@coreguard/agent-commerce 0.1.1 → 0.1.3
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/README.md +275 -11
- package/aer1.mjs +258 -0
- package/anchor.mjs +278 -0
- package/bin/mcp.mjs +0 -0
- package/composition.mjs +150 -0
- package/consumption-store.mjs +114 -38
- package/control-plane-cli.mjs +246 -0
- package/control-plane-http.mjs +275 -0
- package/control-plane.mjs +923 -0
- package/decision.mjs +152 -0
- package/firewall.mjs +1 -1
- package/identity.mjs +205 -0
- package/index.d.ts +848 -1
- package/index.mjs +189 -3
- package/mcp.mjs +476 -21
- package/outcomes-bridge.mjs +169 -0
- package/outcomes.mjs +220 -0
- package/package.json +42 -14
- package/profile-ref.mjs +130 -0
- package/reference.mjs +350 -0
- package/risk-cli.mjs +10 -2
- package/risk.mjs +49 -2
- package/spend.mjs +291 -0
- package/trust.mjs +322 -0
package/index.d.ts
CHANGED
|
@@ -207,10 +207,16 @@ export interface ExecutionVerdict {
|
|
|
207
207
|
* default ledger is process-local (durable single-use anchoring NOT_BUILT —
|
|
208
208
|
* pass an external `consumedSet` for cross-session consumption control).
|
|
209
209
|
*/
|
|
210
|
+
/** A consumption ledger may be synchronous (Set, AC-CS/1) or asynchronous (a shared/remote store). */
|
|
211
|
+
export interface ConsumptionLedger {
|
|
212
|
+
has(id: string): boolean | Promise<boolean>;
|
|
213
|
+
add(id: string): unknown | Promise<unknown>;
|
|
214
|
+
}
|
|
215
|
+
|
|
210
216
|
export declare function verifyExecution(
|
|
211
217
|
consent: ConsentRecord,
|
|
212
218
|
trace: DeclaredTrace,
|
|
213
|
-
options?: { consumedSet?:
|
|
219
|
+
options?: { consumedSet?: ConsumptionLedger },
|
|
214
220
|
): Promise<ExecutionVerdict>;
|
|
215
221
|
|
|
216
222
|
// ---------------------------------------------------------------------------
|
|
@@ -306,6 +312,8 @@ export interface ConsumptionStore {
|
|
|
306
312
|
boundary: string;
|
|
307
313
|
has(id: string): boolean;
|
|
308
314
|
add(id: string): ConsumptionStore;
|
|
315
|
+
/** Atomic cross-process claim: true only for the caller that added the id. */
|
|
316
|
+
tryAdd(id: string): boolean;
|
|
309
317
|
delete(id: string): boolean;
|
|
310
318
|
clear(): void;
|
|
311
319
|
readonly size: number;
|
|
@@ -322,3 +330,842 @@ export interface ConsumptionStoreView {
|
|
|
322
330
|
readonly size: number;
|
|
323
331
|
ids(): string[];
|
|
324
332
|
}
|
|
333
|
+
|
|
334
|
+
// ---------------------------------------------------------------------------
|
|
335
|
+
// CG-OUT/1 — the outcome layer above the reject codes.
|
|
336
|
+
//
|
|
337
|
+
// Nothing here types a verdict as a boolean: `blocks` is not `!verified`, and
|
|
338
|
+
// ABSENT is not a failure. Five names, one result shape, no sixth value.
|
|
339
|
+
// ---------------------------------------------------------------------------
|
|
340
|
+
|
|
341
|
+
export type OutcomeName =
|
|
342
|
+
| "VERIFIED"
|
|
343
|
+
| "VERIFICATION_FAILED"
|
|
344
|
+
| "ABSENT"
|
|
345
|
+
| "NOT_CHECKED"
|
|
346
|
+
| "UNRESOLVABLE_RECORD";
|
|
347
|
+
|
|
348
|
+
export const OUTCOME_VERSION: "CG-OUT/1";
|
|
349
|
+
export const OUTCOMES: readonly OutcomeName[];
|
|
350
|
+
export const OUTCOME_CODES: Readonly<{
|
|
351
|
+
ABSENT: "ABSENT";
|
|
352
|
+
NOT_CHECKED: "NOT_CHECKED";
|
|
353
|
+
UNRESOLVABLE_RECORD: "UNRESOLVABLE_RECORD";
|
|
354
|
+
}>;
|
|
355
|
+
export const NON_BLOCKING_OUTCOMES: readonly OutcomeName[];
|
|
356
|
+
export const BLOCKING_OUTCOMES: readonly OutcomeName[];
|
|
357
|
+
|
|
358
|
+
export interface RecordLayerFacts {
|
|
359
|
+
evaluated?: boolean;
|
|
360
|
+
ok?: boolean;
|
|
361
|
+
code?: string | null;
|
|
362
|
+
reason?: string | null;
|
|
363
|
+
version?: string | null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface AnchorLayerFacts {
|
|
367
|
+
present?: boolean;
|
|
368
|
+
evaluated?: boolean;
|
|
369
|
+
outcome?: "verified" | "absent" | "not_checked" | "unresolvable" | string | null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface OutcomeResult {
|
|
373
|
+
outcome: OutcomeName;
|
|
374
|
+
code: string | null;
|
|
375
|
+
reason: string;
|
|
376
|
+
layers: Readonly<{
|
|
377
|
+
record: { evaluated: boolean; ok: boolean | null; code: string | null };
|
|
378
|
+
anchor: { present: boolean; evaluated: boolean; outcome: string | null };
|
|
379
|
+
}>;
|
|
380
|
+
blocks: boolean;
|
|
381
|
+
outcomeVersion: string;
|
|
382
|
+
detail: unknown;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export declare function decideOutcome(facts?: {
|
|
386
|
+
presented?: boolean;
|
|
387
|
+
record?: RecordLayerFacts | null;
|
|
388
|
+
anchor?: AnchorLayerFacts | null;
|
|
389
|
+
}): OutcomeResult;
|
|
390
|
+
|
|
391
|
+
export declare function assertNotRenderedAsBlock(outcome: OutcomeName): OutcomeName;
|
|
392
|
+
|
|
393
|
+
export declare function outcomeSelfCheck(): Readonly<{
|
|
394
|
+
outcomeVersion: string;
|
|
395
|
+
outcomes: readonly OutcomeName[];
|
|
396
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
397
|
+
ok: boolean;
|
|
398
|
+
}>;
|
|
399
|
+
|
|
400
|
+
// ---------------------------------------------------------------------------
|
|
401
|
+
// CG-ID/1 — identity split: the record's name, kept apart from its bytes.
|
|
402
|
+
// ---------------------------------------------------------------------------
|
|
403
|
+
|
|
404
|
+
export const IDENTITY_VERSION: "CG-ID/1";
|
|
405
|
+
export const IDENTITY_SCHEMA: "coreguard.identity/1";
|
|
406
|
+
export const ANCHOR_KINDS: readonly ("chain" | "transparency-log" | "notary" | "mirror")[];
|
|
407
|
+
|
|
408
|
+
export interface AnchorReference {
|
|
409
|
+
kind: "chain" | "transparency-log" | "notary" | "mirror";
|
|
410
|
+
locator: string;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export interface SplitIdentity {
|
|
414
|
+
identityVersion: string;
|
|
415
|
+
schema: string;
|
|
416
|
+
recordId: string;
|
|
417
|
+
contentDigest: string;
|
|
418
|
+
anchorRef: AnchorReference | null;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export declare function recordIdFor(args: { issuer: string; scope: string; subject: string }): string;
|
|
422
|
+
|
|
423
|
+
export declare function splitIdentity(args: {
|
|
424
|
+
issuer: string;
|
|
425
|
+
scope: string;
|
|
426
|
+
subject: string;
|
|
427
|
+
contentDigest: string;
|
|
428
|
+
anchor?: AnchorReference | null;
|
|
429
|
+
}): SplitIdentity;
|
|
430
|
+
|
|
431
|
+
export declare function normalizeAnchor(anchor: AnchorReference): AnchorReference;
|
|
432
|
+
|
|
433
|
+
export declare function compareIdentities(
|
|
434
|
+
a: Pick<SplitIdentity, "recordId" | "contentDigest">,
|
|
435
|
+
b: Pick<SplitIdentity, "recordId" | "contentDigest">,
|
|
436
|
+
): Readonly<{ sameRecord: boolean; sameBytes: boolean; drifted: boolean; verdictHint: string }>;
|
|
437
|
+
|
|
438
|
+
export declare function anchorFacts(
|
|
439
|
+
identity: Pick<SplitIdentity, "anchorRef">,
|
|
440
|
+
options?: { resolved?: boolean | null },
|
|
441
|
+
): Readonly<{
|
|
442
|
+
present: boolean;
|
|
443
|
+
evaluated: boolean;
|
|
444
|
+
outcome: "verified" | "absent" | "not_checked" | "unresolvable";
|
|
445
|
+
}>;
|
|
446
|
+
|
|
447
|
+
export declare function identitySelfCheck(): Readonly<{
|
|
448
|
+
identityVersion: string;
|
|
449
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
450
|
+
ok: boolean;
|
|
451
|
+
}>;
|
|
452
|
+
|
|
453
|
+
// ---------------------------------------------------------------------------
|
|
454
|
+
// CG-OUT/1 profile reference — the three fields a protocol would carry.
|
|
455
|
+
// ---------------------------------------------------------------------------
|
|
456
|
+
|
|
457
|
+
export const PROFILE_ID: "CG-OUT/1";
|
|
458
|
+
export const PROFILE_VERSION: 1;
|
|
459
|
+
export const PROFILE_REFERENCE_SCHEMA: "coreguard.profile-ref/1";
|
|
460
|
+
export const REFERENCE_FIELDS: readonly ["receipt_id", "profile", "profile_version"];
|
|
461
|
+
|
|
462
|
+
export interface ProfileReference {
|
|
463
|
+
receipt_id: string;
|
|
464
|
+
profile: "CG-OUT/1";
|
|
465
|
+
profile_version: 1;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export declare function makeProfileReference(args: { receiptId: string }): ProfileReference;
|
|
469
|
+
|
|
470
|
+
export declare function parseProfileReference(input: unknown): {
|
|
471
|
+
ok: boolean;
|
|
472
|
+
reference: ProfileReference | null;
|
|
473
|
+
error: string | null;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
export declare function profileSelfCheck(): Readonly<{
|
|
477
|
+
profile: string;
|
|
478
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
479
|
+
ok: boolean;
|
|
480
|
+
}>;
|
|
481
|
+
|
|
482
|
+
// ---------------------------------------------------------------------------
|
|
483
|
+
// Bridges — the outcome layer as the surfaces actually print it.
|
|
484
|
+
// ---------------------------------------------------------------------------
|
|
485
|
+
|
|
486
|
+
export const BRIDGE_VERSION: "CG-OUT-BRIDGE/1";
|
|
487
|
+
|
|
488
|
+
export declare function outcomeForVerificationReport(report: unknown): OutcomeResult;
|
|
489
|
+
|
|
490
|
+
export declare function outcomeForPsarResult(
|
|
491
|
+
result: { decision?: string; code?: string | null; reasons?: readonly string[] } | null,
|
|
492
|
+
options?: { receipt?: unknown },
|
|
493
|
+
): OutcomeResult;
|
|
494
|
+
|
|
495
|
+
export declare function authorizationDecision(
|
|
496
|
+
outcome: OutcomeResult | OutcomeName,
|
|
497
|
+
): Readonly<{ decision: "PASS" | "BLOCK" | "NONE"; reason: string | null }>;
|
|
498
|
+
|
|
499
|
+
export declare function profileReferenceFor(receiptId: string): ProfileReference;
|
|
500
|
+
|
|
501
|
+
// ---------------------------------------------------------------------------
|
|
502
|
+
// CG-AER1/1 — a parser for AER-1 receipts (draft-zambo-aer1-26). The committed
|
|
503
|
+
// payload and the receipt id are separate facts: the digest is recomputed, the
|
|
504
|
+
// id is bound only against an expected id or a resolved record that must agree
|
|
505
|
+
// on the digest.
|
|
506
|
+
// ---------------------------------------------------------------------------
|
|
507
|
+
|
|
508
|
+
export const AER1_PARSER_VERSION: "CG-AER1/1";
|
|
509
|
+
export const SUPPORTED_RECEIPT_SCHEMAS: readonly string[];
|
|
510
|
+
|
|
511
|
+
export interface Aer1Check {
|
|
512
|
+
name: string;
|
|
513
|
+
ok: boolean;
|
|
514
|
+
detail?: unknown;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface Aer1Digest {
|
|
518
|
+
claimed: string | null;
|
|
519
|
+
computed: string | null;
|
|
520
|
+
ok: boolean;
|
|
521
|
+
byteLength: number | null;
|
|
522
|
+
byteLengthClaimed: number | null;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface Aer1IdFacts {
|
|
526
|
+
present: boolean;
|
|
527
|
+
state: "unverified" | "verified-expected" | "verified-resolved" | "mismatch";
|
|
528
|
+
verdict: "matched" | "mismatched" | "resolved" | "unverified" | "absent";
|
|
529
|
+
expected: string | null;
|
|
530
|
+
resolved: { id: string | null; digest: string | null } | null;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export interface Aer1Parsed {
|
|
534
|
+
parserVersion: string;
|
|
535
|
+
version: string | null;
|
|
536
|
+
supportedVersion: boolean;
|
|
537
|
+
structure: readonly Aer1Check[];
|
|
538
|
+
structureOk: boolean;
|
|
539
|
+
digest: Aer1Digest;
|
|
540
|
+
id: Aer1IdFacts;
|
|
541
|
+
verdict: "pass" | "fail";
|
|
542
|
+
code: string | null;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** Anchor facts in CG-OUT/1's vocabulary, as a caller measured them. */
|
|
546
|
+
export interface AnchorFacts {
|
|
547
|
+
present?: boolean;
|
|
548
|
+
evaluated?: boolean;
|
|
549
|
+
outcome?: "verified" | "absent" | "not_checked" | "unresolvable" | string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export declare function parseAer1Record(
|
|
553
|
+
record: unknown,
|
|
554
|
+
options?: { expectedId?: string; resolvedRecord?: unknown },
|
|
555
|
+
): Aer1Parsed;
|
|
556
|
+
|
|
557
|
+
export declare function aer1Outcome(parsed: Aer1Parsed, options?: { anchor?: AnchorFacts }): OutcomeResult;
|
|
558
|
+
|
|
559
|
+
export declare function aer1SelfCheck(): Readonly<{
|
|
560
|
+
ok: boolean;
|
|
561
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
562
|
+
}>;
|
|
563
|
+
|
|
564
|
+
// ---------------------------------------------------------------------------
|
|
565
|
+
// CG-ANCHOR/1 — the anchor service we run: offline-verifiable attestations, an
|
|
566
|
+
// append-only hash-chained log, one Merkle root, and a prepare-only chain
|
|
567
|
+
// adapter that refuses mainnet. No broadcast path is declared because none
|
|
568
|
+
// exists.
|
|
569
|
+
// ---------------------------------------------------------------------------
|
|
570
|
+
|
|
571
|
+
export const ANCHOR_VERSION: "CG-ANCHOR/1";
|
|
572
|
+
export const ANCHOR_SCHEMA: "coreguard.anchor/1";
|
|
573
|
+
|
|
574
|
+
export interface AnchorSubject {
|
|
575
|
+
kind: string;
|
|
576
|
+
digest: string;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export interface AnchorAttestation {
|
|
580
|
+
anchorVersion: string;
|
|
581
|
+
schema: string;
|
|
582
|
+
subject: AnchorSubject;
|
|
583
|
+
sequence: number;
|
|
584
|
+
previous: string | null;
|
|
585
|
+
issuedAt: string;
|
|
586
|
+
issuer: { keyId: string; publicKeyPem: string };
|
|
587
|
+
signature: string;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export interface AnchorLog {
|
|
591
|
+
anchorVersion: string;
|
|
592
|
+
schema: string;
|
|
593
|
+
entries: readonly AnchorAttestation[];
|
|
594
|
+
root?: string;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export declare function normalizeSubject(subject: { kind: string; digest: string }): AnchorSubject;
|
|
598
|
+
|
|
599
|
+
export declare function generateIssuerKey(): Readonly<{ publicKeyPem: string; privateKeyPem: string }>;
|
|
600
|
+
|
|
601
|
+
export declare function keyIdFor(publicKeyPem: string): string;
|
|
602
|
+
|
|
603
|
+
export declare function signAttestation(args: {
|
|
604
|
+
subject: { kind: string; digest: string };
|
|
605
|
+
issuedAt: string;
|
|
606
|
+
privateKeyPem: string;
|
|
607
|
+
sequence?: number;
|
|
608
|
+
previous?: string | null;
|
|
609
|
+
}): AnchorAttestation;
|
|
610
|
+
|
|
611
|
+
export declare function verifyAnchorAttestation(attestation: unknown): Readonly<{
|
|
612
|
+
ok: boolean;
|
|
613
|
+
checks: ReadonlyArray<{ name: string; ok: boolean }>;
|
|
614
|
+
}>;
|
|
615
|
+
|
|
616
|
+
export declare function leafHash(attestation: AnchorAttestation): string;
|
|
617
|
+
|
|
618
|
+
export declare function merkleRoot(leaves: readonly string[]): string;
|
|
619
|
+
|
|
620
|
+
export declare function createLog(): AnchorLog;
|
|
621
|
+
|
|
622
|
+
export declare function appendAnchor(
|
|
623
|
+
log: AnchorLog,
|
|
624
|
+
args: { subject: { kind: string; digest: string }; issuedAt: string; privateKeyPem: string },
|
|
625
|
+
): AnchorLog;
|
|
626
|
+
|
|
627
|
+
export declare function verifyLog(log: AnchorLog): Readonly<{
|
|
628
|
+
ok: boolean;
|
|
629
|
+
checks: ReadonlyArray<{ name: string; ok: boolean }>;
|
|
630
|
+
root: string;
|
|
631
|
+
}>;
|
|
632
|
+
|
|
633
|
+
export declare function resolveAnchor(
|
|
634
|
+
log: AnchorLog,
|
|
635
|
+
digest: string,
|
|
636
|
+
): Readonly<{
|
|
637
|
+
present: boolean;
|
|
638
|
+
evaluated: boolean;
|
|
639
|
+
outcome: "verified" | "absent" | "unresolvable";
|
|
640
|
+
matches?: number;
|
|
641
|
+
reason?: string;
|
|
642
|
+
}>;
|
|
643
|
+
|
|
644
|
+
export declare function prepareChainAnchor(
|
|
645
|
+
log: AnchorLog,
|
|
646
|
+
options?: { network?: string },
|
|
647
|
+
): Readonly<{
|
|
648
|
+
ok: boolean;
|
|
649
|
+
adapter?: string;
|
|
650
|
+
network?: string;
|
|
651
|
+
memoHashHex?: string;
|
|
652
|
+
memoType?: string;
|
|
653
|
+
broadcast?: boolean;
|
|
654
|
+
root?: string;
|
|
655
|
+
entries?: number;
|
|
656
|
+
reason?: string;
|
|
657
|
+
checks?: ReadonlyArray<{ name: string; ok: boolean }>;
|
|
658
|
+
}>;
|
|
659
|
+
|
|
660
|
+
export declare function anchorSelfCheck(): Readonly<{
|
|
661
|
+
ok: boolean;
|
|
662
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
663
|
+
}>;
|
|
664
|
+
|
|
665
|
+
// ---------------------------------------------------------------------------
|
|
666
|
+
// CG-COMPOSE/1 — the anchor composition difference as a mode. `composed` lets
|
|
667
|
+
// an unresolvable anchor block the headline; `layered` keeps the record verdict
|
|
668
|
+
// fixed and reports the rejection on the anchor layer.
|
|
669
|
+
// ---------------------------------------------------------------------------
|
|
670
|
+
|
|
671
|
+
export const COMPOSITION_VERSION: "CG-COMPOSE/1";
|
|
672
|
+
export const COMPOSITION_MODES: readonly ["composed", "layered"];
|
|
673
|
+
|
|
674
|
+
export type CompositionMode = "composed" | "layered";
|
|
675
|
+
|
|
676
|
+
export interface CompositionResult {
|
|
677
|
+
compositionVersion: string;
|
|
678
|
+
mode: CompositionMode;
|
|
679
|
+
headline: OutcomeName;
|
|
680
|
+
record: Readonly<{ outcome: OutcomeName; moved: boolean }>;
|
|
681
|
+
anchor: Readonly<{ present: boolean; evaluated: boolean; outcome: string; rejected: string | null }>;
|
|
682
|
+
blocks: boolean;
|
|
683
|
+
resolutionSensitive: boolean;
|
|
684
|
+
code: string | null;
|
|
685
|
+
reason: string | null;
|
|
686
|
+
layers: unknown;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export declare function composeOutcome(input?: {
|
|
690
|
+
presented?: boolean;
|
|
691
|
+
record?: unknown;
|
|
692
|
+
anchor?: AnchorFacts;
|
|
693
|
+
mode?: CompositionMode;
|
|
694
|
+
}): CompositionResult;
|
|
695
|
+
|
|
696
|
+
export declare function compareModes(input?: {
|
|
697
|
+
presented?: boolean;
|
|
698
|
+
record?: unknown;
|
|
699
|
+
anchor?: AnchorFacts;
|
|
700
|
+
}): Readonly<{
|
|
701
|
+
compositionVersion: string;
|
|
702
|
+
composed: CompositionResult;
|
|
703
|
+
layered: CompositionResult;
|
|
704
|
+
diverges: boolean;
|
|
705
|
+
recordStable: boolean;
|
|
706
|
+
}>;
|
|
707
|
+
|
|
708
|
+
export declare function compositionSelfCheck(): Readonly<{
|
|
709
|
+
ok: boolean;
|
|
710
|
+
checks: ReadonlyArray<{ name: string; pass: boolean }>;
|
|
711
|
+
}>;
|
|
712
|
+
|
|
713
|
+
// ---------------------------------------------------------------------------
|
|
714
|
+
// CG-REF/1 — from `receipt_id` to bytes, with the four answers kept apart:
|
|
715
|
+
// resolved, absent, unresolvable, tampered. A name alone proves nothing.
|
|
716
|
+
// ---------------------------------------------------------------------------
|
|
717
|
+
|
|
718
|
+
export const REFERENCE_VERSION: "CG-REF/1";
|
|
719
|
+
export const REFERENCE_SCHEMA: "coreguard.reference/1";
|
|
720
|
+
export const ID_FORMS: readonly ["urn-sha256", "url", "opaque"];
|
|
721
|
+
|
|
722
|
+
export interface ReceiptIdFacts {
|
|
723
|
+
form: "urn-sha256" | "url" | "opaque";
|
|
724
|
+
receiptId: string;
|
|
725
|
+
digest: string | null;
|
|
726
|
+
contentAddressed: boolean;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface ResolutionStep {
|
|
730
|
+
tier: "inline" | "registry" | "locator";
|
|
731
|
+
proves: string;
|
|
732
|
+
possible: boolean;
|
|
733
|
+
candidates?: readonly string[];
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
export interface ResolutionPlan {
|
|
737
|
+
refVersion: string;
|
|
738
|
+
idForm: string;
|
|
739
|
+
contentAddressed: boolean;
|
|
740
|
+
idDigest: string | null;
|
|
741
|
+
steps: readonly ResolutionStep[];
|
|
742
|
+
strongestPossible: "resolved-by-content" | "resolved-by-expectation";
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export interface ResolutionResult {
|
|
746
|
+
refVersion: string;
|
|
747
|
+
schema: string;
|
|
748
|
+
receiptId: string;
|
|
749
|
+
idForm: string;
|
|
750
|
+
source: "inline" | "registry" | "locator" | null;
|
|
751
|
+
state: "resolved" | "resolved-unchecked" | "absent" | "unresolvable" | "tampered";
|
|
752
|
+
digest: string | null;
|
|
753
|
+
expectedDigest: string | null;
|
|
754
|
+
bytes: string | null;
|
|
755
|
+
size: number;
|
|
756
|
+
checks: readonly { name: string; ok: boolean }[];
|
|
757
|
+
tried: readonly { tier: string; ok: boolean; url?: string; reason?: string; status?: number | null }[];
|
|
758
|
+
reason: string | null;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export declare function digestOf(bytes: string | Uint8Array): string;
|
|
762
|
+
export declare function classifyReceiptId(receiptId: string): ReceiptIdFacts;
|
|
763
|
+
export declare function deriveLocatorCandidates(input: { receiptId: string; issuerOrigin?: string; path?: string }): readonly string[];
|
|
764
|
+
export declare function planResolution(input: { receiptId: string; issuerOrigin?: string }): ResolutionPlan;
|
|
765
|
+
export declare function resolveReceipt(input: {
|
|
766
|
+
reference: { receiptId: string; profile?: string; issuerOrigin?: string };
|
|
767
|
+
inline?: { bytes: string | Uint8Array; digest?: string } | null;
|
|
768
|
+
registry?: ((id: string) => { bytes: string | Uint8Array; digest?: string } | null) | Map<string, { bytes: string | Uint8Array; digest?: string }> | null;
|
|
769
|
+
expectedDigest?: string | null;
|
|
770
|
+
fetchImpl?: ((url: string, init: { signal: AbortSignal; maxBytes: number }) => Promise<{ url?: string; status?: number; bytes?: string; digest?: string }>) | null;
|
|
771
|
+
maxBytes?: number;
|
|
772
|
+
timeoutMs?: number;
|
|
773
|
+
allowInsecureLoopback?: boolean;
|
|
774
|
+
}): Promise<ResolutionResult>;
|
|
775
|
+
export declare function resolutionOutcome(resolution: ResolutionResult): Readonly<{
|
|
776
|
+
outcome: OutcomeName;
|
|
777
|
+
blocks: boolean;
|
|
778
|
+
state: string;
|
|
779
|
+
reason: string | null;
|
|
780
|
+
source: string | null;
|
|
781
|
+
digest: string | null;
|
|
782
|
+
}>;
|
|
783
|
+
export declare function referenceSelfCheck(): Readonly<{ ok: boolean; checks: ReadonlyArray<{ name: string; pass: boolean }> }>;
|
|
784
|
+
|
|
785
|
+
// ---------------------------------------------------------------------------
|
|
786
|
+
// CG-KEYS/1 — pinned trust roots, signed rotation chains, time-aware revocations.
|
|
787
|
+
// ---------------------------------------------------------------------------
|
|
788
|
+
|
|
789
|
+
export const KEYS_VERSION: "CG-KEYS/1";
|
|
790
|
+
export const KEYS_SCHEMA: "coreguard.keyring/1";
|
|
791
|
+
export const KEY_STATUSES: readonly ["trusted", "rotated", "revoked", "expired", "not-yet-valid", "unknown"];
|
|
792
|
+
|
|
793
|
+
export interface PinnedKey {
|
|
794
|
+
keyId: string;
|
|
795
|
+
publicKeyPem: string;
|
|
796
|
+
issuer: string | null;
|
|
797
|
+
notBefore: string | null;
|
|
798
|
+
notAfter: string | null;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
export interface Keyring {
|
|
802
|
+
keysVersion: string;
|
|
803
|
+
schema: string;
|
|
804
|
+
id: string;
|
|
805
|
+
pinned: readonly PinnedKey[];
|
|
806
|
+
rotations: readonly Record<string, unknown>[];
|
|
807
|
+
revocations: readonly Record<string, unknown>[];
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export interface KeyStatus {
|
|
811
|
+
keyId: string;
|
|
812
|
+
status: "trusted" | "rotated" | "revoked" | "expired" | "not-yet-valid" | "unknown";
|
|
813
|
+
trustedAtTime: boolean;
|
|
814
|
+
acceptsNew: boolean;
|
|
815
|
+
at: string;
|
|
816
|
+
reason: string | null;
|
|
817
|
+
issuer?: string | null;
|
|
818
|
+
chainFrom?: string | null;
|
|
819
|
+
depth?: number;
|
|
820
|
+
rotatedTo?: string | null;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export declare function createKeyring(input?: { id?: string }): Keyring;
|
|
824
|
+
export declare function pinKey(keyring: Keyring, input: { publicKeyPem: string; issuer?: string | null; notBefore?: string | null; notAfter?: string | null }): Keyring;
|
|
825
|
+
export declare function rotateKey(keyring: Keyring, input: { privateKeyPem: string; newPublicKeyPem: string; at: string; overlapUntil: string }): Keyring;
|
|
826
|
+
export declare function revokeKey(keyring: Keyring, input: { privateKeyPem: string; keyId: string; at: string; retroactive?: boolean; reason?: string | null }): Keyring;
|
|
827
|
+
export declare function checkKey(keyring: Keyring, input: { keyId: string; at: string }): KeyStatus;
|
|
828
|
+
export declare function verifyWithTrust(attestation: AnchorAttestation, keyring: Keyring): Readonly<{
|
|
829
|
+
ok: boolean;
|
|
830
|
+
keyStatus: string;
|
|
831
|
+
outcome: OutcomeName;
|
|
832
|
+
acceptsNew: boolean;
|
|
833
|
+
reason: string | null;
|
|
834
|
+
checks: readonly { name: string; ok: boolean }[];
|
|
835
|
+
signatureOk: boolean;
|
|
836
|
+
chain: { from: string; depth: number | null } | null;
|
|
837
|
+
}>;
|
|
838
|
+
export declare function keysSelfCheck(): Readonly<{ ok: boolean; checks: ReadonlyArray<{ name: string; pass: boolean }> }>;
|
|
839
|
+
|
|
840
|
+
// ---------------------------------------------------------------------------
|
|
841
|
+
// CG-SPEND/1 — single use that survives a restart, a second worker and a second
|
|
842
|
+
// system; disagreement between logs is a named conflict, not a duplicate.
|
|
843
|
+
// ---------------------------------------------------------------------------
|
|
844
|
+
|
|
845
|
+
export const SPEND_VERSION: "CG-SPEND/1";
|
|
846
|
+
export const SPEND_SCHEMA: "coreguard.spend/1";
|
|
847
|
+
export const SPEND_STATES: readonly ["unspent", "spent", "conflict", "busy", "unreadable"];
|
|
848
|
+
|
|
849
|
+
export interface SpendEntry {
|
|
850
|
+
spendVersion: string;
|
|
851
|
+
schema: string;
|
|
852
|
+
type: "spend";
|
|
853
|
+
receiptDigest: string;
|
|
854
|
+
approvalNonce: string;
|
|
855
|
+
spendKey: string;
|
|
856
|
+
at: string;
|
|
857
|
+
orderRef: string | null;
|
|
858
|
+
issuer: { keyId: string; publicKeyPem: string };
|
|
859
|
+
signature: string;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export interface SpendLog {
|
|
863
|
+
spendVersion: string;
|
|
864
|
+
schema: string;
|
|
865
|
+
path: string | null;
|
|
866
|
+
entries: readonly SpendEntry[];
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export interface SpendVerdict {
|
|
870
|
+
state: "unspent" | "spent" | "conflict" | "busy" | "unreadable";
|
|
871
|
+
reason: string | null;
|
|
872
|
+
matches: number;
|
|
873
|
+
sources: number;
|
|
874
|
+
entries?: readonly SpendEntry[];
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export declare function spendKeyFor(input: { receiptDigest: string; approvalNonce: string }): string;
|
|
878
|
+
export declare function createSpendLog(input?: { path?: string | null }): SpendLog;
|
|
879
|
+
export declare function makeSpendEntry(input: { receiptDigest: string; approvalNonce: string; at: string; orderRef?: string | null; privateKeyPem: string }): SpendEntry;
|
|
880
|
+
export declare function verifySpendEntry(entry: unknown): Readonly<{ ok: boolean; checks: readonly { name: string; ok: boolean }[] }>;
|
|
881
|
+
export declare function checkSpent(
|
|
882
|
+
logs: SpendLog | readonly SpendLog[] | readonly SpendEntry[] | readonly unknown[],
|
|
883
|
+
input: { receiptDigest: string; approvalNonce: string },
|
|
884
|
+
): SpendVerdict;
|
|
885
|
+
export declare function readSpendLog(path: string): SpendLog;
|
|
886
|
+
export declare function claimSpend(input: {
|
|
887
|
+
path: string;
|
|
888
|
+
receiptDigest: string;
|
|
889
|
+
approvalNonce: string;
|
|
890
|
+
at: string;
|
|
891
|
+
orderRef?: string | null;
|
|
892
|
+
privateKeyPem: string;
|
|
893
|
+
timeoutMs?: number;
|
|
894
|
+
}): Readonly<{ ok: boolean; state: string; reason: string | null; entry: SpendEntry | null; entries: readonly SpendEntry[] }>;
|
|
895
|
+
export declare function mergeLogs(logs: readonly unknown[]): Readonly<{
|
|
896
|
+
spendVersion: string;
|
|
897
|
+
entries: readonly SpendEntry[];
|
|
898
|
+
uniqueSpends: number;
|
|
899
|
+
conflicts: readonly { receiptDigest: string; nonces: readonly string[]; entries: readonly SpendEntry[] }[];
|
|
900
|
+
}>;
|
|
901
|
+
export declare function spendSelfCheck(): Readonly<{ ok: boolean; checks: ReadonlyArray<{ name: string; pass: boolean }> }>;
|
|
902
|
+
|
|
903
|
+
// ---------------------------------------------------------------------------
|
|
904
|
+
// CG-DECIDE/1 — outcome to authorisation. Only a failed check may decline;
|
|
905
|
+
// missing evidence is an allow that says so, never a silent pass.
|
|
906
|
+
// ---------------------------------------------------------------------------
|
|
907
|
+
|
|
908
|
+
export const DECISION_VERSION: "CG-DECIDE/1";
|
|
909
|
+
export const DECISION_SCHEMA: "coreguard.decision/1";
|
|
910
|
+
export const DECISIONS: readonly ["ALLOW", "ALLOW_UNVERIFIED", "HOLD", "DECLINE"];
|
|
911
|
+
export const POLICIES: readonly ["strict", "balanced", "availability"];
|
|
912
|
+
|
|
913
|
+
export interface PaymentDecision {
|
|
914
|
+
decisionVersion: string;
|
|
915
|
+
schema: string;
|
|
916
|
+
decision: "ALLOW" | "ALLOW_UNVERIFIED" | "HOLD" | "DECLINE";
|
|
917
|
+
outcome: OutcomeName;
|
|
918
|
+
policy: "strict" | "balanced" | "availability";
|
|
919
|
+
code: string | null;
|
|
920
|
+
reason: string | null;
|
|
921
|
+
unverified: boolean;
|
|
922
|
+
verified: boolean;
|
|
923
|
+
blocks: boolean;
|
|
924
|
+
captureAllowed: boolean;
|
|
925
|
+
retry: boolean;
|
|
926
|
+
explain: string;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export declare function decidePayment(input: { outcome: OutcomeName; policy?: "strict" | "balanced" | "availability" }): PaymentDecision;
|
|
930
|
+
export declare function explainDecision(input: { decision: PaymentDecision["decision"]; outcome: OutcomeName; policy: string }): string;
|
|
931
|
+
export declare function decisionMatrix(): readonly PaymentDecision[];
|
|
932
|
+
export declare function assertDecisionInvariants(): Readonly<{ ok: boolean; violations: readonly string[]; rows: number }>;
|
|
933
|
+
export declare function decisionSelfCheck(): Readonly<{ ok: boolean; checks: ReadonlyArray<{ name: string; pass: boolean }> }>;
|
|
934
|
+
|
|
935
|
+
// ---------------------------------------------------------------------------
|
|
936
|
+
// CGCP/1 — self-hosted Policy & Evidence Control Plane.
|
|
937
|
+
// BUILT: agents, immutable policy versions, approvals, rolling spend windows,
|
|
938
|
+
// execution and verification ledgers, revocation, hash-chained audit, an
|
|
939
|
+
// authenticated HTTP API and a CLI.
|
|
940
|
+
// NOT_BUILT: multi-tenant RBAC/SSO/SCIM, distributed HA/consensus, KMS/HSM,
|
|
941
|
+
// managed SLA, payment custody. Single host, single API key, file-backed.
|
|
942
|
+
// ---------------------------------------------------------------------------
|
|
943
|
+
|
|
944
|
+
export const CONTROL_PLANE_VERSION: "CGCP/1";
|
|
945
|
+
export const CONTROL_PLANE_SCHEMA: "coreguard.control-plane/1";
|
|
946
|
+
export const CONTROL_PLANE_BOUNDARY: string;
|
|
947
|
+
export const CONTROL_PLANE_DECISION_REASONS: readonly string[];
|
|
948
|
+
|
|
949
|
+
export interface ControlPlanePolicySpec {
|
|
950
|
+
spendLimitMinor: string | null;
|
|
951
|
+
dailyLimitMinor: string | null;
|
|
952
|
+
totalLimitMinor: string | null;
|
|
953
|
+
requireApprovalAboveMinor: string | null;
|
|
954
|
+
currency: string | null;
|
|
955
|
+
allowMerchants: string[];
|
|
956
|
+
denyMerchants: string[];
|
|
957
|
+
allowAddresses: string[];
|
|
958
|
+
denyAddresses: string[];
|
|
959
|
+
rules: unknown[];
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export interface ControlPlanePolicyVersion {
|
|
963
|
+
version: number;
|
|
964
|
+
hash: string;
|
|
965
|
+
at: string;
|
|
966
|
+
note: string | null;
|
|
967
|
+
spec: ControlPlanePolicySpec;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export interface ControlPlaneAgent {
|
|
971
|
+
id: string;
|
|
972
|
+
name?: string | null;
|
|
973
|
+
status: "active" | "inactive" | "revoked";
|
|
974
|
+
policyId: string | null;
|
|
975
|
+
metadata: Record<string, unknown>;
|
|
976
|
+
createdAt: string;
|
|
977
|
+
updatedAt: string;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export interface ControlPlanePolicy {
|
|
981
|
+
id: string;
|
|
982
|
+
name: string;
|
|
983
|
+
status: "active" | "inactive" | "revoked";
|
|
984
|
+
currentVersion: number;
|
|
985
|
+
versions: ControlPlanePolicyVersion[];
|
|
986
|
+
createdAt: string;
|
|
987
|
+
updatedAt: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
export interface ControlPlaneApproval {
|
|
991
|
+
id: string;
|
|
992
|
+
agentId: string;
|
|
993
|
+
policyId: string | null;
|
|
994
|
+
merchant: string | null;
|
|
995
|
+
address: string | null;
|
|
996
|
+
amountMinor: string | null;
|
|
997
|
+
currency: string | null;
|
|
998
|
+
status: "pending" | "approved" | "rejected";
|
|
999
|
+
requestedAt: string;
|
|
1000
|
+
requestedBy: string | null;
|
|
1001
|
+
expiresAt: string;
|
|
1002
|
+
decidedAt: string | null;
|
|
1003
|
+
decidedBy: string | null;
|
|
1004
|
+
reason: string | null;
|
|
1005
|
+
hash: string | null;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
export interface ControlPlaneDecision {
|
|
1009
|
+
version: string;
|
|
1010
|
+
allowed: boolean;
|
|
1011
|
+
reasons: string[];
|
|
1012
|
+
checks: Record<string, unknown>;
|
|
1013
|
+
agentId: string | null;
|
|
1014
|
+
policyId: string | null;
|
|
1015
|
+
policyVersion: number | null;
|
|
1016
|
+
merchant: string | null;
|
|
1017
|
+
address: string | null;
|
|
1018
|
+
amountMinor: string | null;
|
|
1019
|
+
currency: string | null;
|
|
1020
|
+
approvalId: string | null;
|
|
1021
|
+
at: string;
|
|
1022
|
+
boundary: string;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
export interface ControlPlaneExecution {
|
|
1026
|
+
id: string;
|
|
1027
|
+
agentId: string | null;
|
|
1028
|
+
policyId: string | null;
|
|
1029
|
+
policyVersion: number | null;
|
|
1030
|
+
merchant: string | null;
|
|
1031
|
+
address: string | null;
|
|
1032
|
+
amountMinor: string | null;
|
|
1033
|
+
currency: string | null;
|
|
1034
|
+
approvalId: string | null;
|
|
1035
|
+
receiptId: string | null;
|
|
1036
|
+
verdict: string | null;
|
|
1037
|
+
orderRef: string | null;
|
|
1038
|
+
at: string;
|
|
1039
|
+
decisionHash: string;
|
|
1040
|
+
hash: string;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
export interface ControlPlaneSpendSummary {
|
|
1044
|
+
agentId: string | null;
|
|
1045
|
+
policyId: string | null;
|
|
1046
|
+
executions: number;
|
|
1047
|
+
rolling24hMinor: string;
|
|
1048
|
+
totalMinor: string;
|
|
1049
|
+
boundary: string;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
export interface ControlPlaneCommitResult {
|
|
1053
|
+
committed: boolean;
|
|
1054
|
+
duplicate: boolean;
|
|
1055
|
+
reasons?: string[];
|
|
1056
|
+
executionId: string;
|
|
1057
|
+
execution?: ControlPlaneExecution;
|
|
1058
|
+
decision?: ControlPlaneDecision;
|
|
1059
|
+
spend?: { agentId: string | null; policyId: string | null; rolling24hMinor: string; totalMinor: string };
|
|
1060
|
+
boundary: string;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
export interface ControlPlaneAuditEntry {
|
|
1064
|
+
seq: number;
|
|
1065
|
+
type: string;
|
|
1066
|
+
at: string;
|
|
1067
|
+
detail: unknown;
|
|
1068
|
+
prevHash: string;
|
|
1069
|
+
hash: string;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
export interface ControlPlaneChainStatus {
|
|
1073
|
+
ok: boolean;
|
|
1074
|
+
length: number;
|
|
1075
|
+
brokenAt: number | null;
|
|
1076
|
+
reason: string | null;
|
|
1077
|
+
headHash: string;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
export interface ControlPlaneAuditReport {
|
|
1081
|
+
version: string;
|
|
1082
|
+
schema: string;
|
|
1083
|
+
boundary: string;
|
|
1084
|
+
generatedAt: string;
|
|
1085
|
+
counts: Record<string, number>;
|
|
1086
|
+
chain: ControlPlaneChainStatus;
|
|
1087
|
+
agents: ControlPlaneAgent[];
|
|
1088
|
+
policies: Array<ControlPlanePolicy & { active: ControlPlanePolicyVersion | null }>;
|
|
1089
|
+
revocations: Array<{ agentId: string; reason: string; at: string }>;
|
|
1090
|
+
recentExecutions: ControlPlaneExecution[];
|
|
1091
|
+
recentVerifications: Array<Record<string, unknown>>;
|
|
1092
|
+
recentAudit: ControlPlaneAuditEntry[];
|
|
1093
|
+
reportHash: string;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
export interface ControlPlaneLedgerVerification {
|
|
1097
|
+
ok: boolean;
|
|
1098
|
+
chain: ControlPlaneChainStatus;
|
|
1099
|
+
executions: number;
|
|
1100
|
+
executionHashesOk: boolean;
|
|
1101
|
+
approvals: number;
|
|
1102
|
+
approvalHashesOk: boolean;
|
|
1103
|
+
boundary: string;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
export interface ControlPlane {
|
|
1107
|
+
version: string;
|
|
1108
|
+
schema: string;
|
|
1109
|
+
boundary: string;
|
|
1110
|
+
storePath: string;
|
|
1111
|
+
upsertAgent(agent: Partial<ControlPlaneAgent> & { id: string }): ControlPlaneAgent;
|
|
1112
|
+
getAgent(agentId: string): ControlPlaneAgent | null;
|
|
1113
|
+
listAgents(): ControlPlaneAgent[];
|
|
1114
|
+
bindPolicy(agentId: string, policyId: string): ControlPlaneAgent;
|
|
1115
|
+
revokeAgent(agentId: string, reason?: string): ControlPlaneAgent;
|
|
1116
|
+
upsertPolicy(policy: Partial<ControlPlanePolicySpec> & { id: string; name?: string; status?: string; note?: string | null }): ControlPlanePolicy;
|
|
1117
|
+
getPolicy(policyId: string): ControlPlanePolicy | null;
|
|
1118
|
+
listPolicies(): ControlPlanePolicy[];
|
|
1119
|
+
revokePolicy(policyId: string, reason?: string): ControlPlanePolicy;
|
|
1120
|
+
requestApproval(request: { agentId: string; id?: string; policyId?: string | null; merchant?: string | null; address?: string | null; amountMinor?: string | null; currency?: string | null; requestedBy?: string | null; expiresAt?: string | null }): ControlPlaneApproval;
|
|
1121
|
+
decideApproval(approvalId: string, decision: { decision: "approved" | "rejected"; decidedBy?: string | null; reason?: string | null }): ControlPlaneApproval;
|
|
1122
|
+
getApproval(approvalId: string): ControlPlaneApproval | null;
|
|
1123
|
+
recordApproval(approval: Record<string, unknown> & { id: string; agentId: string }): Record<string, unknown>;
|
|
1124
|
+
evaluate(request: { agentId?: string | null; policyId?: string | null; merchant?: string | null; address?: string | null; amountMinor?: string | null; currency?: string | null; approvalId?: string | null }): ControlPlaneDecision;
|
|
1125
|
+
authorize(request: { agentId?: string | null; policyId?: string | null; merchant?: string | null; address?: string | null; amountMinor?: string | null; currency?: string | null; approvalId?: string | null }): ControlPlaneDecision & { decisionId: string };
|
|
1126
|
+
commitExecution(execution: { agentId: string; id?: string; policyId?: string | null; merchant?: string | null; address?: string | null; amountMinor: string; currency?: string | null; approvalId?: string | null; receiptId?: string | null; verdict?: string | null; orderRef?: string | null }): ControlPlaneCommitResult;
|
|
1127
|
+
recordExecution(execution: Record<string, unknown> & { id: string }): Record<string, unknown>;
|
|
1128
|
+
recordVerification(verification: Record<string, unknown>): Record<string, unknown>;
|
|
1129
|
+
listExecutions(input?: { limit?: number }): ControlPlaneExecution[];
|
|
1130
|
+
listVerifications(input?: { limit?: number }): Array<Record<string, unknown>>;
|
|
1131
|
+
spend(input?: { agentId?: string | null; policyId?: string | null }): ControlPlaneSpendSummary;
|
|
1132
|
+
auditReport(input?: { limit?: number }): ControlPlaneAuditReport;
|
|
1133
|
+
verifyLedger(): ControlPlaneLedgerVerification;
|
|
1134
|
+
getState(): Record<string, unknown>;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
export declare function createControlPlane(input: {
|
|
1138
|
+
storePath: string;
|
|
1139
|
+
now?: () => Date;
|
|
1140
|
+
lockTimeoutMs?: number;
|
|
1141
|
+
staleLockMs?: number;
|
|
1142
|
+
}): ControlPlane;
|
|
1143
|
+
|
|
1144
|
+
export declare function verifyAuditChain(state: unknown): ControlPlaneChainStatus;
|
|
1145
|
+
|
|
1146
|
+
export declare function createControlPlaneHandler(input: {
|
|
1147
|
+
controlPlane: ControlPlane;
|
|
1148
|
+
apiKey: string;
|
|
1149
|
+
maxBodyBytes?: number;
|
|
1150
|
+
}): (req: unknown, res: unknown) => Promise<void>;
|
|
1151
|
+
|
|
1152
|
+
export declare function createControlPlaneServer(input: {
|
|
1153
|
+
controlPlane: ControlPlane;
|
|
1154
|
+
apiKey: string;
|
|
1155
|
+
maxBodyBytes?: number;
|
|
1156
|
+
}): unknown;
|
|
1157
|
+
|
|
1158
|
+
export declare function startControlPlaneServer(input: {
|
|
1159
|
+
storePath?: string;
|
|
1160
|
+
apiKey: string;
|
|
1161
|
+
port?: number;
|
|
1162
|
+
host?: string;
|
|
1163
|
+
controlPlane?: ControlPlane | null;
|
|
1164
|
+
maxBodyBytes?: number;
|
|
1165
|
+
}): Promise<{
|
|
1166
|
+
server: unknown;
|
|
1167
|
+
controlPlane: ControlPlane;
|
|
1168
|
+
url: string;
|
|
1169
|
+
port: number;
|
|
1170
|
+
close(): Promise<void>;
|
|
1171
|
+
}>;
|