// @volter/world-core — the pack contract (docs/contributing/architecture.md, "The pack contract: the kernel's root"). // This root is everything a Protocol 3 pack may import from the kernel, and nothing else: the manifest's and the // descriptor's types, the handler contract, the derived fetch and core a pack's fetch.ts builds, the serve factory's // pieces, the kernel's deterministic helpers and the scenario grammar. The kernel itself (the log and the tree read // and written directly, the head, the stores, the runtime's scopes) and the plugin contract's surfaces are // `@volter/world-core/runtime`, which a pack never imports. import { bindSemantics as bindAny, type CoreScope, type Handler } from './derived-core.ts'; import type { DerivedHandler, DerivedSurface } from './derived.ts'; import type { DerivedManifest } from './derived-core.ts'; import { packOf as packOfAny, registerPack as registerAny, type PackDescriptor } from './packRegistry.ts'; // ── the descriptor ───────────────────────────────────────────────────────────────────────────── export type { PackDescriptor, PackTransport } from './packRegistry.ts'; /** The descriptor a manifest declares, with its vendor ("The descriptor"); given the pack's generated surface (a vendor of * lanes: each lane's manifest and surface), with the real-system adapters the kernel derives from them. */ export const packOf = ( manifest: { vendor: string; descriptor?: Omit }, surface?: DerivedSurface | Record, /** the lanes beside a pack that has an API of its own (Clerk's `fapi`, PlanetScale's `api`) */ beside?: Record, ): PackDescriptor => packOfAny(manifest, surface, beside); /** The pack registered, so the World finds it. */ export const registerPack = (pack: PackDescriptor): PackDescriptor => registerAny(pack); // ── the manifest ─────────────────────────────────────────────────────────────────────────────── export type { Actor, CoreScope, DerivedManifest, IdentifierKind, PrivacyDecl, PerformHook, PerformHookArgs, ErrorSpec, LaneRoute, LanesDecl, VendorManifest, FieldRule, ResourceDecl, ScreenDecl, SeedCall, StateField, Transition } from './derived-core.ts'; export type { ApplicationAnswer, DeliveryTransportDecl, EndpointsDecl, EventRender, EventScheme, EventsDecl, EventTransport, EventValues, EventWrite, RetryDecl, SignContext } from './events.ts'; export { verifyEvent } from './events.ts'; export { deriveStateSystem, deriveVendorStateSystem } from './derived-real.ts'; export type { IngestDecl } from './derived-core.ts'; export type { SocketDecl, SocketEngine, SocketSession } from './sockets.ts'; // live media (architecture, "Other wires": live media): an ingest's declaration, its dialect and what a screen reads export type { LiveAccess, LiveAdmission, LiveAudio, LiveDecl, LiveEngine, LivePublish, LiveRecording, LiveRefusal, LiveServeOptions, LiveVideo } from './live/types.ts'; export { machinePool, isMachineCapabilityGap, type ExecSpec, type MachinePool, type MachineProcess, type MachineRun, type MachineSpec, type MachineStatus, type MachineFiles, type MachineFileStat } from './machines.ts'; export type { CorsDecl } from './cors.ts'; // ── the handler contract ─────────────────────────────────────────────────────────────────────── export type { Handler, HandlerContext, WriteHookContext } from './derived-core.ts'; export type { MultipartPart } from './multipart.ts'; export { readMailMessage, mailWords, mailAddressList, type MailMessage, type MailAttachment } from './mail-message.ts'; /** A pack's handlers, by operationId, bound to the manifest: each is answered over the contract's context. */ export const bindSemantics = (m: Parameters[0], handlers: Record, scope: CoreScope = {}): Record => bindAny(m, handlers as never, scope); // ── the derived fetch ────────────────────────────────────────────────────────────────────────── export { createPackFetch, createVendorFetch, type LanePart, type PackFetchOptions, type PackParts, type PackScenario } from './pack-fetch.ts'; export { createDerivedFetch } from './derived.ts'; export type { DerivedCall, DerivedFetch, DerivedFetchOptions, DerivedHandler, DerivedOperation, DerivedSurface, BoardFrame } from './derived.ts'; export { coreFor, crossCutting, derivedRequestScopes, vendorError } from './derived-core.ts'; export { answerVendorErrors, RefusedWriteError } from './head.ts'; // a GraphQL API's resolvers (`semantics/graphql.ts`), and the error one answers with the vendor's type export { GraphqlError, type GraphqlPart, type GraphqlResolver } from './graphql-wire.ts'; // what `ctx.vendorFetch` throws when the other vendor cannot be reached (a vendor's call to another as its own behaviour) export { VendorUnreachableError } from './vendor-call.ts'; export { isReadOnlyRequest, READ_ONLY_REQUEST_HEADER } from './request-scope.ts'; // ── the serve factory ────────────────────────────────────────────────────────────────────────── export { serveHttp, serveStream, nodeBuiltin, StreamListenerUnavailable, type HttpHandler, type HttpServer, type ServeHttpOptions } from './serve-http.ts'; export type { TwinStream, TwinStreamConnection, TwinStreamSink } from './twin-fetch.ts'; export { privateTransportKey } from './private-transport.ts'; // where a page links a hostname its twin answers, inside the World that shows it export { siteLabel, siteUrlOf, twinSiteUrl, twinVendorUrl } from './twin-fetch.ts'; export { statefulTwinManifest, twinManifest } from './scenario.ts'; export { assetContentType, packAsset } from './pack-assets.ts'; export { bytesResponse, contentTypeOf, fileResponse } from './file-response.ts'; // ── the kernel's deterministic helpers ───────────────────────────────────────────────────────── export { certificateOf, digest, digestBytes, equalSecrets, oauth1BaseString, oauth1Encode, oauth1Header, oauth1Signature, hmac, jwks, jwtDecode, jwtSign, jwtSignClaims, jwtVerify, jwtVerifySignature, keyId, lettersFrom, base62From, md5, publicKeyOf, sha256, signWith, SIGNING_ALGORITHMS, uuidFrom, verifyWith } from './signing.ts'; export type { HandlerCrypto, Jwk, Jwks, JwtDecodeOptions, JwtSignatureOptions, JwtVerdict, JwtVerificationKey, KeyFormat, SigningKey } from './signing.ts'; export { blobDigest } from './blob-store.ts'; // the receiver's "now": the clock a time a vendor renders for its client to check against its own is on (ADR 0036 §4, §8); // a pack's semantics reaches it here, its one kernel entry export { receiverNow } from './world-clock.ts'; // compressed bytes a wire carries (a SARIF upload), over web streams export { gunzip, gzip } from './bytes.ts'; // a row's own fields, where the tree's reserved ones (id, type, updatedAt) shadow the vendor's of the same name export { ownFields } from './log.ts'; export type { TwinResource } from './serve.ts'; // the people a vendor's pages sign in (a `_person` row with its password's hash) export { passwordHash, personOf, personWith, recordPerson, shownPersonFields, type Person } from './people.ts'; // the World's managed Postgres a handler reaches as `ctx.engine` (managed-database.ts), and a mail's route (`ctx.mail`) export { EngineDatabaseError, EngineUnavailableError, quoteIdent } from './managed-database.ts'; export type { Batch as EngineBatch, ManagedDatabase, Statement as EngineStatement, StatementResult as EngineStatementResult } from './managed-database.ts'; export type { Mail, MailReply } from './smtp.ts'; // S3's wire (contract "S3's wire is a kernel library too") and the git plane (contract "The git plane is a kernel library") export * as s3 from './s3/wire.ts'; // Generic strict XML grammar; vendor interpretation remains in its consumer. export * as xml from './xml.ts'; // Generic WHATWG HTML grammar; what a pack keeps of received HTML remains the pack's policy. export * as html from './html.ts'; export * as clickhouse from './clickhouse/index.ts'; export { sampleFromSchema } from './schema-sample.ts'; export * as openaiWire from './openai-wire.ts'; export * as anthropicWire from './anthropic-wire.ts'; export * as protobuf from './protobuf.ts'; export * as grpc from './grpc-wire.ts'; export { acceptH2Connection, type H2Handler, type Http1Handler } from './h2.ts'; export { placeholderPng } from './placeholder-image.ts'; export { imageDimensions, readImageHeader, readMp4Header } from './media-header.ts'; export { presignSigV4, signSigV4, verifySigV4, type SigV4Verdict } from './sigv4.ts'; export * as redis from './redis/index.ts'; export * as smtpServer from './smtp-server.ts'; export * as mysql from './mysql/index.ts'; export * as live from './live/index.ts'; export * as mongodb from './mongodb/index.ts'; export * as git from './git/index.ts'; // ── the scenario grammar (architecture, "Scenarios") ─────────────────────────────────────────── export { scenarioFaultResult, ScenarioError } from './scenario.ts'; export { WORLD_SCENARIO_ENV } from './placements.ts'; export type { PlacementRecord } from './placements.ts'; export type { PackScenarioAdapter, ScenarioDecision, ScenarioFault, ScenarioFaultResult, ScenarioFeatures, ScenarioHandler, ScenarioMatcher, ScenarioMissRecord } from './scenario.ts'; export { verifyAttestationBundle } from './attestation.ts'; export { cookieOf, signedIn, browserSessionToken, startBrowserSession, endBrowserSession } from './browser-session.ts'; export { readHostPort } from './host-port.ts'; export { assertBrowserName, browserOrigin, validateBrowserState, validateBrowserStorageState, validateBrowserContext, browserAcceptLanguage, cookieMatchesHost, type BrowserCookie, type BrowserState, type BrowserStorageState, type BrowserContext, type BrowserIndexedDB } from './browser-state.ts'; export * as managedOriginalInputs from './managed-original-inputs.ts'; export * as managedGoPrograms from './managed-go-programs.ts'; export { worldSecret, worldAccount } from './derived-core.ts'; export { isWorldAccountName } from './world-account-name.ts';