|
|
|
@@ -0,0 +1,369 @@
|
|
|
|
|
export interface Config {
|
|
|
|
|
mode: 'demo' | 'compatible'; baseUrl: string; model: string;
|
|
|
|
|
contextLimit: number; maxSteps: number; maxOutputTokens: number; hasKey: boolean;
|
|
|
|
|
maxRunDurationMs: number; maxRunTokens: number; maxTaskTokens: number;
|
|
|
|
|
modelResponseTimeoutMs?: number; modelStreamIdleTimeoutMs?: number;
|
|
|
|
|
}
|
|
|
|
|
export interface EnvironmentFile { path:string;sha256:string;bytes:number }
|
|
|
|
|
export interface DependencyTree { status:string;files:number;bytes:number;sha256:string|null;message?:string }
|
|
|
|
|
export interface NodeEnvironmentRuntime {status:string;node:EnvironmentFile&{version:string};npm:(EnvironmentFile&{version:string;manifest:EnvironmentFile})|null}
|
|
|
|
|
export interface NodeEnvironmentBinding {kind:'node';identity:string;dependencyInputs:string;status:string;installed:DependencyTree;declarations:EnvironmentFile[];runtime:NodeEnvironmentRuntime}
|
|
|
|
|
export interface EnvironmentDiagnostic {id:string;taskId:string;runId:string;artifactId:string;artifactSha256:string;inspectedAt:string;status:string;
|
|
|
|
|
node:(NodeEnvironmentBinding&{manager:string;lockVersion:number|null;packageCount:number;missing:string[];mismatched:string[];sources:string[];issues:string[];preparable:boolean})|null;
|
|
|
|
|
python:{status:string;framework?:string;runtime:{version:string|null;logicalExecutable:string|null};pytest:{version:string|null};message:string}|null}
|
|
|
|
|
export interface EnvironmentPlan {id:string;taskId:string;runId:string;status:string;root:string;registry:string;scripts:'skip'|'allow';offline:boolean;packageCount:number;timeoutMs:number;fingerprint:string;
|
|
|
|
|
invocation:{executable:string;args:string[]};lifecycle:{name:string;script:string}[];installScriptPackages:string[]}
|
|
|
|
|
export interface EnvironmentJob {id:string;taskId:string;runId:string;planFingerprint:string;status:string;summary?:string;finishedAt?:string;requiresVerification:boolean;
|
|
|
|
|
logExcerpt?:string;logArtifactId?:string;after?:NodeEnvironmentBinding;result?:{exitCode:number|null;durationMs:number;truncated?:boolean};reconciliation?:{artifactId:string;sha256:string}}
|
|
|
|
|
export interface PreviewPlan {id:string;taskId:string;runId:string;root:string;url:string;port:number;fingerprint:string;status:string;nodeIdentity:string;script:string;timeoutMs:number;invocation:{executable:string;args:string[]}}
|
|
|
|
|
export interface PreviewJob {id:string;taskId:string;runId:string;planId:string;planFingerprint:string;status:string;url:string;port:number;summary?:string;logExcerpt?:string;logArtifactId?:string;requiresVerification?:boolean;reconciliation?:{at:string;result:string};process?:{pid:number;treeTermination?:string};readiness?:{observedAt:string;sha256:string}}
|
|
|
|
|
export interface ExecutionSnapshot {environmentDiagnostics?:EnvironmentDiagnostic[];environmentPlans?:EnvironmentPlan[];environmentJobs?:EnvironmentJob[];previewPlans?:PreviewPlan[];previewJobs?:PreviewJob[]}
|
|
|
|
|
export interface BrowsingTab {id:string;sessionId:string;projectId:string;taskId:string;runId:string;profileId:string;status:string;url:string;title?:string;origins:string[];interact:boolean;persistent:boolean;revision?:string;observationId?:string;previewOrigin?:string;error?:string}
|
|
|
|
|
export interface BrowsingObservation {id:string;tabId:string;revision:string;url:string;title:string;text:string;createdAt:string;scope:{complete:boolean};controls:{ref:string;tag:string;type:string;label:string;disabled:boolean;restricted?:boolean;href?:string}[];screenshotArtifactId:string;screenshotSha256:string;artifactId:string}
|
|
|
|
|
export interface BrowsingAction {id:string;tabId:string;kind:string;status:string;createdAt:string;input:{action?:string;ref?:string;value?:string;url?:string};error?:string;artifactId?:string;downloadArtifactId?:string;downloadSha256?:string;reconciliation?:{at:string}}
|
|
|
|
|
export interface BrowsingSnapshot {available:boolean;tabs:BrowsingTab[];observations:BrowsingObservation[];actions:BrowsingAction[];profiles:{id:string;origins:string[];status:string}[]}
|
|
|
|
|
export interface ExecutionSnapshot {browsingTabs?:BrowsingTab[];browsingActions?:BrowsingAction[]}
|
|
|
|
|
export interface CheckPlan {environment?:NodeEnvironmentBinding|null}
|
|
|
|
|
export interface CheckJob {environment?:NodeEnvironmentBinding|null}
|
|
|
|
|
export interface Approval {environmentPlanId?:string}
|
|
|
|
|
export interface Approval {browsingTabId?:string;mcpRegistrationId?:string}
|
|
|
|
|
export interface Approval {environmentSummary?:Pick<EnvironmentPlan,'root'|'registry'|'scripts'|'offline'|'timeoutMs'|'lifecycle'|'installScriptPackages'>}
|
|
|
|
|
export interface NodeEnvironmentBinding {preparation?:{jobId:string;planId:string;sessionId:string;logArtifactId:string;logSha256:string}|null}
|
|
|
|
|
export interface ModelSelection { type: 'legacy' | 'connection' | 'pool'; id: string; name: string }
|
|
|
|
|
export interface WorkspaceOrigin { id: string; sourceProjectId: string; sourceSessionId: string; sourceRoot: string; sourceWorkspaceId: string | null; baseCommit: string; branch: string; commonGitDir: string; gitDir: string; fingerprint: string }
|
|
|
|
|
export interface WorkspaceIdentity { kind: 'local-project' | 'managed-worktree'; projectId: string; root: string; workspaceId?: string; sourceProjectId?: string; sourceSessionId?: string; sourceRoot?: string; sourceWorkspaceId?: string | null; baseCommit?: string; branch?: string; commonGitDir?: string; gitDir?: string; fingerprint?: string }
|
|
|
|
|
export interface Project { id: string; root: string; name: string; addedAt: string; workspace?: WorkspaceOrigin }
|
|
|
|
|
export interface WorkspaceRecord {
|
|
|
|
|
id: string; projectId: string; sessionId: string; taskId: string | null; runId: string | null; label: string; root: string; branch: string;
|
|
|
|
|
childProjectId: string; childSessionId: string; status: string; phase: string; fingerprint: string;
|
|
|
|
|
createdAt: string; updatedAt: string; finishedAt: string | null; creationAttempted: boolean; requiresVerification: boolean;
|
|
|
|
|
ownerPid: number | null; gitPid: number | null; summary: string;
|
|
|
|
|
source: { root: string; head: string; branch: string; dirty: boolean; changedPathCount: number; changedPaths: { status: string; path: string; originalPath?: string }[]; fingerprint: string; committedBytes: number; treeFiles: { mode: string; blob: string; bytes: number; path: string }[] };
|
|
|
|
|
observation?: { rootState: string; branchHead: string | null; workspaceHead: string | null; workspaceBranch: string | null; registered: boolean; clean: boolean; contentsVerified: boolean; sourcePreserved: boolean; ready: boolean; fingerprint: string; observedAt: string; problems: string[] } | null;
|
|
|
|
|
}
|
|
|
|
|
export interface SessionBrief { id: string; projectId: string; title: string; status: string; revision: number; updatedAt: string; changeCount: number }
|
|
|
|
|
export interface Message { id: string; role: string; content: string; createdAt: string; attachmentIds?: string[] }
|
|
|
|
|
export interface InputAttachment { id:string;name:string;status:string;mediaType:string;taskId:string|null;runId:string|null;sha256:string;bytes:number;sentSha256:string;sentBytes:number;width:number;height:number;sentWidth:number;sentHeight:number;orientation:number }
|
|
|
|
|
export interface BudgetPause { reason:string;requiredInputTokens?:number;contextLimit?:number;inputBudget?:number;outputReservation?:number;safetyTokens?:number;runRemainingTokens?:number|null;taskRemainingTokens?:number|null;imageReservationTokens?:number;breakdown?:Record<string,number> }
|
|
|
|
|
export interface Run { budgetPause?:BudgetPause }
|
|
|
|
|
export interface BudgetPause { originalInputTokens?:number;transportReservationTokens?:number }
|
|
|
|
|
export interface BudgetPause { limitingReason?:string;pauseKind?:string }
|
|
|
|
|
export interface BudgetPause { modelFailure?:RuntimeFailure }
|
|
|
|
|
export interface TokenBudgetCounter { maximumTokens:number;reportedTokens:number;unknownRequests:number;estimatedUnknownTokens:number;accountedTokens:number;remainingTokens:number|null;exceededTokens:number }
|
|
|
|
|
export interface BudgetPause { remainingTokens?:number;tokenReservation?:{schemaVersion:number;reservedTokens:number;routes:{sources:{runId:string;attemptId:string}[]}[]};tokenAccounting?:{schemaVersion:number;singleInFlightResponseMayExceed:boolean;run:TokenBudgetCounter;task:TokenBudgetCounter} }
|
|
|
|
|
export interface ToolEvent {
|
|
|
|
|
id: string; kind: string; label: string; phase: string; createdAt: string; tool?: string;
|
|
|
|
|
input?: Record<string, unknown>; output?: string; durationMs?: number; startedAt?: string; finishedAt?: string;
|
|
|
|
|
source?: string; attempts?: number; diagnostic?: RuntimeFailure; exitCode?: number;
|
|
|
|
|
taskId?: string; runId?: string; invocationId?: string; artifactId?: string;
|
|
|
|
|
connectionId?: string; actualModel?: string;
|
|
|
|
|
stream?: { status: string; protocol?: string; sequence?: number; bytes?: number; textCharacters?: number; textPreview?: string; toolFragments?: number };
|
|
|
|
|
}
|
|
|
|
|
export interface DiffPart { value: string; count: number; added?: boolean; removed?: boolean }
|
|
|
|
|
export interface Change {
|
|
|
|
|
taskId?: string | null; runId?: string | null;
|
|
|
|
|
changeSetId?: string; rolledBackAt?: string;
|
|
|
|
|
id: string; path: string; reason: string; status: string; baseExists: boolean; baseSha256: string | null;
|
|
|
|
|
baseContent: string; content: string; sha256: string; diff: DiffPart[]; additions: number; deletions: number;
|
|
|
|
|
createdAt: string; appliedAt?: string;
|
|
|
|
|
editKind?: 'exact-patch';
|
|
|
|
|
patch?: { edits: number; lineEnding: 'lf' | 'crlf' | 'mixed'; preservedBom: boolean; ranges: { startLine: number; endLine: number; anchorSha256: string; replacementSha256: string }[] };
|
|
|
|
|
}
|
|
|
|
|
export interface Approval { id: string; command: string; reason: string; cwd: string; shell?: string; status: string; createdAt: string; browserPlanId?: string; browserSummary?: { buildDirectory: string; buildSha256: string; viewport: { width: number; height: number }; steps: BrowserStep[] }; checkPlanId?: string; checkScripts?: { name: string; script: string; lifecycle: { name: string; script: string }[]; python?: { mode: string; runtime: PythonRuntimeIdentity } }[] }
|
|
|
|
|
export interface Session {
|
|
|
|
|
id: string; projectId: string; title: string; status: string; revision: number; updatedAt: string; createdAt: string;
|
|
|
|
|
messages: Message[]; events: ToolEvent[]; changes: Change[]; approvals: Approval[];
|
|
|
|
|
compactions: number; estimatedTokens: number; usage: { prompt_tokens?: number; completion_tokens?: number } | null;
|
|
|
|
|
archived: boolean; recoveryNotice?: string | null; executionMode?: string;
|
|
|
|
|
failure?: RuntimeFailure | null; lastFailure?: RuntimeFailure | null;
|
|
|
|
|
execution?: ExecutionSnapshot;
|
|
|
|
|
inputAttachments?: InputAttachment[];
|
|
|
|
|
}
|
|
|
|
|
export interface RuntimeFailure {
|
|
|
|
|
modelIdentity?: import('../shared/contracts/model-identity.mjs').ModelIdentity;
|
|
|
|
|
source: string; stage: string; kind: string; title: string; message: string; messageId?: string;
|
|
|
|
|
detail?: string; suggestion?: string; attempts?: number; httpStatus?: number; code?: string | null;
|
|
|
|
|
occurredAt?: string; retryable?: boolean; historical?: boolean; endpoint?: string; model?: string;
|
|
|
|
|
requestUrl?: string; responseUrl?: string | null; redirected?: boolean; redirectMode?: string;
|
|
|
|
|
origin?: 'upstream' | 'local'; route?: string; type?: string | null; wireAttemptId?: string; upstreamRequestId?: string | null; retryAfterMs?: number; retryDecision?: string; limitReason?: string | null;
|
|
|
|
|
upstream?: { schema: number; scope: string; httpStatus?: number; code?: string | null; type?: string | null; message?: string | null; param?: string | null;
|
|
|
|
|
requestId?: string | null; responseId?: string | null; eventType?: string | null; reason?: string | null; headers?: Record<string, string>; retryAfter?: string | null;
|
|
|
|
|
retryAfterMs?: number | null; retryAfterInvalid?: boolean; rawPreview?: string; previewTruncated?: boolean; shortenedFields?: string[];
|
|
|
|
|
artifactId?: string; artifactSha256?: string; artifactScope?: string; sessionId?: string;
|
|
|
|
|
capture?: { scope: string; receivedBytes: number; capturedBytes: number; storedBytes: number; retention?: string; complete: boolean; truncated: boolean; interrupted: boolean; redacted: boolean; sha256: string; capturedRange: number[] } };
|
|
|
|
|
}
|
|
|
|
|
export interface ExecutionEnvironment { platform: string; node: string; shell: string; encoding: string; shellSyntax: string }
|
|
|
|
|
export interface RuntimeDiagnostics {
|
|
|
|
|
version: string; environment: ExecutionEnvironment;
|
|
|
|
|
projectCache?: ProjectCacheStatus;
|
|
|
|
|
connection: { mode: string; endpoint: string; model: string; hasKey: boolean; lastRequest: { status?: string; attempts?: number; durationMs?: number } | null };
|
|
|
|
|
session: {
|
|
|
|
|
project: { name: string; root: string }; session: { id: string; status: string; revision: number };
|
|
|
|
|
lastFailure: RuntimeFailure | null;
|
|
|
|
|
changes: { id: string; path: string; status: string }[];
|
|
|
|
|
recentTools: { tool: string; phase: string; outputExcerpt: string; exitCode: number | null }[];
|
|
|
|
|
} | null;
|
|
|
|
|
}
|
|
|
|
|
export interface FileEntry { path: string; name: string; kind: string; bytes: number }
|
|
|
|
|
export interface OpenFile { path: string; content: string; sha256: string; bytes: number; bom?: boolean }
|
|
|
|
|
export interface Bootstrap { token: string; version: string; config: Config; modelSelection?: ModelSelection; projects: Project[]; sessions: SessionBrief[]; exampleProjectId: string | null; environment?: ExecutionEnvironment; eventCursor?: number; storage?: { engine: string; schemaVersion: number }; runtimeRoot?: string }
|
|
|
|
|
export interface ResearchDoc { id: string; title: string; description: string }
|
|
|
|
|
|
|
|
|
|
export type CodeQueryKind = 'all' | 'symbols' | 'imports' | 'files';
|
|
|
|
|
export interface ProjectCacheMetrics {
|
|
|
|
|
enabled: boolean; persistent: boolean; checkedAt: string; sourceVerified: boolean; origin: string; invalidation: string | null;
|
|
|
|
|
reusedFiles: number; rebuiltFiles: number; parsedFiles: number; invalidatedFiles: number; removedFiles: number;
|
|
|
|
|
verifiedFiles: number; verificationPasses: number; sourceBytesRead: number; parseMs: number; durationMs: number;
|
|
|
|
|
stored: boolean; storageReason: string; evictedProjects: number; diskProjects: number; diskBytes: number;
|
|
|
|
|
maximumProjects: number; maximumBytes: number; maximumEntryBytes: number; error: string | null;
|
|
|
|
|
}
|
|
|
|
|
export interface ProjectCacheStatus {
|
|
|
|
|
enabled: boolean; persistent: boolean; diskProjects: number; diskBytes: number; maximumProjects: number; maximumBytes: number;
|
|
|
|
|
maximumEntryBytes: number; error: string | null; memoryProjects?: number; memoryBytes?: number; pending?: number;
|
|
|
|
|
latest?: ProjectCacheMetrics | null; clearedAt?: string; removedProjects?: number;
|
|
|
|
|
}
|
|
|
|
|
export interface CodeIndexSummary {
|
|
|
|
|
schemaVersion: number; projectId: string; projectName: string; parser: string; generatedAt: string; sourceFingerprint: string; indexFingerprint: string;
|
|
|
|
|
coverage: { snapshotComplete: boolean; fileCount: number; symbolCount: number; importCount: number; astFiles: number; pythonCandidateFiles: number; unindexedFiles: number; truncated: boolean; maximumFileBytes: number; maximumSymbols: number };
|
|
|
|
|
refresh: { updatedFiles: number; reusedFiles: number; removedFiles: number };
|
|
|
|
|
sourceScope: { complete: boolean; scannedFiles: number; bytes: number; maximumFiles: number; maximumBytes: number; excludedFiles: number; note: string };
|
|
|
|
|
warnings: { path: string; sha256: string; status: string; message: string; line: number }[]; notes: string[];
|
|
|
|
|
cache?: ProjectCacheMetrics;
|
|
|
|
|
}
|
|
|
|
|
export interface CodeResult {
|
|
|
|
|
resultKind: 'symbol' | 'import' | 'file'; path: string; line: number; sha256: string; name: string; kind: string;
|
|
|
|
|
qualifiedName?: string; signature?: string; evidenceMethod: string; exported?: boolean; status?: string; target?: string | null;
|
|
|
|
|
}
|
|
|
|
|
export interface CodeQuery { query: string; kind: CodeQueryKind; results: CodeResult[]; totalMatches: number; truncated: boolean; index: CodeIndexSummary }
|
|
|
|
|
|
|
|
|
|
export interface ModelSnapshot { mode: string; model: string; baseUrl: string; verified?: boolean; contextLimit?: number; maxOutputTokens?: number; routing?: { type: string; name: string; members: { id: string; name: string; model: string; baseUrl: string }[] } }
|
|
|
|
|
export interface ModelConsumption { modelIdentity?: import('../shared/contracts/model-identity.mjs').ModelIdentity; attemptId: string; requestId: string | null; connectionId: string | null; connectionName: string | null; model: string; endpoint: string; protocol: string; usageStatus: string; outcome: string; usage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number } | null; estimatedUnknownTokens: number }
|
|
|
|
|
export interface Usage { requests: number; inputTokens: number; outputTokens: number; totalTokens: number; unknownRequests: number; estimatedUnknownTokens: number }
|
|
|
|
|
export interface RunBudget { maxSteps: number; maxDurationMs: number; maxTokens: number; maxTaskTokens: number }
|
|
|
|
|
export interface RunBrief { id: string; taskId: string; status: string; startedAt: string; finishedAt: string | null; steps: number; toolCalls: number; usage: Usage; stopReason: string | null; model: ModelSnapshot; budget: RunBudget; resumeOf: string | null; workspaceIdentity?: WorkspaceIdentity }
|
|
|
|
|
export interface Run extends RunBrief { engine: string; review?: { kind: string; planId: string; status: string; preparedAt?: string; resolvedAt?: string }; currentContextPlanId?: string; checkpoint: { completedToolIds: string[]; pendingToolIds: string[]; requiresVerification: string[] } }
|
|
|
|
|
export interface TurnObservation {
|
|
|
|
|
stepId: string | null; stepIndex: number | null; phase: string; classification: string; reasons: string[]; truncated: boolean;
|
|
|
|
|
delta: { read_characters: number; repeated_reads: number; changed_files: number; check_results: number; requirement_evidence: number; new_failures: number; repeated_failures: number };
|
|
|
|
|
waiting: { kind: string; id: string }[];
|
|
|
|
|
}
|
|
|
|
|
export interface Run { progressShadow?: { mode: 'shadow'; observations: number; truncated: boolean; turns: TurnObservation[] }; progressShadowArtifactIds?: string[]; progressShadowError?: { kind: string; phase: string } }
|
|
|
|
|
export interface RunBrief { purpose?: 'execution' | 'diagnostic'; source?: string; taskStatusBefore?: string; consumption?: ModelConsumption[] }
|
|
|
|
|
export interface TaskCheckpoint {
|
|
|
|
|
id: string; sessionId: string; projectId: string; taskId: string; runId: string; createdAt: string;
|
|
|
|
|
status: string; artifactId: string; sha256: string; sourceFingerprint: string; requirementsSha256: string;
|
|
|
|
|
counts: { tools: number; completed: number; unknown: number; pendingChanges: number };
|
|
|
|
|
}
|
|
|
|
|
export interface TaskCheckpointView {
|
|
|
|
|
checkpoint: TaskCheckpoint; integrity: string; checkedAt: string; resumable: boolean; reasons: string[]; currentSourceFingerprint: string;
|
|
|
|
|
}
|
|
|
|
|
export interface ContextPlan {
|
|
|
|
|
id: string; sessionId: string; projectId: string; taskId: string; runId: string; stepId: string; requestIndex?: number; status: string;
|
|
|
|
|
createdAt: string; finishedAt: string | null; requestSha256: string; requestBytes: number; requestArtifactId: string; artifactId: string;
|
|
|
|
|
estimatedInputTokens: number; beforeInputTokens: number; beforeBytes: number; estimateMethod: string;
|
|
|
|
|
originalMessages: number; retainedMessages: number; archivedGroups: number; historyIndexArtifactId: string | null; historyIndexSha256: string | null;
|
|
|
|
|
workingSetArtifactId?: string | null; workingSetSha256?: string | null; workingSetEntries?: number;
|
|
|
|
|
workingSetViewVersion?: number; workingRetentionTokens?: number;
|
|
|
|
|
latestToolsArtifactId?: string | null; latestToolsSha256?: string | null; latestToolsEntries?: number;
|
|
|
|
|
projectMemoryArtifactId?: string | null; projectMemorySha256?: string | null; projectMemoryEntries?: number;
|
|
|
|
|
skillCatalogArtifactId?: string | null; skillCatalogSha256?: string | null; skillCatalogEntries?: number;
|
|
|
|
|
actualUsage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number } | null; requestAttempts: number; error?: string;
|
|
|
|
|
budget: { contextLimit: number; outputReservation: number; safetyTokens: number; inputBudget: number; targetInputTokens: number; runRemainingTokens: number | null; taskRemainingTokens: number | null };
|
|
|
|
|
}
|
|
|
|
|
export interface ContextHistoryGroup {
|
|
|
|
|
index: number; startMessage: number; endMessage: number; sha256: string; roles: string[];
|
|
|
|
|
tools?: { call_id: string; name: string; result: { status?: string; path?: string; requires_verification?: boolean }; recorded_state?: string; requires_verification?: boolean; result_artifact_id?: string }[];
|
|
|
|
|
archive: { artifact_id: string; sha256: string; bytes: number; chunks?: number };
|
|
|
|
|
}
|
|
|
|
|
export interface ContextHistory { planId: string; groups: ContextHistoryGroup[]; offset: number; totalGroups: number; truncated: boolean }
|
|
|
|
|
export interface Task { id: string; goal: string; status: string; instructions: { id: string; content: string; createdAt: string; source?: string }[]; usage: Usage; budget: { maxTokens: number }; verification: { status: string; checkJobId: string | null }; origin: string; workspaceIdentity?: WorkspaceIdentity }
|
|
|
|
|
export interface Task { contract?: { schemaVersion: number; goal: string; checks: string; inheritedFromTaskId?: string }; delivery?: { status: string; paths: string[]; at: string; checks: string } }
|
|
|
|
|
export interface FileResultView {
|
|
|
|
|
id: string; taskId: string; runId: string; source: string; reason: string; createdAt: string; verification: 'current' | 'stale' | 'invalid'; error: string | null;
|
|
|
|
|
contractArtifactId: string; contractSha256: string; files: { path: string; sha256: string; bytes: number; origin: { taskId: string; runId: string; resultId: string; sha256: string } | null }[];
|
|
|
|
|
}
|
|
|
|
|
export interface ExecutionSnapshot { fileResults?: Omit<FileResultView, 'verification' | 'error'>[] }
|
|
|
|
|
export interface Artifact { id: string; taskId: string | null; runId: string | null; kind: string; mediaType: string; sha256: string; bytes: number; createdAt: string; status: string }
|
|
|
|
|
export interface ArtifactPreview extends Artifact { content: string; offset: number; totalCharacters: number; truncated: boolean }
|
|
|
|
|
export interface ProjectMemorySource { kind: 'project' | 'file' | 'artifact' | 'session' | 'task' | 'run'; id?: string; path?: string; sha256?: string; sourceFingerprint: string; label?: string; artifactKind?: string }
|
|
|
|
|
export interface ProjectMemory { schemaVersion: number; id: string; projectId: string; sessionId: string; taskId: string | null; runId: string | null; title: string; content: string; tags: string[]; source: ProjectMemorySource; sourceFingerprint: string; status: 'current' | 'unverified' | 'expired' | 'archived'; createdAt: string; updatedAt: string; expiresAt: string | null; expiredAt?: string | null; expiredReason?: string | null; archivedAt?: string; origin: string }
|
|
|
|
|
export interface ProjectMemoryView { projectId: string; sourceFingerprint: string; inspectedAt: string; scope: { complete: boolean; scannedFiles: number; bytes: number; excludedFiles: number; maximumFiles: number; maximumBytes: number; note: string }; memories: ProjectMemory[]; summary: { current: number; unverified: number; expired: number; archived: number; total: number; invalidated: number }; rule: string }
|
|
|
|
|
export interface PythonRuntimeIdentity { status: string; logicalExecutable?: string | null; executable: string | null; version: string | null; sha256?: string; baseExecutable?: string; baseSha256?: string; message?: string; probe?: string }
|
|
|
|
|
export interface CheckResult { id: string; name: string; kind: string; command: string; status: string; exitCode: number | null; durationMs: number; tests: { total: number; passed: number; failed: number; skipped: number; cancelled: number } | null; logArtifactId?: string; reason?: string;
|
|
|
|
|
engine?: string; python?: { mode: string; runtime: PythonRuntimeIdentity; invocationId: string; inputSha256: string; runner: { path: string; sha256: string } };
|
|
|
|
|
compilation?: { total: number; compiled: number; failures: { path: string; line?: number; message: string }[] } | null; collectionErrors?: number | null;
|
|
|
|
|
metricsArtifactId?: string; metricsSha256?: string; inputArtifactId?: string; evidenceValidated?: boolean }
|
|
|
|
|
export interface CheckJob { id: string; taskId: string; runId: string; planId: string; status: string; startedAt: string; finishedAt: string | null; results: CheckResult[]; summary?: string; stale?: boolean; currentCheck?: { name: string; command: string; startedAt: string } | null; baseline?: { head: string | null; dirty: boolean; branch: string | null }; fingerprint?: string; sourceFingerprint?: string }
|
|
|
|
|
export interface CheckPlan { id: string; taskId: string; runId: string; status: string; fingerprint: string; createdAt: string; checks: { id: string; name: string; kind: string; command: string; script: string; lifecycle: { name: string; script: string }[]; python?: { mode: string; runtime: PythonRuntimeIdentity } }[]; project: { name: string; languages: string[]; packageManager: string; scripts?: { name: string; kind: string }[]; rules: { path: string; sha256: string; excerpt: string }[]; python?: { status: string; framework?: string; message?: string; checks?: { name: string; kind: string }[] }; scope: { complete: boolean; scannedFiles: number }; git: { available: boolean; head: string | null; dirty: boolean; branch: string | null; status: string } } }
|
|
|
|
|
export interface DeliveryPlan {
|
|
|
|
|
preparedBy?: 'agent' | 'user';
|
|
|
|
|
id: string; sessionId: string; projectId: string; taskId: string; runId: string; status: string; message: string;
|
|
|
|
|
author: { name: string; email: string; source: string }; baseline: { head: string; branch: string; reference: string };
|
|
|
|
|
paths: string[]; files: { path: string; changeIds: string[]; mode: string; sha256: string; additions: number; deletions: number; reason: string; diff: string }[];
|
|
|
|
|
checkJobId: string; checkSummary: { name: string; command: string; exitCode: number; tests: CheckResult['tests']; logArtifactId: string }[];
|
|
|
|
|
sourceFingerprint: string; diffArtifactId: string; policy: { note: string; hooks: string; signing: string };
|
|
|
|
|
}
|
|
|
|
|
export interface DeliveryJob {
|
|
|
|
|
id: string; sessionId: string; taskId: string; runId: string; planId: string; status: string; parent: string; branch: string; paths: string[];
|
|
|
|
|
commit: string | null; expectedCommit?: string | null; summary?: string; requiresVerification: boolean; startedAt: string; finishedAt: string | null;
|
|
|
|
|
reportArtifactId?: string; reportMarkdownArtifactId?: string; reportError?: string; indexPreserved?: boolean; workspacePreserved?: boolean;
|
|
|
|
|
}
|
|
|
|
|
export interface ChangeSet {
|
|
|
|
|
id: string; taskId: string; runId: string; sessionId: string; projectId: string; fingerprint: string;
|
|
|
|
|
status: string; requiresVerification: boolean; summary: string; createdAt: string; finishedAt?: string;
|
|
|
|
|
baseline: { available: boolean; head: string | null; branch: string | null }; observationFingerprint?: string;
|
|
|
|
|
files: { changeId: string; path: string; baseExists: boolean; baseSha256: string | null; sha256: string; bytes: number;
|
|
|
|
|
baseBytes: number; mode: number; reason: string; state: string; writeAttempted: boolean; restoreAttempted: boolean;
|
|
|
|
|
snapshotArtifactId: string; sourceRunId: string; restoreError?: string }[];
|
|
|
|
|
observations?: { path: string; state: string; exists: boolean | null; actualSha256: string | null; problem?: string }[];
|
|
|
|
|
}
|
|
|
|
|
export interface TaskPlanStep {
|
|
|
|
|
key: string; title: string; criterion: string; kind: 'analysis' | 'changes' | 'results' | 'checks' | 'browser'; depends_on: string[];
|
|
|
|
|
tools?: string[]; paths?: string[]; checks?: string[]; viewport_width?: number; actions?: string[];
|
|
|
|
|
}
|
|
|
|
|
export interface TaskPlanRecord { id: string; taskId: string; runId: string; revision: number; parentPlanId: string | null; steps: TaskPlanStep[]; contractArtifactId: string; contractSha256: string }
|
|
|
|
|
export interface TaskPlanStepView extends TaskPlanStep {
|
|
|
|
|
status: string; blockers: string[]; evidence_verified: boolean; proof_id: string | null; proof_artifact_id: string | null; error: string | null;
|
|
|
|
|
evidence: { id: string; runId: string; artifacts?: { id: string; kind: string; sha256: string }[] } | null;
|
|
|
|
|
last_rejection?: { id: string; message: string; at: string };
|
|
|
|
|
candidates?: { id: string; status: string; label: string; runId: string }[];
|
|
|
|
|
}
|
|
|
|
|
export interface TaskPlanView {
|
|
|
|
|
configured: boolean; task_id: string; plan_id?: string; revision: number; status: string; steps: TaskPlanStepView[]; all_verified: boolean;
|
|
|
|
|
verified_steps?: number; total_steps?: number; ready_steps?: string[]; remaining_steps?: string[]; requirements_current?: boolean;
|
|
|
|
|
contract_artifact_id?: string; contract_sha256?: string; checked_at?: string; error?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface TaskPlanReply { session: Session; plan: TaskPlanView; verification?: { status: string; reused?: boolean; proof_id: string; message?: string } }
|
|
|
|
|
export interface RequirementSource { kind: 'goal' | 'instruction'; id: string; text: string; sha256: string; at: string | null }
|
|
|
|
|
export interface RequirementItem extends TaskPlanStep {
|
|
|
|
|
method: 'evidence' | 'user' | 'not_requested'; source: { kind: string; id: string; start: number; end: number; quote?: string; sourceSha256?: string; at?: string | null };
|
|
|
|
|
revision?: number; status?: string; error?: string | null; proof_id?: string | null; proof_artifact_id?: string | null; user_note?: string | null;
|
|
|
|
|
evidence?: TaskPlanStepView['evidence']; candidates?: TaskPlanStepView['candidates']; last_rejection?: { message: string } | null;
|
|
|
|
|
}
|
|
|
|
|
export interface RequirementView {
|
|
|
|
|
configured: boolean; task_id: string; revision: number; status: string; items: RequirementItem[]; sources: RequirementSource[];
|
|
|
|
|
all_resolved: boolean; unreviewed_sources?: string[]; error?: string; note: string; contract_artifact_id?: string;
|
|
|
|
|
history?: { id: string; key: string; revision: number; status: string; error: string | null; at: string; artifact_id: string }[];
|
|
|
|
|
}
|
|
|
|
|
export interface ExecutionSnapshot { schemaVersion: number; task: Task | null; run: Run | null; runs: RunBrief[]; progress: { totalTools: number; completedTools: number; requiresVerification: { id: string; tool: string; state: string; callId: string }[] }; artifacts: Artifact[]; checks: CheckJob[]; mcpJobs?: McpJob[]; plans?: CheckPlan[]; deliveries?: DeliveryJob[]; deliveryPlans?: DeliveryPlan[]; changeSets?: ChangeSet[]; contextPlans?: ContextPlan[]; workspaces?: WorkspaceRecord[]; researchTargets?: ResearchTarget[]; researchJobs?: ResearchJob[]; engineJobs?: EngineJob[]; engineRuns?: EngineRunView[]; browserPlans?: BrowserPlan[]; browserJobs?: BrowserJob[]; taskPlans?: TaskPlanRecord[]; taskProofs?: { id: string; planId: string; stepKey: string; status: string }[]; collaborations?: CollaborationGroup[]; workers?: WorkerRecord[]; workspaceIdentity?: WorkspaceIdentity; accountedTaskTokens: number }
|
|
|
|
|
export interface WorkerBudget { maxTokens: number; maxSteps: number; maxToolCalls: number }
|
|
|
|
|
export interface WorkerDefinition { id: string; label: string; goal: string; paths: string[]; budget: WorkerBudget; workspaceId: string; projectId: string; sessionId: string; taskId: string; engine?: ControlledEngineAvailability }
|
|
|
|
|
export interface WorkerRecord extends WorkerDefinition {
|
|
|
|
|
collaborationId: string; parentProjectId: string; parentSessionId: string; parentTaskId: string; parentRunId: string;
|
|
|
|
|
runId: string; currentRunId: string | null; runIds: string[]; baseCommit: string; fingerprint: string; status: string; requiresVerification: boolean;
|
|
|
|
|
startedAt: string | null; finishedAt: string | null; summary: string; result: { artifactId: string; sha256: string; checkJobId: string; paths: string[] } | null;
|
|
|
|
|
usage?: Usage & { accountedTokens: number; steps: number; toolCalls: number }; sessionStatus?: string;
|
|
|
|
|
}
|
|
|
|
|
export interface WorkerConflict { path: string; reason: string; workerIds: string[] }
|
|
|
|
|
export interface CollaborationGroup {
|
|
|
|
|
id: string; taskId: string; runId: string; projectId: string; sessionId: string; goal: string; fingerprint: string;
|
|
|
|
|
status: string; phase?: string; requiresVerification: boolean; summary: string; createdAt: string; startedAt: string | null; finishedAt: string | null; deadline: number | null;
|
|
|
|
|
model: { mode: string; model: string; baseUrl: string }; budget: WorkerBudget & { maxDurationMs: number };
|
|
|
|
|
source: { identity: { root: string; head: string; branch: string; indexSha256: string }; dirty: boolean; changedPaths: { path: string; status: string }[] };
|
|
|
|
|
children: WorkerDefinition[]; workers?: WorkerRecord[]; usage?: { accountedTokens: number; steps: number; toolCalls: number; requests?: number; unknownRequests: number };
|
|
|
|
|
collection: { artifactId: string; sha256: string; conflicts: WorkerConflict[]; paths: string[] } | null;
|
|
|
|
|
merge: { changeSetId?: string; fingerprint?: string; changeIds?: string[] } | null;
|
|
|
|
|
evidence?: { artifactId: string; sha256: string } | null;
|
|
|
|
|
}
|
|
|
|
|
export interface WorkerView { groups: CollaborationGroup[]; worker: WorkerRecord | null }
|
|
|
|
|
export interface CollaborationGroup { evaluation?: { batchId: string; sampleId: string } }
|
|
|
|
|
export interface WorkerDefinition { evaluation?: { batchId: string; sampleId: string; role: 'original' | 'candidate' } }
|
|
|
|
|
export interface EvaluationRole {
|
|
|
|
|
outcome: string; reason?: string; evidenceError?: string; workerStatus?: string; startedAt?: string; finishedAt?: string;
|
|
|
|
|
usage: { requests: number; totalTokens: number; unknownRequests?: number; estimatedUnknownTokens?: number; reported: boolean; cost?: number | null } | null;
|
|
|
|
|
attempts: { id: string; status: string; summary?: string; results: { name: string; command?: string; status?: string; exitCode?: number; durationMs?: number; tests?: CheckResult['tests']; logArtifactId: string; logSha256?: string }[] }[];
|
|
|
|
|
approvals?: { id: string; status: string; decidedAt?: string }[]; changes?: { id: string; path: string; status: string }[];
|
|
|
|
|
}
|
|
|
|
|
export interface EvaluationReport {
|
|
|
|
|
schemaVersion: number; batchId: string; sampleId: string; label: string; goal: string; criteria: string; source: { head: string };
|
|
|
|
|
inputVerified: boolean; inputError?: string; summary: { original: string; candidate: string }; original: EvaluationRole; candidate: EvaluationRole;
|
|
|
|
|
evidenceMode: string; note: string; sealedAt: string;
|
|
|
|
|
}
|
|
|
|
|
export interface EvaluationSample {
|
|
|
|
|
id: string; label: string; goal: string; criteria: string; paths: string[]; checks: string[]; status: string; groupId?: string; error?: string;
|
|
|
|
|
baselineAttemptedAt?: string; baselineJobId?: string; contractSha256?: string;
|
|
|
|
|
commands?: { name: string; command: string; script: string; lifecycle?: { name: string; script: string }[] }[];
|
|
|
|
|
report: { artifactId: string; sha256: string; summary: { original: string; candidate: string } } | null; workers?: WorkerRecord[];
|
|
|
|
|
}
|
|
|
|
|
export interface EvaluationBatch {
|
|
|
|
|
id: string; title: string; fingerprint: string; status: string; source: { head: string; branch: string }; model: ModelSnapshot;
|
|
|
|
|
message: string; evidenceMode: string; samples: EvaluationSample[]; budget: WorkerBudget & { maxDurationMs: number }; deadline: number | null;
|
|
|
|
|
adoption: { sampleId: string; status: string; delivery?: { commit: string } } | null;
|
|
|
|
|
summary: { samples: number; finished: number; candidate: Record<string, number>; scope: string };
|
|
|
|
|
}
|
|
|
|
|
export interface McpTool { name: string; description: string; inputSchema: Record<string, unknown>; unsupported?: string }
|
|
|
|
|
export interface McpRegistration {
|
|
|
|
|
id: string; projectId: string; name: string; launch: { executable: { path: string; sha256: string; bytes: number }; entry: { path: string; sha256: string; bytes: number } | null; args: string[]; environment: string; identityScope: string };
|
|
|
|
|
timeoutMs: number; configurationRevision: number; enabled: boolean; allowedTools: string[];
|
|
|
|
|
contract: { artifactId: string; sha256: string } | null; createdAt: string; updatedAt: string; status: string; reason: string; tools: McpTool[];
|
|
|
|
|
}
|
|
|
|
|
export interface McpJob {
|
|
|
|
|
id: string; sessionId: string; projectId: string; taskId: string; runId: string; registrationId: string; configurationRevision: number;
|
|
|
|
|
invocationId?: string | null; reviewedAt?: string; reviewedBy?: string; evidenceSha256?: string;
|
|
|
|
|
operation: 'probe' | 'call'; status: string; startedAt: string; finishedAt: string | null; requiresVerification: boolean; dispatched: boolean; processStarted: boolean;
|
|
|
|
|
input?: { launch?: unknown; protocolVersion?: string; contractSha256?: string | null; call?: { tool: string; arguments: Record<string, unknown> }; timeoutMs?: number }; inputArtifactId?: string; inputSha256?: string; pid?: number;
|
|
|
|
|
reportArtifactId?: string; reportSha256?: string; cleanup?: { connectionId?: string; pid: number | null; rootExited: boolean; forced?: boolean; scope?: string; exit?: { code: number | null; signal: string | null } | null };
|
|
|
|
|
error?: { code: string; message: string } | null;
|
|
|
|
|
}
|
|
|
|
|
export interface EngineAvailability {
|
|
|
|
|
engineId: string; name: string; status: string; root: string | null; profile: string; expectedVersion: string; version?: string; message: string;
|
|
|
|
|
identitySha256?: string; node?: { path: string; version: string; sha256: string };
|
|
|
|
|
serverInfo?: { name: string; version: string }; limitations: string[];
|
|
|
|
|
capabilities: { connectionProbe: boolean; projectExecution: boolean; prompt: boolean; singleSessionCancel: boolean; cancellationUnit: string; tokenStreaming: boolean };
|
|
|
|
|
}
|
|
|
|
|
export interface EngineJob {
|
|
|
|
|
id: string; sessionId: string; projectId: string; taskId: string; runId: string; engineId: string; scope: string;
|
|
|
|
|
installation: EngineAvailability; sdkSessionId: string; status: string; summary: string; requiresVerification: boolean;
|
|
|
|
|
startedAt: string; finishedAt: string | null; pid?: number; connectionId?: string;
|
|
|
|
|
readiness?: { pid: number; signal: string; readyAt: string }; serverInfo?: { name: string; version: string };
|
|
|
|
|
verification?: { verified: boolean; rootExited: boolean; modelRequests: number } | null;
|
|
|
|
|
reportArtifactId?: string; reportSha256?: string; contractSha256: string;
|
|
|
|
|
reportSummary?: { status: string; modelRequests: number | null; observedResponses: number; rootExited: boolean | null } | null;
|
|
|
|
|
}
|
|
|
|
|
export interface ControlledEngineAvailability extends EngineAvailability {
|
|
|
|
|
controlledStatus: string; controlledSha256?: string; scope: string; bridgeSha256?: string;
|
|
|
|
|
controlledCapabilities?: { text: boolean; nativeSessionResume: boolean; nativeModelCredentials: boolean; cancellationUnit: string };
|
|
|
|
|
strategy?: PurgePromptStrategy | PurgeOriginalStrategy;
|
|
|
|
|
}
|
|
|
|
|
export interface PurgeSourceAvailability {
|
|
|
|
|
status: string; root: string | null; message: string; version?: string; sourceSha256?: string;
|
|
|
|
|
defaultEnabled: boolean; defaultPrompt: string; supportedVersions: string[];
|
|
|
|
|
inputs?: { relative: string; path: string; bytes: number; sha256: string }[];
|
|
|
|
|
kind?: 'purge-prompt-experiment' | 'purge-original-restricted-v1'; runtimeSha256?: string; runtimeInputs?: number;
|
|
|
|
|
}
|
|
|
|
|
export interface PurgePromptStrategy {
|
|
|
|
|
kind: 'purge-prompt-experiment'; enabled: true; sha256: string; prompt: string; promptSha256: string;
|
|
|
|
|
source: { root: string; version: string; sourceSha256: string };
|
|
|
|
|
section: { name: string; order: number; interpolate: false; text: string; textSha256: string };
|
|
|
|
|
}
|
|
|
|
|
export interface PurgeOriginalStrategy {
|
|
|
|
|
kind: 'purge-original-restricted-v1'; enabled: true; sha256: string; prompt: string; promptSha256: string;
|
|
|
|
|
source: { root: string; version: string; sourceSha256: string };
|
|
|
|
|
runtime: { root: string; sha256: string; inputs: { path: string; sha256: string }[]; nativeAddons: { path: string; sha256: string }[] };
|
|
|
|
|
originalConfig: { autoRetry: false; autoContinue: false; hooksDenyBypass: false; postPrompt: string };
|
|
|
|
|
}
|
|
|
|
|
export interface EngineRunView {
|
|
|
|
|
id: string; projectId: string; sessionId: string; taskId: string; runId: string; workerId: string; collaborationId: string;
|
|
|
|
|
installation: ControlledEngineAvailability; sdkSessionId: string; status: string; requiresVerification: boolean; verified: boolean;
|
|
|
|
|
startedAt: string; finishedAt: string | null; error?: string | null; inputArtifactId: string; inputSha256: string;
|
|
|
|
|
reportArtifactId?: string; reportSha256?: string; modelRequests: number; toolRequests: number; notificationCount?: number;
|
|
|
|
|
nativeSummary: { status: string | null; pid: number | null; rootExited: boolean | null; treeConfirmed?: boolean | null; receipt: { messageId: string } | null; notifications: number };
|
|
|
|
|
review?: { source: string; evidenceSha256: string; reviewedAt: string; result: string };
|
|
|
|
|
}
|
|
|
|
|
export interface ReaAvailability { status: string; version?: string; declaredVersion?: string; message?: string; packageRoot?: string; protocolVersion?: string; operations?: { id: string; name: string; extensions: string[]; label: string }[] }
|
|
|
|
|
export interface ResearchTarget { id: string; taskId: string; runId: string; projectId: string; sessionId: string; path: string; sha256: string; bytes: number; extension: string; label: string; source: string; registeredAt: string }
|
|
|
|
|
export interface ResearchJob {
|
|
|
|
|
id: string; taskId: string; runId: string; targetId: string; targetSha256: string; operation: string; operationId: string;
|
|
|
|
|
status: string; summary: string; startedAt: string; finishedAt: string | null; evidenceId?: string; reusedFromJobId?: string;
|
|
|
|
|
evidenceBinding?: { verified: boolean; statistics?: Record<string, unknown>; limitations: string[]; scope: string } | null;
|
|
|
|
|
installation: ReaAvailability; before?: { path: string }; raw?: { id: string; documentSha256: string }; traceArtifactId?: string;
|
|
|
|
|
cleanup?: { rootExited: boolean }; requiresVerification: boolean;
|
|
|
|
|
}
|
|
|
|
|
export interface ResearchPage { content: string; offset: number; next_offset: number; total_characters: number; truncated: boolean; pointer?: string;
|
|
|
|
|
evidence_id?: string; target_sha256?: string; source_document_sha256: string; available_fields?: string[] }
|
|
|
|
|
|
|
|
|
|
export interface BrowserStep { action: 'fill' | 'select' | 'click' | 'assert_text' | 'assert_count' | 'assert_visible'; selector: string; value?: string; text?: string; count?: number; visible?: boolean; contains?: boolean }
|
|
|
|
|
export interface BrowserPlan { id: string; taskId: string; runId: string; status: string; fingerprint: string; sourceFingerprint: string; build: { directory: string; files: number; bytes: number; sha256: string }; path: string; viewport: { width: number; height: number }; steps: BrowserStep[] }
|
|
|
|
|
export interface BrowserJob { id: string; taskId: string; runId: string; planId: string; planFingerprint: string; sourceFingerprint: string; buildSha256: string; status: string; startedAt: string; finishedAt: string | null; summary: string; resultArtifactId?: string; resultSha256?: string; assertions: { total: number; passed: number; failed: number }; requiresVerification: boolean; cleanup?: { exited: boolean; pid: number | null }; steps: (BrowserStep & { status: string; error?: string; actual?: unknown })[]; screenshots: { artifactId: string; sha256: string; bytes: number; width: number; height: number; label: string }[] }
|
|
|
|
|
|
|
|
|
|
export interface EvaluationReport {environmentComparison?:{dependencyInputs:string;matched:boolean}}
|