/** * routes/fleet.ts * * `fleet.snapshot` / `fleet.list` gateway-method handlers (see CHANGELOG 1.0.0) over the * ALREADY daemon-resident `ProcessRegistry` (createProcessRegistry(), * ../../runtime/fleet/registry.ts:204, constructed + exposed on * RuntimeServices at ../../runtime/services.ts:712/:242). This is thin verb * registration, not new machinery: every call is a direct pass-through to * `registry.query()`, the registry's own cheap aggregate-on-read scan. * * Wired via `GatewayMethodCatalog.register(descriptor, handler)`, the SAME * mechanism the plugin API already uses (../../plugins/api.ts * `registerGatewayMethod`), rather than a new REST path in the external * `@pellux/goodvibes-daemon-sdk` package or a change to * ../../daemon/http/router.ts (both out of this brief's file ownership). * The registered handler is reached over real HTTP today via the existing * generic invoke endpoint `POST /api/control-plane/methods/{methodId}/invoke` * (daemon-sdk/src/control-routes.ts `invokeGatewayMethod`). * * Descriptors live in ../method-catalog-control-core.ts (so * `buildOperatorContract` / api.md / contract-artifact generation see them * whether or not a handler has been attached yet); `registerFleetGatewayMethods` * below attaches the handler at RuntimeServices construction time * (../../runtime/services.ts, right after `processRegistry` exists). */ import type { GatewayMethodCatalog } from '../method-catalog.js'; import type { GatewayMethodHandler } from '../method-catalog-shared.js'; import type { ProcessRegistry } from '../../runtime/fleet/types.js'; import type { FleetArchiveView } from '../../runtime/fleet/archive.js'; import type { AttemptJudgment, AttemptPickResult, HeldMergeGroup } from '../../orchestration/types.js'; /** * `fleet.snapshot` payload cap: the registry's * `query()` is a cheap O(n) in-memory scan, but the wire response must not * grow unbounded with fleet size. Nodes beyond this cap are dropped (newest * activity first is NOT guaranteed here, see `truncated`/`totalCount` so a * caller that needs the full set knows to page via `fleet.list` instead). */ export declare const FLEET_SNAPSHOT_NODE_CAP = 2000; export declare const FLEET_LIST_DEFAULT_LIMIT = 100; export declare const FLEET_LIST_MAX_LIMIT = 500; /** Structural dep, only the read surface `fleet.*` needs. */ export type FleetQueryOnlyRegistry = Pick; export declare function createFleetSnapshotHandler(registry: FleetQueryOnlyRegistry): GatewayMethodHandler; export declare function createFleetListHandler(registry: FleetQueryOnlyRegistry): GatewayMethodHandler; /** Registry surface for the archive verbs, optional so a runtime without the archive layer degrades honestly. */ export type FleetArchiveCapableRegistry = FleetQueryOnlyRegistry & Partial; /** Registry surface fleet.observed.steer needs, read one node, steer it. */ export type FleetSteerCapableRegistry = Pick; /** * fleet.observed.steer handler, the drill-in steer of an observed foreign * agent. Scoped to 'observed-external' rows by construction: an unknown id is a * 404, and steering a non-observed kind through this verb is refused (400) so it * can never become a back door to a native agent's steer path. The steer itself * rides the foreign session's own channel (registry dispatch → tmux send-keys). */ export declare function createFleetObservedSteerHandler(registry: FleetSteerCapableRegistry): GatewayMethodHandler; export declare function createFleetArchiveHandler(registry: FleetArchiveCapableRegistry): GatewayMethodHandler; export declare function createFleetUnarchiveHandler(registry: FleetArchiveCapableRegistry): GatewayMethodHandler; export declare function createFleetArchiveFinishedHandler(registry: FleetArchiveCapableRegistry): GatewayMethodHandler; export declare function createFleetArchivedListHandler(registry: FleetArchiveCapableRegistry): GatewayMethodHandler; /** * The best-of-N surface the fleet verbs need, the orchestration engine's held- * merge methods. Optional at registration: a runtime with no orchestration * engine simply doesn't register the fleet.attempts.* verbs (graceful degrade). */ export interface FleetAttemptsController { listHeldMergeGroups(workstreamId?: string): Promise; /** The task-graph snapshot (fleet.graph.get), nodes/edges/pool/stalled tells. Optional for narrower embeds. */ getGraphSnapshot?(workstreamId: string): import('../../orchestration/graph-dynamics.js').WorkstreamGraphSnapshot | null; pickAttemptWinner(groupId: string, winnerItemId: string): Promise; proposeAttemptWinner(groupId: string): Promise; /** Conflict surface (optional, narrower embeds may wire attempts without conflicts). */ listWorkstreams?(): ReadonlyArray<{ readonly id: string; readonly items: readonly ConflictWorkItemSlice[]; }>; stampConflictSession?(itemId: string, sessionId: string): boolean; retryItemIntegration?(itemId: string): Promise<'merged' | 'conflict' | 'not-conflicted'>; } export declare function createFleetAttemptsListHandler(controller: FleetAttemptsController): GatewayMethodHandler; export declare function createFleetAttemptsPickHandler(controller: FleetAttemptsController): GatewayMethodHandler; /** The conflicted-item slice the conflicts verbs read (the engine satisfies it structurally). */ export interface ConflictWorkItemSlice { readonly id: string; readonly title: string; readonly mergeState?: string | undefined; readonly worktreePath?: string | undefined; readonly worktreeBranch?: string | undefined; readonly conflictFiles?: readonly string[] | undefined; readonly conflictSessionId?: string | undefined; } export interface FleetConflictsDeps { readonly listWorkstreams: () => ReadonlyArray<{ readonly id: string; readonly items: readonly ConflictWorkItemSlice[]; }>; readonly stampConflictSession: (itemId: string, sessionId: string) => boolean; /** * Start the seeded resolution session INSIDE the kept tree (the CI * fix-session machinery): the seed carries the tree path, branch, and the * structured conflict list. Resolves to the REAL session id, or an honest error. */ readonly startResolutionSession: (seed: { readonly workstreamId: string; readonly itemId: string; readonly title: string; readonly worktreePath: string; readonly branch: string | undefined; readonly files: readonly string[]; }) => Promise<{ sessionId: string; } | { error: string; }>; } export declare function createFleetConflictsListHandler(deps: FleetConflictsDeps): GatewayMethodHandler; export declare function createFleetConflictsResolveHandler(deps: FleetConflictsDeps): GatewayMethodHandler; export declare function createFleetAttemptsJudgeHandler(controller: FleetAttemptsController): GatewayMethodHandler; /** * Attach the `fleet.*` handlers to the descriptors * already registered (without a handler) from * ../method-catalog-fleet.ts's static builtin array. Call once, at * RuntimeServices construction time, after `processRegistry` exists. * A missing descriptor (contract/registration drift) is a silent no-op * rather than a throw, construction must never fail because a wire verb * failed to register; the operator-contract gates catch a real drift. */ /** fleet.graph.get, the surface-facing task graph of one workstream. */ export declare function createFleetGraphGetHandler(controller: FleetAttemptsController): GatewayMethodHandler; export declare function registerFleetGatewayMethods(catalog: GatewayMethodCatalog, registry: FleetArchiveCapableRegistry & FleetSteerCapableRegistry, attempts?: FleetAttemptsController): void; //# sourceMappingURL=fleet.d.ts.map