@leitwerk-dev/protocol 0.1.0

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 (118) hide show
  1. package/dist/LICENSE +13 -0
  2. package/dist/chunk-6L4W7WPV.js +1 -0
  3. package/dist/chunk-6L4W7WPV.js.map +1 -0
  4. package/dist/chunk-7PCFBAV4.js +740 -0
  5. package/dist/chunk-7PCFBAV4.js.map +1 -0
  6. package/dist/chunk-AAV3AAOF.js +1 -0
  7. package/dist/chunk-AAV3AAOF.js.map +1 -0
  8. package/dist/chunk-IEMT3JG4.js +1 -0
  9. package/dist/chunk-IEMT3JG4.js.map +1 -0
  10. package/dist/chunk-IWVU76M5.js +26 -0
  11. package/dist/chunk-IWVU76M5.js.map +1 -0
  12. package/dist/config-snapshot.d.ts +211 -0
  13. package/dist/config-snapshot.d.ts.map +1 -0
  14. package/dist/config-snapshot.js +2 -0
  15. package/dist/config-snapshot.js.map +1 -0
  16. package/dist/external-review.d.ts +8 -0
  17. package/dist/external-review.d.ts.map +1 -0
  18. package/dist/external-review.js +2 -0
  19. package/dist/external-review.js.map +1 -0
  20. package/dist/form-contract.d.ts +41 -0
  21. package/dist/form-contract.d.ts.map +1 -0
  22. package/dist/form-contract.js +2 -0
  23. package/dist/form-contract.js.map +1 -0
  24. package/dist/http-contracts-C8IXe8MU.d.ts +1483 -0
  25. package/dist/http-contracts.d.ts +959 -0
  26. package/dist/http-contracts.d.ts.map +1 -0
  27. package/dist/http-contracts.js +434 -0
  28. package/dist/http-contracts.js.map +1 -0
  29. package/dist/index.d.ts +21 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +21 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/initial-prompt.d.ts +8 -0
  34. package/dist/initial-prompt.d.ts.map +1 -0
  35. package/dist/initial-prompt.js +103 -0
  36. package/dist/initial-prompt.js.map +1 -0
  37. package/dist/launcher-contract.d.ts +34 -0
  38. package/dist/launcher-contract.d.ts.map +1 -0
  39. package/dist/launcher-contract.js +2 -0
  40. package/dist/launcher-contract.js.map +1 -0
  41. package/dist/live-turn-projection.d.ts +39 -0
  42. package/dist/live-turn-projection.d.ts.map +1 -0
  43. package/dist/live-turn-projection.js +395 -0
  44. package/dist/live-turn-projection.js.map +1 -0
  45. package/dist/pi-session-message.d.ts +25 -0
  46. package/dist/pi-session-message.d.ts.map +1 -0
  47. package/dist/pi-session-message.js +27 -0
  48. package/dist/pi-session-message.js.map +1 -0
  49. package/dist/primary-path-snapshot.d.ts +77 -0
  50. package/dist/primary-path-snapshot.d.ts.map +1 -0
  51. package/dist/primary-path-snapshot.js +2 -0
  52. package/dist/primary-path-snapshot.js.map +1 -0
  53. package/dist/protocol.d.ts +428 -0
  54. package/dist/protocol.d.ts.map +1 -0
  55. package/dist/protocol.js +261 -0
  56. package/dist/protocol.js.map +1 -0
  57. package/dist/session-entry-tree.d.ts +15 -0
  58. package/dist/session-entry-tree.d.ts.map +1 -0
  59. package/dist/session-entry-tree.js +42 -0
  60. package/dist/session-entry-tree.js.map +1 -0
  61. package/dist/streamable-events.d.ts +4 -0
  62. package/dist/streamable-events.d.ts.map +1 -0
  63. package/dist/streamable-events.js +17 -0
  64. package/dist/streamable-events.js.map +1 -0
  65. package/dist/text-preview.d.ts +7 -0
  66. package/dist/text-preview.d.ts.map +1 -0
  67. package/dist/text-preview.js +23 -0
  68. package/dist/text-preview.js.map +1 -0
  69. package/dist/timeline-projection.d.ts +9 -0
  70. package/dist/timeline-projection.d.ts.map +1 -0
  71. package/dist/timeline-projection.js +30 -0
  72. package/dist/timeline-projection.js.map +1 -0
  73. package/dist/timestamp-ordering.d.ts +3 -0
  74. package/dist/timestamp-ordering.d.ts.map +1 -0
  75. package/dist/timestamp-ordering.js +15 -0
  76. package/dist/timestamp-ordering.js.map +1 -0
  77. package/dist/tool-renderer-contract.d.ts +18 -0
  78. package/dist/tool-renderer-contract.d.ts.map +1 -0
  79. package/dist/tool-renderer-contract.js +22 -0
  80. package/dist/tool-renderer-contract.js.map +1 -0
  81. package/dist/turn-continuation.d.ts +36 -0
  82. package/dist/turn-continuation.d.ts.map +1 -0
  83. package/dist/turn-continuation.js +179 -0
  84. package/dist/turn-continuation.js.map +1 -0
  85. package/dist/usage-by-turn-record.d.ts +5 -0
  86. package/dist/usage-by-turn-record.d.ts.map +1 -0
  87. package/dist/usage-by-turn-record.js +25 -0
  88. package/dist/usage-by-turn-record.js.map +1 -0
  89. package/dist/usage-snapshot.d.ts +25 -0
  90. package/dist/usage-snapshot.d.ts.map +1 -0
  91. package/dist/usage-snapshot.js +120 -0
  92. package/dist/usage-snapshot.js.map +1 -0
  93. package/dist/ws-event-payloads.d.ts +18 -0
  94. package/dist/ws-event-payloads.d.ts.map +1 -0
  95. package/dist/ws-event-payloads.js +47 -0
  96. package/dist/ws-event-payloads.js.map +1 -0
  97. package/package.json +65 -0
  98. package/src/config-snapshot.ts +244 -0
  99. package/src/external-review.ts +7 -0
  100. package/src/form-contract.ts +50 -0
  101. package/src/http-contracts.ts +1497 -0
  102. package/src/index.ts +20 -0
  103. package/src/initial-prompt.ts +127 -0
  104. package/src/launcher-contract.ts +43 -0
  105. package/src/live-turn-projection.ts +501 -0
  106. package/src/pi-session-message.ts +48 -0
  107. package/src/primary-path-snapshot.ts +98 -0
  108. package/src/protocol.ts +503 -0
  109. package/src/session-entry-tree.ts +63 -0
  110. package/src/streamable-events.ts +20 -0
  111. package/src/text-preview.ts +32 -0
  112. package/src/timeline-projection.ts +43 -0
  113. package/src/timestamp-ordering.ts +15 -0
  114. package/src/tool-renderer-contract.ts +41 -0
  115. package/src/turn-continuation.ts +298 -0
  116. package/src/usage-by-turn-record.ts +34 -0
  117. package/src/usage-snapshot.ts +174 -0
  118. package/src/ws-event-payloads.ts +73 -0
