import type { AccessContext, Address, Capability, CapabilityGrant, MessageDeliveryResult, MessageEnvelope, ResourceOperation, ResourceResult, ToolNamespace, ToolNamespaceUpdate } from "@aicoo/sharedos-contracts"; import { SharedOSKernel, type AuditEvent, type AuditSink, type DelegationChainResolver, type GrantSource, type GrantUsageStore, type MessageRequestRouter, type MessageTransport, type ResourceProvider, type ToolNamespaceSettingsStore } from "@aicoo/sharedos-core"; export declare class InMemoryAuditSink implements AuditSink { readonly events: AuditEvent[]; record(event: AuditEvent): Promise; } export declare class InMemoryMessageTransport implements MessageTransport { readonly deliveries: Array<{ context: AccessContext; envelope: MessageEnvelope; }>; deliver(context: AccessContext, envelope: MessageEnvelope): Promise; } /** * Answers a request from the transport's own log of accepted deliveries. * * The reply is derived from the request, so a test can predict it: the id is * the request's with `-reply` appended, the parties are swapped, and the * payload names the message it answers. A request the transport never accepted * has no reply to give, and asking for one throws. */ export declare class InMemoryMessageRequestRouter implements MessageRequestRouter { #private; constructor(transport: InMemoryMessageTransport); resolveReply(context: AccessContext, request: MessageEnvelope, delivery: MessageDeliveryResult): Promise; } /** Namespace settings fixture keyed by the access-context namespace/world. */ export declare class InMemoryToolNamespaceSettingsStore implements ToolNamespaceSettingsStore { #private; constructor(initial?: Readonly>); applyUpdate(context: AccessContext, update: ToolNamespaceUpdate): Promise; get(namespaceId: string): readonly ToolNamespace[]; } /** * A host grant store fixture. * * `load` answers only with grants issued to the context's actor by its * authority inside its namespace, which is the contract every production * `GrantSource` must satisfy. */ export declare class InMemoryGrantSource implements GrantSource { #private; constructor(grants?: readonly CapabilityGrant[]); add(...grants: readonly CapabilityGrant[]): this; /** Record a revocation the way a host store would, without deleting history. */ revoke(grantId: string, revokedAt: string): this; /** Move a grant's expiry, the way a host store would record a shortened window. */ expire(grantId: string, expiresAt: string): this; load(context: AccessContext): Promise; } /** A grant store that is down; every decision made against it must fail closed. */ export declare class UnavailableGrantSource implements GrantSource { load(): Promise; } /** Namespace-scoped ancestor lookup for delegated-grant fixtures. */ export declare class InMemoryDelegationChainResolver implements DelegationChainResolver { #private; constructor(grants?: readonly CapabilityGrant[]); add(grant: CapabilityGrant): this; /** Record a revocation the way a host grant store would, in place. */ revoke(namespaceId: string, grantId: string, revokedAt: string): this; /** Move a grant's expiry in place, as {@link InMemoryGrantSource.expire} does. */ expire(namespaceId: string, grantId: string, expiresAt: string): this; resolve(namespaceId: string, grantId: string): Promise; } /** * A usage store that cannot answer. * * Bounded use is the one authorization question SharedOS cannot decide from the * grant set alone, so an unreachable counter is an unknown fact rather than a * policy outcome. It throws on both reads and writes: a store that answered * reads while failing writes would let discovery quietly disagree with * execution. */ export declare class UnavailableGrantUsageStore implements GrantUsageStore { getUsage(): Promise; tryConsume(): Promise; } /** A resolver whose authoritative source is down; every lookup must fail closed. */ export declare class UnavailableDelegationChainResolver implements DelegationChainResolver { resolve(): Promise; } export type ResourceHandler = (operation: ResourceOperation) => Promise; /** A host-neutral recording provider for examples, conformance tests, and isolated experiment worlds. */ export declare class InMemoryResourceProvider implements ResourceProvider { #private; readonly namespace: string; readonly operations: ResourceOperation[]; constructor(namespace: string, handler?: ResourceHandler); invoke(operation: ResourceOperation): Promise; } export interface TestKernel { readonly kernel: SharedOSKernel; readonly audit: InMemoryAuditSink; readonly messages: InMemoryMessageTransport; /** The trusted store the kernel loads authority from; mutate it to grant or revoke. */ readonly grants: InMemoryGrantSource; } export interface TestKernelOptions { /** Seed authority for the kernel's trusted grant source. */ readonly grants?: readonly CapabilityGrant[]; /** Replaces the trusted grant source, for example to exercise an outage. */ readonly grantSource?: GrantSource; /** Installs ancestor validation so delegated grants can be exercised. */ readonly delegationResolver?: DelegationChainResolver; } export declare function createTestKernel(options?: TestKernelOptions): TestKernel; export interface TestContextOptions { readonly actor?: Address; readonly authority?: Address; readonly owner?: Address; readonly namespaceId?: string; readonly enabledToolNamespaces?: readonly string[]; readonly purpose?: string; readonly traceId?: string; readonly now?: string; } export declare function createTestContext(options?: TestContextOptions): AccessContext; export interface TestGrantOptions { readonly id?: string; readonly namespaceId?: string; readonly subject?: Address; readonly issuer?: Address; readonly capabilities: readonly Capability[]; readonly purposes?: readonly string[]; readonly issuedAt?: string; readonly notBefore?: string; readonly expiresAt?: string; readonly revokedAt?: string; readonly maxUses?: number; readonly delegationDepth?: number; readonly parentGrantId?: string; } export declare function createTestGrant(options: TestGrantOptions): CapabilityGrant; //# sourceMappingURL=index.d.ts.map