@leitwerk-dev/process-sdk 0.1.9 → 0.2.1

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