import { z } from 'zod'; type ActionAttempt = { attempt: number; status: string; startedAt: number; finishedAt?: number; httpStatus?: number; errorCode?: string; errorMessage?: string; responseSnippet?: string; }; type ActionLiveFeedResult = { items: Array<{ subscriptionName: string; deliveryId: string; runId?: string; status: string; matchedOperationIndexes: Array; matchedOperations: Array<{ index: number; operation?: unknown; }>; createdAt: number; updatedAt?: number; runStatus?: string; attemptCount?: number; maxAttempts?: number; lastErrorCode?: string; lastErrorMessage?: string; lastResponseSnippet?: string; traceId?: string; causationId?: string; hopCount?: number; originRunId?: string; originRepoId?: string; actionContainer?: string; }>; nextCursor?: string; }; type ActionNotification = { subscriptionName?: string; attempt: number; channel: string; status: string; eventType?: string; errorCode?: string; errorMessage?: string; createdAt: number; }; type ActionRun = { runId: string; subscriptionName?: string; status: string; matchedOperationIndexes: Array; attemptCount: number; maxAttempts: number; lastErrorCode?: string; lastErrorMessage?: string; traceId?: string; causationId?: string; hopCount?: number; originRunId?: string; originRepoId?: string; createdAt: number; updatedAt: number; }; type ActionRunStats = { total: number; byStatus: { pending: number; running: number; processing: number; retry_wait: number; succeeded: number; suppressed: number; failed_terminal: number; dead_letter: number; }; }; type AccessResolveInput$1 = { repos?: Array<{ orgName: string; repoName: string; repoDurableId?: never; } | { repoDurableId: string; orgName?: never; repoName?: never; }>; orgs?: Array<{ orgName: string; }>; }; type AccessResolveResult$1 = { repos: Array<{ visible: boolean; scopes: Array; allowedMatches?: Array; orgName: string; repoName: string; repoDurableId?: string; } | { visible: boolean; scopes: Array; allowedMatches?: Array; orgName?: never; repoName?: never; repoDurableId: string; }>; orgs: Array<{ orgName: string; visible: boolean; scopes: Array; }>; }; type AuthSyncResult = { success: boolean; }; type CollectionTag$1 = 'arc' | 'bond' | 'pair' | 'set' | 'list'; type CommitRealOperationResult$1 = { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }; type CommitDiagnostic$1 = { code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }; type CommitValidateInput$1 = { orgName: string; repoName: string; committer?: string; message?: string; componentRef?: string; workspaceName?: never; operations: Array<{ operation: 'add'; kind: 'shape'; name: string; data: unknown; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'add'; kind: 'thing'; name: string; data: unknown; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'add'; kind: 'assertion'; name: string; about: string; data: unknown; affirmedTargets?: Array; skipExisting?: boolean; } | { operation: 'add'; kind: 'collection'; name: string; type: 'arc' | 'bond' | 'pair' | 'set' | 'list'; members: Array; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'revise'; kind: 'shape'; name: string; data: unknown; affirmedTargets?: never; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'thing'; name: string; data: unknown; affirmedTargets?: never; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'assertion'; name: string; data: unknown; affirmedTargets?: Array; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'collection'; name: string; type: 'arc' | 'bond' | 'pair' | 'set' | 'list'; members: Array; affirmedTargets?: never; expectedVersion?: number; leaseId?: string; } | { operation: 'retract'; name: string; kind?: 'shape' | 'thing' | 'assertion' | 'collection'; reason?: string; expectedVersion?: number; leaseId?: string; } | { operation: 'reaffirm'; kind?: 'assertion'; name: string; add?: Array; remove?: Array; expectedVersion?: number; leaseId?: string; } | { operation: 'rename'; name: string; newName: string; kind?: 'shape' | 'thing' | 'assertion' | 'collection'; }>; includeWouldBeBody?: boolean; }; type CommitValidateResult$1 = { operationCount: number; canCommit: boolean; counts: { wouldApply: number; noop: number; error: number; }; baseline: { kind: 'repo_seq'; repoSeq: number; } | { kind: 'withheld'; }; caveats: Array<{ code: string; message: string; }>; committer?: string; message?: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'would_apply' | 'noop'; version?: number; dataHash?: string; wouldBeBody?: unknown; effects?: Array<{ effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'would_apply' | 'noop'; version?: number; dataHash?: string; wouldBeBody?: unknown; } | { effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; } | { effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'discarded'; reason: 'sibling_failed'; }>; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; effects?: Array<{ effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'would_apply' | 'noop'; version?: number; dataHash?: string; wouldBeBody?: unknown; } | { effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; } | { effectIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'discarded'; reason: 'sibling_failed'; }>; }>; }; type OperationEventReceipt$1 = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; type OperationEventReceiptV1$1 = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; type CollectionContainsResult$1 = { shape: string; wref: string; version: number; results: Array<{ member: string; contains: boolean; positions?: Array; }>; }; type CollectionDiffResult$1 = { shape: string; leftWref: string; rightWref: string; leftVersion: number; rightVersion: number; mode: 'membership' | 'ordered'; added: Array<{ wref: string; position?: number; fieldPath: string; }>; removed: Array<{ wref: string; position?: number; fieldPath: string; }>; unchanged: Array<{ wref: string; position?: number; fieldPath: string; }>; changed: Array<{ position: number; left?: { wref: string; position?: number; fieldPath: string; }; right?: { wref: string; position?: number; fieldPath: string; }; }>; }; type CollectionMember$1 = { wref: string; position?: number; fieldPath: string; }; type CollectionMembersPage$1 = { shape: string; wref: string; version: number; items: Array<{ wref: string; position?: number; fieldPath: string; }>; nextCursor?: string; }; type CollectionStatsResult$1 = { shape: string; wref: string; version: number; memberCount: number; uniqueMemberCount: number; }; type CollectionType$1 = 'arc' | 'bond' | 'set' | 'list' | 'pair'; type ComponentDetail = { ref?: string; componentName: string; version?: string; state?: 'initiated' | 'active' | 'uninstalled'; source?: string; sourceUrl?: string; sourceRef?: string; resolvedSha?: string; manifestHash?: string; installedAt?: string; active: boolean; latestVersion?: string; updateAvailable?: boolean; installedManifest: unknown; installComponentId?: string; ownedShapes: Array<{ name: string; kind: 'shape'; active: boolean; version: { version: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm'; data: unknown; dataHash: string; } | null; componentRef?: string; }>; ownedThings: Array<{ wref: string; name: string; kind: 'thing' | 'assertion' | 'shape'; shapeName?: string; declaredShapes?: Array; validatedShapes?: Array; componentRef?: string; version: number; createdAt: number; data?: unknown; active: boolean; aboutWref?: string; affirmedWrefs?: Array; roles?: Array<'from' | 'to' | 'ends' | 'first' | 'second' | 'members' | 'items'>; collections?: Array<{ shape: string; memberCount?: number; dataMode: 'full' | 'summary'; fullData: boolean; truncated: boolean; inlineLimit?: number; preview?: Array; previewCount?: number; }>; metadata: { durableId: string; createdOn: number; revisedOn: number; }; }>; }; type ComponentHistoryResult = { items: Array<{ ref: string; kind: string; version: string | null; createdAt: number; }>; }; type ComponentInstallResult$1 = { componentRef: string; componentName: string; version: string; state: 'ready' | 'degraded'; setupCreates: Array; errors: Array; hasSetup: boolean; submissionId: string; eventReceipts: Array<{ event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }>; }; type ComponentListResult = { items: Array<{ ref?: string; componentName: string; version?: string; state?: 'initiated' | 'active' | 'uninstalled'; source?: string; sourceUrl?: string; sourceRef?: string; resolvedSha?: string; manifestHash?: string; installedAt?: string; active: boolean; latestVersion?: string; updateAvailable?: boolean; }>; nextCursor?: string; }; type ComponentSummary = { ref?: string; componentName: string; version?: string; state?: 'initiated' | 'active' | 'uninstalled'; source?: string; sourceUrl?: string; sourceRef?: string; resolvedSha?: string; manifestHash?: string; installedAt?: string; active: boolean; latestVersion?: string; updateAvailable?: boolean; }; type ComponentUninstallResult$1 = { componentRef: string; componentName: string; state: 'uninstalled'; pausedSubscriptions: Array; releasedShapes: Array; tokensRevoked: number; uninstallDispatched: boolean; warnings: Array; submissionId: string; eventReceipts: Array<{ event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }>; }; type CredentialDeleteResult$1 = { ok: true; name: string; }; type CredentialKeyMutationResult$1 = { ok: true; keyName?: string; keyNames: Array; }; type CredentialRevokeResult$1 = { revoked: boolean; }; type Capabilities = { apiVersion: string; minSupportedSdk: string; minSupportedClients: Record; writeContractVersion: number; features: Record; honoredClientFlags: Array; }; type GrantCreateInput = { orgName: string; repoName: string; idempotencyKey: string; recipient: { kind: 'member'; email: string; } | { kind: 'pat'; name: string; } | { kind: 'component'; orgName: string; componentName: string; }; coverage?: { paths: { include: Array; exclude?: Array; }; shapes?: Array; shapeless?: boolean; fields?: Array; } | { include: Array; exclude?: Array; }; viewRef?: string; ops: Array; }; type GrantListInput = { orgName: string; repoName: string; limit: number; cursor?: string; }; type GrantListResult$1 = { items: Array<{ id: string; grantee: { principalId: string; principalKind: 'anonymous' | 'member' | 'pat' | 'component'; }; issuer: { principalId: string; principalKind: 'anonymous' | 'member' | 'pat' | 'component'; }; idempotencyKey: string; requestHash: string; coverage: { paths: { include: Array; exclude?: Array; }; shapes?: Array; shapeless?: boolean; fields?: Array; } | null; viewRef: string | null; ops: Array; createdBy: string; createdAt: string; revokedAt: string | null; revokedBy: string | null; revokedReason: string | null; }>; nextCursor?: string; }; type GrantRevokeResult$1 = { grantId: string; revoked: boolean; }; type GrantView = { id: string; grantee: { principalId: string; principalKind: 'anonymous' | 'member' | 'pat' | 'component'; }; issuer: { principalId: string; principalKind: 'anonymous' | 'member' | 'pat' | 'component'; }; idempotencyKey: string; requestHash: string; coverage: { paths: { include: Array; exclude?: Array; }; shapes?: Array; shapeless?: boolean; fields?: Array; } | null; viewRef: string | null; ops: Array; createdBy: string; createdAt: string; revokedAt: string | null; revokedBy: string | null; revokedReason: string | null; }; type HomepageFeaturedListsResult$1 = { lists: Array<{ slug: string; title: string; description?: string; surface?: string; itemKind?: 'repo' | 'component' | 'skill'; sortOrder?: number; items: Array<{ kind: 'repo' | 'component' | 'skill'; slug: string; title: string; description?: string; sortOrder: number; tagline?: string; category?: string; ctaLabel?: string; curationReason?: string; featuredSince?: string; orgName?: string; repoName?: string; componentName?: string; componentRef?: string; marketplace?: string; skillName?: string; packageName?: string; installCommand?: string; externalUrl?: string; createdAt?: number; total?: number; byKind?: { shape: number; thing: number; assertion: number; }; }>; }>; }; type StreamAppendInput$1 = { orgName: string; repoName: string; streamId: string; componentRef?: string; workspaceName?: never; committer?: string; message?: string; returnRepoSeq?: boolean; allocatedTokens?: never; allocatedTokenRanges: Array<{ start: number; end: number; }>; operations: Array<{ operation: 'add'; kind: 'shape'; name: string; data: unknown; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'add'; kind: 'thing'; name: string; data: unknown; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'add'; kind: 'assertion'; name: string; about: string; data: unknown; affirmedTargets?: Array; skipExisting?: boolean; } | { operation: 'add'; kind: 'collection'; name: string; type: 'arc' | 'bond' | 'pair' | 'set' | 'list'; members: Array; affirmedTargets?: never; skipExisting?: boolean; } | { operation: 'revise'; kind: 'shape'; name: string; data: unknown; affirmedTargets?: never; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'thing'; name: string; data: unknown; affirmedTargets?: never; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'assertion'; name: string; data: unknown; affirmedTargets?: Array; expectedVersion?: number; active?: never; leaseId?: string; } | { operation: 'revise'; kind: 'collection'; name: string; type: 'arc' | 'bond' | 'pair' | 'set' | 'list'; members: Array; affirmedTargets?: never; expectedVersion?: number; leaseId?: string; } | { operation: 'retract'; name: string; kind?: 'shape' | 'thing' | 'assertion' | 'collection'; reason?: string; expectedVersion?: number; leaseId?: string; } | { operation: 'reaffirm'; kind?: 'assertion'; name: string; add?: Array; remove?: Array; expectedVersion?: number; leaseId?: string; } | { operation: 'rename'; name: string; newName: string; kind?: 'shape' | 'thing' | 'assertion' | 'collection'; }>; chunkOrdinal: number; submissionId: string; }; type StreamAppendResult$1 = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; allocatedTokenRanges: Array<{ start: number; end: number; }>; results: Array<{ opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; repoSeq?: number; createdByEmail?: string; appendTotalMs?: number; appendResolveRepoMs?: number; appendApplyMs?: number; applySubphases?: { addThingMs?: number; addAssertionMs?: number; addAssertionResolveAboutMs?: number; reviseThingMs?: number; reviseAssertionMs?: number; reviseCollectionMs?: number; preparePinnedLoadShapeFieldsMs?: number; preparePinnedPinWrefsMs?: number; preparePinnedValidateMs?: number; operationLoopMs?: number; persistMs?: number; persistThingsMs?: number; persistVersionsMs?: number; persistAssertionsMs?: number; persistUpdatesMs?: number; persistOutboxMs?: number; refInsertMs?: number; refSourceCount?: number; }; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; allocatedTokenRanges: Array<{ start: number; end: number; }>; results: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; repoSeq?: number; createdByEmail?: string; appendTotalMs?: number; appendResolveRepoMs?: number; appendApplyMs?: number; applySubphases?: { addThingMs?: number; addAssertionMs?: number; addAssertionResolveAboutMs?: number; reviseThingMs?: number; reviseAssertionMs?: number; reviseCollectionMs?: number; preparePinnedLoadShapeFieldsMs?: number; preparePinnedPinWrefsMs?: number; preparePinnedValidateMs?: number; operationLoopMs?: number; persistMs?: number; persistThingsMs?: number; persistVersionsMs?: number; persistAssertionsMs?: number; persistUpdatesMs?: number; persistOutboxMs?: number; refInsertMs?: number; refSourceCount?: number; }; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type StreamingSubmissionRow$1 = { opIndex: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; type: 'result'; chunkOrdinal: number; submissionIndex: number; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; type: 'result'; chunkOrdinal: number; submissionIndex: number; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; type: 'result'; chunkOrdinal: number; submissionIndex: number; } | { type: 'group'; chunkOrdinal: number; eventRequestId: string; requestDigest: string; outcome: 'event' | 'no_event'; repoSeq?: number; operations: { applied: number; noop: number; failed: number; }; manifestDigest: string; } | { type: 'summary'; submissionId: string; streamId: string; groupSize: number; groups: number; operations: { applied: number; noop: number; failed: number; total: number; }; repoSeq: { first: number | null; last: number | null; }; verdict: string; durationMs: number; truncatedAt?: { lineNumber: number; message: string; }; manifest: { groups: number; digest: string; }; } | { type: 'error'; code: string; message?: string; }; type CommitApplyCompatibilityResult$1 = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; committer?: string; createdByEmail?: string; message?: string; operationCount: number; repoSeq?: number; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; }>; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; committer?: string; createdByEmail?: string; message?: string; operationCount: number; repoSeq?: number; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type CollectionMutationCompatibilityResult = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; type: 'arc' | 'bond' | 'set' | 'list' | 'pair'; wref: string; version: number; memberCount: number; dataHash?: string; operationCount: number; status: 'created' | 'updated' | 'noop'; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; type: 'arc' | 'bond' | 'set' | 'list' | 'pair'; wref: string; version: number; memberCount: number; dataHash?: string; operationCount: number; status: 'created' | 'updated' | 'noop'; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type RenameCompatibilityResult = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; renamed: true; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; renamed: true; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type ShapeChangeCompatibilityResult = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'noop'; version: number; dataHash: string; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'noop'; version: number; dataHash: string; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type ShapeRemoveCompatibilityResult = { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'noop'; version: number; dataHash: string; removed: true; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex?: number; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version: number; dataHash: string; status?: 'applied' | 'noop'; affirmations?: { added: Array; removed: Array; ignored: Array; }; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; } | { opIndex?: number; name: string; operation?: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename' | 'noop'; version?: number; dataHash?: string; status?: 'success' | 'noop' | 'failed'; error?: { code: string; message: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; }; }; resolvedName?: string; retryable?: boolean; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v1'; submissionId?: string; }; } | { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; name: string; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'noop'; version: number; dataHash: string; removed: true; receipt: { event: { committedAt: string; eventDigest: string; operationCount: number; repo: { orgName: string; repoName: string; }; repoSeq: string; } | null; eventRequestId: string; operations: Array<{ opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'applied' | 'noop'; version?: number; dataHash?: string; } | { opIndex: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm' | 'rename'; name: string; submittedName?: string; resolvedName?: string; warnings?: { undeclaredFields?: Array; undeclaredFieldsTruncated?: true; totalUndeclared?: number; coalescedWrefs?: Array<{ fieldPath: string; wref: string; reason: string; }>; coalescedWrefsTruncated?: true; totalCoalescedWrefs?: number; deprecations?: Array<{ shape: string; message: string; removalMilestone: string; }>; ignoredVersionPins?: Array<{ fieldPath: string; wref: string; binding: 'identity'; }>; }; affirmations?: { added: Array; removed: Array; ignored: Array; }; status: 'error'; errors: Array<{ code: string; message: string; path?: string; details?: { reason: 'expected_version_mismatch'; expectedVersion: number; currentVersion: number; } | { reason: 'lease_held'; leaseExpiresAt: string; } | { reason: 'validation_failed'; issues: Array<{ path: string; message: string; }>; } | { reason: 'rate_limit_reset'; retryAfterSeconds: number; resetAt: string; } | { reason: 'cursor_fence_unavailable'; cause: 'not_ready' | 'below_floor' | 'above_head'; retryFromStart: true; } | { reason: 'dependency_failed'; producerOpIndexes: Array; } | { reason: 'invalid_token'; }; retryable?: boolean; }>; }>; outcome: 'event' | 'no_event'; requestDigest: string; schemaVersion: 'operation-event-receipt/v2'; submissionId?: string; }; }; type Org = { name: string; displayName: string; description?: string; tier: 'free' | 'pro' | 'enterprise'; archivedAt?: number; createdAt: number; repoCount?: number; errorCount?: number; lastActivityAt?: number; }; type OrgListResult = Array<{ name: string; displayName: string; description?: string; tier: 'free' | 'pro' | 'enterprise'; archivedAt?: number; createdAt: number; repoCount?: number; errorCount?: number; lastActivityAt?: number; }>; type OrgMember = { email: string; firstName?: string; lastName?: string; role: 'owner' | 'admin' | 'editor' | 'viewer'; status: 'active' | 'pending'; invitedBy?: string; createdAt: number; }; type CollectionMembershipRole$1 = 'from' | 'to' | 'ends' | 'first' | 'second' | 'members' | 'items'; type RefsResult$1 = { items: Array<{ wref: string; kind?: 'shape' | 'thing' | 'assertion' | 'collection'; shapeName?: string; version?: number; fieldPath?: string; binding?: 'identity' | 'versioned'; }>; nextCursor?: string; }; type ShapeGetResult = { name: string; kind: 'shape'; active: boolean; version: { version: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm'; data: unknown; dataHash: string; } | null; componentRef?: string; }; type ShapeListResult = { items: Array<{ name: string; kind: 'shape'; active: boolean; version: { version: number; operation: 'add' | 'revise' | 'retract' | 'reaffirm'; data: unknown; dataHash: string; } | null; componentRef?: string; }>; }; type ThingHistoryResult = { thing?: { wref: string; kind: 'shape' | 'thing' | 'assertion' | 'collection'; shapeName?: string; }; versions: Array<{ version: number; wref: string; thingName?: string; thingKind?: string; shapeName?: string; declaredShapes?: Array; validatedShapes?: Array; collections?: Array<{ shape: string; memberCount?: number; dataMode: 'full' | 'summary'; fullData: boolean; truncated: boolean; inlineLimit?: number; preview?: Array; previewCount?: number; }>; operation: 'add' | 'revise' | 'retract' | 'reaffirm'; retractReason?: string; data?: unknown; aboutWref?: string; affirmedWrefs?: Array; active: boolean; createdAt: number; committerWref?: string; revisedBy?: string; metadata: { durableId: string; createdOn: number; }; }>; nextCursor?: string; }; type ThingGetManyResult$1 = { requested: number; items: Array<{ wref: string; pinnedWref?: string; name: string; kind: 'thing' | 'assertion' | 'shape'; shape?: string; shapeName?: string; validatedShape?: string; declaredShapes: Array; validatedShapes: Array; version: number; data?: unknown; collections?: Array<{ shape: string; memberCount?: number; dataMode: 'full' | 'summary'; fullData: boolean; truncated: boolean; inlineLimit?: number; preview?: Array; previewCount?: number; }>; active: boolean; synthesized?: boolean; aboutWref?: string; affirmedWrefs?: Array; committerWref?: string; createdBy?: string; revisedBy?: string; metadata: { durableId: string; createdOn: number; revisedOn: number; }; }>; missing: Array; }; type ThingHeadVersionsResult$1 = { requested: number; items: Array<{ wref: string; canonicalWref: string; durableId: string; version: number; active: boolean; revisedOn: number; }>; missing: Array; }; type RepositoryCheckpointAccess$1 = { checkpointId: string; repoSeq: number; expiresAt: number; url: string; byteLength: number; sha256: string; contentType: 'application/zip' | 'application/json' | 'application/x-ndjson'; }; type RepositoryCheckpointStatus$1 = { checkpointId: string; repoSeq: number; contractVersion: 2; attemptsStarted: number; runAgeMs: number; createdAt: number; updatedAt: number; runStartedAt: number; state: 'queued'; nextAction: 'poll'; } | { checkpointId: string; repoSeq: number; contractVersion: 2; attemptsStarted: number; runAgeMs: number; createdAt: number; updatedAt: number; runStartedAt: number; state: 'running'; nextAction: 'poll'; } | { checkpointId: string; repoSeq: number; contractVersion: 2; attemptsStarted: number; runAgeMs: number; createdAt: number; updatedAt: number; runStartedAt: number; state: 'complete'; nextAction: 'download'; completedAt: number; recordCount: number; manifest: { byteLength: number; sha256: string; }; archive: { byteLength: number; sha256: string; contentType: 'application/zip'; }; } | { checkpointId: string; repoSeq: number; contractVersion: 2; attemptsStarted: number; runAgeMs: number; createdAt: number; updatedAt: number; runStartedAt: number; state: 'failed'; completedAt: number; failureCode: 'canonicalization_failed' | 'integrity_failed' | 'unsupported_contract'; nextAction: 'contact_support'; } | { checkpointId: string; repoSeq: number; contractVersion: 2; attemptsStarted: number; runAgeMs: number; createdAt: number; updatedAt: number; runStartedAt: number; state: 'failed'; completedAt: number; failureCode: 'deadline_exceeded' | 'attempts_exhausted' | 'invalid_source' | 'repository_deleted'; nextAction: 'none'; }; type RepoConfigureStats = { subscriptionCount: number; }; type RepoDescribeResult$1 = { repo: { orgName: string; name: string; displayName: string; description?: string; visibility: 'public' | 'private'; archivedAt?: number; createdAt: number; }; license: { spdxId: string; licenseWref: string | null; spdxExpression: string | null; appliesTo: string | null; attributionText: string | null; declaredBy: string | null; sourceUrl: string | null; } | null; shapes: { items: Array; }; subscriptions?: Array; stats: { total: number; byKind: { shape: number; thing: number; assertion: number; }; byShape: Record; }; configureStats?: { subscriptionCount: number; }; head: { items: Array; }; additionalInformation: Array<{ name: string; wref: string; synthesized: boolean; }>; }; type RepoExploreInput = { search?: string; org?: string; activity?: 'week' | 'month'; hasSubscriptions?: true; minThings?: number; sort?: 'recentlyUpdated' | 'mostSubscribed' | 'mostThings' | 'nameAsc' | 'newest'; limit?: number; cursor?: string; slugs?: Array; }; type RepoExploreItem$1 = { orgName: string; orgDisplayName?: string; name: string; displayName: string; description?: string; createdAt: number; lastWriteAt?: number; subscriptionCount: number; thingCount: number; }; type RepoExploreResult$1 = { items: Array<{ orgName: string; orgDisplayName?: string; name: string; displayName: string; description?: string; createdAt: number; lastWriteAt?: number; subscriptionCount: number; thingCount: number; }>; nextCursor?: string; total?: number; orgs?: Array<{ name: string; displayName?: string; count: number; }>; }; type RepoForCaller = { orgName: string; name: string; displayName: string; createdAt: number; lastWriteAt?: number; }; type RepoListResult = { items: Array<{ orgName: string; name: string; displayName: string; description?: string; visibility: 'public' | 'private'; archivedAt?: number; createdAt: number; }>; nextCursor?: string; }; type RepoLicense$1 = { spdxId: string; licenseWref: string | null; spdxExpression: string | null; appliesTo: string | null; attributionText: string | null; declaredBy: string | null; sourceUrl: string | null; }; type RepoShapeInstanceCounts = Record; type RepoStats = { total: number; byKind: { shape: number; thing: number; assertion: number; }; byShape: Record; }; type RepoStatsBatchResult$1 = { items: Array<{ orgName: string; repoName: string; total: number; byKind?: { shape: number; thing: number; assertion: number; }; }>; }; type RepoVisibility = 'public' | 'private'; type SynthesizedRepoContent$1 = { shape: 'Content'; name: 'LlmsTxt'; active: true; synthesized: true; data: { content: string; }; refs?: { outbound: { sameOrg: Array<{ wref: string; title: string; description?: string; }>; crossOrg: Array<{ wref: string; title: string; description?: string; }>; }; inbound: { sameOrg: Array<{ wref: string; title: string; description?: string; }>; crossOrg: Array<{ wref: string; title: string; description?: string; }>; }; }; }; type SubscriptionBindCredentialsResult$1 = { bound: true; subscriptionName: string; credentialSetName: string; }; type SubscriptionRevealResult = { webhookUrl?: string; fallbackWebhookUrl?: string; }; type SubscriptionUnbindCredentialsResult$1 = { unbound: true; subscriptionName: string; }; type TokenCreateInput = { name: string; scopes?: Array<{ resource?: string; permissions: Array; allowedMatches?: Array; }>; structured?: boolean; description?: string; expiresAt?: number; committerIdentityWref?: string; }; type TokenCreateResult = { token: string; name: string; scopes?: Array<{ resource?: string; permissions: Array; allowedMatches?: Array; }>; warnings?: Array; expiresAt: number; createdAt: number; }; type TokenRevokeResult = { ok: boolean; }; type WireScopeEntry$1 = { resource?: string; permissions: Array; allowedMatches?: Array; }; type ViewEvaluateInput = { orgName: string; repoName: string; wref: string; limit?: number; cursor?: string; }; type ViewEvaluateResult$1 = { items: Array<{ wref: string; name: string; kind: 'thing' | 'assertion' | 'shape'; shapeName?: string; declaredShapes?: Array; validatedShapes?: Array; componentRef?: string; version: number; createdAt: number; data?: unknown; active: boolean; aboutWref?: string; affirmedWrefs?: Array; roles?: Array<'from' | 'to' | 'ends' | 'first' | 'second' | 'members' | 'items'>; collections?: Array<{ shape: string; memberCount?: number; dataMode: 'full' | 'summary'; fullData: boolean; truncated: boolean; inlineLimit?: number; preview?: Array; previewCount?: number; }>; metadata: { durableId: string; createdOn: number; revisedOn: number; }; }>; nextCursor?: string; repoSeq?: number; view: { wref: string; version: number; }; }; /** * How a Grant names its recipient. The server resolves the selector to one * exact actor and stores only that, so the grant keeps meaning the same actor * even after the name is reused. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/grantrecipientselector/ */ type GrantRecipientSelector = GrantCreateInput['recipient']; type GrantCreateIdentity = Omit; /** * Input for idempotently creating a repository Grant. * * A Grant draws its coverage from exactly one source: inline `coverage`, or * `viewRef` naming a View (`View/`, or `View/@vN` to pin one * definition). The union makes that exclusive at the call site rather than * leaving it to a server round trip; the server stores the View's durable * identity, so the Grant keeps meaning the same View after a rename. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/grantcreateoptions/ */ type GrantCreateOptions = GrantCreateIdentity & ({ coverage: NonNullable; viewRef?: never; } | { viewRef: NonNullable; coverage?: never; }); /** @internal */ type GrantListOptions = Partial>; /** * An immutable active or revoked repository Grant record. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/grant/ */ type Grant = GrantView; /** @internal */ type GrantListResult = GrantListResult$1; /** @internal */ type GrantRevokeResult = GrantRevokeResult$1; type DateMappedRepositoryCheckpointStatus = T extends { createdAt: number; updatedAt: number; runStartedAt: number; } ? Omit & { createdAt: Date; updatedAt: Date; runStartedAt: Date; } & (T extends { completedAt: number; } ? { completedAt: Date; } : object) : never; /** * The current lifecycle state of a repository checkpoint. * * Checkpoint timestamps are converted from Unix milliseconds to `Date`; the * server-computed `runAgeMs` remains numeric. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositorycheckpointstatus/ */ type RepositoryCheckpointStatus = DateMappedRepositoryCheckpointStatus; /** * A short-lived descriptor for downloading one completed checkpoint artifact. * The SDK returns this descriptor only; it never fetches `url` on the caller's * behalf. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositorycheckpointaccess/ */ type RepositoryCheckpointAccess = Omit & { expiresAt: Date; }; /** * The coarse organization capability scopes this SDK build knows about. * * The org-side twin of `REPO_AUTH_SCOPES`, with the same open-wire caveat: a * newer backend can return a scope missing from this tuple. * @see https://docs.warmhub.ai/sdk-reference/variables/org_auth_scopes/ */ declare const ORG_AUTH_SCOPES: readonly ["org:read", "org:configure", "org:admin", "org:action-callback"]; /** * An organization capability scope this build knows about. The DOMAIN type, * which stays closed — the wire type is an open string. See `ORG_AUTH_SCOPES`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/orgauthscope/ */ type OrgAuthScope = (typeof ORG_AUTH_SCOPES)[number]; /** * Is `value` one of the org scopes this build knows about? The sibling of * `isKnownRepoAuthScope`; see that function for why the guard exists. * @see https://docs.warmhub.ai/sdk-reference/functions/isknownorgauthscope/ */ declare function isKnownOrgAuthScope(value: string): value is OrgAuthScope; /** * The coarse repository capability scopes this SDK build knows about. * * The `access.resolve` response types `scopes` as an open string, so a newer * backend can return a scope missing from this tuple. Use it to enumerate the * capabilities this build understands, not to validate a response. * @see https://docs.warmhub.ai/sdk-reference/variables/repo_auth_scopes/ */ declare const REPO_AUTH_SCOPES: readonly ["repo:read", "repo:checkpoint-read", "repo:checkpoint-generate", "repo:write", "repo:configure", "repo:admin", "repo:action-callback"]; /** * A repository capability scope this build knows about. The DOMAIN type, which * stays closed — the wire type is an open string. See `REPO_AUTH_SCOPES`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repoauthscope/ */ type RepoAuthScope = (typeof REPO_AUTH_SCOPES)[number]; /** * Is `value` one of the repo scopes this build knows about? * * The `access.resolve` response types `scopes` as an open string * (`openVocabulary(REPO_AUTH_SCOPES)`), so a client can receive a scope minted * by a newer backend. This guard is how a caller that wants to distinguish * known from unknown values does so; it is documentation plus a narrowing * helper, never a validation gate on a response. Server-side validation of a * *requested* scope stays closed — see `VALID_SCOPES` in * `@warmhub/backend/token/scope-constants`. * @see https://docs.warmhub.ai/sdk-reference/functions/isknownrepoauthscope/ */ declare function isKnownRepoAuthScope(value: string): value is RepoAuthScope; /** * Maximum authored wref occurrences accepted in one Thing version. * @see https://docs.warmhub.ai/sdk-reference/variables/max_wrefs_per_thing_version/ */ declare const MAX_WREFS_PER_THING_VERSION = 10000; declare const COMMIT_OPERATION_KINDS: readonly ["shape", "thing", "assertion", "collection"]; type CommitOperationKind = (typeof COMMIT_OPERATION_KINDS)[number]; /** * Canonical request signing for component CLI dispatch. * * Component workers expose CLI methods over HTTP. The platform dispatcher * signs each call with HMAC-SHA256 over a canonical request representation * so the worker can authenticate the caller without sharing more than a * single secret. The same canonical input works for GET and POST methods: * the difference is whether the method args ride in the query string or * the body. * * Canonical signing input: * \n\n\n\n\n * * Where: * - METHOD is the uppercased HTTP method ('GET' | 'POST'). * - PATH is the URL path component (no scheme, host, or query). * - CANONICAL_QUERY is `canonicalCliQueryString(query)` — sorted, RFC 3986 * percent-encoded, omitting undefined / null entries. * - INSTALL_REPO is the `/` slug of the install, transmitted on * the wire as the `X-WarmHub-Install-Repo` header. * - BODY is the raw request body string ('' for GET). * - TIMESTAMP is unix-seconds since epoch (string-formatted). * * Verifiers should enforce a tolerance window on the timestamp to bound * replay attacks (default 300 s); they should also compare signatures in * constant time. * * This module is intentionally low-level: component authors import the * higher-level `verifyCliCall(request, secret)` wrapper from * `@warmhub/sdk-ts`, which extracts the canonical inputs from a Fetch * `Request` and calls `verifyCliRequest` for them. */ /** * Wire header names for component CLI dispatch — the single source of truth * shared by the backend dispatcher (which sets them) and `verifyCliCall` (which * reads them). The install repo always rides in {@link CLI_INSTALL_REPO_HEADER}; * the signing scheme adds {@link CLI_SIGNATURE_HEADER} + {@link CLI_TIMESTAMP_HEADER}. * @see https://docs.warmhub.ai/sdk-reference/variables/cli_install_repo_header/ */ declare const CLI_INSTALL_REPO_HEADER = "X-WarmHub-Install-Repo"; /** * HMAC signature header used by component CLI dispatch. * @see https://docs.warmhub.ai/sdk-reference/variables/cli_signature_header/ */ declare const CLI_SIGNATURE_HEADER = "X-WarmHub-Signature"; /** * Unix-seconds timestamp header used by component CLI dispatch. * @see https://docs.warmhub.ai/sdk-reference/variables/cli_timestamp_header/ */ declare const CLI_TIMESTAMP_HEADER = "X-WarmHub-Timestamp"; /** * HTTP verbs a component CLI method can declare. No-body verbs (GET, DELETE) * carry args in the query string; body verbs (POST, PUT, PATCH) carry args in * the JSON body. */ type CliHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** Every event type a webhook subscription can watch. */ declare const SUBSCRIBABLE_EVENT_TYPES: readonly ["commit", "repo.renamed", "org.renamed", "org.member_added", "org.repo_created", "org.repo_published", "thing.renamed", "shape.renamed"]; type SubscribableEventType = (typeof SUBSCRIBABLE_EVENT_TYPES)[number]; /** Org-scoped events — created with an `orgName` and no `repoName`. */ declare const ORG_SCOPED_EVENT_TYPES: readonly ["org.renamed", "org.member_added", "org.repo_created", "org.repo_published"]; type OrgScopedEventType = (typeof ORG_SCOPED_EVENT_TYPES)[number]; /** * Derive the ratified UUIDv5 request identity for one stream chunk. * @see https://docs.warmhub.ai/sdk-reference/functions/operationeventstreamrequestid/ */ declare function operationEventStreamRequestId(submissionId: string, chunkOrdinal: number): string; type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; }; declare const REPOSITORY_EXPORT_MODES: readonly ["heads", "ops"]; declare const repositoryExportRowSchema: z.ZodUnion; shapes: z.ZodArray; active: z.ZodLiteral; data: z.ZodRecord>>; wref: z.ZodString; durableId: z.ZodString; version: z.ZodNumber; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"thing">; shapes: z.ZodArray; collections: z.ZodOptional>>; active: z.ZodLiteral; data: z.ZodRecord>>; wref: z.ZodString; durableId: z.ZodString; version: z.ZodNumber; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"assertion">; shapes: z.ZodArray; about: z.ZodObject<{ wref: z.ZodString; v: z.ZodOptional; durableId: z.ZodString; }, z.core.$strict>; affirmed: z.ZodArray; durableId: z.ZodString; }, z.core.$strict>>; active: z.ZodLiteral; data: z.ZodRecord>>; wref: z.ZodString; durableId: z.ZodString; version: z.ZodNumber; }, z.core.$strict>], "kind">, z.ZodObject<{ kind: z.ZodEnum<{ shape: "shape"; thing: "thing"; assertion: "assertion"; }>; active: z.ZodLiteral; wref: z.ZodString; durableId: z.ZodString; version: z.ZodNumber; }, z.core.$strict>]>; declare const repositoryExportHeaderSchema: z.ZodObject<{ kind: z.ZodLiteral<"header">; formatVersion: z.ZodLiteral<4>; repo: z.ZodString; mode: z.ZodEnum<{ ops: "ops"; heads: "heads"; }>; sinceRepoSeq: z.ZodNumber; atRepoSeq: z.ZodNumber; }, z.core.$strict>; type RepositoryExportMode = (typeof REPOSITORY_EXPORT_MODES)[number]; type RepositoryExportRow = z.infer; type RepositoryExportHeader = z.infer; /** * Warning details for input fields that no shape in the effective set declares. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/undeclaredfieldswarning/ */ type UndeclaredFieldsWarning = { undeclaredFields: string[]; undeclaredFieldsTruncated?: true; totalUndeclared?: number; }; /** * Discriminated result returned when input is validated against shape fields. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/shapevalidatorresult/ */ type ShapeValidatorResult = { valid: true; warnings?: UndeclaredFieldsWarning; } | { valid: false; errors: string[]; warnings?: UndeclaredFieldsWarning; }; /** * Validate a data payload against a single shape's field definitions. * * A single shape is an effective set of one, so this is * {@link compileShapesValidator} with a one-element set — same checks, same * order, same messages. * * Shape field types: * - "number", "string", "boolean": primitive types * - "wref": string (reference to a shape or shaped thing) * - Typed field objects: { type: primitive, description?: string } * - Nested objects: { fieldName: type, ... } * - Arrays: [elementType] * - Optional fields: field name ending with "?" (e.g. "terminal_reason?": "string") * OR type string ending with "?" (e.g. "terminal_reason": "string?") * OR typed object type ending with "?" (e.g. { type: "string?" }) * * For v1 this is permissive: validates top-level field existence and basic types. * Returns a {@link ShapeValidatorResult} discriminated union — read `result.valid` * to branch, then `result.errors` (only present when invalid) for the list of * messages. `result.warnings` may be present in either branch and carries * undeclared top-level field names. * * @example * ```ts * import { validateAgainstShape } from "@warmhub/sdk-ts"; * * const shapeFields = { x: "number", y: "number", label: "string?" }; * * const ok = validateAgainstShape({ x: 1, y: 2 }, shapeFields); * // ok.valid === true * * const bad = validateAgainstShape({ x: "not-a-number" }, shapeFields); * if (!bad.valid) { * for (const message of bad.errors) console.error(message); * // ['Field "x" must be a number', 'Missing required field: "y"'] * } * ``` * @see https://docs.warmhub.ai/sdk-reference/functions/validateagainstshape/ */ declare function validateAgainstShape(data: Record, shapeFields: Record): ShapeValidatorResult; /** * Hardcoded meta-schema for validating shape definitions. * Shapes are NOT validated against a DB-stored shape — they validate against this constant. * This avoids the bootstrap chicken-and-egg problem. * * A valid shape definition is: * { fields: Record, description?: string } * where TypeSpec is one of: * - primitive string: "number", "string", "boolean", "wref", "array" * - optional primitive: "number?", "string?", "boolean?", "wref?", "array?" * - typed field object: { type: primitive, description?: string } * - array: [TypeSpec] (shorthand) or { type: "array", items: TypeSpec } * - nested object: { fieldName: TypeSpec, ... } (key may end with "?" for optional) * * The primitive vocabulary above is closed: any other type name (e.g. "text", * "integer", "json", "date") is rejected. See VALID_PRIMITIVE_TYPES in * ./shape-types.ts for the authoritative set. * String `pattern` constraints use RE2 syntax and are evaluated with re2js so * user-authored patterns run in linear time across backend, SDK, web, CLI, and * worker-adjacent consumers. JavaScript-only constructs such as backreferences * and lookarounds are rejected at shape-definition time. */ /** * Maximum size, in bytes (UTF-8 encoded), allowed for a single content field value. * WarmHub is not a document store: values larger than this are rejected at validation. * Store large documents in S3, Box, Drive, or another document system and reference * them from WarmHub instead. * @see https://docs.warmhub.ai/sdk-reference/variables/max_content_field_bytes/ */ declare const MAX_CONTENT_FIELD_BYTES: number; /** * Human-readable explanation of the {@link MAX_CONTENT_FIELD_BYTES} limit, suitable for * appending to a field-specific validation error. States the byte cap and points callers * to an external document store for large payloads. * @see https://docs.warmhub.ai/sdk-reference/variables/content_field_limit_error/ */ declare const CONTENT_FIELD_LIMIT_ERROR: string; /** * Returns a validation error message if the given string exceeds * {@link MAX_CONTENT_FIELD_BYTES} when UTF-8 encoded, or `null` if it is within the limit. * * @param path - The field path, used to identify the offending field in the message. * @param value - The candidate field value to measure. * @see https://docs.warmhub.ai/sdk-reference/functions/contentfieldlimiterror/ */ declare function contentFieldLimitError(path: string, value: string): string | null; /** * Add operation accepted by `client.commit.apply`. Use this shape to create new * shapes, things, assertions, or collections in a single commit. * * @see https://docs.warmhub.ai/writes/operations/#add-operations */ interface AddOperation { /** * Operation discriminator. Defaults to `add` when omitted. */ operation?: 'add'; /** * Optional kind override: `shape`, `thing`, `assertion`, or `collection`. * When omitted, kind is inferred: `about` present → assertion; collection * `type` plus `members` → collection; otherwise by `name` segmentation * (1–2 segments → thing, 3+ segments → assertion). Shape adds always * require explicit `kind: 'shape'`. */ kind?: CommitOperationKind; /** * Target name. Use `Shape/localName` for things and assertions; use the * plain shape name for shapes. */ name?: string; /** * Assertion target wref. Presence of * `about` makes the add an assertion unless `kind` overrides it. */ about?: string; /** * Shape-validated data payload for shape, thing, or assertion adds. */ data?: unknown; /** * Pinned target wrefs (`Shape/name@vN`) the assertion's claim is affirmed * for. Assertion adds only; the `about` pin never seeds an affirmation. */ affirmedTargets?: string[]; /** * Collection type. Used only for collection adds. */ type?: CollectionTag$1; /** * Collection member wrefs. Used only for collection adds. */ members?: string[]; /** * When true, an existing target returns `noop` instead of failing with * `ALREADY_EXISTS`. Use for caller-side idempotency on retried writes. */ skipExisting?: boolean; } /** * Revise operation accepted by `client.commit.apply`. Replaces the shape-validated * data on an existing shape, thing, or assertion and creates a new version. * * `data` is a full replacement, not a patch — include every shape field, not * just the ones that changed. Revise cannot deactivate a target: the `active` * field is declared `never` at the type level, so passing `active: false` is * a compile error. Use a {@link RetractOperation} to mark an entity inactive. * * @see https://docs.warmhub.ai/writes/operations/#revise-operations */ interface ReviseOperation { /** * Operation discriminator. Set `revise` explicitly — an omitted discriminator * normalizes as `add`, not `revise`. (Supplying `expectedVersion` without * `operation: 'revise'` throws rather than silently dropping the precondition.) */ operation?: 'revise'; /** * Optional kind safety hint: `shape`, `thing`, `assertion`, or `collection`. */ kind?: CommitOperationKind; /** * Target name to revise. Equivalent to `wref` for local paths. */ name?: string; /** * Target wref to revise. Cross-repo references use `wh:org/repo/Shape/name`. */ wref?: string; /** * New shape-validated data payload. */ data?: unknown; /** * Complete affirmation set for the changed claim (assertion revises only). * Omitted clears the snapshot — prior affirmations never transfer to * changed claim data. */ affirmedTargets?: string[]; /** * Collection type. Required when `kind` is `collection`. */ type?: CollectionTag$1; /** * Collection member wrefs. Required when `kind` is `collection`. */ members?: string[]; /** * Optional optimistic-concurrency precondition. When supplied, the revise is * applied only if the target is still at this version number. A stale value * produces a `CONFLICT` error with `details.reason = 'expected_version_mismatch'`. * Absent field preserves today's behavior exactly (opt-in). */ expectedVersion?: number; /** * Type-level guard: revise cannot toggle activity. The field is declared * `never` so passing `active: true` or `active: false` is a TypeScript error. * To mark an entity inactive, use a {@link RetractOperation} instead. */ active?: never; /** * Optional read-lease token (#3625) returned by `thing.getWithLease`. A * matching token auto-releases the lease on commit; a mismatch (or absence * against a live lease) is rejected with `LEASE_UNAVAILABLE`. */ leaseId?: string; } /** * Retract operation accepted by `client.commit.apply`. Marks the target as * retracted in a new version; prior versions remain queryable by history. * * @see https://docs.warmhub.ai/writes/operations/#retract-operations */ interface RetractOperation { /** * Operation discriminator. Required. */ operation: 'retract'; /** * Target wref or local name to retract. */ name: string; /** * Optional kind safety hint: `thing`, `assertion`, `shape`, or `collection`. */ kind?: CommitOperationKind; /** * Optional human-readable retraction reason. */ reason?: string; /** * Optional optimistic-concurrency precondition. When supplied, the retract * is applied only if the target is still at this version number. */ expectedVersion?: number; /** * Optional read-lease token (#3625) returned by `thing.getWithLease`. A * matching token auto-releases the lease on commit; a mismatch (or absence * against a live lease) is rejected with `LEASE_UNAVAILABLE`. */ leaseId?: string; } /** * Reaffirm operation accepted by `client.commit.apply`. Edits an assertion's * affirmation snapshot — the set of pinned target versions the claim is * affirmed for — without changing claim data. Mints a new assertion version * with body and dataHash copied from the current one. * * @see https://docs.warmhub.ai/writes/operations/#reaffirm-operations */ interface ReaffirmOperation { /** * Operation discriminator. Required. */ operation: 'reaffirm'; /** * Assertion to reaffirm: `Shape/name`. */ name: string; /** * Optional kind safety hint; reaffirm applies only to assertions. */ kind?: 'assertion'; /** * Pinned target wrefs (`Shape/name@vN`) to affirm. A target already in the * set is reported as `ignored`, not an error. */ add?: string[]; /** * Pinned target wrefs to stop affirming. A target not in the set is * reported as `ignored`, not an error. Prior versions keep their snapshots. */ remove?: string[]; /** * Optional optimistic-concurrency precondition, as on revise/retract. The * new set is computed from the live current snapshot, so concurrent deltas * merge without it; supply it when the edit must apply to the exact version * you read. */ expectedVersion?: number; /** * Optional read-lease token (#3625), as on revise/retract. */ leaseId?: string; } /** * Rename operation accepted by `client.commit.apply` (#4848). Rewrites a thing's * or shape's name in place — a version-less metadata op that records a from→to * event but mints no new body version. * * @see https://docs.warmhub.ai/writes/operations/#rename-operations */ interface RenameOperation { /** * Operation discriminator. Required. */ operation: 'rename'; /** * Current target: `Shape/oldName` for a thing/assertion, or the plain shape * name for a shape. */ name: string; /** * New bare name — within the same shape for a thing/assertion, or the new * shape name for a shape rename. */ newName: string; /** * Optional kind safety hint: `thing`, `assertion`, `shape`, or `collection`. */ kind?: CommitOperationKind; } /** * Commit operation accepted by `client.commit.apply`. Discriminated union over * {@link AddOperation}, {@link ReviseOperation}, {@link RetractOperation}, and * {@link RenameOperation}, keyed on `operation`. * * Inline array literals passed directly to `client.commit.apply` are * contextually typed by the parameter, so `operation: "add"` stays narrowed * and the call typechecks. Binding the array to a variable **without** a * type annotation widens `operation` to `string`, so the variable no * longer assigns to the `Operation[]` parameter. Either annotate the * variable as `Operation[]` (contextually typed by the annotation) or use * `satisfies Operation[]` to preserve the inferred literal types: * * ```ts * // 1. Annotate the variable. * const ops: Operation[] = [ * { operation: "add", kind: "thing", name: "Sensor/temp-1", data: { x: 1 } }, * { operation: "revise", name: "Sensor/temp-1", data: { x: 2 } }, * ]; * * // 2. Or use `satisfies` to keep the inferred literal types. * const ops2 = [ * { operation: "add", kind: "thing", name: "Sensor/temp-1", data: { x: 1 } }, * { operation: "revise", name: "Sensor/temp-1", data: { x: 2 } }, * ] satisfies Operation[]; * * await client.commit.apply("acme", "world", "seed", ops); * ``` * * @see https://docs.warmhub.ai/sdk/write-methods/#typing-operation-arrays */ type Operation = AddOperation | ReviseOperation | RetractOperation | ReaffirmOperation | RenameOperation; /** * Maximum operations accepted by one complete validation request. * @see https://docs.warmhub.ai/sdk-reference/variables/max_commit_validation_operations/ */ declare const MAX_COMMIT_VALIDATION_OPERATIONS = 10000; /** * Maximum UTF-8 bytes accepted by the unbatched validation request body. * @see https://docs.warmhub.ai/sdk-reference/variables/max_commit_validation_encoded_bytes/ */ declare const MAX_COMMIT_VALIDATION_ENCODED_BYTES: number; /** * Exact wire input evaluated by {@link WarmHubClient.commit.validate}. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/commitvalidateinput/ */ type CommitValidateInput = CommitValidateInput$1; /** * Ordered no-write preview returned by {@link WarmHubClient.commit.validate}. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/commitvalidateresult/ */ type CommitValidateResult = CommitValidateResult$1; /** * Options accepted by {@link WarmHubClient.commit.validate}. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/commitvalidateoptions/ */ type CommitValidateOptions = { message?: string; committer?: string; componentRef?: string; skipExisting?: boolean; includeWouldBeBody?: boolean; signal?: AbortSignal; }; /** @internal Canonical input shared by the SDK call and CLI byte preflight. */ declare function createCommitValidateInput(orgName: string, repoName: string, operations: readonly Operation[], opts?: CommitValidateOptions): CommitValidateInput; /** * Serialize the exact body sent by the dedicated unbatched tRPC HTTP link. * * @internal */ declare function encodeCommitValidateRequestBody(input: CommitValidateInput): string; /** * Return the UTF-8 byte length of the exact validation request body. * @see https://docs.warmhub.ai/sdk-reference/functions/commitvalidaterequestbodybytes/ */ declare function commitValidateRequestBodyBytes(input: CommitValidateInput): number; /** * The one durable-token collector every decoration surface shares (GH-8699). * The SDK link, the CLI's sidecar subsetting, and the MCP dispatcher all * detect body references through this module, so the contract-critical skip * rule cannot drift between surfaces. */ /** * Collect the bare canonical durable ids referenced anywhere in `value` — * bare, `@vN|@HEAD|@ALL`-pinned, and `wh:`-prefixed spellings alike, deduped * by identity (pins select versions; they don't change identity, and labels * always carry the current name). * * Skip rule (structural metadata only): the `durableId` entry of a * `metadata` envelope is an id-typed field whose label already rides the * item's own top-level `wref` — looking it up would add one self-lookup per * list item. The check is path-aware (`metadata` → `durableId`) **and * fenced to structural positions**: a `metadata.durableId` pair anywhere * under a `data` key is arbitrary user body content and is decorated — * structural envelopes never live inside `data`, thing bodies always do. * The skip exists for economy only, so when in doubt the walk decorates: * over-skipping hides a user reference, under-skipping merely enlarges one * batched lookup. * @see https://docs.warmhub.ai/sdk-reference/functions/collectdurabletokens/ */ declare function collectDurableTokens(value: unknown): Set; /** * Reference-decoration internals: discover durable reference tokens in a * response payload and fold `thing.headVersions` items into the additive * `decorations` sidecar (durable id → canonical wref; a miss has no entry). * * Public surface: the option, the `WarmHubDecorations` type, the * `getResponseDecorations` accessor, and `collectDurableTokens` (so CLI-side * sidecar subsetting shares the one collector and its skip rule). The rest — * walker composition, map-builder, link — is not. */ /** * The decoration sidecar a decorated response carries: bare durable id → * canonical wref (`wh:org/repo/Shape/name`, unversioned, current-name text). * An id the caller cannot read — or that does not exist — has no entry. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/warmhubdecorations/ */ type WarmHubDecorations = Record; /** * Read the decoration sidecar off a response, typed. Returns `undefined` * when the response carries none: the client was constructed without * `decorateResponses`, the result held no durable tokens, or the payload * was not a plain object. Top-level result shapes are procedure-controlled, * so a present `decorations` object is always the link's sidecar. * @see https://docs.warmhub.ai/sdk-reference/functions/getresponsedecorations/ */ declare function getResponseDecorations(result: unknown): WarmHubDecorations | undefined; /** * A materialized export, keyed by the identity that survives renames. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositoryexportrowmap/ */ type RepositoryExportRowMap = ReadonlyMap; /** * Any row collection {@link applyRepositoryExportDelta} accepts: a materialized * map from a previous fold, or a plain iterable of rows straight off a stream. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositoryexportrows/ */ type RepositoryExportRows = Iterable | RepositoryExportRowMap; /** * Fold a delta export onto a base, by `durableId`: active rows upsert, and * tombstones remove. Pure — neither argument is mutated — and order-dependent * within each argument, so the last row for an identity wins. * @see https://docs.warmhub.ai/sdk-reference/functions/applyrepositoryexportdelta/ */ declare function applyRepositoryExportDelta(base: RepositoryExportRows, delta: RepositoryExportRows): Map; /** * Stable failure categories produced while reading a repository export stream. * * Every reason except `since_below_epoch_floor` is a local verification * verdict: the bytes the server sent do not prove what the trailer claims. * `since_below_epoch_floor` is the server's own refusal and is surfaced * distinctly so callers can fall back to a full export. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositoryexporterrorreason/ */ type RepositoryExportErrorReason = 'count_mismatch' | 'digest_mismatch' | 'fence_mismatch' | 'header_invalid' | 'row_invalid' | 'row_out_of_order' | 'since_below_epoch_floor' | 'trailer_invalid' | 'truncated'; /** * A repository export protocol or verification failure. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexporterror/ */ declare class RepositoryExportError extends Error { readonly reason: RepositoryExportErrorReason; readonly name = "RepositoryExportError"; constructor(reason: RepositoryExportErrorReason, message?: string); } /** * The verification state of one logical export stream. * * A resumed request carries no header, and its trailer covers only the rows of * that segment — the server cannot know what a client already read. So the * session keeps two hashers: a per-segment one, which each segment's trailer is * checked against, and a whole-stream one, which accumulates across every * segment and is what the caller should record as the export's content digest. * For a stream that never broke the two agree, and the trailer proves both. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/ */ declare class RepositoryExportSession { #private; /** * The header of the opening segment; resumed segments repeat none. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#header */ get header(): RepositoryExportHeader | undefined; /** * Cursor for `afterDurableId` when resuming a broken stream. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#lastdurableid */ get lastDurableId(): string | undefined; /** * Rows verified so far across every segment. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#rowcount */ get rowCount(): number; /** * Rows verified in the segment currently being read. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#segmentrowcount */ get segmentRowCount(): number; /** * The whole logical stream's content digest, available once the stream has * been finalized — by its closing trailer, or by `finalizeContentSha256`. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#contentsha256 */ get contentSha256(): string | undefined; /** * End the session early and read the digest of what was verified. Useful when * a stream will not be resumed; the session cannot be read from again. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#finalizecontentsha256 */ finalizeContentSha256(): string; /** @internal Start a fresh per-segment hasher for one HTTP response. */ beginSegment(): void; /** * @internal A segment failed its trailer — the bytes did not match what the * server said it wrote. The stream digest has already absorbed those rows, so * this session can never produce a trustworthy total again. */ markUnverifiable(): void; /** @internal The digest of the segment just read; spends the segment hasher. */ finalizeSegment(): string; /** @internal Async-flow token, re-redeemed when a prepared download breaks. */ get token(): string | undefined; /** @internal */ set token(value: string | undefined); /** * Whether this session's trailer has been verified. * @see https://docs.warmhub.ai/sdk-reference/classes/repositoryexportsession/#complete */ get complete(): boolean; /** @internal Record the closing trailer and seal the whole-stream digest. */ markComplete(): void; /** @internal Refuse a segment on a session whose digest is already sealed. */ assertResumable(): void; /** @internal Only the opening segment carries a header; it must not change. */ adoptHeader(header: RepositoryExportHeader): void; /** @internal */ recordRow(durableId: string, lineBytes: Uint8Array): void; } /** * Create the session that carries verification state across an export's * segments: the header, the resume cursor, and the whole-stream digest. * @see https://docs.warmhub.ai/sdk-reference/functions/createrepositoryexportsession/ */ declare function createRepositoryExportSession(): RepositoryExportSession; /** * Options for `client.repo.export`: what to export (mode, delta base, fence) * and how (sync stream or async token flow, resume cursor, abort signal). * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repositoryexportoptions/ */ type RepositoryExportOptions = { /** `heads` (default) exports current heads; `ops` exports the operation log. */ readonly mode?: RepositoryExportMode; /** Delta base. Defaults to 0, a full export. */ readonly sinceRepoSeq?: number; /** Pin the fence. Omit to let the server pin current and echo it back. */ readonly atRepoSeq?: number; /** * Resume cursor. Defaults to the session's last verified row, and needs a * `session` carrying the opening header: a resumed request gets no header * back, so without one there is nothing to check the repository and fence * against. */ readonly afterDurableId?: string; /** * `async` asks the server to prepare the export first, then redeems the * returned token once it is ready. Defaults to a direct stream. */ readonly prefer?: 'sync' | 'async'; /** * Redeem a token from a previous `exportPrepare`, polling until the prepared * export is ready. Use it to download an export a different process, or a * different machine, asked for. * * Redemption returns a short-lived URL for the whole stored export object, so * a token download always reads from the beginning: it cannot be continued * with `afterDurableId`. A broken download restarts on a fresh session, and * re-redeeming the token is a free lookup. */ readonly token?: string; /** * Verification state. Pass a session back in to resume a broken stream: the * rolling digest continues and the request is pinned to what it reached. */ readonly session?: RepositoryExportSession; /** * How long to wait between redemption polls while an async export is still * building. Defaults to one second, and is clamped up to a 50ms floor: the * poll re-runs the full authorization gate, so a zero would spin it. */ readonly pollIntervalMs?: number; readonly signal?: AbortSignal; }; /** * What to prepare: the same window a direct stream takes, minus everything * about reading one back. * * @internal */ type RepositoryExportPrepareOptions = Pick; /** * A prepared export: the token that redeems it and the fence the server pinned. * * @internal */ type RepositoryExportPreparation = { /** Redeem it with `export`'s `token` option, from anywhere. */ readonly exportToken: string; /** The repository sequence the export is pinned to. */ readonly atRepoSeq: number; }; /** * What the caller asked for, which the header must agree with. * * @internal */ type RepositoryExportExpectation = { readonly repo: string; readonly mode: RepositoryExportMode; /** * Window bounds the caller stated explicitly. A token redemption sends only * the token, so the header is the first place a stored job's window can be * compared against what the caller asked for — undefined bounds are the * caller delegating the choice, and only stated ones are enforced. */ readonly sinceRepoSeq?: number; readonly atRepoSeq?: number; }; /** * How to read one HTTP segment of an export. * * @internal */ type RepositoryExportSegmentOptions = { /** True when the request carried `afterDurableId`, so no header is sent. */ readonly resumed?: boolean; }; /** * How to replay a saved export back into a session. * * @internal */ type RepositoryExportRestoreOptions = { /** * Accept bytes that stop before the trailer — an interrupted download, which * is exactly what a resume continues from. The restored session is then not * `complete`, and carries the cursor the saved bytes reached. Without it a * missing trailer is `truncated`, as it is on the wire. */ readonly partial?: boolean; }; /** * Read one HTTP response body as export records, verifying it against the * session as it goes: header continuity, per-line canonical decode, the rolling * digest, and finally the trailer. * @see https://docs.warmhub.ai/sdk-reference/functions/readrepositoryexportstream/ */ declare function readRepositoryExportStream(source: AsyncIterable | ReadableStream, session: RepositoryExportSession, expected: RepositoryExportExpectation, options?: RepositoryExportSegmentOptions): AsyncGenerator; /** * Replay a saved export's own bytes back into a fresh verification session. * * This is the offline twin of `readRepositoryExportStream`: the same header, * canonical-row, ordering, and trailer checks, run over a file rather than a * response body, and against no expected repository — a saved export is checked * for what it says it is, not for what a caller hoped it would be. It returns * the session rather than the rows, because the two things a caller needs from * a saved file are proof (`complete`, `contentSha256`, `rowCount`) and the * cursor a resume continues from (`header`, `lastDurableId`). * * Pass `partial` to accept bytes that stop before the trailer. * @see https://docs.warmhub.ai/sdk-reference/functions/restorerepositoryexportsession/ */ declare function restoreRepositoryExportSession(source: AsyncIterable | ReadableStream, options?: RepositoryExportRestoreOptions): Promise; /** * Operations to submit, in order. * * Aggregate `commit.apply` normalizes and preflights an array as a whole before * its first append; iterable input is validated one chunk at a time. The * full-duplex `commit.applyStreaming` path validates every source incrementally, * including arrays, because committed response groups may arrive while later * input is still being produced. * * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationsource/ */ type OperationSource = readonly Operation[] | Iterable | AsyncIterable; /** * Default number of operations the SDK sends per stream append chunk. * * @internal */ declare const DEFAULT_STREAM_CHUNK_SIZE = 1000; /** * Maximum number of operations accepted by one stream append chunk. * * @internal */ declare const MAX_STREAM_APPEND_OPERATION_COUNT = 10000; interface OperationStreamClient { stream: { append(input: StreamAppendInput$1): Promise; }; } /** Legacy aggregate write result with exact chunk receipts added alongside it. */ type SubmittedStreamResult = { committer?: string; createdByEmail?: string; message: string | undefined; operationCount: number; repoSeq?: number; partial?: boolean; statusCounts?: { applied: number; noop: number; error: number; }; operations: CommitRealOperationResult$1[]; /** One exact immutable receipt per stream chunk, in submission order. */ receipts: OperationEventReceipt$1[]; }; /** * Stream identity metadata for caller-managed streamed commit submissions. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamcontinuationstate/ */ type StreamContinuationState = { streamId: string; submissionId: string; nextChunkOrdinal: number; }; /** * Caller-facing knobs for retrying a transport-ambiguous event request under * its identical durable identity. * * Defaults are tuned for interactive and agent latency budgets: 3 attempts * with exponential backoff capped at 8s, so a one-off flake recovers without * user-perceptible latency. Override individual fields as needed. * * @see https://docs.warmhub.ai/sdk/transient-retry/#tuning-retry */ type RetryPolicyOptions = { maxAttempts?: number; baseDelayMs?: number; maxDelayMs?: number; }; type StreamFailureCause = { code: string; message: string; }; /** * Error raised when a streamed commit submission fails after an ambiguous or * partial append. * * `completedReceipts` contains only earlier, acknowledged event receipts. The * other identity fields name the one pending chunk that must be looked up * before any manual retry. `acknowledgedOperationCount` preserves progress * even if a receipt omits operation rows. `attemptedAppendOutcome` and * `lastAcknowledgedRepoSeq` retain recovery information from the earlier * stream contract; the durable receipt remains the authoritative record. * * @see https://docs.warmhub.ai/sdk/transient-retry/#partial-submissions */ declare class PartialStreamSubmissionError extends Error { /** * Stable error code. Always `'PARTIAL_STREAM_SUBMISSION'`. */ readonly code = "PARTIAL_STREAM_SUBMISSION"; /** * Earlier exact receipts, in submission order. * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#completedreceipts */ readonly completedReceipts: readonly OperationEventReceipt$1[]; /** * Legacy projection of operations confirmed before the failed append. * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#completedoperations */ readonly completedOperations: SubmittedStreamResult['operations']; readonly submissionId: string; readonly eventRequestId: string; readonly chunkOrdinal: number; readonly pendingOutcome: 'absent' | 'unknown'; /** * Number of operations covered by acknowledged append responses. * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#acknowledgedoperationcount */ readonly acknowledgedOperationCount: number; /** * Last repository sequence returned by an acknowledged chunk that persisted * an event. This is a lower bound for known completed work, never evidence * that the attempted append did not land. */ readonly lastAcknowledgedRepoSeq?: number; /** * Authoritative outcome of the attempted append. `not_applied` is used only * when the SDK received explicit server rejection evidence; `unknown` means * callers must stop writes and reconcile from a later verified checkpoint. * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#attemptedappendoutcome */ readonly attemptedAppendOutcome: 'not_applied' | 'unknown'; /** * Underlying error that triggered the partial submission, preserved for * diagnostics. Do not infer append outcome from this field; branch on * `attemptedAppendOutcome` instead. * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#cause */ readonly cause: unknown; constructor(input: { cause: unknown; completedReceipts: readonly OperationEventReceipt$1[]; completedOperations?: SubmittedStreamResult['operations']; acknowledgedOperationCount?: number; lastAcknowledgedRepoSeq?: number; attemptedAppendOutcome: 'not_applied' | 'unknown'; submissionId: string; eventRequestId: string; chunkOrdinal: number; pendingOutcome: 'absent' | 'unknown'; }); } /** * Error raised when the stream append path completed deterministically but * every submitted operation failed. * @see https://docs.warmhub.ai/sdk-reference/classes/allstreamoperationsfailederror/ */ declare class AllStreamOperationsFailedError extends Error { readonly code = "STREAM_ALL_OPERATIONS_FAILED"; /** * Every exact immutable receipt returned for the rejected submission. * @see https://docs.warmhub.ai/sdk-reference/classes/allstreamoperationsfailederror/#receipts */ readonly receipts: readonly OperationEventReceipt$1[]; readonly result: SubmittedStreamResult; readonly operations: SubmittedStreamResult['operations']; readonly statusCounts: NonNullable; readonly cause?: StreamFailureCause; constructor(result: SubmittedStreamResult); } /** * Running reducer over stream-append chunk outputs. * * Owns the receipt-era → legacy status projection for streamed submissions. * Each chunk is folded in as it is acknowledged, so the only per-operation * state that survives a chunk is the projected result row the caller is * contractually owed — no raw chunk-result array, and no submission-wide copy * of the submitted operations. Chunk-local submitted names are read for the * `submittedName` echo on failed rows and then released with the chunk. * * @internal */ declare class StreamSubmissionAggregator { readonly receipts: OperationEventReceipt$1[]; private readonly operations; private readonly statusCounts; /** True once at least one row landed and every row failed. */ get allFailed(): boolean; /** * Fold one chunk's result rows into the aggregate. * * `submittedNames` is chunk-local: entry 0 is the operation at * `chunkStart`. Pass the chunk that was submitted; it is not retained. */ addChunk(input: { result: StreamAppendResult$1; chunkStart: number; submittedOperations: ReadonlyArray<{ name?: string; operation: CommitRealOperationResult$1['operation']; }>; }): void; addReceipt(receipt: OperationEventReceipt$1): void; /** Rows confirmed applied or noop, for partial-submission recovery. */ completedOperations(): SubmittedStreamResult['operations']; /** Project the accumulated state into the legacy aggregate write result. */ toResult(meta: { committer?: string; createdByEmail?: string; message?: string; repoSeq?: number; }): SubmittedStreamResult; } /** * Submit `operations` to the WarmHub stream-append surface, chunked to * stay under MAX_STREAM_APPEND_OPERATION_COUNT. * * Each chunk is one atomic operation event. The SDK mints one submission UUID, * derives each chunk's request UUID from its zero-based ordinal, and preserves * both identities across transport-ambiguous retries. A successful submission * returns the legacy aggregate write result plus ordered exact receipts, one * per chunk. * * Definite client rejections (`UNAUTHENTICATED`, `VALIDATION_ERROR`, * `CONFLICT`, `RATE_LIMITED`, `ALREADY_RETRACTED`, …) on the first chunk * still rethrow the raw cause unchanged — they * are not transient, and structured detail (e.g. `retryAfter` on * `RATE_LIMITED`) survives. If the caller's original attempt landed but * the response was lost, the same-identity retry returns the original durable * receipt instead of reapplying the operation or translating the replay into * a new conflict. * * If ambiguity remains after the retry budget, `PartialStreamSubmissionError` * carries the exact pending request identity and every earlier receipt. The * caller can use `client.commit.getReceipt` and retry the identical chunk only * after an opaque not-found response. * * **Operation normalization.** `args.operations` accepts the public * `Operation[]` write contract. The SDK normalizes operations to the * backend stream shape before chunking, token checks, and appends. * * **Iterable sources.** `args.operations` also accepts a sync or async * iterable, so a caller producing millions of operations never has to * materialize them. Memory then stays flat in the *input*: only the chunk * being submitted is held. Two consequences follow from never seeing the whole * submission up front, and they are the price of the flat memory: * * - Validation is per chunk, not whole-submission. An array input is * preflighted in full before the first append, so a bad operation anywhere * rejects with nothing written. An iterable input preflights each chunk as * it fills, so a bad operation — or an error thrown by the producer itself — * surfaces only after every earlier chunk has already been committed, and * arrives as `PartialStreamSubmissionError` with `attemptedAppendOutcome: * 'not_applied'`. * - Degenerate operation sequences that span a chunk boundary are left to the * server, which already applies the identical per-chunk verdict. * * Pass `args.retry: false` to disable retry entirely; pass * `args.retry: { maxAttempts, baseDelayMs, maxDelayMs }` to override * any subset of the defaults (`{ 3, 250, 8_000 }`). * * @see https://docs.warmhub.ai/sdk/transient-retry/ * @internal */ declare function submitOperationsViaStream(client: OperationStreamClient, args: { orgName: string; repoName: string; committer?: string; message?: string; operations: OperationSource; componentRef?: string; chunkSize?: number; skipExisting?: boolean; streamId?: string; submissionId?: string; /** Return the writer's own repository-sequence acknowledgement. */ returnRepoSeq?: boolean; /** * Bounded retry for transport-ambiguous operation-event responses. * Default-on (3 attempts, 250ms base, 8s cap, jittered exponential). * Pass `false` to disable. */ retry?: RetryPolicyOptions | false; }): Promise; /** * Exposed for unit tests and internal callers to avoid re-deriving status values. * * @internal */ declare function streamAppendResultStatus(result: StreamAppendResult$1['results'][number]): 'applied' | 'noop' | 'error'; /** @internal */ declare function countStreamAppendResultStatuses(results: StreamAppendResult$1['results']): { applied: number; noop: number; error: number; }; /** * True when stream append produced a definite pre-apply rejection rather than * a transport-ambiguous outcome. A 4xx response (except timeout-shaped 408) is * definite even when callers may choose to retry it later, as with 429. * * @internal */ declare function isDefiniteStreamAppendRejection(cause: unknown): boolean; /** * Durable caller-controlled identity needed to reconstruct a submission. * @see https://docs.warmhub.ai/sdk-reference/interfaces/streamingsubmissionretryidentity/ */ interface StreamingSubmissionRetryIdentity { readonly orgName: string; readonly repoName: string; readonly streamId: string; readonly submissionId: string; readonly groupSize: number; readonly message?: string; readonly committer?: string; } /** * One operation, group receipt, summary, or terminal error from the wire. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamingsubmissionrow/ */ type StreamingSubmissionRow = StreamingSubmissionRow$1; /** * A lazy, single-use streaming submission. * * The retry identity is available synchronously, before authentication, * source acquisition, or network dispatch begins. * @see https://docs.warmhub.ai/sdk-reference/interfaces/streamingsubmissionhandle/ */ interface StreamingSubmissionHandle extends AsyncIterableIterator { readonly retryIdentity: StreamingSubmissionRetryIdentity; } /** * Options for `client.commit.applyStreaming`. * @see https://docs.warmhub.ai/sdk-reference/interfaces/streamingsubmissionoptions/ */ interface StreamingSubmissionOptions { committer?: string; groupSize?: number; signal?: AbortSignal; streamId: string; submissionId?: string; } /** * A transport or protocol failure after request dispatch. * * The server may already have committed one or more groups. Generic retry is * deliberately disabled: reconstruct the original operation source and retry * only with this exact identity. * @see https://docs.warmhub.ai/sdk-reference/classes/streamingsubmissionoutcomeunknownerror/ */ declare class StreamingSubmissionOutcomeUnknownError extends Error { readonly code = "STREAMING_SUBMISSION_OUTCOME_UNKNOWN"; readonly outcome = "unknown"; readonly retryable = false; readonly retryIdentity: StreamingSubmissionRetryIdentity; readonly cause: unknown; constructor(retryIdentity: StreamingSubmissionRetryIdentity, cause: unknown); } /** * Server-side verifier for component CLI dispatch calls. * * Workers that expose CLI methods declared in their component manifest * receive authenticated requests from the WarmHub platform. The platform * supports four CLI auth schemes (selected via the component's * `credentials[]` entry) and this verifier accepts a request authenticated * under whichever schemes the install configured: * * 1. `CLI_SIGNING_SECRET` — HMAC-SHA256 over the canonical request, * transmitted as `X-WarmHub-Signature` + `X-WarmHub-Timestamp`. * 2. `CLI_BEARER_TOKEN` — `Authorization: Bearer `. * 3. `CLI_API_KEY` (+ optional `CLI_API_KEY_HEADER`, default `X-API-Key`) * — custom header carrying the key. * 4. `CLI_BASIC_USERNAME` + `CLI_BASIC_PASSWORD` — `Authorization: Basic …`. * * Multiple schemes can be configured at once; in that case the verifier * requires ALL of them to validate (downgrade-attack defense — an attacker * who learns only one credential can't drop the other from the request). Bearer * and Basic both use `Authorization`, so they cannot be configured together. * If none are configured, the call is rejected as misconfigured. * * import { verifyCliCall } from '@warmhub/sdk-ts' * * app.get('/list-reputations', async (c) => { * const { args, installRepo } = await verifyCliCall(c.req.raw, c.env) * return c.json(await listReputations(db, args.scope, args.limit, args.cursor)) * }) * * Wire format (orthogonal to the auth scheme): * - GET / DELETE: method args ride in the URL query string. Body is empty. * - POST / PUT / PATCH: method args are the JSON body (no envelope wrapper). * - The install repo always rides in `X-WarmHub-Install-Repo`. * * Throws `CliCallVerificationError` on any failure. The error's `reason` * field is one of a small fixed set so callers can map onto HTTP statuses * without string-matching messages. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/clicallverificationfailurereason/ */ type CliCallVerificationFailureReason = 'missing-signature' | 'missing-timestamp' | 'invalid-timestamp' | 'missing-install-repo' | 'unsupported-method' | 'invalid-signature' | 'invalid-format' | 'expired' | 'invalid-body' | 'no-scheme-configured' | 'invalid-bearer' | 'invalid-api-key' | 'invalid-basic'; /** * Error thrown when component CLI request verification fails. * @see https://docs.warmhub.ai/sdk-reference/classes/clicallverificationerror/ */ declare class CliCallVerificationError extends Error { readonly reason: CliCallVerificationFailureReason; constructor(reason: CliCallVerificationFailureReason, message: string); } /** * Authenticated component CLI request, parsed into its install and arguments. * @see https://docs.warmhub.ai/sdk-reference/interfaces/verifiedclicall/ */ interface VerifiedCliCall { /** HTTP method the request arrived on. */ method: CliHttpMethod; /** * `/` slug of the install, from the install-repo header. * * Only cryptographically bound under the signing scheme (the HMAC covers the * install repo). Under token schemes (bearer / api-key / basic) it is * caller-asserted — verifying the request does NOT prove the caller is * entitled to this install. When the install repo drives authorization, bind * it (resolve the per-install secret keyed by this value and verify with it) * or require the signing scheme. See docs/dev/component-rules.md → "What each * scheme binds". */ installRepo: string; /** Method args — query params for GET, parsed JSON body for POST/PUT/PATCH. */ args: Record; } /** * Secret bundle accepted by `verifyCliCall`. Pass your worker's full env * (e.g. `c.env`) or just the CLI_* subset — the verifier looks only at the * keys it knows. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/clicallsecrets/ */ type CliCallSecrets = Partial<{ CLI_SIGNING_SECRET: string; CLI_BEARER_TOKEN: string; CLI_API_KEY: string; /** Custom header name for `CLI_API_KEY`. Defaults to `X-API-Key`. */ CLI_API_KEY_HEADER: string; CLI_BASIC_USERNAME: string; CLI_BASIC_PASSWORD: string; }> & Record; /** * Verify and parse an inbound component CLI call. * * @param request - The Fetch `Request` as received by the worker. * @param secrets - Credential set values (see `CliCallSecrets`). * @param opts - Optional overrides. `nowUnixSeconds` defaults to the * current wall clock; `toleranceSec` defaults to 300 s. * @see https://docs.warmhub.ai/sdk-reference/functions/verifyclicall/ */ declare function verifyCliCall(request: Request, secrets: CliCallSecrets, opts?: { nowUnixSeconds?: number; toleranceSec?: number; }): Promise; /** * Shape field definitions — the value side of a shape's data.fields * @see https://docs.warmhub.ai/sdk-reference/type-aliases/shapefields/ */ type ShapeFields = Record; /** * Collection type discriminator accepted by an add operation. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/collectionaddtype/ */ type CollectionAddType = CollectionTag$1; type NonCollectionAddKind = Exclude; interface BaseAddOp { /** * Operation discriminator. Always `add`. */ readonly operation: 'add'; /** * Optional kind override: `shape`, `thing`, or `assertion`. */ readonly kind?: NonCollectionAddKind; /** * Assertion target wref. Presence of `about` makes the add an assertion unless `kind` overrides it. */ readonly about?: string; /** * Optional shape wref used by local validation. */ readonly shapeWref?: string; /** * Deprecated spelling for `about`; retained for compatibility. */ readonly aboutWref?: string; /** * Shape-validated data payload for shape, thing, or assertion adds. */ readonly data?: unknown; /** * Pinned target wrefs (`Shape/name@vN`) the assertion's claim is affirmed * for (assertion adds/revises only). */ readonly affirmedTargets?: readonly string[]; /** * When true, an existing target returns `noop` instead of failing. */ readonly skipExisting?: boolean; } /** * Builder add operation for shapes, things, and assertions. * @see https://docs.warmhub.ai/sdk-reference/interfaces/addop/ */ interface AddOp extends BaseAddOp { /** * Target name. Use `Shape/localName` for things and assertions; use the plain shape name for shapes. */ readonly name: string; } /** * Builder collection add operation. ADR 0004 requires an explicit name. * @see https://docs.warmhub.ai/sdk-reference/interfaces/collectionaddop/ */ interface CollectionAddOp { /** * Operation discriminator. Always `add`. */ readonly operation: 'add'; /** * Optional kind override. Collection add inputs may omit this when `type` and * `members` are present. */ readonly kind?: 'collection'; /** * Explicit collection name. ADR 0004 treats collections as ordinary named * things, so collection adds cannot be nameless. */ readonly name: string; /** * Collection type. */ readonly type: CollectionAddType; /** * Collection member wrefs. */ readonly members: string[]; /** * When true, an existing target returns `noop` instead of failing. */ readonly skipExisting?: boolean; } /** * Input accepted by `OperationBuilder.add`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationbuilderaddinput/ */ type OperationBuilderAddInput = Omit | AddOp | Omit | CollectionAddOp; /** * Builder revise operation. * @see https://docs.warmhub.ai/sdk-reference/interfaces/reviseop/ */ interface ReviseOp { /** * Operation discriminator. Always `revise`. */ readonly operation: 'revise'; /** * Target wref to revise. */ readonly wref?: string; /** * Target name to revise. Equivalent to `wref` for local paths. */ readonly name?: string; /** * Optional kind safety hint: `shape`, `thing`, `assertion`, or `collection`. */ readonly kind?: string; /** * New shape-validated data payload. */ readonly data?: unknown; /** * Pinned target wrefs (`Shape/name@vN`) the assertion's claim is affirmed * for (assertion adds/revises only). */ readonly affirmedTargets?: readonly string[]; /** * Collection type. Required when `kind` is `collection`. */ readonly type?: CollectionAddType; /** * Collection member wrefs. Required when `kind` is `collection`. */ readonly members?: string[]; /** * Optional optimistic-concurrency precondition. When supplied, the revise is * applied only if the target is still at this version number. A stale value * produces a `CONFLICT` error with `details.reason = 'expected_version_mismatch'`. * Absent field preserves today's behavior exactly (opt-in). */ readonly expectedVersion?: number; /** * Optional read-lease token (#3625) returned by `thing.getWithLease`. When * it matches the target's active lease the lease auto-releases on commit; * a mismatch (or absence against a live lease) is rejected with * `LEASE_UNAVAILABLE`. */ readonly leaseId?: string; } /** * Builder retract operation. * @see https://docs.warmhub.ai/sdk-reference/interfaces/retractop/ */ interface RetractOp { /** * Operation discriminator. Always `retract`. */ readonly operation: 'retract'; /** * Target wref or local name to retract. */ readonly name: string; /** * Optional kind safety hint: `thing`, `assertion`, `shape`, or `collection`. */ readonly kind?: CommitOperationKind; /** * Optional human-readable retraction reason. */ readonly reason?: string; /** * Optional optimistic-concurrency precondition. When supplied, the retract * is applied only if the target is still at this version number. */ readonly expectedVersion?: number; /** * Optional read-lease token (#3625) returned by `thing.getWithLease`. When * it matches the target's active lease the lease auto-releases on commit; * a mismatch (or absence against a live lease) is rejected with * `LEASE_UNAVAILABLE`. */ readonly leaseId?: string; } /** * Builder reaffirm operation. Edits an assertion's affirmation snapshot (the * pinned target versions the claim is affirmed for) without changing claim * data. */ interface ReaffirmOp { /** * Operation discriminator. Always `reaffirm`. */ readonly operation: 'reaffirm'; /** * Assertion to reaffirm: `Shape/name`. */ readonly name: string; /** * Optional kind safety hint; reaffirm applies only to assertions. */ readonly kind?: 'assertion'; /** * Pinned target wrefs (`Shape/name@vN`) to affirm. */ readonly add?: readonly string[]; /** * Pinned target wrefs to stop affirming. */ readonly remove?: readonly string[]; /** * Optional optimistic-concurrency precondition, as on revise/retract. */ readonly expectedVersion?: number; /** * Optional read-lease token (#3625), as on revise/retract. */ readonly leaseId?: string; } /** * Operation queued by `OperationBuilder`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationbuilderop/ */ type OperationBuilderOp = AddOp | CollectionAddOp | ReviseOp | RetractOp | ReaffirmOp; type OperationSubmitResult$1 = SubmittedStreamResult; /** * Client-side validation diagnostic returned by `OperationBuilder.validate`. * @see https://docs.warmhub.ai/sdk-reference/interfaces/validationdiagnostic/ */ interface ValidationDiagnostic { /** * Machine-readable diagnostic code. */ code: string; /** * Zero-based operation index, or `-1` for whole-builder diagnostics. */ operationIndex: number; /** * Human-readable diagnostic message. */ message: string; } /** * Result returned by `OperationBuilder.validate`. * @see https://docs.warmhub.ai/sdk-reference/interfaces/validationresult/ */ interface ValidationResult { /** * Whether validation produced no errors. */ valid: boolean; /** * Blocking diagnostics that prevent commit submission. */ errors: ValidationDiagnostic[]; /** * Non-blocking diagnostics for suspicious but possibly valid operations. */ warnings: ValidationDiagnostic[]; } /** * Options for constructing an `OperationBuilder`. * @see https://docs.warmhub.ai/sdk-reference/interfaces/operationbuilderoptions/ */ interface OperationBuilderOptions { /** * Known shape definitions used for local data validation. */ shapes?: Record; } /** @internal */ type OperationBuilderClient = OperationStreamClient; type ReviseInput = Omit | ReviseOp; /** * Fluent builder for composing, validating, and submitting WarmHub commit * operations. * * Use this when a caller needs to build a batch incrementally, run local * preflight checks, optionally validate data against known shapes, and submit * through the SDK stream-append path with stream identity and retry options. * * The builder is not a promise — there is no `build()` method, and `await cb` * alone will not submit anything. Finalize the batch by calling * `await cb.commit({ client, orgName, repoName, ... })`, which validates, * submits, and seals the builder in one step. A partial submission also seals * the builder because some operations may have landed. Reusing a sealed * builder throws. * * @example * ```ts * const cb = new OperationBuilder(); * cb * .add({ name: "Sensor/temp-1", data: { location: "A" } }) * .revise({ name: "Sensor/temp-1", data: { location: "B" } }); * const result = await cb.commit({ client, orgName: "acme", repoName: "world" }); * ``` * * @see https://docs.warmhub.ai/sdk/write-methods/ */ declare class OperationBuilder { private readonly ops; private readonly pendingNames; private readonly shapes; private readonly wrefToShape; private submitted; private inFlight; /** * Create an empty operation builder. * * Pass known shape definitions when you want local data validation before submitting operations. */ constructor(options?: OperationBuilderOptions); /** * Add a shape, thing, assertion, or collection operation. * * For things and assertions, names use `Shape/localName`. Supplying `about` makes the operation an assertion. Supplying collection `type` and `members` makes it a collection. Otherwise the builder infers kind from the name. * * Set `kind: 'thing'` explicitly for hierarchical thing names that would otherwise look like assertion paths. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#add */ add(op: OperationBuilderAddInput): this; /** * Add a revise operation. * * The target can be supplied as `name` or `wref`. When shape definitions were provided to the constructor, revise data is validated locally before the operation is queued. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#revise */ revise(op: ReviseInput): this; /** * Add a retract operation. * * Pass a wref string shorthand or an object with retract options such as a * kind safety hint, reason, expected version, or lease ID. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#retract */ retract(target: string | Omit): this; /** * Add a reaffirm operation. * * Edits the assertion's affirmation snapshot: `add`/`remove` carry pinned * target wrefs (`Shape/name@vN`) and compose in one operation. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#reaffirm */ reaffirm(op: Omit): this; /** * Return the queued operations. * * The returned array is read-only; use `add`, `revise`, and `retract` to modify the builder. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#operations */ get operations(): ReadonlyArray; /** * Return the number of queued operations. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#size */ get size(): number; /** * Return whether this builder has queued an add operation for a name. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#has */ has(name: string): boolean; /** * Run client-side validation without contacting the server. * * Validation checks for empty commits, duplicate adds, missing revise targets, revise-after-retract patterns, local shape-data errors when shapes were provided, and the same preflight diagnostics used before commit submission. * * Returns a {@link ValidationResult} object (`{ valid, errors, warnings }`) — * not a boolean. Read `result.valid` to gate submission, and iterate * `result.errors` for blocking diagnostics or `result.warnings` for * informational ones. * * @example * ```ts * const cb = new OperationBuilder(); * cb.add({ name: "Location/cave", data: { x: 0, y: 0 } }); * const result = cb.validate(); * if (!result.valid) { * for (const err of result.errors) { * console.error(`op ${err.operationIndex}: ${err.code} — ${err.message}`); * } * throw new Error("validation failed"); * } * for (const warn of result.warnings) console.warn(warn.message); * ``` * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#validate */ validate(): ValidationResult; /** * Validate, submit, and seal the builder. * * A successful call returns the same ordered exact receipts as * `client.commit.apply` and makes the builder single-use. A * `PartialStreamSubmissionError` also seals the builder to prevent a retry * under a different request identity. * * @param params.client WarmHub client or compatible stream client used for submission. * @param params.message Optional commit message. * @param params.committer Optional wref identifying the actor on whose behalf the write is made. * @param params.chunkSize Maximum operations per stream append. * @param params.streamId Caller-managed stream identity for observability and diagnostic correlation. * @param params.submissionId Caller-managed UUID shared by every chunk. * @param params.returnRepoSeq Return the writer's own repository-sequence acknowledgement. * @param params.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry. * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#commit */ commit(params: { client: OperationBuilderClient; orgName: string; repoName: string; committer?: string; message?: string; chunkSize?: number; streamId?: string; submissionId?: string; returnRepoSeq?: boolean; retry?: RetryPolicyOptions | false; }): Promise; private assertNotSubmitted; private assertCanModify; } /** * Mint the identity shared by every event in one logical submission. * @see https://docs.warmhub.ai/sdk-reference/functions/createoperationeventsubmissionid/ */ declare function createOperationEventSubmissionId(): string; /** * Mint the request identity used by direct operation-event submissions. * @see https://docs.warmhub.ai/sdk-reference/variables/createoperationeventrequestid/ */ declare const createOperationEventRequestId: typeof createOperationEventSubmissionId; /** * Version string for the installed SDK package. * @see https://docs.warmhub.ai/sdk-reference/variables/sdk_version/ */ declare const SDK_VERSION: string; /** @internal */ type CollectionTag = CollectionTag$1; /** @internal */ type WireScopeEntry = WireScopeEntry$1; /** * Low-level stream append input accepted by `client.stream.append`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamappendinput/ */ type StreamAppendInput = StreamAppendInput$1; /** * Low-level stream append result returned by `client.stream.append`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamappendresult/ */ type StreamAppendResult = StreamAppendResult$1; /** * The exact immutable receipt returned by every public write and lookup. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationeventreceipt/ */ type OperationEventReceipt = OperationEventReceipt$1; /** * The frozen historical receipt returned only when replaying a v1 request. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationeventreceiptv1/ */ type OperationEventReceiptV1 = OperationEventReceiptV1$1; /** * Structured diagnostic shared by real and preview operation results. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/commitdiagnostic/ */ type CommitDiagnostic = CommitDiagnostic$1; /** * Canonical ordered result row returned for one submitted real operation. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/commitrealoperationresult/ */ type CommitRealOperationResult = CommitRealOperationResult$1; /** * Remove an `@vN`, `@HEAD`, or `@ALL` version suffix from a wref. * * @see https://docs.warmhub.ai/data-modeling/wrefs/#version-modifiers */ declare function normalizeWref(wref: string): string; /** * Options for constructing a `WarmHubClient`. * @see https://docs.warmhub.ai/sdk-reference/interfaces/warmhubclientoptions/ */ interface WarmHubClientOptions { /** * Override the WarmHub API URL. Defaults to the public WarmHub API. */ apiUrl?: string; /** * Custom `fetch` implementation for non-standard runtimes or tests. */ fetch?: typeof globalThis.fetch; /** * Static token or sync/async token provider used for authenticated requests. */ accessToken?: AccessTokenProvider; /** * Authentication provider object. Prefer `auth.getToken` when integrating with an existing session system. */ auth?: { getToken: () => Promise; }; /** * Control replay of backend function log lines. Defaults to `off`. */ functionLogs?: FunctionLogMode; /** * Self-identification sent on the `X-WarmHub-Client` header (`name/version`) * for backend observability, compatibility admission, and read-analytics * surface attribution. Defaults to `@warmhub/sdk-ts/`. A wrapper * such as the WarmHub CLI overrides both values to identify its actual * released artifact. An untrusted safety hint — never an authz signal. A * per-request `X-WarmHub-Client` header on a raw request still wins over this * default. */ client?: { name?: string; version?: string; }; /** * Client-declared opt-in flags sent on `X-WarmHub-Client-Flags`. Flag names * are defined by the backend deployment; see your deployment's * documentation. Grammar-checked here; validated and honored only by the * server. Untrusted intent — never an authz signal. */ clientFlags?: readonly string[]; /** * Opt into response auto-decoration. Query results are walked for durable * reference tokens; one batched `thing.headVersions` lookup resolves them * under this caller's authority, and the result carries an additive * `decorations` record mapping each bare durable id to its canonical wref. * Unreadable and nonexistent ids get no entry. Costs one extra request per * decorated response, chunked into further requests past 500 distinct ids; * a failed lookup fails the read with the error marked * {@link WarmHubError.decorationFailure}. Defaults to `false`. */ decorateResponses?: boolean; } /** * Default WarmHub API URL used when a client is constructed without `apiUrl`. * @see https://docs.warmhub.ai/sdk-reference/variables/default_api_url/ */ declare const DEFAULT_API_URL = "https://api.warmhub.ai"; /** @internal */ type FunctionLogMode = 'raw' | 'off'; /** @internal */ interface RequestEvent { operation: 'query' | 'mutation' | 'action'; functionPath: string; } /** * Argument forms for the single-subscription management methods (`get`, * `reveal`, `pause`, `resume`, `remove`). GH-4679: the positional * `(orgName, repoName, name)` form addresses a repo-scoped subscription; the * object form may omit `repoName` to address an org-scoped (`org.renamed`) * subscription — `get({ orgName, name })`. */ type SubscriptionRefArgs = [orgName: string, repoName: string, name: string] | [ref: { orgName: string; repoName?: string; name: string; }]; /** Argument forms for `list` — see {@link SubscriptionRefArgs}. */ type SubscriptionListArgs = [orgName: string, repoName?: string] | [ref: { orgName: string; repoName?: string; }]; /** * Argument forms for `bindCredentials` — positional `(orgName, repoName, * subscriptionName, credentialSetName)` addresses a repo-scoped subscription; * the object form may omit `repoName` for an org-scoped subscription. */ type SubscriptionBindArgs = [ orgName: string, repoName: string, subscriptionName: string, credentialSetName: string ] | [ ref: { orgName: string; repoName?: string; subscriptionName: string; credentialSetName: string; } ]; /** Argument forms for `unbindCredentials` — see {@link SubscriptionBindArgs}. */ type SubscriptionUnbindArgs = [orgName: string, repoName: string, subscriptionName: string] | [ ref: { orgName: string; repoName?: string; subscriptionName: string; } ]; /** @internal */ type CoreErrorKind = 'BACKEND' | 'NOT_FOUND' | 'FORBIDDEN' | 'UNAUTHENTICATED' | 'VALIDATION_ERROR' | 'CONFLICT' | 'RATE_LIMITED' | 'CANCELLED' | 'CLIENT_INCOMPATIBLE' | 'NETWORK'; /** * Stable SDK error kinds plus backend domain codes that pass through as strings. * * Branch on this (or {@link WarmHubError.kind}) to recover from expected * failures. {@link isRetryable} returns the retryability column verbatim. * * @remarks * Stable kinds (members of `CoreErrorKind`): * * - `BACKEND` — cause: server-side failure that did not carry a more specific domain code (tRPC error data has no `data.warmhub.code`, REST status mapped to the catch-all default — primarily 5xx that lack a body `error.code` — or an SDK transport throw such as a non-OK SSE response); retryable: true; action: retry with backoff and surface the message if it persists; if the underlying error is a deterministic local-adapter failure (e.g. a misconfigured custom `fetch`), fix the adapter rather than retrying; origin: SDK tRPC fallback, `httpStatusToWarmHubCode` default for unmapped HTTP statuses, SSE transport, unknown thrown values inside tRPC paths (custom-`fetch` adapter throws are normalized to `BACKEND` only on tRPC surfaces — on REST and `ping` surfaces the raw error escapes uncaught). REST responses with a parseable body surface as their pass-through `error.code` (typically `INTERNAL_ERROR`), and REST 4xx responses without a body code fall through to the HTTP-status mapping (`NOT_FOUND`, `UNAUTHENTICATED`, `FORBIDDEN`, `CONFLICT`, `VALIDATION_ERROR`, `RATE_LIMITED`), not `BACKEND`. * - `NOT_FOUND` — cause: a referenced entity (repo, org, thing, shape, subscription, credential set, etc.) is missing or the caller cannot see it, or the client hit a removed/renamed tRPC procedure path or unsupported method because its route contract is out of sync with the backend; retryable: false; action: verify the identifier the call site used (wref, slug, name) and escalate to a caller with read access if the entity should exist; when the message or hint names a procedure/method mismatch, upgrade the WarmHub client to match the backend; origin: SDK reads across all surfaces, commit pipeline, REST query endpoints, tRPC transport 404/405 route-missing/version-skew failures * - `FORBIDDEN` — cause: caller is authenticated but lacks the required permission; retryable: false; action: request the missing permission or use a token with broader scope; origin: SDK + REST authorization middleware * - `UNAUTHENTICATED` — cause: missing, expired, or invalid bearer token on a tRPC or REST call; retryable: false; action: mint a fresh PAT and update whichever client option the application wires it into (`auth.getToken` callback or `accessToken` — the SDK does not read `WH_TOKEN` or any env var directly); `wh auth login` only refreshes the CLI's on-disk credentials and does not propagate to a constructed SDK client; for export tickets, remint via the appropriate backend endpoint; origin: SDK + REST auth middleware. Live-ticket SSE auth failures surface as `BACKEND`, not `UNAUTHENTICATED`, because `openSse` maps every non-OK SSE response to `BACKEND`. * - `VALIDATION_ERROR` — cause: input failed schema, shape, content-length, or read-pagination cursor validation; retryable: false; action: fix the offending field per the error message, or restart the read without a stale/non-advancing cursor; origin: commit pipeline, SDK writes, SDK read pagination helpers, client-side content limits * - `CONFLICT` — cause: write collides with current state (concurrent edit, name already in use); retryable: false; action: refetch the current state and reconcile before retrying the write; origin: commit pipeline, repo/org creation. Archived org / repo writes surface as the pass-through code `ARCHIVED`, not `CONFLICT`. * - `RATE_LIMITED` — cause: caller exceeded the per-token or per-org request budget; retryable: true; action: wait {@link WarmHubError.retryAfter} seconds before retrying; origin: REST + tRPC throttling * - `CANCELLED` — cause: caller aborted the request via `AbortSignal`; retryable: true; action: retry only if the caller still wants the result; origin: SDK `AbortError` mapping * - `CLIENT_INCOMPATIBLE` — cause: the client family/version or write contract is incompatible with the backend; retryable: false; action: follow the error hint to upgrade the client or backend; origin: SDK write preflight and backend mutation admission * - `NETWORK` — cause: connection failed before the server produced a response (DNS, refused, timeout, fetch error); retryable: true; action: check connectivity to the configured `apiUrl` and retry with backoff; origin: SDK `fetchWithAuth` connection-error mapping * * Backend domain codes (e.g. `SHAPE_MISMATCH`, `WREF_UNRESOLVABLE`, * `ARCHIVED`, `INTERNAL_ERROR`) pass through unchanged on * `code` / `kind`. Surface the `message` and `hint` verbatim and use the * message to decide whether to retry — most pass-through codes are terminal, * but the backend reuses some codes for transient failures (notably * `INTERNAL_ERROR`, which the webhook-validation path emits with a * `please retry` message when DNS or HEAD probes flake). See the * [HTTP error catalog](/http-api/overview/#response-format) * for HTTP-status mapping and the most common backend codes (the catalog is * not exhaustive — rarer codes such as `WREF_UNRESOLVABLE` are emitted by the * backend but not yet tabulated). * @see https://docs.warmhub.ai/sdk-reference/type-aliases/errorkind/ */ type ErrorKind = CoreErrorKind | (string & {}); /** * Legacy commit result fields plus ordered exact receipts for every submitted chunk. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationsubmitresult/ */ type OperationSubmitResult = SubmittedStreamResult; /** @internal */ type ShapeChange = ShapeChangeCompatibilityResult; /** @internal */ type Shape = ShapeGetResult; /** @internal */ type ShapeList = ShapeListResult; /** * Result of `client.shape.remove` — confirms the retraction with the new version metadata. * @internal */ type ShapeRemove = ShapeRemoveCompatibilityResult; /** @internal */ type RenameResult = RenameCompatibilityResult; /** @internal */ type CommitApplyCompatibilityResult = CommitApplyCompatibilityResult$1; /** * Shape of a subscription record returned from `client.subscription.list`, * `client.subscription.get`, `client.subscription.create`, and * `client.subscription.update`. * * `filterJson` is typed as `unknown`; treat it as an opaque value owned by * the server and pass it through unchanged on updates. `actionContainer` * and `actionContainerConfig` appear on the type as optional fields but are * always returned as `undefined` on reads. * * Webhook URLs are redacted to their origin (`webhookOrigin`, * `fallbackWebhookOrigin` = scheme://host) on read — the raw URL path is a * bearer secret and is returned only via `client.subscription.reveal`. * * @internal */ type SubscriptionInfo = { name: string; kind: 'webhook'; eventType: SubscribableEventType; active: boolean; shapeName?: string; sourceRepo?: string; filterJson?: unknown; webhookOrigin?: string; fallbackWebhookOrigin?: string; actionContainerConfig?: unknown; actionContainer?: string; allowTraceReentry?: boolean; /** @deprecated Accepted for compatibility; action notifications are failure-only. */ notifyOnSuccess?: boolean; componentRef?: string; credentialSetNames: Array; /** * Immutable operation-event routing revision. Absent for metadata * subscriptions. It describes stored router state; legacy delivery * remains in effect until the exact router is activated. */ operationSubscription?: { /** Omitted when current source-repository authority no longer permits its label. */ effectiveSourceRepo?: string; revision: number; lifecycle: 'active' | 'paused' | 'retired'; matcherVersion: string; matcherDigest: string; credentialGeneration: number; deliveryPolicy: { allowTraceReentry: boolean | null; notifyOnSuccess: boolean; }; retirement?: { retiredAt: number; reason: string; }; }; createdAt: number; }; /** * Array result type for `client.subscription.list`. * @internal */ type SubscriptionList = SubscriptionInfo[]; /** @internal */ type SubscriptionCompatCreateCommon = { orgName: string; name: string; webhookUrl: string; fallbackWebhookUrl?: string; allowTraceReentry?: boolean; /** @deprecated Accepted for compatibility; action notifications are failure-only. */ notifyOnSuccess?: boolean; componentRef?: string; workspacePolicy?: never; kind: 'webhook'; /** @internal */ actionContainer?: string; /** @internal */ actionContainerConfig?: unknown; }; /** * Input shape for `client.subscription.create`, discriminated on `eventType` * (GH-4679, GH-6553): * * - default / `commit` — operation-based, repo-scoped (`repoName`); requires a * `filterJson` object and a shape binding (`shapeName` or `filterJson.shape`). * - `repo.renamed` / `thing.renamed` / `shape.renamed` — repo-scoped metadata * events; no shape/filter/source. * - org-scoped metadata events — no `repoName`/shape/filter/source. * * The metadata variants forbid the commit-only fields at the type level so * invalid shapes fail at compile time, not just server-side. * * @see https://docs.warmhub.ai/subscriptions/creating/ */ type SubscriptionCompatCreateInput = (SubscriptionCompatCreateCommon & { eventType?: 'commit'; repoName: string; filterJson: Record; shapeName?: string; sourceRepoRef?: string; }) | (SubscriptionCompatCreateCommon & { eventType: 'repo.renamed' | 'thing.renamed' | 'shape.renamed'; repoName: string; filterJson?: never; shapeName?: never; sourceRepoRef?: never; }) | (SubscriptionCompatCreateCommon & { eventType: OrgScopedEventType; repoName?: never; filterJson?: never; shapeName?: never; sourceRepoRef?: never; }); /** * Input shape for `client.subscription.update`. `orgName` and `name` identify * the subscription; omit `repoName` to update an org-scoped * subscription. All other fields are optional and only the ones you provide get * patched. Metadata subscriptions reject * `shapeName`/`filterJson` — they have only delivery fields to edit. * * @see https://docs.warmhub.ai/subscriptions/managing/#update-subscription */ type SubscriptionCompatUpdateInput = { orgName: string; repoName?: string; name: string; shapeName?: string; filterJson?: Record; webhookUrl?: string; fallbackWebhookUrl?: string | null; allowTraceReentry?: boolean; /** @deprecated Accepted for compatibility; action notifications are failure-only. */ notifyOnSuccess?: boolean; /** @internal Back-compat field; not consumed by the backend update mutation. */ sourceRepoRef?: string; workspacePolicy?: never; /** @internal */ actionContainer?: string; /** @internal */ actionContainerConfig?: unknown; }; /** @internal */ type ActionRunInfo = ActionRun; /** @internal */ type ActionRunStatsInfo = ActionRunStats; /** @internal */ type ActionAttemptInfo = ActionAttempt; /** @internal */ type ActionNotificationInfo = ActionNotification; /** @internal */ type ActionLiveFeed = ActionLiveFeedResult; /** @internal */ type ActionLiveFeedItem = ActionLiveFeed['items'][number]; /** @internal */ type ActionLeaseAcquire = { ok: true; reused: boolean; } | { ok: false; reason: string; }; /** @internal */ type ActionLeaseOp = { ok: true; } | { ok: false; reason: string; }; /** @internal */ type ActionDeliveryTarget = string | { runId: string; deliveryId?: never; } | { deliveryId: string; runId?: never; }; /** @internal Curated lists returned by `client.homepage.featuredLists()`. */ type HomepageFeaturedListsResult = HomepageFeaturedListsResult$1; /** * A single entry in the indexed-fields report. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/indexedfieldentry/ */ type IndexedFieldEntry = { shapeName: string; fieldPath: string; /** Index states: building | ready | failed */ state: string; /** ISO-8601 date string or null — dates are serialized as strings over tRPC JSON wire. */ promotedAt: string | null; /** ISO-8601 date string — dates are serialized as strings over tRPC JSON wire. */ stateChangedAt: string; failureReason: string | null; backfillDone: number; backfillTotal: number | null; }; /** * One shape's marker on a declared field path. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/fieldindexcarryingmarker/ */ type FieldIndexCarryingMarker = { shapeName: string; /** Index states: building | ready | failed */ state: string; }; /** * One row of the declared-indexing registry, joined to the markers on it. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/declaredfieldentry/ */ type DeclaredFieldEntry = { fieldPath: string; /** Shape named at pin time, display only; null once that shape is gone. */ declaredByShape: string | null; /** Every shape carrying this path, one entry per marker. */ carrying: FieldIndexCarryingMarker[]; /** At least one marker carries the path and every one is ready. */ ready: boolean; }; /** * Declarations-versus-markers consistency check. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/fieldindexconsistency/ */ type FieldIndexConsistency = { /** Markers indexing a path the registry does not authorize. */ undeclaredMarkers: Array<{ shapeName: string; fieldPath: string; }>; /** Declared paths no marker carries. Informational, not a mismatch. */ uncarriedDeclarations: string[]; /** No marker indexes a path the registry does not authorize. */ consistent: boolean; }; /** * Report of all indexed fields for a repo, grouped by state. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/indexedfieldsreport/ */ type IndexedFieldsReport = { ready: IndexedFieldEntry[]; building: IndexedFieldEntry[]; failed: IndexedFieldEntry[]; other: IndexedFieldEntry[]; /** The declarations that authorize those markers. */ declarations: DeclaredFieldEntry[]; consistency: FieldIndexConsistency; }; /** * A shape whose contract carries a declared field path, and its marker state. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/fieldindexcarryingshape/ */ type FieldIndexCarryingShape = { shape: string; markerState: string; }; /** * Result of declaring (or withdrawing) a field path for indexing. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/fieldindexpinresult/ */ type FieldIndexPinResult = { /** The path as the shape spells it — a case-insensitive request is folded to it. */ fieldPath: string; /** The shape the caller named; display only, since a declaration is repo-wide. */ declaredByShape: string; carryingShapes: FieldIndexCarryingShape[]; }; /** @internal */ type ComponentInfo = ComponentSummary; /** @internal */ type ComponentView = ComponentDetail; /** @internal */ type ComponentList = ComponentListResult; /** @internal */ type ComponentHistory = ComponentHistoryResult; /** @internal */ type ComponentHistoryOptions = { componentRef?: string; limit?: number; }; /** @internal */ type ComponentInstallResult = ComponentInstallResult$1; /** @internal */ type ComponentUninstallResult = ComponentUninstallResult$1; /** * Caller-owned root identity for component installation repository-write * receipts. Reuse it only when recovering the same install submission. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/componentinstalloptions/ */ type ComponentInstallOptions = { submissionId: string; }; /** * Caller-owned root identity for component teardown repository-write receipts. * Reuse it only when recovering the same teardown submission. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/componentuninstalloptions/ */ type ComponentUninstallOptions = { submissionId: string; }; /** @internal */ type ComponentListOptions = { limit?: number; cursor?: string; }; type ComponentRegistryInfo = { ownerOrgName: string; componentName: string; ref: string; isPrivate: boolean; mintedTokens: boolean; sourceUrl?: string; sourceDefaultRef?: string; setupUrl?: string; uninstallUrl?: string; allowedCallbackDomains: string[]; credentialSetId?: string; credentialSetName?: string; description?: string; createdAt: number; updatedAt: number; }; type ComponentRegistryList = { items: ComponentRegistryInfo[]; }; type ComponentRegistryMutationInput = { isPrivate?: boolean; mintedTokens?: boolean; sourceUrl?: string; sourceDefaultRef?: string; setupUrl?: string; uninstallUrl?: string; allowedCallbackDomains?: string[]; credentialSetName?: string; description?: string; /** Validated component manifest. Required on register; on update, supplying it publishes a new version. */ manifest?: Record; }; type ComponentRegistryRegisterInput = ComponentRegistryMutationInput & { manifest: Record; }; type ComponentRegistryResolveResult = { /** Latest published manifest (manifest-only install — #3993). */ manifest: Record; /** Stored content hash of the resolved manifest; echo it back on setupCall. */ manifestHash: string; hasSetup: boolean; }; type ComponentRegistrySetupCallInput = { installId: string; installRepo: string; /** * Manifest hash from the preceding resolve. The backend rejects the call if * its latest manifest no longer matches, so token scopes can't drift to a * revision published mid-install (#3993). */ expectedManifestHash: string; }; type ComponentRegistrySetupCallResult = { ok: boolean; status: number; body?: string; warnings: string[]; }; type ComponentRegistryCliCallInput = { installRepo: string; args?: Record; }; /** * Backend wraps the component-service response in an envelope identical to * `ComponentRegistrySetupCallResult`. The type alias keeps the SDK drift gate * happy (no new *Result shape to audit) and signals that callers should expect * the same `{ ok, status, body?, warnings }` contract — upstream non-2xx * comes back as `{ ok: false, status, body }`, not a thrown `WarmHubError`. */ type ComponentRegistryCliCallResult = ComponentRegistrySetupCallResult; /** @internal */ type ShapeListOptions = { match?: string; componentRef?: string; excludeComponents?: boolean; includeRetracted?: boolean; }; /** @internal */ type ShapeGetOptions = { includeRetracted?: boolean; }; /** @internal */ type ShapeCreateOptions = { eventRequestId: string; description?: string; /** Shape HEAD references captured as an immutable composition closure. */ composes?: string[]; }; /** @internal */ type ShapeReviseOptions = { eventRequestId: string; description?: string; /** Replace the composition list; omit to preserve it, or pass [] to clear it. */ composes?: string[]; }; /** @internal */ type ShapeRemoveOptions = { eventRequestId: string; }; /** * Caller-owned UUID retained across an ambiguous rename retry. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/renameoptions/ */ type RenameOptions = { eventRequestId: string; }; /** @internal */ interface ShapeHistoryOptions { includeRetracted?: boolean; limit?: number; cursor?: string; } /** @internal */ type ShapeHistory = HistoryResult; /** @internal */ type OrgInfo = Org; /** @internal */ type OrgList = OrgListResult; /** @internal */ type OrgMemberInfo = OrgMember; /** * Caller's role within an organization. Returned by * `client.org.getCallerRole`, carried as `callerRole` on * `client.org.listMembers` results, and accepted by * `client.org.changeMemberRole` to set a member's role (only owners * may promote to or demote from `'owner'`; the last owner cannot be * demoted). Mirrors `orgRoleSchema` in `@warmhub/backend`; the * static check below blocks any drift between this literal and the * generated copy. * * @see https://docs.warmhub.ai/auth/personal-access-tokens/#available-permissions */ type OrgRole = 'owner' | 'admin' | 'editor' | 'viewer'; /** @internal */ type OrgMemberList = { members: OrgMemberInfo[]; callerRole: OrgRole; }; /** * Repository metadata returned by `client.repo.get`, `create`, * `setDescription`, `setDisplayName`, `setVisibility`, `rename`, `update`, * `archive`, and `unarchive`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repoinfo/ */ type RepoInfo = { orgName: string; name: string; displayName: string; description?: string; visibility: 'public' | 'private'; archivedAt?: number; createdAt: number; }; /** @internal */ type RepoList = RepoListResult; /** * A cross-org search hit (repo or component). GH-4383. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/globalsearchresultitem/ */ type GlobalSearchResultItem = { kind: 'repo' | 'component'; orgName: string; name: string; description: string | null; }; /** @internal */ type GlobalSearchResult = { items: GlobalSearchResultItem[]; nextCursor?: string; }; /** * Pagination controls for global repo and component search. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/globalsearchoptions/ */ type GlobalSearchOptions = { limit?: number; cursor?: string; }; /** @internal */ type OrgListOptions = { includeArchived?: boolean; }; /** @internal */ type OrgListMembersOptions = { pending?: boolean; }; /** @internal */ type RepoStatsView = RepoStats; /** @internal */ type RepoConfigureStatsView = RepoConfigureStats; /** @internal */ type RepoShapeInstanceCountsView = RepoShapeInstanceCounts; /** @internal */ type RepoStatsBatchResult = RepoStatsBatchResult$1; /** @internal */ type RepoWithStatsInfo = { orgName: string; name: string; displayName: string; description?: string; visibility: 'public' | 'private'; archivedAt?: number; createdAt: number; total: number; byKind: { thing: number; assertion: number; shape: number; }; lastWriteAt?: number; hasErrors: boolean; failingSubscriptionName?: string; }; /** @internal */ type RepoListPageResult = Page; /** @internal */ type RepoSort = 'newest' | 'oldest' | 'nameAsc' | 'nameDesc'; /** @internal */ type RepoListPageOptions = { limit?: number; cursor?: string; includeArchived?: boolean; search?: string; sort?: RepoSort; }; /** * A repository in the caller's cross-org listing (`client.repo.listForCaller`). * * `lastWriteAt` is the latest thing-write time and is absent for repos that * have never been written to (they order by `createdAt`). It reflects only * thing-version creation — not description edits, cron runs, or reads. * * Structural alias of the generated `RepoForCaller` (sourced from the backend * `repoForCallerSchema` via the backend-types pipeline), so it can't drift. * * @internal */ type RepoRecentInfo = RepoForCaller; /** @internal */ type RepoListForCallerOptions = { limit?: number; sort?: 'recent' | 'name'; }; /** * Options for the public "Explore" directory (`client.repo.explore`). * * Structural alias of the generated `RepoExploreInput` (sourced from the * backend `repoExploreInputSchema` via the backend-types pipeline), so it * can't drift from the procedure's input contract. * * Two mutually-exclusive modes: the browse mode * (`search`/`org`/`activity`/`hasSubscriptions`/`minThings`/`sort`/`limit`/`cursor`) * and the exact-match `slugs` batch lookup. `slugs` cannot be combined with any * browse/search/sort/filter field — the backend rejects the mix. * * @internal */ type RepoExploreOptions = RepoExploreInput; /** @internal */ type RepoExploreBrowseOptions = Omit & { slugs?: never; }; /** * A repository row in the public "Explore" directory * (`client.repo.explore`). * * Structural alias of the generated `RepoExploreItem` (sourced from the backend * `repoExploreItemSchema` via the backend-types pipeline), so it can't drift. * * @internal */ type RepoExploreItem = RepoExploreItem$1; /** * Result of the public "Explore" directory (`client.repo.explore`). * * `total` and `orgs` are first-page only (present when `cursor` is absent). * * Structural alias of the generated `RepoExploreResult` (sourced from the * backend `repoExploreResultSchema` via the backend-types pipeline), so it * can't drift. * * @internal */ type RepoExploreResult = RepoExploreResult$1; /** @internal */ type CurrentUserInfo = { id: string; email: string; firstName?: string; lastName?: string; externalId: string; identityWref: string | null; knockUserToken: string | null; personalOrgName: string | null; } | null; /** @internal */ type WhoamiScopeEntry = { resource?: string; redactedResource?: true; permissions: string[]; allowedMatches?: string[]; }; /** @internal */ type WhoamiInfo = { authenticated: false; error?: string; } | { authenticated: true; email: string; userId: string; authMethod: 'interactive' | 'pat'; tokenName: string | null; tokenDescription: string | null; scopes: WhoamiScopeEntry[] | null; expiresAt: number | null; identityWref: string | null; }; /** @internal */ type RepoListOptions = { limit?: number; cursor?: string; includeArchived?: boolean; search?: string; sort?: RepoSort; }; /** @internal */ type PageRequest = { limit?: number; cursor?: string; }; /** * Cursor page envelope used by paginated SDK methods. * * `Page` is generic over the item type — always supply the type argument when * annotating a variable that holds a page (`Page`, `Page`, * etc.). Using the bare name `Page` fails with `TS2314: Generic type 'Page' * requires 1 type argument(s)`. * * @example * ```ts * import type { Page, ThingItem } from "@warmhub/sdk-ts"; * * const page: Page = await client.thing.head("acme", "world", { limit: 50 }); * for (const item of page.items) console.log(item.wref); * if (page.nextCursor) { * // pass page.nextCursor back as `cursor` on the next call * } * ``` * @see https://docs.warmhub.ai/sdk-reference/type-aliases/page/ */ type Page = { items: T[]; nextCursor?: string; }; /** @internal */ type OrgRef = OrgInfo; /** @internal */ type RepoRef = RepoInfo; /** @internal */ type ShapeRef = ShapeChange; /** @internal */ type RepoLocator = { orgName: string; repoName: string; }; /** * Stable identity and creation timestamps embedded on every thing-like read * result. `durableId` is a self-routing, self-verifying token (Crockford base32 * over `repo_id + things.id + CRC-32C`) that remains identical before and after * rename and across revise/retract. `createdOn` records the thing's birth * date (stable across all mutations); `revisedOn` is the timestamp of * the current version (advances on each revise). History rows carry only * `durableId` and `createdOn` — omit `revisedOn`. * * Pass a bare `durableId` (optionally with `@vN`) wherever a wref is accepted * on read surfaces; `orgName`/`repoName` may be omitted for self-routing reads. * * @see https://docs.warmhub.ai/data-modeling/wrefs/#durable-ids */ type ThingMetadata = { durableId: string; createdOn: number; revisedOn: number; }; /** @internal */ type CollectionReadDataMode = 'auto' | 'full'; /** @internal */ type CollectionReadSummary = { /** * The PINNED collection Shape wref this entry describes — `Set@v3`, * `Quad@v1`. A Thing certified under two collection Shapes carries two * entries. * * The member LAYOUT is deliberately absent. It is this Shape version's own * contract — which fields are references, single or array, in declared order * — so a reader that needs to place members reads the Shape named here, * once, instead of receiving a copy of the field list on every row. */ shape: string; /** * Absent on a read whose body is not complete — head `dataMode: none` or * `summary`, or a history row the retraction policy blanked. Absent means * "not known from this read", never "zero". */ memberCount?: number; dataMode: 'full' | 'summary'; fullData: boolean; truncated: boolean; inlineLimit?: number; preview?: string[]; previewCount?: number; }; /** @internal */ type ThingItem = { wref: string; name: string; kind: string; shapeName?: string; /** Version-pinned Shapes declared directly by this Thing version. */ declaredShapes?: string[]; /** Full certified closure, included only when requested on page reads. */ validatedShapes?: string[]; version: number; createdAt: number; active?: boolean; data?: unknown; aboutWref?: string; /** * Pinned target wrefs the assertion's current version affirms. Assertions * only; targets the reader cannot see are suppressed per-target. */ affirmedWrefs?: string[]; roles?: CollectionMembershipRole[]; /** * One entry per collection Shape in the certificate closure. Absent on a * Thing that is not a collection; never empty when present. */ collections?: CollectionReadSummary[]; metadata?: ThingMetadata; [key: string]: unknown; }; /** @internal */ type ThingHeadOptions = Omit; /** @internal */ type HeadResult = { items: ThingItem[]; nextCursor?: string; /** Completed incremental scan checkpoint; omitted on ordinary and nonterminal pages. */ repoSeq?: number; }; /** @internal */ type ThingHeadChangesOptions = Omit & { sinceRepoSeq: number; }; /** @internal */ type ThingChanges = { items: ThingItem[]; repoSeq: number; }; /** @internal */ type ThingGet = ThingDetail; /** * Returned by `client.thing.getWithLease`. Everything `client.thing.get` * returns, plus a `lease` block ({@link ThingGetWithLease.lease}) the holder * echoes back on the subsequent `revise`/`retract` (`leaseId`) and on * `client.thing.releaseLease`. The `version` and the `lease` come from a * single backend snapshot, so the holder knows exactly which version it * leased. * * @see https://docs.warmhub.ai/data-modeling/things/ */ type ThingGetWithLease = ThingDetail & { lease: { id: string; expiresAt: string; }; }; /** * Full record shape for a single Thing returned by single-record SDK * reads. Returned by `client.thing.get` and `client.thing.resolve`, the * `items[]` element type for `client.thing.getMany`, the base of * `client.thing.graph`, and the return of `client.repo.getReadme` and * `getAgents`. Identity fields (`wref`, `name`, `kind`, * `shape`/`shapeName`) are always populated. `data` carries the * shape-validated payload when present; `active` is `false` for retracted * reads. The `[key: string]: unknown` index signature is a forward-compat * affordance — current callers should rely on the named fields. Note: list * reads — `client.thing.head`, `query`, and `search` — return a thinner * row shape (no `shape`, `validatedShape`, or `committerWref`); use * `client.thing.get` to hydrate a full `ThingDetail` from a list result. * * Authored WREF values inside `data` and identity metadata such as * `aboutWref`, `committerWref`, `createdBy`, and `revisedBy` use durable ids in * the reader-independent base response. Body references preserve their exact * version pin; identity references are unpinned. With `decorateResponses`, a * separate `decorations` sidecar maps readable durable ids to current canonical * labels without rewriting the base body. A durable id grants no target access. * * @see https://docs.warmhub.ai/data-modeling/things/ */ type ThingDetail = { wref: string; pinnedWref?: string; name: string; kind: string; /** * @deprecated Legacy alias of `shapeName` from the pre-Postgres API * layering — the two are identical for every thing. Read `shapeName` * instead. This field is retired together with the other single-shape read * fields when the multi-shape read arrays land (the multi-shape program's * write-format change). */ shape?: string; /** Canonical unversioned shape name (e.g. `"Game"`). */ shapeName?: string; /** * Version-pinned shape wref (e.g. `"Game@v3"`) — the shape version that * validated this thing version. * * Naming caveat, now retiring. Where the read path still sources the legacy * shape column, this is *synthesized* from the shape's current version at * read time, so revising a shape retroactively changes it for every thing * already validated against an older version. Where reads are served from * certificate records it is the captured fact and no longer moves. The two * sources give the same answer except when the shape was revised after the * thing version was written; the caveat goes away entirely once every * repository reads certificates. */ validatedShape?: string; /** Version-pinned Shapes declared directly by this Thing version. */ declaredShapes?: string[]; /** Full version-pinned certificate closure for this Thing version. */ validatedShapes?: string[]; version: number; active: boolean; data?: unknown; /** One entry per collection Shape in the certificate closure. */ collections?: CollectionReadSummary[]; /** True on synthesized empty stubs from getReadme/getAgents when no row exists yet. */ synthesized?: boolean; aboutWref?: string; /** * Pinned target wrefs the returned assertion version affirms. Assertions * only; targets the reader cannot see are suppressed per-target. */ affirmedWrefs?: string[]; committerWref?: string; /** * #4848 Phase C: the thing's creator (first-version author), a peer of the * current-version author `revisedBy`. Present for things created after Phase * C; optional for legacy rows without trustworthy creator provenance. */ createdBy?: string; /** #4848 Phase C: current-version author (renamed from createdByWref). */ revisedBy?: string; metadata?: ThingMetadata; [key: string]: unknown; }; /** @internal */ type RefLink = RefsResult$1['items'][number]; /** @internal */ type SynthesizedRepoContent = SynthesizedRepoContent$1; /** * Repository schema, subscription, count, content, and license overview. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repodescriberesult/ */ type RepoDescribeResult = RepoDescribeResult$1; /** * A repository's validated, normalized license declaration. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repolicense/ */ type RepoLicense = RepoLicense$1; /** @internal */ type ThingGraphValue = ThingGraphResult | string | number | boolean | null | ThingGraphValue[]; /** @internal */ type ThingGraphResult = ThingDetail & { about?: ThingGraphValue; assertions?: ThingGraphResult[]; resolved?: Record; graph?: { depth: number; limit: number; truncated: boolean; }; }; /** @internal */ type ThingHistory = HistoryResult; /** @internal */ type HistoryVersion = ThingHistoryResult['versions'][number] & Record; /** @internal */ type HistoryResult = Omit & { thing?: { wref: string; name?: string; kind: string; shapeName?: string; }; /** History rows retain forward-compatible backend fields. */ versions: HistoryVersion[]; }; /** @internal */ type ThingHeadRequest = { orgName: string; repoName: string; shape?: string; declaredShape?: string; includeValidatedShapes?: boolean; kind?: CommitOperationKind; match?: string; dataMode?: 'full' | 'summary' | 'none'; includeRetracted?: boolean; limit?: number; cursor?: string; componentRef?: string; excludeComponents?: boolean; excludeInfraShapes?: boolean; where?: WherePredicate[]; /** Strict lower repository sequence for an incremental scan; `-1` seeds a complete snapshot. */ sinceRepoSeq?: number; }; /** @internal */ type ThingHead = HeadResult; /** * Page options for evaluating a stored View. * * The View definition version is selected by the single versionable `wref` * passed to `view.evaluate`; there is no separate version option. */ /** @internal */ type ViewEvaluateOptions = Omit; /** One page of live results from a selected stored View definition. */ /** @internal */ type ViewEvaluateResult = ViewEvaluateResult$1; /** @internal */ type LiveWatchResult = { updates: number; }; /** * Handle returned by live subscription helpers. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/livehandle/ */ type LiveHandle = { close: () => void; closed: Promise; }; /** @internal */ type LiveThingHeadOptions = ThingHeadOptions & { signal?: AbortSignal; }; /** @internal */ type LiveThingHistoryOptions = ThingHistoryOptions & { signal?: AbortSignal; }; /** @internal */ type LiveSubscriptionLogOptions = ActionLiveFeedOptions & { signal?: AbortSignal; }; /** * Raw SSE invalidation event from a watched repo. * * @see https://docs.warmhub.ai/subscriptions/overview/#how-subscriptions-work */ type LiveRepoEvent = { topic: 'commit.applied' | 'action.updated'; affectedShapes: string[]; affectedThings: string[]; affectedTargets: string[]; hasNewCommit: boolean; }; /** @internal */ type ActionListRunsOptions = { runId?: string; subscriptionName?: string; status?: 'pending' | 'running' | 'processing' | 'retry_wait' | 'succeeded' | 'suppressed' | 'failed_terminal' | 'dead_letter'; outcome?: 'succeeded' | 'failed'; since?: number; cursor?: string; limit?: number; }; /** @internal */ type ActionRunStatsOptions = { subscriptionName?: string; since?: number; }; /** @internal */ type ActionLiveFeedOptions = { limit?: number; cursor?: string; }; /** @internal */ type ActionListNotificationsOptions = { since?: number; limit?: number; }; /** @internal */ type ThingHistoryOptions = { wref?: string; shape?: string; declaredShape?: string; about?: string; includeRetracted?: boolean; resolveCollections?: boolean; match?: string; limit?: number; cursor?: string; }; /** @internal */ type ThingGetOptions = { includeRetracted?: boolean; dataMode?: CollectionReadDataMode; }; /** @internal */ type ThingGraphOptions = { version?: number; depth?: number; limit?: number; }; /** * Result from `client.token.create`. Includes the one-time secret token * value and its metadata — persist the secret immediately, it is only * returned on creation. * * @internal */ type TokenResult = TokenCreateResult; /** * Shape of an access token record returned from `client.token.list` and * `client.token.get`. * * `expiresAt` and `revokedAt` are normalized to `number | null` so * "never expires" / "not revoked" (`null`) is distinguishable from * "expired at timestamp" / "revoked at timestamp" without probing for * `undefined`. * * @internal */ type TokenInfo = { name: string; description?: string; scopes?: Array<{ resource?: string; permissions: Array; allowedMatches?: Array; redactedResource?: true; }>; expiresAt: number | null; revokedAt: number | null; createdAt: number; /** * Default committer identity wref. Null when this PAT has no * associated identity. */ committerIdentityWref?: string | null; }; /** @internal */ type CredentialInfo = { name: string; scope: 'org' | 'repo'; description?: string; keyNames: string[]; revokedAt?: number; createdAt: number; updatedAt: number; }; /** @internal */ type CredentialAuditEntry = { timestamp: number; action: string; actorId: string; }; /** @internal */ type CredentialGrantResult = { granted: boolean; repoName: string; }; /** @internal */ type CredentialUngrantResult = { ungranted: boolean; repoName: string; }; /** @internal */ type CredentialKeyMutationResult = CredentialKeyMutationResult$1; /** @internal */ type CredentialDeleteResult = CredentialDeleteResult$1; /** @internal */ type CredentialRevokeResult = CredentialRevokeResult$1; /** @internal */ type SubscriptionBindCredentialsResult = SubscriptionBindCredentialsResult$1; /** @internal */ type SubscriptionUnbindCredentialsResult = SubscriptionUnbindCredentialsResult$1; /** @internal */ type CollectionMembershipRole = CollectionMembershipRole$1; /** @internal */ type Assertion = ThingDetail & { children: Assertion[]; roles?: CollectionMembershipRole[]; }; /** @internal */ type AboutResult = { target?: ThingDetail; assertions: Assertion[]; nextCursor?: string; }; /** @internal */ type FilterResult = HeadResult; /** @internal */ type SearchResult = Omit; /** @internal */ type RefsResult = RefsResult$1; /** @internal */ type CollectionType = CollectionType$1; /** * @internal What `collection.create` accepts. The legacy arc/bond/pair sugar is * accepted during the compatibility window (issue #10668) and lowered by the * backend to ordinary Things with a deprecation warning. */ type CollectionWriteType = CollectionType; /** @internal */ type CollectionMutationResult = CollectionMutationCompatibilityResult; /** @internal */ type CollectionMember = CollectionMember$1; /** @internal */ type CollectionMembersPage = CollectionMembersPage$1; /** @internal */ type CollectionContainsResult = CollectionContainsResult$1; /** @internal */ type CollectionDiffResult = CollectionDiffResult$1; /** @internal */ /** @internal */ type CollectionStatsResult = CollectionStatsResult$1; /** @internal */ type ResolveWrefResult = ThingDetail; /** @internal */ type ThingGetManyResult = ThingGetManyResult$1; /** @internal */ type ThingHeadVersionsResult = ThingHeadVersionsResult$1; /** @internal */ type CountResult = { count: number; /** * The count stopped at the server's typed-WHERE window and there are more * matches than it reports — render it as `${count}+`, never as a total. * Absent or false means the count is exact. */ hasMore?: boolean; /** Completed incremental scan checkpoint; omitted from ordinary counts. */ repoSeq?: number; }; /** @internal */ type AboutOptions = { shape?: string; match?: string; includeRetracted?: boolean; depth?: number; resolveCollections?: boolean; role?: 'from' | 'to' | 'ends'; limit?: number; cursor?: string; where?: WherePredicate[]; }; /** * Filter options for `client.thing.query`. * * All fields are optional and combine as AND filters; unspecified fields do * not constrain the result set. See [Read Semantics](/sdk/read-semantics/) * for glob `match` behavior, retraction visibility, and pagination rules. * * @see https://docs.warmhub.ai/sdk/read-semantics/ */ type WherePredicateBase = { /** Dotted field path (e.g. `"state"`, `"address.county"`). */ fieldPath: string; }; /** * Routeable scalar RHS for typed field-value predicates. Mirrors * `wherePredicateSchema` in @warmhub/backend — keep in sync. Numeric-looking * strings (`"42"`) and strict-ISO date strings stay as strings; the * field-values router classifies them. */ type WhereScalarRhs = string | number | boolean; /** * A typed field-value WHERE predicate for `thing.query`, `thing.head`, and `thing.count`. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/wherepredicate/ */ type WherePredicate = (WherePredicateBase & { /** Comparison operator. */ op: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'prefix'; /** Scalar value for the predicate (string, number, or boolean). */ rhs: WhereScalarRhs; }) | (WherePredicateBase & { /** Set-membership operator. */ op: 'in'; /** Non-empty array of scalar values (string, number, or boolean). */ rhs: WhereScalarRhs[]; }) | (WherePredicateBase & { /** Field existence operator. */ op: 'exists'; /** Omit for `exists`. */ rhs?: never; }); /** * Filters accepted by `client.thing.query` and related list operations. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/filteroptions/ */ type FilterOptions = { /** Filter to records of this shape name (for example `Player`). */ shape?: string; /** Filter to records that directly declare this Shape. */ declaredShape?: string; /** Include the full certified Shape closure on each returned item. */ includeValidatedShapes?: boolean; /** * Filter to records of this kind: `shape`, `thing`, `assertion`, or * `collection`. The requested kind controls membership: `thing` includes * ordinary things and collections. Each result's `kind` describes that * record: a collection is returned as `collection`. */ kind?: CommitOperationKind; /** Filter assertions whose `about` target wref matches the supplied value. */ about?: string; /** * Filter to active assertions whose current version affirms exactly this * pinned target version (`Shape/name@vN`). Pinned-only. Works with `match` * globs, scoped tokens, `search`, and `count`: candidates come from the * search index, membership is decided in PostgreSQL before pagination. */ affirmedAbout?: string; /** Glob pattern matched against record names (for example `Player/*`). */ match?: string; /** Include retracted versions in the result set. */ includeRetracted?: boolean; /** Maximum records returned per page. */ limit?: number; /** Pagination cursor returned by the prior call. */ cursor?: string; /** Filter to records attributed to this installed component's `Org/Name` ref. */ componentRef?: string; /** Exclude records attributed to any component. */ excludeComponents?: boolean; /** Exclude internal infrastructure shapes from the result set. */ excludeInfraShapes?: boolean; /** Expand collection targets to their members in the result. */ resolveCollections?: boolean; /** Keep collection-resolved assertions where the target occupies this role. */ role?: 'from' | 'to' | 'ends'; /** * Field-value WHERE predicates (ANDed). Each predicate must target a pinned/ready * field for typed-index routing; unavailable or unindexable fields return a * machine-readable field-index error. * Up to 8 predicates per call. */ where?: WherePredicate[]; /** Strict lower repository sequence for an incremental scan; `-1` seeds a complete snapshot. */ sinceRepoSeq?: number; }; /** @internal */ type ThingQueryChangesOptions = Omit & { sinceRepoSeq: number; }; /** * Options for `client.thing.search`. Search does not support field-value * `where` predicates in v1; use `thing.query` for typed structured filtering. * * When `about` is set or `resolveCollections` is true, result pages may be * sparse — keep paginating until `nextCursor` is absent. * * @see https://docs.warmhub.ai/sdk/read-semantics/#search-modes */ type SearchOptions = Omit & { /** Restrict the search to assertions about this wref target. */ about?: string; /** Search mode: `text` (BM25), `vector` (semantic), or `hybrid` (combined). Defaults to `text`. */ mode?: 'text' | 'vector' | 'hybrid'; /** Opt into deterministic literal name matching before ranked search. Intended for UI list filtering; defaults to ranked search. */ nameMatch?: 'ranked' | 'deterministic'; /** Expand collection members in the result; pages may be sparse when set. */ resolveCollections?: boolean; /** Exclude internal infrastructure shapes from results. */ excludeInfraShapes?: boolean; }; /** * Options for `client.thing.count`. Same filter set as {@link FilterOptions}; * pagination fields (`limit`, `cursor`) are ignored. * @see https://docs.warmhub.ai/sdk-reference/type-aliases/countoptions/ */ type CountOptions = Omit; /** * Options for `client.thing.refs` — wref-field reverse and forward lookups. * * @see https://docs.warmhub.ai/sdk/read-semantics/#reference-queries */ type RefsOptions = { /** `inbound` finds records whose wref fields point at the target; `outbound` finds records the target points to. Defaults to `inbound`. */ direction?: 'inbound' | 'outbound'; /** Narrow an inbound search to a specific wref field path on the source shape. */ fieldPath?: string; /** * Keep only edges written under one binding mode: `identity` edges follow * the target Thing, `versioned` edges pin one version. Each returned item * also reports its own `binding`. */ binding?: 'identity' | 'versioned'; /** Maximum references returned per page. */ limit?: number; /** Pagination cursor returned by the prior call. */ cursor?: string; }; /** @internal */ type CollectionQuerySourceOptions = Pick; type CollectionMemberSourceOptions = { members: string[]; query?: CollectionQuerySourceOptions; sourceRepo?: never; } | { members?: never; query: CollectionQuerySourceOptions; sourceRepo: RepoLocator; } | { members?: string[]; query: CollectionQuerySourceOptions; sourceRepo?: never; }; /** @internal */ type CollectionCreateOptions = { /** Caller-owned UUID retained across ambiguous retries. */ eventRequestId: string; type: CollectionWriteType; name: string; from?: string; add?: string[]; remove?: string[]; replaceMembers?: string[]; skipExisting?: boolean; message?: string; committer?: string; } & CollectionMemberSourceOptions; /** @internal */ type CollectionMembersOptions = { version?: number; limit?: number; cursor?: string; /** * Which collection Shape to read this Thing under. Optional when it composes * exactly one; required when it composes several, because reading an * Arc+Bond composite as whichever came first would answer a different * question per call. */ shape?: string; }; /** @internal */ type CollectionContainsOptions = { version?: number; position?: number; /** * Which collection Shape to read this Thing under. Optional when it composes * exactly one; required when it composes several, because reading an * Arc+Bond composite as whichever came first would answer a different * question per call. */ shape?: string; }; /** @internal */ type CollectionDiffOptions = { leftVersion?: number; rightVersion?: number; mode?: 'auto' | 'membership' | 'ordered'; /** * Which collection Shape to read this Thing under. Optional when it composes * exactly one; required when it composes several, because reading an * Arc+Bond composite as whichever came first would answer a different * question per call. */ shape?: string; }; /** @internal */ type CollectionReviseOptions = { /** Caller-owned UUID retained across ambiguous retries. */ eventRequestId: string; add?: string[]; remove?: string[]; message?: string; committer?: string; } & CollectionMemberSourceOptions; /** @internal */ type CollectionStatsOptions = { version?: number; /** * Which collection Shape to read this Thing under. Optional when it composes * exactly one; required when it composes several, because reading an * Arc+Bond composite as whichever came first would answer a different * question per call. */ shape?: string; }; /** @internal */ type PingResult = { ok: boolean; error?: string; }; /** @internal */ type AccessTokenProvider = string | (() => string | undefined | Promise); /** @internal */ declare function resolveFunctionLogMode(mode?: FunctionLogMode): FunctionLogMode; /** * Structured backend error details surfaced on `data.warmhub.details`. Derived * from the generated wire type so it stays in lockstep with the backend's * `WarmHubError.details` union. Branch on `details.reason` to recover the * structured payload type-safely — e.g. read `currentVersion` after an * `expected_version_mismatch` to retry against HEAD (#3624), or `leaseExpiresAt` * after a `lease_held` to back off until the lease expires (#3625). * @see https://docs.warmhub.ai/sdk-reference/type-aliases/warmhuberrordetails/ */ type WarmHubErrorDetails = NonNullable; /** @internal */ declare function sanitizeErrorMessage(message: string): string; /** * Normalized error shape thrown by the WarmHub SDK. * * SDK helpers convert transport, tRPC, validation, and backend failures into * this class so callers can branch on stable `code` / `kind` values and read * optional response metadata such as `status`, `hint`, and `retryAfter`. * * See {@link ErrorKind} for the catalog of stable kinds with cause, * retryability, corrective action, and origin per kind, and * {@link isRetryable} for the canonical retry test. * * @example * ```ts * try { * await client.repo.get('acme', 'world') * } catch (err) { * if (isWarmHubError(err) && err.kind === 'NOT_FOUND') { * // handle missing repo * } else if (isRetryable(err)) { * // safe to retry (NETWORK, CANCELLED, BACKEND, RATE_LIMITED) * } else { * throw err * } * } * ``` * @see https://docs.warmhub.ai/sdk-reference/classes/warmhuberror/ */ declare class WarmHubError extends Error { /** * Stable SDK error code or pass-through backend domain code. Branch on this * (or the alias {@link kind}) to handle expected failure modes. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhuberror/#code */ readonly code: string; /** * HTTP status from the failing response when one was available. */ readonly status?: number; /** * Optional human-readable hint surfaced by the backend. */ readonly hint?: string; /** * Seconds the caller should wait before retrying. Present on `RATE_LIMITED` * responses and other backend signals that carry a Retry-After header. */ readonly retryAfter?: number; /** * Canonical domain error code from the response body. Set iff the backend wire * carried a structured `error.code` string. Use this when the question is * "did the backend specifically say this?". For best-effort labelling that * also covers SDK-local transport codes (`NETWORK`, `CANCELLED`, the * generic `BACKEND` fallback), branch on {@link code} or {@link kind}. */ readonly errorCode?: string; /** * @deprecated Use {@link errorCode}. Retained during the GH-3533 migration * window for callers that already branch on the old field. */ readonly backendCode?: string; /** * Structured backend error details, when the response carried them. Branch on * `details.reason`: an `expected_version_mismatch` carries * `expectedVersion`/`currentVersion` so an optimistic-concurrency caller can * re-read HEAD and retry (#3624); a `lease_held` carries `leaseExpiresAt` so a * caller can back off until the lease expires (#3625). Present only when the * backend wire carried `data.warmhub.details`. See {@link WarmHubErrorDetails}. */ readonly details?: WarmHubErrorDetails; /** * Present (`true`) when this error came from the response-decoration * label lookup rather than the read itself — the read may have succeeded. * Set by the decoration link (see * {@link WarmHubClientOptions.decorateResponses}); surfaces use it to * suggest retrying without decoration. `declare`: assigned by the link, * never by this constructor. */ readonly decorationFailure?: true; constructor(code: string, message: string, status?: number, hint?: string, retryAfter?: number, errorCode?: string, details?: WarmHubErrorDetails); get kind(): ErrorKind; } /** * Normalize an unknown thrown value into `WarmHubError`. * @see https://docs.warmhub.ai/sdk-reference/functions/towarmhuberror/ */ declare function toWarmHubError(error: unknown): WarmHubError; /** * Return whether a thrown value is already a `WarmHubError`. * @see https://docs.warmhub.ai/sdk-reference/functions/iswarmhuberror/ */ declare function isWarmHubError(error: unknown): error is WarmHubError; /** * Return whether an error kind is generally safe to retry. * * Returns `true` for these {@link ErrorKind} values: * * - `NETWORK` — transport-level failure during a request (DNS, refused, * timeout, mid-flight fetch error). Safe to retry GETs and other read * surfaces; for side-effectful POSTs the request may already have landed * on the server, so retry only when the surface is idempotent or use an * idempotency key / state reconciliation before replaying. * - `CANCELLED` — the caller aborted; retry only if the caller still wants * the result. * - `BACKEND` — generic server-side failure with no specific domain code; * retry with backoff and surface the message if it persists. * - `RATE_LIMITED` — caller exceeded the budget; retry after the * {@link WarmHubError.retryAfter} interval. * * All other kinds — including backend pass-through domain codes such as * `SHAPE_MISMATCH` or `WREF_UNRESOLVABLE` — return `false`. This is a * conservative default: for most pass-through codes the caller must fix the * input or escalate, but the backend reuses some codes for transient * conditions (notably `INTERNAL_ERROR` from the webhook-validation path, * whose `message` literally says `please retry`). See the pass-through * paragraph on {@link ErrorKind} — read `WarmHubError.message` before * giving up on a `false` return from this helper. * @see https://docs.warmhub.ai/sdk-reference/functions/isretryable/ */ declare function isRetryable(error: unknown): boolean; /** * True if `error` is a connection-level fetch failure — raised before the * server produced a response. Detects both `TypeError('fetch failed')` (Node * undici, browsers) and Bun's native `Error` with a `code` like * `ConnectionRefused` / `ECONNREFUSED`. * @see https://docs.warmhub.ai/sdk-reference/functions/isconnectionerror/ */ declare function isConnectionError(error: unknown): boolean; /** * Canonical user-facing message for a connection-level failure. Embeds the * target URL so the user can see which endpoint was unreachable. * @see https://docs.warmhub.ai/sdk-reference/functions/connectionerrormessage/ */ declare function connectionErrorMessage(url: string): string; /** * Returns true when `version` is strictly older than `minimum`. This is the * parse boundary for the read-side compatibility hint: both arguments arrive * as unproved strings, and a string that is not SemVer returns false rather * than failing the read. Write admission parses both values separately and * fails closed. * * @internal */ declare function sdkVersionIsBelowMinimum(version: string, minimum: string): boolean; /** * Primary TypeScript client for the WarmHub API. * * The client groups API calls by domain (`repo`, `thing`, `shape`, `commit`, * `subscription`, and related surfaces), applies configured authentication to * every request, and normalizes most transport and backend failures through * `WarmHubError`. Streamed commit writes may instead throw * `PartialStreamSubmissionError` when an append outcome is ambiguous. * * @see https://docs.warmhub.ai/sdk/client/ */ /** * Input for {@link WarmHubClient.access.resolve} — repos by names or durable id; * orgs by name. * @internal */ type AccessResolveInput = AccessResolveInput$1; /** * Batch effective-access result; correlate by the echoed repo/org target. * @internal */ type AccessResolveResult = AccessResolveResult$1; /** * Effective repo access for the caller (one entry of {@link AccessResolveResult}). * @internal */ type RepoAccessResult = AccessResolveResult$1['repos'][number]; /** * Effective org-level access for the caller (one entry of {@link AccessResolveResult}). * @internal */ type OrgAccessResult = AccessResolveResult$1['orgs'][number]; /** * HTTP client for WarmHub repository, organization, and component APIs. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/ */ declare class WarmHubClient { /** * The resolved API base URL the client issues requests against. Defaults to * {@link DEFAULT_API_URL} when no `apiUrl` is passed to the constructor. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#apiurl */ readonly apiUrl: string; private readonly fetchImpl; private readonly accessToken; /** Resolved `X-WarmHub-Client` identity; defaults to this SDK's name/version. */ private readonly clientIdentity; /** Normalized `clientFlags` option; stamped on every request. */ private readonly clientFlags; /** Whether query responses carry the decoration sidecar. */ private readonly decorateResponses; protected readonly functionLogMode: FunctionLogMode; protected readonly getToken?: () => Promise; private readonly trpc; private compatibilityCheck?; private overrideNoticePrinted; /** * Repository export v3 streaming, exposed as `repo.export`. The transport * closures are lazy, so this initializer runs before `apiUrl` is assigned * without reading it. */ private readonly repositoryExport; private noteCompatibilityOverride; private assertWriteCompatible; private createCompatibilityLink; /** * Authentication helpers for browser sign-in flows, session checks, and token diagnostics. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#auth */ readonly auth: { /** * Return the configured browser authentication client ID. * * Use this in browser sign-in flows that need to initialize the configured auth provider before redirecting or opening a login UI. */ getClientId: () => Promise; /** * Sync the authenticated identity with WarmHub. * * Call after a browser or server session is established so WarmHub can provision or refresh the corresponding user and personal organization records. */ sync: () => Promise; /** * Return the current authenticated WarmHub user. * * Throws when the request is unauthenticated or the token cannot be resolved. */ currentUser: () => Promise; /** * Return authentication status, identity details, and token scope diagnostics for the current request. */ whoami: () => Promise; }; /** * Homepage surfaces. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#homepage */ readonly homepage: { /** * Return manually curated featured homepage lists. */ featuredLists: () => Promise; }; /** * Effective-access resolution for UI gating and service-side authorization. * First-party surface (web UI + whedge edge); the underlying `access.resolve` * procedure is `@internal`. * @internal */ readonly access: { /** * Resolve the caller's effective access for a batch of repos and/or orgs * (repos by names or durable id; orgs by name). Returns the coarse scope SET * per target so one call answers any permission via `scopes.includes(...)` — e.g. * `scopes.includes('repo:configure')`. Non-throwing: `visible: false` means * not-found/not-visible; `scopes: []` means authenticated-but-no-access. * Correlate results by the echoed target, not by position. */ resolve: (input: AccessResolveInput) => Promise; }; /** * Connectivity and compatibility helpers for checking the configured WarmHub backend. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#diagnostics */ readonly diagnostics: { /** * Perform a health-check request against the configured backend URL. * * This uses the HTTP health endpoint rather than tRPC, so it is useful for distinguishing connection failures from procedure-level errors. */ ping: () => Promise; /** * Return backend API version, per-client floors, write-contract version, and feature flags. */ capabilities: () => Promise; /** * Verify this client family/version and the backend can safely write, * throwing an actionable `WarmHubError` when either side is incompatible. * * Call this once at startup (e.g. immediately after constructing the * client) to fail fast on either direction of version skew. Mutations call * the same cached check automatically before dispatch. * The result is cached on the client instance — repeated calls reuse * the first network round-trip and re-throw the same error if too old. * * @see https://github.com/warmhub/warmhub-app/issues/3081 */ assertCompatible: () => Promise; }; /** * Installed component inspection for packages that add shapes, subscriptions, credentials, and seed data to a repository. * * The top-level methods cover per-repo installation queries, bundled system installs, and the registry-backed install pipeline used by `wh component install `. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#component */ readonly component: { /** * List components installed in a repository. * * Pass pagination options when a repository may have many installed components. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ list: (orgName: string, repoName: string, opts?: ComponentListOptions) => Promise; /** * Iterate installed components. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ listIter: (orgName: string, repoName: string, opts?: ComponentListOptions) => AsyncIterableIterator; /** * Materialize installed components. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ listAll: (orgName: string, repoName: string, opts?: ComponentListOptions & { max?: number; }) => Promise; /** * Search registered components visible to the caller across all orgs * (GH-4383): public components plus private components the caller can * read. Distinct from listing components installed in a repo * (`component.list`). * * Cursor contract: cursors resume the same query and result scope; on * `VALIDATION_ERROR` / `Invalid cursor`, restart the query without `cursor`. */ search: (query: string, opts?: GlobalSearchOptions) => Promise; /** * Iterate global component search hits. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ searchIter: (query: string, opts?: GlobalSearchOptions) => AsyncIterableIterator; /** * Materialize global component search hits. Cursors resume the same query * and result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the * query without `cursor`. */ searchAll: (query: string, opts?: GlobalSearchOptions & { max?: number; }) => Promise; /** * Fetch one installed component by its `Org/Name` ref. */ get: (orgName: string, repoName: string, componentRef: string) => Promise; /** * Install lifecycle timeline from the durable install-events log (GH-4690). * Omit `componentRef` for the repo-wide activity feed; pass `Org/Name` for a * single component's history. */ history: (orgName: string, repoName: string, opts?: ComponentHistoryOptions) => Promise; /** * Install a registered component into a repository (GH-4610). * * Backend-driven: the server resolves the registration and its latest * published manifest, reconciles the shapes/subscriptions/credentials/seeds * into the target repo, and runs the component's optional setup callback — * the same pipeline `wh component install ` drives. `orgName` / * `repoName` identify the INSTALL repo; `componentRef` is the * `/` of the component to install. Requires `things:write` on the * install repo; private registrations require owner-org membership. * * Reinstall is idempotent: the install identity (`installId`) is reused so * runtime tokens keyed on it survive teardown/reinstall. * * `options.submissionId` groups deterministic receipts for the repository * mutation phases only. Credential/subscription reconciliation and setup * callbacks retain their existing lifecycle semantics. */ install: (orgName: string, repoName: string, componentRef: string, options: ComponentInstallOptions) => Promise; /** * Uninstall a registered component from a repository (GH-4677). * * Backend-driven terminal teardown — the sibling of {@link install}: the * server pauses the install's subscriptions per the manifest teardown * policy, revokes its tokens in place, dispatches the component's optional * uninstall callback, and marks the repo-local `ComponentInstall` record * `uninstalled`. The same pipeline `wh component teardown ` drives. * `orgName` / `repoName` identify the INSTALL repo; `componentRef` is the * `/` of the component. Requires `things:write` on the install * repo; private registrations require owner-org membership. * * Non-destructive: manifest shapes and seeded data are left intact (only * repo deletion removes those) and reinstall revives the install. * `options.submissionId` groups deterministic receipts for repository * mutation phases; it does not make callbacks or token lifecycle work one * atomic submission. */ uninstall: (orgName: string, repoName: string, componentRef: string, options: ComponentUninstallOptions) => Promise; /** * Registered-component identity and install-pipeline operations. * * This sub-surface drives the backend-mediated install flow that powers `wh component install `. It manages registered component identities (`register`, `unregister`, `list`, `view`, `update`) and the install pipeline (`resolve` returns the latest published manifest plus an install id, `setupCall` dispatches the optional setup callback). Use these when building a custom installer; most callers should run the CLI instead. */ registry: { register: (orgName: string, componentName: string, input: ComponentRegistryRegisterInput) => Promise; unregister: (orgName: string, componentName: string) => Promise<{ unregistered: true; }>; list: (orgName: string) => Promise; view: (orgName: string, componentName: string) => Promise; update: (orgName: string, componentName: string, input: ComponentRegistryMutationInput) => Promise; resolve: (orgName: string, componentName: string, installRepo: string) => Promise; setupCall: (orgName: string, componentName: string, input: ComponentRegistrySetupCallInput) => Promise; }; /** * Operator-invoked CLI methods (GH-3193). * * `cli.call(orgName, componentName, method, { installRepo, args })` * dispatches a component-declared method via the backend. The backend * loads the install's manifest snapshot, verifies the method exists, * authorizes the operator, signs the request with the install-repo * credential set (HMAC over `${timestamp}.${body}` by default), and * proxies the component service's JSON response back as the envelope's * `body`. * * WarmHub-level failures (component not installed, method not in snapshot, * `ComponentConfig.cliBaseUrl` missing, credentials missing, operator * lacks `requiresPermission`) come back as a thrown `WarmHubError`. * Upstream non-2xx responses do **not** throw — they arrive inside the * envelope as `{ ok: false, status, body }` so the CLI can pretty-print * the component's own error payload. */ cli: { call: (orgName: string, componentName: string, method: string, input: ComponentRegistryCliCallInput) => Promise; }; }; /** * High-level write surface for submitting WarmHub operations through the commit pipeline. * * @see https://docs.warmhub.ai/sdk/write-methods/ */ readonly commit: { /** * Evaluate operations with the real server commit evaluator without * persisting repository state or consuming a write receipt. * * The complete operation list is normalized and sent in one bounded, * unbatched request. Semantic verdicts come only from the server. */ validate: (orgName: string, repoName: string, operations: Operation[], opts?: CommitValidateOptions) => Promise; /** * Submit one or more operations through WarmHub's commit pipeline. * * This is the primary write path for SDK callers. It streams operations to the backend, preserves server-side per-operation results, supports chunking for large submissions, and can attribute writes to a committer wref or installed component. * * Transport-ambiguous failures retry with the identical submission ID and * chunk ordinal. If ambiguity remains, `PartialStreamSubmissionError` * carries the pending `eventRequestId` and every earlier exact receipt. * * Writing to an archived organization or repository fails with an `ARCHIVED` error before any operations are applied. * * @param message Optional commit message stored with the submitted operations. * @param operations Add, revise, or retract operations to submit in order. * @param opts.committer Optional untyped wref identifying the actor on whose behalf the write is made. It may target an existing shape (`"Agent"`) or shaped thing (`"Agent/bot-1"`), locally or canonically (`"wh:other-org/other-repo/Agent"` or `"wh:other-org/other-repo/Agent/bot-1"`). A one-segment value is a shape wref, not a free-form label, and succeeds only when that shape exists. Exact operation-event receipts do not echo this input; version reads expose the resolved target as `committerWref`. * @param opts.componentRef Attribute writes to an installed component, identified by its `Org/Name` ref, when the caller is allowed to claim it. * @param opts.chunkSize Maximum operations per stream append. Values are clamped by the SDK. * @param opts.skipExisting Return `noop` for add operations whose target already exists. * @param opts.streamId Caller-managed stream identity for observability and diagnostic correlation. * @param opts.submissionId Caller-selected UUID correlating all chunks. * When omitted, the SDK mints one before the first network request. * @param opts.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry. */ apply: (orgName: string, repoName: string, message: string | undefined, operations: OperationSource, opts?: { committer?: string; componentRef?: string; chunkSize?: number; skipExisting?: boolean; streamId?: string; submissionId?: string; returnRepoSeq?: boolean; retry?: RetryPolicyOptions | false; }) => Promise; /** * Submit operations over one full-duplex NDJSON request and consume result * rows as groups commit. * * The returned handle is synchronous and lazy. Its retry identity is * available immediately; authentication, source acquisition, and request * dispatch begin only with the first `next()`. */ applyStreaming: (orgName: string, repoName: string, message: string | undefined, operations: OperationSource, opts: StreamingSubmissionOptions) => StreamingSubmissionHandle; /** Recover one immutable write receipt after an ambiguous response. */ getReceipt: (orgName: string, repoName: string, eventRequestId: string) => Promise; }; /** * Organization management surface for namespaces, membership, roles, and scoped member permissions. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#org */ readonly org: { /** * Get an organization by name. */ get: (orgName: string) => Promise; /** * Return the caller's role in an organization, or `null` when the caller is not a member. * * Useful for UI gating before showing organization-level controls. */ getCallerRole: (orgName: string) => Promise; /** * List organizations visible to the caller. * * Archived organizations are hidden unless `includeArchived` is set. */ list: (opts?: OrgListOptions) => Promise>; /** * Create a new organization. * * The description is trimmed and empty strings are ignored. Organization names must avoid reserved public slugs such as `docs`, `api`, `login`, and `warmhub`. * * @param displayName Optional display label. Defaults to the organization name when omitted. */ create: (name: string, displayName?: string, description?: string) => Promise; /** * Set or clear an organization description. * * Descriptions are trimmed; empty strings clear the stored value. */ setDescription: (orgName: string, description?: string) => Promise; /** * Update an organization's display name. * * Display names are trimmed; empty or whitespace-only values are rejected. */ setDisplayName: (orgName: string, displayName: string) => Promise; /** * Rename an organization in place. * * The new slug must satisfy the same naming and reserved-name rules as organization creation. */ rename: (orgName: string, newName: string) => Promise; /** * Atomic combined update of an organization's display name and/or slug. * * Both writes run in a single backend transaction so a slug conflict cannot leave a partial display-name change behind. Pass at least one of `displayName` or `newName`. */ update: (input: { orgName: string; displayName?: string; newName?: string; }) => Promise; /** * Add a member to an organization or create a pending invite. * * The role defaults to `editor`. If the email address does not belong to an existing WarmHub user, WarmHub creates a pending invite and attempts to send the invite email asynchronously. Only owners can assign the `owner` role. * * @param role Organization role to assign. Defaults to `editor`. */ addMember: (orgName: string, email: string, role?: "owner" | "admin" | "editor" | "viewer") => Promise; /** * Remove an active member or revoke a pending invite by email address. */ removeMember: (orgName: string, email: string) => Promise; /** * Leave an organization the caller is a member of (self-service). * * Session-only: requires an interactive user session, so personal access * tokens are rejected. You cannot leave your personal organization, and an * owner can only leave when the organization retains another active owner. */ leave: (orgName: string) => Promise; /** * Change a member's organization role. * * Only owners can promote another member to owner or demote an existing owner. WarmHub rejects attempts to remove the final owner. */ changeMemberRole: (orgName: string, email: string, role: "owner" | "admin" | "editor" | "viewer") => Promise; /** * Replace a member's scoped permission entries. * * Each entry targets either the organization (`acme`) or one repository (`acme/world`) and carries the full desired permission set for that resource. Matching entries replace the role-derived permission set for that resource; include every permission the member should retain. * * Member scope entries share the same wire shape as personal access token scopes, but `allowedMatches` is enforced for PATs only. Member scopes cannot restrict access by thing-name glob. * * @param scopes Scoped permission entries with `resource` and `permissions` fields. */ setMemberScopes: (orgName: string, email: string, scopes: WireScopeEntry[]) => Promise; /** * Remove all scoped permission entries from a member. * * After clearing, the member's effective access comes from their organization role only. */ clearMemberScopes: (orgName: string, email: string) => Promise; /** * List organization members and pending invites. * * The response includes the caller's current organization role so frontend settings pages can gate owner/admin-only controls without making a second request. * * @param opts.pending When `true`, return only pending invites. */ listMembers: (orgName: string, opts?: OrgListMembersOptions) => Promise; /** * Archive an organization, blocking new repositories and membership changes. */ archive: (orgName: string) => Promise; /** * Unarchive an organization. */ unarchive: (orgName: string) => Promise; }; /** * Repository management surface for lifecycle operations, metadata, statistics, and content documents. * * @see https://docs.warmhub.ai/sdk/repo-stats/ */ readonly repo: { /** * Repository checkpoint status and artifact-access operations. * * Reads require unrestricted `repo:read` plus `repo:checkpoint-read`. * Checkpoint generation retired with export v3; use `repo.export` to * produce a fresh snapshot. * * `getAccess` returns a signed artifact descriptor only. It does not fetch * the signed URL or attach the WarmHub bearer token to that URL. */ checkpoint: { status: (orgName: string, repoName: string, selector: { checkpointId: string; repoSeq?: never; } | { repoSeq: number; checkpointId?: never; }) => Promise; latest: (orgName: string, repoName: string) => Promise<(RepositoryCheckpointStatus & { state: "complete"; }) | null>; getAccess: (orgName: string, repoName: string, input: { checkpoint: "latest" | ({ checkpointId: string; repoSeq?: never; } | { repoSeq: number; checkpointId?: never; }); artifact: "archive" | "manifest" | { chunkPath: string; }; }) => Promise; }; /** * Stream a verified repository export (wire format v3). * * Yields rows only after the header matches the repository and mode asked * for, each line decodes canonically, and — at the end — the trailer's * record count and content digest match what was actually read. A stream * that breaks resumes by passing the same `session` back in. */ export: (orgName: string, repoName: string, options?: RepositoryExportOptions) => AsyncGenerator; /** * Ask the server to prepare an export and return the token that redeems it, * without waiting for the fold or reading a byte. * * The fold runs off the request path, so a large export can be started by * one process and downloaded later — or elsewhere — by passing the returned * token to `export`. The token is redeemable only at this repository's URL, * by a principal who holds checkpoint read there. */ exportPrepare: (orgName: string, repoName: string, options?: RepositoryExportPrepareOptions) => Promise; /** * Get a repository by organization and repository name. */ get: (orgName: string, repoName: string) => Promise; /** * Return authoritative active-item totals for a single repository. * * The returned `total` is the sum of active shapes, things, and assertions. Use this when billing, quota checks, health reports, or per-shape breakdowns need single-repo stats. * * The per-shape breakdown counts active things and assertions by shape. */ getStats: (orgName: string, repoName: string) => Promise; /** * Return active-item totals for up to 100 repositories in one request. * * Use this instead of issuing one `getStats` request per repository when building organization dashboards. Batch entries include the exact `total` for visible repositories; call `getStats` for an individual repository when you need the per-shape map. */ getStatsBatch: (orgName: string, repoNames: string[]) => Promise; /** * Return configuration-surface counts for a repository. * * Currently this reports the number of subscriptions attached to the repository, which is useful before delete or visibility-change flows. */ getConfigureStats: (orgName: string, repoName: string) => Promise; /** * Return per-shape thing and assertion counts for a repository. * * The server computes the totals directly, so callers do not need to page through repository contents to build shape summary UI. */ getShapeInstanceCounts: (orgName: string, repoName: string) => Promise; /** * List repositories in an organization. * * Archived repositories are hidden by default. Search and sort options are applied before pagination. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ list: (orgName: string, opts?: RepoListOptions) => Promise; /** * Iterate organization repositories. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ listIter: (orgName: string, opts?: RepoListOptions) => AsyncIterableIterator; /** * Materialize organization repositories. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ listAll: (orgName: string, opts?: RepoListOptions & { max?: number; }) => Promise; /** * Search repos visible to the caller across all orgs (GH-4383): public * repos plus private repos the caller can read. BM25 over * name/description/shape vocabulary/README. * * Cursor contract: cursors resume the same query and result scope; on * `VALIDATION_ERROR` / `Invalid cursor`, restart the query without `cursor`. */ search: (query: string, opts?: GlobalSearchOptions) => Promise; /** * Iterate global repository search hits. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ searchIter: (query: string, opts?: GlobalSearchOptions) => AsyncIterableIterator; /** * Materialize global repository search hits. Cursors resume the same query * and result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the * query without `cursor`. */ searchAll: (query: string, opts?: GlobalSearchOptions & { max?: number; }) => Promise; /** * Create a repository inside an organization. * * Repositories are private by default. Descriptions are trimmed and capped by the backend. * * @param visibility `public` or `private`; defaults to `private`. */ create: (orgName: string, repoName: string, description?: string, visibility?: RepoVisibility, displayName?: string) => Promise; /** * Set or clear a repository description. * * Descriptions are trimmed; empty strings clear the stored value. */ setDescription: (orgName: string, repoName: string, description?: string) => Promise; /** * Set a repository display name. * * `displayName` is required and non-empty (trimmed); slug fallback is a * creation-time behavior only and there is no clear-to-slug flow. */ setDisplayName: (orgName: string, repoName: string, displayName: string) => Promise; /** * Set a repository's visibility to `public` or `private`. */ setVisibility: (orgName: string, repoName: string, visibility: RepoVisibility) => Promise; /** * Rename a repository within its organization. * * The new name must be unused in the organization and follow the same path-segment rules as repository creation. */ rename: (orgName: string, repoName: string, newName: string) => Promise; /** * Atomic combined update of a repository's display name and/or slug. * * Both writes run in a single backend transaction so a slug conflict cannot leave a partial display-name change behind. Pass at least one of `displayName` or `newName`. `displayName` is rejected when empty — slug fallback is a creation-time behavior only. */ update: (input: { orgName: string; repoName: string; displayName?: string; newName?: string; }) => Promise; /** * Archive a repository, blocking new writes. */ archive: (orgName: string, repoName: string) => Promise; /** * Unarchive a repository. */ unarchive: (orgName: string, repoName: string) => Promise; /** * Soft-delete a repository. * * The repository is hidden immediately and scheduled for permanent purge after a 30-day grace window. WarmHub blocks deletion when another repository still has inbound cross-repo references, active subscriptions, or active credential grants that depend on the repository. */ delete: (orgName: string, repoName: string) => Promise<{ graceExpiresAt: Date; }>; /** * List repositories with dashboard-oriented per-repository metadata. * * Each item includes exact active counts, an activity-oriented `lastWriteAt`, and a `hasErrors` flag for terminal action failures. * * Search and sort are applied before pagination, so cursors remain stable across the filtered and ordered list. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ listPage: (orgName: string, opts?: RepoListPageOptions) => Promise; /** * Iterate repository rows with stats. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ listPageIter: (orgName: string, opts?: RepoListPageOptions) => AsyncIterableIterator; /** * Materialize repository rows with stats. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ listPageAll: (orgName: string, opts?: RepoListPageOptions & { max?: number; }) => Promise; /** * List the caller's repositories across every org they belong to, ordered * for recency by default (most recently written first), capped at `limit`. * * Unlike `listPage`, this is user-level and resolves the caller's orgs * server-side, so you don't fan out one request per org to build an * account-wide view. Membership is the access filter and per-token * `allowedMatches` narrowing is not applied, so this requires an * interactive session — PAT and component-token callers are rejected. Use * the org-scoped `listPage` from token-authenticated contexts. */ listForCaller: (opts?: RepoListForCallerOptions) => Promise; /** * Browse the public "Explore" directory: every `visibility='public'` live * repository across all orgs, with search, org/activity/subscription/thing * filters, and sort. No auth required — anonymous callers see the same * public-only listing. * * Two mutually-exclusive modes. Browse mode paginates a filtered, sorted * listing (`search`/`org`/`activity`/`hasSubscriptions`/`minThings`/`sort`/ * `limit`/`cursor`). Slugs mode is an exact-match batch lookup: pass up to * 12 `org/repo` slugs to resolve just those live public repos in input * order, ignoring every browse field. Combining `slugs` with any browse/ * search/sort/filter field is a hard input error, not a silently-filtered * list. * * `total` and `orgs` (the org-filter facet) are returned on the first page * only — i.e. when `cursor` is absent. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ explore: (opts?: RepoExploreOptions) => Promise; /** * Iterate public Explore browse results. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. Exact `slugs` lookup is not pageable. */ exploreIter: (opts?: RepoExploreBrowseOptions) => AsyncIterableIterator; /** * Materialize public Explore browse results. Cursors resume the same query * and result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the * query without `cursor`. Exact `slugs` lookup is not pageable. `max` * remains optional as part of the uniform `*All` contract; callers should * provide a finite cap for this offset-paginated endpoint. */ exploreAll: (opts?: RepoExploreBrowseOptions & { max?: number; }) => Promise; /** * Fetch a repository's `Content/Readme` markdown record. * * Returns a synthesized empty stub when no README content has been committed yet. */ getReadme: (orgName: string, repoName: string) => Promise; /** * Fetch a repository's `Content/Agents` markdown record. * * Returns a synthesized empty stub when no AGENTS.md content has been committed yet. */ getAgents: (orgName: string, repoName: string) => Promise; /** * Fetch the repository's normalized license declaration. * * Returns `null` when no valid active declaration is visible to the caller. */ getLicense: (orgName: string, repoName: string) => Promise; /** * Return the repository's aggregate describe model. * * Requires repository read access. Subscription metadata and configuration * stats are omitted unless the caller has effective `repo:configure` access. * Set `includeHead: false` to skip sampling records; `head.items` is then empty. */ describe: (orgName: string, repoName: string, options?: { includeHead?: boolean; }) => Promise; /** * Commit a new `Content/Readme` value. * * The backend adds or revises the content record through the normal commit * pipeline. Create `opts.eventRequestId` before submission and reuse it to * look up or retry an ambiguous outcome. */ setReadme: (orgName: string, repoName: string, content: string, opts: { eventRequestId: string; }) => Promise; /** * Commit a new `Content/Agents` value through the normal commit pipeline. * The caller owns `opts.eventRequestId` across ambiguous retries. */ setAgents: (orgName: string, repoName: string, content: string, opts: { eventRequestId: string; }) => Promise; /** * Fetch the synthesized `Content/LlmsTxt` sitemap for a repository. * * The returned markdown follows the llms.txt convention. Authenticated callers also receive structured reference metadata partitioned by readable outbound and inbound references; cross-org references the caller cannot read are omitted. */ getLlmsTxt: (orgName: string, repoName: string) => Promise; /** Field-index diagnostics. */ index: { /** * Describe all indexed fields for a repo, grouped by state. * * Returns ready, building, failed, and other buckets (read-only diagnostics). * Use `wh repo describe --indexed-fields --repo `. */ describe: (orgName: string, repoName: string) => Promise; /** * Declare a field path for indexing. * * The path is resolved through `shape`'s effective contract, so a * composite may name a property one of its composed shapes owns. The * declaration is repository-wide: every shape carrying the path is * backfilled, not just the one named here. */ pin: (orgName: string, repoName: string, shape: string, fieldPath: string) => Promise; /** * Withdraw a field path's indexing declaration and evict its rows. * * Refuses while a stored View definition still references the path. */ unpin: (orgName: string, repoName: string, shape: string, fieldPath: string) => Promise; }; }; /** * Shape management surface for schema definitions that validate things and assertions. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#shape */ readonly shape: { /** * List shape definitions in a repository. * * Options can include retracted shapes, filter by component ownership, or hide component-owned shapes. */ list: (orgName: string, repoName: string, opts?: ShapeListOptions) => Promise; /** * Get one shape definition by name. * * Returns the full shape thing record, with `name`, * `kind: "shape"`, `active`, and a nested `version: { version, operation, * data, dataHash } | null`. Shape mutations return immutable operation-event * receipts, not this read projection. To read shape fields, call `get` and * read `result.version?.data`. * * @param opts.includeRetracted Include a retracted shape instead of treating it as missing. */ get: (orgName: string, repoName: string, shapeName: string, opts?: ShapeGetOptions) => Promise; /** * Create a shape definition. * * Shape data should describe the fields used to validate things and assertions with that shape. * * Returns the existing shape-change fields plus a nested immutable receipt. * Supply `opts.eventRequestId` when the caller needs stable receipt lookup * or safe retry after an ambiguous response; legacy callers may omit it. * * @param opts.eventRequestId Caller-owned UUID retained across ambiguous retries. * @param opts.description Optional human-readable shape description. */ create: (orgName: string, repoName: string, shapeName: string, fields: Record, opts: ShapeCreateOptions) => Promise; /** * Revise a shape definition, creating a new shape version. * * Returns the existing shape-change fields plus a nested immutable receipt. * A supplied `opts.eventRequestId` remains stable across ambiguous retries. * * @param opts.eventRequestId Caller-owned UUID retained across ambiguous retries. * @param opts.description Optional human-readable description for the revised shape. */ revise: (orgName: string, repoName: string, shapeName: string, newFields: Record, opts: ShapeReviseOptions) => Promise; /** * Retract a shape definition. * * Returns the existing removal fields plus a nested immutable receipt. * A supplied `opts.eventRequestId` remains stable across ambiguous retries. * * @param opts.eventRequestId Caller-owned UUID retained across ambiguous retries. */ remove: (orgName: string, repoName: string, shapeName: string, opts: ShapeRemoveOptions) => Promise; /** * Rename a shape within a repository. * * The rename is applied in place: the existing shape history is preserved * and no new version is created. Retain `opts.eventRequestId` for an exact * receipt replay after an ambiguous response. */ rename: (orgName: string, repoName: string, oldName: string, newName: string, opts: RenameOptions) => Promise; /** * Return add, revise, retract, and rename history for a shape. * * Use pagination options for long-lived shapes with many revisions. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ history: (orgName: string, repoName: string, name: string, opts?: ShapeHistoryOptions) => Promise; /** * Iterate shape versions. Cursors resume the same query and result scope; * on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ historyIter: (orgName: string, repoName: string, name: string, opts?: ShapeHistoryOptions) => AsyncIterableIterator; /** * Materialize shape versions. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ historyAll: (orgName: string, repoName: string, name: string, opts?: ShapeHistoryOptions & { max?: number; }) => Promise; }; /** * Webhook subscription management surface scoped to a repository. * * @see https://docs.warmhub.ai/sdk/component-identity/#subscriptions */ readonly subscription: { /** * Create a webhook subscription. * * Webhook subscriptions require a delivery URL. Commit subscriptions are * repo-scoped and require a shape/filter; repo and org metadata * subscriptions omit commit-only fields. Org-scoped events also omit * `repoName`. * * Delivery can use a fallback URL and allow trace reentry. Commit * subscriptions can additionally forward events from another repository. */ create: (input: SubscriptionCompatCreateInput) => Promise; /** * Get one subscription by name. * * Repo-scoped subscriptions are addressed by `(orgName, repoName, name)`; * org-scoped subscriptions omit `repoName` via the object * form: `get({ orgName, name })`. */ get: (...args: SubscriptionRefArgs) => Promise; /** * Reveal the raw webhook URL(s) for a subscription. * * Reads return only `webhookOrigin`/`fallbackWebhookOrigin` (scheme://host); * the raw URL path is a bearer secret. This break-glass call returns the * raw URL(s) and is audit-logged server-side. Requires `repo:configure`. * Because it returns the secret, a name-scoped principal (e.g. a component * setup token) may reveal only the subscriptions it is scoped to — a * stricter contract than the redacted `get`/`list`, which are unscoped. */ reveal: (...args: SubscriptionRefArgs) => Promise; /** * List subscriptions in a scope. * * Pass `(orgName, repoName)` to list a repository's subscriptions, or omit * `repoName` — `list(orgName)` or `list({ orgName })` — to list the * org-scoped subscriptions. */ list: (...args: SubscriptionListArgs) => Promise; /** * Update an existing webhook subscription. * * Use `null` for nullable fields such as fallback webhook URL when you need to clear an existing value. */ update: (input: SubscriptionCompatUpdateInput) => Promise; /** * Pause a subscription. * * Omit `repoName` (object form) to pause an org-scoped subscription. */ pause: (...args: SubscriptionRefArgs) => Promise<{ name: string; active: boolean; }>; /** * Resume a paused subscription. * * Omit `repoName` (object form) to resume an org-scoped subscription. */ resume: (...args: SubscriptionRefArgs) => Promise<{ name: string; active: boolean; }>; /** * Remove a subscription. * * Operation subscriptions are immediately retired: delivery stops, the * identity remains auditable, and the name stays reserved. Metadata * subscriptions are deleted. Omit `repoName` (object form) for * an org-scoped subscription. */ remove: (...args: SubscriptionRefArgs) => Promise<{ ok: true; }>; /** * Bind a credential set to a subscription for outbound webhook authentication. * * Omit `repoName` (object form) to bind an org-scoped subscription to one of * the org's org-scoped credential sets. */ bindCredentials: (...args: SubscriptionBindArgs) => Promise; /** * Remove the credential set currently bound to a subscription. * * Omit `repoName` (object form) for an org-scoped subscription. */ unbindCredentials: (...args: SubscriptionUnbindArgs) => Promise; }; /** * Low-level action lease, delivery, run, and notification primitives for subscription consumers. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#action */ readonly action: { /** * Acquire an exclusive processing lease for a subscription consumer. * * @param holderId Stable identifier for the process claiming the lease. * @param holderType Kind of consumer claiming the lease. */ acquireLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, holderType: "sdk" | "cli", opts?: { graceMs?: number; ttlMs?: number; }) => Promise; /** * Extend the TTL for an existing processing lease. */ heartbeatLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, ttlMs?: number) => Promise; /** * Release an existing processing lease. */ releaseLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string) => Promise; /** * Claim one action delivery for processing. */ claimDelivery: (orgName: string, repoName: string, target: ActionDeliveryTarget, holderId: string) => Promise; /** * Mark one claimed action delivery as complete. */ completeDelivery: (orgName: string, repoName: string, target: ActionDeliveryTarget, holderId: string) => Promise; /** * Query the live delivery feed for a subscription. * * Use this for polling or live-log views that need recent delivery status entries. * Matched operation bodies use the same reader-independent durable WREF * form as thing bodies. With `decorateResponses`, readable labels are * attached separately in the response's `decorations` sidecar. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ liveFeed: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => Promise; /** * Iterate delivery-feed entries. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ liveFeedIter: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => AsyncIterableIterator; /** * Materialize delivery-feed entries. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ liveFeedAll: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions & { max?: number; }) => Promise; /** * List subscription action runs as a `Page` (`items` + * optional `nextCursor`), newest-first, capped at 200 runs per page. * * `status` and `outcome` are mutually exclusive. * `since` and `cursor` are mutually exclusive; pass `cursor` alone on later * pages — the `since` window rides in the cursor. * Cursors are opaque, short-lived resume tokens for the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. * See docs/dev/warmhub-actions-api.md for the full contract. */ listRuns: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => Promise>; /** * Iterate action runs. Cursors resume the same query and result scope; on * `VALIDATION_ERROR` / `Invalid cursor`, restart the query without `cursor`. * `since` is sent only on the initial request. */ listRunsIter: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => AsyncIterableIterator; /** * Materialize action runs. Cursors resume the same query and result scope; * on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. `since` is sent only on the initial request. */ listRunsAll: (orgName: string, repoName: string, opts?: ActionListRunsOptions & { max?: number; }) => Promise; /** * Return the newest visible action run for each subscription in a repo. * * This grouped read is intended for subscription summaries that need * complete per-subscription recency without walking repo-wide history or * issuing one request per subscription. */ latestRuns: (orgName: string, repoName: string) => Promise; /** * Aggregate run counts (total + per-status) for a repo or one subscription. * * Computed server-side over an optional `since` window as a window * aggregate — it counts every run in the window, whereas `listRuns` returns * only a page sample of that pageable history. Use `runStats` for totals and * `listRuns` to walk the individual runs page by page. */ runStats: (orgName: string, repoName: string, opts?: ActionRunStatsOptions) => Promise; /** * List delivery attempts for one action run. */ getRunAttempts: (orgName: string, repoName: string, runId: string) => Promise; /** * List repo-scoped action notifications. * * Use `since` or `limit` to bound notification-center style reads. */ listNotifications: (orgName: string, repoName: string, opts?: ActionListNotificationsOptions) => Promise; }; readonly collection: { create: (orgName: string, repoName: string, opts: CollectionCreateOptions) => Promise; /** * Read one collection-membership page. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ members: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: CollectionMembersOptions) => Promise; /** * Iterate collection members. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ membersIter: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: CollectionMembersOptions) => AsyncIterableIterator; /** * Materialize collection members. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ membersAll: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: CollectionMembersOptions & { max?: number; }) => Promise; contains: (orgName: string | undefined, repoName: string | undefined, wref: string, members: string[], opts?: CollectionContainsOptions) => Promise; diff: (orgName: string | undefined, repoName: string | undefined, leftWref: string, rightWref: string, opts?: CollectionDiffOptions) => Promise; revise: (orgName: string, repoName: string, wref: string, opts: CollectionReviseOptions) => Promise; stats: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: CollectionStatsOptions) => Promise; }; /** * Execute stored View definitions against the repository's live read model. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#view */ readonly view: { /** * Evaluate one identity-scoped or pinned View definition and return one page. * * The `wref` is the sole definition selector. Cursors are short-lived resume * tokens for the same query and result scope. If the selected identity-scoped * View changes, the backend may reject a saved cursor with * `CURSOR_EPOCH_INVALID`; restart the query without `cursor`. */ evaluate: (orgName: string, repoName: string, wref: string, opts?: ViewEvaluateOptions) => Promise; /** * Iterate every live result from an identity-scoped or pinned View. * * The iterator preserves the caller's page size and optional resume cursor, * and rejects non-advancing or cyclic backend cursors. * * Cursors resume the same query and result scope. If the backend reports * `CURSOR_EPOCH_INVALID`, restart the query without `cursor`. */ evaluateIter: (orgName: string, repoName: string, wref: string, opts?: ViewEvaluateOptions) => AsyncIterableIterator; /** * Materialize every live result from an identity-scoped or pinned View. * * Use `max` to guard memory usage. The call throws `VALIDATION_ERROR` only * after more than `max` items have actually been observed. * * Cursors resume the same query and result scope. If the backend reports * `CURSOR_EPOCH_INVALID`, restart the query without `cursor`. */ evaluateAll: (orgName: string, repoName: string, wref: string, opts?: ViewEvaluateOptions & { max?: number; }) => Promise; }; /** * Create and administer immutable repository Grants. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#grant */ readonly grant: { create: (orgName: string, repoName: string, input: GrantCreateOptions) => Promise; get: (orgName: string, repoName: string, grantId: string) => Promise; list: (orgName: string, repoName: string, opts?: GrantListOptions) => Promise; revoke: (orgName: string, repoName: string, grantId: string, opts?: { reason?: string; }) => Promise; }; /** * Read surface for things, assertions, histories, references, search, and in-place thing renames. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#thing */ readonly thing: { /** * Return the current HEAD snapshot for repository contents. * * Filter by shape, kind, assertion target, or glob `match` pattern, and choose the data mode appropriate for the payload size. Component filters can narrow results to component-owned records or hide component infrastructure records. * * Tokenless reads of public repositories have stricter page-size and page-count limits than authenticated reads. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ head: (orgName: string, repoName: string, opts?: ThingHeadOptions) => Promise; /** * Iterate every current HEAD row matching the supplied filters. * * Prefer this over hand-written cursor loops when scanning all matching records. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ headIter: (orgName: string, repoName: string, opts?: Omit) => AsyncIterableIterator; /** * Materialize every current HEAD row matching the supplied filters. * * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` items have actually been observed across pages. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ headAll: (orgName: string, repoName: string, opts?: Omit & { max?: number; }) => Promise; /** * Materialize identity-owned changes after a repository sequence and return * the exact checkpoint reached by the completed scan. * * Key a local cache by `item.metadata.durableId`: an identity rename * carries its checkpoint wref, and a retraction carries `active: false`. * This helper forces retracted rows on and returns only after draining the * terminal page. It does not fan out changes caused by another identity * and therefore is not, by itself, a complete local-result-mirror protocol. */ headChanges: (orgName: string, repoName: string, opts: ThingHeadChangesOptions) => Promise; /** * Get one thing, assertion, shape, or collection by wref. * * @param version Optional exact version to pin when the wref is not already version-qualified. * @param opts.includeRetracted Include retracted records instead of treating them as missing. * @param opts.dataMode Defaults to `auto`; pass `full` to force full collection bodies. */ get: (orgName: string | undefined, repoName: string | undefined, wref: string, version?: number, opts?: ThingGetOptions) => Promise; /** * Acquire a short, bounded, exclusive lease on a thing AND read it in one * atomic round trip (#3625). * * Returns everything {@link WarmHub.thing.get} returns plus a `lease` * block; the holder echoes `lease.id` back as `leaseId` on the subsequent * `revise`/`retract` (auto-releasing the lease) or calls * {@link WarmHub.thing.releaseLease} to return it early. Requires * `things:write` — never anonymous. * * Fail-fast: if another holder already holds an active lease, throws a * `WarmHubError` with `kind === 'LEASE_UNAVAILABLE'` and * `error.details?.reason === 'lease_held'` (read `leaseExpiresAt` to back * off until expiry). `ttlMs` out of the backend's bounds (default 5s / * min 1s / max 30s) is rejected, never clamped. */ getWithLease: (orgName: string, repoName: string, wref: string, opts?: { ttlMs?: number; }) => Promise; /** * Release a lease early (#3625), closing the acquire↔release loop without * waiting out the TTL. * * Idempotent and owner-gated: releasing an absent, already-released, * expired, or non-matching lease is a benign no-op (no error). A * successful `revise`/`retract` carrying the `leaseId` already * auto-releases the lease, so this is only needed when the holder decides * not to mutate. Requires `things:write`. */ releaseLease: (orgName: string, repoName: string, wref: string, leaseId: string) => Promise; /** * Get one record and its embedded assertion, about, and wref graph. * * Depth and limit options bound traversal size. References the caller cannot read remain string wrefs in the returned graph. */ graph: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: ThingGraphOptions) => Promise; /** * Batch-fetch wrefs, auto-chunking above the backend's 500-wref transport cap. * * The result preserves duplicate requested wrefs and reports inaccessible or missing refs in `missing` rather than throwing per item. A top-level version pins every unqualified wref; per-wref version pins remain intact. * * @param version Optional exact version to apply to unqualified wrefs. * @param opts.includeRetracted Include retracted records in `items` instead of reporting them in `missing`. * @param opts.chunkSize Maximum wrefs per backend request. Defaults to 500 and is clamped to the backend cap. * @param opts.chunkConcurrency Maximum concurrent chunk requests. Defaults to 1 and is clamped to 8. */ getMany: (orgName: string | undefined, repoName: string | undefined, wrefs: string[], version?: number, opts?: { includeRetracted?: boolean; dataMode?: CollectionReadDataMode; chunkSize?: number; chunkConcurrency?: number; }) => Promise; /** * Batched lightweight per-thing change probe — returns * `{ wref, durableId, version, active, revisedOn }` per wref with NO * payload. Use it to check whether locally-cached copies are still fresh * without pulling `data`: a value is stale if `durableId` differs (the wref * now points to a different thing), `version`/`active` differ (the same * thing changed/was retracted), or the wref appears in `missing`. * * Auto-chunks above the backend's 500-wref transport cap; preserves * duplicate requested wrefs and reports inaccessible/unknown refs in * `missing` rather than throwing per item. * * @param opts.chunkSize Maximum wrefs per backend request. Defaults to 500 and is clamped to the backend cap. * @param opts.chunkConcurrency Maximum concurrent chunk requests. Defaults to 1 and is clamped to 8. */ headVersions: (orgName: string | undefined, repoName: string | undefined, wrefs: string[], opts?: { chunkSize?: number; chunkConcurrency?: number; }) => Promise; /** * Return version history and timeline metadata for repository records. * * Provide at least one selector: a concrete wref, a shape filter, or an assertion target. Shape- and target-filtered histories support pagination and optional collection resolution. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ history: (orgName: string | undefined, repoName: string | undefined, opts: ThingHistoryOptions) => Promise; /** * Iterate thing history versions. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ historyIter: (orgName: string | undefined, repoName: string | undefined, opts: ThingHistoryOptions) => AsyncIterableIterator; /** * Materialize thing history versions. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ historyAll: (orgName: string | undefined, repoName: string | undefined, opts: ThingHistoryOptions & { max?: number; }) => Promise; /** * Rename a thing within its shape namespace. * * The rename is applied in place: the thing's existing history is preserved * and no new version is created. Retain `opts.eventRequestId` for an exact * receipt replay after an ambiguous response. */ rename: (orgName: string, repoName: string, shapeName: string, oldName: string, newName: string, opts: RenameOptions) => Promise; /** * Resolve a wref to its current projected record. */ resolve: (orgName: string | undefined, repoName: string | undefined, wref: string) => Promise; /** * Return assertions about a shape, shaped thing, or collection target. * * Filter by assertion shape or glob `match` pattern, optionally resolve collection targets, and page through large assertion sets with `limit` and `cursor`. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. * * Returns `{ target?, assertions, nextCursor? }`. * The array is named `assertions`, **not** `items`. This breaks the repo-wide * `items` convention used by `HeadResult`, `FilterResult`, `SearchResult`, * `RefsResult`, and `LogResult`; destructure explicitly to avoid the trap: * * ```ts * const { target, assertions } = await client.thing.about(org, repo, "Location/cave"); * for (const a of assertions) console.log(a.wref); * ``` * * Any returned subjective-logic opinion tuple `(b, d, u, α)` is a binomial opinion — well-formed only when the underlying assertion expresses a binary proposition. See [Opinions as Separate Assertions](/data-modeling/patterns/#opinions-as-separate-assertions). */ about: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: AboutOptions) => Promise; /** * Iterate every assertion about a shape, shaped thing, or collection target. * * Prefer this over hand-written cursor loops when scanning all matching assertions. The iterator reads the `assertions` envelope field and advances the cursor automatically; pass `opts.cursor` to resume from a saved cursor and `limit` to control page size. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ aboutIter: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: AboutOptions) => AsyncIterableIterator; /** * Materialize every assertion about a shape, shaped thing, or collection target. * * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` assertions have actually been observed across pages. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ aboutAll: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: AboutOptions & { max?: number; }) => Promise; /** * Query repository records by shape, kind, assertion target, text filters, or glob `match` pattern. * * Use this for structured reads where the caller controls filters. For ranked text or vector search, use `thing.search`. For count-only reads, use `thing.count`. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ query: (orgName: string, repoName: string, opts?: FilterOptions) => Promise; /** * Iterate every repository record matching the supplied filters. * * Prefer this over hand-written cursor loops when scanning all matching records. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ queryIter: (orgName: string, repoName: string, opts?: Omit) => AsyncIterableIterator; /** * Materialize every repository record matching the supplied filters. * * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` items have actually been observed across pages. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ queryAll: (orgName: string, repoName: string, opts?: Omit & { max?: number; }) => Promise; /** * Materialize filtered identity-owned changes after a repository sequence * and return the exact checkpoint reached by the completed scan. * * Key a local cache by `item.metadata.durableId`: an identity rename * carries its checkpoint wref, and a retraction carries `active: false`. * This helper forces retracted rows on and returns only after draining the * terminal page. It does not fan out changes caused by another identity * and therefore is not, by itself, a complete local-result-mirror protocol. */ queryChanges: (orgName: string, repoName: string, opts: ThingQueryChangesOptions) => Promise; /** * Search repository records with text, vector, or hybrid mode. * * When searching with an assertion target or collection resolution, pages may be sparse; keep paginating until `nextCursor` is absent. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ search: (orgName: string, repoName: string, query: string, opts?: SearchOptions) => Promise; /** * Iterate ranked search hits. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ searchIter: (orgName: string, repoName: string, query: string, opts?: SearchOptions) => AsyncIterableIterator; /** * Materialize ranked search hits. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ searchAll: (orgName: string, repoName: string, query: string, opts?: SearchOptions & { max?: number; }) => Promise; /** * Count matching repository records without returning record data. */ count: (orgName: string, repoName: string, opts?: CountOptions) => Promise; /** * Query wref-typed field references for a record. * * Inbound mode finds records whose wref fields point at the supplied wref. Outbound mode finds records that the supplied record points to. Inbound queries can be narrowed to a field path. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ refs: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: RefsOptions) => Promise; /** * Iterate every wref-typed field reference for a record. * * Prefer this over hand-written cursor loops when scanning all matching references. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ refsIter: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: RefsOptions) => AsyncIterableIterator; /** * Materialize every wref-typed field reference for a record. * * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` refs have actually been observed across pages. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ refsAll: (orgName: string | undefined, repoName: string | undefined, wref: string, opts?: RefsOptions & { max?: number; }) => Promise; }; /** * Live repository update surface backed by server-sent events. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#live */ readonly live: { /** * Stream refreshed `thing.head` results whenever the repository changes. * * The SDK re-runs the underlying `thing.head` query after each invalidation and passes the latest snapshot to `onUpdate`. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ thingHead: (orgName: string, repoName: string, opts: LiveThingHeadOptions | undefined, onUpdate: (result: ThingHead) => void | Promise) => Promise; /** * Stream refreshed history results for a single wref whenever the repository changes. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ thingHistory: (orgName: string, repoName: string, opts: LiveThingHistoryOptions, onUpdate: (result: ThingHistory) => void | Promise) => Promise; /** * Stream refreshed action live-feed entries for a subscription. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ subscriptionLog: (orgName: string, repoName: string, subscriptionName: string, opts: LiveSubscriptionLogOptions | undefined, onUpdate: (result: ActionLiveFeed) => void | Promise) => Promise; /** * Subscribe to raw repository invalidation events. * * Unlike the higher-level live helpers, this method does not re-query. It * forwards invalidation metadata such as affected shapes, affected things, * affected assertion targets, and whether the event corresponds to a new * commit. * * @param opts.signal Optional abort signal used to close the SSE stream. * @param onEvent Callback invoked for each repository invalidation event. */ subscribe: (orgName: string, repoName: string, opts: { signal?: AbortSignal; } | undefined, onEvent: (event: LiveRepoEvent) => void | Promise) => Promise; }; /** * Personal access token management for the authenticated user. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#token */ readonly token: { /** * Create a personal access token for the authenticated user. * * Omit `scopes` to mint a token with the same authority as the calling principal. PATs cannot create or revoke other PATs — token-management permissions are excluded from the grantable set. Server enforces a maximum lifetime; pass an `expiresAt` unix-millis value to clamp earlier. * * See [Personal Access Tokens](/auth/personal-access-tokens/) for scope grammar (resource format, permission strings, `allowedMatches`), rotation, and CI usage. * * @param input.name Caller-chosen identifier for the token, returned in `list`, `get`, and `revoke`. * @param input.scopes Scope entries narrowing the token's authority. Omit for full-principal authority. * @param input.expiresAt Unix epoch milliseconds at which the token expires. * @param input.description Human-readable description shown in token listings. */ create: (input: TokenCreateInput) => Promise; /** * List personal access tokens for the authenticated user. * * By default only active tokens are returned. Pass * `{ includeInactive: true }` to also include expired and revoked tokens. */ list: (opts?: { includeInactive?: boolean; }) => Promise; /** * Get one personal access token by name. */ get: (name: string) => Promise; /** * Revoke a personal access token by name. */ revoke: (name: string) => Promise; }; /** * Low-level stream append surface for callers that already have backend stream operations. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#stream */ readonly stream: { /** * Append one non-empty chunk of stream operations to a repository. * * Most callers should prefer `commit.apply` or `OperationBuilder`. Use this low-level surface only when you already have backend-shaped stream operations and a caller-managed stream ID. */ append: (input: StreamAppendInput$1) => Promise; }; /** * Credential set management for subscription webhook authentication and component integrations. * * Sets are scoped at creation time. Repo-scoped sets are visible only to the owning repo; org-scoped sets can be granted to multiple repositories in the same organization. Methods that operate on a specific set accept `repoName: string | undefined` — pass the owning repo name for repo-scoped sets or `undefined` for org-scoped sets. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#credential */ readonly credential: { /** * Create a credential set. * * Credential sets are repo-scoped by default. Org-scoped sets can be granted to multiple repositories in the same organization. */ createSet: (orgName: string, repoName: string | undefined, name: string, opts?: { scope?: "org" | "repo"; description?: string; }) => Promise; /** * List credential sets visible from a repository. */ listSets: (orgName: string, repoName?: string) => Promise; /** * Get credential set metadata without secret values. */ getSet: (orgName: string, repoName: string | undefined, name: string) => Promise; /** * Set or replace one secret key in a credential set. */ setKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string, value: string) => Promise; /** * Set or replace multiple secret keys in one request. */ setKeys: (orgName: string, repoName: string | undefined, setName: string, secrets: Record) => Promise; /** * Remove one secret key from a credential set. */ unsetKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string) => Promise; /** * Delete a credential set and its stored secrets. */ deleteSet: (orgName: string, repoName: string | undefined, setName: string) => Promise; /** * List audit entries for a credential set. */ listAuditLog: (orgName: string, repoName: string | undefined, setName: string, opts?: { limit?: number; }) => Promise; /** * Revoke a credential set so it can no longer be exported or bound. */ revokeSet: (orgName: string, repoName: string | undefined, setName: string, opts?: { reason?: string; }) => Promise; }; /** * Alias for `credential`. * * @hidden */ readonly credentials: { /** * Create a credential set. * * Credential sets are repo-scoped by default. Org-scoped sets can be granted to multiple repositories in the same organization. */ createSet: (orgName: string, repoName: string | undefined, name: string, opts?: { scope?: "org" | "repo"; description?: string; }) => Promise; /** * List credential sets visible from a repository. */ listSets: (orgName: string, repoName?: string) => Promise; /** * Get credential set metadata without secret values. */ getSet: (orgName: string, repoName: string | undefined, name: string) => Promise; /** * Set or replace one secret key in a credential set. */ setKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string, value: string) => Promise; /** * Set or replace multiple secret keys in one request. */ setKeys: (orgName: string, repoName: string | undefined, setName: string, secrets: Record) => Promise; /** * Remove one secret key from a credential set. */ unsetKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string) => Promise; /** * Delete a credential set and its stored secrets. */ deleteSet: (orgName: string, repoName: string | undefined, setName: string) => Promise; /** * List audit entries for a credential set. */ listAuditLog: (orgName: string, repoName: string | undefined, setName: string, opts?: { limit?: number; }) => Promise; /** * Revoke a credential set so it can no longer be exported or bound. */ revokeSet: (orgName: string, repoName: string | undefined, setName: string, opts?: { reason?: string; }) => Promise; }; /** * Create a WarmHub client. * * Pass either an options object or the legacy `(apiUrl, options)` form. The * options object form is preferred for new code. */ constructor(apiUrl?: string, options?: WarmHubClientOptions); constructor(options?: WarmHubClientOptions); /** * Return a new client that shares this client's backend URL and fetch implementation but uses a different access-token provider. * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#withaccesstoken */ withAccessToken(accessToken: AccessTokenProvider): WarmHubClient; /** * Alias for `action`. * * @hidden */ readonly actions: { /** * Acquire an exclusive processing lease for a subscription consumer. * * @param holderId Stable identifier for the process claiming the lease. * @param holderType Kind of consumer claiming the lease. */ acquireLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, holderType: "sdk" | "cli", opts?: { graceMs?: number; ttlMs?: number; }) => Promise; /** * Extend the TTL for an existing processing lease. */ heartbeatLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, ttlMs?: number) => Promise; /** * Release an existing processing lease. */ releaseLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string) => Promise; /** * Claim one action delivery for processing. */ claimDelivery: (orgName: string, repoName: string, target: ActionDeliveryTarget, holderId: string) => Promise; /** * Mark one claimed action delivery as complete. */ completeDelivery: (orgName: string, repoName: string, target: ActionDeliveryTarget, holderId: string) => Promise; /** * Query the live delivery feed for a subscription. * * Use this for polling or live-log views that need recent delivery status entries. * Matched operation bodies use the same reader-independent durable WREF * form as thing bodies. With `decorateResponses`, readable labels are * attached separately in the response's `decorations` sidecar. * * Cursor contract: cursors are short-lived resume tokens for the same query * and result scope. If filters, visibility, or backing streams change, the * backend may reject a saved cursor with `VALIDATION_ERROR` / `Invalid * cursor`; restart the query without `cursor` instead of retrying the stale * token. */ liveFeed: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => Promise; /** * Iterate delivery-feed entries. Cursors resume the same query and result * scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. */ liveFeedIter: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => AsyncIterableIterator; /** * Materialize delivery-feed entries. Cursors resume the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. */ liveFeedAll: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions & { max?: number; }) => Promise; /** * List subscription action runs as a `Page` (`items` + * optional `nextCursor`), newest-first, capped at 200 runs per page. * * `status` and `outcome` are mutually exclusive. * `since` and `cursor` are mutually exclusive; pass `cursor` alone on later * pages — the `since` window rides in the cursor. * Cursors are opaque, short-lived resume tokens for the same query and * result scope; on `VALIDATION_ERROR` / `Invalid cursor`, restart the query * without `cursor`. * See docs/dev/warmhub-actions-api.md for the full contract. */ listRuns: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => Promise>; /** * Iterate action runs. Cursors resume the same query and result scope; on * `VALIDATION_ERROR` / `Invalid cursor`, restart the query without `cursor`. * `since` is sent only on the initial request. */ listRunsIter: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => AsyncIterableIterator; /** * Materialize action runs. Cursors resume the same query and result scope; * on `VALIDATION_ERROR` / `Invalid cursor`, restart the query without * `cursor`. `since` is sent only on the initial request. */ listRunsAll: (orgName: string, repoName: string, opts?: ActionListRunsOptions & { max?: number; }) => Promise; /** * Return the newest visible action run for each subscription in a repo. * * This grouped read is intended for subscription summaries that need * complete per-subscription recency without walking repo-wide history or * issuing one request per subscription. */ latestRuns: (orgName: string, repoName: string) => Promise; /** * Aggregate run counts (total + per-status) for a repo or one subscription. * * Computed server-side over an optional `since` window as a window * aggregate — it counts every run in the window, whereas `listRuns` returns * only a page sample of that pageable history. Use `runStats` for totals and * `listRuns` to walk the individual runs page by page. */ runStats: (orgName: string, repoName: string, opts?: ActionRunStatsOptions) => Promise; /** * List delivery attempts for one action run. */ getRunAttempts: (orgName: string, repoName: string, runId: string) => Promise; /** * List repo-scoped action notifications. * * Use `since` or `limit` to bound notification-center style reads. */ listNotifications: (orgName: string, repoName: string, opts?: ActionListNotificationsOptions) => Promise; }; private openSse; /** * Stamp the `X-WarmHub-Client` self-identification and `X-WarmHub-Client-Flags` * headers, unless the caller already set them on the request (a per-request * header wins over the default). */ private applyClientHeader; private fetchWithAuth; private requestResponse; /** Prepare one authenticated streaming request without acquiring its body. */ private prepareStreamingSubmissionRequest; /** Convert an explicit non-2xx REST response through the standard mapping. */ private httpResponseError; private requestJson; private watchRepoQuery; } export { type AboutOptions, type AboutResult, type AccessResolveInput, type AccessResolveResult, type AccessTokenProvider, type ActionAttemptInfo, type ActionDeliveryTarget, type ActionLeaseAcquire, type ActionLeaseOp, type ActionListNotificationsOptions, type ActionListRunsOptions, type ActionLiveFeed, type ActionLiveFeedItem, type ActionLiveFeedOptions, type ActionNotificationInfo, type ActionRunInfo, type ActionRunStatsInfo, type ActionRunStatsOptions, type AddOp, type AddOperation, AllStreamOperationsFailedError, type Assertion, CLI_INSTALL_REPO_HEADER, CLI_SIGNATURE_HEADER, CLI_TIMESTAMP_HEADER, CONTENT_FIELD_LIMIT_ERROR, type CliCallSecrets, CliCallVerificationError, type CliCallVerificationFailureReason, type CollectionAddOp, type CollectionAddType, type CollectionContainsOptions, type CollectionContainsResult, type CollectionCreateOptions, type CollectionDiffOptions, type CollectionDiffResult, type CollectionMember, type CollectionMembersOptions, type CollectionMembersPage, type CollectionMembershipRole, type CollectionMutationResult, type CollectionQuerySourceOptions, type CollectionReadDataMode, type CollectionReadSummary, type CollectionReviseOptions, type CollectionStatsOptions, type CollectionStatsResult, type CollectionTag, type CollectionType, type CollectionWriteType, type CommitApplyCompatibilityResult, type CommitDiagnostic, type CommitRealOperationResult, type CommitValidateInput, type CommitValidateOptions, type CommitValidateResult, type ComponentHistory, type ComponentHistoryOptions, type ComponentInfo, type ComponentInstallOptions, type ComponentInstallResult, type ComponentList, type ComponentListOptions, type ComponentUninstallOptions, type ComponentUninstallResult, type ComponentView, type CoreErrorKind, type CountOptions, type CountResult, type CredentialAuditEntry, type CredentialDeleteResult, type CredentialGrantResult, type CredentialInfo, type CredentialKeyMutationResult, type CredentialRevokeResult, type CredentialUngrantResult, type CurrentUserInfo, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, type DeclaredFieldEntry, type ErrorKind, type FieldIndexCarryingMarker, type FieldIndexCarryingShape, type FieldIndexConsistency, type FieldIndexPinResult, type FilterOptions, type FilterResult, type FunctionLogMode, type GlobalSearchOptions, type GlobalSearchResult, type GlobalSearchResultItem, type Grant, type GrantCreateOptions, type GrantListOptions, type GrantListResult, type GrantRecipientSelector, type GrantRevokeResult, type HeadResult, type HistoryResult, type HistoryVersion, type HomepageFeaturedListsResult, type IndexedFieldEntry, type IndexedFieldsReport, type LiveHandle, type LiveRepoEvent, type LiveSubscriptionLogOptions, type LiveThingHeadOptions, type LiveThingHistoryOptions, type LiveWatchResult, MAX_COMMIT_VALIDATION_ENCODED_BYTES, MAX_COMMIT_VALIDATION_OPERATIONS, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, MAX_WREFS_PER_THING_VERSION, ORG_AUTH_SCOPES, type Operation, OperationBuilder, type OperationBuilderAddInput, type OperationBuilderClient, type OperationBuilderOp, type OperationBuilderOptions, type OperationEventReceipt, type OperationEventReceiptV1, type OperationSource, type OperationSubmitResult, type OrgAccessResult, type OrgAuthScope, type OrgInfo, type OrgList, type OrgListMembersOptions, type OrgListOptions, type OrgMemberInfo, type OrgMemberList, type OrgRef, type OrgRole, type Page, type PageRequest, PartialStreamSubmissionError, type PingResult, REPO_AUTH_SCOPES, type ReaffirmOperation, type RefLink, type RefsOptions, type RefsResult, type RenameOperation, type RenameOptions, type RenameResult, type RepoAccessResult, type RepoAuthScope, type RepoConfigureStatsView, type RepoDescribeResult, type RepoExploreBrowseOptions, type RepoExploreItem, type RepoExploreOptions, type RepoExploreResult, type RepoInfo, type RepoLicense, type RepoList, type RepoListForCallerOptions, type RepoListOptions, type RepoListPageOptions, type RepoListPageResult, type RepoLocator, type RepoRecentInfo, type RepoRef, type RepoShapeInstanceCountsView, type RepoSort, type RepoStatsBatchResult, type RepoStatsView, type RepoWithStatsInfo, type RepositoryCheckpointAccess, type RepositoryCheckpointStatus, RepositoryExportError, type RepositoryExportErrorReason, type RepositoryExportExpectation, type RepositoryExportOptions, type RepositoryExportPreparation, type RepositoryExportPrepareOptions, type RepositoryExportRestoreOptions, type RepositoryExportRowMap, type RepositoryExportRows, type RepositoryExportSegmentOptions, RepositoryExportSession, type RequestEvent, type ResolveWrefResult, type RetractOp, type RetractOperation, type RetryPolicyOptions, type ReviseOp, type ReviseOperation, SDK_VERSION, type SearchOptions, type SearchResult, type Shape, type ShapeChange, type ShapeCreateOptions, type ShapeFields, type ShapeGetOptions, type ShapeHistory, type ShapeHistoryOptions, type ShapeList, type ShapeListOptions, type ShapeRef, type ShapeRemove, type ShapeRemoveOptions, type ShapeReviseOptions, type ShapeValidatorResult, type StreamAppendInput, type StreamAppendResult, type StreamContinuationState, StreamSubmissionAggregator, type StreamingSubmissionHandle, type StreamingSubmissionOptions, StreamingSubmissionOutcomeUnknownError, type StreamingSubmissionRetryIdentity, type StreamingSubmissionRow, type SubscriptionBindCredentialsResult, type SubscriptionCompatCreateInput, type SubscriptionCompatUpdateInput, type SubscriptionInfo, type SubscriptionList, type SubscriptionUnbindCredentialsResult, type SynthesizedRepoContent, type ThingChanges, type ThingDetail, type ThingGet, type ThingGetManyResult, type ThingGetOptions, type ThingGetWithLease, type ThingGraphOptions, type ThingGraphResult, type ThingGraphValue, type ThingHead, type ThingHeadChangesOptions, type ThingHeadOptions, type ThingHeadRequest, type ThingHeadVersionsResult, type ThingHistory, type ThingHistoryOptions, type ThingItem, type ThingMetadata, type ThingQueryChangesOptions, type TokenInfo, type TokenResult, type UndeclaredFieldsWarning, type ValidationDiagnostic, type ValidationResult, type VerifiedCliCall, type ViewEvaluateOptions, type ViewEvaluateResult, WarmHubClient, type WarmHubClientOptions, type WarmHubDecorations, WarmHubError, type WarmHubErrorDetails, type WherePredicate, type WhoamiInfo, type WhoamiScopeEntry, type WireScopeEntry, applyRepositoryExportDelta, collectDurableTokens, commitValidateRequestBodyBytes, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, createCommitValidateInput, createOperationEventRequestId, createOperationEventSubmissionId, createRepositoryExportSession, encodeCommitValidateRequestBody, getResponseDecorations, isConnectionError, isDefiniteStreamAppendRejection, isKnownOrgAuthScope, isKnownRepoAuthScope, isRetryable, isWarmHubError, normalizeWref, operationEventStreamRequestId, readRepositoryExportStream, resolveFunctionLogMode, restoreRepositoryExportSession, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall };