@leitwerk-dev/domain 0.1.0 → 0.1.2

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 (69) hide show
  1. package/dist/index.d.ts +811 -18
  2. package/dist/index.js +1005 -15
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/actor.d.ts +0 -18
  6. package/dist/actor.d.ts.map +0 -1
  7. package/dist/actor.js +0 -72
  8. package/dist/actor.js.map +0 -1
  9. package/dist/domain-model.d.ts +0 -472
  10. package/dist/domain-model.d.ts.map +0 -1
  11. package/dist/domain-model.js +0 -171
  12. package/dist/domain-model.js.map +0 -1
  13. package/dist/index.d.ts.map +0 -1
  14. package/dist/launcher-recent-values.d.ts +0 -10
  15. package/dist/launcher-recent-values.d.ts.map +0 -1
  16. package/dist/launcher-recent-values.js +0 -60
  17. package/dist/launcher-recent-values.js.map +0 -1
  18. package/dist/markdown-normalize.d.ts +0 -4
  19. package/dist/markdown-normalize.d.ts.map +0 -1
  20. package/dist/markdown-normalize.js +0 -14
  21. package/dist/markdown-normalize.js.map +0 -1
  22. package/dist/process-definitions.d.ts +0 -68
  23. package/dist/process-definitions.d.ts.map +0 -1
  24. package/dist/process-definitions.js +0 -2
  25. package/dist/process-definitions.js.map +0 -1
  26. package/dist/process-model-config.d.ts +0 -24
  27. package/dist/process-model-config.d.ts.map +0 -1
  28. package/dist/process-model-config.js +0 -68
  29. package/dist/process-model-config.js.map +0 -1
  30. package/dist/process-row-slots.d.ts +0 -17
  31. package/dist/process-row-slots.d.ts.map +0 -1
  32. package/dist/process-row-slots.js +0 -45
  33. package/dist/process-row-slots.js.map +0 -1
  34. package/dist/process-state-json.d.ts +0 -16
  35. package/dist/process-state-json.d.ts.map +0 -1
  36. package/dist/process-state-json.js +0 -102
  37. package/dist/process-state-json.js.map +0 -1
  38. package/dist/repo-locator.d.ts +0 -10
  39. package/dist/repo-locator.d.ts.map +0 -1
  40. package/dist/repo-locator.js +0 -82
  41. package/dist/repo-locator.js.map +0 -1
  42. package/dist/review-subject.d.ts +0 -9
  43. package/dist/review-subject.d.ts.map +0 -1
  44. package/dist/review-subject.js +0 -18
  45. package/dist/review-subject.js.map +0 -1
  46. package/dist/semantic-entry-refs.d.ts +0 -34
  47. package/dist/semantic-entry-refs.d.ts.map +0 -1
  48. package/dist/semantic-entry-refs.js +0 -79
  49. package/dist/semantic-entry-refs.js.map +0 -1
  50. package/dist/string-normalize.d.ts +0 -12
  51. package/dist/string-normalize.d.ts.map +0 -1
  52. package/dist/string-normalize.js +0 -28
  53. package/dist/string-normalize.js.map +0 -1
  54. package/dist/turn-acceptance.d.ts +0 -3
  55. package/dist/turn-acceptance.d.ts.map +0 -1
  56. package/dist/turn-acceptance.js +0 -2
  57. package/dist/turn-acceptance.js.map +0 -1
  58. package/dist/turn-annotations.d.ts +0 -33
  59. package/dist/turn-annotations.d.ts.map +0 -1
  60. package/dist/turn-annotations.js +0 -49
  61. package/dist/turn-annotations.js.map +0 -1
  62. package/dist/turn-recovery.d.ts +0 -26
  63. package/dist/turn-recovery.d.ts.map +0 -1
  64. package/dist/turn-recovery.js +0 -70
  65. package/dist/turn-recovery.js.map +0 -1
  66. package/dist/turn-start-resolution.d.ts +0 -65
  67. package/dist/turn-start-resolution.d.ts.map +0 -1
  68. package/dist/turn-start-resolution.js +0 -97
  69. package/dist/turn-start-resolution.js.map +0 -1
