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