@leitwerk-dev/process-sdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/browser-ui-extension.d.ts +20 -0
  2. package/dist/browser-ui-extension.d.ts.map +1 -1
  3. package/dist/capabilities.d.ts +6 -0
  4. package/dist/capabilities.d.ts.map +1 -1
  5. package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
  6. package/dist/chunk-5R6MVLHC.js.map +1 -0
  7. package/dist/chunk-DVXW2ZUV.js +1 -0
  8. package/dist/chunk-DVXW2ZUV.js.map +1 -0
  9. package/dist/{chunk-TA4KO53Q.js → chunk-I7U6HCLN.js} +1 -7
  10. package/dist/chunk-I7U6HCLN.js.map +1 -0
  11. package/dist/{chunk-WFY2WWZE.js → chunk-TM2LTSW4.js} +1 -1
  12. package/dist/chunk-TM2LTSW4.js.map +1 -0
  13. package/dist/codecs.d.ts +1 -0
  14. package/dist/codecs.d.ts.map +1 -1
  15. package/dist/commit-message.d.ts +5 -0
  16. package/dist/commit-message.d.ts.map +1 -1
  17. package/dist/core-capabilities.d.ts +336 -20
  18. package/dist/core-capabilities.d.ts.map +1 -1
  19. package/dist/define-process.d.ts +195 -18
  20. package/dist/define-process.d.ts.map +1 -1
  21. package/dist/event-bus.d.ts +1 -0
  22. package/dist/event-bus.d.ts.map +1 -1
  23. package/dist/{extension-api-CcqZCYJx.d.ts → extension-api-B4gG5w1K.d.ts} +1000 -108
  24. package/dist/extension-api.d.ts +385 -50
  25. package/dist/extension-api.d.ts.map +1 -1
  26. package/dist/external-action-source.d.ts +3 -1
  27. package/dist/external-action-source.d.ts.map +1 -1
  28. package/dist/external-source-poll.d.ts +8 -1
  29. package/dist/external-source-poll.d.ts.map +1 -1
  30. package/dist/flow.d.ts +308 -11
  31. package/dist/flow.d.ts.map +1 -1
  32. package/dist/form-contract.d.ts +1 -1
  33. package/dist/form-contract.d.ts.map +1 -1
  34. package/dist/fs-utils.d.ts +4 -0
  35. package/dist/fs-utils.d.ts.map +1 -1
  36. package/dist/git-binary.d.ts +2 -1
  37. package/dist/git-binary.d.ts.map +1 -1
  38. package/dist/git-binary.js.map +1 -1
  39. package/dist/graph-fragments.d.ts +16 -0
  40. package/dist/graph-fragments.d.ts.map +1 -1
  41. package/dist/host-capabilities.d.ts +9 -3
  42. package/dist/host-capabilities.d.ts.map +1 -1
  43. package/dist/index.d.ts +24 -25
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +262 -80
  46. package/dist/index.js.map +1 -1
  47. package/dist/integration-http.d.ts +14 -3
  48. package/dist/integration-http.d.ts.map +1 -1
  49. package/dist/json-data.d.ts +1 -1
  50. package/dist/json-data.d.ts.map +1 -1
  51. package/dist/leaf-outcome-renderer.d.ts +35 -0
  52. package/dist/leaf-outcome-renderer.d.ts.map +1 -1
  53. package/dist/leaf-outcome-renderer.js +12 -0
  54. package/dist/leaf-outcome-renderer.js.map +1 -1
  55. package/dist/leaf-outcomes.d.ts +3 -0
  56. package/dist/leaf-outcomes.d.ts.map +1 -1
  57. package/dist/model-provider.d.ts +144 -12
  58. package/dist/model-provider.d.ts.map +1 -1
  59. package/dist/pi-config-public.d.ts +2 -0
  60. package/dist/pi-config-public.d.ts.map +1 -0
  61. package/dist/pi-config-public.js +15 -0
  62. package/dist/pi-config-public.js.map +1 -0
  63. package/dist/pi-config.d.ts +40 -0
  64. package/dist/pi-config.d.ts.map +1 -1
  65. package/dist/pi-config.js +1 -1
  66. package/dist/process-definition-internals.d.ts +4 -0
  67. package/dist/process-definition-internals.d.ts.map +1 -1
  68. package/dist/process-flow-view.d.ts +2 -0
  69. package/dist/process-flow-view.d.ts.map +1 -1
  70. package/dist/process-graph.d.ts +34 -0
  71. package/dist/process-graph.d.ts.map +1 -1
  72. package/dist/process-launcher-builder.d.ts +5 -0
  73. package/dist/process-launcher-builder.d.ts.map +1 -1
  74. package/dist/process-watcher-builder.d.ts +5 -0
  75. package/dist/process-watcher-builder.d.ts.map +1 -1
  76. package/dist/process-watcher-source.d.ts +3 -1
  77. package/dist/process-watcher-source.d.ts.map +1 -1
  78. package/dist/project-binding.d.ts +5 -1
  79. package/dist/project-binding.d.ts.map +1 -1
  80. package/dist/registry-utils.d.ts +6 -0
  81. package/dist/registry-utils.d.ts.map +1 -1
  82. package/dist/repository-feedback.d.ts +20 -2
  83. package/dist/repository-feedback.d.ts.map +1 -1
  84. package/dist/repository-git-env.d.ts +6 -2
  85. package/dist/repository-git-env.d.ts.map +1 -1
  86. package/dist/repository-http.d.ts +13 -1
  87. package/dist/repository-http.d.ts.map +1 -1
  88. package/dist/repository-https.d.ts +1 -1
  89. package/dist/repository-https.d.ts.map +1 -1
  90. package/dist/repository-issue-watcher.d.ts +21 -1
  91. package/dist/repository-issue-watcher.d.ts.map +1 -1
  92. package/dist/repository-reconciliation.d.ts +5 -0
  93. package/dist/repository-reconciliation.d.ts.map +1 -0
  94. package/dist/repository-source-config.d.ts +27 -1
  95. package/dist/repository-source-config.d.ts.map +1 -1
  96. package/dist/repository-types.d.ts +28 -1
  97. package/dist/repository-types.d.ts.map +1 -1
  98. package/dist/review-flow-public.d.ts +2 -0
  99. package/dist/review-flow-public.d.ts.map +1 -0
  100. package/dist/review-flow-public.js +11 -0
  101. package/dist/review-flow-public.js.map +1 -0
  102. package/dist/review-flow.d.ts +6 -0
  103. package/dist/review-flow.d.ts.map +1 -1
  104. package/dist/review-flow.js +1 -1
  105. package/dist/runtime-internals-public.d.ts +2 -0
  106. package/dist/runtime-internals-public.d.ts.map +1 -0
  107. package/dist/runtime-internals-public.js +16 -0
  108. package/dist/runtime-internals-public.js.map +1 -0
  109. package/dist/runtime-internals.js +2 -1
  110. package/dist/server-events.d.ts +67 -0
  111. package/dist/server-events.d.ts.map +1 -1
  112. package/dist/server-process-builder.d.ts +7 -0
  113. package/dist/server-process-builder.d.ts.map +1 -1
  114. package/dist/state-helpers.d.ts +6 -0
  115. package/dist/state-helpers.d.ts.map +1 -1
  116. package/dist/subprocess-env.d.ts +3 -0
  117. package/dist/subprocess-env.d.ts.map +1 -1
  118. package/dist/tool-arguments.d.ts +4 -2
  119. package/dist/tool-arguments.d.ts.map +1 -1
  120. package/dist/tool-renderers.d.ts +6 -0
  121. package/dist/tool-renderers.d.ts.map +1 -1
  122. package/dist/turn-semantics.d.ts +14 -1
  123. package/dist/turn-semantics.d.ts.map +1 -1
  124. package/dist/types.d.ts +205 -24
  125. package/dist/types.d.ts.map +1 -1
  126. package/dist/ui-process-builder.d.ts +5 -0
  127. package/dist/ui-process-builder.d.ts.map +1 -1
  128. package/dist/worker-process-builder.d.ts +5 -0
  129. package/dist/worker-process-builder.d.ts.map +1 -1
  130. package/package.json +16 -15
  131. package/src/browser-ui-extension.ts +20 -0
  132. package/src/capabilities.ts +9 -1
  133. package/src/codecs.ts +1 -0
  134. package/src/commit-message.ts +5 -0
  135. package/src/core-capabilities.ts +396 -35
  136. package/src/define-process.ts +198 -23
  137. package/src/event-bus.ts +1 -0
  138. package/src/extension-api.ts +399 -55
  139. package/src/external-action-source.ts +7 -2
  140. package/src/external-source-poll.ts +15 -3
  141. package/src/flow.ts +352 -23
  142. package/src/form-contract.ts +0 -4
  143. package/src/fs-utils.ts +4 -0
  144. package/src/git-binary.ts +2 -1
  145. package/src/graph-fragments.ts +16 -0
  146. package/src/host-capabilities.ts +9 -6
  147. package/src/index.ts +5 -201
  148. package/src/integration-http.ts +15 -3
  149. package/src/json-data.ts +1 -1
  150. package/src/leaf-outcome-renderer.ts +35 -0
  151. package/src/leaf-outcomes.ts +3 -0
  152. package/src/model-provider.ts +169 -20
  153. package/src/pi-config-public.ts +7 -0
  154. package/src/pi-config.ts +47 -2
  155. package/src/process-definition-internals.ts +4 -0
  156. package/src/process-flow-view.ts +2 -0
  157. package/src/process-graph.ts +34 -0
  158. package/src/process-launcher-builder.ts +5 -0
  159. package/src/process-watcher-builder.ts +5 -0
  160. package/src/process-watcher-source.ts +6 -4
  161. package/src/project-binding.ts +5 -1
  162. package/src/registry-utils.ts +6 -0
  163. package/src/repository-feedback.ts +30 -4
  164. package/src/repository-git-env.ts +6 -2
  165. package/src/repository-http.ts +19 -2
  166. package/src/repository-https.ts +1 -1
  167. package/src/repository-issue-watcher.ts +35 -5
  168. package/src/repository-reconciliation.ts +30 -0
  169. package/src/repository-source-config.ts +20 -1
  170. package/src/repository-types.ts +43 -5
  171. package/src/review-flow-public.ts +5 -0
  172. package/src/review-flow.ts +6 -0
  173. package/src/runtime-internals-public.ts +7 -0
  174. package/src/server-events.ts +67 -0
  175. package/src/server-process-builder.ts +10 -1
  176. package/src/state-helpers.ts +6 -0
  177. package/src/subprocess-env.ts +3 -0
  178. package/src/tool-arguments.ts +4 -2
  179. package/src/tool-renderers.ts +6 -0
  180. package/src/turn-semantics.ts +15 -2
  181. package/src/types.ts +212 -30
  182. package/src/ui-process-builder.ts +8 -1
  183. package/src/worker-process-builder.ts +8 -1
  184. package/dist/chunk-LIIP7FMU.js.map +0 -1
  185. package/dist/chunk-TA4KO53Q.js.map +0 -1
  186. package/dist/chunk-WFY2WWZE.js.map +0 -1
@@ -1,273 +1,439 @@
1
1
  import * as _leitwerk_dev_domain from '@leitwerk-dev/domain';
2
- import { ProcessInstance, ProcessProject, ProcessTurnRecord, WorkerErrorClass, ProcessLeafOutcomeSnapshot, ProcessQuestionRequest, TurnId, ProcessTurnTerminalLifecycleStatus, TurnAcceptanceState as TurnAcceptanceState$1, ProcessTurnRecordPathType, ProcessSemanticEntryRefKey, TurnProgressReport, ProcessTurnStartSelection, ProcessLifecycleStatus, InputSource, InputKind, ProcessInputTarget, LaunchModelConfigInput, ProcessCustomizableFields, Actor } from '@leitwerk-dev/domain';
2
+ import { ProcessInstance, ProcessProject, ProcessTurnRecord, WorkerErrorClass, ProcessLeafOutcomeSnapshot, ProcessQuestionRequest, TurnId, ProcessTurnTerminalLifecycleStatus, ProcessTurnRecordPathType, TurnAcceptanceState as TurnAcceptanceState$1, ProcessSemanticEntryRefKey, TurnProgressReport, ProcessTurnStartSelection, ProcessLifecycleStatus, InputSource, InputKind, ProcessInputTarget, LaunchModelConfigInput, ProcessCustomizableFields, Actor } from '@leitwerk-dev/domain';
3
+ import { ExternalWrites } from '@leitwerk-dev/external-writes';
3
4
  import { UsageTokenCounts, UsageCostSnapshot, WatcherPresentationField } from '@leitwerk-dev/protocol';
4
5
  import { ActionFormDefinition } from '@leitwerk-dev/protocol/form-contract';
5
6
  import { LauncherCardMetadata, LauncherSchemaDefinition, LauncherFieldOptionDefinition, LauncherValidationError, UiLauncherSummaryBase } from '@leitwerk-dev/protocol/launcher-contract';
6
7
  import { ToolCallRendererDefinition } from '@leitwerk-dev/protocol/tool-renderer-contract';
7
8
 
9
+ /** @internal */
8
10
  type CapabilityCardinality = "single" | "multi";
11
+ /** @public */
9
12
  interface CapabilityToken<_TValue> {
13
+ /** @internal */
10
14
  readonly id: string;
15
+ /** @internal */
11
16
  readonly cardinality: CapabilityCardinality;
12
17
  }
18
+ /** @public */
13
19
  declare function createCapabilityToken<TValue>(id: string, options?: {
20
+ /** @internal */
14
21
  cardinality?: CapabilityCardinality;
15
22
  }): CapabilityToken<TValue>;
16
23
 
24
+ /** @internal */
17
25
  interface ProcessCreatedEvent {
26
+ /** @internal */
18
27
  instanceId: string;
28
+ /** @internal */
19
29
  process: ProcessInstance;
30
+ /** @internal */
20
31
  projects: readonly ProcessProject[];
32
+ /** @internal */
21
33
  launcherId?: string | null;
22
34
  }
35
+ /** @internal */
23
36
  interface ProcessUpdatedEvent {
37
+ /** @internal */
24
38
  instanceId: string;
39
+ /** @internal */
25
40
  process: ProcessInstance;
41
+ /** @internal */
26
42
  changedFields: readonly string[];
27
43
  }
44
+ /** @internal */
28
45
  interface TurnStartedEvent {
46
+ /** @internal */
29
47
  instanceId: string;
48
+ /** @internal */
30
49
  turnRecord: ProcessTurnRecord;
31
50
  }
51
+ /** @internal */
32
52
  interface TurnFailedEvent {
53
+ /** @internal */
33
54
  instanceId: string;
55
+ /** @internal */
34
56
  turnRecord: ProcessTurnRecord;
57
+ /** @internal */
35
58
  errorSummary: string;
59
+ /** @internal */
36
60
  errorClass?: WorkerErrorClass | null;
37
61
  }
62
+ /** @internal */
38
63
  interface LeafOutcomeCapturedEvent {
64
+ /** @internal */
39
65
  instanceId: string;
66
+ /** @internal */
40
67
  snapshot: ProcessLeafOutcomeSnapshot;
41
68
  }
69
+ /** @internal */
42
70
  interface ReviewRequestedEvent {
71
+ /** @internal */
43
72
  instanceId: string;
73
+ /** @internal */
44
74
  workerId?: string;
75
+ /** @internal */
45
76
  changedProjects: string[];
46
77
  }
78
+ /** @internal */
47
79
  interface QuestionRequestedEvent {
80
+ /** @internal */
48
81
  instanceId: string;
82
+ /** @internal */
49
83
  request: ProcessQuestionRequest;
50
84
  }
85
+ /** @internal */
51
86
  interface TurnOutcomeEvent {
87
+ /** @internal */
52
88
  instanceId: string;
89
+ /** @internal */
53
90
  turnRecordId: string;
91
+ /** @internal */
54
92
  turnId: string;
93
+ /** @internal */
55
94
  outcome: string;
95
+ /** @internal */
56
96
  params: Record<string, unknown>;
97
+ /** @internal */
57
98
  turnResultMarkdown?: string | null;
58
99
  }
100
+ /** @internal */
59
101
  interface PlanApprovedEvent {
102
+ /** @internal */
60
103
  instanceId: string;
104
+ /** @internal */
61
105
  externalId: string | null;
106
+ /** @internal */
62
107
  planRevision: number;
63
108
  }
109
+ /** @internal */
64
110
  interface PlanRevisionRequestedEvent {
111
+ /** @internal */
65
112
  instanceId: string;
113
+ /** @internal */
66
114
  message: string;
67
115
  }
116
+ /** @internal */
68
117
  interface PlanSavedEvent {
118
+ /** @internal */
69
119
  instanceId: string;
120
+ /** @internal */
70
121
  planRevision: number;
122
+ /** @internal */
71
123
  summary: string;
124
+ /** @internal */
72
125
  planMarkdown: string;
126
+ /** @internal */
73
127
  acceptanceCriteria: string[];
74
128
  }
129
+ /** @internal */
75
130
  interface ReviewCompletedEvent {
131
+ /** @internal */
76
132
  instanceId: string;
133
+ /** @internal */
77
134
  hasIssues: boolean;
135
+ /** @internal */
78
136
  issueCount: number;
137
+ /** @internal */
79
138
  reviewMarkdown?: string;
80
139
  }
