import type { WorkspaceRef } from '../workspace/types'; import type { RunStatusType, RunStepTypeValue } from './schema'; export interface RunRecordData { /** Base-relative Solid resource id, e.g. `chat/default/2026/05/18/runs.ttl#run_x`. */ id: string; task?: string; thread: string; workspace: WorkspaceRef; status: RunStatusType; runner: string; prompt?: string; externalRunId?: string; leaseOwner?: string; leaseExpiresAt?: number; heartbeatAt?: number; cancelRequestedAt?: number; error?: string; metadata?: Record; createdAt: number; startedAt?: number; completedAt?: number; updatedAt: number; } export interface RunStepRecordData { /** Base-relative Solid resource id, e.g. `chat/default/2026/05/18/runs.ttl#step_x`. */ id: string; /** Denormalized Run resource id for lookup; semantic relation is `run`. */ runId: string; run: string; type: RunStepTypeValue | string; message?: string; data?: Record; createdAt: number; } export interface RunListOptions { task?: string; thread?: string; workspace?: WorkspaceRef; status?: RunStatusType; limit?: number; } export type RunCommandKind = 'chat' | 'task'; export interface RunCommandProjection { commandKind: RunCommandKind; surfaceId: string; } export interface RunStore { saveRun(run: RunRecordData, context: TContext): Promise; loadRun(id: string, context: TContext): Promise; listRuns(options: RunListOptions, context: TContext): Promise; appendRunStep(event: RunStepRecordData, context: TContext): Promise; loadRunSteps(runId: string, context: TContext): Promise; claimRun?(input: { runId: string; leaseOwner: string; leaseExpiresAt: number; now: number; }, context: TContext): Promise; } export declare function isClaimableRunStatus(status: RunRecordData['status']): boolean; export declare function hasActiveRunLease(run: Pick, now: number): boolean; export declare function canClaimRun(run: Pick, input: { leaseOwner: string; now: number; }): boolean; export declare function isBaseRelativeResourceId(value: string | null | undefined): value is string; export declare function isRunResourceId(value: string | null | undefined): value is string; export declare function deriveRunCommandProjection(runId: string | null | undefined): RunCommandProjection | undefined; /** * Extracts the local template fragment for display or protocol compatibility. * Do not use this to turn a canonical resource id back into the durable `id`. */ export declare function extractResourceLocalId(resourceId: string): string; export declare function datePathFromTimestamp(timestamp: number | undefined): { yyyy: string; MM: string; dd: string; }; export declare function generateRunResourceId(input: { key: string; parentKind: RunCommandKind; parentKey: string; createdAt?: number; }): string; export declare function generateRunStepResourceId(input: { key: string; runId?: string; parentKind?: RunCommandKind; parentKey?: string; createdAt?: number; }): string; export declare function buildRunResourceId(input: string | { id: string; createdAt?: number; }): string; export declare function buildRunStepResourceId(input: string | { id: string; runId?: string; createdAt?: number; }): string; export declare function resolveRunUrn(runId: string): string; export declare function resolveDataResource(podBaseUrl: string, resourceId: string): string;