@leitwerk-dev/domain 0.2.0 → 0.3.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.
- package/dist/actor.d.ts +4 -2
- package/dist/actor.d.ts.map +1 -1
- package/dist/domain-model.d.ts +397 -64
- package/dist/domain-model.d.ts.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -21
- package/dist/index.js.map +1 -1
- package/dist/launcher-recent-values.d.ts +5 -0
- package/dist/launcher-recent-values.d.ts.map +1 -1
- package/dist/markdown-normalize.d.ts +3 -0
- package/dist/markdown-normalize.d.ts.map +1 -1
- package/dist/number-normalize.d.ts +1 -1
- package/dist/number-normalize.d.ts.map +1 -1
- package/dist/process-definitions.d.ts +37 -8
- package/dist/process-definitions.d.ts.map +1 -1
- package/dist/process-model-config.d.ts +18 -0
- package/dist/process-model-config.d.ts.map +1 -1
- package/dist/process-row-slots.d.ts +14 -0
- package/dist/process-row-slots.d.ts.map +1 -1
- package/dist/process-state-json.d.ts +13 -0
- package/dist/process-state-json.d.ts.map +1 -1
- package/dist/repo-locator.d.ts +8 -0
- package/dist/repo-locator.d.ts.map +1 -1
- package/dist/semantic-entry-refs.d.ts +21 -0
- package/dist/semantic-entry-refs.d.ts.map +1 -1
- package/dist/startup-observation.d.ts +35 -2
- package/dist/startup-observation.d.ts.map +1 -1
- package/dist/string-normalize.d.ts +7 -2
- package/dist/string-normalize.d.ts.map +1 -1
- package/dist/turn-acceptance.d.ts +2 -0
- package/dist/turn-acceptance.d.ts.map +1 -1
- package/dist/turn-annotations.d.ts +27 -0
- package/dist/turn-annotations.d.ts.map +1 -1
- package/dist/turn-recovery.d.ts +24 -0
- package/dist/turn-recovery.d.ts.map +1 -1
- package/dist/turn-start-resolution.d.ts +48 -1
- package/dist/turn-start-resolution.d.ts.map +1 -1
- package/dist/unknown-record.d.ts +3 -1
- package/dist/unknown-record.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/actor.ts +4 -2
- package/src/domain-model.ts +428 -72
- package/src/index.ts +1 -34
- package/src/launcher-recent-values.ts +5 -0
- package/src/markdown-normalize.ts +3 -0
- package/src/number-normalize.ts +1 -1
- package/src/process-definitions.ts +37 -8
- package/src/process-model-config.ts +27 -1
- package/src/process-row-slots.ts +14 -0
- package/src/process-state-json.ts +13 -0
- package/src/repo-locator.ts +8 -0
- package/src/semantic-entry-refs.ts +21 -0
- package/src/startup-observation.ts +35 -2
- package/src/string-normalize.ts +7 -2
- package/src/turn-acceptance.ts +2 -0
- package/src/turn-annotations.ts +27 -0
- package/src/turn-recovery.ts +20 -0
- package/src/turn-start-resolution.ts +59 -5
- package/src/unknown-record.ts +3 -1
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,17 +16,13 @@ export type {
|
|
|
17
16
|
FutureExecutionScheduleKind,
|
|
18
17
|
InputKind,
|
|
19
18
|
InputSource,
|
|
20
|
-
JsonObject,
|
|
21
19
|
LaunchChecklistStep,
|
|
22
20
|
LaunchChecklistStepStatus,
|
|
23
21
|
LaunchOrigin,
|
|
24
22
|
LaunchRun,
|
|
25
23
|
LaunchRunStatus,
|
|
26
|
-
LlmContextMode,
|
|
27
|
-
ModelPolicyFailureCode,
|
|
28
24
|
ModelSelectionKind,
|
|
29
25
|
ModelSelectionProvenance,
|
|
30
|
-
ModelSelectionSource,
|
|
31
26
|
NormalizedQuestion,
|
|
32
27
|
PreparedTurnStart,
|
|
33
28
|
ProcessCustomizableFields,
|
|
@@ -58,7 +53,6 @@ export type {
|
|
|
58
53
|
TurnOutcomePayload,
|
|
59
54
|
TurnProgressLink,
|
|
60
55
|
TurnProgressReport,
|
|
61
|
-
TurnProgressStep,
|
|
62
56
|
TurnProgressStepStatus,
|
|
63
57
|
TurnStartContinuation,
|
|
64
58
|
TurnStartKind,
|
|
@@ -83,7 +77,6 @@ export {
|
|
|
83
77
|
isWorkerOwnedTurnType,
|
|
84
78
|
lifecycleStatusForSelectedTurnType,
|
|
85
79
|
normalizeAskQuestionsInput,
|
|
86
|
-
PROCESS_SELECTED_TURN_MODEL_SOURCES,
|
|
87
80
|
PROCESS_TURN_RECORD_PATH_TYPES,
|
|
88
81
|
PROCESS_TURN_TYPES,
|
|
89
82
|
SYSTEM_ACTOR,
|
|
@@ -104,10 +97,8 @@ export {
|
|
|
104
97
|
export { readFiniteNumber } from "./number-normalize.js";
|
|
105
98
|
export type {
|
|
106
99
|
ProcessFlowEdge,
|
|
107
|
-
ProcessFlowEdgeKind,
|
|
108
100
|
ProcessFlowEndState,
|
|
109
101
|
ProcessFlowNode,
|
|
110
|
-
ProcessFlowNodeRole,
|
|
111
102
|
ProcessFlowView,
|
|
112
103
|
ProcessTurnTerminalLifecycleStatus,
|
|
113
104
|
ProcessTurnTransition,
|
|
@@ -116,7 +107,6 @@ export type {
|
|
|
116
107
|
export {
|
|
117
108
|
type InstanceTurnConfigInput,
|
|
118
109
|
type InstanceTurnConfigMap,
|
|
119
|
-
type InstanceTurnConfigsJsonError,
|
|
120
110
|
type LaunchModelConfigInput,
|
|
121
111
|
normalizeLaunchModelConfigInput,
|
|
122
112
|
parseStrictInstanceTurnConfigsJson,
|
|
@@ -124,17 +114,14 @@ export {
|
|
|
124
114
|
} from "./process-model-config.js";
|
|
125
115
|
export {
|
|
126
116
|
buildProcessRowSlot,
|
|
127
|
-
getProcessStatusCategory,
|
|
128
117
|
type ProcessRowSlot,
|
|
129
118
|
sortProcessRows,
|
|
130
119
|
} from "./process-row-slots.js";
|
|
131
120
|
export {
|
|
132
|
-
type ProcessStateJsonParseContext,
|
|
133
121
|
parseProcessStateJsonLenient,
|
|
134
122
|
parseProcessStateJsonStrict,
|
|
135
123
|
parseProductRefsFromStateJsonLenient,
|
|
136
124
|
parseProductRefsFromStateJsonStrict,
|
|
137
|
-
parseProductRefsLenient,
|
|
138
125
|
parseProductRefsStrict,
|
|
139
126
|
parseSemanticEntryRefsFromStateJsonLenient,
|
|
140
127
|
parseSemanticEntryRefsFromStateJsonStrict,
|
|
@@ -144,10 +131,7 @@ export {
|
|
|
144
131
|
export {
|
|
145
132
|
assertRepoLocator,
|
|
146
133
|
detectRepoLocatorKind,
|
|
147
|
-
isRepoLocator,
|
|
148
|
-
type ParsedRepoLocator,
|
|
149
134
|
parseRepoLocator,
|
|
150
|
-
type RepoLocatorKind,
|
|
151
135
|
} from "./repo-locator.js";
|
|
152
136
|
export {
|
|
153
137
|
areSemanticEntryRefsEqual,
|
|
@@ -176,42 +160,25 @@ export {
|
|
|
176
160
|
trimString,
|
|
177
161
|
trimToNull,
|
|
178
162
|
} from "./string-normalize.js";
|
|
179
|
-
export {
|
|
163
|
+
export type { TurnAcceptanceState } from "./turn-acceptance.js";
|
|
180
164
|
export {
|
|
181
|
-
type EntryTurnAnnotationReference,
|
|
182
165
|
type ProcessTurnAnnotation,
|
|
183
|
-
parseTurnAnnotationReference,
|
|
184
166
|
parseTurnAnnotationReferences,
|
|
185
|
-
type SemanticEntryRefTurnAnnotationReference,
|
|
186
|
-
TURN_ANNOTATION_REFERENCE_KINDS,
|
|
187
167
|
type TurnAnnotationReference,
|
|
188
|
-
type TurnAnnotationReferenceKind,
|
|
189
|
-
type TurnAnnotationReferenceRole,
|
|
190
|
-
type TurnRecordAnnotationReference,
|
|
191
168
|
} from "./turn-annotations.js";
|
|
192
169
|
export {
|
|
193
170
|
buildFailedTurnRecoveryMetadata,
|
|
194
171
|
CONTINUE_PROMPT_METADATA_KEY,
|
|
195
172
|
createGenericFailedTurnRecoveryContext,
|
|
196
173
|
DEFAULT_CONTINUE_PROMPT,
|
|
197
|
-
FAILED_TURN_RECOVERY_CODES,
|
|
198
174
|
FAILED_TURN_RECOVERY_METADATA_KEY,
|
|
199
175
|
type FailedTurnRecoveryCode,
|
|
200
176
|
type FailedTurnRecoveryContext,
|
|
201
177
|
inferTerminalRecordingFailedTurnRecoveryContext,
|
|
202
|
-
isFailedTurnRecoveryCode,
|
|
203
178
|
normalizeContinuePrompt,
|
|
204
179
|
readFailedTurnRecoveryContext,
|
|
205
180
|
} from "./turn-recovery.js";
|
|
206
181
|
export {
|
|
207
|
-
defaultProcessTurnStartSelection,
|
|
208
|
-
type ProcessTurnStartFallback,
|
|
209
|
-
type ProcessTurnStartFromCurrentLeaf,
|
|
210
|
-
type ProcessTurnStartFromEntry,
|
|
211
|
-
type ProcessTurnStartFromProductRef,
|
|
212
|
-
type ProcessTurnStartFromSemanticRef,
|
|
213
|
-
type ProcessTurnStartFromSessionRoot,
|
|
214
|
-
type ProcessTurnStartResolution,
|
|
215
182
|
type ProcessTurnStartSelection,
|
|
216
183
|
type ProcessTurnStartTarget,
|
|
217
184
|
resolveExistingProcessEntryId,
|
|
@@ -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,6 +28,7 @@ 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
34
|
if (!normalizedValue || hasCredentialBearingAbsoluteUrl(normalizedValue)) {
|
|
@@ -34,6 +37,7 @@ export function normalizeLauncherRecentValue(value: unknown): string | null {
|
|
|
34
37
|
return normalizedValue;
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/** @internal */
|
|
37
41
|
export function normalizeLauncherRecentValues(
|
|
38
42
|
values: readonly unknown[],
|
|
39
43
|
limit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,
|
|
@@ -52,6 +56,7 @@ export function normalizeLauncherRecentValues(
|
|
|
52
56
|
return [...nextValues];
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
/** @internal */
|
|
55
60
|
export function addLauncherRecentValue(
|
|
56
61
|
existingValues: readonly string[],
|
|
57
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;
|
package/src/number-normalize.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Accept finite numbers and non-blank numeric strings, without coercing other values. */
|
|
1
|
+
/** Accept finite numbers and non-blank numeric strings, without coercing other values. @internal */
|
|
2
2
|
export function readFiniteNumber(value: unknown): number | null {
|
|
3
3
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4
4
|
return value;
|
|
@@ -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
|
-
):
|
|
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 {
|
package/src/process-row-slots.ts
CHANGED
|
@@ -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 {
|
package/src/repo-locator.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
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
|
|
|
@@ -58,6 +62,7 @@ function isRemoteGitUrl(value: string): boolean {
|
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
65
|
+
/** @internal */
|
|
61
66
|
export function detectRepoLocatorKind(value: string): RepoLocatorKind | null {
|
|
62
67
|
const trimmed = value.trim();
|
|
63
68
|
if (trimmed.length === 0) {
|
|
@@ -72,6 +77,7 @@ export function detectRepoLocatorKind(value: string): RepoLocatorKind | null {
|
|
|
72
77
|
return null;
|
|
73
78
|
}
|
|
74
79
|
|
|
80
|
+
/** @internal */
|
|
75
81
|
export function parseRepoLocator(value: unknown): ParsedRepoLocator | null {
|
|
76
82
|
if (typeof value !== "string") {
|
|
77
83
|
return null;
|
|
@@ -84,10 +90,12 @@ export function parseRepoLocator(value: unknown): ParsedRepoLocator | null {
|
|
|
84
90
|
return { kind, value: trimmed };
|
|
85
91
|
}
|
|
86
92
|
|
|
93
|
+
/** @internal */
|
|
87
94
|
export function isRepoLocator(value: unknown): value is string {
|
|
88
95
|
return parseRepoLocator(value) !== null;
|
|
89
96
|
}
|
|
90
97
|
|
|
98
|
+
/** @internal */
|
|
91
99
|
export function assertRepoLocator(value: unknown, fieldName = "repoLocator"): string {
|
|
92
100
|
const parsed = parseRepoLocator(value);
|
|
93
101
|
if (!parsed) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { trimToNull } from "./string-normalize.js";
|
|
2
2
|
import { asUnknownRecord, isUnknownRecord } from "./unknown-record.js";
|
|
3
3
|
|
|
4
|
+
/** @public */
|
|
4
5
|
export const PROCESS_SEMANTIC_ENTRY_REF_KEYS = [
|
|
5
6
|
"plan",
|
|
6
7
|
"review",
|
|
@@ -8,13 +9,18 @@ export const PROCESS_SEMANTIC_ENTRY_REF_KEYS = [
|
|
|
8
9
|
"rootEntry",
|
|
9
10
|
] as const;
|
|
10
11
|
|
|
12
|
+
/** @public */
|
|
11
13
|
export type ProcessSemanticEntryRefKey = (typeof PROCESS_SEMANTIC_ENTRY_REF_KEYS)[number];
|
|
12
14
|
|
|
15
|
+
/** @internal */
|
|
13
16
|
export interface SemanticEntryRef {
|
|
17
|
+
/** @internal */
|
|
14
18
|
entryId: string;
|
|
19
|
+
/** @internal */
|
|
15
20
|
turnRecordId: string | null;
|
|
16
21
|
}
|
|
17
22
|
|
|
23
|
+
/** @internal */
|
|
18
24
|
export function areSemanticEntryRefsEqual(
|
|
19
25
|
left: SemanticEntryRef | null | undefined,
|
|
20
26
|
right: SemanticEntryRef | null | undefined,
|
|
@@ -25,15 +31,19 @@ export function areSemanticEntryRefsEqual(
|
|
|
25
31
|
);
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
/** @internal */
|
|
28
35
|
export type ProcessProductRef = SemanticEntryRef;
|
|
36
|
+
/** @internal */
|
|
29
37
|
export type ProcessProductRefs = Record<string, ProcessProductRef>;
|
|
30
38
|
|
|
31
39
|
const PRODUCT_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
32
40
|
|
|
41
|
+
/** @internal */
|
|
33
42
|
export function isValidProcessProductName(value: string): boolean {
|
|
34
43
|
return PRODUCT_NAME_PATTERN.test(value);
|
|
35
44
|
}
|
|
36
45
|
|
|
46
|
+
/** @internal */
|
|
37
47
|
export function assertValidProcessProductName(value: string): void {
|
|
38
48
|
if (!isValidProcessProductName(value)) {
|
|
39
49
|
throw new Error(
|
|
@@ -53,17 +63,24 @@ export function assertValidProcessProductName(value: string): void {
|
|
|
53
63
|
* - `review` during successful review turns; it remains the current review until
|
|
54
64
|
* another review turn replaces it
|
|
55
65
|
*/
|
|
66
|
+
/** @internal */
|
|
56
67
|
export interface ProcessSemanticEntryRefs {
|
|
68
|
+
/** @internal */
|
|
57
69
|
plan: SemanticEntryRef | null;
|
|
70
|
+
/** @internal */
|
|
58
71
|
review: SemanticEntryRef | null;
|
|
72
|
+
/** @internal */
|
|
59
73
|
currentPrimaryPathLeaf: SemanticEntryRef | null;
|
|
74
|
+
/** @internal */
|
|
60
75
|
rootEntry: SemanticEntryRef | null;
|
|
61
76
|
}
|
|
62
77
|
|
|
78
|
+
/** @internal */
|
|
63
79
|
export function isProcessSemanticEntryRefKey(value: string): value is ProcessSemanticEntryRefKey {
|
|
64
80
|
return (PROCESS_SEMANTIC_ENTRY_REF_KEYS as readonly string[]).includes(value);
|
|
65
81
|
}
|
|
66
82
|
|
|
83
|
+
/** @internal */
|
|
67
84
|
export function parseSemanticEntryRef(value: unknown): SemanticEntryRef | null {
|
|
68
85
|
const record = asUnknownRecord(value);
|
|
69
86
|
const entryId = trimToNull(record?.entryId);
|
|
@@ -76,6 +93,7 @@ export function parseSemanticEntryRef(value: unknown): SemanticEntryRef | null {
|
|
|
76
93
|
};
|
|
77
94
|
}
|
|
78
95
|
|
|
96
|
+
/** @internal */
|
|
79
97
|
export function createEmptyProcessSemanticEntryRefs(): ProcessSemanticEntryRefs {
|
|
80
98
|
return {
|
|
81
99
|
plan: null,
|
|
@@ -85,10 +103,12 @@ export function createEmptyProcessSemanticEntryRefs(): ProcessSemanticEntryRefs
|
|
|
85
103
|
};
|
|
86
104
|
}
|
|
87
105
|
|
|
106
|
+
/** @internal */
|
|
88
107
|
export function createEmptyProcessProductRefs(): ProcessProductRefs {
|
|
89
108
|
return {};
|
|
90
109
|
}
|
|
91
110
|
|
|
111
|
+
/** @internal */
|
|
92
112
|
export function parseProcessProductRefs(value: unknown): ProcessProductRefs {
|
|
93
113
|
if (!isUnknownRecord(value)) return createEmptyProcessProductRefs();
|
|
94
114
|
const refs: ProcessProductRefs = {};
|
|
@@ -104,6 +124,7 @@ export function parseProcessProductRefs(value: unknown): ProcessProductRefs {
|
|
|
104
124
|
return refs;
|
|
105
125
|
}
|
|
106
126
|
|
|
127
|
+
/** @internal */
|
|
107
128
|
export function parseProcessSemanticEntryRefs(value: unknown): ProcessSemanticEntryRefs {
|
|
108
129
|
const record = asUnknownRecord(value) ?? {};
|
|
109
130
|
return {
|