140
+ /** @internal */
81
141
  interface ServerExtensionEventMap {
142
+ /** @internal */
82
143
  process_created: ProcessCreatedEvent;
144
+ /** @internal */
83
145
  process_updated: ProcessUpdatedEvent;
146
+ /** @internal */
84
147
  turn_started: TurnStartedEvent;
148
+ /** @internal */
85
149
  turn_failed: TurnFailedEvent;
150
+ /** @internal */
86
151
  leaf_outcome_captured: LeafOutcomeCapturedEvent;
152
+ /** @internal */
87
153
  question_requested: QuestionRequestedEvent;
154
+ /** @internal */
88
155
  review_requested: ReviewRequestedEvent;
156
+ /** @internal */
89
157
  turn_outcome: TurnOutcomeEvent;
158
+ /** @internal */
90
159
  plan_approved: PlanApprovedEvent;
160
+ /** @internal */
91
161
  plan_revision_requested: PlanRevisionRequestedEvent;
162
+ /** @internal */
92
163
  plan_saved: PlanSavedEvent;
164
+ /** @internal */
93
165
  review_completed: ReviewCompletedEvent;
94
166
  }
167
+ /** @internal */
95
168
  type ServerExtensionEventName = keyof ServerExtensionEventMap;
169
+ /** @internal */
96
170
  type ServerExtensionEventPayloadInputMap = {
97
171
  [K in keyof ServerExtensionEventMap]: Omit<ServerExtensionEventMap[K], "instanceId">;
98
172
  };
99
173
 
100
- interface ProcessContext {
101
- readonly process: ProcessInstance;
102
- readonly selectedTurnId: TurnId | null;
103
- readonly isTerminal: boolean;
104
- readonly projects: readonly ProcessProject[];
105
- selectTurn(turnId: TurnId | null): void;
106
- }
174
+ /** @internal */
107
175
  interface TurnOptions {
176
+ /** @internal */
108
177
  reset?: boolean;
109
178
  }
179
+ /** @internal */
110
180
  interface TurnResult<T extends string = string> {
181
+ /** @internal */
111
182
  outcome: T;
183
+ /** @internal */
112
184
  params: Record<string, unknown>;
113
185
  }
186
+ /** @public */
114
187
  declare const PI_BUILT_IN_TOOL_NAMES: readonly ["read", "bash", "edit", "write", "grep", "find", "ls"];
188
+ /** @public */
115
189
  type PiBuiltInToolName = (typeof PI_BUILT_IN_TOOL_NAMES)[number];
116
- /** Tool names owned by the worker runtime rather than an integration extension. */
117
- declare const FRAMEWORK_LLM_TOOL_NAMES: readonly ["ask_questions", "markdown_result", "upload_result_images"];
118
- /** Names integration tools cannot use because Pi or the worker runtime owns them. */
190
+ /** Names integration tools cannot use because Pi or the worker runtime owns them. @internal */
119
191
  declare const RESERVED_INTEGRATION_TOOL_NAMES: readonly ["read", "bash", "edit", "write", "grep", "find", "ls", "ask_questions", "markdown_result", "upload_result_images"];
192
+ /** @public */
120
193
  interface ProcessPiConfig {
121
194
  /**
122
195
  * System prompt template. Rendered with Mustache against runtime context.
123
196
  * Use {{variableName}} for escaped values and {{{variableName}}} for raw values.
124
197
  * When omitted, Pi's default system prompt is used.
125
198
  */
199
+ /** @internal */
126
200
  systemPromptTemplate?: string;
127
201
  /**
128
202
  * Additional text appended after the base system prompt/resources. Rendered
129
203
  * with Mustache against runtime context.
130
204
  */
205
+ /** @public */
131
206
  appendSystemPromptTemplate?: string;
132
207
  /**
133
208
  * Code-defined Pi session working directory template. Rendered with Mustache
134
209
  * against runtime context. When omitted, the process workspace root is used.
135
210
  */
211
+ /** @public */
136
212
  sessionCwdTemplate?: string;
137
213
  }
214
+ /** @internal */
138
215
  interface ResolvedProcessPiConfig {
216
+ /** @internal */
139
217
  systemPrompt?: string;
218
+ /** @internal */
140
219
  appendSystemPrompt?: string;
220
+ /** @internal */
141
221
  sessionCwd?: string;
222
+ /** @internal */
142
223
  availableToolNames: string[];
143
224
  }
225
+ /** @internal */
144
226
  type OutcomeToolParameterType = "string" | "number" | "array" | "boolean" | "object";
227
+ /** @internal */
145
228
  type OutcomeToolArrayItemType = Exclude<OutcomeToolParameterType, "array">;
229
+ /** @internal */
146
230
  interface OutcomeToolArrayItemSpec {
231
+ /** @internal */
147
232
  type: OutcomeToolArrayItemType;
233
+ /** @internal */
148
234
  description?: string;
149
235
  }
236
+ /** @public */
150
237
  interface OutcomeToolParameterSpec {
238
+ /** @internal */
151
239
  type: OutcomeToolParameterType;
240
+ /** @internal */
152
241
  description: string;
242
+ /** @internal */
153
243
  required?: boolean;
244
+ /** @internal */
154
245
  requiredErrorCode?: string;
246
+ /** @internal */
155
247
  invalidErrorCode?: string;
248
+ /** @internal */
156
249
  minItems?: number;
250
+ /** @internal */
157
251
  minItemsErrorCode?: string;
252
+ /** @internal */
158
253
  minimum?: number;
254
+ /** @internal */
159
255
  minimumErrorCode?: string;
256
+ /** @internal */
160
257
  items?: OutcomeToolArrayItemSpec;
258
+ /** @internal */
161
259
  enum?: readonly string[];
162
260
  }
261
+ /** @internal */
163
262
  interface OutcomeToolSpec {
263
+ /** @internal */
164
264
  description: string;
265
+ /** @internal */
165
266
  parameters: Record<string, OutcomeToolParameterSpec>;
166
- /** Product published from this outcome's turn-result markdown, when selected. */
267
+ /** Product published from this outcome's turn-result markdown, when selected. @internal */
167
268
  publishedProduct?: string;
168
- /** Outcome parameter whose markdown value is captured as the turn result. */
269
+ /** Outcome parameter whose markdown value is captured as the turn result. @internal */
169
270
  turnResultMarkdownParameter?: string;
170
- /** Outcome parameter containing a concise operator-facing summary. */
271
+ /** Outcome parameter containing a concise operator-facing summary. @internal */
171
272
  resultSummaryParameter?: string;
172
273
  }
173
- interface ProcessToolResult {
174
- status: string;
175
- outcome?: string;
176
- }
274
+ /** @public */
177
275
  interface PiTreeEntry {
276
+ /** @internal */
178
277
  readonly id: string;
278
+ /** @internal */
179
279
  readonly parentId: string | null;
280
+ /** @public */
180
281
  readonly type: string;
282
+ /** @internal */
181
283
  readonly timestamp: string;
284
+ /** @public */
182
285
  readonly message?: {
286
+ /** @internal */
183
287
  readonly role?: string;
288
+ /** @public */
184
289
  readonly content?: unknown;
185
290
  };
186
- /** Pi custom-message fields. Details are intentionally excluded from model context. */
291
+ /** Pi custom-message fields. Details are intentionally excluded from model context. @internal */
187
292
  readonly customType?: string;
293
+ /** @public */
188
294
  readonly content?: unknown;
295
+ /** @internal */
189
296
  readonly details?: unknown;
297
+ /** @internal */
190
298
  readonly targetId?: string;
299
+ /** @internal */
191
300
  readonly label?: string;
192
301
  }
302
+ /** @internal */
193
303
  interface PiTreeNode {
304
+ /** @internal */
194
305
  readonly entry: PiTreeEntry;
306
+ /** @internal */
195
307
  readonly children: readonly PiTreeNode[];
308
+ /** @internal */
196
309
  readonly label?: string;
310
+ /** @internal */
197
311
  readonly labelTimestamp?: string;
198
312
  }
313
+ /** @public */
199
314
  interface PiTurnExecutionResult {
315
+ /** @internal */
200
316
  startLeafId: string | null;
317
+ /** @internal */
201
318
  endLeafId: string | null;
319
+ /** @internal */
202
320
  createdEntryIds: string[];
321
+ /** @internal */
203
322
  resultEntryId: string;
204
- /** Final assistant markdown captured from the Pi assistant message for this turn, when available. */
323
+ /** Final assistant markdown captured from the Pi assistant message for this turn, when available. @internal */
205
324
  assistantMarkdown?: string | null;
206
325
  }
326
+ /** @internal */
207
327
  type PiEventType = "turn.start" | "turn.end" | "stream.delta" | "tool.call" | "tool.update" | "tool.result" | "toolcall.start" | "toolcall.delta" | "toolcall.end" | "compaction.start" | "compaction.end" | "label.changed" | "error" | "retry.start" | "retry.end" | "usage";
328
+ /** @internal */
208
329
  interface PiEvent {
330
+ /** @internal */
209
331
  type: PiEventType;
332
+ /** @internal */
210
333
  turnId: string;
334
+ /** @internal */
211
335
  data: Record<string, unknown>;
336
+ /** @internal */
212
337
  timestamp: string;
213
338
  }
339
+ /** @internal */
214
340
  type PiEventHandler = (event: PiEvent) => void;
341
+ /** @internal */
215
342
  type PiSessionDiagnosticLevel = "debug" | "info" | "warn" | "error";
343
+ /** @internal */
216
344
  interface PiSessionDiagnostic {
345
+ /** @internal */
217
346
  level: PiSessionDiagnosticLevel;
347
+ /** @internal */
218
348
  code: string;
349
+ /** @internal */
219
350
  message: string;
351
+ /** @internal */
220
352
  timestamp: string;
353
+ /** @internal */
221
354
  turnId?: string;
355
+ /** @internal */
222
356
  details?: Record<string, unknown>;
223
357
  }
358
+ /** @internal */
224
359
  type PiSessionDiagnosticHandler = (diagnostic: PiSessionDiagnostic) => void;
360
+ /** @public */
225
361
  interface PiCustomToolExecutionContext {
226
- /** Pi's identity for this exact invocation; stable across the paused call. */
362
+ /** Pi's identity for this exact invocation; stable across the paused call. @public */
227
363
  toolCallId: string;
228
- /** Aborted when the active turn is stopped or torn down. */
364
+ /** Aborted when the active turn is stopped or torn down. @public */
229
365
  signal: AbortSignal;
230
- /** Pause model-execution budgets while this custom tool awaits durable operator input. */
366
+ /** Pause model-execution budgets while this custom tool awaits durable operator input. @internal */
231
367
  suspendPromptGuards?: () => () => void;
232
368
  }
369
+ /** @public */
233
370
  interface PiCustomTool {
371
+ /** @public */
234
372
  name: string;
373
+ /** @internal */
235
374
  description: string;
375
+ /** @internal */
236
376
  parameters: Record<string, unknown>;
377
+ /** @internal */
237
378
  executionMode?: "sequential" | "parallel";
379
+ /** @public */
238
380
  execute(args: Record<string, unknown>, context?: PiCustomToolExecutionContext): Promise<unknown>;
239
381
  }
382
+ /** @internal */
240
383
  interface PiUsageData extends UsageTokenCounts {
384
+ /** @internal */
241
385
  cost: UsageCostSnapshot;
386
+ /** @internal */
242
387
  cacheHitRate: number;
243
388
  }
389
+ /** @internal */
244
390
  interface PiRunDetails {
391
+ /** @internal */
245
392
  loadedAgentsFiles: Array<{
393
+ /** @internal */
246
394
  path: string;
395
+ /** @internal */
247
396
  sizeBytes: number;
248
397
  }>;
398
+ /** @internal */
249
399
  loadedSkills: Array<{
400
+ /** @internal */
250
401
  name: string;
402
+ /** @internal */
251
403
  path: string;
252
404
  }>;
405
+ /** @internal */
253
406
  availableToolNames: string[];
254
407
  }
255
- type ProcessCustomTool = PiCustomTool;
408
+ /** @public */
256
409
  interface PiCustomMessageInput {
410
+ /** @internal */
257
411
  content: string;
412
+ /** @internal */
258
413
  details: unknown;
414
+ /** @internal */
259
415
  display?: boolean;
260
416
  }
417
+ /** @internal */
261
418
  type PiTerminalAcknowledgementState = "open" | "outcome_accepted" | "acknowledgement_succeeded" | "acknowledgement_failed_ignored";
419
+ /** @internal */
262
420
  interface PiTerminalAcknowledgementControl {
421
+ /** @internal */
263
422
  readonly timeoutMs: number;
423
+ /** @internal */
264
424
  state(): PiTerminalAcknowledgementState;
425
+ /** @internal */
265
426
  isOperatorAbortRequested(): boolean;
427
+ /** @internal */
266
428
  markSucceeded(): void;
429
+ /** @internal */
267
430
  markFailed(reason: string): void;
268
431
  }
