@h-rig/contracts 0.0.6-alpha.14 → 0.0.6-alpha.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7456 -0
- package/dist/index.mjs +7415 -0
- package/dist/src/artifact.d.ts +13 -0
- package/dist/src/artifact.js +3 -0
- package/dist/src/baseSchemas.d.ts +63 -0
- package/dist/src/baseSchemas.js +6 -0
- package/dist/src/cli-output.d.ts +324 -0
- package/dist/src/cli-output.js +190 -0
- package/dist/src/config.d.ts +536 -0
- package/dist/src/config.js +1592 -162
- package/dist/src/conversation.d.ts +50 -0
- package/dist/src/conversation.js +3 -0
- package/dist/src/drift.d.ts +28 -0
- package/dist/src/drift.js +69 -0
- package/dist/src/editor.d.ts +25 -0
- package/dist/src/editor.js +3 -0
- package/dist/src/engine.d.ts +2789 -0
- package/dist/src/engine.js +127 -13
- package/dist/src/git.d.ts +144 -0
- package/dist/src/git.js +3 -0
- package/dist/src/graph.d.ts +323 -0
- package/dist/src/graph.js +124 -1
- package/dist/src/help-catalog.d.ts +34 -0
- package/dist/src/help-catalog.js +655 -0
- package/dist/src/index.d.ts +46 -0
- package/dist/src/index.js +4095 -1228
- package/dist/src/ipc.d.ts +248 -0
- package/dist/src/kernel.d.ts +221 -0
- package/dist/src/kernel.js +269 -0
- package/dist/src/keybindings.d.ts +71 -0
- package/dist/src/keybindings.js +3 -0
- package/dist/src/model.d.ts +77 -0
- package/dist/src/orchestration.d.ts +3695 -0
- package/dist/src/orchestration.js +3 -0
- package/dist/src/pi-session.d.ts +113 -0
- package/dist/src/pi-session.js +1 -0
- package/dist/src/planning.d.ts +64 -0
- package/dist/src/planning.js +90 -0
- package/dist/src/plugin-hooks.d.ts +51 -0
- package/dist/src/plugin-hooks.js +375 -0
- package/dist/src/plugin.d.ts +416 -0
- package/dist/src/plugin.js +332 -64
- package/dist/src/policy.d.ts +16 -0
- package/dist/src/policy.js +3 -0
- package/dist/src/project.d.ts +71 -0
- package/dist/src/project.js +3 -0
- package/dist/src/protocol-version.d.ts +21 -0
- package/dist/src/protocol-version.js +6 -0
- package/dist/src/provider.d.ts +105 -0
- package/dist/src/provider.js +3 -0
- package/dist/src/providerRuntime.d.ts +3949 -0
- package/dist/src/providerRuntime.js +3 -0
- package/dist/src/remote.d.ts +326 -0
- package/dist/src/remote.js +16 -10
- package/dist/src/review.d.ts +18 -0
- package/dist/src/review.js +3 -0
- package/dist/src/rig.d.ts +783 -0
- package/dist/src/rig.js +178 -15
- package/dist/src/rollups.d.ts +41 -0
- package/dist/src/rollups.js +70 -0
- package/dist/src/run-journal.d.ts +930 -0
- package/dist/src/run-journal.js +1641 -0
- package/dist/src/run-record.d.ts +45 -0
- package/dist/src/run-record.js +1 -0
- package/dist/src/run-session-journal.d.ts +93 -0
- package/dist/src/run-session-journal.js +1809 -0
- package/dist/src/run-status.d.ts +12 -0
- package/dist/src/run-status.js +38 -0
- package/dist/src/run-timeline.d.ts +10 -0
- package/dist/src/run-timeline.js +1499 -0
- package/dist/src/runtime.d.ts +103 -0
- package/dist/src/runtime.js +9 -4
- package/dist/src/server.d.ts +106 -0
- package/dist/src/server.js +3 -0
- package/dist/src/serviceFabric.d.ts +62 -0
- package/dist/src/serviceFabric.js +5 -2
- package/dist/src/stage.d.ts +245 -0
- package/dist/src/stage.js +169 -0
- package/dist/src/supervisor-journal.d.ts +205 -0
- package/dist/src/supervisor-journal.js +1246 -0
- package/dist/src/task-source.d.ts +37 -0
- package/dist/src/terminal.d.ts +130 -0
- package/dist/src/terminal.js +3 -0
- package/dist/src/validation.d.ts +14 -0
- package/dist/src/validation.js +3 -0
- package/dist/src/workflow-journal.d.ts +124 -0
- package/dist/src/workflow-journal.js +389 -0
- package/dist/src/workspace.d.ts +204 -0
- package/dist/src/workspace.js +5 -2
- package/dist/src/ws.d.ts +747 -0
- package/dist/src/ws.js +172 -14
- package/package.json +51 -4
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { GitCheckoutInput, GitCreateBranchInput, GitCreateWorktreeInput, GitCreateWorktreeResult, GitInitInput, GitListBranchesInput, GitListBranchesResult, GitPullInput, GitPullResult, GitReadWorkingTreePatchInput, GitReadWorkingTreePatchResult, GitRemoveWorktreeInput, GitRunStackedActionInput, GitRunStackedActionResult, GitStatusInput, GitStatusResult } from "./git";
|
|
2
|
+
import type { ProjectListDirectoryInput, ProjectListDirectoryResult, ProjectSearchEntriesInput, ProjectSearchEntriesResult, ProjectReadFileInput, ProjectReadFileResult, ProjectWriteFileInput, ProjectWriteFileResult } from "./project";
|
|
3
|
+
import type { ServerConfig } from "./server";
|
|
4
|
+
import type { RigCreateAdhocRunInput, RigCreateTaskRunInput, RigDeleteRunInput, RigEnqueueTaskInput, RigGetRunLogsInput, RigGetRunLogsResult, RigGetTaskArtifactsResult, RigRunLogAppendedPayload, RigGetWorkspaceInput, RigGetWorkspaceResult, RigListWorkspacesResult, RigMutationResult, RigInterruptRunInput, RigQueueRunSteeringInput, RigQueueRunSteeringResult, RigResumeRunInput, RigResolveApprovalInput, RigResolveUserInputInput, RigSnapshot, RigStopRunInput, RigSubmitRunMessageInput } from "./rig";
|
|
5
|
+
import type { TerminalClearInput, TerminalCloseInput, TerminalEvent, TerminalOpenInput, TerminalResizeInput, TerminalSessionSnapshot, TerminalWriteInput } from "./terminal";
|
|
6
|
+
import type { ServerUpsertKeybindingInput, ServerUpsertKeybindingResult } from "./server";
|
|
7
|
+
import type { ClientOrchestrationCommand, OrchestrationGetFullThreadDiffInput, OrchestrationGetFullThreadDiffResult, OrchestrationGetTurnDiffInput, OrchestrationGetTurnDiffResult, OrchestrationEvent, OrchestrationReadModel } from "./orchestration";
|
|
8
|
+
import type { EngineEvent } from "./engine";
|
|
9
|
+
import { EditorId } from "./editor";
|
|
10
|
+
export interface ContextMenuItem<T extends string = string> {
|
|
11
|
+
id: T;
|
|
12
|
+
label: string;
|
|
13
|
+
destructive?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type DesktopUpdateStatus = "disabled" | "idle" | "checking" | "up-to-date" | "available" | "downloading" | "downloaded" | "error";
|
|
16
|
+
export interface DesktopUpdateState {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
status: DesktopUpdateStatus;
|
|
19
|
+
currentVersion: string;
|
|
20
|
+
availableVersion: string | null;
|
|
21
|
+
downloadedVersion: string | null;
|
|
22
|
+
downloadPercent: number | null;
|
|
23
|
+
checkedAt: string | null;
|
|
24
|
+
message: string | null;
|
|
25
|
+
errorContext: "check" | "download" | "install" | null;
|
|
26
|
+
canRetry: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface DesktopUpdateActionResult {
|
|
29
|
+
accepted: boolean;
|
|
30
|
+
completed: boolean;
|
|
31
|
+
state: DesktopUpdateState;
|
|
32
|
+
}
|
|
33
|
+
export type RigProjectConfigStatus = "rig-config-ts" | "rig-config-json" | "legacy-task-config" | "missing";
|
|
34
|
+
export interface DesktopRigSetupState {
|
|
35
|
+
rootPath: string | null;
|
|
36
|
+
ready: boolean;
|
|
37
|
+
wsUrl: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* What kind of Rig configuration the project at `rootPath` has. The
|
|
40
|
+
* desktop main process probes the filesystem at boot and on
|
|
41
|
+
* `setRigRoot`; the renderer reads this to decide whether to show an
|
|
42
|
+
* onboarding banner ("Run `rig init`") or the normal dashboard.
|
|
43
|
+
*/
|
|
44
|
+
configStatus: RigProjectConfigStatus;
|
|
45
|
+
}
|
|
46
|
+
export interface RigConfigWriteResult {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
/** Absolute path to the file that was written. */
|
|
49
|
+
configPath: string;
|
|
50
|
+
/** Filesystem error message when `ok === false`. */
|
|
51
|
+
error?: string;
|
|
52
|
+
/** Updated setup state — `configStatus` reflects the post-write probe. */
|
|
53
|
+
setup: DesktopRigSetupState;
|
|
54
|
+
}
|
|
55
|
+
export interface RigConfigReadResult {
|
|
56
|
+
/** The raw rig.config.{ts,json} source, or null if none exists. */
|
|
57
|
+
source: string | null;
|
|
58
|
+
/** Which file was read; null when no config exists. */
|
|
59
|
+
configPath: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface ProjectGitRemoteInfo {
|
|
62
|
+
/** The raw origin URL, e.g. `git@github.com:humanity-org/humanwork.git`. */
|
|
63
|
+
url: string;
|
|
64
|
+
/** Parsed host, e.g. `github.com`. */
|
|
65
|
+
host: string | null;
|
|
66
|
+
/** Parsed owner/org, e.g. `humanity-org`. */
|
|
67
|
+
owner: string | null;
|
|
68
|
+
/** Parsed repository name (no `.git` suffix), e.g. `humanwork`. */
|
|
69
|
+
repo: string | null;
|
|
70
|
+
}
|
|
71
|
+
export interface DesktopBridge {
|
|
72
|
+
getWsUrl: () => string | null;
|
|
73
|
+
getRigSetup: () => Promise<DesktopRigSetupState>;
|
|
74
|
+
setRigRoot: (rootPath: string) => Promise<DesktopRigSetupState>;
|
|
75
|
+
/**
|
|
76
|
+
* Read the raw rig.config.{ts,json} from the project at `rootPath`.
|
|
77
|
+
* Returns `{ source: null }` when no config exists. Used by the in-app
|
|
78
|
+
* Settings screen to populate the form from the existing file.
|
|
79
|
+
*/
|
|
80
|
+
readRigConfigRaw: (rootPath: string) => Promise<RigConfigReadResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Write rig.config.ts to the project root atomically (temp-file + rename).
|
|
83
|
+
* Refreshes the cached setup state and returns it post-write so callers
|
|
84
|
+
* can route past the setup gate. Used by both the in-app setup wizard
|
|
85
|
+
* and the Settings → Project section.
|
|
86
|
+
*/
|
|
87
|
+
writeRigConfig: (rootPath: string, source: string) => Promise<RigConfigWriteResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Inspect the project's git origin to auto-fill setup wizard fields.
|
|
90
|
+
* Runs `git -C <rootPath> remote get-url origin` and parses owner/repo.
|
|
91
|
+
* Returns null when the project isn't a git repo, has no origin, or the
|
|
92
|
+
* URL doesn't match a recognized GitHub-style pattern. The wizard uses
|
|
93
|
+
* this to prefill the GitHub owner/repo step instead of making the
|
|
94
|
+
* operator type values that are already in `.git/config`.
|
|
95
|
+
*/
|
|
96
|
+
getProjectGitRemote: (rootPath: string) => Promise<ProjectGitRemoteInfo | null>;
|
|
97
|
+
pickFolder: () => Promise<string | null>;
|
|
98
|
+
confirm: (message: string) => Promise<boolean>;
|
|
99
|
+
showContextMenu: <T extends string>(items: readonly ContextMenuItem<T>[], position?: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
}) => Promise<T | null>;
|
|
103
|
+
openExternal: (url: string) => Promise<boolean>;
|
|
104
|
+
onMenuAction: (listener: (action: string) => void) => () => void;
|
|
105
|
+
getUpdateState: () => Promise<DesktopUpdateState>;
|
|
106
|
+
downloadUpdate: () => Promise<DesktopUpdateActionResult>;
|
|
107
|
+
installUpdate: () => Promise<DesktopUpdateActionResult>;
|
|
108
|
+
onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void;
|
|
109
|
+
}
|
|
110
|
+
export interface NativeApi {
|
|
111
|
+
dialogs: {
|
|
112
|
+
pickFolder: () => Promise<string | null>;
|
|
113
|
+
confirm: (message: string) => Promise<boolean>;
|
|
114
|
+
};
|
|
115
|
+
terminal: {
|
|
116
|
+
open: (input: TerminalOpenInput) => Promise<TerminalSessionSnapshot>;
|
|
117
|
+
write: (input: TerminalWriteInput) => Promise<void>;
|
|
118
|
+
resize: (input: TerminalResizeInput) => Promise<void>;
|
|
119
|
+
clear: (input: TerminalClearInput) => Promise<void>;
|
|
120
|
+
restart: (input: TerminalOpenInput) => Promise<TerminalSessionSnapshot>;
|
|
121
|
+
close: (input: TerminalCloseInput) => Promise<void>;
|
|
122
|
+
onEvent: (callback: (event: TerminalEvent) => void) => () => void;
|
|
123
|
+
};
|
|
124
|
+
projects: {
|
|
125
|
+
listDirectory: (input: ProjectListDirectoryInput) => Promise<ProjectListDirectoryResult>;
|
|
126
|
+
searchEntries: (input: ProjectSearchEntriesInput) => Promise<ProjectSearchEntriesResult>;
|
|
127
|
+
readFile: (input: ProjectReadFileInput) => Promise<ProjectReadFileResult>;
|
|
128
|
+
writeFile: (input: ProjectWriteFileInput) => Promise<ProjectWriteFileResult>;
|
|
129
|
+
};
|
|
130
|
+
shell: {
|
|
131
|
+
openInEditor: (cwd: string, editor: EditorId) => Promise<void>;
|
|
132
|
+
openExternal: (url: string) => Promise<void>;
|
|
133
|
+
};
|
|
134
|
+
git: {
|
|
135
|
+
listBranches: (input: GitListBranchesInput) => Promise<GitListBranchesResult>;
|
|
136
|
+
createWorktree: (input: GitCreateWorktreeInput) => Promise<GitCreateWorktreeResult>;
|
|
137
|
+
removeWorktree: (input: GitRemoveWorktreeInput) => Promise<void>;
|
|
138
|
+
createBranch: (input: GitCreateBranchInput) => Promise<void>;
|
|
139
|
+
checkout: (input: GitCheckoutInput) => Promise<void>;
|
|
140
|
+
init: (input: GitInitInput) => Promise<void>;
|
|
141
|
+
pull: (input: GitPullInput) => Promise<GitPullResult>;
|
|
142
|
+
status: (input: GitStatusInput) => Promise<GitStatusResult>;
|
|
143
|
+
readWorkingTreePatch: (input: GitReadWorkingTreePatchInput) => Promise<GitReadWorkingTreePatchResult>;
|
|
144
|
+
runStackedAction: (input: GitRunStackedActionInput) => Promise<GitRunStackedActionResult>;
|
|
145
|
+
};
|
|
146
|
+
contextMenu: {
|
|
147
|
+
show: <T extends string>(items: readonly ContextMenuItem<T>[], position?: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
}) => Promise<T | null>;
|
|
151
|
+
};
|
|
152
|
+
server: {
|
|
153
|
+
getConfig: () => Promise<ServerConfig>;
|
|
154
|
+
upsertKeybinding: (input: ServerUpsertKeybindingInput) => Promise<ServerUpsertKeybindingResult>;
|
|
155
|
+
};
|
|
156
|
+
rig: {
|
|
157
|
+
getSnapshot: () => Promise<RigSnapshot>;
|
|
158
|
+
listWorkspaces: () => Promise<RigListWorkspacesResult>;
|
|
159
|
+
getWorkspace: (input: RigGetWorkspaceInput) => Promise<RigGetWorkspaceResult>;
|
|
160
|
+
getRunLogs: (input: RigGetRunLogsInput) => Promise<RigGetRunLogsResult>;
|
|
161
|
+
replayEvents: (fromSequenceExclusive: number) => Promise<EngineEvent[]>;
|
|
162
|
+
createAdhocRun: (input: RigCreateAdhocRunInput) => Promise<RigMutationResult>;
|
|
163
|
+
createTaskRun: (input: RigCreateTaskRunInput) => Promise<RigMutationResult>;
|
|
164
|
+
deleteRun: (input: RigDeleteRunInput) => Promise<RigMutationResult>;
|
|
165
|
+
enqueueTask: (input: RigEnqueueTaskInput) => Promise<RigMutationResult>;
|
|
166
|
+
resumeRun: (input: RigResumeRunInput) => Promise<RigMutationResult>;
|
|
167
|
+
submitRunMessage: (input: RigSubmitRunMessageInput) => Promise<RigMutationResult>;
|
|
168
|
+
queueRunSteering: (input: RigQueueRunSteeringInput) => Promise<RigQueueRunSteeringResult>;
|
|
169
|
+
interruptRun: (input: RigInterruptRunInput) => Promise<RigMutationResult>;
|
|
170
|
+
stopRun: (input: RigStopRunInput) => Promise<RigMutationResult>;
|
|
171
|
+
resolveApproval: (input: RigResolveApprovalInput) => Promise<RigMutationResult>;
|
|
172
|
+
resolveUserInput: (input: RigResolveUserInputInput) => Promise<RigMutationResult>;
|
|
173
|
+
getTaskArtifacts: (taskId: string) => Promise<RigGetTaskArtifactsResult>;
|
|
174
|
+
onEvent: (callback: (event: EngineEvent) => void) => () => void;
|
|
175
|
+
onRunLogAppended: (callback: (payload: RigRunLogAppendedPayload) => void) => () => void;
|
|
176
|
+
};
|
|
177
|
+
orchestration: {
|
|
178
|
+
getSnapshot: () => Promise<OrchestrationReadModel>;
|
|
179
|
+
dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{
|
|
180
|
+
sequence: number;
|
|
181
|
+
}>;
|
|
182
|
+
getTurnDiff: (input: OrchestrationGetTurnDiffInput) => Promise<OrchestrationGetTurnDiffResult>;
|
|
183
|
+
getFullThreadDiff: (input: OrchestrationGetFullThreadDiffInput) => Promise<OrchestrationGetFullThreadDiffResult>;
|
|
184
|
+
replayEvents: (fromSequenceExclusive: number) => Promise<OrchestrationEvent[]>;
|
|
185
|
+
onDomainEvent: (callback: (event: OrchestrationEvent) => void) => () => void;
|
|
186
|
+
};
|
|
187
|
+
remote: {
|
|
188
|
+
testEndpoint: (input: {
|
|
189
|
+
host: string;
|
|
190
|
+
port: number;
|
|
191
|
+
token?: string;
|
|
192
|
+
}) => Promise<{
|
|
193
|
+
latencyMs: number;
|
|
194
|
+
}>;
|
|
195
|
+
listEndpoints: () => Promise<unknown[]>;
|
|
196
|
+
registerEndpoint: (input: {
|
|
197
|
+
alias: string;
|
|
198
|
+
host: string;
|
|
199
|
+
port: number;
|
|
200
|
+
token?: string;
|
|
201
|
+
autoConnect?: boolean;
|
|
202
|
+
}) => Promise<unknown>;
|
|
203
|
+
removeEndpoint: (input: {
|
|
204
|
+
endpointId: string;
|
|
205
|
+
}) => Promise<void>;
|
|
206
|
+
connect: (input: {
|
|
207
|
+
endpointId: string;
|
|
208
|
+
}) => Promise<void>;
|
|
209
|
+
disconnect: (input: {
|
|
210
|
+
endpointId: string;
|
|
211
|
+
}) => Promise<void>;
|
|
212
|
+
createRunForTask: (input: {
|
|
213
|
+
endpointId: string;
|
|
214
|
+
taskId: string;
|
|
215
|
+
runId: string;
|
|
216
|
+
workspaceId: string;
|
|
217
|
+
runtimeMode?: string;
|
|
218
|
+
interactionMode?: string;
|
|
219
|
+
}) => Promise<{
|
|
220
|
+
ok: boolean;
|
|
221
|
+
}>;
|
|
222
|
+
terminalOpen: (input: {
|
|
223
|
+
endpointId: string;
|
|
224
|
+
threadId: string;
|
|
225
|
+
terminalId: string;
|
|
226
|
+
cwd?: string;
|
|
227
|
+
env?: Record<string, string>;
|
|
228
|
+
}) => Promise<unknown>;
|
|
229
|
+
terminalWrite: (input: {
|
|
230
|
+
endpointId: string;
|
|
231
|
+
threadId: string;
|
|
232
|
+
terminalId: string;
|
|
233
|
+
data: string;
|
|
234
|
+
}) => Promise<void>;
|
|
235
|
+
terminalResize: (input: {
|
|
236
|
+
endpointId: string;
|
|
237
|
+
threadId: string;
|
|
238
|
+
terminalId: string;
|
|
239
|
+
cols: number;
|
|
240
|
+
rows: number;
|
|
241
|
+
}) => Promise<void>;
|
|
242
|
+
terminalClose: (input: {
|
|
243
|
+
endpointId: string;
|
|
244
|
+
threadId: string;
|
|
245
|
+
terminalId: string;
|
|
246
|
+
}) => Promise<void>;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { ResolvedPipeline, StageContext, StageDescriptor, StageMutation, StageResult, StageRunOutcome } from "./stage";
|
|
3
|
+
export declare const CapabilityTag: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
4
|
+
export type CapabilityTag = typeof CapabilityTag.Type;
|
|
5
|
+
export declare const CapabilityProviderRef: Schema.Struct<{
|
|
6
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
7
|
+
readonly pluginId: Schema.Trim;
|
|
8
|
+
}>;
|
|
9
|
+
export type CapabilityProviderRef = typeof CapabilityProviderRef.Type;
|
|
10
|
+
export declare const CapabilityReplacement: Schema.Struct<{
|
|
11
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
12
|
+
readonly providerPluginId: Schema.Trim;
|
|
13
|
+
}>;
|
|
14
|
+
export type CapabilityReplacement = typeof CapabilityReplacement.Type;
|
|
15
|
+
export declare const CapabilityReplacementSpec: Schema.Union<readonly [Schema.Struct<{
|
|
16
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
17
|
+
readonly providerPluginId: Schema.Trim;
|
|
18
|
+
}>, Schema.Trim]>;
|
|
19
|
+
export type CapabilityReplacementSpec = typeof CapabilityReplacementSpec.Type;
|
|
20
|
+
export declare const PluginMeta: Schema.Struct<{
|
|
21
|
+
readonly id: Schema.Trim;
|
|
22
|
+
readonly version: Schema.Trim;
|
|
23
|
+
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
24
|
+
readonly requires: Schema.optional<Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>>;
|
|
25
|
+
readonly replaces: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
26
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
27
|
+
readonly providerPluginId: Schema.Trim;
|
|
28
|
+
}>, Schema.Trim]>>>;
|
|
29
|
+
}>;
|
|
30
|
+
export type PluginMeta = typeof PluginMeta.Type;
|
|
31
|
+
export declare const LoadedPluginDescriptor: Schema.Struct<{
|
|
32
|
+
readonly meta: Schema.Struct<{
|
|
33
|
+
readonly id: Schema.Trim;
|
|
34
|
+
readonly version: Schema.Trim;
|
|
35
|
+
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
36
|
+
readonly requires: Schema.optional<Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>>;
|
|
37
|
+
readonly replaces: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
38
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
39
|
+
readonly providerPluginId: Schema.Trim;
|
|
40
|
+
}>, Schema.Trim]>>>;
|
|
41
|
+
}>;
|
|
42
|
+
readonly provides: Schema.$Array<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
43
|
+
readonly contributes: Schema.Unknown;
|
|
44
|
+
readonly runtime: Schema.Unknown;
|
|
45
|
+
}>;
|
|
46
|
+
export type LoadedPluginDescriptor = typeof LoadedPluginDescriptor.Type;
|
|
47
|
+
export declare const KernelReplacementGrant: Schema.Struct<{
|
|
48
|
+
readonly pluginId: Schema.Trim;
|
|
49
|
+
readonly grantedBy: Schema.optional<Schema.Trim>;
|
|
50
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
51
|
+
}>;
|
|
52
|
+
export type KernelReplacementGrant = typeof KernelReplacementGrant.Type;
|
|
53
|
+
export declare const CapabilityGrants: Schema.Struct<{
|
|
54
|
+
readonly capabilityPrecedence: Schema.optional<Schema.$Record<Schema.String, Schema.$Array<Schema.Trim>>>;
|
|
55
|
+
readonly kernelReplacementGrants: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
56
|
+
readonly pluginId: Schema.Trim;
|
|
57
|
+
readonly grantedBy: Schema.optional<Schema.Trim>;
|
|
58
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
59
|
+
}>>>;
|
|
60
|
+
}>;
|
|
61
|
+
export type CapabilityGrants = typeof CapabilityGrants.Type;
|
|
62
|
+
export declare const KernelBootErrorCode: Schema.Literals<readonly ["BootIncoherent", "AmbiguousCapability", "MissingCapability", "KernelReplacementDenied", "PipelineUnresolvable"]>;
|
|
63
|
+
export type KernelBootErrorCode = typeof KernelBootErrorCode.Type;
|
|
64
|
+
export declare const KernelBootError: Schema.Struct<{
|
|
65
|
+
readonly code: Schema.Literals<readonly ["BootIncoherent", "AmbiguousCapability", "MissingCapability", "KernelReplacementDenied", "PipelineUnresolvable"]>;
|
|
66
|
+
readonly message: Schema.Trim;
|
|
67
|
+
readonly capability: Schema.optional<Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>>;
|
|
68
|
+
readonly stageId: Schema.optional<Schema.Trim>;
|
|
69
|
+
readonly pluginIds: Schema.optional<Schema.$Array<Schema.Trim>>;
|
|
70
|
+
}>;
|
|
71
|
+
export type KernelBootError = typeof KernelBootError.Type;
|
|
72
|
+
export declare class BootIncoherent extends Error {
|
|
73
|
+
readonly code = "BootIncoherent";
|
|
74
|
+
}
|
|
75
|
+
export declare class AmbiguousCapability extends Error {
|
|
76
|
+
readonly code = "AmbiguousCapability";
|
|
77
|
+
}
|
|
78
|
+
export declare class MissingCapability extends Error {
|
|
79
|
+
readonly code = "MissingCapability";
|
|
80
|
+
}
|
|
81
|
+
export declare class KernelReplacementDenied extends Error {
|
|
82
|
+
readonly code = "KernelReplacementDenied";
|
|
83
|
+
}
|
|
84
|
+
export declare class PipelineUnresolvable extends Error {
|
|
85
|
+
readonly code = "PipelineUnresolvable";
|
|
86
|
+
}
|
|
87
|
+
export declare const CapabilityResolutionStatus: Schema.Literals<readonly ["resolved", "ambiguous", "missing", "replaced"]>;
|
|
88
|
+
export type CapabilityResolutionStatus = typeof CapabilityResolutionStatus.Type;
|
|
89
|
+
export declare const CapabilityResolutionRecord: Schema.Struct<{
|
|
90
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
91
|
+
readonly status: Schema.Literals<readonly ["resolved", "ambiguous", "missing", "replaced"]>;
|
|
92
|
+
readonly selectedPluginId: Schema.NullOr<Schema.Trim>;
|
|
93
|
+
readonly candidatePluginIds: Schema.$Array<Schema.Trim>;
|
|
94
|
+
readonly precedenceUsed: Schema.Boolean;
|
|
95
|
+
readonly replacementUsed: Schema.optional<Schema.Struct<{
|
|
96
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
97
|
+
readonly providerPluginId: Schema.Trim;
|
|
98
|
+
}>>;
|
|
99
|
+
readonly error: Schema.optional<Schema.String>;
|
|
100
|
+
}>;
|
|
101
|
+
export type CapabilityResolutionRecord = typeof CapabilityResolutionRecord.Type;
|
|
102
|
+
export declare const KernelResolutionRecord: Schema.Struct<{
|
|
103
|
+
readonly resolvedAt: Schema.String;
|
|
104
|
+
readonly capabilities: Schema.$Array<Schema.Struct<{
|
|
105
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
106
|
+
readonly status: Schema.Literals<readonly ["resolved", "ambiguous", "missing", "replaced"]>;
|
|
107
|
+
readonly selectedPluginId: Schema.NullOr<Schema.Trim>;
|
|
108
|
+
readonly candidatePluginIds: Schema.$Array<Schema.Trim>;
|
|
109
|
+
readonly precedenceUsed: Schema.Boolean;
|
|
110
|
+
readonly replacementUsed: Schema.optional<Schema.Struct<{
|
|
111
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
112
|
+
readonly providerPluginId: Schema.Trim;
|
|
113
|
+
}>>;
|
|
114
|
+
readonly error: Schema.optional<Schema.String>;
|
|
115
|
+
}>>;
|
|
116
|
+
readonly pipeline: Schema.optional<Schema.Struct<{
|
|
117
|
+
readonly runId: Schema.optional<Schema.brand<Schema.Trim, "RunId">>;
|
|
118
|
+
readonly order: Schema.$Array<Schema.brand<Schema.Trim, "StageId">>;
|
|
119
|
+
readonly record: Schema.$Array<Schema.Struct<{
|
|
120
|
+
readonly stageId: Schema.brand<Schema.Trim, "StageId">;
|
|
121
|
+
readonly contributedBy: Schema.Trim;
|
|
122
|
+
readonly removedBy: Schema.optional<Schema.Trim>;
|
|
123
|
+
readonly replacedBy: Schema.optional<Schema.Trim>;
|
|
124
|
+
readonly wrappedBy: Schema.optional<Schema.$Array<Schema.Trim>>;
|
|
125
|
+
readonly droppedAnchors: Schema.optional<Schema.$Array<Schema.brand<Schema.Trim, "StageId">>>;
|
|
126
|
+
readonly isProtected: Schema.Boolean;
|
|
127
|
+
}>>;
|
|
128
|
+
readonly cycles: Schema.$Array<Schema.$Array<Schema.brand<Schema.Trim, "StageId">>>;
|
|
129
|
+
readonly grantUses: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
130
|
+
readonly kind: Schema.Literal<"kernel-replacement">;
|
|
131
|
+
readonly target: Schema.Trim;
|
|
132
|
+
readonly pluginId: Schema.Trim;
|
|
133
|
+
}>>>;
|
|
134
|
+
readonly resolvedAt: Schema.optional<Schema.String>;
|
|
135
|
+
}>>;
|
|
136
|
+
}>;
|
|
137
|
+
export type KernelResolutionRecord = typeof KernelResolutionRecord.Type;
|
|
138
|
+
export declare const BootResultDescriptor: Schema.Struct<{
|
|
139
|
+
readonly kernelPluginId: Schema.Trim;
|
|
140
|
+
readonly pluginIds: Schema.$Array<Schema.Trim>;
|
|
141
|
+
readonly resolution: Schema.Struct<{
|
|
142
|
+
readonly resolvedAt: Schema.String;
|
|
143
|
+
readonly capabilities: Schema.$Array<Schema.Struct<{
|
|
144
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
145
|
+
readonly status: Schema.Literals<readonly ["resolved", "ambiguous", "missing", "replaced"]>;
|
|
146
|
+
readonly selectedPluginId: Schema.NullOr<Schema.Trim>;
|
|
147
|
+
readonly candidatePluginIds: Schema.$Array<Schema.Trim>;
|
|
148
|
+
readonly precedenceUsed: Schema.Boolean;
|
|
149
|
+
readonly replacementUsed: Schema.optional<Schema.Struct<{
|
|
150
|
+
readonly capability: Schema.Literals<readonly ["kernel", "journal", "stage-runner", "transport", "loader-policy"]>;
|
|
151
|
+
readonly providerPluginId: Schema.Trim;
|
|
152
|
+
}>>;
|
|
153
|
+
readonly error: Schema.optional<Schema.String>;
|
|
154
|
+
}>>;
|
|
155
|
+
readonly pipeline: Schema.optional<Schema.Struct<{
|
|
156
|
+
readonly runId: Schema.optional<Schema.brand<Schema.Trim, "RunId">>;
|
|
157
|
+
readonly order: Schema.$Array<Schema.brand<Schema.Trim, "StageId">>;
|
|
158
|
+
readonly record: Schema.$Array<Schema.Struct<{
|
|
159
|
+
readonly stageId: Schema.brand<Schema.Trim, "StageId">;
|
|
160
|
+
readonly contributedBy: Schema.Trim;
|
|
161
|
+
readonly removedBy: Schema.optional<Schema.Trim>;
|
|
162
|
+
readonly replacedBy: Schema.optional<Schema.Trim>;
|
|
163
|
+
readonly wrappedBy: Schema.optional<Schema.$Array<Schema.Trim>>;
|
|
164
|
+
readonly droppedAnchors: Schema.optional<Schema.$Array<Schema.brand<Schema.Trim, "StageId">>>;
|
|
165
|
+
readonly isProtected: Schema.Boolean;
|
|
166
|
+
}>>;
|
|
167
|
+
readonly cycles: Schema.$Array<Schema.$Array<Schema.brand<Schema.Trim, "StageId">>>;
|
|
168
|
+
readonly grantUses: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
169
|
+
readonly kind: Schema.Literal<"kernel-replacement">;
|
|
170
|
+
readonly target: Schema.Trim;
|
|
171
|
+
readonly pluginId: Schema.Trim;
|
|
172
|
+
}>>>;
|
|
173
|
+
readonly resolvedAt: Schema.optional<Schema.String>;
|
|
174
|
+
}>>;
|
|
175
|
+
}>;
|
|
176
|
+
}>;
|
|
177
|
+
export type BootResultDescriptor = typeof BootResultDescriptor.Type;
|
|
178
|
+
export declare const JournalEvent: Schema.Struct<{
|
|
179
|
+
readonly type: Schema.Trim;
|
|
180
|
+
readonly runId: Schema.optional<Schema.brand<Schema.Trim, "RunId">>;
|
|
181
|
+
readonly at: Schema.String;
|
|
182
|
+
readonly payload: Schema.Unknown;
|
|
183
|
+
}>;
|
|
184
|
+
export type JournalEvent = typeof JournalEvent.Type;
|
|
185
|
+
export interface LoadedPlugin {
|
|
186
|
+
meta: PluginMeta;
|
|
187
|
+
provides: ReadonlySet<CapabilityTag>;
|
|
188
|
+
contributes: unknown;
|
|
189
|
+
runtime: unknown;
|
|
190
|
+
}
|
|
191
|
+
export interface JournalCapability {
|
|
192
|
+
append(event: unknown): Promise<void>;
|
|
193
|
+
recordPipeline(runId: string, pipeline: ResolvedPipeline): Promise<void>;
|
|
194
|
+
recordStageOutcome?(runId: string, outcome: StageRunOutcome): Promise<void>;
|
|
195
|
+
read(runId: string): Promise<readonly unknown[]>;
|
|
196
|
+
}
|
|
197
|
+
export interface StageRunnerCapability {
|
|
198
|
+
resolve(defaultStages: readonly StageDescriptor[], mutations: readonly StageMutation[], grants?: CapabilityGrants): ResolvedPipeline;
|
|
199
|
+
runPipeline(runId: string, resolved: ResolvedPipeline, ctx: StageContext): Promise<readonly StageRunOutcome[]>;
|
|
200
|
+
}
|
|
201
|
+
export interface TransportCapability {
|
|
202
|
+
dispatch(task: unknown, options?: unknown): Promise<string>;
|
|
203
|
+
attach?(runId: string): Promise<unknown>;
|
|
204
|
+
serve?(): Promise<void>;
|
|
205
|
+
}
|
|
206
|
+
export interface LoaderPolicyCapability {
|
|
207
|
+
resolveCapability(plugins: readonly PluginMeta[], capability: CapabilityTag, grants?: CapabilityGrants): CapabilityResolutionRecord;
|
|
208
|
+
}
|
|
209
|
+
export interface KernelCapability {
|
|
210
|
+
journal: JournalCapability;
|
|
211
|
+
stageRunner: StageRunnerCapability;
|
|
212
|
+
transport: TransportCapability;
|
|
213
|
+
loaderPolicy: LoaderPolicyCapability;
|
|
214
|
+
start(plugins: readonly unknown[]): Promise<void>;
|
|
215
|
+
}
|
|
216
|
+
export interface BootResult {
|
|
217
|
+
kernel: KernelCapability;
|
|
218
|
+
plugins: readonly LoadedPlugin[];
|
|
219
|
+
capabilityProviderIds: Readonly<Record<CapabilityTag, string>>;
|
|
220
|
+
}
|
|
221
|
+
export type StageExecutor = (ctx: StageContext) => Promise<StageResult> | StageResult;
|