@aikdna/kdna-core 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +136 -94
- package/README.md +109 -215
- package/package.json +7 -2
- package/schema/agent-host-capabilities.schema.json +62 -0
- package/schema/agent-host-receipt.schema.json +371 -0
- package/schema/agent-host-request.schema.json +223 -0
- package/schema/{bundle-profile-v1.schema.json → bundle-profile.schema.json} +9 -5
- package/schema/checksums.schema.json +8 -8
- package/schema/consumption-plan.schema.json +428 -0
- package/schema/digest-evidence.schema.json +115 -26
- package/schema/{kdna-envelope-external-grant-v1.schema.json → external-grant-envelope.schema.json} +17 -4
- package/schema/{kdna-key-grant-v1.schema.json → external-key-grant.schema.json} +39 -7
- package/schema/judgment-trace.schema.json +1251 -0
- package/schema/load-plan.schema.json +5 -3
- package/schema/manifest.schema.json +78 -10
- package/schema/{payload-profile-v1.schema.json → payload-profile.schema.json} +30 -6
- package/schema/{runtime-capsule-2.schema.json → runtime-capsule.schema.json} +7 -33
- package/src/asset-reader.js +8 -2
- package/src/{v1 → container}/index.js +385 -198
- package/src/container/index.mjs +20 -0
- package/src/container-dispatcher.js +6 -6
- package/src/crypto-profile.js +37 -107
- package/src/external-key-grant.js +41 -15
- package/src/index.js +11 -8
- package/src/index.mjs +49 -45
- package/src/loader-compatibility.js +59 -0
- package/src/loader.js +1 -1
- package/src/public-api.js +5 -5
- package/src/remote-runtime.d.ts +13 -0
- package/src/remote-runtime.js +27 -0
- package/src/remote-runtime.mjs +3 -0
- package/src/runtime-api.js +5 -5
- package/src/{capsule-v2.js → runtime-capsule.js} +95 -254
- package/src/{execution-contract-v1.js → runtime-contract.js} +184 -152
- package/src/types.d.ts +200 -278
- package/src/workpack-pure.js +1 -1
- package/schema/agent-host-2-receipt.schema.json +0 -206
- package/schema/agent-host-2-request.schema.json +0 -135
- package/schema/agent-host-capabilities-1.schema.json +0 -40
- package/schema/consumption-plan-1.schema.json +0 -280
- package/schema/judgment-trace-1.schema.json +0 -748
- package/schema/runtime-capsule-1.schema.json +0 -68
- package/src/lint-pure.js +0 -433
- package/src/v1/index.mjs +0 -21
package/src/types.d.ts
CHANGED
|
@@ -198,7 +198,7 @@ export interface KDNAFileDataMap {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
export interface KDNAManifest {
|
|
201
|
-
|
|
201
|
+
format_version: '0.1.0';
|
|
202
202
|
asset_id: string;
|
|
203
203
|
asset_uid: string;
|
|
204
204
|
asset_type: 'domain' | 'cluster' | 'tool' | 'sample' | 'fixture' | 'bundle';
|
|
@@ -209,7 +209,8 @@ export interface KDNAManifest {
|
|
|
209
209
|
updated_at: string;
|
|
210
210
|
compatibility: {
|
|
211
211
|
min_loader_version: string;
|
|
212
|
-
profile: 'judgment
|
|
212
|
+
profile: 'kdna.payload.judgment' | 'kdna.payload.bundle';
|
|
213
|
+
profile_version: '0.1.0';
|
|
213
214
|
[key: string]: any;
|
|
214
215
|
};
|
|
215
216
|
payload: {
|
|
@@ -238,20 +239,11 @@ export interface KDNAManifest {
|
|
|
238
239
|
encrypted_entries?: string[];
|
|
239
240
|
[key: string]: any;
|
|
240
241
|
};
|
|
241
|
-
/** @deprecated Legacy source/signature compatibility only. */
|
|
242
|
-
name?: string;
|
|
243
|
-
/** @deprecated Legacy source/signature compatibility only. */
|
|
244
|
-
author?: { name: string; id?: string; pubkey?: string; public_key_pem?: string };
|
|
245
242
|
content_digest?: string;
|
|
246
243
|
signature?: string;
|
|
247
244
|
[key: string]: any;
|
|
248
245
|
}
|
|
249
246
|
|
|
250
|
-
export interface LintResult {
|
|
251
|
-
errors: string[];
|
|
252
|
-
warnings: string[];
|
|
253
|
-
}
|
|
254
|
-
|
|
255
247
|
export interface ValidationResult {
|
|
256
248
|
valid: boolean;
|
|
257
249
|
errors: string[];
|
|
@@ -382,21 +374,21 @@ export interface KdnaDecryptOptions {
|
|
|
382
374
|
|
|
383
375
|
export function createKdnaAssetReader(): KdnaAssetReader;
|
|
384
376
|
|
|
385
|
-
export const LICENSED_ENTRY_PROFILE: 'kdna
|
|
386
|
-
export const
|
|
387
|
-
export const
|
|
388
|
-
export const
|
|
377
|
+
export const LICENSED_ENTRY_PROFILE: 'kdna.encryption.licensed-entry';
|
|
378
|
+
export const PASSWORD_PROTECTED_PROFILE: 'kdna.encryption.password';
|
|
379
|
+
export const PASSWORD_PROTECTED_SCRYPT_PROFILE: 'kdna.encryption.password.scrypt';
|
|
380
|
+
export const ENCRYPTION_PROFILE_VERSION: '0.1.0';
|
|
389
381
|
export const ALG: 'AES-256-GCM';
|
|
390
382
|
export const RFC_KDF: 'HKDF-SHA256';
|
|
391
383
|
export const RFC_KEY_WRAPPING: 'AES-256-KW';
|
|
392
|
-
export const LEGACY_KDF: 'scrypt-sha256';
|
|
393
384
|
export const PASSWORD_KDF: 'Argon2id';
|
|
394
385
|
export const SCRYPT_KDF: 'scrypt-sha256';
|
|
395
386
|
|
|
396
387
|
export type KDNACryptoInput = string | Uint8Array;
|
|
397
388
|
|
|
398
389
|
export interface LicensedEntryEnvelope {
|
|
399
|
-
profile: 'kdna
|
|
390
|
+
profile: 'kdna.encryption.licensed-entry';
|
|
391
|
+
profile_version: '0.1.0';
|
|
400
392
|
alg: 'AES-256-GCM';
|
|
401
393
|
kdf: 'HKDF-SHA256';
|
|
402
394
|
key_wrapping: 'AES-256-KW';
|
|
@@ -406,16 +398,6 @@ export interface LicensedEntryEnvelope {
|
|
|
406
398
|
ciphertext: string;
|
|
407
399
|
}
|
|
408
400
|
|
|
409
|
-
export interface LicensedEntryLegacyEnvelope {
|
|
410
|
-
profile: 'kdna-licensed-entry-experimental';
|
|
411
|
-
alg: 'AES-256-GCM';
|
|
412
|
-
kdf: 'scrypt-sha256';
|
|
413
|
-
salt: string;
|
|
414
|
-
iv: string;
|
|
415
|
-
tag: string;
|
|
416
|
-
ciphertext: string;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
401
|
export interface KDNAPasswordKdfParams {
|
|
420
402
|
salt: string;
|
|
421
403
|
memory_kib?: number;
|
|
@@ -439,7 +421,8 @@ export interface KDNAScryptKdfParams {
|
|
|
439
421
|
}
|
|
440
422
|
|
|
441
423
|
export interface KDNAProtectedEntryEnvelope {
|
|
442
|
-
profile: 'kdna
|
|
424
|
+
profile: 'kdna.encryption.password';
|
|
425
|
+
profile_version: '0.1.0';
|
|
443
426
|
alg: 'AES-256-GCM';
|
|
444
427
|
kdf: 'Argon2id';
|
|
445
428
|
key_wrapping: 'AES-256-KW';
|
|
@@ -455,7 +438,8 @@ export interface KDNAProtectedEntryEnvelope {
|
|
|
455
438
|
}
|
|
456
439
|
|
|
457
440
|
export interface KDNAScryptProtectedEntryEnvelope {
|
|
458
|
-
profile: 'kdna
|
|
441
|
+
profile: 'kdna.encryption.password.scrypt';
|
|
442
|
+
profile_version: '0.1.0';
|
|
459
443
|
alg: 'AES-256-GCM';
|
|
460
444
|
kdf: 'scrypt-sha256';
|
|
461
445
|
key_wrapping: 'AES-256-KW';
|
|
@@ -476,17 +460,6 @@ export interface KDNALicensedEntryOptions {
|
|
|
476
460
|
licenseKey: KDNACryptoInput;
|
|
477
461
|
}
|
|
478
462
|
|
|
479
|
-
export interface KDNALicensedEntryLegacyOptions extends KDNALicensedEntryOptions {
|
|
480
|
-
machineFingerprint: string;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
export function deriveLicensedEntryKey(options: {
|
|
484
|
-
licenseKey: string;
|
|
485
|
-
machineFingerprint: string;
|
|
486
|
-
salt: string | Uint8Array;
|
|
487
|
-
keyLength?: number;
|
|
488
|
-
}): Uint8Array;
|
|
489
|
-
|
|
490
463
|
export function hkdfSha256(
|
|
491
464
|
ikm: KDNACryptoInput,
|
|
492
465
|
salt?: Uint8Array | null,
|
|
@@ -500,11 +473,11 @@ export function generateCEK(): Uint8Array;
|
|
|
500
473
|
export function wrapCEK(cek: Uint8Array, wrappingKey: Uint8Array): Uint8Array;
|
|
501
474
|
export function unwrapCEK(wrappedCek: Uint8Array, wrappingKey: Uint8Array): Uint8Array;
|
|
502
475
|
|
|
503
|
-
export function
|
|
476
|
+
export function encryptLicensedEntry(
|
|
504
477
|
plaintext: KDNACryptoInput,
|
|
505
478
|
options: KDNALicensedEntryOptions,
|
|
506
479
|
): LicensedEntryEnvelope;
|
|
507
|
-
export function
|
|
480
|
+
export function decryptLicensedEntry(
|
|
508
481
|
envelope: KDNACryptoInput | LicensedEntryEnvelope,
|
|
509
482
|
options: KDNALicensedEntryOptions,
|
|
510
483
|
): Uint8Array;
|
|
@@ -563,53 +536,23 @@ export function decryptProtectedEntryScrypt(
|
|
|
563
536
|
export function createPasswordDecryptEntryScrypt(options: {
|
|
564
537
|
password: KDNACryptoInput;
|
|
565
538
|
}): NonNullable<KdnaDecryptOptions['decryptEntry']>;
|
|
566
|
-
export function encryptLicensedEntryLegacy(
|
|
567
|
-
plaintext: KDNACryptoInput,
|
|
568
|
-
options: KDNALicensedEntryLegacyOptions,
|
|
569
|
-
): LicensedEntryLegacyEnvelope;
|
|
570
|
-
export function decryptLicensedEntryLegacy(
|
|
571
|
-
envelope: KDNACryptoInput | LicensedEntryLegacyEnvelope,
|
|
572
|
-
options: KDNALicensedEntryLegacyOptions,
|
|
573
|
-
): Uint8Array;
|
|
574
|
-
|
|
575
|
-
export function encryptLicensedEntry(
|
|
576
|
-
plaintext: string | Uint8Array,
|
|
577
|
-
options: KDNALicensedEntryOptions,
|
|
578
|
-
): LicensedEntryEnvelope;
|
|
579
|
-
|
|
580
|
-
export function decryptLicensedEntry(
|
|
581
|
-
envelope: LicensedEntryEnvelope,
|
|
582
|
-
options: KDNALicensedEntryOptions,
|
|
583
|
-
): Uint8Array;
|
|
584
|
-
export function decryptLicensedEntry(
|
|
585
|
-
envelope: LicensedEntryLegacyEnvelope,
|
|
586
|
-
options: KDNALicensedEntryLegacyOptions,
|
|
587
|
-
): Uint8Array;
|
|
588
|
-
export function decryptLicensedEntry(
|
|
589
|
-
envelope: KDNACryptoInput,
|
|
590
|
-
options: KDNALicensedEntryLegacyOptions,
|
|
591
|
-
): Uint8Array;
|
|
592
|
-
export function decryptLicensedEntry(
|
|
593
|
-
envelope: KDNACryptoInput | LicensedEntryEnvelope | LicensedEntryLegacyEnvelope,
|
|
594
|
-
options: KDNALicensedEntryLegacyOptions,
|
|
595
|
-
): Uint8Array;
|
|
596
|
-
|
|
597
539
|
export function createLicensedDecryptEntry(options: {
|
|
598
540
|
licenseKey: KDNACryptoInput;
|
|
599
|
-
machineFingerprint?: string;
|
|
600
541
|
}): NonNullable<KdnaDecryptOptions['decryptEntry']>;
|
|
601
542
|
|
|
602
|
-
export const EXTERNAL_ENVELOPE_PROFILE: 'kdna
|
|
603
|
-
export const EXTERNAL_GRANT_PROFILE: 'kdna-key
|
|
604
|
-
export const EXTERNAL_AAD_PROFILE: 'kdna-
|
|
605
|
-
export const DEVICE_KEK_PROFILE: 'kdna-device-grant
|
|
543
|
+
export const EXTERNAL_ENVELOPE_PROFILE: 'kdna.envelope.external-grant';
|
|
544
|
+
export const EXTERNAL_GRANT_PROFILE: 'kdna.grant.external-key';
|
|
545
|
+
export const EXTERNAL_AAD_PROFILE: 'kdna.key-context.asset-content';
|
|
546
|
+
export const DEVICE_KEK_PROFILE: 'kdna.key-context.device-grant';
|
|
547
|
+
export const EXTERNAL_GRANT_CONTRACT_VERSION: '0.1.0';
|
|
606
548
|
|
|
607
549
|
export class KDNAExternalGrantError extends Error {
|
|
608
550
|
code: string;
|
|
609
551
|
}
|
|
610
552
|
|
|
611
553
|
export interface KDNAExternalGrantEnvelope {
|
|
612
|
-
profile: 'kdna
|
|
554
|
+
profile: 'kdna.envelope.external-grant';
|
|
555
|
+
contract_version: '0.1.0';
|
|
613
556
|
alg: 'A256GCM';
|
|
614
557
|
cek_derivation: 'HKDF-SHA256';
|
|
615
558
|
key_ref: string;
|
|
@@ -622,7 +565,8 @@ export interface KDNAExternalGrantEnvelope {
|
|
|
622
565
|
}
|
|
623
566
|
|
|
624
567
|
export interface KDNAExternalKeyGrant {
|
|
625
|
-
profile: 'kdna-key
|
|
568
|
+
profile: 'kdna.grant.external-key';
|
|
569
|
+
contract_version: '0.1.0';
|
|
626
570
|
grant_id: string;
|
|
627
571
|
issuer: string;
|
|
628
572
|
signing_key_id: string;
|
|
@@ -664,7 +608,7 @@ export interface KDNADeviceKeyPairs {
|
|
|
664
608
|
/** Runtime-branded by authorizeExternalKeyGrant; a structurally similar object is not accepted. */
|
|
665
609
|
export interface KDNAVerifiedExternalEntitlement {
|
|
666
610
|
readonly status: 'active' | 'offline_grace';
|
|
667
|
-
readonly profile: 'kdna-key
|
|
611
|
+
readonly profile: 'kdna.grant.external-key';
|
|
668
612
|
readonly grant_id: string;
|
|
669
613
|
readonly entitlement_id: string;
|
|
670
614
|
readonly account_id: string;
|
|
@@ -754,7 +698,8 @@ export function authorizeExternalKeyGrant(options: {
|
|
|
754
698
|
grant: KDNAExternalKeyGrant;
|
|
755
699
|
issuerPublicKeys: Map<string, unknown> | Record<string, unknown>;
|
|
756
700
|
manifest: KDNAManifest;
|
|
757
|
-
checksums
|
|
701
|
+
/** Final immutable container digest A; never checksums entry-set digest E. */
|
|
702
|
+
expectedAssetDigest: string;
|
|
758
703
|
envelope: KDNAExternalGrantEnvelope | Uint8Array;
|
|
759
704
|
deviceAgreementKey: KDNADeviceKeyPairs['agreement'] | unknown;
|
|
760
705
|
expectedAccountId: string;
|
|
@@ -773,7 +718,7 @@ export function isVerifiedExternalEntitlement(
|
|
|
773
718
|
export type KDNAAssetInput = string | Uint8Array | KdnaAsset;
|
|
774
719
|
|
|
775
720
|
export interface KDNAInspectResult {
|
|
776
|
-
|
|
721
|
+
format_version: '0.1.0' | null;
|
|
777
722
|
asset_id: string | null;
|
|
778
723
|
asset_uid: string | null;
|
|
779
724
|
asset_type: string | null;
|
|
@@ -783,6 +728,9 @@ export interface KDNAInspectResult {
|
|
|
783
728
|
payload: string | null;
|
|
784
729
|
payload_encrypted: boolean | null;
|
|
785
730
|
profile: string | null;
|
|
731
|
+
loader_version: string;
|
|
732
|
+
min_loader_version: string | null;
|
|
733
|
+
loader_compatible: boolean | null;
|
|
786
734
|
load_contract_default_profile: string | null;
|
|
787
735
|
checksums_present?: boolean;
|
|
788
736
|
entries: string[];
|
|
@@ -801,36 +749,13 @@ export interface KDNAValidationReport {
|
|
|
801
749
|
payload_valid: boolean;
|
|
802
750
|
checksums_valid: boolean;
|
|
803
751
|
load_contract_valid: boolean;
|
|
752
|
+
loader_version: string;
|
|
753
|
+
min_loader_version: string | null;
|
|
754
|
+
loader_compatible: boolean | null;
|
|
804
755
|
overall_valid: boolean;
|
|
805
756
|
problems: string[];
|
|
806
757
|
}
|
|
807
758
|
|
|
808
|
-
export interface KDNARuntimeCapsule {
|
|
809
|
-
type: 'kdna.context.capsule';
|
|
810
|
-
version: '1.0';
|
|
811
|
-
domain: string | null;
|
|
812
|
-
judgment_version: string | null;
|
|
813
|
-
asset_digest: string;
|
|
814
|
-
signature: { state: 'verified' | 'not_checked' | 'absent'; issuer?: string };
|
|
815
|
-
access: string;
|
|
816
|
-
risk_level: string | null;
|
|
817
|
-
profile: string;
|
|
818
|
-
context: Record<string, any>;
|
|
819
|
-
trace: Record<string, any>;
|
|
820
|
-
extends_chain?: Array<Record<string, any>>;
|
|
821
|
-
inheritance_applied?: boolean;
|
|
822
|
-
resolved_dependencies?: Array<Record<string, any>>;
|
|
823
|
-
rag_isolation_policy?: Record<string, any>;
|
|
824
|
-
[key: string]: any;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
export interface KDNACapsule1Extensions {
|
|
828
|
-
extends_chain?: Array<Record<string, any>>;
|
|
829
|
-
inheritance_applied?: boolean;
|
|
830
|
-
resolved_dependencies?: Array<Record<string, any>>;
|
|
831
|
-
rag_isolation_policy?: Record<string, any>;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
759
|
export type KDNADigestComparisonState = 'matched' | 'mismatched' | 'not_compared' | 'unavailable';
|
|
835
760
|
|
|
836
761
|
export type KDNADigestComparisonSource =
|
|
@@ -840,8 +765,7 @@ export type KDNADigestComparisonSource =
|
|
|
840
765
|
| 'lockfile'
|
|
841
766
|
| 'kdna.json.content_digest'
|
|
842
767
|
| 'kdna.json.authoring.content_digest'
|
|
843
|
-
| 'checksums.json.entry_set_digest'
|
|
844
|
-
| 'checksums.json.asset_digest';
|
|
768
|
+
| 'checksums.json.entry_set_digest';
|
|
845
769
|
|
|
846
770
|
export interface KDNADigestComparison {
|
|
847
771
|
state: KDNADigestComparisonState;
|
|
@@ -857,15 +781,16 @@ export interface KDNADigestValue {
|
|
|
857
781
|
}
|
|
858
782
|
|
|
859
783
|
export interface KDNADigestEvidence {
|
|
860
|
-
profile: 'kdna-
|
|
784
|
+
profile: 'kdna.digest-evidence';
|
|
785
|
+
profile_version: '0.1.0';
|
|
861
786
|
asset: KDNADigestValue;
|
|
862
787
|
content: KDNADigestValue;
|
|
863
788
|
runtime_entry_set: KDNADigestValue;
|
|
864
789
|
}
|
|
865
790
|
|
|
866
|
-
export interface
|
|
867
|
-
type: 'kdna.
|
|
868
|
-
|
|
791
|
+
export interface KDNARuntimeCapsule {
|
|
792
|
+
type: 'kdna.runtime-capsule';
|
|
793
|
+
contract_version: '0.1.0';
|
|
869
794
|
asset: {
|
|
870
795
|
asset_id: string;
|
|
871
796
|
asset_uid: string;
|
|
@@ -875,7 +800,6 @@ export interface KDNARuntimeCapsuleV2 {
|
|
|
875
800
|
digests: KDNADigestEvidence;
|
|
876
801
|
signature: { state: 'verified' | 'not_checked' | 'absent'; issuer?: string };
|
|
877
802
|
access: 'public' | 'licensed' | 'remote';
|
|
878
|
-
risk_level: string | null;
|
|
879
803
|
profile: 'index' | 'compact' | 'scenario' | 'full';
|
|
880
804
|
context: Record<string, any>;
|
|
881
805
|
trace: {
|
|
@@ -888,19 +812,17 @@ export interface KDNARuntimeCapsuleV2 {
|
|
|
888
812
|
signature_state: 'verified' | 'not_checked' | 'absent';
|
|
889
813
|
profile: 'index' | 'compact' | 'scenario' | 'full';
|
|
890
814
|
};
|
|
891
|
-
compatibility?: {
|
|
892
|
-
capsule_1_domain?: string;
|
|
893
|
-
capsule_1_access?: 'open' | 'protected' | 'runtime';
|
|
894
|
-
capsule_1_extensions?: KDNACapsule1Extensions;
|
|
895
|
-
};
|
|
896
815
|
}
|
|
897
816
|
|
|
898
|
-
export const DIGEST_PROFILE: 'kdna-
|
|
899
|
-
export const
|
|
817
|
+
export const DIGEST_PROFILE: 'kdna.digest-evidence';
|
|
818
|
+
export const DIGEST_PROFILE_VERSION: '0.1.0';
|
|
819
|
+
export const CAPSULE_DIGEST_PROFILE: 'kdna.canonicalization.runtime-capsule-jcs';
|
|
820
|
+
export const CANONICALIZATION_PROFILE_VERSION: '0.1.0';
|
|
821
|
+
export const RUNTIME_CAPSULE_CONTRACT_VERSION: '0.1.0';
|
|
900
822
|
export const BASIS: Readonly<{
|
|
901
|
-
asset: 'kdna-container-bytes
|
|
902
|
-
content: 'kdna-content-tree
|
|
903
|
-
runtime_entry_set: 'kdna-runtime-entry-set
|
|
823
|
+
asset: 'kdna.digest-basis.container-bytes';
|
|
824
|
+
content: 'kdna.digest-basis.content-tree';
|
|
825
|
+
runtime_entry_set: 'kdna.digest-basis.runtime-entry-set';
|
|
904
826
|
}>;
|
|
905
827
|
export function computeAssetDigest(assetBytes: Uint8Array): string;
|
|
906
828
|
export function computeRuntimeEntrySetDigest(
|
|
@@ -920,23 +842,22 @@ export function computeDigestEvidence(
|
|
|
920
842
|
}
|
|
921
843
|
>
|
|
922
844
|
>;
|
|
923
|
-
/** @deprecated Use expectedDigests.asset. */
|
|
924
|
-
expectedAssetDigest?:
|
|
925
|
-
string | { value: string; source: 'caller' | 'registry' | 'install_receipt' | 'lockfile' };
|
|
926
845
|
},
|
|
927
846
|
): KDNADigestEvidence;
|
|
928
847
|
export function canonicalizeJcs(value: unknown): string;
|
|
929
848
|
export function computeCapsuleDeliveryDigest(
|
|
930
|
-
capsule:
|
|
849
|
+
capsule: KDNARuntimeCapsule | Record<string, any>,
|
|
931
850
|
): string;
|
|
932
|
-
export function
|
|
933
|
-
|
|
851
|
+
export function buildRuntimeCapsule(input: {
|
|
852
|
+
projection: Record<string, any>;
|
|
934
853
|
manifest: KDNAManifest;
|
|
935
854
|
digests: KDNADigestEvidence;
|
|
855
|
+
signature: { state: 'verified' | 'not_checked' | 'absent'; issuer?: string };
|
|
936
856
|
inputKind: 'packaged_file' | 'packaged_bytes';
|
|
937
857
|
loadedAt?: string;
|
|
938
|
-
|
|
939
|
-
|
|
858
|
+
schemaValid?: boolean;
|
|
859
|
+
}): KDNARuntimeCapsule;
|
|
860
|
+
export function loadRuntimeCapsule(
|
|
940
861
|
input: string | Uint8Array,
|
|
941
862
|
options?: {
|
|
942
863
|
profile?: 'index' | 'compact' | 'scenario' | 'full';
|
|
@@ -951,13 +872,8 @@ export function loadCapsuleV2(
|
|
|
951
872
|
}
|
|
952
873
|
>
|
|
953
874
|
>;
|
|
954
|
-
/** @deprecated Use expectedDigests.asset. */
|
|
955
|
-
expectedAssetDigest?:
|
|
956
|
-
string | { value: string; source: 'caller' | 'registry' | 'install_receipt' | 'lockfile' };
|
|
957
875
|
} & KdnaDecryptOptions,
|
|
958
|
-
):
|
|
959
|
-
export function adaptCapsuleV2ToV1(capsule: KDNARuntimeCapsuleV2): KDNARuntimeCapsule;
|
|
960
|
-
|
|
876
|
+
): KDNARuntimeCapsule;
|
|
961
877
|
export type KDNAJsonValue =
|
|
962
878
|
null | boolean | number | string | KDNAJsonValue[] | { [key: string]: KDNAJsonValue };
|
|
963
879
|
|
|
@@ -971,13 +887,13 @@ export type KDNAExecutionContractValidationResult =
|
|
|
971
887
|
| { valid: true; code: null; errors: []; value?: unknown }
|
|
972
888
|
| { valid: false; code: string; errors: KDNAExecutionContractValidationError[] };
|
|
973
889
|
|
|
974
|
-
export class
|
|
890
|
+
export class KDNARuntimeContractError extends Error {
|
|
975
891
|
code: string;
|
|
976
892
|
details?: unknown;
|
|
977
893
|
constructor(code: string, message: string, details?: unknown);
|
|
978
894
|
}
|
|
979
895
|
|
|
980
|
-
export interface
|
|
896
|
+
export interface KDNAExpectedDigest {
|
|
981
897
|
value: string;
|
|
982
898
|
basis: string;
|
|
983
899
|
source:
|
|
@@ -986,14 +902,13 @@ export interface KDNAExpectedDigestV1 {
|
|
|
986
902
|
| 'install_receipt'
|
|
987
903
|
| 'lockfile'
|
|
988
904
|
| 'kdna.json.content_digest'
|
|
989
|
-
| 'checksums.json.entry_set_digest'
|
|
990
|
-
| 'checksums.json.asset_digest';
|
|
905
|
+
| 'checksums.json.entry_set_digest';
|
|
991
906
|
comparison: 'matched' | 'not_compared';
|
|
992
907
|
}
|
|
993
908
|
|
|
994
|
-
export interface
|
|
995
|
-
type: 'kdna.consumption
|
|
996
|
-
|
|
909
|
+
export interface KDNAConsumptionPlan {
|
|
910
|
+
type: 'kdna.consumption-plan';
|
|
911
|
+
contract_version: '0.1.0';
|
|
997
912
|
plan_id: string;
|
|
998
913
|
created_at: string;
|
|
999
914
|
mode: 'single';
|
|
@@ -1005,26 +920,31 @@ export interface KDNAConsumptionPlanV1 {
|
|
|
1005
920
|
judgment_version: string;
|
|
1006
921
|
access: 'public' | 'licensed' | 'remote';
|
|
1007
922
|
expected_digests: {
|
|
1008
|
-
asset:
|
|
1009
|
-
content:
|
|
1010
|
-
runtime_entry_set:
|
|
923
|
+
asset: KDNAExpectedDigest | null;
|
|
924
|
+
content: KDNAExpectedDigest | null;
|
|
925
|
+
runtime_entry_set: KDNAExpectedDigest | null;
|
|
1011
926
|
};
|
|
1012
927
|
};
|
|
1013
928
|
projection_request: {
|
|
1014
929
|
profile: 'index' | 'compact' | 'scenario' | 'full';
|
|
1015
|
-
accepted_capsule_versions: ['
|
|
1016
|
-
required_digest_profile: 'kdna-
|
|
930
|
+
accepted_capsule_versions: ['0.1.0'];
|
|
931
|
+
required_digest_profile: 'kdna.digest-evidence';
|
|
932
|
+
required_digest_profile_version: '0.1.0';
|
|
1017
933
|
require_packaged_asset: true;
|
|
1018
934
|
};
|
|
1019
|
-
host_request: { accepted_protocols: ['kdna.agent-host
|
|
935
|
+
host_request: { accepted_protocols: ['kdna.agent-host'] };
|
|
1020
936
|
result_request: { shape: 'structured_judgment' };
|
|
1021
|
-
budget:
|
|
937
|
+
budget: KDNAExecutionBudget;
|
|
1022
938
|
constraints: { enforce_before_host: true; reject_on_exceed: true };
|
|
1023
939
|
trace_policy: { emit: true; storage: 'ephemeral' | 'session' | 'persistent' };
|
|
1024
|
-
integrity: {
|
|
940
|
+
integrity: {
|
|
941
|
+
profile: 'kdna.canonicalization.consumption-plan-jcs';
|
|
942
|
+
profile_version: '0.1.0';
|
|
943
|
+
plan_digest: string;
|
|
944
|
+
};
|
|
1025
945
|
}
|
|
1026
946
|
|
|
1027
|
-
export interface
|
|
947
|
+
export interface KDNAExecutionBudget {
|
|
1028
948
|
max_projection_chars: number;
|
|
1029
949
|
max_task_chars: number;
|
|
1030
950
|
deadline_ms: number;
|
|
@@ -1032,49 +952,55 @@ export interface KDNAExecutionBudgetV1 {
|
|
|
1032
952
|
max_model_calls: number | null;
|
|
1033
953
|
}
|
|
1034
954
|
|
|
1035
|
-
export interface
|
|
1036
|
-
type: 'kdna.agent-host
|
|
1037
|
-
|
|
955
|
+
export interface KDNAAgentHostCapabilities {
|
|
956
|
+
type: 'kdna.agent-host-capabilities';
|
|
957
|
+
protocol_version: '0.1.0';
|
|
1038
958
|
capability_basis: 'registered_descriptor' | 'legacy_assumption';
|
|
1039
|
-
host_protocols:
|
|
1040
|
-
capsule_versions:
|
|
1041
|
-
capsule_digest_profiles:
|
|
959
|
+
host_protocols: Array<'kdna.agent-host'>;
|
|
960
|
+
capsule_versions: Array<'0.1.0'>;
|
|
961
|
+
capsule_digest_profiles: Array<'kdna.canonicalization.runtime-capsule-jcs'>;
|
|
962
|
+
capsule_digest_profile_versions: ['0.1.0'];
|
|
1042
963
|
}
|
|
1043
964
|
|
|
1044
|
-
export interface
|
|
1045
|
-
protocol: 'kdna.agent-host
|
|
965
|
+
export interface KDNAAgentHostRequest {
|
|
966
|
+
protocol: 'kdna.agent-host';
|
|
967
|
+
protocol_version: '0.1.0';
|
|
1046
968
|
request_id: string;
|
|
1047
969
|
plan_ref: {
|
|
1048
970
|
plan_id: string;
|
|
1049
|
-
plan_digest_profile: 'kdna
|
|
971
|
+
plan_digest_profile: 'kdna.canonicalization.consumption-plan-jcs';
|
|
972
|
+
plan_digest_profile_version: '0.1.0';
|
|
1050
973
|
plan_digest: string;
|
|
1051
974
|
};
|
|
1052
975
|
runtime_contract: {
|
|
1053
|
-
capsule_version: '
|
|
1054
|
-
capsule_digest_profile: 'kdna-capsule-jcs
|
|
976
|
+
capsule_version: '0.1.0';
|
|
977
|
+
capsule_digest_profile: 'kdna.canonicalization.runtime-capsule-jcs';
|
|
978
|
+
capsule_digest_profile_version: '0.1.0';
|
|
1055
979
|
capsule_delivery_digest: string;
|
|
1056
980
|
};
|
|
1057
|
-
projection_contract:
|
|
981
|
+
projection_contract: KDNAConsumptionPlan['projection_request'] extends infer T
|
|
1058
982
|
? Omit<Extract<T, object>, 'accepted_capsule_versions'>
|
|
1059
983
|
: never;
|
|
1060
984
|
result_contract: { shape: 'structured_judgment' };
|
|
1061
|
-
budget:
|
|
1062
|
-
constraints:
|
|
985
|
+
budget: KDNAExecutionBudget;
|
|
986
|
+
constraints: KDNAConsumptionPlan['constraints'];
|
|
1063
987
|
phase: 'single_judgment';
|
|
1064
|
-
task:
|
|
988
|
+
task: KDNAConsumptionPlan['task'];
|
|
1065
989
|
authority: { asset_id: string; role: 'primary'; final_decision: true };
|
|
1066
|
-
asset:
|
|
1067
|
-
capsule:
|
|
990
|
+
asset: KDNAConsumptionPlan['asset_ref'] & { role: 'primary' };
|
|
991
|
+
capsule: KDNARuntimeCapsule;
|
|
1068
992
|
}
|
|
1069
993
|
|
|
1070
|
-
export interface
|
|
1071
|
-
protocol: 'kdna.agent-host
|
|
994
|
+
export interface KDNAAgentHostReceipt {
|
|
995
|
+
protocol: 'kdna.agent-host';
|
|
996
|
+
protocol_version: '0.1.0';
|
|
1072
997
|
request_id: string;
|
|
1073
998
|
runtime_receipt: {
|
|
1074
999
|
type: 'kdna.agent-host.runtime-receipt';
|
|
1075
|
-
|
|
1076
|
-
capsule_version: '
|
|
1077
|
-
capsule_digest_profile: 'kdna-capsule-jcs
|
|
1000
|
+
contract_version: '0.1.0';
|
|
1001
|
+
capsule_version: '0.1.0';
|
|
1002
|
+
capsule_digest_profile: 'kdna.canonicalization.runtime-capsule-jcs';
|
|
1003
|
+
capsule_digest_profile_version: '0.1.0';
|
|
1078
1004
|
sender_capsule_delivery_digest: string;
|
|
1079
1005
|
host_recomputed_capsule_delivery_digest: string;
|
|
1080
1006
|
echoed_capsule_delivery_digest: string;
|
|
@@ -1098,8 +1024,8 @@ export interface KDNAAgentHost2ReceiptV1 {
|
|
|
1098
1024
|
} | null;
|
|
1099
1025
|
}
|
|
1100
1026
|
|
|
1101
|
-
export interface
|
|
1102
|
-
limits:
|
|
1027
|
+
export interface KDNABudgetEvidence {
|
|
1028
|
+
limits: KDNAExecutionBudget;
|
|
1103
1029
|
actual: {
|
|
1104
1030
|
projection_chars: number | null;
|
|
1105
1031
|
task_chars: number;
|
|
@@ -1119,19 +1045,20 @@ export interface KDNABudgetEvidenceV1 {
|
|
|
1119
1045
|
};
|
|
1120
1046
|
}
|
|
1121
1047
|
|
|
1122
|
-
export interface
|
|
1048
|
+
export interface KDNAJudgmentTraceIssue {
|
|
1123
1049
|
code: string;
|
|
1124
1050
|
message: string;
|
|
1125
1051
|
phase: 'plan' | 'negotiation' | 'load' | 'budget' | 'delivery' | 'host' | 'execution';
|
|
1126
1052
|
}
|
|
1127
1053
|
|
|
1128
|
-
export interface
|
|
1129
|
-
type: 'kdna.judgment
|
|
1130
|
-
|
|
1054
|
+
export interface KDNAJudgmentTrace {
|
|
1055
|
+
type: 'kdna.judgment-trace';
|
|
1056
|
+
contract_version: '0.1.0';
|
|
1131
1057
|
trace_id: string;
|
|
1132
1058
|
plan_ref: {
|
|
1133
1059
|
plan_id: string;
|
|
1134
|
-
plan_digest_profile: 'kdna
|
|
1060
|
+
plan_digest_profile: 'kdna.canonicalization.consumption-plan-jcs';
|
|
1061
|
+
plan_digest_profile_version: '0.1.0';
|
|
1135
1062
|
plan_digest: string;
|
|
1136
1063
|
comparison: 'matched';
|
|
1137
1064
|
};
|
|
@@ -1140,15 +1067,15 @@ export interface KDNAJudgmentTraceV1 {
|
|
|
1140
1067
|
overall_status:
|
|
1141
1068
|
'execution_completed' | 'blocked' | 'execution_failed' | 'cancelled' | 'timed_out';
|
|
1142
1069
|
runtime_contract: {
|
|
1143
|
-
plan_capsule_versions: ['
|
|
1144
|
-
core_capsule_versions: Array<'
|
|
1145
|
-
plan_host_protocols: ['kdna.agent-host
|
|
1146
|
-
host_capabilities:
|
|
1070
|
+
plan_capsule_versions: ['0.1.0'];
|
|
1071
|
+
core_capsule_versions: Array<'0.1.0'>;
|
|
1072
|
+
plan_host_protocols: ['kdna.agent-host'];
|
|
1073
|
+
host_capabilities: KDNAAgentHostCapabilities;
|
|
1147
1074
|
negotiation_state: 'selected' | 'blocked' | 'not_started';
|
|
1148
|
-
selected_capsule_version: '
|
|
1149
|
-
selected_host_protocol: 'kdna.agent-host
|
|
1075
|
+
selected_capsule_version: '0.1.0' | null;
|
|
1076
|
+
selected_host_protocol: 'kdna.agent-host' | null;
|
|
1150
1077
|
issue_code:
|
|
1151
|
-
| '
|
|
1078
|
+
| 'KDNA_CAPSULE_CONTRACT_VERSION_UNSUPPORTED'
|
|
1152
1079
|
| 'KDNA_HOST_PROTOCOL_UNSUPPORTED'
|
|
1153
1080
|
| 'KDNA_HOST_CAPSULE_PAIR_UNSUPPORTED'
|
|
1154
1081
|
| null;
|
|
@@ -1162,12 +1089,13 @@ export interface KDNAJudgmentTraceV1 {
|
|
|
1162
1089
|
};
|
|
1163
1090
|
digest_evidence: KDNADigestEvidence;
|
|
1164
1091
|
capsule_delivery_evidence: {
|
|
1165
|
-
basis: 'kdna-capsule-jcs
|
|
1092
|
+
basis: 'kdna.canonicalization.runtime-capsule-jcs';
|
|
1093
|
+
basis_version: '0.1.0';
|
|
1166
1094
|
observed: string | null;
|
|
1167
1095
|
sender_computed: boolean;
|
|
1168
1096
|
host_recomputed: string | null;
|
|
1169
1097
|
host_echoed: string | null;
|
|
1170
|
-
delivered_capsule_version: '
|
|
1098
|
+
delivered_capsule_version: '0.1.0' | null;
|
|
1171
1099
|
host_boundary_comparison:
|
|
1172
1100
|
'matched' | 'mismatched' | 'not_delivered' | 'not_observed' | 'unavailable';
|
|
1173
1101
|
request_id: string | null;
|
|
@@ -1177,7 +1105,7 @@ export interface KDNAJudgmentTraceV1 {
|
|
|
1177
1105
|
capsule_delivery_digest: string | null;
|
|
1178
1106
|
profile_deviated_from_plan: boolean | null;
|
|
1179
1107
|
};
|
|
1180
|
-
host_receipt:
|
|
1108
|
+
host_receipt: KDNAAgentHostReceipt | null;
|
|
1181
1109
|
execution: {
|
|
1182
1110
|
delivery_status: 'correlated_response' | 'rejected_before_execution' | 'not_delivered';
|
|
1183
1111
|
semantic_consumption: { state: 'not_observed'; basis: null };
|
|
@@ -1185,118 +1113,120 @@ export interface KDNAJudgmentTraceV1 {
|
|
|
1185
1113
|
conformance_status: 'not_evaluated';
|
|
1186
1114
|
model_identity: { value: string | null; basis: 'host_reported' | 'not_observed' };
|
|
1187
1115
|
};
|
|
1188
|
-
budget:
|
|
1116
|
+
budget: KDNABudgetEvidence;
|
|
1189
1117
|
result_ref: {
|
|
1190
1118
|
shape: 'structured_judgment';
|
|
1191
1119
|
result_digest: string;
|
|
1192
|
-
basis: 'kdna
|
|
1120
|
+
basis: 'kdna.canonicalization.result-jcs';
|
|
1193
1121
|
stored: boolean;
|
|
1194
1122
|
} | null;
|
|
1195
|
-
errors:
|
|
1123
|
+
errors: KDNAJudgmentTraceIssue[];
|
|
1196
1124
|
warnings: string[];
|
|
1197
1125
|
}
|
|
1198
1126
|
|
|
1199
|
-
export interface
|
|
1127
|
+
export interface KDNARuntimePairContext {
|
|
1200
1128
|
trustedPlanDigest: string;
|
|
1201
|
-
capabilities:
|
|
1129
|
+
capabilities: KDNAAgentHostCapabilities;
|
|
1202
1130
|
coreCapsuleVersions: readonly string[];
|
|
1203
1131
|
}
|
|
1204
1132
|
|
|
1205
|
-
export interface
|
|
1206
|
-
plan:
|
|
1133
|
+
export interface KDNAAgentHostValidationContext extends KDNARuntimePairContext {
|
|
1134
|
+
plan: KDNAConsumptionPlan;
|
|
1207
1135
|
}
|
|
1208
1136
|
|
|
1209
|
-
export interface
|
|
1210
|
-
request:
|
|
1211
|
-
receipt:
|
|
1137
|
+
export interface KDNAJudgmentTraceContext extends KDNAAgentHostValidationContext {
|
|
1138
|
+
request: KDNAAgentHostRequest | null;
|
|
1139
|
+
receipt: KDNAAgentHostReceipt | null;
|
|
1212
1140
|
trustedDeliveryObservation: 'host_receipt' | 'not_delivered' | 'not_observed';
|
|
1213
1141
|
}
|
|
1214
1142
|
|
|
1215
|
-
export interface
|
|
1216
|
-
extends
|
|
1217
|
-
capsule:
|
|
1143
|
+
export interface KDNAPreHostBudgetBlockedTraceContext
|
|
1144
|
+
extends KDNAAgentHostValidationContext {
|
|
1145
|
+
capsule: KDNARuntimeCapsule;
|
|
1218
1146
|
}
|
|
1219
1147
|
|
|
1220
|
-
export const PLAN_DIGEST_PROFILE: 'kdna
|
|
1221
|
-
export const
|
|
1222
|
-
export const
|
|
1223
|
-
export
|
|
1148
|
+
export const PLAN_DIGEST_PROFILE: 'kdna.canonicalization.consumption-plan-jcs';
|
|
1149
|
+
export const PLAN_DIGEST_PROFILE_VERSION: '0.1.0';
|
|
1150
|
+
export const HOST_PROTOCOL: 'kdna.agent-host';
|
|
1151
|
+
export const HOST_PROTOCOL_VERSION: '0.1.0';
|
|
1152
|
+
export const DEFAULT_CORE_CAPSULE_CONTRACT_VERSIONS: readonly ['0.1.0'];
|
|
1153
|
+
export function parseRuntimeContractJson(
|
|
1224
1154
|
input: string | Uint8Array,
|
|
1225
1155
|
options?: { maxBytes?: number; maxDepth?: number },
|
|
1226
1156
|
): KDNAJsonValue;
|
|
1227
|
-
export function
|
|
1228
|
-
export function
|
|
1157
|
+
export function computeConsumptionPlanDigest(plan: KDNAConsumptionPlan): string;
|
|
1158
|
+
export function buildConsumptionPlan(input: {
|
|
1229
1159
|
plan_id: string;
|
|
1230
1160
|
created_at: string;
|
|
1231
|
-
task:
|
|
1232
|
-
asset_ref:
|
|
1233
|
-
projection_profile:
|
|
1234
|
-
budget:
|
|
1235
|
-
constraints:
|
|
1236
|
-
trace_policy:
|
|
1237
|
-
}):
|
|
1238
|
-
export function
|
|
1161
|
+
task: KDNAConsumptionPlan['task'];
|
|
1162
|
+
asset_ref: KDNAConsumptionPlan['asset_ref'];
|
|
1163
|
+
projection_profile: KDNAConsumptionPlan['projection_request']['profile'];
|
|
1164
|
+
budget: KDNAExecutionBudget;
|
|
1165
|
+
constraints: KDNAConsumptionPlan['constraints'];
|
|
1166
|
+
trace_policy: KDNAConsumptionPlan['trace_policy'];
|
|
1167
|
+
}): KDNAConsumptionPlan;
|
|
1168
|
+
export function validateConsumptionPlan(
|
|
1239
1169
|
plan: unknown,
|
|
1240
1170
|
context: { trustedPlanDigest: string },
|
|
1241
1171
|
): KDNAExecutionContractValidationResult;
|
|
1242
|
-
export function
|
|
1243
|
-
plan:
|
|
1244
|
-
context:
|
|
1172
|
+
export function negotiateRuntimePair(
|
|
1173
|
+
plan: KDNAConsumptionPlan,
|
|
1174
|
+
context: KDNARuntimePairContext,
|
|
1245
1175
|
): {
|
|
1246
1176
|
state: 'selected' | 'blocked';
|
|
1247
|
-
capsule_version: '
|
|
1248
|
-
host_protocol: 'kdna.agent-host
|
|
1177
|
+
capsule_version: '0.1.0' | null;
|
|
1178
|
+
host_protocol: 'kdna.agent-host' | null;
|
|
1249
1179
|
issue_code: string | null;
|
|
1250
1180
|
};
|
|
1251
|
-
export function
|
|
1252
|
-
input: { request_id: string; capsule:
|
|
1253
|
-
context:
|
|
1254
|
-
):
|
|
1255
|
-
export function
|
|
1181
|
+
export function buildAgentHostRequest(
|
|
1182
|
+
input: { request_id: string; capsule: KDNARuntimeCapsule },
|
|
1183
|
+
context: KDNAAgentHostValidationContext,
|
|
1184
|
+
): KDNAAgentHostRequest;
|
|
1185
|
+
export function validateAgentHostRequest(
|
|
1256
1186
|
request: unknown,
|
|
1257
|
-
context:
|
|
1187
|
+
context: KDNAAgentHostValidationContext,
|
|
1258
1188
|
): KDNAExecutionContractValidationResult;
|
|
1259
|
-
export function
|
|
1189
|
+
export function validateAgentHostReceipt(
|
|
1260
1190
|
receipt: unknown,
|
|
1261
|
-
context: { request:
|
|
1191
|
+
context: { request: KDNAAgentHostRequest },
|
|
1262
1192
|
): KDNAExecutionContractValidationResult;
|
|
1263
|
-
export function
|
|
1264
|
-
plan:
|
|
1193
|
+
export function deriveBudgetEvidence(
|
|
1194
|
+
plan: KDNAConsumptionPlan,
|
|
1265
1195
|
context: {
|
|
1266
1196
|
trustedPlanDigest: string;
|
|
1267
|
-
request:
|
|
1268
|
-
receipt:
|
|
1197
|
+
request: KDNAAgentHostRequest | null;
|
|
1198
|
+
receipt: KDNAAgentHostReceipt | null;
|
|
1269
1199
|
},
|
|
1270
|
-
):
|
|
1271
|
-
export function
|
|
1200
|
+
): KDNABudgetEvidence;
|
|
1201
|
+
export function buildPreHostBudgetBlockedTrace(
|
|
1272
1202
|
input: {
|
|
1273
1203
|
trace_id: string;
|
|
1274
1204
|
timestamp: string;
|
|
1275
|
-
capsule:
|
|
1205
|
+
capsule: KDNARuntimeCapsule;
|
|
1276
1206
|
parent_trace_id?: string | null;
|
|
1277
1207
|
warnings?: string[];
|
|
1278
1208
|
},
|
|
1279
|
-
context:
|
|
1280
|
-
):
|
|
1281
|
-
export function
|
|
1209
|
+
context: KDNAAgentHostValidationContext,
|
|
1210
|
+
): KDNAJudgmentTrace;
|
|
1211
|
+
export function validatePreHostBudgetBlockedTrace(
|
|
1282
1212
|
trace: unknown,
|
|
1283
|
-
context:
|
|
1213
|
+
context: KDNAPreHostBudgetBlockedTraceContext,
|
|
1284
1214
|
): KDNAExecutionContractValidationResult;
|
|
1285
|
-
export function
|
|
1215
|
+
export function buildJudgmentTrace(
|
|
1286
1216
|
input: {
|
|
1287
1217
|
trace_id: string;
|
|
1288
1218
|
timestamp: string;
|
|
1289
|
-
overall_status:
|
|
1219
|
+
overall_status: KDNAJudgmentTrace['overall_status'];
|
|
1290
1220
|
parent_trace_id?: string | null;
|
|
1291
1221
|
result_stored?: boolean;
|
|
1292
|
-
errors?:
|
|
1222
|
+
errors?: KDNAJudgmentTraceIssue[];
|
|
1293
1223
|
warnings?: string[];
|
|
1294
1224
|
},
|
|
1295
|
-
context:
|
|
1296
|
-
):
|
|
1297
|
-
export function
|
|
1225
|
+
context: KDNAJudgmentTraceContext,
|
|
1226
|
+
): KDNAJudgmentTrace;
|
|
1227
|
+
export function validateJudgmentTrace(
|
|
1298
1228
|
trace: unknown,
|
|
1299
|
-
context:
|
|
1229
|
+
context: KDNAJudgmentTraceContext,
|
|
1300
1230
|
): KDNAExecutionContractValidationResult;
|
|
1301
1231
|
|
|
1302
1232
|
export interface KDNAMatchResult extends KDNAInspectResult {
|
|
@@ -1447,14 +1377,13 @@ export interface KDNAChecksumEntry {
|
|
|
1447
1377
|
}
|
|
1448
1378
|
|
|
1449
1379
|
export interface KDNAChecksums {
|
|
1450
|
-
digest_profile?: 'kdna-runtime-entry-set
|
|
1380
|
+
digest_profile?: 'kdna.digest-basis.runtime-entry-set';
|
|
1381
|
+
digest_profile_version?: '0.1.0';
|
|
1451
1382
|
covered_entries?: ['kdna.json', 'payload.kdnab'];
|
|
1452
1383
|
algorithm: 'sha256';
|
|
1453
1384
|
manifest_digest?: string;
|
|
1454
1385
|
payload_digest?: string;
|
|
1455
1386
|
entry_set_digest?: string;
|
|
1456
|
-
/** @deprecated Use entry_set_digest. This is not the final .kdna file digest. */
|
|
1457
|
-
asset_digest?: string;
|
|
1458
1387
|
entries?: Record<string, KDNAChecksumEntry>;
|
|
1459
1388
|
}
|
|
1460
1389
|
|
|
@@ -1464,6 +1393,15 @@ export function inspect(
|
|
|
1464
1393
|
input: string | Uint8Array,
|
|
1465
1394
|
options?: Record<string, any>,
|
|
1466
1395
|
): Record<string, any>;
|
|
1396
|
+
export const KDNA_LOADER_VERSION: '0.20.0';
|
|
1397
|
+
export const STRICT_LOADER_VERSION: RegExp;
|
|
1398
|
+
export function parseLoaderVersion(version: unknown): readonly [string, string, string] | null;
|
|
1399
|
+
export function compareLoaderVersions(left: string, right: string): -1 | 0 | 1;
|
|
1400
|
+
export function assessLoaderCompatibility(manifest: Partial<KDNAManifest> | null | undefined): {
|
|
1401
|
+
loader_version: string;
|
|
1402
|
+
min_loader_version: string | null;
|
|
1403
|
+
loader_compatible: boolean | null;
|
|
1404
|
+
};
|
|
1467
1405
|
export function validate(
|
|
1468
1406
|
input: string | Uint8Array,
|
|
1469
1407
|
options?: Record<string, any>,
|
|
@@ -1474,7 +1412,7 @@ export interface KDNALoadPlanIssue {
|
|
|
1474
1412
|
message: string;
|
|
1475
1413
|
}
|
|
1476
1414
|
export interface KDNALoadPlan {
|
|
1477
|
-
|
|
1415
|
+
format_version: '0.1.0' | null;
|
|
1478
1416
|
asset: {
|
|
1479
1417
|
asset_id: string | null;
|
|
1480
1418
|
asset_uid: string | null;
|
|
@@ -1510,7 +1448,11 @@ export interface KDNALoadPlan {
|
|
|
1510
1448
|
| string;
|
|
1511
1449
|
can_load_now: boolean;
|
|
1512
1450
|
projection_policy: 'minimal' | 'remote' | 'none' | string;
|
|
1513
|
-
input_fingerprint:
|
|
1451
|
+
input_fingerprint: {
|
|
1452
|
+
has_password_input: boolean;
|
|
1453
|
+
entitlement_input: 'active' | 'expired' | 'revoked' | 'offline_grace' | null;
|
|
1454
|
+
source_fingerprint: string;
|
|
1455
|
+
} | null;
|
|
1514
1456
|
checks: Record<string, boolean>;
|
|
1515
1457
|
issues: KDNALoadPlanIssue[];
|
|
1516
1458
|
source: {
|
|
@@ -1550,22 +1492,6 @@ export function loadAsset(
|
|
|
1550
1492
|
as?: 'json' | 'prompt' | string;
|
|
1551
1493
|
},
|
|
1552
1494
|
): KDNARuntimeCapsule | Record<string, any>;
|
|
1553
|
-
export function buildCapsule(
|
|
1554
|
-
loadResult: {
|
|
1555
|
-
profile: string;
|
|
1556
|
-
content?: Record<string, unknown>;
|
|
1557
|
-
extends_chain?: unknown[];
|
|
1558
|
-
inheritance_applied?: boolean;
|
|
1559
|
-
resolved_dependencies?: unknown[];
|
|
1560
|
-
rag_isolation_policy?: Record<string, unknown>;
|
|
1561
|
-
[key: string]: unknown;
|
|
1562
|
-
},
|
|
1563
|
-
layout: KDNALayout,
|
|
1564
|
-
profile: string,
|
|
1565
|
-
options?: {
|
|
1566
|
-
_validation?: { schema_valid?: boolean; signature_valid?: boolean | null };
|
|
1567
|
-
},
|
|
1568
|
-
): KDNARuntimeCapsule;
|
|
1569
1495
|
export const FORBIDDEN_OUTPUT_TERMS: readonly string[];
|
|
1570
1496
|
|
|
1571
1497
|
export interface KDNASemver {
|
|
@@ -1578,10 +1504,6 @@ export function parseSemver(version: string): KDNASemver | null;
|
|
|
1578
1504
|
export function compareSemver(left: string, right: string): number;
|
|
1579
1505
|
export function satisfies(version: string, range: string): boolean;
|
|
1580
1506
|
|
|
1581
|
-
// Lint
|
|
1582
|
-
export function lintDomain(dataMap: KDNAFileDataMap): LintResult;
|
|
1583
|
-
export function validateManifest(manifest: unknown): LintResult;
|
|
1584
|
-
|
|
1585
1507
|
// Validate
|
|
1586
1508
|
export function validateDomainSchema(
|
|
1587
1509
|
dataMap: KDNAFileDataMap,
|