@hardkas/core 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.
- package/dist/index.d.ts +402 -14
- package/dist/index.js +807 -65
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Lightweight branded/nominal types for domain-critical strings/numbers.
|
|
@@ -70,7 +71,7 @@ declare const asEventId: (id: string) => EventId;
|
|
|
70
71
|
declare const asCorrelationId: (id: string) => CorrelationId;
|
|
71
72
|
declare const asKaspaAddress: (addr: string) => KaspaAddress;
|
|
72
73
|
declare const asRpcEndpointId: (id: string) => RpcEndpointId;
|
|
73
|
-
declare const asNetworkId: (id:
|
|
74
|
+
declare const asNetworkId: <T extends string>(id: T) => Brand<T, "NetworkId">;
|
|
74
75
|
declare const asEventSequence: (seq: number) => EventSequence;
|
|
75
76
|
declare const asDaaScore: (score: number | bigint) => DaaScore;
|
|
76
77
|
|
|
@@ -81,7 +82,7 @@ type EventDomain = "workflow" | "integrity" | "rpc" | "dag" | "replay" | "localn
|
|
|
81
82
|
/**
|
|
82
83
|
* HardKAS Core Event Kinds.
|
|
83
84
|
*/
|
|
84
|
-
type EventKind = "workflow.plan.created" | "workflow.signed" | "workflow.submitted" | "workflow.receipt" | "workflow.started" | "workflow.completed" | "workflow.failed" | "integrity.hash_mismatch" | "integrity.schema_violation" | "integrity.lineage_break" | "integrity.violation" | "dag.conflict" | "dag.displacement" | "dag.sink_moved" | "rpc.health" | "rpc.error" | "rpc.stale" | "replay.divergence" | "replay.verified" | "localnet.started" | "localnet.stopped" | "l2.deposit.planned" | "l2.withdrawal.planned";
|
|
85
|
+
type EventKind = "workflow.plan.created" | "workflow.signed" | "workflow.submitted" | "workflow.receipt" | "workflow.started" | "workflow.completed" | "workflow.failed" | "integrity.hash_mismatch" | "integrity.schema_violation" | "integrity.lineage_break" | "integrity.violation" | "dag.conflict" | "dag.displacement" | "dag.sink_moved" | "rpc.health" | "rpc.error" | "rpc.stale" | "replay.divergence" | "replay.verified" | "localnet.started" | "localnet.stopped" | "l2.deposit.planned" | "l2.withdrawal.planned" | "artifact.written" | "artifact.indexed" | "artifact.corrupted" | "sqlite.commit" | "replay.invalidated" | "replay.completed" | "replay.excluded" | "sse.emitted" | "dashboard.cache_invalidated" | "dashboard.refetch_started" | "dashboard.refetch_completed" | "query_store.sync_started" | "query_store.sync_completed" | "lineage.verification_failed";
|
|
85
86
|
/**
|
|
86
87
|
* Payload mapping for each event kind.
|
|
87
88
|
*/
|
|
@@ -192,6 +193,60 @@ interface EventPayloadByKind {
|
|
|
192
193
|
amount: bigint;
|
|
193
194
|
from: string;
|
|
194
195
|
};
|
|
196
|
+
"artifact.written": {
|
|
197
|
+
artifactId: ArtifactId;
|
|
198
|
+
path: string;
|
|
199
|
+
};
|
|
200
|
+
"artifact.indexed": {
|
|
201
|
+
artifactId: ArtifactId;
|
|
202
|
+
schema: string;
|
|
203
|
+
};
|
|
204
|
+
"artifact.corrupted": {
|
|
205
|
+
artifactId: ArtifactId;
|
|
206
|
+
path: string;
|
|
207
|
+
issue: string;
|
|
208
|
+
};
|
|
209
|
+
"sqlite.commit": {
|
|
210
|
+
transactionId: string;
|
|
211
|
+
rowCount: number;
|
|
212
|
+
};
|
|
213
|
+
"replay.invalidated": {
|
|
214
|
+
artifactId: ArtifactId;
|
|
215
|
+
reason: string;
|
|
216
|
+
};
|
|
217
|
+
"replay.completed": {
|
|
218
|
+
targetArtifactId: ArtifactId;
|
|
219
|
+
success: boolean;
|
|
220
|
+
};
|
|
221
|
+
"replay.excluded": {
|
|
222
|
+
artifactId: ArtifactId;
|
|
223
|
+
reason: string;
|
|
224
|
+
};
|
|
225
|
+
"sse.emitted": {
|
|
226
|
+
eventId: EventId;
|
|
227
|
+
channel: string;
|
|
228
|
+
};
|
|
229
|
+
"dashboard.cache_invalidated": {
|
|
230
|
+
key: string;
|
|
231
|
+
};
|
|
232
|
+
"dashboard.refetch_started": {
|
|
233
|
+
key: string;
|
|
234
|
+
};
|
|
235
|
+
"dashboard.refetch_completed": {
|
|
236
|
+
key: string;
|
|
237
|
+
success: boolean;
|
|
238
|
+
};
|
|
239
|
+
"query_store.sync_started": {
|
|
240
|
+
syncId: string;
|
|
241
|
+
};
|
|
242
|
+
"query_store.sync_completed": {
|
|
243
|
+
syncId: string;
|
|
244
|
+
stats: Record<string, number>;
|
|
245
|
+
};
|
|
246
|
+
"lineage.verification_failed": {
|
|
247
|
+
artifactId: ArtifactId;
|
|
248
|
+
missingParentId: ArtifactId;
|
|
249
|
+
};
|
|
195
250
|
}
|
|
196
251
|
/**
|
|
197
252
|
* Formal Event Envelope (v1).
|
|
@@ -205,7 +260,10 @@ interface EventEnvelope<K extends EventKind = EventKind> {
|
|
|
205
260
|
domain: EventDomain;
|
|
206
261
|
kind: K;
|
|
207
262
|
timestamp: string;
|
|
208
|
-
|
|
263
|
+
emittedAt: string;
|
|
264
|
+
sequenceNumber: EventSequence;
|
|
265
|
+
globalOffset?: number;
|
|
266
|
+
sourceSubsystem: string;
|
|
209
267
|
workflowId: WorkflowId;
|
|
210
268
|
correlationId: CorrelationId;
|
|
211
269
|
causationId?: EventId;
|
|
@@ -256,7 +314,9 @@ declare function createEventEnvelope<K extends EventKind>(params: {
|
|
|
256
314
|
artifactId?: ArtifactId;
|
|
257
315
|
txId?: TxId;
|
|
258
316
|
eventId?: EventId;
|
|
259
|
-
|
|
317
|
+
sequenceNumber: EventSequence;
|
|
318
|
+
globalOffset?: number;
|
|
319
|
+
sourceSubsystem: string;
|
|
260
320
|
}): EventEnvelope<K>;
|
|
261
321
|
/**
|
|
262
322
|
* Lightweight runtime validation for event envelopes.
|
|
@@ -269,6 +329,11 @@ type UnknownEventPayload = {
|
|
|
269
329
|
readonly type: "unknown";
|
|
270
330
|
readonly data: Record<string, unknown>;
|
|
271
331
|
};
|
|
332
|
+
/**
|
|
333
|
+
* Attaches the canonical Event Ledger appender to the core event bus.
|
|
334
|
+
* This guarantees that all formal EventEnvelopes are persisted to events.jsonl.
|
|
335
|
+
*/
|
|
336
|
+
declare function attachLedgerAppender(workspaceRoot: string): () => void;
|
|
272
337
|
|
|
273
338
|
/**
|
|
274
339
|
* @deprecated Use Brand from domain-types.js instead.
|
|
@@ -334,6 +399,37 @@ interface CorruptionIssue {
|
|
|
334
399
|
*/
|
|
335
400
|
declare function formatCorruptionIssue(issue: CorruptionIssue): string;
|
|
336
401
|
|
|
402
|
+
type IntegrityStatus = "verified" | "corrupted" | "invalid_json" | "unknown";
|
|
403
|
+
/**
|
|
404
|
+
* Explains the causal origin and validation state of a derived value.
|
|
405
|
+
*/
|
|
406
|
+
interface StateProvenance {
|
|
407
|
+
/**
|
|
408
|
+
* The architectural authority that asserts this state (e.g. "query-store projection", "filesystem artifact", "memory cache")
|
|
409
|
+
*/
|
|
410
|
+
authority: string;
|
|
411
|
+
/**
|
|
412
|
+
* The source artifact ID from which this state was derived (if applicable)
|
|
413
|
+
*/
|
|
414
|
+
derivedFrom?: ArtifactId;
|
|
415
|
+
/**
|
|
416
|
+
* The absolute or relative file path of the source artifact
|
|
417
|
+
*/
|
|
418
|
+
originalPath?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Current deterministic integrity of the source
|
|
421
|
+
*/
|
|
422
|
+
integrity: IntegrityStatus;
|
|
423
|
+
/**
|
|
424
|
+
* The replay scope indicating where this state is valid (e.g., "local-only", "global")
|
|
425
|
+
*/
|
|
426
|
+
replayScope: "local-only" | "global" | "unknown";
|
|
427
|
+
/**
|
|
428
|
+
* True if this state has been independently verified against network consensus
|
|
429
|
+
*/
|
|
430
|
+
consensusValidated: boolean;
|
|
431
|
+
}
|
|
432
|
+
|
|
337
433
|
/**
|
|
338
434
|
* HardKAS Lock Metadata schema v1
|
|
339
435
|
*/
|
|
@@ -368,6 +464,7 @@ interface AcquireLockArgs {
|
|
|
368
464
|
declare const LOCK_ORDER: string[];
|
|
369
465
|
/**
|
|
370
466
|
* Acquires a named lock for the workspace.
|
|
467
|
+
* Supports automatic stale lock recovery when the holding process is dead.
|
|
371
468
|
*/
|
|
372
469
|
declare function acquireLock(args: AcquireLockArgs): Promise<LockHandle>;
|
|
373
470
|
/**
|
|
@@ -406,16 +503,307 @@ declare function clearLock(rootDir: string, name: string, options?: {
|
|
|
406
503
|
reason?: string;
|
|
407
504
|
};
|
|
408
505
|
|
|
506
|
+
interface StructuralDiff {
|
|
507
|
+
missingArtifacts: string[];
|
|
508
|
+
excludedArtifacts: string[];
|
|
509
|
+
missingProjections: string[];
|
|
510
|
+
}
|
|
511
|
+
interface DeterministicDiff {
|
|
512
|
+
stateRootDiverged: boolean;
|
|
513
|
+
lineageDiverged: boolean;
|
|
514
|
+
graphDiverged: boolean;
|
|
515
|
+
differences: Array<{
|
|
516
|
+
path: string;
|
|
517
|
+
a: any;
|
|
518
|
+
b: any;
|
|
519
|
+
}>;
|
|
520
|
+
}
|
|
521
|
+
interface RuntimeNoiseDiff {
|
|
522
|
+
timestampShifts: Array<{
|
|
523
|
+
path: string;
|
|
524
|
+
shiftMs: number;
|
|
525
|
+
}>;
|
|
526
|
+
eventOrderingShifts: string[];
|
|
527
|
+
metadataDrift: string[];
|
|
528
|
+
}
|
|
529
|
+
interface LayeredReplayDiff {
|
|
530
|
+
schema: "hardkas.replayDiff.v1";
|
|
531
|
+
structural: StructuralDiff;
|
|
532
|
+
deterministic: DeterministicDiff;
|
|
533
|
+
observational: RuntimeNoiseDiff;
|
|
534
|
+
}
|
|
535
|
+
declare function diffReplays(replayA: any, replayB: any): LayeredReplayDiff;
|
|
536
|
+
|
|
537
|
+
interface SnapshotManifest {
|
|
538
|
+
snapshotVersion: number;
|
|
539
|
+
createdAt: string;
|
|
540
|
+
hardkasVersion: string;
|
|
541
|
+
stateAuthority: "filesystem";
|
|
542
|
+
projectionAuthority: "sqlite";
|
|
543
|
+
deterministicScope: "local-only" | "consensus-validated";
|
|
544
|
+
consensusValidated: boolean;
|
|
545
|
+
includedArtifacts: number;
|
|
546
|
+
excludedArtifacts: number;
|
|
547
|
+
corruptedArtifacts: number;
|
|
548
|
+
}
|
|
549
|
+
interface CreateSnapshotOptions {
|
|
550
|
+
hardkasDir: string;
|
|
551
|
+
outputDir: string;
|
|
552
|
+
deterministicScope?: "local-only" | "consensus-validated";
|
|
553
|
+
}
|
|
554
|
+
declare function createSnapshot(options: CreateSnapshotOptions): Promise<SnapshotManifest>;
|
|
555
|
+
declare function readSnapshotManifest(snapshotDir: string): Promise<SnapshotManifest>;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Deterministic comparison utility for cross-platform string sorting.
|
|
559
|
+
* Avoids localeCompare() which is dependent on the host machine's ICU version and OS locale.
|
|
560
|
+
*/
|
|
561
|
+
declare function deterministicCompare(a: string, b: string): number;
|
|
562
|
+
|
|
563
|
+
type TelemetrySubsystem = "lock" | "fs" | "replay" | "normalization" | "query-store" | "lineage" | "projection" | "unknown";
|
|
564
|
+
type AnomalyType = "LOCK_CONTENTION" | "STALE_LOCK_RECOVERY" | "FS_RETRY" | "NORMALIZATION_COLLISION" | "REPLAY_RECONCILIATION" | "EXTERNAL_MUTATION" | "PATH_TRAVERSAL_ATTEMPT" | "ORPHAN_PROJECTION_RECOVERY";
|
|
565
|
+
type Severity = "low" | "medium" | "high" | "critical";
|
|
566
|
+
interface AnomalyEvent {
|
|
567
|
+
timestamp: string;
|
|
568
|
+
seed?: number | undefined;
|
|
569
|
+
caseId?: string | undefined;
|
|
570
|
+
bucket?: string | undefined;
|
|
571
|
+
anomalyType: AnomalyType;
|
|
572
|
+
severity: Severity;
|
|
573
|
+
subsystem: TelemetrySubsystem;
|
|
574
|
+
details: string;
|
|
575
|
+
sandbox?: string | undefined;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
declare class TelemetryManager {
|
|
579
|
+
private rootDir;
|
|
580
|
+
private currentContext;
|
|
581
|
+
private preservedSandboxes;
|
|
582
|
+
constructor(rootDir?: string);
|
|
583
|
+
init(rootDir: string): void;
|
|
584
|
+
setContext(context: {
|
|
585
|
+
seed?: number;
|
|
586
|
+
caseId?: string;
|
|
587
|
+
bucket?: string;
|
|
588
|
+
}): void;
|
|
589
|
+
clearContext(): void;
|
|
590
|
+
getContext(): {
|
|
591
|
+
seed?: number;
|
|
592
|
+
caseId?: string;
|
|
593
|
+
bucket?: string;
|
|
594
|
+
};
|
|
595
|
+
logAnomaly(anomalyType: AnomalyType, severity: Severity, subsystem: TelemetrySubsystem, details: string, sandboxOverride?: string): void;
|
|
596
|
+
shouldPreserveSandbox(sandboxDir: string): boolean;
|
|
597
|
+
}
|
|
598
|
+
declare const telemetryContextStorage: AsyncLocalStorage<TelemetryManager>;
|
|
599
|
+
declare const globalTelemetry: TelemetryManager;
|
|
600
|
+
declare function getTelemetry(): TelemetryManager;
|
|
601
|
+
declare class TelemetryProxy {
|
|
602
|
+
logAnomaly(anomalyType: AnomalyType, severity: Severity, subsystem: TelemetrySubsystem, details: string, sandboxOverride?: string): void;
|
|
603
|
+
init(rootDir: string): void;
|
|
604
|
+
setContext(context: {
|
|
605
|
+
seed?: number;
|
|
606
|
+
caseId?: string;
|
|
607
|
+
bucket?: string;
|
|
608
|
+
}): void;
|
|
609
|
+
clearContext(): void;
|
|
610
|
+
getContext(): {
|
|
611
|
+
seed?: number;
|
|
612
|
+
caseId?: string;
|
|
613
|
+
bucket?: string;
|
|
614
|
+
};
|
|
615
|
+
shouldPreserveSandbox(sandboxDir: string): boolean;
|
|
616
|
+
}
|
|
617
|
+
declare const EnvironmentTelemetry: TelemetryProxy;
|
|
618
|
+
|
|
619
|
+
interface RotationResult {
|
|
620
|
+
rotated: boolean;
|
|
621
|
+
archivePath?: string;
|
|
622
|
+
bytesRotated?: number;
|
|
623
|
+
reason?: string;
|
|
624
|
+
}
|
|
625
|
+
declare class TelemetryRotator {
|
|
626
|
+
private static readonly DEFAULT_MAX_SIZE_BYTES;
|
|
627
|
+
/**
|
|
628
|
+
* Rotates the telemetry stream if it exceeds the maximum size.
|
|
629
|
+
* This is a safe operation that renames the active file to an archive directory.
|
|
630
|
+
*/
|
|
631
|
+
static rotateIfNeeded(rootDir: string, maxSizeBytes?: number): RotationResult;
|
|
632
|
+
/**
|
|
633
|
+
* Forces a rotation regardless of file size.
|
|
634
|
+
*/
|
|
635
|
+
static forceRotate(rootDir: string): RotationResult;
|
|
636
|
+
/**
|
|
637
|
+
* Lists all archived telemetry segments.
|
|
638
|
+
*/
|
|
639
|
+
static listArchivedSegments(rootDir: string): string[];
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
interface DeterministicClock {
|
|
643
|
+
now(): number;
|
|
644
|
+
}
|
|
645
|
+
interface DeterministicRandom {
|
|
646
|
+
next(): number;
|
|
647
|
+
}
|
|
648
|
+
interface IdProvider {
|
|
649
|
+
execution(): string;
|
|
650
|
+
workflow(): string;
|
|
651
|
+
}
|
|
652
|
+
interface RuntimeContext {
|
|
653
|
+
clock: DeterministicClock;
|
|
654
|
+
random: DeterministicRandom;
|
|
655
|
+
ids: IdProvider;
|
|
656
|
+
telemetry: TelemetryManager;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* A default system runtime context (for non-deterministic contexts like dev server or CLI entry points)
|
|
660
|
+
* This should NOT be used directly in pure canonical domain logic (e.g. artifacts, replays).
|
|
661
|
+
*/
|
|
662
|
+
declare const systemRuntimeContext: RuntimeContext;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Formal Artifact Status Lattice
|
|
666
|
+
*
|
|
667
|
+
* UNKNOWN: Unreadable, ambiguous, partially classified, migration-pending states.
|
|
668
|
+
* PROJECTED: An artifact read from disk / state whose truth has not yet been verified.
|
|
669
|
+
* STALE: An artifact whose dependencies/lineage has drifted since it was verified.
|
|
670
|
+
* VERIFIED: Integrity, signature, and internal capability constraints are verified.
|
|
671
|
+
* REPLAY_VERIFIED: Full lineage and determinism verified via an active replay.
|
|
672
|
+
* CORRUPTED: Irreparable semantic or cryptographic corruption detected.
|
|
673
|
+
* QUARANTINED: Corrupted or malicious artifact safely isolated from runtime.
|
|
674
|
+
*/
|
|
675
|
+
type ArtifactStatus = "UNKNOWN" | "PROJECTED" | "STALE" | "VERIFIED" | "REPLAY_VERIFIED" | "CORRUPTED" | "QUARANTINED";
|
|
676
|
+
/**
|
|
677
|
+
* Baseline schema version is 1.
|
|
678
|
+
*/
|
|
679
|
+
type SchemaVersion = 1;
|
|
680
|
+
interface SemanticIdentity {
|
|
681
|
+
/** The unique artifact ID */
|
|
682
|
+
artifactId: string;
|
|
683
|
+
/** The semantic hash of the artifact content */
|
|
684
|
+
semanticHash: string;
|
|
685
|
+
/** Formal schema version */
|
|
686
|
+
schemaVersion: SchemaVersion;
|
|
687
|
+
/** Current status in the lattice */
|
|
688
|
+
status: ArtifactStatus;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Throws a loud runtime error if a transition is invalid.
|
|
693
|
+
* Invariant: `artifact_status_transitions_are_semantically_valid`
|
|
694
|
+
*/
|
|
695
|
+
declare function validateStatusTransition(from: ArtifactStatus, to: ArtifactStatus): void;
|
|
696
|
+
|
|
697
|
+
interface ReplayContext {
|
|
698
|
+
semanticHash: string;
|
|
699
|
+
lineageId: string;
|
|
700
|
+
replayHash: string;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Resolves a canonical artifact.
|
|
704
|
+
* Implicit 'latest' is STRICTLY FORBIDDEN.
|
|
705
|
+
* You must provide an explicit artifactId, lineageId, or semanticHash.
|
|
706
|
+
* Invariant: `canonical_resolution_never_depends_on_implicit_latest`
|
|
707
|
+
*/
|
|
708
|
+
declare function resolveCanonicalArtifact(params: {
|
|
709
|
+
artifactId?: string;
|
|
710
|
+
lineageId?: string;
|
|
711
|
+
semanticHash?: string;
|
|
712
|
+
}): string;
|
|
713
|
+
/**
|
|
714
|
+
* Verifies that the artifact content integrity is valid.
|
|
715
|
+
*/
|
|
716
|
+
declare function verifyArtifactIntegrity(identity: SemanticIdentity, computedHash: string): void;
|
|
717
|
+
/**
|
|
718
|
+
* Verifies the artifact via active replay, isolating it from ambient state.
|
|
719
|
+
* Invariant: `replay_isolated_from_ambient_runtime_state`
|
|
720
|
+
*/
|
|
721
|
+
declare function verifyReplay(identity: SemanticIdentity, replayCtx: ReplayContext): ArtifactStatus;
|
|
722
|
+
declare function verifyProjectionFreshness(identity: SemanticIdentity, currentLineageHead: string): boolean;
|
|
723
|
+
declare function classifyArtifactStatus(identity: SemanticIdentity, isReadable: boolean, isCorrupted: boolean): ArtifactStatus;
|
|
724
|
+
declare function resolveLineage(artifactId: string): string[];
|
|
725
|
+
declare function verifyCapabilityBoundary(identity: SemanticIdentity, capability: string): void;
|
|
726
|
+
|
|
727
|
+
interface MigrationResult {
|
|
728
|
+
migratedIdentity: SemanticIdentity;
|
|
729
|
+
success: boolean;
|
|
730
|
+
error?: string;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Validates that an artifact migration preserves identity and lineage semantics.
|
|
734
|
+
* Invariant: `schema_evolution_preserves_semantic_identity`
|
|
735
|
+
*/
|
|
736
|
+
declare function verifyMigrationIntegrity(preMigration: SemanticIdentity, postMigration: SemanticIdentity): void;
|
|
737
|
+
/**
|
|
738
|
+
* Handles migrating an artifact to a newer schema version.
|
|
739
|
+
* Currently, only schemaVersion: 1 exists as the baseline.
|
|
740
|
+
*/
|
|
741
|
+
declare function migrateArtifact(identity: SemanticIdentity, targetVersion: SchemaVersion): MigrationResult;
|
|
742
|
+
/**
|
|
743
|
+
* Compares lineage before and after migration to ensure continuity.
|
|
744
|
+
*/
|
|
745
|
+
declare function comparePrePostMigrationLineage(preLineageId: string, postLineageId: string): void;
|
|
746
|
+
|
|
747
|
+
interface SemanticDriftReport {
|
|
748
|
+
hasDrift: boolean;
|
|
749
|
+
conflictingSubsystem?: string;
|
|
750
|
+
exactReplayCommand?: string;
|
|
751
|
+
severity: "NONE" | "CRITICAL";
|
|
752
|
+
details?: string;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Compares the truth across different subsystems.
|
|
756
|
+
* If multiple subsystems disagree about truth, that is a CRITICAL semantic failure.
|
|
757
|
+
* Invariant: `subsystems_cannot_disagree_about_canonical_truth`
|
|
758
|
+
*/
|
|
759
|
+
declare function detectSemanticDrift(dashboardView: SemanticIdentity, queryStoreView: SemanticIdentity, replayView: SemanticIdentity, filesystemView: SemanticIdentity): SemanticDriftReport;
|
|
760
|
+
/**
|
|
761
|
+
* Asserts no semantic drift exists. Fails loudly.
|
|
762
|
+
*/
|
|
763
|
+
declare function assertNoSemanticDrift(dashboardView: SemanticIdentity, queryStoreView: SemanticIdentity, replayView: SemanticIdentity, filesystemView: SemanticIdentity): void;
|
|
764
|
+
|
|
765
|
+
declare class AppendCoordinator {
|
|
766
|
+
/**
|
|
767
|
+
* Safely appends a line to a JSONL log under process coordination locks.
|
|
768
|
+
* Performs an immediate fsync to ensure data durability.
|
|
769
|
+
* Also repairs the trailing line if it is corrupted, emitting an anomaly.
|
|
770
|
+
*/
|
|
771
|
+
static appendAtomic(filePath: string, line: string, rootDir: string): void;
|
|
772
|
+
/**
|
|
773
|
+
* Scans a JSONL stream for corruption, truncating malformed trailing lines.
|
|
774
|
+
*/
|
|
775
|
+
static recoverCorruptedTail(filePath: string): {
|
|
776
|
+
repaired: boolean;
|
|
777
|
+
linesDiscarded: number;
|
|
778
|
+
originalTail: string;
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
declare const CURRENT_RUNTIME_VERSION = "0.6.1-alpha";
|
|
783
|
+
declare const MIN_SUPPORTED_VERSION = "0.5.0-alpha";
|
|
784
|
+
interface MigrationStatus {
|
|
785
|
+
needsMigration: boolean;
|
|
786
|
+
canDowngrade: boolean;
|
|
787
|
+
currentVersion: string;
|
|
788
|
+
}
|
|
789
|
+
declare class MigrationManager {
|
|
790
|
+
static checkVersion(rootDir: string): MigrationStatus;
|
|
791
|
+
static migrate(rootDir: string, dryRun?: boolean): void;
|
|
792
|
+
private static writeVersion;
|
|
793
|
+
private static backupWorkspace;
|
|
794
|
+
private static compareSemver;
|
|
795
|
+
}
|
|
796
|
+
|
|
409
797
|
declare const SOMPI_PER_KAS = 100000000n;
|
|
410
|
-
declare const kaspaNetworkIdSchema: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
798
|
+
declare const kaspaNetworkIdSchema: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
411
799
|
type NetworkId = Brand<z.infer<typeof kaspaNetworkIdSchema>, "NetworkId">;
|
|
412
800
|
declare const executionModeSchema: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
413
801
|
type ExecutionMode = z.infer<typeof executionModeSchema>;
|
|
414
|
-
declare const artifactTypeSchema: z.ZodEnum<["txPlan", "signedTx", "txReceipt", "txTrace", "snapshot"]>;
|
|
802
|
+
declare const artifactTypeSchema: z.ZodEnum<["txPlan", "signedTx", "txReceipt", "txTrace", "snapshot", "workflow.v1"]>;
|
|
415
803
|
type ArtifactType = z.infer<typeof artifactTypeSchema>;
|
|
416
|
-
declare const NetworkIdSchema: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
804
|
+
declare const NetworkIdSchema: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
417
805
|
declare const ExecutionModeSchema: z.ZodEnum<["simulated", "real", "readonly"]>;
|
|
418
|
-
declare const ArtifactTypeSchema: z.ZodEnum<["txPlan", "signedTx", "txReceipt", "txTrace", "snapshot"]>;
|
|
806
|
+
declare const ArtifactTypeSchema: z.ZodEnum<["txPlan", "signedTx", "txReceipt", "txTrace", "snapshot", "workflow.v1"]>;
|
|
419
807
|
declare const hardkasConfigSchema: z.ZodObject<{
|
|
420
808
|
project: z.ZodObject<{
|
|
421
809
|
name: z.ZodString;
|
|
@@ -428,13 +816,13 @@ declare const hardkasConfigSchema: z.ZodObject<{
|
|
|
428
816
|
root: string;
|
|
429
817
|
}>;
|
|
430
818
|
network: z.ZodObject<{
|
|
431
|
-
id: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet"]>;
|
|
819
|
+
id: z.ZodEnum<["mainnet", "testnet-10", "testnet-11", "testnet-12", "simnet", "simnet-1", "devnet", "simulated"]>;
|
|
432
820
|
rpcUrl: z.ZodOptional<z.ZodString>;
|
|
433
821
|
}, "strip", z.ZodTypeAny, {
|
|
434
|
-
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
822
|
+
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet" | "simulated";
|
|
435
823
|
rpcUrl?: string | undefined;
|
|
436
824
|
}, {
|
|
437
|
-
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
825
|
+
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet" | "simulated";
|
|
438
826
|
rpcUrl?: string | undefined;
|
|
439
827
|
}>;
|
|
440
828
|
localnet: z.ZodDefault<z.ZodObject<{
|
|
@@ -453,7 +841,7 @@ declare const hardkasConfigSchema: z.ZodObject<{
|
|
|
453
841
|
root: string;
|
|
454
842
|
};
|
|
455
843
|
network: {
|
|
456
|
-
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
844
|
+
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet" | "simulated";
|
|
457
845
|
rpcUrl?: string | undefined;
|
|
458
846
|
};
|
|
459
847
|
localnet: {
|
|
@@ -466,7 +854,7 @@ declare const hardkasConfigSchema: z.ZodObject<{
|
|
|
466
854
|
root: string;
|
|
467
855
|
};
|
|
468
856
|
network: {
|
|
469
|
-
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet";
|
|
857
|
+
id: "mainnet" | "testnet-10" | "testnet-11" | "testnet-12" | "simnet" | "simnet-1" | "devnet" | "simulated";
|
|
470
858
|
rpcUrl?: string | undefined;
|
|
471
859
|
};
|
|
472
860
|
localnet?: {
|
|
@@ -496,4 +884,4 @@ declare function parseHardkasConfig(input: unknown): HardkasConfig;
|
|
|
496
884
|
declare function parseKasToSompi(input: string): bigint;
|
|
497
885
|
declare function formatSompi(amountSompi: bigint): string;
|
|
498
886
|
|
|
499
|
-
export { type AcquireLockArgs, type ArtifactId, type ArtifactType, ArtifactTypeSchema, type Brand, type Branded, type ContentHash, type CoreEvent, type CoreEventListener, type CorrelationId, type CorruptionCode, type CorruptionIssue, type CorruptionSeverity, type DaaScore, type EventDomain, type EventEnvelope, type EventId, type EventKind, type EventPayloadByKind, type EventSequence, type ExecutionMode, ExecutionModeSchema, type HardkasConfig, HardkasError, type InvariantDomain, type InvariantSeverity, InvariantViolationError, type KaspaAddress, LOCK_ORDER, type LineageId, type LockHandle, type LockMetadata, type NetworkId, NetworkIdSchema, type RpcEndpointId, SOMPI_PER_KAS, type StampedEvent, type TxId, type UnknownEventPayload, type WorkflowId, type WriteFileAtomicOptions, acquireLock, artifactTypeSchema, asArtifactId, asContentHash, asCorrelationId, asDaaScore, asEventId, asEventSequence, asKaspaAddress, asLineageId, asNetworkId, asRpcEndpointId, asTxId, asWorkflowId, clearLock, coreEvents, createEventEnvelope, executionModeSchema, formatCorruptionIssue, formatSompi, hardkasConfigSchema, isProcessAlive, kaspaNetworkIdSchema, listLocks, maskSecrets, parseHardkasConfig, parseKasToSompi, redactSecret, validateEventEnvelope, withLock, withLocks, writeFileAtomic, writeFileAtomicSync };
|
|
887
|
+
export { type AcquireLockArgs, type AnomalyEvent, type AnomalyType, AppendCoordinator, type ArtifactId, type ArtifactStatus, type ArtifactType, ArtifactTypeSchema, type Brand, type Branded, CURRENT_RUNTIME_VERSION, type ContentHash, type CoreEvent, type CoreEventListener, type CorrelationId, type CorruptionCode, type CorruptionIssue, type CorruptionSeverity, type CreateSnapshotOptions, type DaaScore, type DeterministicClock, type DeterministicDiff, type DeterministicRandom, EnvironmentTelemetry, type EventDomain, type EventEnvelope, type EventId, type EventKind, type EventPayloadByKind, type EventSequence, type ExecutionMode, ExecutionModeSchema, type HardkasConfig, HardkasError, type IdProvider, type IntegrityStatus, type InvariantDomain, type InvariantSeverity, InvariantViolationError, type KaspaAddress, LOCK_ORDER, type LayeredReplayDiff, type LineageId, type LockHandle, type LockMetadata, MIN_SUPPORTED_VERSION, MigrationManager, type MigrationResult, type MigrationStatus, type NetworkId, NetworkIdSchema, type ReplayContext, type RpcEndpointId, type RuntimeContext, type RuntimeNoiseDiff, SOMPI_PER_KAS, type SchemaVersion, type SemanticDriftReport, type SemanticIdentity, type Severity, type SnapshotManifest, type StampedEvent, type StateProvenance, type StructuralDiff, TelemetryManager, TelemetryRotator, type TelemetrySubsystem, type TxId, type UnknownEventPayload, type WorkflowId, type WriteFileAtomicOptions, acquireLock, artifactTypeSchema, asArtifactId, asContentHash, asCorrelationId, asDaaScore, asEventId, asEventSequence, asKaspaAddress, asLineageId, asNetworkId, asRpcEndpointId, asTxId, asWorkflowId, assertNoSemanticDrift, attachLedgerAppender, classifyArtifactStatus, clearLock, comparePrePostMigrationLineage, coreEvents, createEventEnvelope, createSnapshot, detectSemanticDrift, deterministicCompare, diffReplays, executionModeSchema, formatCorruptionIssue, formatSompi, getTelemetry, globalTelemetry, hardkasConfigSchema, isProcessAlive, kaspaNetworkIdSchema, listLocks, maskSecrets, migrateArtifact, parseHardkasConfig, parseKasToSompi, readSnapshotManifest, redactSecret, resolveCanonicalArtifact, resolveLineage, systemRuntimeContext, telemetryContextStorage, validateEventEnvelope, validateStatusTransition, verifyArtifactIntegrity, verifyCapabilityBoundary, verifyMigrationIntegrity, verifyProjectionFreshness, verifyReplay, withLock, withLocks, writeFileAtomic, writeFileAtomicSync };
|