@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
69 lines • 3.03 kB
TypeScript
import { type RosterView, type ServiceSig } from "./roster-entries.ts";
import { type LocalKeyVerification } from "./verified-keys.ts";
import type { VerifierRevocation } from "./verifier-revocations.ts";
export interface PlacementClaim {
readonly accountId: string;
readonly placementId: string;
readonly epoch: number;
/** Generation of the placement-registry key that signed this claim (4.6). */
readonly registryGeneration: number;
readonly issuedAt: number;
readonly expiresAt: number;
}
export interface SignedPlacementClaim {
readonly claim: PlacementClaim;
readonly sig: ServiceSig;
}
/** A claim may live at most 24 h; the brain renews it at half-life under the same epoch (4.6). */
export declare const CLAIM_MAX_LIFETIME_MS = 86400000;
/** Device-side tolerance for a claim's `issuedAt` in the hand's future (15.15 M-1); `MOVE_SKEW_MS` stays server-side. */
export declare const CLAIM_ISSUE_SKEW_MS = 300000;
export type ClaimVerdict = "valid" | "invalid" | "malformed" | "expired" | "superseded" | "unknown";
/** The `provider.call.error` each refusal answers with (4.6, 15.14 M-3, C.P1). */
export declare const CLAIM_VERDICT_ERRORS: {
readonly invalid: {
readonly code: "stale_epoch";
readonly retryable: false;
};
readonly malformed: {
readonly code: "claim_invalid";
readonly retryable: false;
};
readonly expired: {
readonly code: "claim_expired";
readonly retryable: true;
};
readonly superseded: {
readonly code: "registry_key_revoked";
readonly retryable: true;
};
readonly unknown: {
readonly code: "registry_key_unknown";
readonly retryable: true;
};
};
/** The highest epoch this hand accepted for one (account, registry generation), and the placement that held it. */
export interface EpochFloor {
readonly epoch: number;
readonly placementId: string;
}
/** What this hand trusts when it checks a claim; supplied by the hand's executor (CK8), read fresh per check. */
export interface ClaimTrust {
readonly accountId: string;
readonly records: readonly LocalKeyVerification[];
readonly roster: RosterView;
readonly revocations: readonly VerifierRevocation[];
epochFloor(accountId: string, registryGeneration: number): EpochFloor | undefined;
}
export interface ClaimClock {
readonly now: number;
readonly nowMono: number;
}
export interface ClaimVerifier {
verify(claim: unknown, clock: ClaimClock): Promise<ClaimVerdict>;
}
/** `ASCII(domain) || 0x00 || UTF8(canonicalJson(claim))`: the exact bytes the registry key signs (C.P1). */
export declare function placementClaimSigningInput(claim: PlacementClaim): Uint8Array<ArrayBuffer>;
/** The claim's verdict for this hand (custody design 4.6, 15.15, 15.16 and the total order of C.P1). */
export declare function verifyPlacementClaim(value: unknown, trust: ClaimTrust, clock: ClaimClock): Promise<ClaimVerdict>;
//# sourceMappingURL=placement-claim.d.ts.map