Files
upstream-affine/packages/backend/native/index.d.ts
upstream-mirror 50f788e799
Some checks failed
Build & Test / Analyze (javascript, blocksuite) (push) Failing after 3s
Build & Test / Rust test filter (push) Failing after 3s
Build & Test / E2E BlockSuite Test (2) (push) Failing after 3s
Build & Test / E2E BlockSuite Test (3) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (4) (push) Failing after 3s
Build & Test / E2E BlockSuite Cross Browser Test (push) Failing after 3s
Build & Test / E2E Mobile Test (1) (push) Failing after 3s
Build & Test / E2E Mobile Test (2) (push) Failing after 3s
Build & Test / Build AFFiNE native (x86_64-unknown-linux-gnu) (push) Failing after 4s
Build & Test / Unit Test (1) (push) Has been skipped
Build & Test / Unit Test (2) (push) Has been skipped
Build & Test / Unit Test (3) (push) Has been skipped
Build & Test / Build Server native (push) Failing after 3s
Build & Test / Check Git Status (push) Has been skipped
Build & Test / Server Test (0, 4) (push) Has been skipped
Build & Test / Server Test (1, 4) (push) Has been skipped
Build & Test / Analyze (javascript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, affine) (push) Failing after 3s
Build & Test / Analyze (typescript, blocksuite) (push) Failing after 3s
Build & Test / Mobile native build filter (push) Failing after 3s
Build & Test / Check yarn binary (push) Failing after 3s
Build & Test / E2E BlockSuite Test (1) (push) Failing after 4s
Build & Test / E2E BlockSuite Test (5) (push) Failing after 3s
Build & Test / Unit Test (4) (push) Has been skipped
Build & Test / Unit Test (5) (push) Has been skipped
Build & Test / Native Unit Test (push) Has been skipped
Build & Test / Server Test (2, 4) (push) Has been skipped
Build & Test / Server Test (3, 4) (push) Has been skipped
Build & Test / Server Test with Elasticsearch (push) Has been skipped
Build & Test / Server Test with Embedded Search (push) Has been skipped
Build & Test / Server Test with Manticore Search (push) Has been skipped
Build & Test / Server E2E Test (push) Has been skipped
Build & Test / Cloud Desktop E2E Test (push) Has been skipped
Build & Test / Cloud E2E Test 1/2 (push) Has been skipped
Build & Test / Cloud E2E Test 2/2 (push) Has been skipped
Build & Test / Build @affine/electron renderer (push) Failing after 3s
Build & Test / Copilot test filter (push) Failing after 4s
Build & Test / Lint Rust (push) Has been skipped
Build & Test / Build Android app (push) Has been skipped
Build & Test / Test Android app (push) Has been skipped
Build & Test / Run native tests (push) Has been skipped
Build & Test / Server Copilot Api Test (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (3, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (4, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (1, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (2, 5) (push) Has been skipped
Build & Test / Frontend Copilot E2E Test (5, 5) (push) Has been skipped
Build & Test / Desktop Test (ubuntu-latest, linux, x64, x86_64-unknown-linux-gnu, true) (push) Has been cancelled
Build & Test / Desktop Test (windows-latest, windows, x64, x86_64-pc-windows-msvc, true) (push) Has been cancelled
Build & Test / 3, 2, 1 Launch (push) Has been cancelled
Build & Test / Lint (push) Has been cancelled
Build & Test / Typecheck (push) Has been cancelled
Build & Test / Build iOS app (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-apple-darwin) (push) Has been cancelled
Build & Test / E2E Test (1) (push) Has been cancelled
Build & Test / E2E Test (2) (push) Has been cancelled
Build & Test / E2E Test (3) (push) Has been cancelled
Build & Test / E2E Test (4) (push) Has been cancelled
Build & Test / E2E Test (5) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-apple-darwin) (push) Has been cancelled
Build & Test / Build AFFiNE native (aarch64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Build AFFiNE native (x86_64-pc-windows-msvc) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, arm64, aarch64-apple-darwin, true) (push) Has been cancelled
Build & Test / Desktop Test (macos-latest, macos, x64, x86_64-apple-darwin, false) (push) Has been cancelled
snapshot of https://github.com/toeverything/AFFiNE.git (canary, 2026-09-16; blobs > 131072B omitted)
2026-09-16 00:31:07 +05:00

1861 lines
52 KiB
TypeScript

/* auto-generated by NAPI-RS */
/* oxlint-disable */
declare const _default: typeof import('./index')
export default _default
export declare class BackendRuntime {
executeAuthSessionCommandV1(input: any): Promise<any>
resolveAuthPrincipalV1(input: any): Promise<any>
getDocBlobManifestV1(input: any): Promise<any>
getReadableWorkspaceBlobManifestV1(input: any): Promise<any>
getBlobV1(input: any): Promise<RuntimeAuthorizedBlobV1>
readBlobStreamChunkV1(streamId: string): Promise<RuntimeBlobChunkV1>
closeBlobStreamV1(streamId: string): Promise<void>
listByokProfiles(workspaceId: string): Promise<Array<ByokProfileOutput>>
getByokPolicy(): ByokPolicyOutput
createByokProfile(input: CreateByokProfileInput): Promise<ByokProfileOutput>
replaceByokProfile(input: ReplaceByokProfileInput): Promise<ByokProfileOutput>
rotateByokCredential(input: RotateByokCredentialInput): Promise<ByokProfileOutput>
probeByokProfile(input: ProbeByokProfileInput): Promise<ByokProbeResultOutput>
probeByokDraft(input: ProbeByokDraftInput): Promise<ByokProbeResultOutput>
deleteByokProfile(workspaceId: string, profileId: string): Promise<boolean>
reorderByokProfiles(input: ReorderByokProfilesInput): Promise<Array<ByokProfileOutput>>
createByokLocalLease(input: CreateByokLocalLeaseInput): Promise<ByokLocalLeaseOutput>
getUserQuotaStateV1(userId: string): Promise<RuntimeUserQuotaState>
getWorkspaceQuotaStateV1(workspaceId: string): Promise<RuntimeWorkspaceQuotaState>
getSyncPermissionGenerationV1(workspaceId: string): Promise<number>
quotaSeatUsageTransitionV1(workspaceIds: Array<string>): Promise<void>
runMigrations(): Promise<void>
searchAuthorized(actorUserId: string, workspaceId: string, request: RuntimeSearchRequest): Promise<SearchOperationOutput>
aggregateAuthorized(actorUserId: string, workspaceId: string, request: RuntimeAggregateRequest): Promise<SearchOperationOutput>
reconcileSearchProjection(limit?: number | undefined | null): Promise<number>
authorizePermissionV1(input: any): Promise<any>
executeDomainCommandV1(input: any): Promise<any>
searchStatus(): Promise<any>
executeCopilotStream(input: CopilotExecuteInput, maxSteps: number, callback: ((err: Error | null, arg: string) => void), toolCallback: ((err: Error | null, arg: string) => Promise<string>)): Promise<CopilotStreamHandle>
executeCopilot(input: CopilotExecuteInput): Promise<string>
assertCopilotRoute(input: CopilotRouteCheckInput): Promise<void>
/**
* Merge pending doc updates with y-octo and persist the merged snapshot.
*
* Do not use this for snapshots that will be sent back to yjs clients until
* the y-octo/yjs round-trip compatibility issue is resolved.
*
* The caller must pass the canonical history retention period resolved for
* this workspace. The compactor does not make quota decisions.
*/
compactPendingDocUpdates(workspaceId: string, docId: string, batchLimit: number, historyMinIntervalMs: number, historyMaxAgeSeconds: number): Promise<RuntimeDocCompactionResult>
upsertDocSnapshot(workspaceId: string, docId: string, blob: Buffer, timestampMs: number, editorId?: string | undefined | null): Promise<boolean>
createDocHistory(input: RuntimeDocHistoryInput): Promise<boolean>
appendWorkspaceDocUpdatesV1(input: AppendWorkspaceDocUpdatesInputV1): Promise<number>
appendWorkspaceDocUpdatesTrustedV1(input: AppendWorkspaceDocUpdatesTrustedInputV1): Promise<number>
embeddingHealth(): Promise<EmbeddingHealth>
syncEmbeddingState(input: SyncEmbeddingStateInput): Promise<RuntimeEmbeddingWorkspaceState>
embeddingQueueCounts(): Promise<RuntimeEmbeddingQueueCounts>
embeddingWorkspaceProgress(workspaceId: string): Promise<RuntimeEmbeddingProgress>
putWorkspaceArtifact(input: PutWorkspaceArtifactInput, body: Buffer): Promise<RuntimeWorkspaceArtifact>
ensureWorkspaceBlobArtifact(input: EnsureWorkspaceBlobArtifactInput): Promise<RuntimeWorkspaceArtifact>
cleanupUnreferencedArtifacts(limit: number): Promise<number>
setArtifactLibraryOwned(workspaceId: string, artifactId: string, libraryOwned: boolean, displayName?: string | undefined | null): Promise<RuntimeWorkspaceArtifact>
compileTurnScope(input: CompileScopeInput): Promise<RuntimeTurnScopeSnapshot>
readEmbeddingSourceContent(input: ReadEmbeddingSourceContentInput): Promise<RuntimeEmbeddingSourceContent>
matchEmbeddingCandidates(input: MatchEmbeddingCandidatesInput): Promise<Array<RuntimeEmbeddingCandidate>>
cancelEmbeddingCandidateRequest(requestId: string): Promise<void>
hasAiEntitlementV1(userId: string): Promise<boolean>
hasWorkspaceCommercialEntitlementV1(workspaceId: string): Promise<boolean>
getByokEntitlementV1(workspaceId: string, actorId?: string | undefined | null): Promise<RuntimeByokEntitlement>
getInstalledLicenseV1(workspaceId: string): Promise<RuntimeInstalledLicense | null>
installTeamLicenseFileV1(workspaceId: string, license: Buffer): Promise<RuntimeInstalledLicense>
activateTeamLicenseV1(workspaceId: string, licenseKey: string): Promise<RuntimeInstalledLicense>
removeTeamLicenseV1(workspaceId: string): Promise<RuntimeLicenseChange | null>
updateTeamLicenseRecurringV1(key: string, recurring: string): Promise<void>
createTeamLicensePortalV1(workspaceId: string): Promise<string>
updateTeamLicenseSeatsV1(workspaceId: string): Promise<RuntimeLicenseSeatUpdateResult>
checkLicensesV1(): Promise<RuntimeLicenseHealthResult>
upsertAdminGrantV1(input: RuntimeAdminGrantInput): Promise<void>
revokeAdminGrantV1(targetType: string, targetId: string): Promise<void>
putRuntimeGateIfAbsent(key: string, ttlMs: number): Promise<boolean>
cleanupExpiredRuntimeGates(limit: number): Promise<number>
cleanupExpiredUserSessions(limit: number): Promise<number>
cleanupExpiredSnapshotHistories(limit: number): Promise<number>
configureObjectStorage(configJson: string): void
start(): Promise<void>
stop(): Promise<void>
reloadConfig(privateKey?: string | undefined | null, objectStorageConfig?: string | undefined | null, inlineConfig?: string | undefined | null): Promise<void>
health(): Promise<BackendRuntimeHealth>
executePaymentCommandV1(input: any): Promise<any>
createPaymentCustomerPortalV1(actorUserId: string): Promise<string>
createLicenseCustomerPortalV1(licenseKey: string, validateKey?: string | undefined | null): Promise<string>
capturePaymentWebhookV1(provider: string, rawBody: Buffer, authorization: string): Promise<any>
paymentProviderNamespacesV1(): Promise<any>
isInviteAbuseUserQuarantinedOrBanned(userId: string): Promise<boolean>
isInviteAbuseWorkspaceQuarantined(workspaceId: string): Promise<boolean>
claimInviteAbuseAction(actionId: string, workerId: string): Promise<boolean>
claimRetryableInviteAbuseActions(workerId: string, limit: number): Promise<Array<RuntimeInviteAbuseClaimedAction>>
markInviteAbuseAction(actionId: string, workerId: string, status: string, error?: string | undefined | null): Promise<boolean>
evaluateWorkspaceInviteLinkV1(actorUserId: string, workspaceId: string): Promise<RuntimeWorkspaceActionDecision>
assertWorkspaceInviteQuotaV1(input: RuntimeWorkspaceInviteQuotaInput): Promise<RuntimeWorkspaceInviteQuotaDecision>
commitWorkspaceInviteQuotaV1(reservationId: string, usage: RuntimeWorkspaceInviteQuotaUsage): Promise<boolean>
releaseWorkspaceInviteQuotaV1(reservationId: string): Promise<boolean>
assertMailDeliveryQuotaV1(input: RuntimeMailDeliveryQuotaInput): Promise<RuntimeMailDeliveryQuotaDecision>
commitMailDeliveryQuotaV1(reservationId: string): Promise<boolean>
releaseMailDeliveryQuotaV1(reservationId: string): Promise<boolean>
cleanupExpiredRollingQuota(limit: number): Promise<number>
createAuthCaptchaChallengeV1(): Promise<CaptchaChallenge>
verifyAuthCaptchaV1(input: CaptchaVerificationInput): Promise<boolean>
createWorkspaceInviteLink(workspaceId: string, inviteId: string, inviterUserId: string, ttlMs: number): Promise<RuntimeWorkspaceInviteLinkRecord>
getWorkspaceInviteLink(workspaceId: string): Promise<RuntimeWorkspaceInviteLinkRecord | null>
getWorkspaceInviteLinkById(inviteId: string): Promise<RuntimeWorkspaceInviteLinkRecord | null>
revokeWorkspaceInviteLink(workspaceId: string): Promise<boolean>
cleanupExpiredRuntimeStates(limit: number): Promise<number>
cleanupExpiredStorageReservationsV1(limit: number): Promise<number>
listManagedWorkspaceBlobsV1(actorUserId: string, workspaceId: string): Promise<Array<RuntimeManagedBlob>>
manageWorkspaceBlobV1(input: RuntimeBlobManagementInput): Promise<boolean>
releaseManagedWorkspaceBlobsV1(actorUserId: string, workspaceId: string, limit: number): Promise<number>
finalizeStorageReservationV1(input: RuntimeStorageReservationMutation): Promise<boolean>
abortStorageReservationV1(input: RuntimeStorageReservationMutation): Promise<boolean>
reserveWorkspaceReviewSeatV1(input: RuntimeSeatReviewInput): Promise<boolean>
activateWorkspaceSeatV1(input: RuntimeSeatActivationInput): Promise<boolean>
reserveWorkspaceSeatsV1(input: RuntimeSeatReservationInput): Promise<RuntimeSeatReservationDecision>
reserveStorageQuotaV1(input: RuntimeStorageReservationInput): Promise<RuntimeStorageReservationDecision>
constructor(privateKey?: string | undefined | null, configPaths?: Array<string> | undefined | null, permissionTelemetry?: (((err: Error | null, arg: string) => void)) | undefined | null, inlineConfig?: string | undefined | null, invalidationEvents?: (((err: Error | null, arg: string) => void)) | undefined | null)
}
export declare class CopilotStreamHandle {
abort(): void
}
export declare class StorageRuntime {
cleanupUnreferencedWorkspaceBlobs(workspaceId: string, gracePeriodDays: number, limit: number): Promise<RuntimeBlobCleanupResult>
backfillMissingBlobMetadata(workspaceId: string | undefined | null, limit: number): Promise<RuntimeBlobMetadataBackfillResult>
rebuildDocBlobRefs(workspaceId: string, docId: string, sourceRevision: number): Promise<RuntimeDocBlobRefsResult>
rebuildWorkspaceDocBlobRefs(workspaceId: string, limit: number): Promise<RuntimeDocBlobRefsResult>
reconcileWorkspaceDocuments(workspaceId: string): Promise<RuntimeDocumentCleanupReconcileResult>
executeDocumentCleanupCandidates(workspaceId: string | undefined | null, gracePeriodDays: number, limit: number): Promise<RuntimeDocumentCleanupExecuteResult>
deleteWorkspaceObjects(workspaceId: string, userIds?: Array<string> | undefined | null): Promise<number>
reconcileWorkspaceStorage(limit: number): Promise<RuntimeWorkspaceStorageReconcileResult>
constructor()
start(): Promise<void>
configure(configJson: string): void
stop(): Promise<void>
runMigrations(): Promise<void>
health(): Promise<StorageRuntimeHealth>
providerCapabilities(scope: string): Promise<StorageProviderCapabilities>
putObject(scope: string, key: string, body: Buffer, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<RuntimeObjectMetadata>
headObject(scope: string, key: string): Promise<RuntimeObjectMetadata | null>
getObject(scope: string, key: string): Promise<RuntimeObjectGetResult | null>
deleteObject(scope: string, key: string): Promise<void>
presignPut(scope: string, key: string, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<RuntimePresignedObjectRequest | null>
presignGet(scope: string, key: string): Promise<RuntimePresignedObjectRequest | null>
createMultipartUpload(scope: string, key: string, metadata?: RuntimeObjectStoragePutOptions | undefined | null): Promise<RuntimeMultipartUploadInit | null>
presignUploadPart(scope: string, key: string, uploadId: string, partNumber: number): Promise<RuntimePresignedObjectRequest | null>
proxyUploadPart(scope: string, key: string, uploadId: string, partNumber: number, body: Buffer, contentLength?: number | undefined | null): Promise<string | null>
listMultipartUploadParts(scope: string, key: string, uploadId: string): Promise<Array<RuntimeMultipartUploadPart> | null>
completeMultipartUpload(scope: string, key: string, uploadId: string, parts: Array<RuntimeMultipartUploadPart>): Promise<boolean>
abortMultipartUpload(scope: string, key: string, uploadId: string): Promise<boolean>
}
export declare class Tokenizer {
count(content: string, allowedSpecial?: Array<string> | undefined | null): number
}
/**
* Adds a document ID to the workspace root doc's meta.pages array.
* This registers the document in the workspace so it appears in the UI.
*
* # Arguments
* * `root_doc_bin` - The current root doc binary (workspaceId doc)
* * `doc_id` - The document ID to add
* * `title` - Optional title for the document
*
* # Returns
* A Buffer containing the y-octo update binary to apply to the root doc
*/
export declare function addDocToRootDoc(rootDocBin: Buffer, docId: string, title?: string | undefined | null): Buffer
export const AFFINE_PRO_PUBLIC_KEY: string | undefined | null
export interface AggregateHitsOptions {
fields: Array<string>
highlights: Array<SearchHighlight>
pagination: SearchPagination
}
export interface AggregateOptions {
hits: AggregateHitsOptions
pagination: SearchPagination
}
export interface AppConfigDescriptor {
key: string
description: string
defaultValue: any
schema: any
internal: boolean
}
export declare function appConfigDescriptors(module: string): Array<AppConfigDescriptor>
export interface AppendWorkspaceDocUpdatesInputV1 {
workspaceId: string
docId: string
updates: Array<Buffer>
actorUserId: string
writeIntent: WorkspaceDocWriteIntentV1
permissionDocId?: string
expectedPermissionGeneration?: number
}
export interface AppendWorkspaceDocUpdatesTrustedInputV1 {
workspaceId: string
docId: string
updates: Array<Buffer>
editorId?: string
}
export declare function assertSafeUrl(request: AssertSafeUrlRequest): void
export interface AssertSafeUrlRequest {
url: string
}
export declare function authorizeReservedDocSubject(userId: string, workspaceId: string, docId: string): boolean
export interface BackendRuntimeHealth {
started: boolean
databaseConnected: boolean
embedding: EmbeddingHealth
invalidation: InvalidationHealth
}
export declare function buildPublicRootDoc(rootDocBin: Buffer, docMetas: Array<PublicDocMetaInput>): Buffer
export declare function buildSafeCallbackUrl(input: string, baseUrl: string, allowedOrigins: Array<string>, queryPairs: Array<UrlQueryPair>): string
export interface BuiltInManagedTarget {
id: string
displayName: string
minimumTier: BuiltInManagedTargetTier
}
export type BuiltInManagedTargetTier = 'Standard'|
'Premium';
export interface BuiltInPromptRenderContract {
name: string
renderParams: Record<string, any>
}
export interface BuiltInPromptSessionContract {
name: string
turns: Array<PromptMessageContract>
renderParams: Record<string, any>
}
export interface BuiltInPromptSpec {
name: string
action?: string
config?: any
params?: Record<string, PromptParamSpec>
builtins?: Array<PromptBuiltin>
messages: Array<PromptSpecMessage>
}
export interface BuiltInRouteOptions {
routeId: string
standardDefaultTargetId?: string
premiumDefaultTargetId?: string
choices: Array<BuiltInManagedTarget>
}
export interface ByokCapabilityInput {
input: Array<string>
output: Array<string>
features: Array<string>
attachmentKinds: Array<string>
attachmentSources: Array<string>
}
export interface ByokCatalogModelOutput {
modelId: string
displayName: string
recommended: boolean
capabilities: Array<ByokCapabilityInput>
}
export interface ByokCatalogOutput {
version: string
providers: Array<ByokCatalogProviderOutput>
}
export interface ByokCatalogProviderOutput {
provider: string
models: Array<ByokCatalogModelOutput>
}
export interface ByokEndpointInput {
kind: string
url?: string
dialect?: string
}
export interface ByokLocalLeaseOutput {
leaseId: string
expiresAtMs: number
}
export interface ByokModelDeclarationInput {
modelId: string
enabled: boolean
capabilities: Array<ByokCapabilityInput>
}
export interface ByokModelProbeCheckOutput {
operation: string
status: ByokProbeStatusOutput
}
export interface ByokModelProbeOutput {
modelId: string
checks: Array<ByokModelProbeCheckOutput>
}
export interface ByokPolicyOutput {
enabled: boolean
allowedProviders: Array<string>
customEndpointMode: string
privateEndpointSupported: boolean
}
export interface ByokProbeCheckInput {
modelId: string
operation: string
}
export interface ByokProbeResultOutput {
definitionFingerprint: string
stale: boolean
connection: ByokProbeStatusOutput
models: Array<ByokModelProbeOutput>
}
export interface ByokProbeStatusOutput {
kind: string
testedAtMs?: number
errorKind?: string
}
export interface ByokProfileDefinitionInput {
endpoint: ByokEndpointInput
models: Array<ByokModelDeclarationInput>
}
export interface ByokProfileOrderInput {
profileId: string
expectedRevision: number
}
export interface ByokProfileOutput {
profileId: string
workspaceId: string
provider: string
name: string
description?: string
definition: ByokProfileDefinitionInput
enabled: boolean
sortOrder: number
revision: number
validation?: ByokValidationOutput
}
export interface ByokValidationOutput {
definitionFingerprint: string
credentialGeneration: number
connection: ByokProbeStatusOutput
models: Array<ByokModelProbeOutput>
}
export interface CanonicalChatRequestContract {
model: string
messages: Array<PromptMessageContract>
maxTokens?: number
temperature?: number
tools?: Array<ToolContract>
include?: Array<string>
reasoning?: any
responseSchema?: any
attachmentCapability?: CapabilityAttachmentContract
middleware?: any
}
export interface CanonicalDocumentIdentity {
workspaceId: string
docId: string
variant: string
isWorkspace: boolean
}
export declare function canonicalizeDocumentIdentity(rawId: string, workspaceHint?: string | undefined | null): CanonicalDocumentIdentity
export interface CanonicalStructuredRequestContract {
model: string
messages: Array<PromptMessageContract>
schema?: any
maxTokens?: number
temperature?: number
reasoning?: any
strict?: boolean
responseMimeType?: string
attachmentCapability?: CapabilityAttachmentContract
middleware?: any
}
export interface CapabilityAttachmentContract {
kinds: Array<'image' | 'audio' | 'file'>
sourceKinds?: Array<'url' | 'data' | 'bytes' | 'file_handle'>
allowRemoteUrls?: boolean
}
export interface CapabilityMatchRequest {
models: Array<CapabilityModelContract>
cond: ModelConditionsContract
}
export interface CapabilityMatchResponse {
modelId?: string
}
export interface CapabilityModelCapability {
input: Array<'text' | 'image' | 'audio' | 'file'>
output: Array<'text' | 'image' | 'object' | 'structured' | 'embedding' | 'rerank'>
attachments?: CapabilityAttachmentContract
structuredAttachments?: CapabilityAttachmentContract
defaultForOutputType?: boolean
}
export interface CapabilityModelContract {
id: string
capabilities: Array<CapabilityModelCapability>
}
export interface CaptchaChallenge {
challenge: string
resource: string
}
export interface CaptchaVerificationInput {
provider: string
token: string
challenge?: string
bits?: number
secret?: string
action?: string
ip?: string
hosts?: Array<string>
dev?: boolean
}
export interface Chunk {
index: number
content: string
}
export interface CompileScopeInput {
workspaceId: string
userId: string
selectors: Array<ScopeSelectorInput>
preferredSourceIds?: Array<string>
}
export interface ContentPolicyMatch {
type: string
reason: string
value?: string
span?: ContentPolicyMatchSpan
}
export interface ContentPolicyMatchSpan {
start: number
end: number
}
export interface ContentPolicyScanInput {
value: string
checks?: Array<string>
}
export interface ContentPolicyScanResult {
version: number
original: string
normalized: string
skeleton: string
matched: boolean
matches: Array<ContentPolicyMatch>
flags: Array<string>
}
export interface CopilotAccessProjection {
routeAllowed: boolean
managedTier: CopilotManagedTier
serverByok: boolean
localByok: boolean
}
export declare function copilotActionRecipe(actionId: string, actionVersion?: string | undefined | null): string
export interface CopilotExecuteInput {
slot: string
builtInRouteId?: string
workspaceId?: string
userId?: string
localLeaseId?: string
access: CopilotAccessProjection
managedTargetId?: string
targetOverride?: CopilotTargetOverrideInput
request: unknown
}
export type CopilotManagedTier = 'Standard'|
'Premium';
export interface CopilotRouteCheckInput {
slot: string
builtInRouteId?: string
workspaceId?: string
userId?: string
localLeaseId?: string
access: CopilotAccessProjection
managedTargetId?: string
targetOverride?: CopilotTargetOverrideInput
}
export interface CopilotTargetOverrideInput {
profileId: string
modelId: string
}
export interface CreateByokLocalLeaseInput {
workspaceId: string
userId: string
providers: Array<CreateByokLocalLeaseProviderInput>
}
export interface CreateByokLocalLeaseProviderInput {
provider: string
name: string
description?: string
credential: string
definition: ByokProfileDefinitionInput
enabled: boolean
}
export interface CreateByokProfileInput {
workspaceId: string
provider: string
name: string
description?: string
credential: string
definition: ByokProfileDefinitionInput
enabled: boolean
actorUserId: string
}
/**
* Converts markdown content to AFFiNE-compatible y-octo document binary.
*
* # Arguments
* * `title` - The document title
* * `markdown` - The markdown content to convert
* * `doc_id` - The document ID to use for the y-octo doc
*
* # Returns
* A Buffer containing the y-octo document update binary
*/
export declare function createDocWithMarkdown(title: string, markdown: string, docId: string): Buffer
export interface DocumentEmbeddingProjectionInput {
docId: string
revision: string
sourceHash: string
units: Array<DocumentEmbeddingUnitInput>
deleted?: boolean
}
export interface DocumentEmbeddingUnitInput {
unitId: string
visibility: string
text: string
blockId?: string
elementId?: string
frameId?: string
}
export interface EmbeddingHealth {
enabled: boolean
state: string
reason?: string
pgvectorVersion?: string
schemaVersion?: number
workerRunning: boolean
}
export interface EnsureWorkspaceBlobArtifactInput {
workspaceId: string
blobId: string
mimeType: string
displayName?: string
fileName?: string
libraryOwned?: boolean
}
export declare function evaluateLocalRedirect(input: string, baseUrl: string, allowedBases: Array<string>): string
export declare function evaluateRedirectUri(input: string, baseUrl: string, allowedOrigins: Array<string>, trustedDomains: Array<string>, queryPairs: Array<UrlQueryPair>): string
export declare function fetchRemoteAttachment(request: RemoteAttachmentFetchRequest): Promise<RemoteAttachmentFetchResponse>
export declare function fromModelName(modelName: string): Tokenizer | null
export declare function getMime(input: Uint8Array): string
export declare function htmlSanitize(input: string): string
export interface ImageInspection {
mimeType: string
width: number
height: number
}
export interface ImageInspectionOptions {
maxWidth?: number
maxHeight?: number
maxPixels?: number
}
export declare function inferRemoteMimeType(request: RemoteMimeTypeRequest): Promise<string>
export declare function inspectImageForProxy(input: Buffer, options?: ImageInspectionOptions | undefined | null): ImageInspection
export interface InvalidationHealth {
state: string
reconnects: number
decodeFailures: number
received: number
published: number
publishFailures: number
}
export interface IssueLicenseInput {
licenseId: string
workspaceId: string
seatQuantity: number
subscriptionEnd?: string
privateKey: string
now: string
}
export declare function issueLicenseV1(input: IssueLicenseInput): Buffer
export declare function llmBuildCanonicalRequest(request: CanonicalChatRequestContract): LlmRequestContract
export declare function llmBuildCanonicalStructuredRequest(request: CanonicalStructuredRequestContract): LlmStructuredRequestContract
export declare function llmBuildEmbeddingRequest(request: LlmEmbeddingRequestContract): LlmEmbeddingRequestContract
export declare function llmBuildImageRequestFromMessages(request: LlmImageRequestBuildContract): LlmImageRequestContract
export declare function llmBuildRerankRequest(request: LlmRerankRequestContract): LlmRerankRequestContract
export declare function llmCanonicalJsonSchemaHash(schema: any): string
export interface LlmCoreMessage {
role: string
content: Array<any>
}
export interface LlmEmbeddingRequestContract {
model: string
inputs: Array<string>
dimensions?: number
taskType?: string
}
export declare function llmGetBuiltInPromptSpec(name: string): BuiltInPromptSpec | null
export declare function llmGetBuiltInRouteOptions(name: string): BuiltInRouteOptions | null
export declare function llmGetByokCatalog(): ByokCatalogOutput
export declare function llmGetContractSchema(name: string): any
export interface LlmImageInputContract {
kind: 'url' | 'data' | 'bytes'
url?: string
dataBase64?: string
data?: Array<number>
mediaType?: string
fileName?: string
}
export interface LlmImageOptionsContract {
n?: number
size?: string
aspectRatio?: string
quality?: string
outputFormat?: 'png' | 'jpeg' | 'webp'
outputCompression?: number
background?: string
seed?: number
}
export interface LlmImageProviderOptionsContract {
provider: 'openai' | 'gemini' | 'fal' | 'extra'
options?: {
input_fidelity?: string;
response_modalities?: string[];
model_name?: string;
image_size?: unknown;
aspect_ratio?: string;
num_images?: number;
enable_safety_checker?: boolean;
output_format?: 'jpeg' | 'png' | 'webp';
sync_mode?: boolean;
enable_prompt_expansion?: boolean;
loras?: unknown;
controlnets?: unknown;
extra?: unknown;
} | unknown
}
export interface LlmImageRequestBuildContract {
model: string
messages: Array<PromptMessageContract>
options?: any
}
export interface LlmImageRequestContract {
model: string
prompt: string
operation: 'generate' | 'edit'
images?: Array<LlmImageInputContract>
mask?: LlmImageInputContract
options?: LlmImageOptionsContract
providerOptions?: LlmImageProviderOptionsContract
}
export declare function llmInferPromptModelConditions(messages: Array<PromptMessageContract>): ModelConditionsContract
export declare function llmListBuiltInPromptSpecs(): Array<BuiltInPromptSpec>
export declare function llmMatchModelCapabilities(payload: CapabilityMatchRequest): CapabilityMatchResponse
export declare function llmMatchModelRegistry(request: ModelRegistryMatchRequest): ModelRegistryMatchResponse
export declare function llmRenderBuiltInPrompt(request: BuiltInPromptRenderContract): PromptRenderResult
export declare function llmRenderBuiltInSessionPrompt(request: BuiltInPromptSessionContract): PromptSessionResult
export interface LlmRequestContract {
model: string
messages: Array<LlmCoreMessage>
stream?: boolean
maxTokens?: number
temperature?: number
tools?: Array<ToolContract>
toolChoice?: any
include?: Array<string>
reasoning?: any
responseSchema?: any
middleware?: any
}
export interface LlmRerankRequestContract {
model: string
query: string
candidates: Array<RerankCandidate>
topN?: number
}
export declare function llmResolveModelRegistryVariant(request: ModelRegistryResolveRequest): ModelRegistryResolveResponse
export interface LlmStructuredRequestContract {
model: string
messages: Array<LlmCoreMessage>
schema: any
maxTokens?: number
temperature?: number
reasoning?: any
strict?: boolean
responseMimeType?: string
middleware?: any
}
export declare function llmValidateContract(name: string, value: any): any
export declare function llmValidateJsonSchema(schema: any, value: any): any
export interface MatchEmbeddingCandidatesInput {
requestId?: string
workspaceId: string
query: string
sourceKind: string
retrieval: RuntimeRetrievalScope
limit?: number
}
/**
* Merge updates in form like `Y.applyUpdate(doc, update)` way and return the
* result binary.
*/
export declare function mergeUpdatesInApplyWay(updates: Array<Buffer>): Buffer
export declare function mintChallengeResponse(resource: string, bits?: number | undefined | null): Promise<string>
export interface ModelConditionsContract {
inputTypes?: Array<'text' | 'image' | 'audio' | 'file'>
attachmentKinds?: Array<'image' | 'audio' | 'file'>
attachmentSourceKinds?: Array<'url' | 'data' | 'bytes' | 'file_handle'>
hasRemoteAttachments?: boolean
modelId?: string
outputType?: 'text' | 'image' | 'object' | 'structured' | 'embedding' | 'rerank'
}
export interface ModelRegistryMatchRequest {
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
cond: ModelConditionsContract
}
export interface ModelRegistryMatchResponse {
variant?: ModelRegistryVariantContract
}
export interface ModelRegistryResolveRequest {
backendKind?: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
modelId: string
}
export interface ModelRegistryResolveResponse {
variant?: ModelRegistryVariantContract
matchedBy?: string
}
export interface ModelRegistryRouteContract {
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
requestLayer?: 'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
}
export interface ModelRegistryVariantContract {
backendKind: 'openai_chat' | 'openai_responses' | 'anthropic' | 'cloudflare_workers_ai' | 'gemini_api' | 'gemini_vertex' | 'fal' | 'anthropic_vertex' | 'deepseek' | 'kimi' | 'opencode_go' | 'opencode_zen'
canonicalKey: string
rawModelId: string
displayName?: string
aliases: Array<string>
legacyAliases?: Array<string>
capabilities: Array<CapabilityModelCapability>
protocol?: 'openai_chat' | 'openai_responses' | 'openai_images' | 'anthropic' | 'gemini' | 'fal_image'
requestLayer?: 'anthropic' | 'chat_completions' | 'cloudflare_workers_ai' | 'responses' | 'openai_images' | 'fal' | 'vertex' | 'vertex_anthropic' | 'gemini_api' | 'gemini_vertex'
routeOverrides?: Record<string, ModelRegistryRouteContract>
behaviorFlags?: Array<string>
}
export interface NativeCanvasProjection {
version: number
docId: string
revision: string
title: string
surfaceBlockId?: string
bounds?: NativeDocBounds
counts: Record<string, number>
blocks: Array<NativeCanvasProjectionBlock>
elements: Array<NativeCanvasProjectionElement>
warnings: Array<NativeProjectionWarning>
}
export interface NativeCanvasProjectionBlock {
id: string
type: string
visibility: string
bounds?: NativeDocBounds
text?: string
title?: string
childIds: Array<string>
}
export interface NativeCanvasProjectionElement {
id: string
type: string
bounds?: NativeDocBounds
text?: string
title?: string
frameId?: string
childIds: Array<string>
sourceId?: string
targetId?: string
parentId?: string
index?: string
pointCount?: number
color?: string
lineWidth?: number
}
export interface NativeDocBounds {
x: number
y: number
width: number
height: number
}
export interface NativeDocumentSearchProjection {
version: number
docId: string
revision: string
sourceHash: string
title: string
units: Array<NativeDocumentSearchUnit>
warnings: Array<NativeProjectionWarning>
}
export interface NativeDocumentSearchUnit {
unitId: string
source: string
visibility: string
blockId?: string
elementId?: string
frameId?: string
blobId?: string
refDocIds: Array<string>
refs: Array<string>
parentFlavour?: string
parentBlockId?: string
additional?: string
type: string
text: string
}
export interface NativeMarkdownResult {
title: string
markdown: string
knownUnsupportedBlocks: Array<string>
unknownBlocks: Array<string>
}
export interface NativePageDocContent {
title: string
summary: string
}
export interface NativeProjectionWarning {
code: string
locator: string
}
export interface NativeWorkspaceDocContent {
name: string
avatarKey: string
}
export interface ParsedDoc {
name: string
chunks: Array<Chunk>
}
export declare function parseDoc(filePath: string, doc: Buffer): Promise<ParsedDoc>
export declare function parseDocToMarkdown(docBin: Buffer, docId: string, aiEditable?: boolean | undefined | null, docUrlPrefix?: string | undefined | null): NativeMarkdownResult
export declare function parsePageDoc(docBin: Buffer, maxSummaryLength?: number | undefined | null): NativePageDocContent | null
export declare function parseWorkspaceDoc(docBin: Buffer): NativeWorkspaceDocContent | null
export declare function permissionActionCatalogV1(): PermissionActionCatalogV1
export interface PermissionActionCatalogV1 {
workspace: Array<string>
doc: Array<string>
}
export interface ProbeByokDraftInput {
workspaceId: string
provider: string
credential?: string
profileId?: string
expectedRevision?: number
definition: ByokProfileDefinitionInput
checks: Array<ByokProbeCheckInput>
}
export interface ProbeByokProfileInput {
workspaceId: string
profileId: string
checks: Array<ByokProbeCheckInput>
}
export declare function processImage(input: Buffer, maxEdge: number, keepExif: boolean): Promise<Buffer>
export declare function projectDocCanvasFromBinary(docBin: Buffer, docId: string, revision: string): NativeCanvasProjection
export declare function projectDocSearchFromBinary(docBin: Buffer, docId: string, revision: string): NativeDocumentSearchProjection
export type PromptBuiltin = 'Date'|
'Language'|
'Timezone'|
'HasDocs'|
'HasFiles'|
'HasSelected'|
'HasCurrentDoc';
export interface PromptMessageContract {
role: 'system' | 'assistant' | 'user'
content: string
attachments?: Array<any>
params?: Record<string, any>
responseFormat?: PromptStructuredResponseContract
}
export interface PromptParamSpec {
default?: string
enumValues?: Array<string>
}
export interface PromptRenderResult {
messages: Array<PromptMessageContract>
warnings: Array<string>
}
export interface PromptSessionResult {
messages: Array<PromptMessageContract>
warnings: Array<string>
promptMessagePositions: Array<number>
}
export interface PromptSpecMessage {
role: 'system' | 'assistant' | 'user'
template: string
}
export interface PromptStructuredResponseContract {
type: 'json_schema'
responseSchemaJson: Record<string, unknown>
schemaHash: string
strict?: boolean
}
export interface ProviderDriverSpec {
driverId: string
providerType: string
models: Array<string>
routes: Array<ProviderRouteSpec>
hostOnly?: ProviderHostOnlySpec
}
export interface ProviderHostOnlySpec {
errorMapper?: string
structuredRetry?: boolean
providerToolAlias?: boolean
}
export interface ProviderRouteSpec {
kind: string
protocol: string
requestLayer?: string
supportsNativeFallback?: boolean
supportsToolLoop?: boolean
requestMiddlewares?: Array<string>
streamMiddlewares?: Array<string>
nodeTextMiddlewares?: Array<string>
}
export interface PublicDocMetaInput {
id: string
title?: string
}
export interface PutWorkspaceArtifactInput {
workspaceId: string
mimeType: string
displayName?: string
fileName?: string
libraryOwned?: boolean
}
export declare function readAllDocIdsFromRootDoc(docBin: Buffer, includeTrash?: boolean | undefined | null): Array<string>
export interface ReadEmbeddingSourceContentInput {
workspaceId: string
sourceKind: string
sourceKey: string
retrieval: RuntimeRetrievalScope
maxChars?: number
cursor?: string
}
export interface RemoteAttachmentFetchRequest {
url: string
timeoutMs?: number
maxBytes: number
allowPrivateTargetOrigin?: boolean
expectedContentTypePrefix?: string
maxImageWidth?: number
maxImageHeight?: number
maxImagePixels?: number
}
export interface RemoteAttachmentFetchResponse {
finalUrl: string
mimeType: string
body: Buffer
}
export interface RemoteMimeTypeRequest {
url: string
timeoutMs?: number
}
export interface ReorderByokProfilesInput {
workspaceId: string
profiles: Array<ByokProfileOrderInput>
actorUserId: string
}
export interface ReplaceByokProfileInput {
workspaceId: string
profileId: string
expectedRevision: number
name: string
description?: string
definition: ByokProfileDefinitionInput
credential?: string
enabled: boolean
actorUserId: string
}
export interface RerankCandidate {
id?: string
text: string
}
export interface ResolvedEntitlement {
plan: string
valid: boolean
status: string
quantity?: number
expiresAt?: string
subjectId?: string
targetId?: string
recurring?: string
issuedAt?: string
entity?: string
issuer?: string
quota: ResolvedQuota
flags: Record<string, boolean>
errorCode?: string
errorMessage?: string
}
export interface ResolvedQuota {
blobLimit: number
storageQuota: number
seatLimit?: number
seatQuota?: number
historyPeriod: number
copilotActionLimit?: number
}
export interface ResolveEntitlementInput {
deploymentType: string
targetType: string
targetId?: string
plan?: string
quantity?: number
signedPayload?: Buffer
publicKey?: string
now: string
}
export declare function resolveEntitlementV1(input: ResolveEntitlementInput): ResolvedEntitlement
export interface RotateByokCredentialInput {
workspaceId: string
profileId: string
expectedRevision: number
credential: string
actorUserId: string
}
export interface RuntimeAdminGrantInput {
targetType: string
targetId: string
plan: string
quantity?: number
}
export interface RuntimeAggregateRequest {
table: SearchTable
queries: Array<RuntimeSearchQuery>
rootQuery: number
field: string
options: AggregateOptions
}
export interface RuntimeAuthorizedBlobV1 {
streamId: string
mime: string
size: number
lastModifiedMs: number
}
export interface RuntimeBlobChunkV1 {
body: Buffer
done: boolean
}
export interface RuntimeBlobCleanupResult {
scannedBlobs: number
deletedObjects: number
deletedMetadata: number
protectedByDocRefs: number
protectedByMetadata: number
protectedByOtherRefs: number
failed: number
nextCursor?: string
workspaceIds: Array<string>
}
export interface RuntimeBlobManagementInput {
workspaceId: string
actorUserId: string
key: string
permanently: boolean
}
export interface RuntimeBlobMetadataBackfillResult {
scannedObjects: number
headedObjects: number
upsertedMetadata: number
skippedExisting: number
skippedWorkspaceMissing: number
failed: number
nextCursor?: string
workspaceIds: Array<string>
}
export interface RuntimeByokEntitlement {
server: boolean
local: boolean
}
export interface RuntimeDocBlobRefsResult {
scannedDocs: number
parsedDocs: number
refsWritten: number
refsDeleted: number
failedDocs: number
nextCursor?: string
}
export interface RuntimeDocCompactionResult {
lockAcquired: boolean
merged: boolean
workspaceId: string
docId: string
updatesMerged: number
historyCreated: boolean
}
export interface RuntimeDocHistoryInput {
workspaceId: string
docId: string
blob: Buffer
timestampMs: number
editorId?: string
force: boolean
historyMinIntervalMs: number
historyMaxAgeMs: number
}
export interface RuntimeDocumentCleanupExecuteResult {
scannedCandidates: number
serializationRetries: number
executed: number
recovered: number
reset: number
failed: number
deletedRows: number
}
export interface RuntimeDocumentCleanupReconcileResult {
scannedDocs: number
marked: number
reset: number
recovered: number
}
export interface RuntimeEmbeddingCandidate {
sourceKind: string
sourceKey: string
content: string
distance: number
docId?: string
artifactId?: string
unitId?: string
visibility?: string
blockId?: string
elementId?: string
frameId?: string
chunk: number
}
export interface RuntimeEmbeddingProgress {
total: number
embedded: number
}
export interface RuntimeEmbeddingQueueCounts {
pending: bigint | number
running: bigint | number
retryWait: bigint | number
ready: bigint | number
failed: bigint | number
expiredLeases: bigint | number
oldestPendingSeconds: bigint | number
activeVectorRows: bigint | number
inactiveVectorRows: bigint | number
indexBytes: bigint | number
retryingIndexes: bigint | number
maxIndexRetrySeconds: bigint | number
}
export interface RuntimeEmbeddingSourceContent {
content: string
/**
* Active materialization token. Changes whenever extracted content is
* replaced.
*/
revision: string
mimeType?: string
name?: string
truncated: boolean
nextCursor?: string
}
export interface RuntimeEmbeddingWorkspaceState {
workspaceId: string
activeIndexId?: string
indexEpoch: bigint | number
runtimeState: string
reasonCode?: string
}
export interface RuntimeInstalledLicense {
key: string
workspaceId: string
quantity: number
recurring: string
variant?: string
validateKey: string
validatedAt: string
expiredAt?: string
installedAt: string
license?: Buffer
}
export interface RuntimeInviteAbuseActionRequired {
action: string
subjectKey: string
evidenceId: string
actionId: string
}
export interface RuntimeInviteAbuseClaimedAction {
action: string
subjectKey: string
evidenceId: string
actionId: string
actorUserId: string
workspaceId: string
}
export interface RuntimeLicenseChange {
workspaceId: string
recurring: string
quantity?: number
canceled: boolean
}
export interface RuntimeLicenseHealthResult {
changes: Array<RuntimeLicenseChange>
transientFailure: boolean
}
export interface RuntimeLicenseSeatUpdateResult {
status: string
license?: RuntimeInstalledLicense
}
export interface RuntimeMailDeliveryQuotaDecision {
allowed: boolean
reservationId?: string
mailClass: string
retryAfterSeconds?: number
reason?: string
scopeKey?: string
windowSeconds?: number
limit?: number
current?: number
requested?: number
}
export interface RuntimeMailDeliveryQuotaInput {
requestId?: string
mailName: string
recipient: RuntimeMailDeliveryQuotaRecipientInput
metadata: RuntimeMailDeliveryQuotaMetadataInput
source?: RuntimeQuotaSourceInput
}
export interface RuntimeMailDeliveryQuotaMetadataInput {
actorUserId?: string
workspaceId?: string
notificationId?: string
abuseSubjectKey?: string
}
export interface RuntimeMailDeliveryQuotaRecipientInput {
email: string
userId?: string
}
export interface RuntimeManagedBlob {
key: string
mime: string
size: number
createdAt: string
}
export interface RuntimeMultipartUploadInit {
uploadId: string
expiresAtMs: number
}
export interface RuntimeMultipartUploadPart {
partNumber: number
etag: string
}
export interface RuntimeObjectGetResult {
body: Buffer
metadata: RuntimeObjectMetadata
}
export interface RuntimeObjectMetadata {
contentType: string
contentLength: number
lastModifiedMs: number
checksumCrc32?: string
}
export interface RuntimeObjectStoragePutOptions {
contentType?: string
contentLength?: number
checksumCrc32?: string
}
export interface RuntimePresignedObjectRequest {
url: string
headersJson: string
expiresAtMs: number
}
export interface RuntimeQuotaSourceInput {
trusted: boolean
ip?: string
country?: string
asn?: number
rayId?: string
}
export interface RuntimeQuotaTargetDomainInput {
domain: string
count: number
}
export interface RuntimeRetrievalScope {
mode: string
requiredDocIds: Array<string>
requiredArtifactIds: Array<string>
preferredSourceIds: Array<string>
}
export interface RuntimeSearchQuery {
queryType: string
field?: string
matchValue?: string
query?: number
queries?: Array<number>
occur?: string
boost?: number
}
export interface RuntimeSearchRequest {
table: SearchTable
queries: Array<RuntimeSearchQuery>
rootQuery: number
options: SearchOptions
}
export interface RuntimeSeatActivationInput {
workspaceId: string
actorUserId: string
targetUserId: string
requireManagePermission: boolean
}
export interface RuntimeSeatReservation {
invitationId: string
userId: string
email: string
status: string
}
export interface RuntimeSeatReservationDecision {
allowed: boolean
reason?: string
limit: number
current: number
reservations: Array<RuntimeSeatReservation>
}
export interface RuntimeSeatReservationInput {
workspaceId: string
actorUserId: string
targets: Array<RuntimeSeatReservationTarget>
}
export interface RuntimeSeatReservationTarget {
email: string
}
export interface RuntimeSeatReviewInput {
workspaceId: string
targetUserId: string
inviterUserId: string
}
export interface RuntimeStorageReservationDecision {
allowed: boolean
reservationId?: string
alreadyUploaded: boolean
reason?: string
limit?: number
current?: number
requested: number
}
export interface RuntimeStorageReservationInput {
workspaceId: string
userId: string
key: string
size: number
mime: string
kind: string
docId?: string
name?: string
uploadId?: string
}
export interface RuntimeStorageReservationMutation {
workspaceId: string
userId: string
key: string
reservationId: string
kind: string
docId?: string
size?: number
mime?: string
}
export interface RuntimeTurnScopeSnapshot {
version: number
resolvedAt: string
selectors: Array<ScopeSelectorInput>
requiredDocIds: Array<string>
requiredArtifactIds: Array<string>
preferredSourceIds: Array<string>
retrieval: RuntimeRetrievalScope
}
export interface RuntimeUserQuotaState {
plan: string
seatLimit: number
blobLimit: number
storageQuota: number
usedStorageQuota: number
historyPeriodSeconds: number
copilotActionLimit?: number
unlimitedCopilot: boolean
}
export interface RuntimeWorkspaceActionDecision {
allowed: boolean
retryAfterSeconds?: number
reason?: string
}
export interface RuntimeWorkspaceArtifact {
id: string
workspaceId: string
contentHash: string
displayName?: string
fileName?: string
canonicalMediaType: string
size: bigint | number
storageScope: string
storageKey: string
status: string
libraryOwned: boolean
}
export interface RuntimeWorkspaceInviteLinkRecord {
workspaceId: string
inviteId: string
inviterUserId: string
expiresAtMs: number
}
export interface RuntimeWorkspaceInviteQuotaDecision {
allowed: boolean
reservationId?: string
retryAfterSeconds?: number
reason?: string
scopeKey?: string
windowSeconds?: number
limit?: number
current?: number
requested?: number
actionRequired?: RuntimeInviteAbuseActionRequired
}
export interface RuntimeWorkspaceInviteQuotaInput {
actorUserId: string
workspaceId: string
requestId?: string
targetCount: number
targetDomains: Array<RuntimeQuotaTargetDomainInput>
source?: RuntimeQuotaSourceInput
}
export interface RuntimeWorkspaceInviteQuotaUsage {
targetCount: number
targetDomains: Array<RuntimeQuotaTargetDomainInput>
}
export interface RuntimeWorkspaceQuotaState {
plan: string
ownerUserId: string
usesOwnerQuota: boolean
seatLimit: number
memberCount: number
overcapacityMemberCount: number
blobLimit: number
storageQuota: number
usedStorageQuota: number
historyPeriodSeconds: number
readonly: boolean
readonlyReasons: Array<string>
unlimitedCopilot: boolean
}
export interface RuntimeWorkspaceStorageReconcileResult {
scannedWorkspaces: bigint | number
deletedWorkspaces: bigint | number
scannedObjects: bigint | number
deletedObjects: bigint | number
deletedOrphanRows: bigint | number
unknownPrefixes: bigint | number
failedShards: bigint | number
failedScopes: Array<string>
unknownPrefixSamples: Array<string>
}
export declare function safeFetch(request: SafeFetchRequest): Promise<SafeFetchResponse>
export type SafeFetchMethod = 'get'|
'head'|
'post'|
'put'|
'propfind'|
'report';
export interface SafeFetchRequest {
url: string
method?: SafeFetchMethod
headers?: Record<string, string>
body?: Buffer
timeoutMs?: number
maxRedirects?: number
maxBytes?: number
allowedHeaders?: Array<string>
allowedHosts?: Array<string>
allowHttp?: boolean
allowPrivateTargetOrigin?: boolean
enableEch?: boolean
echConfigList?: Buffer
}
export interface SafeFetchResponse {
status: number
finalUrl: string
headers: Record<string, string>
body: Buffer
}
export declare function scanContentPolicyV1(input: ContentPolicyScanInput): ContentPolicyScanResult
export interface ScopeSelectorInput {
kind: string
id: string
name?: string
source: string
}
export interface SearchHighlight {
field: string
before: string
end: string
}
export interface SearchOperationOutput {
ok: boolean
value?: any
errorCode?: string
}
export interface SearchOptions {
fields: Array<string>
highlights: Array<SearchHighlight>
pagination: SearchPagination
}
export interface SearchPagination {
limit?: number
skip?: number
cursor?: string
}
export type SearchTable = 'doc'|
'block';
export interface StorageProviderCapabilities {
put: boolean
get: boolean
head: boolean
list: boolean
delete: boolean
presignPut: boolean
presignGet: boolean
multipartDirect: boolean
proxyUpload: boolean
assetpack: boolean
serverMediatedOnly: boolean
}
export interface StorageRuntimeHealth {
started: boolean
databaseConnected: boolean
providerConfigured: boolean
provider?: string
bucket?: string
}
export interface SyncEmbeddingStateInput {
workspaceId: string
enabled: boolean
documents?: Array<DocumentEmbeddingProjectionInput>
reconcileDocuments?: boolean
priority?: number
waitForReadyMs?: number
}
export interface ToolContract {
name: string
description?: string
parameters: any
}
/**
* Updates or creates the docProperties record for a document.
*
* # Arguments
* * `existing_binary` - The current docProperties document binary
* * `properties_doc_id` - The docProperties document ID
* (db$${workspaceId}$docProperties)
* * `target_doc_id` - The document ID to update in docProperties
* * `created_by` - Optional creator user ID
* * `updated_by` - Optional updater user ID
*
* # Returns
* A Buffer containing only the delta (changes) as a y-octo update binary
*/
export declare function updateDocProperties(existingBinary: Buffer, propertiesDocId: string, targetDocId: string, createdBy?: string | undefined | null, updatedBy?: string | undefined | null): Buffer
/**
* Updates a document's title without touching content blocks.
*
* # Arguments
* * `existing_binary` - The current document binary
* * `title` - The new title
* * `doc_id` - The document ID
*
* # Returns
* A Buffer containing only the delta (changes) as a y-octo update binary
*/
export declare function updateDocTitle(existingBinary: Buffer, title: string, docId: string): Buffer
/**
* Updates an existing document with new markdown content.
* Uses structural diffing to apply block-level replacements for changes.
*
* # Arguments
* * `existing_binary` - The current document binary
* * `new_markdown` - The new markdown content to apply
* * `doc_id` - The document ID
*
* # Returns
* A Buffer containing only the delta (changes) as a y-octo update binary
*/
export declare function updateDocWithMarkdown(existingBinary: Buffer, newMarkdown: string, docId: string): Buffer
/**
* Updates a document title in the workspace root doc's meta.pages array.
*
* # Arguments
* * `root_doc_bin` - The current root doc binary (workspaceId doc)
* * `doc_id` - The document ID to update
* * `title` - The new title for the document
*
* # Returns
* A Buffer containing the y-octo update binary to apply to the root doc
*/
export declare function updateRootDocMetaTitle(rootDocBin: Buffer, docId: string, title: string): Buffer
export interface UrlQueryPair {
name: string
value: string
}
export declare function validateAppConfigValue(module: string, key: string, value: any): Array<string>
/**
* Check whether a Yjs update binary can be decoded without applying it to a
* document state.
*/
export declare function validateDocUpdate(update: Buffer): Promise<boolean>
export declare function validateLicenseSeatQuantityV1(seatQuantity: number): void
export declare function verifyChallengeResponse(response: string, bits: number, resource: string): Promise<boolean>
export type WorkspaceDocWriteIntentV1 = 'update_doc'|
'create_doc';