@leitwerk-dev/domain 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 (95) hide show
  1. package/dist/actor.d.ts +4 -2
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/domain-model.d.ts +457 -60
  4. package/dist/domain-model.d.ts.map +1 -1
  5. package/dist/index.d.ts +16 -14
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +966 -15
  8. package/dist/index.js.map +1 -1
  9. package/dist/launcher-recent-values.d.ts +5 -0
  10. package/dist/launcher-recent-values.d.ts.map +1 -1
  11. package/dist/markdown-normalize.d.ts +3 -0
  12. package/dist/markdown-normalize.d.ts.map +1 -1
  13. package/dist/number-normalize.d.ts +3 -0
  14. package/dist/number-normalize.d.ts.map +1 -0
  15. package/dist/process-definitions.d.ts +37 -8
  16. package/dist/process-definitions.d.ts.map +1 -1
  17. package/dist/process-model-config.d.ts +18 -0
  18. package/dist/process-model-config.d.ts.map +1 -1
  19. package/dist/process-row-slots.d.ts +14 -0
  20. package/dist/process-row-slots.d.ts.map +1 -1
  21. package/dist/process-state-json.d.ts +13 -0
  22. package/dist/process-state-json.d.ts.map +1 -1
  23. package/dist/repo-locator.d.ts +8 -0
  24. package/dist/repo-locator.d.ts.map +1 -1
  25. package/dist/semantic-entry-refs.d.ts +22 -0
  26. package/dist/semantic-entry-refs.d.ts.map +1 -1
  27. package/dist/startup-observation.d.ts +75 -0
  28. package/dist/startup-observation.d.ts.map +1 -0
  29. package/dist/string-normalize.d.ts +10 -0
  30. package/dist/string-normalize.d.ts.map +1 -1
  31. package/dist/turn-acceptance.d.ts +2 -0
  32. package/dist/turn-acceptance.d.ts.map +1 -1
  33. package/dist/turn-annotations.d.ts +27 -0
  34. package/dist/turn-annotations.d.ts.map +1 -1
  35. package/dist/turn-recovery.d.ts +30 -1
  36. package/dist/turn-recovery.d.ts.map +1 -1
  37. package/dist/turn-start-resolution.d.ts +48 -1
  38. package/dist/turn-start-resolution.d.ts.map +1 -1
  39. package/dist/unknown-record.d.ts +8 -0
  40. package/dist/unknown-record.d.ts.map +1 -0
  41. package/package.json +2 -2
  42. package/src/actor.ts +8 -10
  43. package/src/domain-model.ts +511 -80
  44. package/src/index.ts +18 -38
  45. package/src/launcher-recent-values.ts +11 -11
  46. package/src/markdown-normalize.ts +3 -0
  47. package/src/number-normalize.ts +11 -0
  48. package/src/process-definitions.ts +37 -8
  49. package/src/process-model-config.ts +27 -1
  50. package/src/process-row-slots.ts +14 -0
  51. package/src/process-state-json.ts +13 -0
  52. package/src/repo-locator.ts +10 -6
  53. package/src/semantic-entry-refs.ts +40 -22
  54. package/src/startup-observation.ts +106 -0
  55. package/src/string-normalize.ts +38 -0
  56. package/src/turn-acceptance.ts +2 -0
  57. package/src/turn-annotations.ts +34 -21
  58. package/src/turn-recovery.ts +38 -8
  59. package/src/turn-start-resolution.ts +70 -30
  60. package/src/unknown-record.ts +18 -0
  61. package/dist/actor.js +0 -62
  62. package/dist/actor.js.map +0 -1
  63. package/dist/domain-model.js +0 -169
  64. package/dist/domain-model.js.map +0 -1
  65. package/dist/launcher-recent-values.js +0 -60
  66. package/dist/launcher-recent-values.js.map +0 -1
  67. package/dist/markdown-normalize.js +0 -14
  68. package/dist/markdown-normalize.js.map +0 -1
  69. package/dist/process-definitions.js +0 -2
  70. package/dist/process-definitions.js.map +0 -1
  71. package/dist/process-model-config.js +0 -68
  72. package/dist/process-model-config.js.map +0 -1
  73. package/dist/process-row-slots.js +0 -45
  74. package/dist/process-row-slots.js.map +0 -1
  75. package/dist/process-state-json.js +0 -102
  76. package/dist/process-state-json.js.map +0 -1
  77. package/dist/repo-locator.js +0 -82
  78. package/dist/repo-locator.js.map +0 -1
  79. package/dist/semantic-entry-refs.js +0 -79
  80. package/dist/semantic-entry-refs.js.map +0 -1
  81. package/dist/string-normalize.js +0 -28
  82. package/dist/string-normalize.js.map +0 -1
  83. package/dist/turn-acceptance.js +0 -2
  84. package/dist/turn-acceptance.js.map +0 -1
  85. package/dist/turn-annotations.js +0 -49
  86. package/dist/turn-annotations.js.map +0 -1
  87. package/dist/turn-progress.d.ts +0 -4
  88. package/dist/turn-progress.d.ts.map +0 -1
  89. package/dist/turn-progress.js +0 -10
  90. package/dist/turn-progress.js.map +0 -1
  91. package/dist/turn-recovery.js +0 -70
  92. package/dist/turn-recovery.js.map +0 -1
  93. package/dist/turn-start-resolution.js +0 -97
  94. package/dist/turn-start-resolution.js.map +0 -1
  95. package/src/turn-progress.ts +0 -15