432
+ /** @public */
269
433
  interface PiPromptOptions {
434
+ /** @public */
270
435
  tools?: readonly PiCustomTool[];
436
+ /** @internal */
271
437
  activeTools?: readonly string[];
272
438
  /** @internal Runtime-only hook used by the worker Pi adapter before a tool executes. */
273
439
  shouldBlockToolCall?: (toolName: string) => string | null;
@@ -276,790 +442,1333 @@ interface PiPromptOptions {
276
442
  /** @internal Runtime-only terminal outcome acknowledgement state. */
277
443
  terminalAcknowledgement?: PiTerminalAcknowledgementControl;
278
444
  }
445
+ /** @public */
279
446
  interface PiTreeHandle {
447
+ /** @internal */
280
448
  readonly sessionId: string;
449
+ /** @internal */
281
450
  readonly treeFile: string;
451
+ /** @internal */
282
452
  readonly isResumed: boolean;
453
+ /** @internal */
283
454
  getRunDetails(): PiRunDetails;
455
+ /** @internal */
284
456
  getLeafId(): string | null;
457
+ /** @internal */
285
458
  getEntry(id: string): PiTreeEntry | undefined;
459
+ /** @internal */
286
460
  getBranch(fromId?: string): PiTreeEntry[];
461
+ /** @internal */
287
462
  getChildren(parentId: string): PiTreeEntry[];
463
+ /** @internal */
288
464
  getTree(): PiTreeNode[];
465
+ /** @internal */
289
466
  branch(entryId: string): void | Promise<void>;
467
+ /** @internal */
290
468
  branchFromRoot(): void | Promise<void>;
469
+ /** @internal */
291
470
  resetLeaf(): void | Promise<void>;
292
471
  /**
293
472
  * Compact the current Pi context. `details` is persisted with the resulting
294
473
  * compaction entry, but deliberately remains outside model context.
295
474
  */
475
+ /** @internal */
296
476
  compact?(customInstructions?: string, details?: unknown): Promise<unknown>;
477
+ /** @public */
297
478
  prompt(text: string, options?: PiPromptOptions): Promise<PiTurnExecutionResult>;
479
+ /** @public */
298
480
  promptLiteral(text: string, options?: PiPromptOptions): Promise<PiTurnExecutionResult>;
481
+ /** @public */
299
482
  promptCustom(input: PiCustomMessageInput, options?: PiPromptOptions): Promise<PiTurnExecutionResult>;
483
+ /** @public */
300
484
  continueTurn(options?: PiPromptOptions): Promise<PiTurnExecutionResult>;
485
+ /** @internal */
301
486
  appendCustomMessage?(input: PiCustomMessageInput): Promise<string>;
487
+ /** @internal */
302
488
  steer(text: string): Promise<void>;
489
+ /** @internal */
303
490
  abortTurn(): Promise<void>;
491
+ /** @internal */
304
492
  subscribe(handler: PiEventHandler): () => void;
493
+ /** @internal */
305
494
  subscribeDiagnostics?(handler: PiSessionDiagnosticHandler): () => void;
495
+ /** @internal */
306
496
  close(): Promise<void>;
307
497
  }
498
+ /** @public */
308
499
  declare const TURN_CONTEXT_MODES: readonly ["full", "compacted", "fresh", "fresh_seeded"];
500
+ /** @public */
309
501
  type TurnContextMode = (typeof TURN_CONTEXT_MODES)[number];
502
+ /** @public */
310
503
  declare const TURN_COMPLETION_MODES: readonly ["turn_end"];
504
+ /** @public */
311
505
  type TurnCompletionMode = (typeof TURN_COMPLETION_MODES)[number];
506
+ /** @public */
312
507
  type TurnBranchType = ProcessTurnRecordPathType;
313
- type TurnSemanticEntryRefKey = ProcessSemanticEntryRefKey;
508
+ /** @public */
314
509
  interface TurnResultMarkdownNoneBehavior {
510
+ /** @internal */
315
511
  mode: "none";
316
512
  }
513
+ /** @public */
317
514
  interface TurnResultMarkdownAssistantOutputBehavior {
515
+ /** @internal */
318
516
  mode: "assistant_output";
517
+ /** @internal */
319
518
  required?: boolean;
320
519
  }
520
+ /** @public */
321
521
  interface TurnResultMarkdownToolCallBehavior {
522
+ /** @internal */
322
523
  mode: "tool_call";
524
+ /** @internal */
323
525
  toolName: string;
526
+ /** @internal */
324
527
  source?: "arguments" | "result";
528
+ /** @internal */
325
529
  path: string;
530
+ /** @internal */
326
531
  required?: boolean;
327
532
  }
533
+ /** @public */
328
534
  interface TurnResultMarkdownOutcomeToolArgumentBehavior {
535
+ /** @internal */
329
536
  mode: "outcome_tool_argument";
537
+ /** @internal */
330
538
  parameterName: string;
539
+ /** @internal */
331
540
  required?: boolean;
332
541
  }
542
+ /** @public */
333
543
  type TurnResultMarkdownBehavior = TurnResultMarkdownNoneBehavior | TurnResultMarkdownAssistantOutputBehavior | TurnResultMarkdownToolCallBehavior | TurnResultMarkdownOutcomeToolArgumentBehavior;
544
+ /** @public */
334
545
  type TurnAcceptanceState = TurnAcceptanceState$1;
546
+ /** @public */
335
547
  interface ProcessActionSchedulingFixedTurnPreview {
548
+ /** @public */
336
549
  kind: "fixed_turn";
550
+ /** @public */
337
551
  turnId: TurnId | null;
338
552
  }
553
+ /** @public */
339
554
  interface ProcessActionSchedulingTriggerPreview {
555
+ /** @public */
340
556
  kind: "trigger";
557
+ /** @internal */
341
558
  trigger: string;
342
559
  }
560
+ /** @public */
343
561
  interface ProcessActionSchedulingTerminalPreview {
562
+ /** @public */
344
563
  kind: "terminal";
564
+ /** @internal */
345
565
  lifecycleStatus: ProcessTurnTerminalLifecycleStatus;
346
566
  }
567
+ /** @public */
347
568
  type ProcessActionSchedulingPreview = ProcessActionSchedulingFixedTurnPreview | ProcessActionSchedulingTriggerPreview | ProcessActionSchedulingTerminalPreview;
569
+ /** @public */
348
570
  type ProcessActionPreviewDefinition = ProcessActionSchedulingPreview;
571
+ /** @internal */
349
572
  interface ProcessActionSchedulingDefinition {
573
+ /** @internal */
350
574
  preview: ProcessActionSchedulingPreview;
351
575
  }
576
+ /** @internal */
352
577
  interface HumanTurnActionView {
578
+ /** @internal */
353
579
  actionId: string;
580
+ /** @internal */
354
581
  acceptanceState: TurnAcceptanceState;
582
+ /** @internal */
355
583
  label?: string;
584
+ /** @internal */
356
585
  description?: string;
586
+ /** @internal */
357
587
  preview?: ProcessActionPreviewDefinition;
588
+ /** @internal */
358
589
  scheduling?: ProcessActionSchedulingDefinition;
359
590
  }
591
+ /** @internal */
360
592
  interface HumanTurnNotesField {
593
+ /** @internal */
361
594
  id: string;
595
+ /** @internal */
362
596
  label: string;
597
+ /** @internal */
363
598
  description?: string;
599
+ /** @internal */
364
600
  placeholder?: string;
601
+ /** @internal */
365
602
  required?: boolean;
366
603
  }
604
+ /** @internal */
367
605
  interface HumanTurnExternalTrigger {
606
+ /** @internal */
368
607
  id: string;
608
+ /** @internal */
369
609
  actionId: string;
610
+ /** @internal */
370
611
  label: string;
612
+ /** @internal */
371
613
  description: string;
372
614
  }
615
+ /** @internal */
373
616
  interface HumanTurnExternalActionView {
374
- /** Process-local arming id exposed to providers and UI. */
617
+ /** Process-local arming id exposed to providers and UI. @internal */
375
618
  id: string;
619
+ /** @internal */
376
620
  externalActionId: string;
621
+ /** @internal */
377
622
  sourceKind: string;
623
+ /** @internal */
378
624
  label: string | null;
625
+ /** @internal */
379
626
  description: string | null;
380
627
  }
628
+ /** @internal */
381
629
  interface EventBus<TEventMap extends object = Record<string, unknown>> {
630
+ /** @internal */
382
631
  emit<K extends keyof TEventMap & string>(event: K, data: TEventMap[K]): void;
632
+ /** @internal */
383
633
  on<K extends keyof TEventMap & string>(event: K, handler: (data: TEventMap[K]) => void | Promise<void>): void;
634
+ /** @internal */
384
635
  off<K extends keyof TEventMap & string>(event: K, handler: (data: TEventMap[K]) => void | Promise<void>): void;
385
636
  }
386
637
 
638
+ /** @internal */
387
639
  type ProcessEventName = keyof ServerExtensionEventMap & string;
640
+ /** @internal */
388
641
  type ProcessEmittedEvent = {
642
+ /** @internal */
389
643
  type: ProcessEventName;
644
+ /** @internal */
390
645
  data: unknown;
391
646
  };
647
+ /** @public */
392
648
  type ProcessQueuedInput = Parameters<ServerProcessContext["queueInput"]>[0];
649
+ /** @public */
393
650
  type MaybePromise<T> = T | Promise<T>;
651
+ /** @public */
394
652
  type StaticRouteTarget = {
653
+ /** @public */
395
654
  to?: TurnId;
655
+ /** @internal */
396
656
  complete?: boolean;
657
+ /** @public */
397
658
  lifecycleStatus?: ProcessTurnTerminalLifecycleStatus;
398
659
  };
660
+ /** @public */
399
661
  interface ProcessRuntimeTurnContext<TParams = unknown, TState = unknown> extends WorkerProcessContext<TParams, TState> {
400
662
  }
663
+ /** @internal */
401
664
  interface LlmTurnPreparationContext<TParams = unknown, TState = unknown> extends ProcessRuntimeTurnContext<TParams, TState> {
665
+ /** @internal */
402
666
  callIntegrationTool(name: string, args: Record<string, unknown>): Promise<unknown>;
667
+ /** @internal */
403
668
  reportProgress(report: TurnProgressReport): void;
404
669
  }
670
+ /** @public */
405
671
  interface ProcessServerRuntimeContext<TParams = unknown, TState = unknown> {
672
+ /** @internal */
406
673
  readonly process: ServerProcessContext<TParams, TState>["process"];
674
+ /** @internal */
407
675
  readonly projects: ServerProcessContext<TParams, TState>["projects"];
676
+ /** @internal */
408
677
  readonly params: TParams;
678
+ /** @public */
409
679
  readonly state: TState;
680
+ /** @internal */
410
681
  readSemanticTurnResultMarkdown(ref: ProcessSemanticEntryRefKey): string | null;
682
+ /** @internal */
411
683
  readProductTurnResultMarkdown(productName: string): string | null;
684
+ /** @internal */
412
685
  reportProgress?(report: TurnProgressReport): void;
413
686
  }
687
+ /** @internal */
414
688
  interface ProcessBroadcastEffect {
689
+ /** @internal */
415
690
  type: string;
691
+ /** @internal */
416
692
  payload: Record<string, unknown>;
417
693
  }
694
+ /** @public */
418
695
  type ProcessPatchEffect = Partial<Pick<ProcessInstance, "lifecycleStatus" | "planRevision" | "title" | "externalId" | "externalUrl" | "metadata" | "defaultModelProfileId" | "turnConfigsJson">>;
696
+ /** @public */
419
697
  interface ProcessLifecycleEffects {
698
+ /** @public */
420
699
  processPatch?: ProcessPatchEffect;
700
+ /** @internal */
421
701
  broadcasts?: readonly ProcessBroadcastEffect[];
422
702
  }
703
+ /** @public */
423
704
  interface ProcessEffectPlan<TState = unknown> extends ProcessLifecycleEffects {
705
+ /** @public */
424
706
  state?: TState;
707
+ /** @internal */
425
708
  emit?: readonly ProcessEmittedEvent[];
709
+ /** @public */
426
710
  queueInput?: readonly ProcessQueuedInput[];
427
711
  }
712
+ /** @internal */
428
713
  interface SavePlanResultLifecycleIntent<TParams = unknown, TState = unknown> {
714
+ /** @internal */
429
715
  kind: "save_plan_result";
716
+ /** @internal */
430
717
  summaryParam: string;
718
+ /** @internal */
431
719
  acceptanceCriteriaParam: string;
720
+ /** @internal */
432
721
  planMarkdownParam: string;
722
+ /** @internal */
433
723
  emitEventType: ProcessEventName;
724
+ /** @internal */
434
725
  broadcastType: string;
726
+ /** @internal */
435
727
  state?: ProcessOutcomeEffect<TParams, TState>;
436
728
  }
729
+ /** @internal */
437
730
  type ProcessOutcomeLifecycleIntent<TParams = unknown, TState = unknown> = SavePlanResultLifecycleIntent<TParams, TState>;
731
+ /** @public */
438
732
  interface ProcessActionExecution<TParams = unknown, TState = unknown> {
733
+ /** @public */
439
734
  readonly ctx: ProcessServerRuntimeContext<TParams, TState>;
735
+ /** @public */
440
736
  readonly input: Record<string, unknown>;
737
+ /** @internal */
441
738
  readonly turnId: TurnId;
739
+ /** @internal */
442
740
  readonly actionId: string;
741
+ /** @internal */
443
742
  readonly selectedBranchId?: string;
444
743
  }
744
+ /** @public */
445
745
  interface ProcessOutcomeExecution<TParams = unknown, TState = unknown> {
746
+ /** @internal */
446
747
  readonly ctx: ProcessServerRuntimeContext<TParams, TState>;
748
+ /** @internal */
447
749
  readonly event: ProcessTurnOutcomeEvent;
750
+ /** @internal */
448
751
  readonly turnId: TurnId;
752
+ /** @internal */
449
753
  readonly outcome: string;
450
754
  }
755
+ /** @public */
451
756
  type ProcessActionEffect<TParams = unknown, TState = unknown> = (input: ProcessActionExecution<TParams, TState>) => MaybePromise<ProcessEffectPlan<TState> | undefined>;
757
+ /** @public */
452
758
  type ProcessActionBranchSelector<TParams = unknown, TState = unknown> = (input: Omit<ProcessActionExecution<TParams, TState>, "selectedBranchId">) => MaybePromise<string>;
759
+ /** @public */
453
760
  type ProcessOutcomeEffect<TParams = unknown, TState = unknown> = (input: ProcessOutcomeExecution<TParams, TState>) => MaybePromise<ProcessEffectPlan<TState> | undefined>;
761
+ /** @internal */
454
762
  type ProcessOutcomeBranchSelector<TParams = unknown, TState = unknown> = (input: ProcessOutcomeExecution<TParams, TState>) => MaybePromise<string>;
763
+ /** @internal */
455
764
  interface ProcessOutcomeBranchSpec extends StaticRouteTarget {
765
+ /** @internal */
456
766
  trigger?: string;
457
767
  }
768
+ /** @internal */
458
769
  interface ProcessActionExternalTrigger {
770
+ /** @internal */
459
771
  id: string;
772
+ /** @internal */
460
773
  label: string;
774
+ /** @internal */
461
775
  description: string;
462
776
  }
777
+ /** @internal */
463
778
  interface ExternalActionInputPublication {
779
+ /** @internal */
464
780
  productName: string;
781
+ /** @internal */
465
782
  inputField: string;
466
783
  }
784
+ /** @public */
467
785
  interface ProcessHumanTurnExternalActionSpec<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> extends StaticRouteTarget {
786
+ /** @internal */
468
787
  id: string;
788
+ /** @internal */
469
789
  source: ExternalActionSource<TParams, TState, TEvent, TInput>;
470
- /** Arms and exposes this action only when the current process snapshot matches. */
790
+ /** Arms and exposes this action only when the current process snapshot matches. @public */
471
791
  when?: (ctx: ExternalSourceResolveContext<TParams, TState>) => boolean;
792
+ /** @internal */
472
793
  label?: string;
794
+ /** @internal */
473
795
  description?: string;
796
+ /** @internal */
474
797
  publishInput?: ExternalActionInputPublication;
798
+ /** @public */
475
799
  effect?: ExternalSourceEffect<TParams, TState, TEvent, TInput>;
476
800
  }
801
+ /** @public */
477
802
  interface ProcessActionBranchSpec extends StaticRouteTarget {
803
+ /** @internal */
478
804
  trigger?: string;
479
805
  }
806
+ /** @public */
480
807
  type StaticActionRouting = StaticRouteTarget & {
808
+ /** @internal */
481
809
  trigger?: string;
482
810
  };
811
+ /** @public */
483
812
  type BranchingActionRouting<TParams, TState> = {
813
+ /** @public */
484
814
  branches: Record<string, ProcessActionBranchSpec>;
815
+ /** @public */
485
816
  choose: ProcessActionBranchSelector<TParams, TState>;
486
817
  };
818
+ /** @public */
487
819
  interface BaseActionSpec<TParams, TState> {
820
+ /** @public */
488
821
  label: string;
822
+ /** @public */
489
823
  description?: string;
824
+ /** @internal */
490
825
  form?: ActionFormDefinition;
826
+ /** @public */
491
827
  preview?: ProcessActionPreviewDefinition;
828
+ /** @public */
492
829
  schedulable?: boolean;
830
+ /** @public */
493
831
  effect?: ProcessActionEffect<TParams, TState>;
494
832
  }
833
+ /** @public */
495
834
  type ProcessHumanTurnActionSpec<TParams = unknown, TState = unknown> = BaseActionSpec<TParams, TState> & {
835
+ /** @public */
496
836
  acceptanceState: TurnAcceptanceState;
837
+ /** @internal */
497
838
  externalTriggers?: readonly ProcessActionExternalTrigger[];
498
839
  } & (StaticActionRouting | BranchingActionRouting<TParams, TState>);
840
+ /** @public */
499
841
  interface ProcessToolOutcomeBaseSpec<TParams = unknown, TState = unknown> {
842
+ /** @internal */
500
843
  description: string;
844
+ /** @internal */
501
845
  parameters: Record<string, OutcomeToolParameterSpec>;
502
- /** Product published from this outcome's turn-result markdown, when this outcome is selected. */
846
+ /** Product published from this outcome's turn-result markdown, when this outcome is selected. @internal */
503
847
  publishedProduct?: string;
504
- /** Outcome parameter whose markdown value is captured as the turn result. */
848
+ /** Outcome parameter whose markdown value is captured as the turn result. @internal */
505
849
  turnResultMarkdownParameter?: string;
506
- /** Outcome parameter containing a concise operator-facing summary. */
850
+ /** Outcome parameter containing a concise operator-facing summary. @internal */
507
851
  resultSummaryParameter?: string;
852
+ /** @internal */
508
853
  effect?: ProcessOutcomeEffect<TParams, TState>;
854
+ /** @internal */
509
855
  lifecycleIntent?: ProcessOutcomeLifecycleIntent<TParams, TState>;
510
856
  }
857
+ /** @public */
511
858
  type ProcessToolOutcomeSpec<TParams = unknown, TState = unknown> = ProcessToolOutcomeBaseSpec<TParams, TState> & (StaticRouteTarget | {
859
+ /** @internal */
512
860
  branches: Record<string, ProcessOutcomeBranchSpec>;
861
+ /** @internal */
513
862
  choose: ProcessOutcomeBranchSelector<TParams, TState>;
514
863
  });
864
+ /** @public */
515
865
  type HumanTurnOperatorAttention = "required" | "passive";
866
+ /** @public */
516
867
  interface HumanTurnDefinition<TParams = unknown, TState = unknown> {
868
+ /** @public */
517
869
  kind: "human";
870
+ /** @public */
518
871
  description: string;
519
- /** Named product rendered as the subject of this human review turn. */
872
+ /** Named product rendered as the subject of this human review turn. @internal */
520
873
  reviewProduct?: string;
874
+ /** @internal */
521
875
  reviewSemanticRef?: ProcessSemanticEntryRefKey;
522
- /** Controls whether entering this turn should raise an action-required toast. */
876
+ /** Controls whether entering this turn should raise an action-required toast. @public */
523
877
  operatorAttention?: HumanTurnOperatorAttention;
878
+ /** @internal */
524
879
  notesFields?: readonly HumanTurnNotesField[];
880
+ /** @internal */
525
881
  commentary?: string;
882
+ /** @public */
526
883
  actions: Record<string, ProcessHumanTurnActionSpec<TParams, TState>>;
884
+ /** @internal */
527
885
  externalActions?: Record<string, ProcessHumanTurnExternalActionSpec<TParams, TState>>;
528
886
  }
887
+ /** @public */
529
888
  interface ProcessTurnEndSpec<TParams = unknown, TState = unknown, TOutcome extends string = string> extends StaticRouteTarget {
889
+ /** @public */
530
890
  outcome: TOutcome;
891
+ /** @public */
531
892
  params?: Record<string, unknown>;
893
+ /** @public */
532
894
  effect?: ProcessOutcomeEffect<TParams, TState>;
533
895
  }
896
+ /** @internal */
534
897
  type OutcomeRouteSpec<TParams = unknown, TState = unknown> = StaticRouteTarget & Partial<Pick<ProcessToolOutcomeSpec<TParams, TState>, "description" | "parameters" | "effect">>;
898
+ /** @internal */
535
899
  interface OutcomeRouteOptions {
900
+ /** @internal */
536
901
  strict?: boolean;
537
902
  }
903
+ /** @internal */
538
904
  type LlmModelPurpose = "process_title_generation";
905
+ /** @public */
539
906
  interface LlmTurnDefinition<TOutcome extends string = string, TParams = unknown, TState = unknown> {
907
+ /** @public */
540
908
  kind: "llm";
909
+ /** @public */
541
910
  description: string;
542
- /** Code-defined model policy purpose. Purpose selections cannot be overridden per launch/action. */
911
+ /** Code-defined model policy purpose. Purpose selections cannot be overridden per launch/action. @internal */
543
912
  modelPurpose?: LlmModelPurpose;
544
- /** Built-in Pi tools active while this turn runs. */
913
+ /** Built-in Pi tools active while this turn runs. @public */
545
914
  availableTools: readonly PiBuiltInToolName[];
546
- /** Server-owned integration tools proxied over authenticated worker IPC. */
915
+ /** Server-owned integration tools proxied over authenticated worker IPC. @internal */
547
916
  integrationTools?: readonly string[];
548
- /** Resolve a constrained tool set from validated durable process data at turn start. */
917
+ /** Resolve a constrained tool set from validated durable process data at turn start. @public */
549
918
  resolveIntegrationTools?: (params: TParams, state: TState) => readonly string[];
550
- /** Opt in to the durable, operator-facing ask_questions custom tool. */
919
+ /** Opt in to the durable, operator-facing ask_questions custom tool. @internal */
551
920
  askQuestions?: boolean;
552
- /** Deterministic worker preparation that must complete before Pi is prompted. */
921
+ /** Deterministic worker preparation that must complete before Pi is prompted. @internal */
553
922
  prepare?(ctx: LlmTurnPreparationContext<TParams, TState>): MaybePromise<unknown>;
923
+ /** @public */
554
924
  completionMode?: TurnCompletionMode;
925
+ /** @public */
555
926
  branchType: TurnBranchType;
927
+ /** @public */
556
928
  context: TurnContextMode;
929
+ /** @internal */
557
930
  startFrom?: ProcessTurnStartSelection;
931
+ /** @internal */
558
932
  restorePrimaryLeafAfterTurn?: boolean;
933
+ /** @public */
559
934
  prompt(ctx: ProcessRuntimeTurnContext<TParams, TState>): string | Promise<string>;
935
+ /** @public */
560
936
  outcomes?: Partial<Record<TOutcome, ProcessToolOutcomeSpec<TParams, TState>>>;
937
+ /** @public */
561
938
  turnEnd?: ProcessTurnEndSpec<TParams, TState, TOutcome>;
939
+ /** @public */
562
940
  turnResultMarkdown?: TurnResultMarkdownBehavior;
941
+ /** @internal */
563
942
  reviewSemanticRef?: ProcessSemanticEntryRefKey;
943
+ /** @internal */
564
944
  resultSemanticRef?: ProcessSemanticEntryRefKey;
945
+ /** @internal */
565
946
  publishedProduct?: string;
947
+ /** @internal */
566
948
  consumedProducts?: readonly string[];
949
+ /** @internal */
567
950
  optionalConsumedProducts?: readonly string[];
951
+ /** @internal */
568
952
  requiredSemanticMarkdownRefs?: readonly ProcessSemanticEntryRefKey[];
953
+ /** @internal */
569
954
  optionalSemanticMarkdownRefs?: readonly ProcessSemanticEntryRefKey[];
570
955
  }
956
+ /** @public */
571
957
  interface AutomaticTurnDefinition<TOutcome extends string = string, TParams = unknown, TState = unknown> {
958
+ /** @public */
572
959
  kind: "automatic";
960
+ /** @public */
573
961
  description: string;
574
- /** Server-owned integration tools callable by this deterministic worker turn. */
962
+ /** Server-owned integration tools callable by this deterministic worker turn. @internal */
575
963
  integrationTools?: readonly string[];
576
- /** External events armed while this automatic turn is selected and waiting. */
964
+ /** External events armed while this automatic turn is selected and waiting. @public */
577
965
  externalActions?: Record<string, ProcessHumanTurnExternalActionSpec<TParams, TState>>;
966
+ /** @internal */
578
967
  outcomes?: Partial<Record<TOutcome, ProcessToolOutcomeSpec<TParams, TState>>>;
968
+ /** @internal */
579
969
  turnEnd?: ProcessTurnEndSpec<TParams, TState, TOutcome>;
970
+ /** @internal */
580
971
  reviewSemanticRef?: ProcessSemanticEntryRefKey;
972
+ /** @public */
581
973
  run(ctx: ProcessRuntimeTurnContext<TParams, TState>): Promise<WorkerCompleteInput<TOutcome>> | WorkerCompleteInput<TOutcome>;
582
974
  }
975
+ /** @internal */
583
976
  interface ExternalSourceTransition<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> extends StaticRouteTarget {
977
+ /** @internal */
584
978
  source: ExternalActionSource<TParams, TState, TEvent, TInput>;
979
+ /** @internal */
585
980
  effect?: ExternalSourceEffect<TParams, TState, TEvent, TInput>;
586
981
  }
982
+ /** @public */
587
983
  interface ExternalTurnDefinition<TParams = unknown, TState = unknown> {
984
+ /** @public */
588
985
  kind: "external";
986
+ /** @public */
589
987
  description: string;
988
+ /** @internal */
590
989
  transitions: readonly ExternalSourceTransition<TParams, TState>[];
990
+ /** @internal */
591
991
  reviewSemanticRef?: ProcessSemanticEntryRefKey;
592
992
  }
993
+ /** @public */
593
994
  type TurnDefinition<TParams = unknown, TState = unknown> = LlmTurnDefinition<string, TParams, TState> | AutomaticTurnDefinition<string, TParams, TState> | HumanTurnDefinition<TParams, TState> | ExternalTurnDefinition<TParams, TState>;
995
+ /** @public */
594
996
  type TurnDefinitionRecord<TParams = unknown, TState = unknown> = Record<TurnId, TurnDefinition<TParams, TState>>;
595
- type ProcessDefinition<TParams = unknown, TState = unknown> = ExtensionProcessDefinition<TParams, TState>;
997
+ /** @public */
596
998
  interface DefinedProcessInput<TParams = unknown, TState = unknown> extends Omit<ExtensionProcessDefinition<TParams, TState>, "entryTurnId" | "alternateEntryTurnIds" | "turns"> {
597
- /** Primary entry used when a launch does not select a start turn explicitly. */
999
+ /** Primary entry used when a launch does not select a start turn explicitly. @public */
598
1000
  entry: TurnId;
599
- /** Additional entry turns that launchers may select explicitly. */
1001
+ /** Additional entry turns that launchers may select explicitly. @public */
600
1002
  alternateEntries?: readonly TurnId[];
1003
+ /** @public */
601
1004
  turns: TurnDefinitionRecord<TParams, TState>;
602
1005
  }
1006
+ /** @internal */
603
1007
  declare function getExternalSourceTransitionId(input: {
1008
+ /** @internal */
604
1009
  turnId: TurnId;
1010
+ /** @internal */
605
1011
  source: ExternalActionSource;
1012
+ /** @internal */
606
1013
  index: number;
607
1014
  }): string;
1015
+ /** @internal */
608
1016
  declare function getExternalActionArmingId(input: {
1017
+ /** @internal */
609
1018
  turnId: TurnId;
1019
+ /** @internal */
610
1020
  externalActionId: string;
611
1021
  }): string;
1022
+ /** @internal */
612
1023
  declare function getExternalActionTransitionTrigger(input: {
1024
+ /** @internal */
613
1025
  externalActionId: string;
614
1026
  }): string;
1027
+ /** @internal */
615
1028
  declare function resolveHumanTurnView<TParams, TState>(input: {
1029
+ /** @internal */
616
1030
  turnId: TurnId;
1031
+ /** @internal */
617
1032
  turn: HumanTurnDefinition<TParams, TState>;
618
1033
  }): {
1034
+ /** @internal */
619
1035
  actions: readonly HumanTurnActionView[];
1036
+ /** @internal */
620
1037
  externalTriggers: readonly HumanTurnExternalTrigger[];
1038
+ /** @internal */
621
1039
  externalActions: readonly HumanTurnExternalActionView[];
622
1040
  };
623
- declare function defineProcess<TParams = unknown, TState = unknown>(input: DefinedProcessInput<TParams, TState>): ProcessDefinition<TParams, TState>;
1041
+ /** @public */
1042
+ declare function defineProcess<TParams = unknown, TState = unknown>(input: DefinedProcessInput<TParams, TState>): ExtensionProcessDefinition<TParams, TState>;
1043
+ /** @internal */
624
1044
  type RoutableTurnDefinition<TOutcome extends string, TParams, TState> = LlmTurnDefinition<TOutcome, TParams, TState> | AutomaticTurnDefinition<TOutcome, TParams, TState>;
1045
+ /** @internal */
625
1046
  type RoutableOutcome<TTurn> = TTurn extends RoutableTurnDefinition<infer TOutcome, any, any> ? TOutcome : never;
1047
+ /** @internal */
626
1048
  type RoutableParams<TTurn> = TTurn extends RoutableTurnDefinition<any, infer TParams, any> ? TParams : never;
1049
+ /** @internal */
627
1050
  type RoutableState<TTurn> = TTurn extends RoutableTurnDefinition<any, any, infer TState> ? TState : never;
1051
+ /** @internal */
628
1052
  declare function routeTurnOutcomes<TTurn extends RoutableTurnDefinition<string, any, any>>(baseTurn: TTurn, routes: Partial<Record<RoutableOutcome<TTurn>, OutcomeRouteSpec<RoutableParams<TTurn>, RoutableState<TTurn>>>>, options?: OutcomeRouteOptions): TTurn;
1053
+ /** @public */
629
1054
  declare function llmTurn<TParams = unknown, TState = unknown, TOutcome extends string = string>(input: Omit<LlmTurnDefinition<TOutcome, TParams, TState>, "kind">): LlmTurnDefinition<TOutcome, TParams, TState>;
1055
+ /** @internal */
630
1056
  declare function automaticTurn<TParams = unknown, TState = unknown, TOutcome extends string = string>(input: Omit<AutomaticTurnDefinition<TOutcome, TParams, TState>, "kind">): AutomaticTurnDefinition<TOutcome, TParams, TState>;
1057
+ /** @public */
631
1058
  declare function humanTurn<TParams = unknown, TState = unknown>(input: Omit<HumanTurnDefinition<TParams, TState>, "kind">): HumanTurnDefinition<TParams, TState>;
632
- declare function externalTurn<TParams = unknown, TState = unknown>(input: Omit<ExternalTurnDefinition<TParams, TState>, "kind">): ExternalTurnDefinition<TParams, TState>;
633
1059
 
634
- /** JSON values that may cross the server/worker bootstrap boundary. */
1060
+ /** JSON values that may cross the server/worker bootstrap boundary. @public */
635
1061
  type ProviderJsonPrimitive = string | number | boolean | null;
1062
+ /** @public */
636
1063
  type ProviderJsonValue = ProviderJsonPrimitive | ProviderJsonValue[] | {
1064
+ /** @internal */
637
1065
  [key: string]: ProviderJsonValue;
638
1066
  };
1067
+ /** @public */
639
1068
  type ProviderJsonObject = {
1069
+ /** @internal */
640
1070
  [key: string]: ProviderJsonValue;
641
1071
  };
1072
+ /** @public */
642
1073
  interface ConfiguredProviderModel {
1074
+ /** @public */
643
1075
  readonly profileId: string;
1076
+ /** @public */
644
1077
  readonly modelId: string;
645
1078
  }
1079
+ /** @public */
646
1080
  type ProviderAvailability = "available" | "unavailable" | "stale";
1081
+ /** @public */
647
1082
  interface ProviderModelStatus {
1083
+ /** @public */
648
1084
  readonly modelId: string;
1085
+ /** @public */
649
1086
  readonly availability: ProviderAvailability;
650
- /** Safe operator-facing reason. It must not contain credential material. */
1087
+ /** Safe operator-facing reason. It must not contain credential material. @internal */
651
1088
  readonly safeReason?: string;
652
1089
  }
1090
+ /** @public */
653
1091
  interface ProviderCredentialStatus {
1092
+ /** @public */
654
1093
  readonly available: boolean;
1094
+ /** @public */
655
1095
  readonly revision: number | null;
656
1096
  }
1097
+ /** @public */
657
1098
  interface ModelProviderModelsContext<TConfig = unknown> {
1099
+ /** @internal */
658
1100
  readonly config: TConfig;
1101
+ /** @public */
659
1102
  readonly configuredModels: readonly ConfiguredProviderModel[];
1103
+ /** @public */
660
1104
  readonly credentialStatus: ProviderCredentialStatus;
661
1105
  }
1106
+ /** @public */
662
1107
  interface ProviderOptionChoice {
1108
+ /** @internal */
663
1109
  readonly value: string;
1110
+ /** @internal */
664
1111
  readonly label: string;
665
1112
  }
1113
+ /** @public */
666
1114
  interface ProviderOptionChoicesContext<TConfig = unknown> {
1115
+ /** @internal */
667
1116
  readonly config: TConfig;
1117
+ /** @internal */
668
1118
  readonly credentialStatus: ProviderCredentialStatus;
669
1119
  }
1120
+ /** @internal */
670
1121
  interface ProviderOptionDefaultContext<TConfig = unknown> {
1122
+ /** @internal */
671
1123
  readonly config: TConfig;
672
1124
  }
1125
+ /** @public */
673
1126
  interface ProviderOptionField<TConfig = unknown> {
1127
+ /** @public */
674
1128
  readonly label: string;
1129
+ /** @public */
675
1130
  readonly required?: boolean;
1131
+ /** @internal */
676
1132
  readonly minLength?: number;
1133
+ /** @public */
677
1134
  readonly maxLength?: number;
678
1135
  /**
679
1136
  * Explicit provider default. Dynamic choices are advisory and are never used
680
1137
  * as an implicit default.
681
1138
  */
1139
+ /** @internal */
682
1140
  readonly defaultValue?: string | null | ((ctx: ProviderOptionDefaultContext<TConfig>) => string | null | undefined);
683
1141
  }
1142
+ /** @public */
684
1143
  interface ProviderOptionsDefinition<TConfig = unknown> {
1144
+ /** @public */
685
1145
  readonly fields: Readonly<Record<string, ProviderOptionField<TConfig>>>;
1146
+ /** @public */
686
1147
  choices?(ctx: ProviderOptionChoicesContext<TConfig>): Readonly<Record<string, readonly ProviderOptionChoice[]>> | Promise<Readonly<Record<string, readonly ProviderOptionChoice[]>>>;
687
1148
  }
1149
+ /** @public */
688
1150
  declare function defineProviderOptions<TConfig = unknown>(definition: ProviderOptionsDefinition<TConfig>): ProviderOptionsDefinition<TConfig>;
1151
+ /** @internal */
689
1152
  interface ProviderOptionsResolutionInput<TConfig = unknown> {
1153
+ /** @internal */
690
1154
  readonly definition: ProviderOptionsDefinition<TConfig> | null | undefined;
1155
+ /** @internal */
691
1156
  readonly config: TConfig;
1157
+ /** @internal */
692
1158
  readonly explicit?: Readonly<Record<string, unknown>> | null;
1159
+ /** @internal */
693
1160
  readonly profileDefaults?: Readonly<Record<string, unknown>> | null;
694
1161
  }
1162
+ /** @internal */
695
1163
  interface ProviderOptionValidationIssue {
1164
+ /** @internal */
696
1165
  readonly fieldId: string;
1166
+ /** @internal */
697
1167
  readonly code: "unknown" | "not_string" | "too_short" | "too_long" | "required";
1168
+ /** @internal */
698
1169
  readonly message: string;
699
1170
  }
1171
+ /** @internal */
700
1172
  type ProviderOptionsResolution = {
1173
+ /** @internal */
701
1174
  readonly ok: true;
1175
+ /** @internal */
702
1176
  readonly value: Readonly<Record<string, string>>;
703
1177
  } | {
1178
+ /** @internal */
704
1179
  readonly ok: false;
1180
+ /** @internal */
705
1181
  readonly issues: readonly ProviderOptionValidationIssue[];
706
1182
  };
707
1183
  /**
708
1184
  * Resolve explicit values, profile defaults, then declared provider defaults.
709
1185
  * Dynamic choices deliberately do not participate in validation or fallback.
710
1186
  */
1187
+ /** @internal */
711
1188
  declare function resolveProviderOptions<TConfig = unknown>(input: ProviderOptionsResolutionInput<TConfig>): ProviderOptionsResolution;
712
- /** Keep only fields declared by a newly selected provider. */
1189
+ /** Keep only fields declared by a newly selected provider. @internal */
713
1190
  declare function filterProviderOptionsForDefinition<TConfig = unknown>(definition: ProviderOptionsDefinition<TConfig> | null | undefined, values: Readonly<Record<string, string>>): Readonly<Record<string, string>>;
714
1191
  /**
715
1192
  * Runtime-independent schema boundary for non-secret provider worker config.
716
1193
  * Adapters may wrap Valibot, TypeBox, Zod, or another validator behind parse.
717
1194
  */
1195
+ /** @public */
718
1196
  interface ProviderWorkerConfigSchema<TValue extends ProviderJsonObject> {
1197
+ /** @public */
719
1198
  parse(value: unknown): TValue;
720
1199
  }
1200
+ /** @public */
721
1201
  interface ProviderWorkerConfigContext<TConfig = unknown> {
1202
+ /** @public */
722
1203
  readonly config: TConfig;
1204
+ /** @internal */
723
1205
  readonly options: Readonly<Record<string, string>>;
724
1206
  }
1207
+ /** @public */
725
1208
  interface ProviderWorkerConfigDefinition<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject> {
1209
+ /** @public */
726
1210
  readonly version: number;
1211
+ /** @public */
727
1212
  readonly schema: ProviderWorkerConfigSchema<TValue>;
1213
+ /** @public */
728
1214
  resolve(ctx: ProviderWorkerConfigContext<TConfig>): TValue;
729
1215
  }
1216
+ /** @public */
730
1217
  declare function defineWorkerConfig<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject>(definition: ProviderWorkerConfigDefinition<TConfig, TValue>): ProviderWorkerConfigDefinition<TConfig, TValue>;
1218
+ /** @public */
731
1219
  interface PiWorkerReference<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject> {
1220
+ /** @public */
732
1221
  readonly kind: "extension_pi_worker";
1222
+ /** @internal */
733
1223
  readonly config?: ProviderWorkerConfigDefinition<TConfig, TValue>;
734
- /** Mutable, flat JSON credential files required by this provider's Pi extension. */
1224
+ /** Mutable, flat JSON credential files required by this provider's Pi extension. @internal */
735
1225
  readonly credentialFiles?: readonly string[];
736
1226
  }
1227
+ /** @public */
737
1228
  interface PiServerReference {
1229
+ /** @internal */
738
1230
  readonly kind: "extension_pi_server";
739
1231
  }
1232
+ /** @public */
740
1233
  interface PiServerGenerateTextInput<TConfig = unknown> {
1234
+ /** @public */
741
1235
  readonly providerId: string;
1236
+ /** @public */
742
1237
  readonly modelId: string;
1238
+ /** @public */
743
1239
  readonly thinkingLevel: string;
1240
+ /** @public */
744
1241
  readonly prompt: string;
1242
+ /** @public */
745
1243
  readonly systemPrompt: string;
1244
+ /** @public */
746
1245
  readonly maxTokens: number;
1246
+ /** @public */
747
1247
  readonly config: TConfig;
1248
+ /** @public */
748
1249
  readonly options: Readonly<Record<string, string>>;
1250
+ /** @public */
749
1251
  readonly secrets: Readonly<Record<string, string>>;
1252
+ /** @public */
750
1253
  readonly request: {
1254
+ /** @public */
751
1255
  readonly timeoutMs?: number;
1256
+ /** @internal */
752
1257
  readonly maxRetries?: number;
1258
+ /** @public */
753
1259
  readonly maxRetryDelayMs: number;
754
1260
  };
755
1261
  }
756
- /** Server-only provider boundary for title generation and future cheap LLM consumers. */
1262
+ /** Server-only provider boundary for title generation and future cheap LLM consumers. @public */
757
1263
  interface PiServerAdapter<TConfig = unknown> {
1264
+ /** @public */
758
1265
  generateText(input: PiServerGenerateTextInput<TConfig>): Promise<string>;
759
1266
  }
1267
+ /** @public */
760
1268
  declare function definePiServerAdapter<TConfig = unknown>(adapter: PiServerAdapter<TConfig>): PiServerAdapter<TConfig>;
1269
+ /** @public */
761
1270
  interface BuiltinPiProviderReference {
1271
+ /** @public */
762
1272
  readonly kind: "builtin_pi_provider";
1273
+ /** @internal */
763
1274
  readonly providerId: string;
764
1275
  }
1276
+ /** @public */
765
1277
  interface ConfiguredPiProviderReference<TConfig = unknown> {
1278
+ /** @public */
766
1279
  readonly kind: "configured_pi_provider";
1280
+ /** @internal */
767
1281
  readonly providerId: string;
768
- /** Resolve the credential-blind models.json document pinned into each worker snapshot. */
1282
+ /** Resolve the credential-blind models.json document pinned into each worker snapshot. @internal */
769
1283
  resolveModels(ctx: {
1284
+ /** @internal */
770
1285
  readonly config: TConfig;
771
1286
  }): ProviderJsonObject;
772
1287
  }
1288
+ /** @public */
773
1289
  declare function piWorker<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject>(input?: {
1290
+ /** @public */
774
1291
  config?: ProviderWorkerConfigDefinition<TConfig, TValue>;
1292
+ /** @public */
775
1293
  credentialFiles?: readonly string[];
776
1294
  }): PiWorkerReference<TConfig, TValue>;
1295
+ /** @public */
777
1296
  declare function piServer(): PiServerReference;
1297
+ /** @public */
778
1298
  declare function builtinPiProvider(providerId: string): BuiltinPiProviderReference;
1299
+ /** @internal */
779
1300
  declare function configuredPiProvider<TConfig>(providerId: string, resolveModels: ConfiguredPiProviderReference<TConfig>["resolveModels"]): ConfiguredPiProviderReference<TConfig>;
1301
+ /** @public */
780
1302
  type ModelProviderWorker<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject> = PiWorkerReference<TConfig, TValue> | BuiltinPiProviderReference | ConfiguredPiProviderReference<TConfig>;
1303
+ /** @public */
781
1304
  type ModelProviderServer = PiServerReference | BuiltinPiProviderReference;
1305
+ /** @public */
782
1306
  interface ModelProviderSecretsContext<TConfig = unknown, TCredential = unknown> {
1307
+ /** @internal */
783
1308
  readonly config: TConfig;
1309
+ /** @public */
784
1310
  readonly credential: TCredential | null;
1311
+ /** @internal */
785
1312
  readonly options: Readonly<Record<string, string>>;
786
1313
  }
1314
+ /** @public */
787
1315
  interface ParsedModelProviderConfig<TConfig = unknown, TCredential = unknown> {
788
- /** Restart-scoped, non-secret provider configuration. */
1316
+ /** Restart-scoped, non-secret provider configuration. @public */
789
1317
  readonly config: TConfig;
790
- /** Optional credential used only to initialize an empty durable credential store. */
1318
+ /** Optional credential used only to initialize an empty durable credential store. @internal */
791
1319
  readonly credential?: TCredential;
792
1320
  }
1321
+ /** @public */
793
1322
  interface ModelProviderCredentialDefinition<TCredential = unknown> {
794
- /** Validates configured, durable, and worker-refreshed credential data. */
1323
+ /** Validates configured, durable, and worker-refreshed credential data. @public */
795
1324
  parse?(value: unknown): TCredential;
796
1325
  }
1326
+ /** @public */
797
1327
  interface ModelProviderDefinition<TConfig = unknown, TCredential = unknown, TWorkerConfig extends ProviderJsonObject = ProviderJsonObject> {
1328
+ /** @public */
798
1329
  readonly id: string;
1330
+ /** @public */
799
1331
  parseConfig(raw: unknown): ParsedModelProviderConfig<TConfig, TCredential>;
1332
+ /** @public */
800
1333
  readonly worker: ModelProviderWorker<TConfig, TWorkerConfig>;
1334
+ /** @public */
801
1335
  readonly server?: ModelProviderServer;
1336
+ /** @public */
802
1337
  models(ctx: ModelProviderModelsContext<TConfig>): readonly ProviderModelStatus[] | Promise<readonly ProviderModelStatus[]>;
1338
+ /** @public */
803
1339
  readonly options?: ProviderOptionsDefinition<TConfig>;
1340
+ /** @public */
804
1341
  secrets(ctx: ModelProviderSecretsContext<TConfig, TCredential>): Readonly<Record<string, string>>;
1342
+ /** @public */
805
1343
  readonly credential?: ModelProviderCredentialDefinition<TCredential>;
806
1344
  }
1345
+ /** @public */
807
1346
  declare function defineModelProvider<TConfig = unknown, TCredential = unknown, TWorkerConfig extends ProviderJsonObject = ProviderJsonObject>(definition: ModelProviderDefinition<TConfig, TCredential, TWorkerConfig>): ModelProviderDefinition<TConfig, TCredential, TWorkerConfig>;
808
- /** Type-erased provider definition used after its typed boundary has been established. */
1347
+ /** Type-erased provider definition used after its typed boundary has been established. @public */
809
1348
  type ErasedModelProviderDefinition = ModelProviderDefinition<any, any, any>;
1349
+ /** @public */
810
1350
  interface ModelProviderSetEntry {
1351
+ /** @public */
811
1352
  readonly definition: ErasedModelProviderDefinition;
812
- /** Owner-scoped fragment passed to this provider's parseConfig(). */
1353
+ /** Owner-scoped fragment passed to this provider's parseConfig(). @public */
813
1354
  readonly rawConfig: unknown;
814
1355
  }
815
- /** Resolves every provider owned by one extension from its owner-scoped configuration. */
1356
+ /** Resolves every provider owned by one extension from its owner-scoped configuration. @public */
816
1357
  type ModelProviderSet = (ownerConfig: unknown) => readonly ModelProviderSetEntry[];
1358
+ /** @public */
817
1359
  declare function defineModelProviders(resolve: ModelProviderSet): ModelProviderSet;
1360
+ /** @public */
818
1361
  interface PiWorkerSecretBag {
1362
+ /** @public */
819
1363
  get(key: string): string | undefined;
1364
+ /** @public */
820
1365
  require(key: string): string;
1366
+ /** @public */
821
1367
  keys(): readonly string[];
822
1368
  }
1369
+ /** @public */
823
1370
  interface PiWorkerContributionContext {
1371
+ /** @public */
824
1372
  readonly model: {
1373
+ /** @public */
825
1374
  readonly providerId: string;
1375
+ /** @public */
826
1376
  readonly modelId: string;
827
1377
  };
1378
+ /** @public */
828
1379
  readonly options: Readonly<Record<string, string>>;
1380
+ /** @public */
829
1381
  readonly workerConfig: ProviderJsonObject | null;
1382
+ /** @public */
830
1383
  readonly secrets: PiWorkerSecretBag;
1384
+ /** @public */
831
1385
  report(event: Readonly<Record<string, ProviderJsonValue>>): void;
832
1386
  }
1387
+ /** @public */
833
1388
  type PiWorkerContribution = (pi: {
1389
+ /** @public */
834
1390
  registerProvider(name: string, config: object): void;
835
1391
  }, ctx: PiWorkerContributionContext) => void | Promise<void>;
1392
+ /** @public */
836
1393
  declare function definePiWorker(contribution: PiWorkerContribution): PiWorkerContribution;
837
1394
  /**
838
1395
  * Report each distinct configured model as available or unavailable based solely
839
1396
  * on credential status. Providers that do not perform runtime model probing can
840
1397
  * delegate their `models()` callback to this helper.
841
1398
  */
1399
+ /** @public */
842
1400
  declare function credentialBasedModelStatuses(configuredModels: readonly ConfiguredProviderModel[], credentialStatus: ProviderCredentialStatus, unavailableReason: string): readonly ProviderModelStatus[];
843
1401
 
1402
+ /** @public */
844
1403
  interface Codec<T> {
1404
+ /** @public */
845
1405
  parse(value: unknown): T;
1406
+ /** @public */
846
1407
  serialize(value: T): unknown;
847
1408
  }
1409
+ /** @internal */
848
1410
  interface LauncherModelProfileSummary {
1411
+ /** @internal */
849
1412
  readonly id: string;
1413
+ /** @internal */
850
1414
  readonly provider: string;
1415
+ /** @internal */
851
1416
  readonly modelId: string;
1417
+ /** @internal */
852
1418
  readonly thinkingLevel: string;
853
1419
  }
1420
+ /** @public */
854
1421
  interface LauncherContext {
1422
+ /** @internal */
855
1423
  readonly process?: ProcessInstance;
1424
+ /** @internal */
856
1425
  readonly projects?: readonly ProcessProject[];
857
1426
  /**
858
1427
  * Effective model profiles available to this launch path.
859
1428
  * The server may filter this list per process (for example via process allowlists)
860
1429
  * before invoking UI launcher or process watcher code.
861
1430
  */
1431
+ /** @internal */
862
1432
  readonly modelProfiles?: readonly LauncherModelProfileSummary[];
863
1433
  }
1434
+ /** @public */
864
1435
  type LauncherVisibility = "ui";
1436
+ /** @public */
865
1437
  interface ProcessLaunchProjectConfig {
1438
+ /** @public */
866
1439
  key: string;
1440
+ /** @public */
867
1441
  repoLocator: string;
1442
+ /** @public */
868
1443
  baseBranch: string;
1444
+ /** @public */
869
1445
  workBranch?: string | null;
1446
+ /** @public */
870
1447
  externalId?: string | null;
1448
+ /** @public */
871
1449
  externalUrl?: string | null;
1450
+ /** @public */
872
1451
  metadata?: Record<string, unknown> | null;
873
1452
  }
1453
+ /** @public */
874
1454
  interface ProcessTitleSourceField {
875
- /** Short label shown to the title-generation model, e.g. "Prompt" or "Summary". */
1455
+ /** Short label shown to the title-generation model, e.g. "Prompt" or "Summary". @public */
876
1456
  label: string;
877
- /** Launcher-selected descriptive text to summarize into a short operator-facing title. */
1457
+ /** Launcher-selected descriptive text to summarize into a short operator-facing title. @public */
878
1458
  value: string;
879
1459
  }
1460
+ /** @public */
880
1461
  interface ProcessLaunchConfig<TParams = unknown> {
1462
+ /** @public */
881
1463
  processId: string;
1464
+ /** @public */
882
1465
  params: TParams;
1466
+ /** @public */
883
1467
  startTurnId?: TurnId | null;
884
- /** Explicit operator-facing title. UI launches may override this with the built-in title input before persistence. */
1468
+ /** Explicit operator-facing title. UI launches may override this with the built-in title input before persistence. @public */
885
1469
  title?: string | null;
886
- /** Explicit launcher-selected fields for optional server-side title generation when title is blank. */
1470
+ /** Explicit launcher-selected fields for optional server-side title generation when title is blank. @public */
887
1471
  titleSourceFields?: readonly ProcessTitleSourceField[];
1472
+ /** @public */
888
1473
  externalId?: string | null;
1474
+ /** @public */
889
1475
  externalUrl?: string | null;
1476
+ /** @public */
890
1477
  metadata?: Record<string, unknown> | null;
1478
+ /** @internal */
891
1479
  defaultModelProfileId?: string | null;
1480
+ /** @internal */
892
1481
  turnConfigs?: Record<string, {
1482
+ /** @internal */
893
1483
  modelProfileId?: string | null;
894
1484
  }>;
895
- /** Skill ids resolved to active immutable revisions before process creation. */
1485
+ /** Skill ids resolved to active immutable revisions before process creation. @internal */
896
1486
  skillIds?: readonly string[];
1487
+ /** @public */
897
1488
  projects?: readonly ProcessLaunchProjectConfig[];
898
1489
  }
1490
+ /** @public */
899
1491
  type UiLauncherConfigResolution<TParams = unknown> = {
1492
+ /** @public */
900
1493
  ok: true;
1494
+ /** @public */
901
1495
  launchConfig: ProcessLaunchConfig<TParams>;
902
1496
  } | {
1497
+ /** @public */
903
1498
  ok: false;
1499
+ /** @public */
904
1500
  errors: readonly LauncherValidationError[];
905
1501
  };
1502
+ /** @public */
906
1503
  interface LaunchPreparationContext<TParams = unknown> {
1504
+ /** @public */
907
1505
  readonly signal: AbortSignal;
1506
+ /** @public */
908
1507
  readonly launchConfig: ProcessLaunchConfig<TParams>;
1508
+ /** @public */
909
1509
  readonly logger: {
1510
+ /** @internal */
910
1511
  info(message: string): void;
1512
+ /** @public */
911
1513
  warn(message: string): void;
912
1514
  };
913
1515
  }
1516
+ /** @public */
914
1517
  interface LaunchPreparationCheck<TParams = unknown> {
1518
+ /** @public */
915
1519
  readonly id: string;
1520
+ /** @public */
916
1521
  readonly label: string;
1522
+ /** @public */
917
1523
  run(ctx: LaunchPreparationContext<TParams>): Promise<void>;
918
1524
  }
919
- /** A launcher check may throw this error to expose bounded operator-safe remediation. */
1525
+ /** A launcher check may throw this error to expose bounded operator-safe remediation. @public */
920
1526
  declare class SafeLaunchPreparationError extends Error {
1527
+ /** @internal */
921
1528
  readonly safeSummary: string;
922
- constructor(message: string, safeSummary: string);
1529
+ /** @public */
1530
+ constructor(message: string,
1531
+ /** @internal */
1532
+ safeSummary: string);
923
1533
  }
1534
+ /** @public */
924
1535
  interface UiLauncherDefinition<TParams = unknown> {
1536
+ /** @public */
925
1537
  card: LauncherCardMetadata;
1538
+ /** @public */
926
1539
  launchConfigSchema: LauncherSchemaDefinition;
1540
+ /** @public */
927
1541
  resolveDefaults?(ctx: LauncherContext): Record<string, unknown> | Promise<Record<string, unknown>>;
1542
+ /** @public */
928
1543
  resolveOptions?(input: Record<string, unknown>, ctx: LauncherContext): Record<string, readonly LauncherFieldOptionDefinition[]> | Promise<Record<string, readonly LauncherFieldOptionDefinition[]>>;
929
1544
  /**
930
1545
  * Convert persisted operator input into a new-launch draft. The default preserves
931
1546
  * the complete input. Launchers override this only for values that must be rebuilt.
932
1547
  */
1548
+ /** @public */
933
1549
  resolveRelaunchInput?(previousInput: Record<string, unknown>, ctx: LauncherContext): Record<string, unknown> | Promise<Record<string, unknown>>;
1550
+ /** @public */
934
1551
  preparationChecks?(input: Record<string, unknown>, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
1552
+ /** @public */
935
1553
  resolveLaunchConfig(input: Record<string, unknown>, ctx: LauncherContext): UiLauncherConfigResolution<TParams> | Promise<UiLauncherConfigResolution<TParams>>;
936
1554
  }
937
- type ProcessWatcherPresentationField = WatcherPresentationField;
1555
+ /** @public */
938
1556
  interface ProcessWatcherPresentation {
1557
+ /** @public */
939
1558
  readonly targetSummary: string;
1559
+ /** @public */
940
1560
  readonly details?: readonly WatcherPresentationField[];
941
1561
  }
1562
+ /** @public */
942
1563
  interface ParsedProcessWatcherConfig<TConfig = unknown> {
1564
+ /** @public */
943
1565
  readonly config: TConfig;
1566
+ /** @public */
944
1567
  readonly enabled: boolean;
1568
+ /** @public */
945
1569
  readonly launchModelConfig?: LaunchModelConfigInput;
946
1570
  }
947
- /** A watcher source is defined and owned by the extension that implements it. */
1571
+ /** A watcher source is defined and owned by the extension that implements it. @public */
948
1572
  interface ProcessWatcherSource<TConfig = unknown, TEvent = unknown> {
1573
+ /** @public */
949
1574
  readonly id: string;
1575
+ /** @public */
950
1576
  readonly label: string;
951
- /** Type-only marker used to carry the provider event type across the source seam. */
1577
+ /** Type-only marker used to carry the provider event type across the source seam. @internal */
952
1578
  readonly eventType?: TEvent;
1579
+ /** @public */
953
1580
  parseConfig(raw: unknown): ParsedProcessWatcherConfig<TConfig>;
1581
+ /** @public */
954
1582
  presentConfig(config: TConfig): ProcessWatcherPresentation;
955
1583
  }
1584
+ /** @public */
956
1585
  interface ProcessWatcherDefinition<TParams = unknown, TEvent = unknown, TConfig = unknown> {
1586
+ /** @public */
957
1587
  id: string;
1588
+ /** @public */
958
1589
  label: string;
1590
+ /** @public */
959
1591
  description: string;
1592
+ /** @public */
960
1593
  source: ProcessWatcherSource<TConfig, TEvent>;
1594
+ /** @internal */
961
1595
  matches?(event: TEvent, ctx: LauncherContext): boolean | Promise<boolean>;
1596
+ /** @public */
962
1597
  preparationChecks?(event: TEvent, launchConfig: ProcessLaunchConfig<TParams>): readonly LaunchPreparationCheck<TParams>[];
1598
+ /** @public */
963
1599
  resolveLaunchConfig(event: TEvent, ctx: LauncherContext): ProcessLaunchConfig<TParams> | Promise<ProcessLaunchConfig<TParams>>;
964
1600
  }
1601
+ /** @public */
965
1602
  interface ProcessLauncherDefinition<TParams = unknown> {
1603
+ /** @public */
966
1604
  id: string;
1605
+ /** @public */
967
1606
  label: string;
1607
+ /** @public */
968
1608
  description: string;
1609
+ /** @public */
969
1610
  visibility: LauncherVisibility;
1611
+ /** @public */
970
1612
  ui: UiLauncherDefinition<TParams>;
971
1613
  }
1614
+ /** @internal */
972
1615
  interface ProcessLaunchPlanProcessInput extends ProcessCustomizableFields {
1616
+ /** @internal */
973
1617
  processId: string;
1618
+ /** @internal */
974
1619
  selectedTurnId: string | null;
1620
+ /** @internal */
975
1621
  lifecycleStatus: ProcessLifecycleStatus;
1622
+ /** @internal */
976
1623
  paramsJson: string | null;
1624
+ /** @internal */
977
1625
  stateJson: string | null;
978
1626
  }
1627
+ /** @internal */
979
1628
  interface ProcessLaunchPlan {
1629
+ /** @internal */
980
1630
  launcherId: string;
1631
+ /** @internal */
981
1632
  processId: string;
1633
+ /** @internal */
982
1634
  processInput: ProcessLaunchPlanProcessInput;
983
- /** Optional server-owned idempotency key for cross-process handoffs. */
1635
+ /** Optional server-owned idempotency key for cross-process handoffs. @internal */
984
1636
  handoffDedupKey?: string | null;
985
- /** Carry-forward launcher-selected fields for optional server-side title generation. */
1637
+ /** Carry-forward launcher-selected fields for optional server-side title generation. @internal */
986
1638
  titleSourceFields?: readonly ProcessTitleSourceField[];
1639
+ /** @internal */
987
1640
  projectInputs: readonly ProcessLaunchProjectConfig[];
1641
+ /** @internal */
988
1642
  startTurnId: TurnId | null;
1643
+ /** @internal */
989
1644
  skillIds?: readonly string[];
990
1645
  }
1646
+ /** @internal */
991
1647
  interface ResolvedProcessLauncher<TParams = unknown> {
1648
+ /** @internal */
992
1649
  launcherId: string;
1650
+ /** @internal */
993
1651
  processId: string;
1652
+ /** @internal */
994
1653
  displayName: string;
1654
+ /** @internal */
995
1655
  launchConfig: ProcessLaunchConfig<TParams>;
1656
+ /** @internal */
996
1657
  launchPlan: ProcessLaunchPlan;
997
1658
  }
1659
+ /** @internal */
998
1660
  type UiLauncherResolutionResult<TParams = unknown> = {
1661
+ /** @internal */
999
1662
  ok: true;
1663
+ /** @internal */
1000
1664
  launcher: ResolvedProcessLauncher<TParams>;
1001
1665
  } | {
1666
+ /** @internal */
1002
1667
  ok: false;
1668
+ /** @internal */
1003
1669
  errors: readonly LauncherValidationError[];
1004
1670
  };
1671
+ /** @internal */
1005
1672
  interface UiLauncherSummary extends UiLauncherSummaryBase {
1006
1673
  }
1674
+ /** @internal */
1007
1675
  interface ProcessLauncherService {
1676
+ /** @internal */
1008
1677
  listUiLaunchers(): readonly UiLauncherSummary[];
1678
+ /** @internal */
1009
1679
  resolveUiDefaults(launcherId: string, ctx?: LauncherContext): Promise<Record<string, unknown>>;
1680
+ /** @internal */
1010
1681
  resolveUiOptions(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, readonly LauncherFieldOptionDefinition[]>>;
1682
+ /** @internal */
1011
1683
  resolveUiRelaunchInput(launcherId: string, previousInput: Record<string, unknown>, ctx?: LauncherContext): Promise<Record<string, unknown>>;
1684
+ /** @internal */
1012
1685
  resolvePreparationChecks?(launcherId: string, input: Record<string, unknown>, launchConfig: ProcessLaunchConfig): readonly LaunchPreparationCheck[];
1686
+ /** @internal */
1013
1687
  resolveUiLauncher(launcherId: string, input: Record<string, unknown>, ctx?: LauncherContext): Promise<UiLauncherResolutionResult>;
1014
1688
  }
1015
- /** Resolve a UI launcher summary by id, returning `null` when it is unknown. */
1689
+ /** Resolve a UI launcher summary by id, returning `null` when it is unknown. @internal */
1016
1690
  declare function findUiLauncherById(launcherService: Pick<ProcessLauncherService, "listUiLaunchers">, launcherId: string): UiLauncherSummary | null;
1691
+ /** @public */
1017
1692
  interface ProcessTurnOutcomeEvent {
1693
+ /** @internal */
1018
1694
  turnRecordId: string;
1695
+ /** @internal */
1019
1696
  turnId: string;
1697
+ /** @internal */
1020
1698
  outcome: string;
1699
+ /** @public */
1021
1700
  params: Record<string, unknown>;
1701
+ /** @internal */
1022
1702
  turnResultMarkdown?: string | null;
1023
1703
  }
1704
+ /** @internal */
1024
1705
  type ProcessCleanupReason = "abort";
1706
+ /** @internal */
1025
1707
  interface ProcessCleanupResult<TState = unknown> extends ProcessLifecycleEffects {
1708
+ /** @internal */
1026
1709
  state?: TState;
1027
1710
  }
1711
+ /** @internal */
1028
1712
  interface ProcessCleanupContext<TParams = unknown, TState = unknown> extends ProcessSnapshotContext<TParams, TState> {
1713
+ /** @internal */
1029
1714
  readonly reason: ProcessCleanupReason;
1030
1715
  }
1716
+ /** @internal */
1031
1717
  type ProcessCleanupHandler<TParams = unknown, TState = unknown> = (ctx: ProcessCleanupContext<TParams, TState>) => undefined | ProcessCleanupResult<TState> | Promise<ProcessCleanupResult<TState> | undefined>;
1718
+ /** @internal */
1032
1719
  interface LeafOutcomeCaptureContext<TParams = unknown, TState = unknown> extends ProcessSnapshotContext<TParams, TState> {
1720
+ /** @internal */
1033
1721
  readonly leaf: {
1722
+ /** @internal */
1034
1723
  entryId: string;
1724
+ /** @internal */
1035
1725
  turnRecordId: string | null;
1036
1726
  };
1727
+ /** @internal */
1037
1728
  readonly turnRecord: ProcessTurnRecord | null;
1729
+ /** @internal */
1038
1730
  readTreeEntry(entryId: string): PiTreeEntry | null;
1731
+ /** @internal */
1039
1732
  readLeafEntry(): PiTreeEntry | null;
1733
+ /** @internal */
1040
1734
  readTurnRecord(turnRecordId: string): ProcessTurnRecord | null;
1041
1735
  }
1736
+ /** @internal */
1042
1737
  interface LeafOutcomeCaptureResult {
1738
+ /** @internal */
1043
1739
  rendererId: string;
1740
+ /** @internal */
1044
1741
  schemaVersion?: number;
1742
+ /** @internal */
1045
1743
  props: Record<string, unknown>;
1744
+ /** @internal */
1046
1745
  fallbackMarkdown?: string | null;
1047
1746
  }
1747
+ /** @internal */
1048
1748
  interface ProcessLeafOutcomeDefinition<TParams = unknown, TState = unknown> {
1749
+ /** @internal */
1049
1750
  rendererId: string;
1751
+ /** @internal */
1050
1752
  capture(ctx: LeafOutcomeCaptureContext<TParams, TState>): Promise<LeafOutcomeCaptureResult | null> | LeafOutcomeCaptureResult | null;
1051
1753
  }
1754
+ /** @internal */
1052
1755
  interface ProcessActionDefinition<TParams = unknown, TState = unknown> {
1756
+ /** @internal */
1053
1757
  id: string;
1758
+ /** @internal */
1054
1759
  label: string;
1760
+ /** @internal */
1055
1761
  form?: ActionFormDefinition;
1762
+ /** @internal */
1056
1763
  preview?: ProcessActionPreviewDefinition;
1764
+ /** @internal */
1057
1765
  scheduling?: ProcessActionSchedulingDefinition;
1058
1766
  /**
1059
1767
  * Explicitly marks an action as an immediate-only side-effect command. Such
1060
1768
  * actions must declare execute(...), cannot participate in pure preview or
1061
1769
  * scheduling flows, and are run only by immediate action execution.
1062
1770
  */
1771
+ /** @internal */
1063
1772
  executionMode?: "side_effect";
1064
1773
  /**
1065
1774
  * Optional pure planner used for side-effect-free previews, scheduling validation,
@@ -1067,66 +1776,99 @@ interface ProcessActionDefinition<TParams = unknown, TState = unknown> {
1067
1776
  * transition/input/event plan from this hook without committing side effects
1068
1777
  * while the hook runs.
1069
1778
  */
1779
+ /** @internal */
1070
1780
  plan?(input: Record<string, unknown>, ctx: ServerProcessContext<TParams, TState>): Promise<void>;
1071
1781
  /**
1072
1782
  * Imperative hook for actions with executionMode: "side_effect". Use only for
1073
1783
  * immediate side effects that cannot be represented as a pure plan(...).
1074
1784
  */
1785
+ /** @internal */
1075
1786
  execute?(input: Record<string, unknown>, ctx: ServerProcessContext<TParams, TState>): Promise<void>;
1076
1787
  }
1788
+ /** @internal */
1077
1789
  type ServerTransitionRuntime = "reconcile" | "restart_worker";
1790
+ /** @internal */
1078
1791
  interface ServerTransitionEffect {
1079
1792
  /**
1080
1793
  * Declares how the server runtime should handle the worker context after the
1081
1794
  * durable transition is committed.
1082
1795
  */
1796
+ /** @internal */
1083
1797
  runtime?: ServerTransitionRuntime;
1084
1798
  }
1799
+ /** @internal */
1085
1800
  interface ServerTransitionRequest<TState = unknown> {
1801
+ /** @internal */
1086
1802
  lifecycleStatus?: ProcessLifecycleStatus;
1803
+ /** @internal */
1087
1804
  turnId?: TurnId | null;
1805
+ /** @internal */
1088
1806
  state?: TState;
1089
- /** State machine trigger for the selected-turn graph. */
1807
+ /** State machine trigger for the selected-turn graph. @internal */
1090
1808
  trigger?: string;
1809
+ /** @internal */
1091
1810
  effect?: ServerTransitionEffect;
1092
1811
  }
1812
+ /** @public */
1093
1813
  interface ProcessSnapshotContext<TParams = unknown, TState = unknown> {
1814
+ /** @public */
1094
1815
  readonly process: ProcessInstance;
1816
+ /** @public */
1095
1817
  readonly projects: readonly ProcessProject[];
1818
+ /** @public */
1096
1819
  readonly params: TParams;
1820
+ /** @public */
1097
1821
  readonly state: TState;
1098
1822
  }
1823
+ /** @public */
1099
1824
  type ExternalSourceInputMode = "none" | "input" | "instruction";
1825
+ /** @public */
1100
1826
  interface ExternalSourceResolveContext<TParams = unknown, TState = unknown> extends ProcessSnapshotContext<TParams, TState> {
1101
1827
  }
1828
+ /** @public */
1102
1829
  interface ExternalSourceEffectContext<TParams = unknown, TState = unknown, TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>> extends ProcessSnapshotContext<TParams, TState> {
1830
+ /** @public */
1103
1831
  readonly event: TEvent;
1832
+ /** @internal */
1104
1833
  readonly input: TInput;
1105
1834
  }
1835
+ /** @public */
1106
1836
  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;
1837
+ /** @public */
1107
1838
  interface ExternalEventDescription {
1839
+ /** @public */
1108
1840
  summary: string;
1841
+ /** @internal */
1109
1842
  markdown?: string;
1843
+ /** @public */
1110
1844
  links?: _leitwerk_dev_domain.TurnProgressLink[];
1111
1845
  }
1846
+ /** @public */
1112
1847
  interface ExternalActionSource<TParams = unknown, TState = unknown, _TEvent = unknown, _TInput extends Record<string, unknown> = Record<string, unknown>> {
1848
+ /** @public */
1113
1849
  kind: string;
1850
+ /** @public */
1114
1851
  label?: string;
1852
+ /** @public */
1115
1853
  description?: string;
1116
- /** Pure description captured when the event is consumed. */
1854
+ /** Pure description captured when the event is consumed. @public */
1117
1855
  describeEvent?(event: _TEvent): ExternalEventDescription;
1118
1856
  /**
1119
1857
  * Extension-owned opaque config. Core may persist, hash, and display it, but must not
1120
1858
  * interpret provider-specific fields.
1121
1859
  */
1860
+ /** @public */
1122
1861
  config: unknown;
1123
- /** Source-provided input behavior. Provider input is only published when the external action declares publishInput. */
1862
+ /** Source-provided input behavior. Provider input is only published when the external action declares publishInput. @public */
1124
1863
  inputMode?: ExternalSourceInputMode;
1125
- /** Optional extension-owned resolver for process-instance-specific matching. */
1864
+ /** Optional extension-owned resolver for process-instance-specific matching. @public */
1126
1865
  resolve?(ctx: ExternalSourceResolveContext<TParams, TState>): unknown;
1127
1866
  }
1867
+ /** @public */
1128
1868
  interface ServerProcessContext<TParams = unknown, TState = unknown> extends ProcessSnapshotContext<TParams, TState> {
1869
+ /** @internal */
1129
1870
  transition(next: ServerTransitionRequest<TState>): Promise<void>;
1871
+ /** @internal */
1130
1872
  emitEvent<K extends keyof ServerExtensionEventMap & string>(eventType: K, data: ServerExtensionEventPayloadInputMap[K]): void;
1131
1873
  /**
1132
1874
  * Resolves non-empty turn-result markdown for the current semantic ref.
@@ -1134,6 +1876,7 @@ interface ServerProcessContext<TParams = unknown, TState = unknown> extends Proc
1134
1876
  * carry operator-facing markdown. Throws when persisted semantic-ref state is
1135
1877
  * malformed.
1136
1878
  */
1879
+ /** @internal */
1137
1880
  readSemanticTurnResultMarkdown(ref: ProcessSemanticEntryRefKey): string | null;
1138
1881
  /**
1139
1882
  * Resolves non-empty turn-result markdown for a process-defined published product.
@@ -1141,6 +1884,7 @@ interface ServerProcessContext<TParams = unknown, TState = unknown> extends Proc
1141
1884
  * not carry operator-facing markdown. Throws when persisted product-ref state is
1142
1885
  * malformed.
1143
1886
  */
1887
+ /** @internal */
1144
1888
  readProductTurnResultMarkdown(productName: string): string | null;
1145
1889
  /**
1146
1890
  * Queue durable process input for worker delivery.
@@ -1151,10 +1895,15 @@ interface ServerProcessContext<TParams = unknown, TState = unknown> extends Proc
1151
1895
  * input is the only new instruction: the worker does not replay the original
1152
1896
  * kickoff prompt.
1153
1897
  */
1898
+ /** @public */
1154
1899
  queueInput(input: {
1900
+ /** @public */
1155
1901
  source: InputSource;
1902
+ /** @public */
1156
1903
  kind: InputKind;
1904
+ /** @public */
1157
1905
  bodyMarkdown: string;
1906
+ /** @public */
1158
1907
  target?: ProcessInputTarget;
1159
1908
  }): void;
1160
1909
  /**
@@ -1162,104 +1911,160 @@ interface ServerProcessContext<TParams = unknown, TState = unknown> extends Proc
1162
1911
  * helpers. Raw process definitions should prefer intent helpers instead of
1163
1912
  * constructing these effects directly.
1164
1913
  */
1914
+ /** @internal */
1165
1915
  applyLifecycleEffects?(effects: ProcessLifecycleEffects): void;
1166
1916
  }
1917
+ /** @public */
1167
1918
  interface WorkerProcessContext<TParams = unknown, TState = unknown> extends ProcessSnapshotContext<TParams, TState> {
1919
+ /** @internal */
1168
1920
  readonly turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
1921
+ /** @internal */
1169
1922
  readonly turnResultMarkdownByProduct?: Readonly<Record<string, string>>;
1170
- /** Absolute workspace root for the current process instance, when available. */
1923
+ /** Absolute workspace root for the current process instance, when available. @internal */
1171
1924
  readonly workspaceRoot?: string;
1172
- /** Durable output produced by this LLM turn's preparation phase, when declared. */
1925
+ /** Durable output produced by this LLM turn's preparation phase, when declared. @internal */
1173
1926
  readonly prepared?: unknown;
1174
- /** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. */
1927
+ /** Invoke a server-owned integration tool authorized for this automatic turn or LLM preparation. @internal */
1175
1928
  callIntegrationTool?(name: string, args: Record<string, unknown>): Promise<unknown>;
1176
- /** Replace the durable operator-facing progress report for this turn attempt. */
1929
+ /** Replace the durable operator-facing progress report for this turn attempt. @internal */
1177
1930
  reportProgress?(report: TurnProgressReport): void;
1178
1931
  }
1932
+ /** @public */
1179
1933
  interface WorkerCompleteInput<TOutcome extends string = string> {
1934
+ /** @internal */
1180
1935
  outcome: TOutcome;
1936
+ /** @internal */
1181
1937
  params?: Record<string, unknown>;
1938
+ /** @internal */
1182
1939
  markdown?: string | null;
1940
+ /** @internal */
1183
1941
  resultSummary?: string;
1184
1942
  }
1943
+ /** @internal */
1185
1944
  interface WorkerRunHandle<TParams = unknown, TState = unknown> {
1945
+ /** @internal */
1186
1946
  readonly ctx: WorkerProcessContext<TParams, TState>;
1947
+ /** @internal */
1187
1948
  turn<TOutcome extends string>(def: LlmTurnDefinition<TOutcome, TParams, TState>, options?: TurnOptions): Promise<{
1949
+ /** @internal */
1188
1950
  outcome: TOutcome;
1951
+ /** @internal */
1189
1952
  params: Record<string, unknown>;
1190
1953
  }>;
1954
+ /** @internal */
1191
1955
  complete<TOutcome extends string>(input: WorkerCompleteInput<TOutcome>): Promise<void>;
1956
+ /** @internal */
1192
1957
  park(reason?: string): void;
1193
1958
  }
1959
+ /** @internal */
1194
1960
  type WorkerTurnHandler<TParams = unknown, TState = unknown> = (run: WorkerRunHandle<TParams, TState>) => Promise<void>;
1961
+ /** @internal */
1195
1962
  interface ServerProcessAPI<TParams = unknown, TState = unknown> {
1963
+ /** @internal */
1196
1964
  action(def: ProcessActionDefinition<TParams, TState>): void;
1965
+ /** @internal */
1197
1966
  onTurnOutcome(turnId: string, handler: (event: ProcessTurnOutcomeEvent, ctx: ServerProcessContext<TParams, TState>) => void | Promise<void>): void;
1967
+ /** @internal */
1198
1968
  onCleanup(handler: ProcessCleanupHandler<TParams, TState>): void;
1199
1969
  }
1970
+ /** @internal */
1200
1971
  interface WorkerProcessAPI<TParams = unknown, TState = unknown> {
1972
+ /** @internal */
1201
1973
  start(turnId: TurnId): void;
1974
+ /** @internal */
1202
1975
  turn(turnId: TurnId, handler: WorkerTurnHandler<TParams, TState>): void;
1203
1976
  }
1977
+ /** @public */
1204
1978
  interface UiProcessAPI<TParams = unknown, TState = unknown> {
1979
+ /** @internal */
1205
1980
  leafOutcome(def: ProcessLeafOutcomeDefinition<TParams, TState>): void;
1206
1981
  }
1982
+ /** @public */
1207
1983
  interface ProcessLauncherAPI<TParams = unknown> {
1984
+ /** @public */
1208
1985
  launcher(def: ProcessLauncherDefinition<TParams>): void;
1209
1986
  }
1987
+ /** @public */
1210
1988
  interface ProcessWatcherAPI<TParams = unknown> {
1989
+ /** @public */
1211
1990
  watcher<TEvent = unknown, TConfig = unknown>(def: ProcessWatcherDefinition<TParams, TEvent, TConfig>): void;
1212
1991
  }
1992
+ /** @public */
1213
1993
  interface ProcessTurnBinding<TTurn = TurnDefinition> {
1994
+ /** @public */
1214
1995
  definition: TTurn;
1215
1996
  }
1997
+ /** @public */
1216
1998
  type RepositoryCredentialKind = "git_ssh" | "git_https";
1217
- /** Non-secret, code-defined repository authentication request. */
1999
+ /** Non-secret, code-defined repository authentication request. @public */
1218
2000
  interface RepositoryCredentialRequirement {
2001
+ /** @public */
1219
2002
  readonly projectKey: string;
2003
+ /** @public */
1220
2004
  readonly kind: RepositoryCredentialKind;
2005
+ /** @public */
1221
2006
  readonly credentialRef: string;
1222
2007
  }
1223
- /** Project fields available while deriving repository credential requirements. */
2008
+ /** Project fields available while deriving repository credential requirements. @public */
1224
2009
  interface RepositoryCredentialProject {
2010
+ /** @internal */
1225
2011
  readonly key: string;
2012
+ /** @internal */
1226
2013
  readonly repoLocator: string;
2014
+ /** @internal */
1227
2015
  readonly baseBranch: string;
2016
+ /** @internal */
1228
2017
  readonly workBranch: string | null;
1229
2018
  }
1230
- /** Secret material is intentionally restricted to server registration and worker.start. */
2019
+ /** Secret material is intentionally restricted to server registration and worker.start. @internal */
1231
2020
  interface GitSshCredentialMaterial {
2021
+ /** @internal */
1232
2022
  readonly privateKey: string;
2023
+ /** @internal */
1233
2024
  readonly knownHosts: string;
1234
2025
  }
2026
+ /** @internal */
1235
2027
  interface GitHttpsCredentialMaterial {
1236
- /** HTTPS origin authorized by the credential-owning extension. */
2028
+ /** HTTPS origin authorized by the credential-owning extension. @internal */
1237
2029
  readonly origin: string;
2030
+ /** @internal */
1238
2031
  readonly username: string;
2032
+ /** @internal */
1239
2033
  readonly password: string;
1240
2034
  }
2035
+ /** @internal */
1241
2036
  type RepositoryCredentialProvider = {
2037
+ /** @internal */
1242
2038
  readonly kind: "git_ssh";
2039
+ /** @internal */
1243
2040
  resolve(credentialRef: string): GitSshCredentialMaterial | null;
1244
2041
  } | {
2042
+ /** @internal */
1245
2043
  readonly kind: "git_https";
2044
+ /** @internal */
1246
2045
  resolve(credentialRef: string): GitHttpsCredentialMaterial | null;
1247
2046
  };
2047
+ /** @internal */
1248
2048
  interface RepositoryCredentialRegistrar {
2049
+ /** @internal */
1249
2050
  register(provider: RepositoryCredentialProvider): void;
1250
2051
  }
2052
+ /** @public */
1251
2053
  interface ProcessRuntimeCapabilities {
1252
- /** Install repository-declared development tools with mise before accepting work. */
2054
+ /** Install repository-declared development tools with mise before accepting work. @internal */
1253
2055
  readonly developmentTools?: boolean;
1254
- /** Require a Docker CLI connected to a private or explicitly acknowledged daemon. */
2056
+ /** Require a Docker CLI connected to a private or explicitly acknowledged daemon. @public */
1255
2057
  readonly docker?: boolean;
1256
2058
  }
2059
+ /** @public */
1257
2060
  interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
2061
+ /** @public */
1258
2062
  id: string;
2063
+ /** @public */
1259
2064
  displayName: string;
1260
- /** Primary entry used when a launch does not select a start turn explicitly. */
2065
+ /** Primary entry used when a launch does not select a start turn explicitly. @public */
1261
2066
  entryTurnId: TurnId;
1262
- /** Additional entry turns that launchers may select explicitly. */
2067
+ /** Additional entry turns that launchers may select explicitly. @public */
1263
2068
  alternateEntryTurnIds?: readonly TurnId[];
1264
2069
  /**
1265
2070
  * Optional author-declared happy path: the ordered spine of turns a successful
@@ -1267,12 +2072,17 @@ interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
1267
2072
  * other turn off it as a branch. When omitted, consumers fall back to a derived
1268
2073
  * best-effort spine.
1269
2074
  */
2075
+ /** @public */
1270
2076
  happyPath?: readonly TurnId[];
2077
+ /** @public */
1271
2078
  turns: ReadonlyMap<TurnId, ProcessTurnBinding<TurnDefinition<TParams, TState>>>;
2079
+ /** @public */
1272
2080
  paramsCodec: Codec<TParams>;
2081
+ /** @public */
1273
2082
  stateCodec: Codec<TState>;
2083
+ /** @public */
1274
2084
  initialState(params: TParams): TState;
1275
- /** Process-owned runtime capabilities. All capabilities default to disabled. */
2085
+ /** Process-owned runtime capabilities. All capabilities default to disabled. @public */
1276
2086
  runtime?: ProcessRuntimeCapabilities;
1277
2087
  /**
1278
2088
  * Server-only Kubernetes process-volume size, derived from extension configuration.
@@ -1280,131 +2090,213 @@ interface ExtensionProcessDefinition<TParams = unknown, TState = unknown> {
1280
2090
  * Called before provisioning on worker starts. Must be synchronous and side-effect free;
1281
2091
  * repeated calls never resize or replace an existing volume.
1282
2092
  */
2093
+ /** @internal */
1283
2094
  resolveStorageSize?(input: {
2095
+ /** @internal */
1284
2096
  params: TParams;
2097
+ /** @internal */
1285
2098
  projects: readonly ProcessProject[];
1286
2099
  }): string | undefined;
1287
- /** Runtime-only requirements; references are non-secret and remain in opaque params JSON. */
2100
+ /** Runtime-only requirements; references are non-secret and remain in opaque params JSON. @public */
1288
2101
  repositoryCredentials?(input: {
2102
+ /** @public */
1289
2103
  params: TParams;
2104
+ /** @public */
1290
2105
  projects: readonly RepositoryCredentialProject[];
1291
2106
  }): readonly RepositoryCredentialRequirement[];
2107
+ /** @public */
1292
2108
  piConfig?: ProcessPiConfig;
2109
+ /** @internal */
1293
2110
  server?: (api: ServerProcessAPI<TParams, TState>) => void;
2111
+ /** @internal */
1294
2112
  worker?: (api: WorkerProcessAPI<TParams, TState>) => void;
2113
+ /** @public */
1295
2114
  ui?: (api: UiProcessAPI<TParams, TState>) => void;
2115
+ /** @public */
1296
2116
  launchers?: (api: ProcessLauncherAPI<TParams>) => void;
2117
+ /** @public */
1297
2118
  watchers?: (api: ProcessWatcherAPI<TParams>) => void;
1298
2119
  }
2120
+ /** @public */
1299
2121
  interface CatalogExtensionAPI {
2122
+ /** @internal */
1300
2123
  readonly events: EventBus;
2124
+ /** @public */
1301
2125
  registerProcess<TParams = unknown, TState = unknown>(def: ExtensionProcessDefinition<TParams, TState>): void;
2126
+ /** @internal */
1302
2127
  registerToolRenderer(def: ToolCallRendererDefinition): void;
2128
+ /** @internal */
1303
2129
  provide<T>(token: CapabilityToken<T>, value: T): void;
2130
+ /** @internal */
1304
2131
  get<T>(token: CapabilityToken<T>): T | T[] | undefined;
2132
+ /** @internal */
1305
2133
  require<T>(token: CapabilityToken<T>): T | T[];
1306
2134
  }
2135
+ /** @public */
1307
2136
  type ExtensionLifecycleHook = () => void | Promise<void>;
2137
+ /** @internal */
1308
2138
  interface ServerExtensionLogger {
2139
+ /** @internal */
1309
2140
  info?(payload: Record<string, unknown>, message?: string): void;
2141
+ /** @internal */
1310
2142
  warn?(payload: Record<string, unknown>, message?: string): void;
2143
+ /** @internal */
1311
2144
  error?(payload: Record<string, unknown>, message?: string): void;
1312
2145
  }
2146
+ /** @public */
1313
2147
  interface TicketCreationDestinationSummary {
1314
- /** Adapter-owned opaque identifier. Browsers must not construct or interpret it. */
2148
+ /** Adapter-owned opaque identifier. Browsers must not construct or interpret it. @public */
1315
2149
  readonly id: string;
2150
+ /** @public */
1316
2151
  readonly displayName: string;
2152
+ /** @public */
1317
2153
  readonly group?: string;
2154
+ /** @public */
1318
2155
  readonly description?: string;
1319
2156
  }
2157
+ /** @public */
1320
2158
  interface TicketCreationDestinationList {
2159
+ /** @public */
1321
2160
  readonly destinations: readonly TicketCreationDestinationSummary[];
2161
+ /** @public */
1322
2162
  readonly warnings?: readonly string[];
1323
2163
  }
2164
+ /** @public */
1324
2165
  interface TicketCreationDestinationSnapshot {
2166
+ /** @public */
1325
2167
  readonly summary: TicketCreationDestinationSummary;
1326
- /** Adapter-owned, JSON-serializable immutable destination state. */
2168
+ /** Adapter-owned, JSON-serializable immutable destination state. @public */
1327
2169
  readonly data: unknown;
1328
- /** Untrusted destination context included in the ticket agent prompt. */
2170
+ /** Untrusted destination context included in the ticket agent prompt. @public */
1329
2171
  readonly agentContext?: string;
1330
2172
  }
2173
+ /** @public */
1331
2174
  interface TicketCreationDestinationContext {
2175
+ /** @public */
1332
2176
  readonly actor: Actor;
1333
2177
  }
2178
+ /** @public */
1334
2179
  interface TicketCreationDestinationProvider {
2180
+ /** @public */
1335
2181
  list(ctx: TicketCreationDestinationContext): Promise<TicketCreationDestinationList>;
2182
+ /** @public */
1336
2183
  resolve(ctx: TicketCreationDestinationContext & {
2184
+ /** @public */
1337
2185
  destinationId: string;
1338
2186
  }): Promise<TicketCreationDestinationSnapshot>;
1339
- /** Rejects stale, renamed, transferred, or otherwise invalid snapshots. */
2187
+ /** Rejects stale, renamed, transferred, or otherwise invalid snapshots. @public */
1340
2188
  validate(snapshot: TicketCreationDestinationSnapshot): Promise<void>;
1341
2189
  }
2190
+ /** @public */
1342
2191
  interface TicketCreationCapability {
2192
+ /** @public */
1343
2193
  readonly kind: "ticket_creation";
2194
+ /** @public */
1344
2195
  readonly displayName: string;
1345
- /** Extension-owned process launched by the generic derived-ticket route. */
2196
+ /** Extension-owned process launched by the generic derived-ticket route. @public */
1346
2197
  readonly processId: string;
1347
- /** Entry turn selected when the derived process starts. */
2198
+ /** Entry turn selected when the derived process starts. @public */
1348
2199
  readonly startTurnId: TurnId;
1349
- /** RFC 6901 JSON Pointer into the tool arguments. */
2200
+ /** RFC 6901 JSON Pointer into the tool arguments. @public */
1350
2201
  readonly titlePath?: string;
1351
- /** RFC 6901 JSON Pointer into the tool arguments. */
2202
+ /** RFC 6901 JSON Pointer into the tool arguments. @public */
1352
2203
  readonly descriptionPath?: string;
2204
+ /** @public */
1353
2205
  readonly destinations?: TicketCreationDestinationProvider;
1354
2206
  }
2207
+ /** @internal */
1355
2208
  interface TicketCreationReceipt {
2209
+ /** @internal */
1356
2210
  readonly externalId: string;
2211
+ /** @internal */
1357
2212
  readonly url: string;
2213
+ /** @internal */
1358
2214
  readonly result?: unknown;
1359
2215
  }
2216
+ /** @public */
1360
2217
  interface IntegrationToolExecutionContext {
2218
+ /** Process-bound coordination; storage remains server-owned. */
2219
+ /** @public */
2220
+ readonly externalWrites: ExternalWrites;
2221
+ /** @public */
1361
2222
  readonly process: ProcessInstance;
2223
+ /** @public */
1362
2224
  readonly projects: readonly ProcessProject[];
2225
+ /** @public */
1363
2226
  readonly turn: ProcessTurnRecord;
2227
+ /** @public */
1364
2228
  readonly project: ProcessProject | null;
2229
+ /** @public */
1365
2230
  readonly ticketDestination?: TicketCreationDestinationSnapshot;
1366
- /** Stable for a single Pi tool call, including reconnect/replay. */
2231
+ /** Stable for a single Pi tool call, including reconnect/replay. @public */
1367
2232
  readonly idempotencyKey: string;
1368
- /** Aborted when the worker stops waiting for this tool call. */
2233
+ /** Aborted when the worker stops waiting for this tool call. @public */
1369
2234
  readonly signal: AbortSignal;
1370
2235
  }
2236
+ /** @public */
1371
2237
  interface IntegrationToolDefinition<TArgs = Record<string, unknown>> {
2238
+ /** @public */
1372
2239
  readonly name: string;
2240
+ /** @public */
1373
2241
  readonly description: string;
2242
+ /** @public */
1374
2243
  readonly parameters: Record<string, unknown>;
1375
- /** Sanitized discovery metadata; credentials and adapter configuration never belong here. */
2244
+ /** Sanitized discovery metadata; credentials and adapter configuration never belong here. @public */
1376
2245
  readonly capability?: TicketCreationCapability;
2246
+ /** @internal */
1377
2247
  parse?(value: unknown): TArgs;
2248
+ /** @public */
1378
2249
  execute(ctx: IntegrationToolExecutionContext, args: TArgs): Promise<unknown>;
1379
2250
  }
2251
+ /** @public */
1380
2252
  interface ServerExtensionAPI {
2253
+ /** @internal */
1381
2254
  readonly events: EventBus<ServerExtensionEventMap>;
2255
+ /** @internal */
1382
2256
  readonly logger?: ServerExtensionLogger;
2257
+ /** @public */
1383
2258
  provide<T>(token: CapabilityToken<T>, value: T): void;
2259
+ /** @public */
1384
2260
  get<T>(token: CapabilityToken<T>): T | T[] | undefined;
2261
+ /** @public */
1385
2262
  require<T>(token: CapabilityToken<T>): T | T[];
2263
+ /** @public */
1386
2264
  tool<TArgs>(definition: IntegrationToolDefinition<TArgs>): void;
2265
+ /** @internal */
1387
2266
  onStart(handler: ExtensionLifecycleHook): void;
2267
+ /** @public */
1388
2268
  onStop(handler: ExtensionLifecycleHook): void;
1389
2269
  }
2270
+ /** @internal */
1390
2271
  interface WorkerExtensionAPI {
2272
+ /** @internal */
1391
2273
  readonly events: EventBus;
2274
+ /** @internal */
1392
2275
  get<T>(token: CapabilityToken<T>): T | T[] | undefined;
2276
+ /** @internal */
1393
2277
  require<T>(token: CapabilityToken<T>): T | T[];
1394
2278
  }
1395
- interface LeitwerkExtensionManifest {
1396
- id: string;
1397
- version: string;
1398
- requires?: readonly string[];
1399
- optional?: readonly string[];
1400
- }
2279
+ /** @public */
1401
2280
  interface LeitwerkExtensionModule {
1402
- manifest: LeitwerkExtensionManifest;
1403
- /** Resolves every provider owned by this extension before setupServer. */
2281
+ /** @public */
2282
+ manifest: {
2283
+ /** @public */
2284
+ id: string;
2285
+ /** @public */
2286
+ version: string;
2287
+ /** @public */
2288
+ requires?: readonly string[];
2289
+ /** @internal */
2290
+ optional?: readonly string[];
2291
+ };
2292
+ /** Resolves every provider owned by this extension before setupServer. @public */
1404
2293
  modelProviders?: ModelProviderSet;
2294
+ /** @public */
1405
2295
  setupCatalog?(api: CatalogExtensionAPI): void | Promise<void>;
2296
+ /** @public */
1406
2297
  setupServer?(api: ServerExtensionAPI, config: unknown): void | Promise<void>;
2298
+ /** @internal */
1407
2299
  setupWorker?(api: WorkerExtensionAPI, config: unknown): void | Promise<void>;
1408
2300
  }
1409
2301
 
1410
- export { type CapabilityCardinality as $, type AutomaticTurnDefinition as A, type PiBuiltInToolName as B, type Codec as C, type ProcessTurnEndSpec as D, type ExternalActionSource as E, type ProcessRuntimeTurnContext as F, type ProcessActionExecution as G, type HumanTurnDefinition as H, type ProcessActionEffect as I, type LeafOutcomeCaptureResult as J, type ProcessLeafOutcomeDefinition as K, type LauncherContext as L, type ExtensionProcessDefinition as M, type IntegrationToolExecutionContext as N, type OutcomeToolParameterSpec as O, type ProcessLauncherService as P, type ProcessTurnOutcomeEvent as Q, type RepositoryCredentialRegistrar as R, type ServerProcessAPI as S, type TurnResultMarkdownBehavior as T, type UiProcessAPI as U, type ServerProcessContext as V, type WorkerCompleteInput as W, type ProcessCleanupHandler as X, type WorkerTurnHandler as Y, type WorkerProcessAPI as Z, type BuiltinPiProviderReference as _, type ProcessLaunchPlan as a, type PiWorkerContribution as a$, type CatalogExtensionAPI as a0, type ConfiguredPiProviderReference as a1, type ConfiguredProviderModel as a2, type DefinedProcessInput as a3, type ErasedModelProviderDefinition as a4, type ExtensionLifecycleHook as a5, type ExternalEventDescription as a6, type ExternalSourceInputMode as a7, type ExternalSourceResolveContext as a8, type ExternalSourceTransition as a9, type OutcomeToolArrayItemType as aA, type OutcomeToolParameterType as aB, type OutcomeToolSpec as aC, PI_BUILT_IN_TOOL_NAMES as aD, type ParsedModelProviderConfig as aE, type ParsedProcessWatcherConfig as aF, type PiCustomMessageInput as aG, type PiCustomTool as aH, type PiCustomToolExecutionContext as aI, type PiEvent as aJ, type PiEventHandler as aK, type PiEventType as aL, type PiPromptOptions as aM, type PiRunDetails as aN, type PiServerAdapter as aO, type PiServerGenerateTextInput as aP, type PiServerReference as aQ, type PiSessionDiagnostic as aR, type PiSessionDiagnosticHandler as aS, type PiSessionDiagnosticLevel as aT, type PiTerminalAcknowledgementControl as aU, type PiTerminalAcknowledgementState as aV, type PiTreeEntry as aW, type PiTreeHandle as aX, type PiTreeNode as aY, type PiTurnExecutionResult as aZ, type PiUsageData as a_, FRAMEWORK_LLM_TOOL_NAMES as aa, type GitHttpsCredentialMaterial as ab, type GitSshCredentialMaterial as ac, type HumanTurnActionView as ad, type HumanTurnExternalTrigger as ae, type HumanTurnNotesField as af, type IntegrationToolDefinition as ag, type LaunchPreparationContext as ah, type LauncherModelProfileSummary as ai, type LauncherVisibility as aj, type LeafOutcomeCaptureContext as ak, type LeafOutcomeCapturedEvent as al, type LeitwerkExtensionManifest as am, type LeitwerkExtensionModule as an, type LlmTurnPreparationContext as ao, type ModelProviderCredentialDefinition as ap, type ModelProviderDefinition as aq, type ModelProviderModelsContext as ar, type ModelProviderSecretsContext as as, type ModelProviderServer as at, type ModelProviderSet as au, type ModelProviderSetEntry as av, type ModelProviderWorker as aw, type OutcomeRouteOptions as ax, type OutcomeRouteSpec as ay, type OutcomeToolArrayItemSpec as az, type ProcessWatcherPresentation as b, type ServerExtensionLogger as b$, type PiWorkerContributionContext as b0, type PiWorkerReference as b1, type PiWorkerSecretBag as b2, type PlanApprovedEvent as b3, type PlanRevisionRequestedEvent as b4, type ProcessActionBranchSelector as b5, type ProcessActionBranchSpec as b6, type ProcessActionExternalTrigger as b7, type ProcessActionPreviewDefinition as b8, type ProcessActionSchedulingDefinition as b9, type ProviderModelStatus as bA, type ProviderOptionChoice as bB, type ProviderOptionChoicesContext as bC, type ProviderOptionDefaultContext as bD, type ProviderOptionField as bE, type ProviderOptionValidationIssue as bF, type ProviderOptionsDefinition as bG, type ProviderOptionsResolution as bH, type ProviderOptionsResolutionInput as bI, type ProviderWorkerConfigContext as bJ, type ProviderWorkerConfigDefinition as bK, type ProviderWorkerConfigSchema as bL, type QuestionRequestedEvent as bM, RESERVED_INTEGRATION_TOOL_NAMES as bN, type RepositoryCredentialKind as bO, type RepositoryCredentialProject as bP, type RepositoryCredentialProvider as bQ, type RepositoryCredentialRequirement as bR, type ResolvedProcessLauncher as bS, type ResolvedProcessPiConfig as bT, type ReviewCompletedEvent as bU, type ReviewRequestedEvent as bV, SafeLaunchPreparationError as bW, type ServerExtensionAPI as bX, type ServerExtensionEventMap as bY, type ServerExtensionEventName as bZ, type ServerExtensionEventPayloadInputMap as b_, type ProcessActionSchedulingFixedTurnPreview as ba, type ProcessActionSchedulingPreview as bb, type ProcessActionSchedulingTriggerPreview as bc, type ProcessBroadcastEffect as bd, type ProcessContext as be, type ProcessCreatedEvent as bf, type ProcessCustomTool as bg, type ProcessLaunchPlanProcessInput as bh, type ProcessLaunchProjectConfig as bi, type ProcessLifecycleEffects as bj, type ProcessOutcomeBranchSelector as bk, type ProcessOutcomeBranchSpec as bl, type ProcessOutcomeEffect as bm, type ProcessPatchEffect as bn, type ProcessServerRuntimeContext as bo, type ProcessSnapshotContext as bp, type ProcessTitleSourceField as bq, type ProcessToolResult as br, type ProcessTurnBinding as bs, type ProcessUpdatedEvent as bt, type ProcessWatcherPresentationField as bu, type ProviderAvailability as bv, type ProviderCredentialStatus as bw, type ProviderJsonObject as bx, type ProviderJsonPrimitive as by, type ProviderJsonValue as bz, type ProcessLaunchConfig as c, type ServerTransitionEffect as c0, type ServerTransitionRequest as c1, type ServerTransitionRuntime as c2, TURN_COMPLETION_MODES as c3, TURN_CONTEXT_MODES as c4, type TicketCreationCapability as c5, type TicketCreationDestinationContext as c6, type TicketCreationDestinationList as c7, type TicketCreationDestinationProvider as c8, type TicketCreationDestinationSnapshot as c9, defineModelProviders as cA, definePiServerAdapter as cB, definePiWorker as cC, defineProcess as cD, defineProviderOptions as cE, defineWorkerConfig as cF, externalTurn as cG, filterProviderOptionsForDefinition as cH, findUiLauncherById as cI, getExternalActionArmingId as cJ, getExternalActionTransitionTrigger as cK, getExternalSourceTransitionId as cL, humanTurn as cM, llmTurn as cN, piServer as cO, piWorker as cP, resolveHumanTurnView as cQ, resolveProviderOptions as cR, routeTurnOutcomes as cS, type PlanSavedEvent as cT, type TicketCreationDestinationSummary as ca, type TicketCreationReceipt as cb, type TurnAcceptanceState as cc, type TurnBranchType as cd, type TurnCompletionMode as ce, type TurnContextMode as cf, type TurnDefinitionRecord as cg, type TurnFailedEvent as ch, type TurnOptions as ci, type TurnOutcomeEvent as cj, type TurnResult as ck, type TurnSemanticEntryRefKey as cl, type TurnStartedEvent as cm, type UiLauncherConfigResolution as cn, type UiLauncherDefinition as co, type UiLauncherResolutionResult as cp, type UiLauncherSummary as cq, type WorkerExtensionAPI as cr, type WorkerProcessContext as cs, type WorkerRunHandle as ct, automaticTurn as cu, builtinPiProvider as cv, configuredPiProvider as cw, createCapabilityToken as cx, credentialBasedModelStatuses as cy, defineModelProvider as cz, type LaunchPreparationCheck as d, type ProcessWatcherSource as e, type CapabilityToken as f, type EventBus as g, type ProcessHumanTurnExternalActionSpec as h, type ExternalSourceEffect as i, type ProcessOutcomeExecution as j, type ProcessEffectPlan as k, type ProcessToolOutcomeSpec as l, type ExternalTurnDefinition as m, type ExternalSourceEffectContext as n, type LlmTurnDefinition as o, type TurnDefinition as p, type ProcessLauncherAPI as q, type ProcessWatcherAPI as r, type ProcessActionDefinition as s, type ProcessLauncherDefinition as t, type ProcessWatcherDefinition as u, type ProcessDefinition as v, type ProcessPiConfig as w, type ProcessHumanTurnActionSpec as x, type HumanTurnOperatorAttention as y, type LlmModelPurpose as z };
2302
+ export { type ErasedModelProviderDefinition as $, type AutomaticTurnDefinition as A, type ExternalSourceEffectContext as B, type Codec as C, type ExtensionProcessDefinition as D, type ExternalActionSource as E, type ProcessPiConfig as F, type ProcessActionExecution as G, type HumanTurnDefinition as H, type ProcessActionEffect as I, type LeafOutcomeCaptureResult as J, type IntegrationToolExecutionContext as K, type LauncherContext as L, type ProcessTurnOutcomeEvent as M, type ServerProcessContext as N, type OutcomeToolParameterSpec as O, type ProcessLauncherService as P, type ProcessCleanupHandler as Q, type RepositoryCredentialRegistrar as R, type ServerProcessAPI as S, type TurnResultMarkdownBehavior as T, type UiProcessAPI as U, type ProcessLeafOutcomeDefinition as V, type WorkerCompleteInput as W, type WorkerTurnHandler as X, type WorkerProcessAPI as Y, type CatalogExtensionAPI as Z, type ConfiguredProviderModel as _, type ProcessLaunchPlan as a, type TurnOptions as a$, type ExternalEventDescription as a0, type ExternalSourceResolveContext as a1, type ExternalSourceTransition as a2, type GitSshCredentialMaterial as a3, type IntegrationToolDefinition as a4, type LauncherModelProfileSummary as a5, type LeitwerkExtensionModule as a6, type ModelProviderDefinition as a7, type ModelProviderModelsContext as a8, type ModelProviderSet as a9, type ProviderAvailability as aA, type ProviderCredentialStatus as aB, type ProviderJsonObject as aC, type ProviderModelStatus as aD, type ProviderOptionChoice as aE, type ProviderOptionValidationIssue as aF, type ProviderOptionsResolution as aG, RESERVED_INTEGRATION_TOOL_NAMES as aH, type RepositoryCredentialProject as aI, type RepositoryCredentialProvider as aJ, type RepositoryCredentialRequirement as aK, type ResolvedProcessLauncher as aL, type ResolvedProcessPiConfig as aM, SafeLaunchPreparationError as aN, type ServerExtensionAPI as aO, type ServerExtensionEventMap as aP, type ServerExtensionEventName as aQ, type ServerExtensionEventPayloadInputMap as aR, type ServerExtensionLogger as aS, type ServerTransitionRequest as aT, type TicketCreationCapability as aU, type TicketCreationDestinationList as aV, type TicketCreationDestinationProvider as aW, type TicketCreationDestinationSnapshot as aX, type TicketCreationDestinationSummary as aY, type TicketCreationReceipt as aZ, type TurnAcceptanceState as a_, type ModelProviderSetEntry as aa, type ModelProviderWorker as ab, type OutcomeToolSpec as ac, type PiCustomMessageInput as ad, type PiCustomTool as ae, type PiEvent as af, type PiEventHandler as ag, type PiEventType as ah, type PiPromptOptions as ai, type PiRunDetails as aj, type PiServerAdapter as ak, type PiSessionDiagnostic as al, type PiSessionDiagnosticHandler as am, type PiTerminalAcknowledgementControl as an, type PiTerminalAcknowledgementState as ao, type PiTreeEntry as ap, type PiTreeHandle as aq, type PiTreeNode as ar, type PiTurnExecutionResult as as, type PiUsageData as at, type ProcessActionPreviewDefinition as au, type ProcessActionSchedulingDefinition as av, type ProcessLaunchProjectConfig as aw, type ProcessLifecycleEffects as ax, type ProcessTitleSourceField as ay, type ProcessTurnBinding as az, type ProcessWatcherPresentation as b, type TurnResult as b0, type UiLauncherDefinition as b1, type UiLauncherSummary as b2, type WorkerExtensionAPI as b3, type WorkerProcessContext as b4, type WorkerRunHandle as b5, automaticTurn as b6, builtinPiProvider as b7, configuredPiProvider as b8, createCapabilityToken as b9, credentialBasedModelStatuses as ba, defineModelProvider as bb, defineModelProviders as bc, definePiServerAdapter as bd, definePiWorker as be, defineProcess as bf, defineProviderOptions as bg, defineWorkerConfig as bh, filterProviderOptionsForDefinition as bi, findUiLauncherById as bj, getExternalActionArmingId as bk, getExternalActionTransitionTrigger as bl, getExternalSourceTransitionId as bm, humanTurn as bn, llmTurn as bo, piServer as bp, piWorker as bq, resolveHumanTurnView as br, resolveProviderOptions as bs, routeTurnOutcomes as bt, type PlanSavedEvent as bu, type ReviewCompletedEvent as bv, type ReviewRequestedEvent as bw, type ProcessLaunchConfig as c, type LaunchPreparationCheck as d, type ProcessWatcherSource as e, type CapabilityToken as f, type EventBus as g, type ProcessOutcomeExecution as h, type ProcessEffectPlan as i, type ProcessToolOutcomeSpec as j, type LlmTurnDefinition as k, type ExternalTurnDefinition as l, type TurnDefinition as m, type ProcessLauncherAPI as n, type ProcessWatcherAPI as o, type ProcessActionDefinition as p, type ProcessLauncherDefinition as q, type ProcessWatcherDefinition as r, type ProcessHumanTurnExternalActionSpec as s, type ExternalSourceEffect as t, type HumanTurnOperatorAttention as u, type ProcessHumanTurnActionSpec as v, type ProcessRuntimeTurnContext as w, type LlmModelPurpose as x, type PiBuiltInToolName as y, type ProcessTurnEndSpec as z };