@leitwerk-dev/process-sdk 0.2.0 → 0.2.1
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/browser-ui-extension.d.ts +20 -0
- package/dist/browser-ui-extension.d.ts.map +1 -1
- package/dist/capabilities.d.ts +6 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
- package/dist/chunk-5R6MVLHC.js.map +1 -0
- package/dist/chunk-DVXW2ZUV.js +1 -0
- package/dist/chunk-DVXW2ZUV.js.map +1 -0
- package/dist/{chunk-TA4KO53Q.js → chunk-I7U6HCLN.js} +1 -7
- package/dist/chunk-I7U6HCLN.js.map +1 -0
- package/dist/{chunk-WFY2WWZE.js → chunk-TM2LTSW4.js} +1 -1
- package/dist/chunk-TM2LTSW4.js.map +1 -0
- package/dist/codecs.d.ts +1 -0
- package/dist/codecs.d.ts.map +1 -1
- package/dist/commit-message.d.ts +5 -0
- package/dist/commit-message.d.ts.map +1 -1
- package/dist/core-capabilities.d.ts +336 -20
- package/dist/core-capabilities.d.ts.map +1 -1
- package/dist/define-process.d.ts +195 -18
- package/dist/define-process.d.ts.map +1 -1
- package/dist/event-bus.d.ts +1 -0
- package/dist/event-bus.d.ts.map +1 -1
- package/dist/{extension-api-CcqZCYJx.d.ts → extension-api-B4gG5w1K.d.ts} +1000 -108
- package/dist/extension-api.d.ts +385 -50
- package/dist/extension-api.d.ts.map +1 -1
- package/dist/external-action-source.d.ts +3 -1
- package/dist/external-action-source.d.ts.map +1 -1
- package/dist/external-source-poll.d.ts +8 -1
- package/dist/external-source-poll.d.ts.map +1 -1
- package/dist/flow.d.ts +308 -11
- package/dist/flow.d.ts.map +1 -1
- package/dist/form-contract.d.ts +1 -1
- package/dist/form-contract.d.ts.map +1 -1
- package/dist/fs-utils.d.ts +4 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/git-binary.d.ts +2 -1
- package/dist/git-binary.d.ts.map +1 -1
- package/dist/git-binary.js.map +1 -1
- package/dist/graph-fragments.d.ts +16 -0
- package/dist/graph-fragments.d.ts.map +1 -1
- package/dist/host-capabilities.d.ts +9 -3
- package/dist/host-capabilities.d.ts.map +1 -1
- package/dist/index.d.ts +24 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +262 -80
- package/dist/index.js.map +1 -1
- package/dist/integration-http.d.ts +14 -3
- package/dist/integration-http.d.ts.map +1 -1
- package/dist/json-data.d.ts +1 -1
- package/dist/json-data.d.ts.map +1 -1
- package/dist/leaf-outcome-renderer.d.ts +35 -0
- package/dist/leaf-outcome-renderer.d.ts.map +1 -1
- package/dist/leaf-outcome-renderer.js +12 -0
- package/dist/leaf-outcome-renderer.js.map +1 -1
- package/dist/leaf-outcomes.d.ts +3 -0
- package/dist/leaf-outcomes.d.ts.map +1 -1
- package/dist/model-provider.d.ts +144 -12
- package/dist/model-provider.d.ts.map +1 -1
- package/dist/pi-config-public.d.ts +2 -0
- package/dist/pi-config-public.d.ts.map +1 -0
- package/dist/pi-config-public.js +15 -0
- package/dist/pi-config-public.js.map +1 -0
- package/dist/pi-config.d.ts +40 -0
- package/dist/pi-config.d.ts.map +1 -1
- package/dist/pi-config.js +1 -1
- package/dist/process-definition-internals.d.ts +4 -0
- package/dist/process-definition-internals.d.ts.map +1 -1
- package/dist/process-flow-view.d.ts +2 -0
- package/dist/process-flow-view.d.ts.map +1 -1
- package/dist/process-graph.d.ts +34 -0
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-launcher-builder.d.ts +5 -0
- package/dist/process-launcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-builder.d.ts +5 -0
- package/dist/process-watcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-source.d.ts +3 -1
- package/dist/process-watcher-source.d.ts.map +1 -1
- package/dist/project-binding.d.ts +5 -1
- package/dist/project-binding.d.ts.map +1 -1
- package/dist/registry-utils.d.ts +6 -0
- package/dist/registry-utils.d.ts.map +1 -1
- package/dist/repository-feedback.d.ts +20 -2
- package/dist/repository-feedback.d.ts.map +1 -1
- package/dist/repository-git-env.d.ts +6 -2
- package/dist/repository-git-env.d.ts.map +1 -1
- package/dist/repository-http.d.ts +13 -1
- package/dist/repository-http.d.ts.map +1 -1
- package/dist/repository-https.d.ts +1 -1
- package/dist/repository-https.d.ts.map +1 -1
- package/dist/repository-issue-watcher.d.ts +21 -1
- package/dist/repository-issue-watcher.d.ts.map +1 -1
- package/dist/repository-reconciliation.d.ts +5 -0
- package/dist/repository-reconciliation.d.ts.map +1 -0
- package/dist/repository-source-config.d.ts +27 -1
- package/dist/repository-source-config.d.ts.map +1 -1
- package/dist/repository-types.d.ts +28 -1
- package/dist/repository-types.d.ts.map +1 -1
- package/dist/review-flow-public.d.ts +2 -0
- package/dist/review-flow-public.d.ts.map +1 -0
- package/dist/review-flow-public.js +11 -0
- package/dist/review-flow-public.js.map +1 -0
- package/dist/review-flow.d.ts +6 -0
- package/dist/review-flow.d.ts.map +1 -1
- package/dist/review-flow.js +1 -1
- package/dist/runtime-internals-public.d.ts +2 -0
- package/dist/runtime-internals-public.d.ts.map +1 -0
- package/dist/runtime-internals-public.js +16 -0
- package/dist/runtime-internals-public.js.map +1 -0
- package/dist/runtime-internals.js +2 -1
- package/dist/server-events.d.ts +67 -0
- package/dist/server-events.d.ts.map +1 -1
- package/dist/server-process-builder.d.ts +7 -0
- package/dist/server-process-builder.d.ts.map +1 -1
- package/dist/state-helpers.d.ts +6 -0
- package/dist/state-helpers.d.ts.map +1 -1
- package/dist/subprocess-env.d.ts +3 -0
- package/dist/subprocess-env.d.ts.map +1 -1
- package/dist/tool-arguments.d.ts +4 -2
- package/dist/tool-arguments.d.ts.map +1 -1
- package/dist/tool-renderers.d.ts +6 -0
- package/dist/tool-renderers.d.ts.map +1 -1
- package/dist/turn-semantics.d.ts +14 -1
- package/dist/turn-semantics.d.ts.map +1 -1
- package/dist/types.d.ts +205 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/ui-process-builder.d.ts +5 -0
- package/dist/ui-process-builder.d.ts.map +1 -1
- package/dist/worker-process-builder.d.ts +5 -0
- package/dist/worker-process-builder.d.ts.map +1 -1
- package/package.json +16 -15
- package/src/browser-ui-extension.ts +20 -0
- package/src/capabilities.ts +9 -1
- package/src/codecs.ts +1 -0
- package/src/commit-message.ts +5 -0
- package/src/core-capabilities.ts +396 -35
- package/src/define-process.ts +198 -23
- package/src/event-bus.ts +1 -0
- package/src/extension-api.ts +399 -55
- package/src/external-action-source.ts +7 -2
- package/src/external-source-poll.ts +15 -3
- package/src/flow.ts +352 -23
- package/src/form-contract.ts +0 -4
- package/src/fs-utils.ts +4 -0
- package/src/git-binary.ts +2 -1
- package/src/graph-fragments.ts +16 -0
- package/src/host-capabilities.ts +9 -6
- package/src/index.ts +5 -201
- package/src/integration-http.ts +15 -3
- package/src/json-data.ts +1 -1
- package/src/leaf-outcome-renderer.ts +35 -0
- package/src/leaf-outcomes.ts +3 -0
- package/src/model-provider.ts +169 -20
- package/src/pi-config-public.ts +7 -0
- package/src/pi-config.ts +47 -2
- package/src/process-definition-internals.ts +4 -0
- package/src/process-flow-view.ts +2 -0
- package/src/process-graph.ts +34 -0
- package/src/process-launcher-builder.ts +5 -0
- package/src/process-watcher-builder.ts +5 -0
- package/src/process-watcher-source.ts +6 -4
- package/src/project-binding.ts +5 -1
- package/src/registry-utils.ts +6 -0
- package/src/repository-feedback.ts +30 -4
- package/src/repository-git-env.ts +6 -2
- package/src/repository-http.ts +19 -2
- package/src/repository-https.ts +1 -1
- package/src/repository-issue-watcher.ts +35 -5
- package/src/repository-reconciliation.ts +30 -0
- package/src/repository-source-config.ts +20 -1
- package/src/repository-types.ts +43 -5
- package/src/review-flow-public.ts +5 -0
- package/src/review-flow.ts +6 -0
- package/src/runtime-internals-public.ts +7 -0
- package/src/server-events.ts +67 -0
- package/src/server-process-builder.ts +10 -1
- package/src/state-helpers.ts +6 -0
- package/src/subprocess-env.ts +3 -0
- package/src/tool-arguments.ts +4 -2
- package/src/tool-renderers.ts +6 -0
- package/src/turn-semantics.ts +15 -2
- package/src/types.ts +212 -30
- package/src/ui-process-builder.ts +8 -1
- package/src/worker-process-builder.ts +8 -1
- package/dist/chunk-LIIP7FMU.js.map +0 -1
- package/dist/chunk-TA4KO53Q.js.map +0 -1
- package/dist/chunk-WFY2WWZE.js.map +0 -1
package/src/extension-api.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
TurnId,
|
|
14
14
|
TurnProgressReport,
|
|
15
15
|
} from "@leitwerk-dev/domain";
|
|
16
|
+
import type { ExternalWrites } from "@leitwerk-dev/external-writes";
|
|
16
17
|
import type { WatcherPresentationField } from "@leitwerk-dev/protocol";
|
|
17
18
|
import type { CapabilityToken } from "./capabilities.js";
|
|
18
19
|
import type { FormDefinition } from "./form-contract.js";
|
|
@@ -47,95 +48,150 @@ import type {
|
|
|
47
48
|
TurnOptions,
|
|
48
49
|
} from "./types.js";
|
|
49
50
|
|
|
51
|
+
/** @public */
|
|
50
52
|
export interface Codec<T> {
|
|
53
|
+
/** @public */
|
|
51
54
|
parse(value: unknown): T;
|
|
55
|
+
/** @public */
|
|
52
56
|
serialize(value: T): unknown;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
/** @internal */
|
|
55
60
|
export interface LauncherModelProfileSummary {
|
|
61
|
+
/** @internal */
|
|
56
62
|
readonly id: string;
|
|
63
|
+
/** @internal */
|
|
57
64
|
readonly provider: string;
|
|
65
|
+
/** @internal */
|
|
58
66
|
readonly modelId: string;
|
|
67
|
+
/** @internal */
|
|
59
68
|
readonly thinkingLevel: string;
|
|
60
69
|
}
|
|
61
70
|
|
|
71
|
+
/** @public */
|
|
62
72
|
export interface LauncherContext {
|
|
73
|
+
/** @internal */
|
|
63
74
|
readonly process?: ProcessInstance;
|
|
75
|
+
/** @internal */
|
|
64
76
|
readonly projects?: readonly ProcessProject[];
|
|
65
77
|
/**
|
|
66
78
|
* Effective model profiles available to this launch path.
|
|
67
79
|
* The server may filter this list per process (for example via process allowlists)
|
|
68
80
|
* before invoking UI launcher or process watcher code.
|
|
69
81
|
*/
|
|
82
|
+
/** @internal */
|
|
70
83
|
readonly modelProfiles?: readonly LauncherModelProfileSummary[];
|
|
71
84
|
}
|
|
72
85
|
|
|
86
|
+
/** @public */
|
|
73
87
|
export type LauncherVisibility = "ui";
|
|
74
88
|
|
|
89
|
+
/** @public */
|
|
75
90
|
export interface ProcessLaunchProjectConfig {
|
|
91
|
+
/** @public */
|
|
76
92
|
key: string;
|
|
93
|
+
/** @public */
|
|
77
94
|
repoLocator: string;
|
|
95
|
+
/** @public */
|
|
78
96
|
baseBranch: string;
|
|
97
|
+
/** @public */
|
|
79
98
|
workBranch?: string | null;
|
|
99
|
+
/** @public */
|
|
80
100
|
externalId?: string | null;
|
|
101
|
+
/** @public */
|
|
81
102
|
externalUrl?: string | null;
|
|
103
|
+
/** @public */
|
|
82
104
|
metadata?: Record<string, unknown> | null;
|
|
83
105
|
}
|
|
84
106
|
|
|
107
|
+
/** @public */
|
|
85
108
|
export interface ProcessTitleSourceField {
|
|
86
|
-
/** Short label shown to the title-generation model, e.g. "Prompt" or "Summary". */
|
|
109
|
+
/** Short label shown to the title-generation model, e.g. "Prompt" or "Summary". @public */
|
|
87
110
|
label: string;
|
|
88
|
-
/** Launcher-selected descriptive text to summarize into a short operator-facing title. */
|
|
111
|
+
/** Launcher-selected descriptive text to summarize into a short operator-facing title. @public */
|
|
89
112
|
value: string;
|
|
90
113
|
}
|
|
91
114
|
|
|
115
|
+
/** @public */
|
|
92
116
|
export interface ProcessLaunchConfig<TParams = unknown> {
|
|
117
|
+
/** @public */
|
|
93
118
|
processId: string;
|
|
119
|
+
/** @public */
|
|
94
120
|
params: TParams;
|
|
121
|
+
/** @public */
|
|
95
122
|
startTurnId?: TurnId | null;
|
|
96
|
-
/** Explicit operator-facing title. UI launches may override this with the built-in title input before persistence. */
|
|
123
|
+
/** Explicit operator-facing title. UI launches may override this with the built-in title input before persistence. @public */
|
|
97
124
|
title?: string | null;
|
|
98
|
-
/** Explicit launcher-selected fields for optional server-side title generation when title is blank. */
|
|
125
|
+
/** Explicit launcher-selected fields for optional server-side title generation when title is blank. @public */
|
|
99
126
|
titleSourceFields?: readonly ProcessTitleSourceField[];
|
|
127
|
+
/** @public */
|
|
100
128
|
externalId?: string | null;
|
|
129
|
+
/** @public */
|
|
101
130
|
externalUrl?: string | null;
|
|
131
|
+
/** @public */
|
|
102
132
|
metadata?: Record<string, unknown> | null;
|
|
133
|
+
/** @internal */
|
|
103
134
|
defaultModelProfileId?: string | null;
|
|
104
|
-
|
|
105
|
-
|
|
135
|
+
/** @internal */
|
|
136
|
+
turnConfigs?: Record<
|
|
137
|
+
string,
|
|
138
|
+
{
|
|
139
|
+
/** @internal */
|
|
140
|
+
modelProfileId?: string | null;
|
|
141
|
+
}
|
|
142
|
+
>;
|
|
143
|
+
/** Skill ids resolved to active immutable revisions before process creation. @internal */
|
|
106
144
|
skillIds?: readonly string[];
|
|
145
|
+
/** @public */
|
|
107
146
|
projects?: readonly ProcessLaunchProjectConfig[];
|
|
108
147
|
}
|
|
109
148
|
|
|
149
|
+
/** @public */
|
|
110
150
|
export type UiLauncherConfigResolution<TParams = unknown> =
|
|
111
151
|
| {
|
|
152
|
+
/** @public */
|
|
112
153
|
ok: true;
|
|
154
|
+
/** @public */
|
|
113
155
|
launchConfig: ProcessLaunchConfig<TParams>;
|
|
114
156
|
}
|
|
115
157
|
| {
|
|
158
|
+
/** @public */
|
|
116
159
|
ok: false;
|
|
160
|
+
/** @public */
|
|
117
161
|
errors: readonly LauncherValidationError[];
|
|
118
162
|
};
|
|
119
163
|
|
|
164
|
+
/** @public */
|
|
120
165
|
export interface LaunchPreparationContext<TParams = unknown> {
|
|
166
|
+
/** @public */
|
|
121
167
|
readonly signal: AbortSignal;
|
|
168
|
+
/** @public */
|
|
122
169
|
readonly launchConfig: ProcessLaunchConfig<TParams>;
|
|
170
|
+
/** @public */
|
|
123
171
|
readonly logger: {
|
|
172
|
+
/** @internal */
|
|
124
173
|
info(message: string): void;
|
|
174
|
+
/** @public */
|
|
125
175
|
warn(message: string): void;
|
|
126
176
|
};
|
|
127
177
|
}
|
|
128
178
|
|
|
179
|
+
/** @public */
|
|
129
180
|
export interface LaunchPreparationCheck<TParams = unknown> {
|
|
181
|
+
/** @public */
|
|
130
182
|
readonly id: string;
|
|
183
|
+
/** @public */
|
|
131
184
|
readonly label: string;
|
|
185
|
+
/** @public */
|
|
132
186
|
run(ctx: LaunchPreparationContext<TParams>): Promise<void>;
|
|
133
187
|
}
|
|
134
188
|
|
|
135
|
-
/** A launcher check may throw this error to expose bounded operator-safe remediation. */
|
|
189
|
+
/** A launcher check may throw this error to expose bounded operator-safe remediation. @public */
|
|
136
190
|
export class SafeLaunchPreparationError extends Error {
|
|
191
|
+
/** @public */
|
|
137
192
|
constructor(
|
|
138
193
|
message: string,
|
|
194
|
+
/** @internal */
|
|
139
195
|
readonly safeSummary: string,
|
|
140
196
|
) {
|
|
141
197
|
super(message);
|
|
@@ -143,12 +199,17 @@ export class SafeLaunchPreparationError extends Error {
|
|
|
143
199
|
}
|
|
144
200
|
}
|
|
145
201
|
|
|
202
|
+
/** @public */
|
|
146
203
|
export interface UiLauncherDefinition<TParams = unknown> {
|
|
204
|
+
/** @public */
|
|
147
205
|
card: LauncherCardMetadata;
|
|
206
|
+
/** @public */
|
|
148
207
|
launchConfigSchema: LauncherSchemaDefinition;
|
|
208
|
+
/** @public */
|
|
149
209
|
resolveDefaults?(
|
|
150
210
|
ctx: LauncherContext,
|
|
151
211
|
): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
212
|
+
/** @public */
|
|
152
213
|
resolveOptions?(
|
|
153
214
|
input: Record<string, unknown>,
|
|
154
215
|
ctx: LauncherContext,
|
|
@@ -159,126 +220,184 @@ export interface UiLauncherDefinition<TParams = unknown> {
|
|
|
159
220
|
* Convert persisted operator input into a new-launch draft. The default preserves
|
|
160
221
|
* the complete input. Launchers override this only for values that must be rebuilt.
|
|
161
222
|
*/
|
|
223
|
+
/** @public */
|
|
162
224
|
resolveRelaunchInput?(
|
|
163
225
|
previousInput: Record<string, unknown>,
|
|
164
226
|
ctx: LauncherContext,
|
|
165
227
|
): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
228
|
+
/** @public */
|
|
166
229
|
preparationChecks?(
|
|
167
230
|
input: Record<string, unknown>,
|
|
168
231
|
launchConfig: ProcessLaunchConfig<TParams>,
|
|
169
232
|
): readonly LaunchPreparationCheck<TParams>[];
|
|
233
|
+
/** @public */
|
|
170
234
|
resolveLaunchConfig(
|
|
171
235
|
input: Record<string, unknown>,
|
|
172
236
|
ctx: LauncherContext,
|
|
173
237
|
): UiLauncherConfigResolution<TParams> | Promise<UiLauncherConfigResolution<TParams>>;
|
|
174
238
|
}
|
|
175
239
|
|
|
176
|
-
|
|
177
|
-
|
|
240
|
+
/** @public */
|
|
178
241
|
export interface ProcessWatcherPresentation {
|
|
242
|
+
/** @public */
|
|
179
243
|
readonly targetSummary: string;
|
|
244
|
+
/** @public */
|
|
180
245
|
readonly details?: readonly WatcherPresentationField[];
|
|
181
246
|
}
|
|
182
247
|
|
|
248
|
+
/** @public */
|
|
183
249
|
export interface ParsedProcessWatcherConfig<TConfig = unknown> {
|
|
250
|
+
/** @public */
|
|
184
251
|
readonly config: TConfig;
|
|
252
|
+
/** @public */
|
|
185
253
|
readonly enabled: boolean;
|
|
254
|
+
/** @public */
|
|
186
255
|
readonly launchModelConfig?: LaunchModelConfigInput;
|
|
187
256
|
}
|
|
188
257
|
|
|
189
|
-
/** A watcher source is defined and owned by the extension that implements it. */
|
|
258
|
+
/** A watcher source is defined and owned by the extension that implements it. @public */
|
|
190
259
|
export interface ProcessWatcherSource<TConfig = unknown, TEvent = unknown> {
|
|
260
|
+
/** @public */
|
|
191
261
|
readonly id: string;
|
|
262
|
+
/** @public */
|
|
192
263
|
readonly label: string;
|
|
193
|
-
/** Type-only marker used to carry the provider event type across the source seam. */
|
|
264
|
+
/** Type-only marker used to carry the provider event type across the source seam. @internal */
|
|
194
265
|
readonly eventType?: TEvent;
|
|
266
|
+
/** @public */
|
|
195
267
|
parseConfig(raw: unknown): ParsedProcessWatcherConfig<TConfig>;
|
|
268
|
+
/** @public */
|
|
196
269
|
presentConfig(config: TConfig): ProcessWatcherPresentation;
|
|
197
270
|
}
|
|
198
271
|
|
|
272
|
+
/** @public */
|
|
199
273
|
export interface ProcessWatcherDefinition<TParams = unknown, TEvent = unknown, TConfig = unknown> {
|
|
274
|
+
/** @public */
|
|
200
275
|
id: string;
|
|
276
|
+
/** @public */
|
|
201
277
|
label: string;
|
|
278
|
+
/** @public */
|
|
202
279
|
description: string;
|
|
280
|
+
/** @public */
|
|
203
281
|
source: ProcessWatcherSource<TConfig, TEvent>;
|
|
282
|
+
/** @internal */
|
|
204
283
|
matches?(event: TEvent, ctx: LauncherContext): boolean | Promise<boolean>;
|
|
284
|
+
/** @public */
|
|
205
285
|
preparationChecks?(
|
|
206
286
|
event: TEvent,
|
|
207
287
|
launchConfig: ProcessLaunchConfig<TParams>,
|
|
208
288
|
): readonly LaunchPreparationCheck<TParams>[];
|
|
289
|
+
/** @public */
|
|
209
290
|
resolveLaunchConfig(
|
|
210
291
|
event: TEvent,
|
|
211
292
|
ctx: LauncherContext,
|
|
212
293
|
): ProcessLaunchConfig<TParams> | Promise<ProcessLaunchConfig<TParams>>;
|
|
213
294
|
}
|
|
214
295
|
|
|
296
|
+
/** @public */
|
|
215
297
|
export interface ProcessLauncherDefinition<TParams = unknown> {
|
|
298
|
+
/** @public */
|
|
216
299
|
id: string;
|
|
300
|
+
/** @public */
|
|
217
301
|
label: string;
|
|
302
|
+
/** @public */
|
|
218
303
|
description: string;
|
|
304
|
+
/** @public */
|
|
219
305
|
visibility: LauncherVisibility;
|
|
306
|
+
/** @public */
|
|
220
307
|
ui: UiLauncherDefinition<TParams>;
|
|
221
308
|
}
|
|
222
309
|
|
|
310
|
+
/** @internal */
|
|
223
311
|
export interface ProcessLaunchPlanProcessInput extends ProcessCustomizableFields {
|
|
312
|
+
/** @internal */
|
|
224
313
|
processId: string;
|
|
314
|
+
/** @internal */
|
|
225
315
|
selectedTurnId: string | null;
|
|
316
|
+
/** @internal */
|
|
226
317
|
lifecycleStatus: ProcessLifecycleStatus;
|
|
318
|
+
/** @internal */
|
|
227
319
|
paramsJson: string | null;
|
|
320
|
+
/** @internal */
|
|
228
321
|
stateJson: string | null;
|
|
229
322
|
}
|
|
230
323
|
|
|
324
|
+
/** @internal */
|
|
231
325
|
export interface ProcessLaunchPlan {
|
|
326
|
+
/** @internal */
|
|
232
327
|
launcherId: string;
|
|
328
|
+
/** @internal */
|
|
233
329
|
processId: string;
|
|
330
|
+
/** @internal */
|
|
234
331
|
processInput: ProcessLaunchPlanProcessInput;
|
|
235
|
-
/** Optional server-owned idempotency key for cross-process handoffs. */
|
|
332
|
+
/** Optional server-owned idempotency key for cross-process handoffs. @internal */
|
|
236
333
|
handoffDedupKey?: string | null;
|
|
237
|
-
/** Carry-forward launcher-selected fields for optional server-side title generation. */
|
|
334
|
+
/** Carry-forward launcher-selected fields for optional server-side title generation. @internal */
|
|
238
335
|
titleSourceFields?: readonly ProcessTitleSourceField[];
|
|
336
|
+
/** @internal */
|
|
239
337
|
projectInputs: readonly ProcessLaunchProjectConfig[];
|
|
338
|
+
/** @internal */
|
|
240
339
|
startTurnId: TurnId | null;
|
|
340
|
+
/** @internal */
|
|
241
341
|
skillIds?: readonly string[];
|
|
242
342
|
}
|
|
243
343
|
|
|
344
|
+
/** @internal */
|
|
244
345
|
export interface ResolvedProcessLauncher<TParams = unknown> {
|
|
346
|
+
/** @internal */
|
|
245
347
|
launcherId: string;
|
|
348
|
+
/** @internal */
|
|
246
349
|
processId: string;
|
|
350
|
+
/** @internal */
|
|
247
351
|
displayName: string;
|
|
352
|
+
/** @internal */
|
|
248
353
|
launchConfig: ProcessLaunchConfig<TParams>;
|
|
354
|
+
/** @internal */
|
|
249
355
|
launchPlan: ProcessLaunchPlan;
|
|
250
356
|
}
|
|
251
357
|
|
|
358
|
+
/** @internal */
|
|
252
359
|
export type UiLauncherResolutionResult<TParams = unknown> =
|
|
253
360
|
| {
|
|
361
|
+
/** @internal */
|
|
254
362
|
ok: true;
|
|
363
|
+
/** @internal */
|
|
255
364
|
launcher: ResolvedProcessLauncher<TParams>;
|
|
256
365
|
}
|
|
257
366
|
| {
|
|
367
|
+
/** @internal */
|
|
258
368
|
ok: false;
|
|
369
|
+
/** @internal */
|
|
259
370
|
errors: readonly LauncherValidationError[];
|
|
260
371
|
};
|
|
261
372
|
|
|
373
|
+
/** @internal */
|
|
262
374
|
export interface UiLauncherSummary extends UiLauncherSummaryBase {}
|
|
263
375
|
|
|
376
|
+
/** @internal */
|
|
264
377
|
export interface ProcessLauncherService {
|
|
378
|
+
/** @internal */
|
|
265
379
|
listUiLaunchers(): readonly UiLauncherSummary[];
|
|
380
|
+
/** @internal */
|
|
266
381
|
resolveUiDefaults(launcherId: string, ctx?: LauncherContext): Promise<Record<string, unknown>>;
|
|
382
|
+
/** @internal */
|
|
267
383
|
resolveUiOptions(
|
|
268
384
|
launcherId: string,
|
|
269
385
|
input: Record<string, unknown>,
|
|
270
386
|
ctx?: LauncherContext,
|
|
271
387
|
): Promise<Record<string, readonly LauncherFieldOptionDefinition[]>>;
|
|
388
|
+
/** @internal */
|
|
272
389
|
resolveUiRelaunchInput(
|
|
273
390
|
launcherId: string,
|
|
274
391
|
previousInput: Record<string, unknown>,
|
|
275
392
|
ctx?: LauncherContext,
|
|
276
393
|
): Promise<Record<string, unknown>>;
|
|
394
|
+
/** @internal */
|
|
277
395
|
resolvePreparationChecks?(
|
|
278
396
|
launcherId: string,
|
|
279
397
|
input: Record<string, unknown>,
|
|
280
398
|
launchConfig: ProcessLaunchConfig,
|
|
281
399
|
): readonly LaunchPreparationCheck[];
|
|
400
|
+
/** @internal */
|
|
282
401
|
resolveUiLauncher(
|
|
283
402
|
launcherId: string,
|
|
284
403
|
input: Record<string, unknown>,
|
|
@@ -286,7 +405,7 @@ export interface ProcessLauncherService {
|
|
|
286
405
|
): Promise<UiLauncherResolutionResult>;
|
|
287
406
|
}
|
|
288
407
|
|
|
289
|
-
/** Resolve a UI launcher summary by id, returning `null` when it is unknown. */
|
|
408
|
+
/** Resolve a UI launcher summary by id, returning `null` when it is unknown. @internal */
|
|
290
409
|
export function findUiLauncherById(
|
|
291
410
|
launcherService: Pick<ProcessLauncherService, "listUiLaunchers">,
|
|
292
411
|
launcherId: string,
|
|
@@ -294,66 +413,101 @@ export function findUiLauncherById(
|
|
|
294
413
|
return launcherService.listUiLaunchers().find((launcher) => launcher.id === launcherId) ?? null;
|
|
295
414
|
}
|
|
296
415
|
|
|
416
|
+
/** @public */
|
|
297
417
|
export interface ProcessTurnOutcomeEvent {
|
|
418
|
+
/** @internal */
|
|
298
419
|
turnRecordId: string;
|
|
420
|
+
/** @internal */
|
|
299
421
|
turnId: string;
|
|
422
|
+
/** @internal */
|
|
300
423
|
outcome: string;
|
|
424
|
+
/** @public */
|
|
301
425
|
params: Record<string, unknown>;
|
|
426
|
+
/** @internal */
|
|
302
427
|
turnResultMarkdown?: string | null;
|
|
303
428
|
}
|
|
304
429
|
|
|
430
|
+
/** @internal */
|
|
305
431
|
export type ProcessCleanupReason = "abort";
|
|
306
432
|
|
|
433
|
+
/** @internal */
|
|
307
434
|
export interface ProcessCleanupResult<TState = unknown> extends ProcessLifecycleEffects {
|
|
435
|
+
/** @internal */
|
|
308
436
|
state?: TState;
|
|
309
437
|
}
|
|
310
438
|
|
|
439
|
+
/** @internal */
|
|
311
440
|
export interface ProcessCleanupContext<TParams = unknown, TState = unknown>
|
|
312
441
|
extends ProcessSnapshotContext<TParams, TState> {
|
|
442
|
+
/** @internal */
|
|
313
443
|
readonly reason: ProcessCleanupReason;
|
|
314
444
|
}
|
|
315
445
|
|
|
446
|
+
/** @internal */
|
|
316
447
|
export type ProcessCleanupHandler<TParams = unknown, TState = unknown> = (
|
|
317
448
|
ctx: ProcessCleanupContext<TParams, TState>,
|
|
318
449
|
) => undefined | ProcessCleanupResult<TState> | Promise<ProcessCleanupResult<TState> | undefined>;
|
|
319
450
|
|
|
451
|
+
/** @internal */
|
|
320
452
|
export interface LeafOutcomeCaptureContext<TParams = unknown, TState = unknown>
|
|
321
453
|
extends ProcessSnapshotContext<TParams, TState> {
|
|
454
|
+
/** @internal */
|
|
322
455
|
readonly leaf: {
|
|
456
|
+
/** @internal */
|
|
323
457
|
entryId: string;
|
|
458
|
+
/** @internal */
|
|
324
459
|
turnRecordId: string | null;
|
|
325
460
|
};
|
|
461
|
+
/** @internal */
|
|
326
462
|
readonly turnRecord: ProcessTurnRecord | null;
|
|
463
|
+
/** @internal */
|
|
327
464
|
readTreeEntry(entryId: string): PiTreeEntry | null;
|
|
465
|
+
/** @internal */
|
|
328
466
|
readLeafEntry(): PiTreeEntry | null;
|
|
467
|
+
/** @internal */
|
|
329
468
|
readTurnRecord(turnRecordId: string): ProcessTurnRecord | null;
|
|
330
469
|
}
|
|
331
470
|
|
|
471
|
+
/** @internal */
|
|
332
472
|
export interface LeafOutcomeCaptureResult {
|
|
473
|
+
/** @internal */
|
|
333
474
|
rendererId: string;
|
|
475
|
+
/** @internal */
|
|
334
476
|
schemaVersion?: number;
|
|
477
|
+
/** @internal */
|
|
335
478
|
props: Record<string, unknown>;
|
|
479
|
+
/** @internal */
|
|
336
480
|
fallbackMarkdown?: string | null;
|
|
337
481
|
}
|
|
338
482
|
|
|
483
|
+
/** @internal */
|
|
339
484
|
export interface ProcessLeafOutcomeDefinition<TParams = unknown, TState = unknown> {
|
|
485
|
+
/** @internal */
|
|
340
486
|
rendererId: string;
|
|
487
|
+
/** @internal */
|
|
341
488
|
capture(
|
|
342
489
|
ctx: LeafOutcomeCaptureContext<TParams, TState>,
|
|
343
490
|
): Promise<LeafOutcomeCaptureResult | null> | LeafOutcomeCaptureResult | null;
|
|
344
491
|
}
|
|
345
492
|
|
|
493
|
+
/** @internal */
|
|
346
494
|
export interface ProcessActionDefinition<TParams = unknown, TState = unknown> {
|
|
495
|
+
/** @internal */
|
|
347
496
|
id: string;
|
|
497
|
+
/** @internal */
|
|
348
498
|
label: string;
|
|
499
|
+
/** @internal */
|
|
349
500
|
form?: FormDefinition;
|
|
501
|
+
/** @internal */
|
|
350
502
|
preview?: ProcessActionPreviewDefinition;
|
|
503
|
+
/** @internal */
|
|
351
504
|
scheduling?: ProcessActionSchedulingDefinition;
|
|
352
505
|
/**
|
|
353
506
|
* Explicitly marks an action as an immediate-only side-effect command. Such
|
|
354
507
|
* actions must declare execute(...), cannot participate in pure preview or
|
|
355
508
|
* scheduling flows, and are run only by immediate action execution.
|
|
356
509
|
*/
|
|
510
|
+
/** @internal */
|
|
357
511
|
executionMode?: "side_effect";
|
|
358
512
|
/**
|
|
359
513
|
* Optional pure planner used for side-effect-free previews, scheduling validation,
|
|
@@ -361,58 +515,79 @@ export interface ProcessActionDefinition<TParams = unknown, TState = unknown> {
|
|
|
361
515
|
* transition/input/event plan from this hook without committing side effects
|
|
362
516
|
* while the hook runs.
|
|
363
517
|
*/
|
|
518
|
+
/** @internal */
|
|
364
519
|
plan?(input: Record<string, unknown>, ctx: ServerProcessContext<TParams, TState>): Promise<void>;
|
|
365
520
|
/**
|
|
366
521
|
* Imperative hook for actions with executionMode: "side_effect". Use only for
|
|
367
522
|
* immediate side effects that cannot be represented as a pure plan(...).
|
|
368
523
|
*/
|
|
524
|
+
/** @internal */
|
|
369
525
|
execute?(
|
|
370
526
|
input: Record<string, unknown>,
|
|
371
527
|
ctx: ServerProcessContext<TParams, TState>,
|
|
372
528
|
): Promise<void>;
|
|
373
529
|
}
|
|
374
530
|
|
|
531
|
+
/** @internal */
|
|
375
532
|
export type ServerTransitionRuntime = "reconcile" | "restart_worker";
|
|
376
533
|
|
|
534
|
+
/** @internal */
|
|
377
535
|
export interface ServerTransitionEffect {
|
|
378
536
|
/**
|
|
379
537
|
* Declares how the server runtime should handle the worker context after the
|
|
380
538
|
* durable transition is committed.
|
|
381
539
|
*/
|
|
540
|
+
/** @internal */
|
|
382
541
|
runtime?: ServerTransitionRuntime;
|
|
383
542
|
}
|
|
384
543
|
|
|
544
|
+
/** @internal */
|
|
385
545
|
export interface ServerTransitionRequest<TState = unknown> {
|
|
546
|
+
/** @internal */
|
|
386
547
|
lifecycleStatus?: ProcessLifecycleStatus;
|
|
548
|
+
/** @internal */
|
|
387
549
|
turnId?: TurnId | null;
|
|
550
|
+
/** @internal */
|
|
388
551
|
state?: TState;
|
|
389
|
-
/** State machine trigger for the selected-turn graph. */
|
|
552
|
+
/** State machine trigger for the selected-turn graph. @internal */
|
|
390
553
|
trigger?: string;
|
|
554
|
+
/** @internal */
|
|
391
555
|
effect?: ServerTransitionEffect;
|
|
392
556
|
}
|
|
393
557
|
|
|
558
|
+
/** @public */
|
|
394
559
|
export interface ProcessSnapshotContext<TParams = unknown, TState = unknown> {
|
|
560
|
+
/** @public */
|
|
395
561
|
readonly process: ProcessInstance;
|
|
562
|
+
/** @public */
|
|
396
563
|
readonly projects: readonly ProcessProject[];
|
|
564
|
+
/** @public */
|
|
397
565
|
readonly params: TParams;
|
|
566
|
+
/** @public */
|
|
398
567
|
readonly state: TState;
|
|
399
568
|
}
|
|
400
569
|
|
|
570
|
+
/** @public */
|
|
401
571
|
export type ExternalSourceInputMode = "none" | "input" | "instruction";
|
|
402
572
|
|
|
573
|
+
/** @public */
|
|
403
574
|
export interface ExternalSourceResolveContext<TParams = unknown, TState = unknown>
|
|
404
575
|
extends ProcessSnapshotContext<TParams, TState> {}
|
|
405
576
|
|
|
577
|
+
/** @public */
|
|
406
578
|
export interface ExternalSourceEffectContext<
|
|
407
579
|
TParams = unknown,
|
|
408
580
|
TState = unknown,
|
|
409
581
|
TEvent = unknown,
|
|
410
582
|
TInput extends Record<string, unknown> = Record<string, unknown>,
|
|
411
583
|
> extends ProcessSnapshotContext<TParams, TState> {
|
|
584
|
+
/** @public */
|
|
412
585
|
readonly event: TEvent;
|
|
586
|
+
/** @internal */
|
|
413
587
|
readonly input: TInput;
|
|
414
588
|
}
|
|
415
589
|
|
|
590
|
+
/** @public */
|
|
416
591
|
export type ExternalSourceEffect<
|
|
417
592
|
TParams = unknown,
|
|
418
593
|
TState = unknown,
|
|
@@ -422,37 +597,49 @@ export type ExternalSourceEffect<
|
|
|
422
597
|
ctx: ExternalSourceEffectContext<TParams, TState, TEvent, TInput>,
|
|
423
598
|
) => ProcessEffectPlan<TState> | Promise<ProcessEffectPlan<TState> | undefined> | undefined;
|
|
424
599
|
|
|
600
|
+
/** @public */
|
|
425
601
|
export interface ExternalEventDescription {
|
|
602
|
+
/** @public */
|
|
426
603
|
summary: string;
|
|
604
|
+
/** @internal */
|
|
427
605
|
markdown?: string;
|
|
606
|
+
/** @public */
|
|
428
607
|
links?: import("@leitwerk-dev/domain").TurnProgressLink[];
|
|
429
608
|
}
|
|
430
609
|
|
|
610
|
+
/** @public */
|
|
431
611
|
export interface ExternalActionSource<
|
|
432
612
|
TParams = unknown,
|
|
433
613
|
TState = unknown,
|
|
434
614
|
_TEvent = unknown,
|
|
435
615
|
_TInput extends Record<string, unknown> = Record<string, unknown>,
|
|
436
616
|
> {
|
|
617
|
+
/** @public */
|
|
437
618
|
kind: string;
|
|
619
|
+
/** @public */
|
|
438
620
|
label?: string;
|
|
621
|
+
/** @public */
|
|
439
622
|
description?: string;
|
|
440
|
-
/** Pure description captured when the event is consumed. */
|
|
623
|
+
/** Pure description captured when the event is consumed. @public */
|
|
441
624
|
describeEvent?(event: _TEvent): ExternalEventDescription;
|
|
442
625
|
/**
|
|
443
626
|
* Extension-owned opaque config. Core may persist, hash, and display it, but must not
|
|
444
627
|
* interpret provider-specific fields.
|
|
445
628
|
*/
|
|
629
|
+
/** @public */
|
|
446
630
|
config: unknown;
|
|
447
|
-
/** Source-provided input behavior. Provider input is only published when the external action declares publishInput. */
|
|
631
|
+
/** Source-provided input behavior. Provider input is only published when the external action declares publishInput. @public */
|
|
448
632
|
inputMode?: ExternalSourceInputMode;
|
|
449
|
-
/** Optional extension-owned resolver for process-instance-specific matching. */
|
|
633
|
+
/** Optional extension-owned resolver for process-instance-specific matching. @public */
|
|
450
634
|
resolve?(ctx: ExternalSourceResolveContext<TParams, TState>): unknown;
|
|
451
635
|
}
|
|
452
636
|
|
|
637
|
+
/** @public */
|
|
453
638
|
export interface ServerProcessContext<TParams = unknown, TState = unknown>
|
|
454
639
|
extends ProcessSnapshotContext<TParams, TState> {
|
|
640
|
+
/** @internal */
|
|
455
641
|
transition(next: ServerTransitionRequest<TState>): Promise<void>;
|
|
642
|
+
/** @internal */
|
|
456
643
|
emitEvent<K extends keyof ServerExtensionEventMap & string>(
|
|
457
644
|
eventType: K,
|
|
458
645
|
data: ServerExtensionEventPayloadInputMap[K],
|
|
@@ -463,6 +650,7 @@ export interface ServerProcessContext<TParams = unknown, TState = unknown>
|
|
|
463
650
|
* carry operator-facing markdown. Throws when persisted semantic-ref state is
|
|
464
651
|
* malformed.
|
|
465
652
|
*/
|
|
653
|
+
/** @internal */
|
|
466
654
|
readSemanticTurnResultMarkdown(ref: ProcessSemanticEntryRefKey): string | null;
|
|
467
655
|
/**
|
|
468
656
|
* Resolves non-empty turn-result markdown for a process-defined published product.
|
|
@@ -470,6 +658,7 @@ export interface ServerProcessContext<TParams = unknown, TState = unknown>
|
|
|
470
658
|
* not carry operator-facing markdown. Throws when persisted product-ref state is
|
|
471
659
|
* malformed.
|
|
472
660
|
*/
|
|
661
|
+
/** @internal */
|
|
473
662
|
readProductTurnResultMarkdown(productName: string): string | null;
|
|
474
663
|
/**
|
|
475
664
|
* Queue durable process input for worker delivery.
|
|
@@ -480,10 +669,15 @@ export interface ServerProcessContext<TParams = unknown, TState = unknown>
|
|
|
480
669
|
* input is the only new instruction: the worker does not replay the original
|
|
481
670
|
* kickoff prompt.
|
|
482
671
|
*/
|
|
672
|
+
/** @public */
|
|
483
673
|
queueInput(input: {
|
|
674
|
+
/** @public */
|
|
484
675
|
source: InputSource;
|
|
676
|
+
/** @public */
|
|
485
677
|
kind: InputKind;
|
|
678
|
+
/** @public */
|
|
486
679
|
bodyMarkdown: string;
|
|
680
|
+
/** @public */
|
|
487
681
|
target?: ProcessInputTarget;
|
|
488
682
|
}): void;
|
|
489
683
|
/**
|
|
@@ -491,46 +685,69 @@ export interface ServerProcessContext<TParams = unknown, TState = unknown>
|
|
|
491
685
|
* helpers. Raw process definitions should prefer intent helpers instead of
|
|
492
686
|
* constructing these effects directly.
|
|
493
687
|
*/
|
|
688
|
+
/** @internal */
|
|
494
689
|
applyLifecycleEffects?(effects: ProcessLifecycleEffects): void;
|
|
495
690
|
}
|
|
496
691
|
|
|
692
|
+
/** @public */
|
|
497
693
|
export interface WorkerProcessContext<TParams = unknown, TState = unknown>
|
|
498
694
|
extends ProcessSnapshotContext<TParams, TState> {
|
|
695
|
+
/** @internal */
|
|
499
696
|
readonly turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
|
|
697
|
+
/** @internal */
|
|
500
698
|
readonly turnResultMarkdownByProduct?: Readonly<Record<string, string>>;
|
|
501
|
-
/** Absolute workspace root for the current process instance, when available. */
|
|
699
|
+
/** Absolute workspace root for the current process instance, when available. @internal */
|
|
502
700
|
readonly workspaceRoot?: string;
|
|
503
|
-
/** Durable output produced by this LLM turn's preparation phase, when declared. */
|
|
701
|
+
/** Durable output produced by this LLM turn's preparation phase, when declared. @internal */
|
|
504
702
|
readonly prepared?: unknown;
|
|
505
|
-
/** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. */
|
|
703
|
+
/** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. @internal */
|
|
506
704
|
callIntegrationTool?(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
507
|
-
/** Replace the durable operator-facing progress report for this turn attempt. */
|
|
705
|
+
/** Replace the durable operator-facing progress report for this turn attempt. @internal */
|
|
508
706
|
reportProgress?(report: TurnProgressReport): void;
|
|
509
707
|
}
|
|
510
708
|
|
|
709
|
+
/** @public */
|
|
511
710
|
export interface WorkerCompleteInput<TOutcome extends string = string> {
|
|
711
|
+
/** @internal */
|
|
512
712
|
outcome: TOutcome;
|
|
713
|
+
/** @internal */
|
|
513
714
|
params?: Record<string, unknown>;
|
|
715
|
+
/** @internal */
|
|
514
716
|
markdown?: string | null;
|
|
717
|
+
/** @internal */
|
|
515
718
|
resultSummary?: string;
|
|
516
719
|
}
|
|
517
720
|
|
|
721
|
+
/** @internal */
|
|
518
722
|
export interface WorkerRunHandle<TParams = unknown, TState = unknown> {
|
|
723
|
+
/** @internal */
|
|
519
724
|
readonly ctx: WorkerProcessContext<TParams, TState>;
|
|
725
|
+
/** @internal */
|
|
520
726
|
turn<TOutcome extends string>(
|
|
521
727
|
def: LlmTurnDefinition<TOutcome, TParams, TState>,
|
|
522
728
|
options?: TurnOptions,
|
|
523
|
-
): Promise<{
|
|
729
|
+
): Promise<{
|
|
730
|
+
/** @internal */
|
|
731
|
+
outcome: TOutcome;
|
|
732
|
+
/** @internal */
|
|
733
|
+
params: Record<string, unknown>;
|
|
734
|
+
}>;
|
|
735
|
+
/** @internal */
|
|
524
736
|
complete<TOutcome extends string>(input: WorkerCompleteInput<TOutcome>): Promise<void>;
|
|
737
|
+
/** @internal */
|
|
525
738
|
park(reason?: string): void;
|
|
526
739
|
}
|
|
527
740
|
|
|
741
|
+
/** @internal */
|
|
528
742
|
export type WorkerTurnHandler<TParams = unknown, TState = unknown> = (
|
|
529
743
|
run: WorkerRunHandle<TParams, TState>,
|
|
530
744
|
) => Promise<void>;
|
|
531
745
|
|
|
746
|
+
/** @internal */
|
|
532
747
|
export interface ServerProcessAPI<TParams = unknown, TState = unknown> {
|
|
748
|
+
/** @internal */
|
|
533
749
|
action(def: ProcessActionDefinition<TParams, TState>): void;
|
|
750
|
+
/** @internal */
|
|
534
751
|
onTurnOutcome(
|
|
535
752
|
turnId: string,
|
|
536
753
|
handler: (
|
|
@@ -538,86 +755,125 @@ export interface ServerProcessAPI<TParams = unknown, TState = unknown> {
|
|
|
538
755
|
ctx: ServerProcessContext<TParams, TState>,
|
|
539
756
|
) => void | Promise<void>,
|
|
540
757
|
): void;
|
|
758
|
+
/** @internal */
|
|
541
759
|
onCleanup(handler: ProcessCleanupHandler<TParams, TState>): void;
|
|
542
760
|
}
|
|
543
761
|
|
|
762
|
+
/** @internal */
|
|
544
763
|
export interface WorkerProcessAPI<TParams = unknown, TState = unknown> {
|
|
764
|
+
/** @internal */
|
|
545
765
|
start(turnId: TurnId): void;
|
|
766
|
+
/** @internal */
|
|
546
767
|
turn(turnId: TurnId, handler: WorkerTurnHandler<TParams, TState>): void;
|
|
547
768
|
}
|
|
548
769
|
|
|
770
|
+
/** @public */
|
|
549
771
|
export interface UiProcessAPI<TParams = unknown, TState = unknown> {
|
|
772
|
+
/** @internal */
|
|
550
773
|
leafOutcome(def: ProcessLeafOutcomeDefinition<TParams, TState>): void;
|
|
551
774
|
}
|
|
552
775
|
|
|
776
|
+
/** @public */
|
|
553
777
|
export interface ProcessLauncherAPI<TParams = unknown> {
|
|
778
|
+
/** @public */
|
|
554
779
|
launcher(def: ProcessLauncherDefinition<TParams>): void;
|
|
555
780
|
}
|
|
556
781
|
|
|
782
|
+
/** @public */
|
|
557
783
|
export interface ProcessWatcherAPI<TParams = unknown> {
|
|
784
|
+
/** @public */
|
|
558
785
|
watcher<TEvent = unknown, TConfig = unknown>(
|
|
559
786
|
def: ProcessWatcherDefinition<TParams, TEvent, TConfig>,
|
|
560
787
|
): void;
|
|
561
788
|
}
|
|
562
789
|
|
|
790
|
+
/** @public */
|
|
563
791
|
export interface ProcessTurnBinding<TTurn = TurnDefinition> {
|
|
792
|
+
/** @public */
|
|
564
793
|
definition: TTurn;
|
|
565
794
|
}
|
|
566
795
|
|
|
796
|
+
/** @public */
|
|
567
797
|
export type RepositoryCredentialKind = "git_ssh" | "git_https";
|
|
568
798
|
|
|
569
|
-
/** Non-secret, code-defined repository authentication request. */
|
|
799
|
+
/** Non-secret, code-defined repository authentication request. @public */
|
|
570
800
|
export interface RepositoryCredentialRequirement {
|
|
801
|
+
/** @public */
|
|
571
802
|
readonly projectKey: string;
|
|
803
|
+
/** @public */
|
|
572
804
|
readonly kind: RepositoryCredentialKind;
|
|
805
|
+
/** @public */
|
|
573
806
|
readonly credentialRef: string;
|
|
574
807
|
}
|
|
575
808
|
|
|
576
|
-
/** Project fields available while deriving repository credential requirements. */
|
|
809
|
+
/** Project fields available while deriving repository credential requirements. @public */
|
|
577
810
|
export interface RepositoryCredentialProject {
|
|
811
|
+
/** @internal */
|
|
578
812
|
readonly key: string;
|
|
813
|
+
/** @internal */
|
|
579
814
|
readonly repoLocator: string;
|
|
815
|
+
/** @internal */
|
|
580
816
|
readonly baseBranch: string;
|
|
817
|
+
/** @internal */
|
|
581
818
|
readonly workBranch: string | null;
|
|
582
819
|
}
|
|
583
820
|
|
|
584
|
-
/** Secret material is intentionally restricted to server registration and worker.start. */
|
|
821
|
+
/** Secret material is intentionally restricted to server registration and worker.start. @internal */
|
|
585
822
|
export interface GitSshCredentialMaterial {
|
|
823
|
+
/** @internal */
|
|
586
824
|
readonly privateKey: string;
|
|
825
|
+
/** @internal */
|
|
587
826
|
readonly knownHosts: string;
|
|
588
827
|
}
|
|
589
828
|
|
|
829
|
+
/** @internal */
|
|
590
830
|
export interface GitHttpsCredentialMaterial {
|
|
591
|
-
/** HTTPS origin authorized by the credential-owning extension. */
|
|
831
|
+
/** HTTPS origin authorized by the credential-owning extension. @internal */
|
|
592
832
|
readonly origin: string;
|
|
833
|
+
/** @internal */
|
|
593
834
|
readonly username: string;
|
|
835
|
+
/** @internal */
|
|
594
836
|
readonly password: string;
|
|
595
837
|
}
|
|
596
838
|
|
|
839
|
+
/** @internal */
|
|
597
840
|
export type RepositoryCredentialProvider =
|
|
598
|
-
| { readonly kind: "git_ssh"; resolve(credentialRef: string): GitSshCredentialMaterial | null }
|
|
599
841
|
| {
|
|
842
|
+
/** @internal */
|
|
843
|
+
readonly kind: "git_ssh";
|
|
844
|
+
/** @internal */
|
|
845
|
+
resolve(credentialRef: string): GitSshCredentialMaterial | null;
|
|
846
|
+
}
|
|
847
|
+
| {
|
|
848
|
+
/** @internal */
|
|
600
849
|
readonly kind: "git_https";
|
|
850
|
+
/** @internal */
|
|
601
851
|
resolve(credentialRef: string): GitHttpsCredentialMaterial | null;
|
|
602
852
|
};
|
|
603
853
|
|
|
854
|
+
/** @internal */
|
|
604
855
|
export interface RepositoryCredentialRegistrar {
|
|
856
|
+
/** @internal */
|
|
605
857
|
register(provider: RepositoryCredentialProvider): void;
|
|
606
858
|
}
|
|
607
859
|
|
|
860
|
+
/** @public */
|
|
608
861
|
export interface ProcessRuntimeCapabilities {
|
|
609
|
-
/** Install repository-declared development tools with mise before accepting work. */
|
|
862
|
+
/** Install repository-declared development tools with mise before accepting work. @internal */
|
|
610
863
|
readonly developmentTools?: boolean;
|
|
611
|
-
/** Require a Docker CLI connected to a private or explicitly acknowledged daemon. */
|
|
864
|
+
/** Require a Docker CLI connected to a private or explicitly acknowledged daemon. @public */
|
|
612
865
|
readonly docker?: boolean;
|
|
613
866
|
}
|
|
614
867
|
|
|
868
|
+
/** @public */
|
|
615
869
|
export interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
|
|
870
|
+
/** @public */
|
|
616
871
|
id: string;
|
|
872
|
+
/** @public */
|
|
617
873
|
displayName: string;
|
|
618
|
-
/** Primary entry used when a launch does not select a start turn explicitly. */
|
|
874
|
+
/** Primary entry used when a launch does not select a start turn explicitly. @public */
|
|
619
875
|
entryTurnId: TurnId;
|
|
620
|
-
/** Additional entry turns that launchers may select explicitly. */
|
|
876
|
+
/** Additional entry turns that launchers may select explicitly. @public */
|
|
621
877
|
alternateEntryTurnIds?: readonly TurnId[];
|
|
622
878
|
/**
|
|
623
879
|
* Optional author-declared happy path: the ordered spine of turns a successful
|
|
@@ -625,12 +881,17 @@ export interface ExtensionProcessDefinition<TParams = unknown, TState = unknown>
|
|
|
625
881
|
* other turn off it as a branch. When omitted, consumers fall back to a derived
|
|
626
882
|
* best-effort spine.
|
|
627
883
|
*/
|
|
884
|
+
/** @public */
|
|
628
885
|
happyPath?: readonly TurnId[];
|
|
886
|
+
/** @public */
|
|
629
887
|
turns: ReadonlyMap<TurnId, ProcessTurnBinding<TurnDefinition<TParams, TState>>>;
|
|
888
|
+
/** @public */
|
|
630
889
|
paramsCodec: Codec<TParams>;
|
|
890
|
+
/** @public */
|
|
631
891
|
stateCodec: Codec<TState>;
|
|
892
|
+
/** @public */
|
|
632
893
|
initialState(params: TParams): TState;
|
|
633
|
-
/** Process-owned runtime capabilities. All capabilities default to disabled. */
|
|
894
|
+
/** Process-owned runtime capabilities. All capabilities default to disabled. @public */
|
|
634
895
|
runtime?: ProcessRuntimeCapabilities;
|
|
635
896
|
/**
|
|
636
897
|
* Server-only Kubernetes process-volume size, derived from extension configuration.
|
|
@@ -638,147 +899,230 @@ export interface ExtensionProcessDefinition<TParams = unknown, TState = unknown>
|
|
|
638
899
|
* Called before provisioning on worker starts. Must be synchronous and side-effect free;
|
|
639
900
|
* repeated calls never resize or replace an existing volume.
|
|
640
901
|
*/
|
|
902
|
+
/** @internal */
|
|
641
903
|
resolveStorageSize?(input: {
|
|
904
|
+
/** @internal */
|
|
642
905
|
params: TParams;
|
|
906
|
+
/** @internal */
|
|
643
907
|
projects: readonly ProcessProject[];
|
|
644
908
|
}): string | undefined;
|
|
645
|
-
/** Runtime-only requirements; references are non-secret and remain in opaque params JSON. */
|
|
909
|
+
/** Runtime-only requirements; references are non-secret and remain in opaque params JSON. @public */
|
|
646
910
|
repositoryCredentials?(input: {
|
|
911
|
+
/** @public */
|
|
647
912
|
params: TParams;
|
|
913
|
+
/** @public */
|
|
648
914
|
projects: readonly RepositoryCredentialProject[];
|
|
649
915
|
}): readonly RepositoryCredentialRequirement[];
|
|
916
|
+
/** @public */
|
|
650
917
|
piConfig?: ProcessPiConfig;
|
|
918
|
+
/** @internal */
|
|
651
919
|
server?: (api: ServerProcessAPI<TParams, TState>) => void;
|
|
920
|
+
/** @internal */
|
|
652
921
|
worker?: (api: WorkerProcessAPI<TParams, TState>) => void;
|
|
922
|
+
/** @public */
|
|
653
923
|
ui?: (api: UiProcessAPI<TParams, TState>) => void;
|
|
924
|
+
/** @public */
|
|
654
925
|
launchers?: (api: ProcessLauncherAPI<TParams>) => void;
|
|
926
|
+
/** @public */
|
|
655
927
|
watchers?: (api: ProcessWatcherAPI<TParams>) => void;
|
|
656
928
|
}
|
|
657
929
|
|
|
930
|
+
/** @public */
|
|
658
931
|
export interface CatalogExtensionAPI {
|
|
932
|
+
/** @internal */
|
|
659
933
|
readonly events: EventBus;
|
|
934
|
+
/** @public */
|
|
660
935
|
registerProcess<TParams = unknown, TState = unknown>(
|
|
661
936
|
def: ExtensionProcessDefinition<TParams, TState>,
|
|
662
937
|
): void;
|
|
938
|
+
/** @internal */
|
|
663
939
|
registerToolRenderer(def: ToolCallRendererDefinition): void;
|
|
940
|
+
/** @internal */
|
|
664
941
|
provide<T>(token: CapabilityToken<T>, value: T): void;
|
|
942
|
+
/** @internal */
|
|
665
943
|
get<T>(token: CapabilityToken<T>): T | T[] | undefined;
|
|
944
|
+
/** @internal */
|
|
666
945
|
require<T>(token: CapabilityToken<T>): T | T[];
|
|
667
946
|
}
|
|
668
947
|
|
|
948
|
+
/** @public */
|
|
669
949
|
export type ExtensionLifecycleHook = () => void | Promise<void>;
|
|
670
950
|
|
|
951
|
+
/** @internal */
|
|
671
952
|
export interface ServerExtensionLogger {
|
|
953
|
+
/** @internal */
|
|
672
954
|
info?(payload: Record<string, unknown>, message?: string): void;
|
|
955
|
+
/** @internal */
|
|
673
956
|
warn?(payload: Record<string, unknown>, message?: string): void;
|
|
957
|
+
/** @internal */
|
|
674
958
|
error?(payload: Record<string, unknown>, message?: string): void;
|
|
675
959
|
}
|
|
676
960
|
|
|
961
|
+
/** @public */
|
|
677
962
|
export interface TicketCreationDestinationSummary {
|
|
678
|
-
/** Adapter-owned opaque identifier. Browsers must not construct or interpret it. */
|
|
963
|
+
/** Adapter-owned opaque identifier. Browsers must not construct or interpret it. @public */
|
|
679
964
|
readonly id: string;
|
|
965
|
+
/** @public */
|
|
680
966
|
readonly displayName: string;
|
|
967
|
+
/** @public */
|
|
681
968
|
readonly group?: string;
|
|
969
|
+
/** @public */
|
|
682
970
|
readonly description?: string;
|
|
683
971
|
}
|
|
684
972
|
|
|
973
|
+
/** @public */
|
|
685
974
|
export interface TicketCreationDestinationList {
|
|
975
|
+
/** @public */
|
|
686
976
|
readonly destinations: readonly TicketCreationDestinationSummary[];
|
|
977
|
+
/** @public */
|
|
687
978
|
readonly warnings?: readonly string[];
|
|
688
979
|
}
|
|
689
980
|
|
|
981
|
+
/** @public */
|
|
690
982
|
export interface TicketCreationDestinationSnapshot {
|
|
983
|
+
/** @public */
|
|
691
984
|
readonly summary: TicketCreationDestinationSummary;
|
|
692
|
-
/** Adapter-owned, JSON-serializable immutable destination state. */
|
|
985
|
+
/** Adapter-owned, JSON-serializable immutable destination state. @public */
|
|
693
986
|
readonly data: unknown;
|
|
694
|
-
/** Untrusted destination context included in the ticket agent prompt. */
|
|
987
|
+
/** Untrusted destination context included in the ticket agent prompt. @public */
|
|
695
988
|
readonly agentContext?: string;
|
|
696
989
|
}
|
|
697
990
|
|
|
991
|
+
/** @public */
|
|
698
992
|
export interface TicketCreationDestinationContext {
|
|
993
|
+
/** @public */
|
|
699
994
|
readonly actor: Actor;
|
|
700
995
|
}
|
|
701
996
|
|
|
997
|
+
/** @public */
|
|
702
998
|
export interface TicketCreationDestinationProvider {
|
|
999
|
+
/** @public */
|
|
703
1000
|
list(ctx: TicketCreationDestinationContext): Promise<TicketCreationDestinationList>;
|
|
1001
|
+
/** @public */
|
|
704
1002
|
resolve(
|
|
705
|
-
ctx: TicketCreationDestinationContext & {
|
|
1003
|
+
ctx: TicketCreationDestinationContext & {
|
|
1004
|
+
/** @public */
|
|
1005
|
+
destinationId: string;
|
|
1006
|
+
},
|
|
706
1007
|
): Promise<TicketCreationDestinationSnapshot>;
|
|
707
|
-
/** Rejects stale, renamed, transferred, or otherwise invalid snapshots. */
|
|
1008
|
+
/** Rejects stale, renamed, transferred, or otherwise invalid snapshots. @public */
|
|
708
1009
|
validate(snapshot: TicketCreationDestinationSnapshot): Promise<void>;
|
|
709
1010
|
}
|
|
710
1011
|
|
|
1012
|
+
/** @public */
|
|
711
1013
|
export interface TicketCreationCapability {
|
|
1014
|
+
/** @public */
|
|
712
1015
|
readonly kind: "ticket_creation";
|
|
1016
|
+
/** @public */
|
|
713
1017
|
readonly displayName: string;
|
|
714
|
-
/** Extension-owned process launched by the generic derived-ticket route. */
|
|
1018
|
+
/** Extension-owned process launched by the generic derived-ticket route. @public */
|
|
715
1019
|
readonly processId: string;
|
|
716
|
-
/** Entry turn selected when the derived process starts. */
|
|
1020
|
+
/** Entry turn selected when the derived process starts. @public */
|
|
717
1021
|
readonly startTurnId: TurnId;
|
|
718
|
-
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
1022
|
+
/** RFC 6901 JSON Pointer into the tool arguments. @public */
|
|
719
1023
|
readonly titlePath?: string;
|
|
720
|
-
/** RFC 6901 JSON Pointer into the tool arguments. */
|
|
1024
|
+
/** RFC 6901 JSON Pointer into the tool arguments. @public */
|
|
721
1025
|
readonly descriptionPath?: string;
|
|
1026
|
+
/** @public */
|
|
722
1027
|
readonly destinations?: TicketCreationDestinationProvider;
|
|
723
1028
|
}
|
|
724
1029
|
|
|
1030
|
+
/** @internal */
|
|
725
1031
|
export interface TicketCreationReceipt {
|
|
1032
|
+
/** @internal */
|
|
726
1033
|
readonly externalId: string;
|
|
1034
|
+
/** @internal */
|
|
727
1035
|
readonly url: string;
|
|
1036
|
+
/** @internal */
|
|
728
1037
|
readonly result?: unknown;
|
|
729
1038
|
}
|
|
730
1039
|
|
|
1040
|
+
/** @public */
|
|
731
1041
|
export interface IntegrationToolExecutionContext {
|
|
1042
|
+
/** Process-bound coordination; storage remains server-owned. */
|
|
1043
|
+
/** @public */
|
|
1044
|
+
readonly externalWrites: ExternalWrites;
|
|
1045
|
+
/** @public */
|
|
732
1046
|
readonly process: ProcessInstance;
|
|
1047
|
+
/** @public */
|
|
733
1048
|
readonly projects: readonly ProcessProject[];
|
|
1049
|
+
/** @public */
|
|
734
1050
|
readonly turn: ProcessTurnRecord;
|
|
1051
|
+
/** @public */
|
|
735
1052
|
readonly project: ProcessProject | null;
|
|
1053
|
+
/** @public */
|
|
736
1054
|
readonly ticketDestination?: TicketCreationDestinationSnapshot;
|
|
737
|
-
/** Stable for a single Pi tool call, including reconnect/replay. */
|
|
1055
|
+
/** Stable for a single Pi tool call, including reconnect/replay. @public */
|
|
738
1056
|
readonly idempotencyKey: string;
|
|
739
|
-
/** Aborted when the worker stops waiting for this tool call. */
|
|
1057
|
+
/** Aborted when the worker stops waiting for this tool call. @public */
|
|
740
1058
|
readonly signal: AbortSignal;
|
|
741
1059
|
}
|
|
742
1060
|
|
|
1061
|
+
/** @public */
|
|
743
1062
|
export interface IntegrationToolDefinition<TArgs = Record<string, unknown>> {
|
|
1063
|
+
/** @public */
|
|
744
1064
|
readonly name: string;
|
|
1065
|
+
/** @public */
|
|
745
1066
|
readonly description: string;
|
|
1067
|
+
/** @public */
|
|
746
1068
|
readonly parameters: Record<string, unknown>;
|
|
747
|
-
/** Sanitized discovery metadata; credentials and adapter configuration never belong here. */
|
|
1069
|
+
/** Sanitized discovery metadata; credentials and adapter configuration never belong here. @public */
|
|
748
1070
|
readonly capability?: TicketCreationCapability;
|
|
1071
|
+
/** @internal */
|
|
749
1072
|
parse?(value: unknown): TArgs;
|
|
1073
|
+
/** @public */
|
|
750
1074
|
execute(ctx: IntegrationToolExecutionContext, args: TArgs): Promise<unknown>;
|
|
751
1075
|
}
|
|
752
1076
|
|
|
1077
|
+
/** @public */
|
|
753
1078
|
export interface ServerExtensionAPI {
|
|
1079
|
+
/** @internal */
|
|
754
1080
|
readonly events: EventBus<ServerExtensionEventMap>;
|
|
1081
|
+
/** @internal */
|
|
755
1082
|
readonly logger?: ServerExtensionLogger;
|
|
1083
|
+
/** @public */
|
|
756
1084
|
provide<T>(token: CapabilityToken<T>, value: T): void;
|
|
1085
|
+
/** @public */
|
|
757
1086
|
get<T>(token: CapabilityToken<T>): T | T[] | undefined;
|
|
1087
|
+
/** @public */
|
|
758
1088
|
require<T>(token: CapabilityToken<T>): T | T[];
|
|
1089
|
+
/** @public */
|
|
759
1090
|
tool<TArgs>(definition: IntegrationToolDefinition<TArgs>): void;
|
|
1091
|
+
/** @internal */
|
|
760
1092
|
onStart(handler: ExtensionLifecycleHook): void;
|
|
1093
|
+
/** @public */
|
|
761
1094
|
onStop(handler: ExtensionLifecycleHook): void;
|
|
762
1095
|
}
|
|
763
1096
|
|
|
1097
|
+
/** @internal */
|
|
764
1098
|
export interface WorkerExtensionAPI {
|
|
1099
|
+
/** @internal */
|
|
765
1100
|
readonly events: EventBus;
|
|
1101
|
+
/** @internal */
|
|
766
1102
|
get<T>(token: CapabilityToken<T>): T | T[] | undefined;
|
|
1103
|
+
/** @internal */
|
|
767
1104
|
require<T>(token: CapabilityToken<T>): T | T[];
|
|
768
1105
|
}
|
|
769
1106
|
|
|
770
|
-
|
|
771
|
-
id: string;
|
|
772
|
-
version: string;
|
|
773
|
-
requires?: readonly string[];
|
|
774
|
-
optional?: readonly string[];
|
|
775
|
-
}
|
|
776
|
-
|
|
1107
|
+
/** @public */
|
|
777
1108
|
export interface LeitwerkExtensionModule {
|
|
778
|
-
|
|
779
|
-
|
|
1109
|
+
/** @public */
|
|
1110
|
+
manifest: {
|
|
1111
|
+
/** @public */
|
|
1112
|
+
id: string;
|
|
1113
|
+
/** @public */
|
|
1114
|
+
version: string;
|
|
1115
|
+
/** @public */
|
|
1116
|
+
requires?: readonly string[];
|
|
1117
|
+
/** @internal */
|
|
1118
|
+
optional?: readonly string[];
|
|
1119
|
+
};
|
|
1120
|
+
/** Resolves every provider owned by this extension before setupServer. @public */
|
|
780
1121
|
modelProviders?: ModelProviderSet;
|
|
1122
|
+
/** @public */
|
|
781
1123
|
setupCatalog?(api: CatalogExtensionAPI): void | Promise<void>;
|
|
1124
|
+
/** @public */
|
|
782
1125
|
setupServer?(api: ServerExtensionAPI, config: unknown): void | Promise<void>;
|
|
1126
|
+
/** @internal */
|
|
783
1127
|
setupWorker?(api: WorkerExtensionAPI, config: unknown): void | Promise<void>;
|
|
784
1128
|
}
|