@@ -0,0 +1,244 @@
1
+ export interface ExtensionLoadingConfigSnapshot {
2
+ sources: string[];
3
+ }
4
+
5
+ export interface ServerWebsocketConfigSnapshot {
6
+ heartbeat_interval: string;
7
+ client_timeout: string;
8
+ toast_ttl: string;
9
+ }
10
+
11
+ export interface ServerConfigSnapshot {
12
+ host: string;
13
+ port: number;
14
+ base_url: string;
15
+ websocket: ServerWebsocketConfigSnapshot;
16
+ }
17
+
18
+ export interface StorageConfigSnapshot {
19
+ sqlite_path: string;
20
+ process_workspaces_dir: string;
21
+ tree_files_dir: string;
22
+ }
23
+
24
+ export interface ComponentConfigSnapshot {
25
+ repo: string;
26
+ default_branch: string;
27
+ /**
28
+ * Worker runtime profile this component requires. Selection precedence is
29
+ * process override → component → default; conflicting component profiles on
30
+ * a single process are rejected before the worker starts.
31
+ */
32
+ worker_runtime_profile?: string;
33
+ }
34
+
35
+ export interface WorkersCleanupConfigSnapshot {
36
+ transient_ttl: string;
37
+ completed_process_retention: string;
38
+ error_process_retention: string;
39
+ }
40
+
41
+ export interface WorkersConfigSnapshot {
42
+ /** Worker execution run mode. Docker/Kubernetes are production; local is test/development only. */
43
+ runner: "docker" | "kubernetes" | "local";
44
+ /**
45
+ * Fallback worker runtime profile id used when neither the process nor any
46
+ * component selects one. Must reference a configured `worker_runtime_profiles`
47
+ * entry when set.
48
+ */
49
+ default_runtime_profile?: string;
50
+ max_parallel_processes: number;
51
+ startup_timeout: string;
52
+ shutdown_grace_period: string;
53
+ heartbeat_interval: string;
54
+ turn_max_duration: string;
55
+ turn_inactivity_timeout: string;
56
+ turn_abort_grace_period: string;
57
+ stale_heartbeat_timeout: string;
58
+ resume_on_boot: boolean;
59
+ idle_worker_ttl: string;
60
+ /** Server-enforced maximum HTTP session snapshot upload size in bytes. */
61
+ session_snapshot_max_size_bytes: number;
62
+ /** Server-owned debug mirror for raw worker.event payloads. Workers ignore this switch. */
63
+ log_worker_events_to_stdout: boolean;
64
+ cleanup: WorkersCleanupConfigSnapshot;
65
+ }
66
+
67
+ export interface WorkerRuntimeConfigSnapshot {
68
+ heartbeat_interval: string;
69
+ turn_max_duration: string;
70
+ turn_inactivity_timeout: string;
71
+ turn_abort_grace_period: string;
72
+ }
73
+
74
+ export interface ModelProfileSnapshot {
75
+ id: string;
76
+ provider: string;
77
+ model_id: string;
78
+ thinking_level?: string;
79
+ /** Non-secret provider-owned defaults applied to each new LLM start. */
80
+ provider_options?: Record<string, string>;
81
+ }
82
+
83
+ export interface PiProviderRetryConfigSnapshot {
84
+ /** Optional provider/SDK request timeout. Null defers to the provider SDK default. */
85
+ timeout: string | null;
86
+ /** Optional provider/SDK retry attempts. Null defers to the provider SDK default. */
87
+ max_retries: number | null;
88
+ /** Maximum provider-requested retry delay before failing fast. */
89
+ max_retry_delay: string;
90
+ }
91
+
92
+ export interface PiRetryConfigSnapshot {
93
+ enabled: boolean;
94
+ max_retries: number;
95
+ base_delay: string;
96
+ provider: PiProviderRetryConfigSnapshot;
97
+ }
98
+
99
+ export interface PiProcessTitleGenerationRetryConfigSnapshot {
100
+ /** Total title-generation attempts including the first immediate try. */
101
+ max_attempts: number;
102
+ /** Base outer retry delay after a failed server-side title request. */
103
+ base_delay: string;
104
+ /** Maximum outer retry delay for failed title-generation jobs. */
105
+ max_delay: string;
106
+ }
107
+
108
+ export interface PiProcessTitleGenerationConfigSnapshot {
109
+ model_profile: string | null;
110
+ retry: PiProcessTitleGenerationRetryConfigSnapshot;
111
+ }
112
+
113
+ export interface PiConfigSnapshot {
114
+ /** Leitwerk-managed Pi agent directory. Local workers use it as PI_CODING_AGENT_DIR. */
115
+ agent_dir: string;
116
+ model_profiles: ModelProfileSnapshot[];
117
+ /** Global default system prompt template for all processes. Rendered with Mustache against runtime context. When omitted, the worker uses its built-in default. */
118
+ system_prompt_template?: string;
119
+ /** Server-side pre-start process title generation settings. */
120
+ process_title_generation: PiProcessTitleGenerationConfigSnapshot;
121
+ /** Leitwerk-managed Pi retry/runtime settings for newly created worker sessions. */
122
+ retry: PiRetryConfigSnapshot;
123
+ }
124
+
125
+ export interface ProcessPiConfigSnapshot {
126
+ system_prompt_template?: string;
127
+ append_system_prompt_template?: string;
128
+ }
129
+
130
+ export interface ProcessTurnConfigSnapshot {
131
+ model_profile?: string;
132
+ }
133
+
134
+ export interface WatcherLaunchConfigSnapshot {
135
+ default_model_profile?: string;
136
+ turn_configs?: Record<string, ProcessTurnConfigSnapshot>;
137
+ }
138
+
139
+ export interface JiraWatcherLabelsConfigSnapshot {
140
+ trigger: string;
141
+ done: string;
142
+ required?: string[];
143
+ forbidden?: string[];
144
+ }
145
+
146
+ export interface JiraProcessWatcherConfigSnapshot {
147
+ type: "jira";
148
+ enabled: boolean;
149
+ project: string;
150
+ poll_interval: string;
151
+ labels: JiraWatcherLabelsConfigSnapshot;
152
+ target_branch_label_prefix: string;
153
+ launch?: WatcherLaunchConfigSnapshot;
154
+ }
155
+
156
+ export interface GitLabMrWatcherLabelsConfigSnapshot {
157
+ trigger: string;
158
+ done: string;
159
+ }
160
+
161
+ export interface GitLabMrProcessWatcherConfigSnapshot {
162
+ type: "gitlab_mr";
163
+ enabled: boolean;
164
+ group: string;
165
+ poll_interval: string;
166
+ labels: GitLabMrWatcherLabelsConfigSnapshot;
167
+ launch?: WatcherLaunchConfigSnapshot;
168
+ }
169
+
170
+ export interface FilesystemProcessWatcherConfigSnapshot {
171
+ type: "filesystem";
172
+ enabled: boolean;
173
+ poll_interval: string;
174
+ file_path: string;
175
+ launch?: WatcherLaunchConfigSnapshot;
176
+ }
177
+
178
+ export type ProcessWatcherConfigSnapshot =
179
+ | JiraProcessWatcherConfigSnapshot
180
+ | GitLabMrProcessWatcherConfigSnapshot
181
+ | FilesystemProcessWatcherConfigSnapshot;
182
+
183
+ export type ProcessWatcherType = ProcessWatcherConfigSnapshot["type"];
184
+
185
+ export interface ProcessConfigSnapshot {
186
+ default_model_profile?: string;
187
+ /**
188
+ * Restricts which model profiles this process may use.
189
+ * When set, only listed profile IDs are valid for default, turn, and override selections.
190
+ * When omitted, all configured model profiles are allowed.
191
+ */
192
+ allowed_model_profiles?: string[];
193
+ /**
194
+ * Process-level worker runtime profile override. Wins over per-component
195
+ * selection. Must reference a configured `worker_runtime_profiles` entry.
196
+ */
197
+ worker_runtime_profile?: string;
198
+ pi?: ProcessPiConfigSnapshot;
199
+ turn_configs: Record<string, ProcessTurnConfigSnapshot>;
200
+ watchers?: Record<string, ProcessWatcherConfigSnapshot>;
201
+ }
202
+
203
+ export interface WorkerProcessConfigSnapshot {
204
+ pi?: ProcessPiConfigSnapshot;
205
+ }
206
+
207
+ export interface NotificationChannelConfigSnapshot {
208
+ enabled: boolean;
209
+ type: string;
210
+ url: string;
211
+ }
212
+
213
+ export interface SquadNotificationRouteSnapshot {
214
+ url: string;
215
+ }
216
+
217
+ export interface SquadNotificationConfigSnapshot {
218
+ enabled: boolean;
219
+ type: string;
220
+ routing_field: string;
221
+ routes: Record<string, SquadNotificationRouteSnapshot>;
222
+ }
223
+
224
+ export interface NotificationsConfigSnapshot {
225
+ all: NotificationChannelConfigSnapshot;
226
+ debug: NotificationChannelConfigSnapshot;
227
+ squad: SquadNotificationConfigSnapshot;
228
+ }
229
+
230
+ export interface SandboxConfigSnapshot {
231
+ enabled: boolean;
232
+ profile: string;
233
+ }
234
+
235
+ /**
236
+ * Worker-safe config object snapshot sent from server to worker at bootstrap
237
+ * time. Server-only wiring and unused operator/server config are intentionally
238
+ * excluded.
239
+ */
240
+ export interface ConfigSnapshot {
241
+ workers: WorkerRuntimeConfigSnapshot;
242
+ pi: PiConfigSnapshot;
243
+ process_configs?: Record<string, WorkerProcessConfigSnapshot>;
244
+ }
@@ -0,0 +1,7 @@
1
+ /** Repository review created by a worker-side handoff and persisted by the server. */
2
+ export interface CreatedExternalReview {
3
+ projectKey: string;
4
+ externalId: string;
5
+ externalUrl: string;
6
+ baseBranch: string;
7
+ }
@@ -0,0 +1,50 @@
1
+ export type FormFieldKind = "text" | "textarea" | "number" | "boolean" | "select";
2
+
3
+ export interface FormFieldOptionDefinition {
4
+ value: string;
5
+ label: string;
6
+ description?: string;
7
+ }
8
+
9
+ export interface FormFieldPublishDefinition {
10
+ /** Product name to publish. Defaults to the field id. */
11
+ product?: string;
12
+ }
13
+
14
+ export interface FormFieldStateDefinition {
15
+ /** Dot-separated path in process state to write the submitted field value to. */
16
+ path: string;
17
+ }
18
+
19
+ export interface FormFieldDefinition<TKind extends FormFieldKind = FormFieldKind> {
20
+ id: string;
21
+ label: string;
22
+ kind: TKind;
23
+ required?: boolean;
24
+ placeholder?: string;
25
+ description?: string;
26
+ options?: readonly FormFieldOptionDefinition[];
27
+ rememberRecentValues?: boolean;
28
+ /** Publish this field as transition-scoped product/input data. */
29
+ publish?: true | FormFieldPublishDefinition;
30
+ /** Persist this field value into process state. */
31
+ state?: FormFieldStateDefinition;
32
+ }
33
+
34
+ export type ActionFormFieldKind = Exclude<FormFieldKind, "select">;
35
+ export type ActionFormFieldDefinition = Omit<
36
+ FormFieldDefinition<ActionFormFieldKind>,
37
+ "options" | "rememberRecentValues"
38
+ > & {
39
+ /** Share this textual value across compatible action forms as their primary prompt. */
40
+ primaryPrompt?: true;
41
+ };
42
+
43
+ export interface FormDefinition<TField extends FormFieldDefinition = FormFieldDefinition> {
44
+ id: string;
45
+ title: string;
46
+ fields: readonly TField[];
47
+ submitLabel?: string;
48
+ }
49
+
50
+ export type ActionFormDefinition = FormDefinition<ActionFormFieldDefinition>;