package/src/index.ts CHANGED
@@ -6,7 +6,6 @@ export {
6
6
  } from "./actor.js";
7
7
  export type {
8
8
  Actor,
9
- ActorKind,
10
9
  CurrentExecutionRef,
11
10
  DurableModelSelection,
12
11
  ExternalWriteLog,
@@ -17,12 +16,13 @@ export type {
17
16
  FutureExecutionScheduleKind,
18
17
  InputKind,
19
18
  InputSource,
20
- JsonObject,
21
- LlmContextMode,
22
- ModelPolicyFailureCode,
19
+ LaunchChecklistStep,
20
+ LaunchChecklistStepStatus,
21
+ LaunchOrigin,
22
+ LaunchRun,
23
+ LaunchRunStatus,
23
24
  ModelSelectionKind,
24
25
  ModelSelectionProvenance,
25
- ModelSelectionSource,
26
26
  NormalizedQuestion,
27
27
  PreparedTurnStart,
28
28
  ProcessCustomizableFields,
@@ -35,13 +35,17 @@ export type {
35
35
  ProcessLifecycleStatus,
36
36
  ProcessProject,
37
37
  ProcessQuestionRequest,
38
+ ProcessRelation,
38
39
  ProcessSelectedTurnModelSource,
40
+ ProcessToolApprovalDestination,
41
+ ProcessToolApprovalRequest,
39
42
  ProcessTurnRecord,
40
43
  ProcessTurnRecordPathType,
41
44
  ProcessTurnRecordStatus,
42
45
  ProcessTurnType,
43
46
  QuestionAnswerDraft,
44
47
  ResolvedTurnStart,
48
+ ToolApprovalStatus,
45
49
  TransitionTrigger,
46
50
  TurnFailedPayload,
47
51
  TurnFailureCode,
@@ -49,7 +53,6 @@ export type {
49
53
  TurnOutcomePayload,
50
54
  TurnProgressLink,
51
55
  TurnProgressReport,
52
- TurnProgressStep,
53
56
  TurnProgressStepStatus,
54
57
  TurnStartContinuation,
55
58
  TurnStartKind,
@@ -74,7 +77,6 @@ export {
74
77
  isWorkerOwnedTurnType,
75
78
  lifecycleStatusForSelectedTurnType,
76
79
  normalizeAskQuestionsInput,
77
- PROCESS_SELECTED_TURN_MODEL_SOURCES,
78
80
  PROCESS_TURN_RECORD_PATH_TYPES,
79
81
  PROCESS_TURN_TYPES,
80
82
  SYSTEM_ACTOR,
@@ -92,12 +94,11 @@ export {
92
94
  normalizeMarkdownText,
93
95
  normalizeOptionalMarkdown,
94
96
  } from "./markdown-normalize.js";
97
+ export { readFiniteNumber } from "./number-normalize.js";
95
98
  export type {
96
99
  ProcessFlowEdge,
97
- ProcessFlowEdgeKind,
98
100
  ProcessFlowEndState,
99
101
  ProcessFlowNode,
100
- ProcessFlowNodeRole,
101
102
  ProcessFlowView,
102
103
  ProcessTurnTerminalLifecycleStatus,
103
104
  ProcessTurnTransition,
@@ -106,7 +107,6 @@ export type {
106
107
  export {
107
108
  type InstanceTurnConfigInput,
108
109
  type InstanceTurnConfigMap,
109
- type InstanceTurnConfigsJsonError,
110
110
  type LaunchModelConfigInput,
111
111
  normalizeLaunchModelConfigInput,
112
112
  parseStrictInstanceTurnConfigsJson,
@@ -114,17 +114,14 @@ export {
114
114
  } from "./process-model-config.js";
115
115
  export {
116
116
  buildProcessRowSlot,
117
- getProcessStatusCategory,
118
117
  type ProcessRowSlot,
119
118
  sortProcessRows,
120
119
  } from "./process-row-slots.js";
121
120
  export {
122
- type ProcessStateJsonParseContext,
123
121
  parseProcessStateJsonLenient,
124
122
  parseProcessStateJsonStrict,
125
123
  parseProductRefsFromStateJsonLenient,
126
124
  parseProductRefsFromStateJsonStrict,
127
- parseProductRefsLenient,
128
125
  parseProductRefsStrict,
129
126
  parseSemanticEntryRefsFromStateJsonLenient,
130
127
  parseSemanticEntryRefsFromStateJsonStrict,
@@ -134,12 +131,10 @@ export {
134
131
  export {
135
132
  assertRepoLocator,
136
133
  detectRepoLocatorKind,
137
- isRepoLocator,
138
- type ParsedRepoLocator,
139
134
  parseRepoLocator,
140
- type RepoLocatorKind,
141
135
  } from "./repo-locator.js";
142
136
  export {
137
+ areSemanticEntryRefsEqual,
143
138
  assertValidProcessProductName,
144
139
  createEmptyProcessProductRefs,
145
140
  createEmptyProcessSemanticEntryRefs,
@@ -155,51 +150,35 @@ export {
155
150
  parseSemanticEntryRef,
156
151
  type SemanticEntryRef,
157
152
  } from "./semantic-entry-refs.js";
153
+ export * from "./startup-observation.js";
158
154
  export {
155
+ formatProcessIdentifier,
159
156
  humanizeProcessLabel,
160
157
  normalizeStringArray,
158
+ readNonBlankString,
159
+ toErrorMessage,
161
160
  trimString,
162
161
  trimToNull,
163
162
  } from "./string-normalize.js";
164
- export { TURN_ACCEPTANCE_STATES, type TurnAcceptanceState } from "./turn-acceptance.js";
163
+ export type { TurnAcceptanceState } from "./turn-acceptance.js";
165
164
  export {
166
- type EntryTurnAnnotationReference,
167
165
  type ProcessTurnAnnotation,
168
- parseTurnAnnotationReference,
169
166
  parseTurnAnnotationReferences,
170
- type SemanticEntryRefTurnAnnotationReference,
171
- TURN_ANNOTATION_REFERENCE_KINDS,
172
167
  type TurnAnnotationReference,
173
- type TurnAnnotationReferenceKind,
174
- type TurnAnnotationReferenceRole,
175
- type TurnRecordAnnotationReference,
176
168
  } from "./turn-annotations.js";
177
- export {
178
- AUTOMATIC_TURN_FAILED_PROGRESS_DETAIL,
179
- failActiveTurnProgress,
180
- } from "./turn-progress.js";
181
169
  export {
182
170
  buildFailedTurnRecoveryMetadata,
183
171
  CONTINUE_PROMPT_METADATA_KEY,
184
172
  createGenericFailedTurnRecoveryContext,
185
173
  DEFAULT_CONTINUE_PROMPT,
186
- FAILED_TURN_RECOVERY_CODES,
187
174
  FAILED_TURN_RECOVERY_METADATA_KEY,
188
175
  type FailedTurnRecoveryCode,
189
176
  type FailedTurnRecoveryContext,
190
- isFailedTurnRecoveryCode,
177
+ inferTerminalRecordingFailedTurnRecoveryContext,
191
178
  normalizeContinuePrompt,
192
179
  readFailedTurnRecoveryContext,
193
180
  } from "./turn-recovery.js";
194
181
  export {
195
- defaultProcessTurnStartSelection,
196
- type ProcessTurnStartFallback,
197
- type ProcessTurnStartFromCurrentLeaf,
198
- type ProcessTurnStartFromEntry,
199
- type ProcessTurnStartFromProductRef,
200
- type ProcessTurnStartFromSemanticRef,
201
- type ProcessTurnStartFromSessionRoot,
202
- type ProcessTurnStartResolution,
203
182
  type ProcessTurnStartSelection,
204
183
  type ProcessTurnStartTarget,
205
184
  resolveExistingProcessEntryId,
@@ -208,3 +187,4 @@ export {
208
187
  resolveProcessTurnStartSelection,
209
188
  resolveProcessTurnStartTarget,
210
189
  } from "./turn-start-resolution.js";
190
+ export { asUnknownRecord, copiedUnknownRecordSchema, isUnknownRecord } from "./unknown-record.js";
@@ -1,3 +1,4 @@
1
+ /** @internal */
1
2
  export const DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT = 5;
2
3
 
3
4
  function hasCredentialBearingAbsoluteUrl(value: string): boolean {
@@ -16,6 +17,7 @@ function hasCredentialBearingAbsoluteUrl(value: string): boolean {
16
17
  * Strip any embedded credentials (`user:pass@`) from an absolute non-`file:` URL,
17
18
  * returning the value unchanged when it is not such a URL.
18
19
  */
20
+ /** @internal */
19
21
  export function redactCredentialBearingAbsoluteUrl(value: string): string {
20
22
  if (!hasCredentialBearingAbsoluteUrl(value)) {
21
23
  return value;
@@ -26,37 +28,35 @@ export function redactCredentialBearingAbsoluteUrl(value: string): string {
26
28
  return url.toString();
27
29
  }
28
30
 
31
+ /** @internal */
29
32
  export function normalizeLauncherRecentValue(value: unknown): string | null {
30
33
  const normalizedValue = typeof value === "string" ? value.trim() : "";
31
- if (!normalizedValue) {
32
- return null;
33
- }
34
- if (hasCredentialBearingAbsoluteUrl(normalizedValue)) {
34
+ if (!normalizedValue || hasCredentialBearingAbsoluteUrl(normalizedValue)) {
35
35
  return null;
36
36
  }
37
37
  return normalizedValue;
38
38
  }
39
39
 
40
+ /** @internal */
40
41
  export function normalizeLauncherRecentValues(
41
42
  values: readonly unknown[],
42
43
  limit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,
43
44
  ): string[] {
44
- const nextValues: string[] = [];
45
- const seen = new Set<string>();
45
+ const nextValues = new Set<string>();
46
46
  for (const value of values) {
47
47
  const normalizedValue = normalizeLauncherRecentValue(value);
48
- if (!normalizedValue || seen.has(normalizedValue)) {
48
+ if (!normalizedValue || nextValues.has(normalizedValue)) {
49
49
  continue;
50
50
  }
51
- seen.add(normalizedValue);
52
- nextValues.push(normalizedValue);
53
- if (nextValues.length >= limit) {
51
+ nextValues.add(normalizedValue);
52
+ if (nextValues.size >= limit) {
54
53
  break;
55
54
  }
56
55
  }
57
- return nextValues;
56
+ return [...nextValues];
58
57
  }
59
58
 
59
+ /** @internal */
60
60
  export function addLauncherRecentValue(
61
61
  existingValues: readonly string[],
62
62
  value: string,
@@ -1,11 +1,14 @@
1
+ /** @internal */
1
2
  export function normalizeMarkdownLineEndings(markdown: string): string {
2
3
  return markdown.replace(/\r\n?/g, "\n");
3
4
  }
4
5
 
6
+ /** @internal */
5
7
  export function normalizeMarkdownText(markdown: string): string {
6
8
  return normalizeMarkdownLineEndings(markdown).trim();
7
9
  }
8
10
 
11
+ /** @internal */
9
12
  export function normalizeOptionalMarkdown(value: unknown): string | null {
10
13
  if (typeof value !== "string") {
11
14
  return null;
@@ -0,0 +1,11 @@
1
+ /** Accept finite numbers and non-blank numeric strings, without coercing other values. @internal */
2
+ export function readFiniteNumber(value: unknown): number | null {
3
+ if (typeof value === "number" && Number.isFinite(value)) {
4
+ return value;
5
+ }
6
+ if (typeof value === "string" && value.trim() !== "") {
7
+ const parsed = Number(value);
8
+ return Number.isFinite(parsed) ? parsed : null;
9
+ }
10
+ return null;
11
+ }
@@ -1,26 +1,36 @@
1
1
  import type { ProcessLifecycleStatus, ProcessTurnType, TurnId } from "./domain-model.js";
2
2
 
3
+ /** @public */
3
4
  export type ProcessTurnTerminalLifecycleStatus = Extract<
4
5
  ProcessLifecycleStatus,
5
6
  "completed" | "aborted"
6
7
  >;
7
8
 
9
+ /** @internal */
8
10
  export interface ProcessTurnTransition {
11
+ /** @internal */
9
12
  nextTurnId?: TurnId;
13
+ /** @internal */
10
14
  lifecycleStatus?: ProcessTurnTerminalLifecycleStatus;
15
+ /** @internal */
11
16
  outcome?: string;
17
+ /** @internal */
12
18
  trigger?: string;
13
19
  }
14
20
 
15
- /** Wire DTO used by HTTP clients that need serialized process graph data. */
21
+ /** Wire DTO used by HTTP clients that need serialized process graph data. @internal */
16
22
  export interface SerializedProcessGraph {
23
+ /** @internal */
17
24
  id: string;
25
+ /** @internal */
18
26
  entryTurnIds: TurnId[];
27
+ /** @internal */
19
28
  reachableTurnIds: TurnId[];
29
+ /** @internal */
20
30
  turnTransitions: Record<TurnId, ProcessTurnTransition[]>;
21
31
  }
22
32
 
23
- /** Whether a flow node sits on the declared happy path (`spine`) or hangs off it (`branch`). */
33
+ /** Whether a flow node sits on the declared happy path (`spine`) or hangs off it (`branch`). @internal */
24
34
  export type ProcessFlowNodeRole = "spine" | "branch";
25
35
 
26
36
  /**
@@ -30,38 +40,50 @@ export type ProcessFlowNodeRole = "spine" | "branch";
30
40
  * - `branch`: leaves the spine toward an offshoot node
31
41
  * - `terminal`: ends the process with a lifecycle status
32
42
  */
43
+ /** @internal */
33
44
  export type ProcessFlowEdgeKind = "forward" | "loopback" | "branch" | "terminal";
34
45
 
46
+ /** @internal */
35
47
  export interface ProcessFlowNode {
48
+ /** @internal */
36
49
  turnId: TurnId;
50
+ /** @internal */
37
51
  description: string;
52
+ /** @internal */
38
53
  turnType: ProcessTurnType;
54
+ /** @internal */
39
55
  role: ProcessFlowNodeRole;
40
- /** Position on the spine when `role === "spine"`, otherwise `null`. */
56
+ /** Position on the spine when `role === "spine"`, otherwise `null`. @internal */
41
57
  spineIndex: number | null;
42
- /** The spine node this branch hangs off, when derivable. `null` for spine nodes. */
58
+ /** The spine node this branch hangs off, when derivable. `null` for spine nodes. @internal */
43
59
  anchorTurnId: TurnId | null;
44
- /** True when this turn is a launch entry point. */
60
+ /** True when this turn is a launch entry point. @internal */
45
61
  isEntry: boolean;
46
62
  }
47
63
 
64
+ /** @internal */
48
65
  export interface ProcessFlowEdge {
66
+ /** @internal */
49
67
  from: TurnId;
50
- /** Target turn for non-terminal edges. */
68
+ /** Target turn for non-terminal edges. @internal */
51
69
  to: TurnId | null;
52
- /** Lifecycle status for `terminal` edges. */
70
+ /** Lifecycle status for `terminal` edges. @internal */
53
71
  lifecycleStatus: ProcessTurnTerminalLifecycleStatus | null;
72
+ /** @internal */
54
73
  kind: ProcessFlowEdgeKind;
55
- /** Optional human-facing edge label derived from outcome/trigger metadata. */
74
+ /** Optional human-facing edge label derived from outcome/trigger metadata. @internal */
56
75
  label: string | null;
57
76
  }
58
77
 
78
+ /** @internal */
59
79
  export interface ProcessFlowEndState {
80
+ /** @internal */
60
81
  lifecycleStatus: ProcessTurnTerminalLifecycleStatus;
61
82
  /**
62
83
  * True when the end state is not reached by an explicit graph transition.
63
84
  * Abort is always reachable from any active turn, so it is synthesized.
64
85
  */
86
+ /** @internal */
65
87
  synthetic: boolean;
66
88
  }
67
89
 
@@ -69,11 +91,18 @@ export interface ProcessFlowEndState {
69
91
  * Spine-first projection of a process graph for operator-facing flow diagrams.
70
92
  * The `spine` is the happy path; everything else hangs off it as branches and loops.
71
93
  */
94
+ /** @internal */
72
95
  export interface ProcessFlowView {
96
+ /** @internal */
73
97
  processId: string;
98
+ /** @internal */
74
99
  entryTurnIds: TurnId[];
100
+ /** @internal */
75
101
  spine: TurnId[];
102
+ /** @internal */
76
103
  nodes: ProcessFlowNode[];
104
+ /** @internal */
77
105
  edges: ProcessFlowEdge[];
106
+ /** @internal */
78
107
  endStates: ProcessFlowEndState[];
79
108
  }
@@ -1,21 +1,32 @@
1
1
  import * as v from "valibot";
2
2
  import { trimToNull } from "./string-normalize.js";
3
3
 
4
+ /** @internal */
4
5
  export interface InstanceTurnConfigInput {
6
+ /** @internal */
5
7
  modelProfileId?: string | null;
6
8
  }
7
9
 
10
+ /** @internal */
8
11
  export type InstanceTurnConfigMap = Record<string, InstanceTurnConfigInput>;
9
12
 
13
+ /** @public */
10
14
  export interface LaunchModelConfigInput {
15
+ /** @internal */
11
16
  defaultModelProfileId?: string | null;
17
+ /** @internal */
12
18
  turnConfigs?: InstanceTurnConfigMap;
13
19
  }
14
20
 
21
+ /** @internal */
15
22
  export interface InstanceTurnConfigsJsonError {
23
+ /** @internal */
16
24
  code: "invalid_turn_configs_json";
25
+ /** @internal */
17
26
  processId: string;
27
+ /** @internal */
18
28
  reason: "invalid_json" | "not_object" | "turn_config_not_object";
29
+ /** @internal */
19
30
  turnId?: string;
20
31
  }
21
32
 
@@ -55,10 +66,23 @@ function getFirstIssuePathKey(issue: v.BaseIssue<unknown>): string | undefined {
55
66
  return typeof pathItem?.key === "string" ? pathItem.key : undefined;
56
67
  }
57
68
 
69
+ /** @internal */
58
70
  export function parseStrictInstanceTurnConfigsJson(
59
71
  processId: string,
60
72
  turnConfigsJson: string | null | undefined,
61
- ): { ok: true; value: InstanceTurnConfigMap } | { ok: false; error: InstanceTurnConfigsJsonError } {
73
+ ):
74
+ | {
75
+ /** @internal */
76
+ ok: true;
77
+ /** @internal */
78
+ value: InstanceTurnConfigMap;
79
+ }
80
+ | {
81
+ /** @internal */
82
+ ok: false;
83
+ /** @internal */
84
+ error: InstanceTurnConfigsJsonError;
85
+ } {
62
86
  if (!turnConfigsJson) return { ok: true, value: {} };
63
87
  const result = v.safeParse(strictInstanceTurnConfigsJsonSchema, turnConfigsJson, {
64
88
  abortEarly: true,
@@ -85,6 +109,7 @@ export function parseStrictInstanceTurnConfigsJson(
85
109
  return { ok: true, value: normalizeInstanceTurnConfigs(result.output) };
86
110
  }
87
111
 
112
+ /** @internal */
88
113
  export function serializeInstanceTurnConfigs(turnConfigs: InstanceTurnConfigMap): string | null {
89
114
  const normalizedEntries = Object.entries(turnConfigs)
90
115
  .map(([turnId, turnConfig]) => {
@@ -97,6 +122,7 @@ export function serializeInstanceTurnConfigs(turnConfigs: InstanceTurnConfigMap)
97
122
  : JSON.stringify(Object.fromEntries(normalizedEntries));
98
123
  }
99
124
 
125
+ /** @internal */
100
126
  export function normalizeLaunchModelConfigInput(
101
127
  input: LaunchModelConfigInput,
102
128
  ): LaunchModelConfigInput {
@@ -1,18 +1,30 @@
1
1
  import type { ProcessInstance, ProcessLifecycleStatus, ProcessProject } from "./domain-model.js";
2
2
 
3
+ /** @internal */
3
4
  export interface ProcessRowSlot {
5
+ /** @internal */
4
6
  instanceId: string;
7
+ /** @internal */
5
8
  processId: string;
9
+ /** @internal */
6
10
  title: string;
11
+ /** @internal */
7
12
  subtitle: string;
13
+ /** @internal */
8
14
  selectedTurnId: string | null;
15
+ /** @internal */
9
16
  lifecycleStatus: ProcessLifecycleStatus;
17
+ /** @internal */
10
18
  statusCategory: "error" | "active" | "waiting" | "terminal" | "discovered";
19
+ /** @internal */
11
20
  projectCount: number;
21
+ /** @internal */
12
22
  externalId: string | null;
23
+ /** @internal */
13
24
  externalLinkCount: number;
14
25
  }
15
26
 
27
+ /** @internal */
16
28
  export function getProcessStatusCategory(
17
29
  lifecycleStatus: ProcessLifecycleStatus,
18
30
  ): ProcessRowSlot["statusCategory"] {
@@ -23,6 +35,7 @@ export function getProcessStatusCategory(
23
35
  return "discovered";
24
36
  }
25
37
 
38
+ /** @internal */
26
39
  export function buildProcessRowSlot(
27
40
  process: ProcessInstance,
28
41
  projects: ReadonlyArray<ProcessProject>,
@@ -46,6 +59,7 @@ export function buildProcessRowSlot(
46
59
  };
47
60
  }
48
61
 
62
+ /** @internal */
49
63
  export function sortProcessRows(rows: ProcessRowSlot[]): ProcessRowSlot[] {
50
64
  const categoryOrder: Record<string, number> = {
51
65
  error: 0,
@@ -8,8 +8,11 @@ import {
8
8
  parseSemanticEntryRef,
9
9
  } from "./semantic-entry-refs.js";
10
10
 
11
+ /** @internal */
11
12
  export interface ProcessStateJsonParseContext {
13
+ /** @internal */
12
14
  label?: string;
15
+ /** @internal */
13
16
  processId?: string;
14
17
  }
15
18
 
@@ -24,6 +27,7 @@ function formatMalformedSubject(
24
27
  return context?.processId ? `${label} for process '${context.processId}'` : label;
25
28
  }
26
29
 
30
+ /** @internal */
27
31
  export function parseProcessStateJsonStrict(
28
32
  stateJson: string | null | undefined,
29
33
  context?: string | ProcessStateJsonParseContext,
@@ -46,6 +50,7 @@ export function parseProcessStateJsonStrict(
46
50
  return parsed as Record<string, unknown>;
47
51
  }
48
52
 
53
+ /** @internal */
49
54
  export function parseProcessStateJsonLenient(
50
55
  stateJson: string | null | undefined,
51
56
  ): Record<string, unknown> {
@@ -56,6 +61,7 @@ export function parseProcessStateJsonLenient(
56
61
  }
57
62
  }
58
63
 
64
+ /** @internal */
59
65
  export function parseSemanticEntryRefsStrict(
60
66
  value: unknown,
61
67
  context?: ProcessStateJsonParseContext,
@@ -74,6 +80,7 @@ export function parseSemanticEntryRefsStrict(
74
80
  return parseProcessSemanticEntryRefs(value);
75
81
  }
76
82
 
83
+ /** @internal */
77
84
  export function parseSemanticEntryRefsLenient(value: unknown): ProcessSemanticEntryRefs {
78
85
  try {
79
86
  return parseSemanticEntryRefsStrict(value);
@@ -82,6 +89,7 @@ export function parseSemanticEntryRefsLenient(value: unknown): ProcessSemanticEn
82
89
  }
83
90
  }
84
91
 
92
+ /** @internal */
85
93
  export function parseProductRefsStrict(
86
94
  value: unknown,
87
95
  context?: ProcessStateJsonParseContext,
@@ -110,6 +118,7 @@ export function parseProductRefsStrict(
110
118
  return refs;
111
119
  }
112
120
 
121
+ /** @internal */
113
122
  export function parseProductRefsLenient(value: unknown): ProcessProductRefs {
114
123
  try {
115
124
  return parseProductRefsStrict(value);
@@ -118,6 +127,7 @@ export function parseProductRefsLenient(value: unknown): ProcessProductRefs {
118
127
  }
119
128
  }
120
129
 
130
+ /** @internal */
121
131
  export function parseSemanticEntryRefsFromStateJsonStrict(
122
132
  stateJson: string | null | undefined,
123
133
  context?: string | ProcessStateJsonParseContext,
@@ -129,6 +139,7 @@ export function parseSemanticEntryRefsFromStateJsonStrict(
129
139
  );
130
140
  }
131
141
 
142
+ /** @internal */
132
143
  export function parseSemanticEntryRefsFromStateJsonLenient(
133
144
  stateJson: string | null | undefined,
134
145
  ): ProcessSemanticEntryRefs {
@@ -136,6 +147,7 @@ export function parseSemanticEntryRefsFromStateJsonLenient(
136
147
  return parseSemanticEntryRefsLenient(stateRecord.semanticEntryRefs);
137
148
  }
138
149
 
150
+ /** @internal */
139
151
  export function parseProductRefsFromStateJsonStrict(
140
152
  stateJson: string | null | undefined,
141
153
  context?: string | ProcessStateJsonParseContext,
@@ -147,6 +159,7 @@ export function parseProductRefsFromStateJsonStrict(
147
159
  );
148
160
  }
149
161
 
162
+ /** @internal */
150
163
  export function parseProductRefsFromStateJsonLenient(
151
164
  stateJson: string | null | undefined,
152
165
  ): ProcessProductRefs {
@@ -1,14 +1,14 @@
1
+ /** @internal */
1
2
  export type RepoLocatorKind = "remote_url" | "local_path";
2
3
 
4
+ /** @internal */
3
5
  export interface ParsedRepoLocator {
6
+ /** @internal */
4
7
  kind: RepoLocatorKind;
8
+ /** @internal */
5
9
  value: string;
6
10
  }
7
11
 
8
- function trimRepoLocator(value: string): string {
9
- return value.trim();
10
- }
11
-
12
12
  function isFileUrl(value: string): boolean {
13
13
  try {
14
14
  const url = new URL(value);
@@ -62,8 +62,9 @@ function isRemoteGitUrl(value: string): boolean {
62
62
  }
63
63
  }
64
64
 
65
+ /** @internal */
65
66
  export function detectRepoLocatorKind(value: string): RepoLocatorKind | null {
66
- const trimmed = trimRepoLocator(value);
67
+ const trimmed = value.trim();
67
68
  if (trimmed.length === 0) {
68
69
  return null;
69
70
  }
@@ -76,11 +77,12 @@ export function detectRepoLocatorKind(value: string): RepoLocatorKind | null {
76
77
  return null;
77
78
  }
78
79
 
80
+ /** @internal */
79
81
  export function parseRepoLocator(value: unknown): ParsedRepoLocator | null {
80
82
  if (typeof value !== "string") {
81
83
  return null;
82
84
  }
83
- const trimmed = trimRepoLocator(value);
85
+ const trimmed = value.trim();
84
86
  const kind = detectRepoLocatorKind(trimmed);
85
87
  if (!kind) {
86
88
  return null;
@@ -88,10 +90,12 @@ export function parseRepoLocator(value: unknown): ParsedRepoLocator | null {
88
90
  return { kind, value: trimmed };
89
91
  }
90
92
 
93
+ /** @internal */
91
94
  export function isRepoLocator(value: unknown): value is string {
92
95
  return parseRepoLocator(value) !== null;
93
96
  }
94
97
 
98
+ /** @internal */
95
99
  export function assertRepoLocator(value: unknown, fieldName = "repoLocator"): string {
96
100
  const parsed = parseRepoLocator(value);
97
101
  if (!parsed) {