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