@@ -1,472 +0,0 @@
1
- import type { RepoLocatorKind } from "./repo-locator.js";
2
- import type { ProcessSemanticEntryRefKey } from "./semantic-entry-refs.js";
3
- import type { FailedTurnRecoveryContext } from "./turn-recovery.js";
4
- import type { ProcessTurnStartTarget } from "./turn-start-resolution.js";
5
- export type TransitionTrigger = "start" | "advance" | "revision_requested" | "plan_approved" | "feedback_received" | "operator_re_review" | "mr_merged" | "abort" | "mr_state_waiting";
6
- export type InputSource = "external_comment" | "app_steer" | "action_prompt" | "watcher_event" | "llm_review" | "system";
7
- /**
8
- * Stable principal that drove an action, orthogonal to `InputSource` (the
9
- * channel an input arrived through) and `TransitionTrigger` (the graph edge a
10
- * transition followed). An `Actor` answers "who acted", not "how" or "why".
11
- */
12
- export type ActorKind = "user" | "channel" | "system";
13
- export interface Actor {
14
- /**
15
- * Stable principal id, namespaced by provider where applicable.
16
- * e.g. "forgejo:alice", "telegram", "system", "admin".
17
- */
18
- id: string;
19
- kind: ActorKind;
20
- /** Origin that vouched for this actor. `null` for system/admin/local. */
21
- provider: "forgejo" | "gitlab" | "telegram" | null;
22
- /** Optional human-readable name for UI display. */
23
- displayName?: string;
24
- }
25
- /** Watcher / scheduler / startup reconciliation and other internal callers. */
26
- export declare const SYSTEM_ACTOR: Actor;
27
- /**
28
- * Unauthenticated default for human-driven web/HTTP/WS actions when no SSO
29
- * provider is configured. Keeps an auth-disabled leitwerk behaving exactly
30
- * as it does today while still attributing actions to a stable principal.
31
- */
32
- export declare const ADMIN_ACTOR: Actor;
33
- /** Single collapsed principal for all Telegram-originated actions. */
34
- export declare const TELEGRAM_ACTOR: Actor;
35
- export type QuestionSelectionMode = "single" | "multiple";
36
- export interface NormalizedQuestionOption {
37
- id: string;
38
- label: string;
39
- details: string | null;
40
- }
41
- export interface NormalizedQuestion {
42
- id: string;
43
- question: string;
44
- selection: QuestionSelectionMode;
45
- options: readonly NormalizedQuestionOption[];
46
- }
47
- export interface QuestionAnswerDraft {
48
- selectedOptionIds: readonly string[];
49
- freeText: string;
50
- comment: string;
51
- }
52
- export interface ProcessQuestionRequest {
53
- id: string;
54
- instanceId: string;
55
- turnRecordId: string;
56
- toolCallId: string;
57
- questions: readonly NormalizedQuestion[];
58
- status: "open" | "answered" | "cancelled";
59
- answers: readonly string[] | null;
60
- askedAt: string;
61
- answeredAt: string | null;
62
- answeredBy: Actor | null;
63
- cancelledAt: string | null;
64
- }
65
- /** Normalize an LLM-authored request into immutable, position-stable identities. */
66
- export declare function normalizeAskQuestionsInput(value: unknown): NormalizedQuestion[];
67
- export declare function emptyQuestionDrafts(questions: readonly NormalizedQuestion[]): QuestionAnswerDraft[];
68
- /** Validate a complete structured draft and produce one canonical free-text answer per question. */
69
- export declare function canonicalizeQuestionAnswers(questions: readonly NormalizedQuestion[], value: unknown): string[];
70
- /**
71
- * Durable operator/system input queued for worker delivery.
72
- * `action_prompt` is the conventional source for action-originated follow-up
73
- * prompts. Delivery semantics are owned by `ProcessInput.target`, not by
74
- * `source` or `kind`.
75
- */
76
- export type InputKind = "instruction" | "action" | "system_event";
77
- export type ProcessInputTarget = {
78
- semanticRef: ProcessSemanticEntryRefKey;
79
- productName?: never;
80
- } | {
81
- productName: string;
82
- semanticRef?: never;
83
- };
84
- export declare const WORKER_ERROR_CLASSES: readonly ["llm_error", "git_error", "pi_crash", "pipeline_error", "infrastructure", "protocol_error", "operator_abort"];
85
- export type WorkerErrorClass = (typeof WORKER_ERROR_CLASSES)[number];
86
- export declare function isWorkerErrorClass(value: string): value is WorkerErrorClass;
87
- export type TurnFailureCode = "branch_drift";
88
- export declare function isTurnFailureCode(value: string): value is TurnFailureCode;
89
- /** Extension-defined stable turn identifier. */
90
- export type TurnId = string;
91
- export declare const PROCESS_TURN_TYPES: readonly ["llm", "human", "external", "automatic", "server_automatic"];
92
- export type ProcessTurnType = (typeof PROCESS_TURN_TYPES)[number];
93
- export interface TurnOutcomePayload {
94
- instanceId: string;
95
- turnRecordId: string;
96
- turnId: TurnId;
97
- turnType: ProcessTurnType;
98
- outcome: string;
99
- params: Record<string, unknown>;
100
- pathType?: ProcessTurnRecordPathType;
101
- forkPiEntryId?: string | null;
102
- resultPiEntryId?: string | null;
103
- turnResultMarkdown?: string | null;
104
- rootEntryId?: string | null;
105
- state?: unknown;
106
- }
107
- export interface TurnFailedPayload {
108
- instanceId: string;
109
- turnRecordId: string;
110
- turnId: TurnId;
111
- turnType: ProcessTurnType;
112
- pathType: ProcessTurnRecordPathType;
113
- forkPiEntryId?: string | null;
114
- resultPiEntryId?: string | null;
115
- errorSummary: string;
116
- errorClass?: WorkerErrorClass;
117
- failureCode?: TurnFailureCode | null;
118
- failureDetails?: Record<string, unknown> | null;
119
- recoveryContext?: FailedTurnRecoveryContext | null;
120
- }
121
- export type ProcessLifecycleStatus = "discovered" | "active" | "waiting" | "error" | "completed" | "aborted";
122
- export declare function isProcessTurnType(value: unknown): value is ProcessTurnType;
123
- export declare function isWorkerOwnedTurnType(turnType: ProcessTurnType): boolean;
124
- export declare function isWaitingTurnType(turnType: ProcessTurnType): boolean;
125
- export declare function lifecycleStatusForSelectedTurnType(turnType: ProcessTurnType): Extract<ProcessLifecycleStatus, "active" | "waiting">;
126
- export type ProcessSelectedTurnModelSource = "action_override" | "launch_override" | "instance_turn_config" | "process_config_turn" | "instance_default" | "process_config_default" | "catalog_default" | "legacy_persisted";
127
- export type ModelSelectionKind = "explicit" | "inherited";
128
- export type ModelSelectionSource = ProcessSelectedTurnModelSource;
129
- /** Durable intent and resolution path for one effective model selection. */
130
- export interface ModelSelectionProvenance {
131
- kind: ModelSelectionKind;
132
- source: ModelSelectionSource;
133
- }
134
- export interface DurableModelSelection {
135
- modelProfileId: string;
136
- provenance: ModelSelectionProvenance;
137
- }
138
- export type ModelPolicyFailureCode = "invalid_model_configuration" | "unknown_model_profile" | "model_profile_not_allowed" | "model_required" | "model_unavailable" | "model_stale" | "stale_evaluation_snapshot";
139
- export interface FutureExecutionBlockReason {
140
- code: ModelPolicyFailureCode;
141
- selection: DurableModelSelection | null;
142
- summary: string;
143
- detectedAt: string;
144
- /** Present when the block depends on a runtime availability snapshot. */
145
- availabilityRevision?: number;
146
- }
147
- /** JSON object persisted as non-secret turn-start configuration. */
148
- export type JsonObject = Record<string, unknown>;
149
- /** The one durable technical execution currently owned by a process. */
150
- export type CurrentExecutionRef = {
151
- kind: "worker_start";
152
- id: string;
153
- } | {
154
- kind: "server_turn";
155
- id: string;
156
- } | null;
157
- /** Immutable non-secret inputs resolved for a worker-owned turn start. */
158
- export type ResolvedTurnStart = {
159
- kind: "llm";
160
- model: {
161
- profileId: string;
162
- providerId: string;
163
- modelId: string;
164
- thinkingLevel: string;
165
- };
166
- /** Frozen provenance used to resolve this prepared start. */
167
- modelSelectionProvenance?: ModelSelectionProvenance;
168
- /** Status revision evaluated before preparation. Diagnostic only. */
169
- availabilityRevision?: number;
170
- providerOptions: Record<string, string>;
171
- providerWorkerConfig: {
172
- version: number;
173
- value: JsonObject;
174
- } | null;
175
- piResourceSnapshotDigest: string;
176
- workerRuntimeProfileId: string;
177
- piSettings: JsonObject;
178
- } | {
179
- kind: "automatic";
180
- };
181
- export type TurnStartKind = "selected_turn" | "retry" | "continue" | "startup_retry";
182
- export interface TurnStartContinuation {
183
- continueFromPiEntryId: string;
184
- continuePrompt: string;
185
- savedPrimaryLeafEntryId: string | null;
186
- }
187
- export type TurnStartPreparationFailureCode = "invalid_model_configuration" | "model_required" | "model_unavailable" | "model_stale" | "provider_options_required" | "provider_preflight_failed";
188
- export type TurnStartRecordState = {
189
- kind: "preparation_failed";
190
- requestedModelProfileId: string | null;
191
- providerOptions: Record<string, string>;
192
- code: TurnStartPreparationFailureCode;
193
- safeSummary: string;
194
- modelSelectionProvenance?: ModelSelectionProvenance;
195
- availabilityRevision?: number;
196
- } | {
197
- kind: "starting";
198
- start: ResolvedTurnStart;
199
- } | {
200
- kind: "bootstrap_failed";
201
- start: ResolvedTurnStart;
202
- failedWorkerLeaseId: string | null;
203
- code: string;
204
- safeSummary: string;
205
- } | {
206
- kind: "accepted";
207
- start: ResolvedTurnStart;
208
- turnRecordId: string;
209
- acceptedWorkerLeaseId: string;
210
- } | {
211
- kind: "superseded";
212
- start: ResolvedTurnStart | null;
213
- };
214
- /** Durable preparation for a single worker-owned selected turn, not an attempt. */
215
- export interface TurnStartRecord {
216
- id: string;
217
- instanceId: string;
218
- turnId: TurnId;
219
- turnType: Extract<ProcessTurnType, "llm" | "automatic">;
220
- /** Reserved id used when, and only when, this start is accepted. */
221
- proposedTurnRecordId: string;
222
- startKind: TurnStartKind;
223
- recoveryTurnRecordId: string | null;
224
- continuation: TurnStartContinuation | null;
225
- state: TurnStartRecordState;
226
- createdAt: string;
227
- updatedAt: string;
228
- }
229
- /** Tree positioning selected during bootstrap, before a turn is accepted. */
230
- export interface PreparedTurnStart {
231
- pathType: ProcessTurnRecordPathType;
232
- /** Durable authored context mode used to reconcile pre-prompt positioning and compaction. */
233
- contextMode: LlmContextMode;
234
- startTarget: ProcessTurnStartTarget;
235
- forkPiEntryId: string | null;
236
- }
237
- export type LlmContextMode = "full" | "compacted" | "fresh" | "fresh_seeded";
238
- /** Immutable, lease-correlated proof of successful worker bootstrap. */
239
- export type WorkerBootstrapReceipt = {
240
- kind: "llm";
241
- startRecordId: string;
242
- workerLeaseId: string;
243
- receiptEpoch: string;
244
- verifiedResourceSnapshotDigest: string;
245
- credentialRevision: number | null;
246
- loadedResourceIds: string[];
247
- resolvedModel: {
248
- providerId: string;
249
- modelId: string;
250
- };
251
- preparedStart: PreparedTurnStart | null;
252
- readyAt: string;
253
- } | {
254
- kind: "automatic";
255
- startRecordId: string;
256
- workerLeaseId: string;
257
- receiptEpoch: string;
258
- readyAt: string;
259
- };
260
- export declare const PROCESS_SELECTED_TURN_MODEL_SOURCES: readonly ["action_override", "launch_override", "instance_turn_config", "process_config_turn", "instance_default", "process_config_default", "catalog_default", "legacy_persisted"];
261
- export declare function isProcessSelectedTurnModelSource(value: unknown): value is ProcessSelectedTurnModelSource;
262
- export interface ProcessCustomizableFields {
263
- title?: string | null;
264
- externalId?: string | null;
265
- externalUrl?: string | null;
266
- metadata?: Record<string, unknown> | null;
267
- defaultModelProfileId?: string | null;
268
- initialDefaultModelProfileId?: string | null;
269
- turnConfigsJson?: string | null;
270
- selectedTurnModelProfileId?: string | null;
271
- selectedTurnModelKind?: ModelSelectionKind | null;
272
- selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
273
- }
274
- export interface ProcessInstance {
275
- id: string;
276
- /** Canonical process identifier from the extension catalog. */
277
- processId: string;
278
- /** Durable pointer to the currently selected business turn, if any. */
279
- selectedTurnId: TurnId | null;
280
- /** High-level lifecycle bucket for scheduling and operator state. */
281
- lifecycleStatus: ProcessLifecycleStatus;
282
- /** Single durable technical execution reference; null for waiting/terminal states. */
283
- currentExecution: CurrentExecutionRef;
284
- planRevision: number;
285
- /** Short operator-facing process title used in process lists and related UI. */
286
- title: string | null;
287
- /** Provider-agnostic external reference (e.g. Jira issue key, GitLab MR path). */
288
- externalId: string | null;
289
- /** URL to the external resource, if applicable. */
290
- externalUrl: string | null;
291
- /** Extension-owned JSON metadata blob. */
292
- metadata: Record<string, unknown> | null;
293
- /** Instance-scoped default model profile used when no turn override applies. */
294
- defaultModelProfileId?: string | null;
295
- /** Effective default model at creation time, retained for historical inspection. */
296
- initialDefaultModelProfileId?: string | null;
297
- /** JSON-serialized per-turn runtime config overrides for this instance. */
298
- turnConfigsJson?: string | null;
299
- /** Frozen effective model profile for the currently selected LLM turn, if any. */
300
- selectedTurnModelProfileId?: string | null;
301
- /** Explicit operator intent or inherited policy resolution for the selected model. */
302
- selectedTurnModelKind?: ModelSelectionKind | null;
303
- /** Resolution path that selected `selectedTurnModelProfileId`; null for empty selections. */
304
- selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
305
- /** JSON-serialized process params. */
306
- paramsJson: string | null;
307
- /** JSON-serialized process state. */
308
- stateJson: string | null;
309
- createdAt: string;
310
- updatedAt: string;
311
- /** Set once when the process first reaches a terminal lifecycle status. */
312
- closedAt?: string | null;
313
- }
314
- export interface ProcessProject {
315
- id: string;
316
- instanceId: string;
317
- key: string;
318
- /** Repository source identifier. May be a remote URL or a local filesystem path. */
319
- repoLocator: string;
320
- repoLocatorKind: RepoLocatorKind;
321
- baseBranch: string;
322
- workBranch: string | null;
323
- /** Provider-agnostic external identifier (e.g. MR IID, PR number). */
324
- externalId: string | null;
325
- /** URL to the external resource (e.g. MR URL, PR URL). */
326
- externalUrl: string | null;
327
- /** Extension-owned JSON metadata blob. */
328
- metadata: Record<string, unknown> | null;
329
- pipelineStatus: string | null;
330
- createdAt: string;
331
- updatedAt: string;
332
- }
333
- export interface ProcessInput {
334
- id: string;
335
- instanceId: string;
336
- sequence: number;
337
- source: InputSource;
338
- kind: InputKind;
339
- target: ProcessInputTarget | null;
340
- bodyMarkdown: string;
341
- /** Stable principal that queued this input. Defaults to `SYSTEM_ACTOR`. */
342
- actor: Actor;
343
- receivedAt: string;
344
- consumedAt: string | null;
345
- }
346
- export type FutureExecutionKind = "launch" | "action";
347
- export type FutureExecutionScheduleKind = "once" | "cron";
348
- export interface FutureExecution {
349
- id: string;
350
- kind: FutureExecutionKind;
351
- scheduleKind: FutureExecutionScheduleKind;
352
- /** Canonical target process identifier. */
353
- processId: string;
354
- /** Populated only for scheduled actions on an existing process instance. */
355
- instanceId: string | null;
356
- launcherId: string | null;
357
- actionId: string | null;
358
- /** JSON-serialized kind-specific payload. */
359
- payloadJson: string;
360
- cronExpression: string | null;
361
- nextRunAt: string;
362
- /** Immediate LLM selection caused by this execution, if known. */
363
- modelSelection?: DurableModelSelection | null;
364
- /** Structured model-policy block. Blocked rows remain durable. */
365
- blockedReason?: FutureExecutionBlockReason | null;
366
- createdAt: string;
367
- updatedAt: string;
368
- }
369
- export interface ProcessEvent {
370
- id: string;
371
- instanceId: string;
372
- eventType: string;
373
- data: Record<string, unknown>;
374
- createdAt: string;
375
- }
376
- export type ProcessLeafOutcomeSnapshotStatus = "ready" | "capture_error";
377
- export interface ProcessLeafOutcomeSnapshot {
378
- id: string;
379
- instanceId: string;
380
- leafEntryId: string;
381
- turnRecordId: string | null;
382
- rendererId: string | null;
383
- schemaVersion: number | null;
384
- props: Record<string, unknown> | null;
385
- fallbackMarkdown: string | null;
386
- status: ProcessLeafOutcomeSnapshotStatus;
387
- warningCode: string | null;
388
- warningMessage: string | null;
389
- anchoredAt: string;
390
- createdAt: string;
391
- }
392
- export type ProcessTurnRecordStatus = "running" | "succeeded" | "failed" | "superseded";
393
- /**
394
- * Structural tree position for a turn record.
395
- * - `primary`: continue the primary path from the current leaf
396
- * - `root_branch`: start from the implicit session root with no prior Pi entry context
397
- * - `leaf_branch`: fork from the current leaf as a side path
398
- */
399
- export declare const PROCESS_TURN_RECORD_PATH_TYPES: readonly ["primary", "root_branch", "leaf_branch"];
400
- export type ProcessTurnRecordPathType = (typeof PROCESS_TURN_RECORD_PATH_TYPES)[number];
401
- export interface ProcessTurnRecord {
402
- id: string;
403
- instanceId: string;
404
- turnId: TurnId;
405
- turnType: ProcessTurnType;
406
- status: ProcessTurnRecordStatus;
407
- attemptNumber: number;
408
- parentTurnRecordId: string | null;
409
- pathType: ProcessTurnRecordPathType;
410
- forkPiEntryId: string | null;
411
- /** Accepted worker-start preparation that created this worker-owned record. */
412
- turnStartRecordId?: string | null;
413
- /** Lease whose receipt first authorized this worker-owned record. */
414
- acceptedWorkerLeaseId?: string | null;
415
- resultPiEntryId: string | null;
416
- modelProfileId: string | null;
417
- modelSelectionProvenance?: ModelSelectionProvenance | null;
418
- turnResultMarkdown: string | null;
419
- errorSummary: string | null;
420
- errorClass: WorkerErrorClass | null;
421
- startedAt: string;
422
- endedAt: string | null;
423
- }
424
- export interface WorkerLease {
425
- id: string;
426
- instanceId: string;
427
- workerId: string;
428
- /** Durable server-owned supervision state for the current worker lease. */
429
- state: WorkerState;
430
- /** Server epoch this lease belongs to, used to reject stale snapshot writes. */
431
- serverEpoch?: string | null;
432
- /** Hash of the lease-scoped WebSocket connect token. The raw token is never stored. */
433
- connectTokenHash?: string | null;
434
- /** Hash of the lease-scoped HTTP session-snapshot credential. The raw token is never stored. */
435
- snapshotTokenHash?: string | null;
436
- /** Fingerprint of the effective instance model policy/config snapshot used to start this worker. */
437
- modelPolicyFingerprint?: string | null;
438
- /** First valid lease-correlated bootstrap receipt; written once by the server. */
439
- bootstrapReceipt?: WorkerBootstrapReceipt | null;
440
- /** Updated from heartbeats for liveness/recovery diagnostics. */
441
- lastHeartbeatAt: string | null;
442
- startedAt: string;
443
- /** Set once the lease is no longer active for supervision. */
444
- exitedAt: string | null;
445
- }
446
- /**
447
- * Durable worker lease states owned by the server.
448
- * `absent` is conceptual in lifecycle logic and usually represented by
449
- * the absence of an active lease row.
450
- */
451
- export type WorkerState = "absent" | "spawning" | "bootstrapping" | "idle" | "busy" | "draining" | "failed" | "cleanup" | "exited";
452
- /**
453
- * External write type identifier. Extensions define their own write types
454
- * as plain strings (e.g. "jira.approved_plan_comment", "gitlab.create_mr").
455
- */
456
- export type ExternalWriteType = string;
457
- export interface ExternalWriteLog {
458
- id: string;
459
- instanceId: string;
460
- writeType: ExternalWriteType;
461
- dedupKey: string;
462
- completedAt: string;
463
- metadata: Record<string, unknown>;
464
- }
465
- /**
466
- * Returns a human-readable, operator-facing label for the structural path
467
- * position of a turn record. These labels avoid internal domain terms such
468
- * as "primary" or "root_branch" in favour of plain descriptions of what the
469
- * turn is doing relative to the main path.
470
- */
471
- export declare function formatPathTypeLabel(pathType: ProcessTurnRecordPathType): string;
472
- //# sourceMappingURL=domain-model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domain-model.d.ts","sourceRoot":"","sources":["../src/domain-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,MAAM,MAAM,iBAAiB,GAC1B,OAAO,GACP,SAAS,GACT,oBAAoB,GACpB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,WAAW,GACX,OAAO,GACP,kBAAkB,CAAC;AAEtB,MAAM,MAAM,WAAW,GACpB,kBAAkB,GAClB,WAAW,GACX,eAAe,GACf,eAAe,GACf,YAAY,GACZ,QAAQ,CAAC;AAEZ;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,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C,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAW/E"}
@@ -1,171 +0,0 @@
1
- /** Watcher / scheduler / startup reconciliation and other internal callers. */
2
- export const SYSTEM_ACTOR = { id: "system", kind: "system", provider: null };
3
- /**
4
- * Unauthenticated default for human-driven web/HTTP/WS actions when no SSO
5
- * provider is configured. Keeps an auth-disabled leitwerk behaving exactly
6
- * as it does today while still attributing actions to a stable principal.
7
- */
8
- export const ADMIN_ACTOR = { id: "admin", kind: "user", provider: null };
9
- /** Single collapsed principal for all Telegram-originated actions. */
10
- export const TELEGRAM_ACTOR = { id: "telegram", kind: "channel", provider: "telegram" };
11
- function requiredTrimmedString(value, field) {
12
- if (typeof value !== "string" || value.trim() === "") {
13
- throw new Error(`${field} must be a non-empty string`);
14
- }
15
- return value.trim();
16
- }
17
- /** Normalize an LLM-authored request into immutable, position-stable identities. */
18
- export function normalizeAskQuestionsInput(value) {
19
- const questions = value?.questions;
20
- if (!Array.isArray(questions))
21
- throw new Error("questions must be an array");
22
- if (questions.length === 0)
23
- throw new Error("questions must not be empty");
24
- return questions.map((candidate, questionIndex) => {
25
- const question = requiredTrimmedString(candidate?.question, `questions[${questionIndex}].question`);
26
- if (candidate?.selection !== "single" && candidate?.selection !== "multiple") {
27
- throw new Error(`questions[${questionIndex}].selection must be 'single' or 'multiple'`);
28
- }
29
- if (!Array.isArray(candidate.options) || candidate.options.length === 0) {
30
- throw new Error(`questions[${questionIndex}].options must not be empty`);
31
- }
32
- const labels = new Set();
33
- const questionId = `question_${questionIndex + 1}`;
34
- const options = candidate.options.map((option, optionIndex) => {
35
- const label = requiredTrimmedString(option?.label, `questions[${questionIndex}].options[${optionIndex}].label`);
36
- const key = label.toLocaleLowerCase();
37
- if (labels.has(key)) {
38
- throw new Error(`questions[${questionIndex}] contains duplicate option '${label}'`);
39
- }
40
- labels.add(key);
41
- return {
42
- id: `${questionId}_option_${optionIndex + 1}`,
43
- label,
44
- details: typeof option.details === "string" && option.details.trim() !== ""
45
- ? option.details.trim()
46
- : null,
47
- };
48
- });
49
- return { id: questionId, question, selection: candidate.selection, options };
50
- });
51
- }
52
- export function emptyQuestionDrafts(questions) {
53
- return questions.map(() => ({ selectedOptionIds: [], freeText: "", comment: "" }));
54
- }
55
- function normalizeQuestionDrafts(questions, value) {
56
- if (!Array.isArray(value) || value.length !== questions.length) {
57
- throw new Error("Every question must have one draft answer in question order");
58
- }
59
- return questions.map((question, index) => {
60
- const answer = value[index];
61
- if (!Array.isArray(answer?.selectedOptionIds)) {
62
- throw new Error(`Question ${index + 1} has a malformed selection`);
63
- }
64
- const selectedOptionIds = answer.selectedOptionIds.map((id) => {
65
- if (typeof id !== "string" || !question.options.some((option) => option.id === id)) {
66
- throw new Error(`Question ${index + 1} contains an unknown selection`);
67
- }
68
- return id;
69
- });
70
- if (new Set(selectedOptionIds).size !== selectedOptionIds.length) {
71
- throw new Error(`Question ${index + 1} contains duplicate selections`);
72
- }
73
- if (question.selection === "single" && selectedOptionIds.length > 1) {
74
- throw new Error(`Question ${index + 1} accepts only one selection`);
75
- }
76
- if (typeof answer.freeText !== "string" || typeof answer.comment !== "string") {
77
- throw new Error(`Question ${index + 1} contains malformed text`);
78
- }
79
- return { selectedOptionIds, freeText: answer.freeText, comment: answer.comment };
80
- });
81
- }
82
- /** Validate a complete structured draft and produce one canonical free-text answer per question. */
83
- export function canonicalizeQuestionAnswers(questions, value) {
84
- return normalizeQuestionDrafts(questions, value).map((answer, index) => {
85
- const question = questions[index];
86
- if (!question)
87
- throw new Error(`Question ${index + 1} is missing`);
88
- const options = answer.selectedOptionIds.map((id) => question.options.find((option) => option.id === id)?.label ?? "");
89
- const freeText = answer.freeText.trim();
90
- const comment = answer.comment.trim();
91
- if (options.length === 0 && freeText === "") {
92
- throw new Error(`Question ${index + 1} requires an answer`);
93
- }
94
- return [options.join(", "), freeText, comment ? `Context: ${comment}` : ""]
95
- .filter(Boolean)
96
- .join("\n");
97
- });
98
- }
99
- export const WORKER_ERROR_CLASSES = [
100
- "llm_error",
101
- "git_error",
102
- "pi_crash",
103
- "pipeline_error",
104
- "infrastructure",
105
- "protocol_error",
106
- "operator_abort",
107
- ];
108
- export function isWorkerErrorClass(value) {
109
- return WORKER_ERROR_CLASSES.includes(value);
110
- }
111
- export function isTurnFailureCode(value) {
112
- return value === "branch_drift";
113
- }
114
- export const PROCESS_TURN_TYPES = [
115
- "llm",
116
- "human",
117
- "external",
118
- "automatic",
119
- "server_automatic",
120
- ];
121
- export function isProcessTurnType(value) {
122
- return typeof value === "string" && PROCESS_TURN_TYPES.includes(value);
123
- }
124
- export function isWorkerOwnedTurnType(turnType) {
125
- return turnType === "llm" || turnType === "automatic";
126
- }
127
- export function isWaitingTurnType(turnType) {
128
- return turnType === "human" || turnType === "external";
129
- }
130
- export function lifecycleStatusForSelectedTurnType(turnType) {
131
- return isWaitingTurnType(turnType) ? "waiting" : "active";
132
- }
133
- export const PROCESS_SELECTED_TURN_MODEL_SOURCES = [
134
- "action_override",
135
- "launch_override",
136
- "instance_turn_config",
137
- "process_config_turn",
138
- "instance_default",
139
- "process_config_default",
140
- "catalog_default",
141
- "legacy_persisted",
142
- ];
143
- export function isProcessSelectedTurnModelSource(value) {
144
- return PROCESS_SELECTED_TURN_MODEL_SOURCES.includes(value);
145
- }
146
- /**
147
- * Structural tree position for a turn record.
148
- * - `primary`: continue the primary path from the current leaf
149
- * - `root_branch`: start from the implicit session root with no prior Pi entry context
150
- * - `leaf_branch`: fork from the current leaf as a side path
151
- */
152
- export const PROCESS_TURN_RECORD_PATH_TYPES = ["primary", "root_branch", "leaf_branch"];
153
- /**
154
- * Returns a human-readable, operator-facing label for the structural path
155
- * position of a turn record. These labels avoid internal domain terms such
156
- * as "primary" or "root_branch" in favour of plain descriptions of what the
157
- * turn is doing relative to the main path.
158
- */
159
- export function formatPathTypeLabel(pathType) {
160
- switch (pathType) {
161
- case "primary":
162
- return "Continuing the main path";
163
- case "root_branch":
164
- return "Starting from the beginning";
165
- case "leaf_branch":
166
- return "Exploring an alternative";
167
- default:
168
- return "Path";
169
- }
170
- }
171
- //# sourceMappingURL=domain-model.js.map