Implement workspace evolution, migrations, and runtime continuity
Enable evolution by default for source-backed workspaces. Add stable conformance ownership, semantic-major review, candidate typechecking, and durable fenced cutover with explicit migrations and forward recovery. Independently supervise package runtimes so unchanged resource owners keep their processes and connections across cutover. Add scoped invocation authority, resource sessions, and typed callback rebinding. Wire opaque object references through generated bindings and RPCs. Add canonical relationship sets, keyed maps, and ordered lists with scoped transactional mutations, revision checks, and inverse consistency. Support planned cascade deletion, protection, tombstones, and lifecycle foundations. Add journaled structural edits, package/function/migration scaffolding, managed repository creation, and resumable bottom-up dependency pin publication. Document lifetime boundaries, revision pinning, prototype compatibility policy, commands, and deferred work. Validate with 210 tests, user-systemd process/connection continuity, generated-package TypeScript checks, and Nix host/protocol checks. TTL handoff, physical reclamation, general multi-step migrations, and root-systemd migration isolation acceptance remain deferred.
This commit is contained in:
Vendored
+34
-9
@@ -1,5 +1,8 @@
|
||||
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";
|
||||
@@ -15,9 +18,7 @@ export type RuntimeDependency = {
|
||||
attachmentId: string;
|
||||
projectionId: string;
|
||||
};
|
||||
export declare const objectRef: (objectId: string) => {
|
||||
$quixosRef: string;
|
||||
};
|
||||
export declare const objectRef: (reference: QxObjectRef) => QxObjectRef<string>;
|
||||
export declare const liveValue: (value: Value) => {
|
||||
$quixosValue: Value;
|
||||
};
|
||||
@@ -35,23 +36,37 @@ export type StatePort<T = unknown> = {
|
||||
export type EdgePort = {
|
||||
edgeTypeId: string;
|
||||
projectionId: string;
|
||||
resolve(): Promise<string[]>;
|
||||
connect(targetObjectId: string): Promise<void>;
|
||||
disconnect(targetObjectId: string): Promise<void>;
|
||||
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: string;
|
||||
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<string>;
|
||||
construct(input?: Record<string, unknown>): Promise<QxObjectRef>;
|
||||
};
|
||||
export type RuntimePort = StatePort | EdgePort | InterfacePort | ConstructorPort;
|
||||
export type RuntimeContext = {
|
||||
objectId: string;
|
||||
/** 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>;
|
||||
@@ -60,6 +75,16 @@ export type RuntimeContext = {
|
||||
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 = {
|
||||
|
||||
Reference in New Issue
Block a user