7e69e675ba
Add authorized exact-contract lookup, revision-fenced views, generated typed package/browser descriptors, and lifecycle-safe React discovery. Preserve closed generic contracts without competing-conformance policies or new authority grants. Document supported workarounds and privacy boundaries for agent feedback. Publish matching protocol/SDK exports and update scaffold/starter pins; leave the deployed template unchanged.
111 lines
4.5 KiB
TypeScript
111 lines
4.5 KiB
TypeScript
import http from "node:http";
|
|
import { type QxObjectRef } from "./references.js";
|
|
export * from "./bindings.js";
|
|
export { relationshipMap, relationshipList, relationshipSet } from "./relationships.js";
|
|
export { createMigrationContext, migrationObjectId, serveMigration, type MigrationContext, type MigrationInput, type MigrationOutput, type MigrationEdge, } from "./migration.js";
|
|
import { type Client, type ConnectRouter } from "@connectrpc/connect";
|
|
import { CaminoService, type Value } from "./camino/api_pb.js";
|
|
import { OrchestratorRuntime } from "./quixos/orch_pb.js";
|
|
export type CaminoClient = Client<typeof CaminoService>;
|
|
export type OrchClient = Client<typeof OrchestratorRuntime>;
|
|
export type RuntimeDependency = {
|
|
kind: "state";
|
|
objectId: string;
|
|
attachmentId: string;
|
|
} | {
|
|
kind: "edge";
|
|
objectId: string;
|
|
attachmentId: string;
|
|
projectionId: string;
|
|
};
|
|
export declare const objectRef: (reference: QxObjectRef) => QxObjectRef<string>;
|
|
export declare const liveValue: (value: Value) => {
|
|
$quixosValue: Value;
|
|
};
|
|
export declare const jsToProtoValue: (value: unknown) => Value;
|
|
export declare const protoValueToJs: (value: Value | undefined) => unknown;
|
|
export declare const protoFieldsToJs: (fields: Record<string, Value>) => {
|
|
[k: string]: unknown;
|
|
};
|
|
export type StatePort<T = unknown> = {
|
|
slotId: string;
|
|
get(): Promise<T>;
|
|
live(): Promise<ReturnType<typeof liveValue>>;
|
|
set(value: T): Promise<void>;
|
|
};
|
|
export type EdgePort = {
|
|
edgeTypeId: string;
|
|
projectionId: string;
|
|
resolve(): Promise<QxObjectRef[]>;
|
|
connect(target: QxObjectRef): Promise<void>;
|
|
disconnect(target: QxObjectRef): Promise<void>;
|
|
collection(): Promise<RelationshipCollection>;
|
|
replace(entries: RelationshipEntry[], expectedRevision: bigint): Promise<RelationshipCollection>;
|
|
};
|
|
export type RelationshipEntry<T extends QxObjectRef = QxObjectRef> = {
|
|
edgeId?: string;
|
|
target: T;
|
|
key?: string | boolean | bigint;
|
|
};
|
|
export type RelationshipCollection<T extends QxObjectRef = QxObjectRef> = {
|
|
revision: bigint;
|
|
entries: RelationshipEntry<T>[];
|
|
};
|
|
export type InterfacePort = {
|
|
objectId: QxObjectRef;
|
|
interfaceRevisionId: string;
|
|
invoke(operationId: string, input?: Record<string, unknown>): Promise<unknown>;
|
|
live(operationId: string, input?: Record<string, unknown>): Promise<ReturnType<typeof liveValue>>;
|
|
};
|
|
export type ConstructorPort = {
|
|
atomId: string;
|
|
construct(input?: Record<string, unknown>): Promise<QxObjectRef>;
|
|
};
|
|
export type RuntimePort = StatePort | EdgePort | InterfacePort | ConstructorPort;
|
|
export type RuntimeContext = {
|
|
tryConform(object: QxObjectRef, interfaceRevisionId: string): Promise<InterfacePort | undefined>;
|
|
/** Cooperative cancellation. Completion is acknowledged only after the handler returns. */
|
|
signal?: AbortSignal;
|
|
openSession?: () => Promise<RuntimeSession>;
|
|
objectId: QxObjectRef;
|
|
input: Record<string, unknown>;
|
|
inputProto: Record<string, Value>;
|
|
ports: ReadonlyMap<string, RuntimePort>;
|
|
state<T = unknown>(portId: string): StatePort<T>;
|
|
edge(portId: string): EdgePort;
|
|
interface(portId: string): InterfacePort;
|
|
constructor(portId: string): ConstructorPort;
|
|
};
|
|
export type RuntimeSession = {
|
|
id: string;
|
|
run<T>(work: (context: RuntimeContext) => Promise<T>): Promise<T>;
|
|
/** Close the external resource first, then close its host retention/session. */
|
|
close(): Promise<void>;
|
|
};
|
|
export declare class RuntimeAuthorityError extends Error {
|
|
readonly retryable: boolean;
|
|
constructor(message: string);
|
|
}
|
|
export declare const createRuntimeContext: (camino: CaminoClient, orch: OrchClient, request: RuntimeRequest) => RuntimeContext;
|
|
export type RuntimeHandler = (context: RuntimeContext) => unknown | Promise<unknown>;
|
|
export type DerivedHandler = {
|
|
kind: "derived";
|
|
get: RuntimeHandler;
|
|
};
|
|
export declare const derived: (get: RuntimeHandler) => DerivedHandler;
|
|
export declare const createPackageRuntimeRoutes: (config: {
|
|
packageRevisionId: string;
|
|
exports: Record<string, RuntimeHandler | DerivedHandler>;
|
|
caminoUrl?: string;
|
|
orchUrl?: string;
|
|
}) => (router: ConnectRouter) => ConnectRouter;
|
|
export declare const servePackageRuntime: (config: {
|
|
packageRevisionId: string;
|
|
exports: Record<string, RuntimeHandler | DerivedHandler>;
|
|
}) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
type RuntimeRequest = {
|
|
objectId: string;
|
|
input: Record<string, Value>;
|
|
dependencies: import("./quixos/refs_pb.js").InjectedDependency[];
|
|
};
|
|
//# sourceMappingURL=index.d.ts.map
|