@leitwerk-dev/server 0.5.2 → 0.5.4
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/{app-DZUsf76a.d.ts → app-B8gyS_Id.d.ts} +82 -76
- package/dist/app-XAQTAQ5Y.js +8 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/{chunk-AJ2DQWI3.js → chunk-6STQ3LAP.js} +133 -83
- package/dist/chunk-6STQ3LAP.js.map +1 -0
- package/dist/{chunk-6EEU4QOU.js → chunk-ZA5TDEM5.js} +302 -144
- package/dist/chunk-ZA5TDEM5.js.map +1 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/dashboard-model-issues.d.ts.map +1 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/launch-lifecycle.d.ts.map +1 -1
- package/dist/future-execution/lifecycle.d.ts.map +1 -1
- package/dist/future-execution/reconciliation.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/main.js +3 -3
- package/dist/process-engine/ops/execute-action.d.ts.map +1 -1
- package/dist/process-engine/ops/retry-startup.d.ts.map +1 -1
- package/dist/process-engine/turn-start-preflight.d.ts.map +1 -1
- package/dist/process-model-config.d.ts.map +1 -1
- package/dist/process-model-policy/construct.d.ts +1 -0
- package/dist/process-model-policy/construct.d.ts.map +1 -1
- package/dist/process-model-policy/evaluate.d.ts +3 -3
- package/dist/process-model-policy/evaluate.d.ts.map +1 -1
- package/dist/process-model-policy/index.d.ts +1 -0
- package/dist/process-model-policy/index.d.ts.map +1 -1
- package/dist/process-model-policy/launch.d.ts.map +1 -1
- package/dist/process-model-policy/project.d.ts.map +1 -1
- package/dist/process-model-policy/requirements.d.ts +16 -0
- package/dist/process-model-policy/requirements.d.ts.map +1 -0
- package/dist/process-model-policy/types.d.ts +87 -75
- package/dist/process-model-policy/types.d.ts.map +1 -1
- package/dist/process-model-policy-presenter.d.ts.map +1 -1
- package/dist/process-model-selection.d.ts.map +1 -1
- package/dist/process-title-generator.d.ts +2 -0
- package/dist/process-title-generator.d.ts.map +1 -1
- package/dist/routes/process-actions.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/test-helpers/process-model-fixtures.d.ts +6 -0
- package/dist/test-helpers/process-model-fixtures.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +12 -12
- package/src/app.ts +21 -0
- package/src/config/config-loader.ts +5 -0
- package/src/dashboard-model-issues.ts +66 -5
- package/src/future-execution/execution.ts +3 -8
- package/src/future-execution/launch-lifecycle.ts +15 -10
- package/src/future-execution/lifecycle.ts +1 -0
- package/src/future-execution/reconciliation.ts +2 -34
- package/src/launch-coordinator.ts +2 -2
- package/src/process-engine/ops/execute-action.ts +1 -0
- package/src/process-engine/ops/retry-startup.ts +10 -12
- package/src/process-engine/turn-start-preflight.ts +38 -15
- package/src/process-model-config.ts +7 -3
- package/src/process-model-policy/construct.ts +61 -3
- package/src/process-model-policy/evaluate.ts +73 -64
- package/src/process-model-policy/index.ts +16 -14
- package/src/process-model-policy/launch.ts +27 -29
- package/src/process-model-policy/project.ts +72 -43
- package/src/process-model-policy/requirements.ts +73 -0
- package/src/process-model-policy/types.ts +108 -78
- package/src/process-model-policy-presenter.ts +18 -2
- package/src/process-model-selection.ts +2 -0
- package/src/process-title-generator.ts +12 -16
- package/src/routes/launchers.ts +1 -1
- package/src/routes/process-actions.ts +1 -0
- package/src/supervisor/worker-start-payload-builder.ts +6 -1
- package/src/test-helpers/process-model-fixtures.ts +25 -4
- package/dist/app-2TCRADVA.js +0 -8
- package/dist/chunk-6EEU4QOU.js.map +0 -1
- package/dist/chunk-AJ2DQWI3.js.map +0 -1
- /package/dist/{app-2TCRADVA.js.map → app-XAQTAQ5Y.js.map} +0 -0
|
@@ -263,15 +263,6 @@ function normalizeLaunchPlanTitle(launchPlan: ProcessLaunchPlan): ProcessLaunchP
|
|
|
263
263
|
);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
function isTitleModelAllowedForProcess(
|
|
267
|
-
config: LeitwerkConfig,
|
|
268
|
-
processId: string,
|
|
269
|
-
modelProfileId: string,
|
|
270
|
-
): boolean {
|
|
271
|
-
const allowedProfiles = config.process_configs?.[processId]?.allowed_model_profiles;
|
|
272
|
-
return !allowedProfiles || allowedProfiles.includes(modelProfileId);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
266
|
function collectProcessTitleRuntimeDiagnostics(
|
|
276
267
|
services: AgentSessionServices,
|
|
277
268
|
): ProcessTitleRuntimeDiagnosticSummary[] {
|
|
@@ -443,6 +434,7 @@ class DefaultProcessTitleGenerator implements ProcessTitleGenerator {
|
|
|
443
434
|
private readonly extensionHost?: ExtensionHost,
|
|
444
435
|
private readonly futureExecutionTitleApplier?: FutureExecutionTitleApplier,
|
|
445
436
|
private readonly getLaunchCoordinator?: () => LaunchCoordinator | undefined,
|
|
437
|
+
private readonly modelPolicyError?: (processId: string, profileId: string) => string | null,
|
|
446
438
|
) {
|
|
447
439
|
this.configuredProfileId = trimToNull(config.pi.process_title_generation.model_profile);
|
|
448
440
|
this.retryPolicy = buildProcessTitleRetryPolicy(config);
|
|
@@ -535,13 +527,12 @@ class DefaultProcessTitleGenerator implements ProcessTitleGenerator {
|
|
|
535
527
|
if (normalizedLaunchPlan.processInput.title || !this.configuredProfileId) {
|
|
536
528
|
return null;
|
|
537
529
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
this.configuredProfileId
|
|
543
|
-
|
|
544
|
-
) {
|
|
530
|
+
const policyError = this.modelPolicyError
|
|
531
|
+
? this.modelPolicyError(normalizedLaunchPlan.processId, this.configuredProfileId)
|
|
532
|
+
: this.config.process_configs?.[
|
|
533
|
+
normalizedLaunchPlan.processId
|
|
534
|
+
]?.allowed_model_profiles?.includes(this.configuredProfileId) === false;
|
|
535
|
+
if (policyError) {
|
|
545
536
|
this.logger?.warn(
|
|
546
537
|
"Skipping process title generation because the configured model profile is not allowed for this process",
|
|
547
538
|
{
|
|
@@ -780,6 +771,8 @@ class DefaultProcessTitleGenerator implements ProcessTitleGenerator {
|
|
|
780
771
|
}
|
|
781
772
|
|
|
782
773
|
private async generateTitle(job: ProcessTitleJob): Promise<GeneratedTitleAttemptResult> {
|
|
774
|
+
const policyError = this.modelPolicyError?.(job.processDefinitionId, job.modelProfileId);
|
|
775
|
+
if (policyError) return { ok: false, error: policyError };
|
|
783
776
|
const configuredProfile = this.config.pi.model_profiles.find(
|
|
784
777
|
(profile) => profile.id === job.modelProfileId,
|
|
785
778
|
);
|
|
@@ -909,6 +902,8 @@ export function createProcessTitleGenerator(options: {
|
|
|
909
902
|
futureExecutionTitleApplier?: FutureExecutionTitleApplier;
|
|
910
903
|
/** @internal */
|
|
911
904
|
getLaunchCoordinator?: () => LaunchCoordinator | undefined;
|
|
905
|
+
/** Fixed title profile validation at queue and dispatch. @internal */
|
|
906
|
+
modelPolicyError?: (processId: string, profileId: string) => string | null;
|
|
912
907
|
}): ProcessTitleGenerator {
|
|
913
908
|
const runtime = { ...createDefaultRuntimeDeps(), ...options.runtime };
|
|
914
909
|
return new DefaultProcessTitleGenerator(
|
|
@@ -920,5 +915,6 @@ export function createProcessTitleGenerator(options: {
|
|
|
920
915
|
options.extensionHost,
|
|
921
916
|
options.futureExecutionTitleApplier,
|
|
922
917
|
options.getLaunchCoordinator,
|
|
918
|
+
options.modelPolicyError,
|
|
923
919
|
);
|
|
924
920
|
}
|
package/src/routes/launchers.ts
CHANGED
|
@@ -67,7 +67,7 @@ export function registerLauncherRoutes(
|
|
|
67
67
|
title = resolved.launcher.launchPlan.processInput.title ?? null;
|
|
68
68
|
const preparedLaunchPlan = await deps.launchPlans.prepare(
|
|
69
69
|
resolved.launcher.launchPlan,
|
|
70
|
-
{ invalidModelConfig: "
|
|
70
|
+
{ invalidModelConfig: "retain" },
|
|
71
71
|
);
|
|
72
72
|
if (!preparedLaunchPlan.ok) {
|
|
73
73
|
warnings.push(...presentLaunchPlanPreparationIssues(preparedLaunchPlan.errors));
|
|
@@ -40,6 +40,7 @@ export function registerProcessActionRoutes(
|
|
|
40
40
|
);
|
|
41
41
|
const profiles = deps.processModelPolicy.project({
|
|
42
42
|
kind: "profile_options",
|
|
43
|
+
target: { kind: "process_default" },
|
|
43
44
|
processId: process.processId,
|
|
44
45
|
availability: deps.modelStatusCache.snapshot(),
|
|
45
46
|
});
|
|
@@ -104,7 +104,12 @@ export function buildWorkerConfigSnapshot(config: LeitwerkConfig): ConfigSnapsho
|
|
|
104
104
|
);
|
|
105
105
|
return {
|
|
106
106
|
workers: buildWorkerRuntimeSettingsSnapshot(config),
|
|
107
|
-
pi:
|
|
107
|
+
pi: {
|
|
108
|
+
...config.pi,
|
|
109
|
+
model_profiles: config.pi.model_profiles.map(
|
|
110
|
+
({ labels: _labels, default: _default, ...profile }) => profile,
|
|
111
|
+
),
|
|
112
|
+
},
|
|
108
113
|
...(Object.keys(processConfigs).length > 0 ? { process_configs: processConfigs } : {}),
|
|
109
114
|
};
|
|
110
115
|
}
|
|
@@ -118,6 +118,8 @@ export function createTestModelPolicy(
|
|
|
118
118
|
profiles?: readonly {
|
|
119
119
|
id: string;
|
|
120
120
|
model_id?: string;
|
|
121
|
+
labels?: string[];
|
|
122
|
+
default?: boolean;
|
|
121
123
|
provider_options?: Record<string, unknown>;
|
|
122
124
|
}[];
|
|
123
125
|
processDefaultProfileId?: string;
|
|
@@ -125,6 +127,13 @@ export function createTestModelPolicy(
|
|
|
125
127
|
modelPurpose?: boolean;
|
|
126
128
|
purposeProfileId?: string;
|
|
127
129
|
allowedProfileIds?: readonly string[];
|
|
130
|
+
processRequirements?: import("@leitwerk-dev/protocol").ModelRequirements;
|
|
131
|
+
turnRequirements?: import("@leitwerk-dev/protocol").ModelRequirements;
|
|
132
|
+
operatorTurnRequirements?: import("@leitwerk-dev/protocol").ModelRequirements;
|
|
133
|
+
capabilities?: (
|
|
134
|
+
providerId: string,
|
|
135
|
+
modelId: string,
|
|
136
|
+
) => Readonly<Record<string, boolean | "unknown">>;
|
|
128
137
|
} = {},
|
|
129
138
|
): {
|
|
130
139
|
config: LeitwerkConfig;
|
|
@@ -143,26 +152,33 @@ export function createTestModelPolicy(
|
|
|
143
152
|
id: profile.id,
|
|
144
153
|
provider: "test",
|
|
145
154
|
model_id: profile.model_id ?? profile.id,
|
|
155
|
+
labels: profile.labels,
|
|
156
|
+
default: profile.default,
|
|
146
157
|
...(profile.provider_options ? { provider_options: profile.provider_options as never } : {}),
|
|
147
158
|
}));
|
|
148
159
|
config.pi.process_title_generation.model_profile = input.purposeProfileId ?? null;
|
|
149
160
|
config.process_configs = {
|
|
150
161
|
policy: {
|
|
162
|
+
model_requirements: input.processRequirements,
|
|
151
163
|
allowed_model_profiles: [
|
|
152
164
|
...(input.allowedProfileIds ?? config.pi.model_profiles.map((profile) => profile.id)),
|
|
153
165
|
],
|
|
154
166
|
...(input.processDefaultProfileId
|
|
155
167
|
? { default_model_profile: input.processDefaultProfileId }
|
|
156
168
|
: {}),
|
|
157
|
-
turn_configs:
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
turn_configs: {
|
|
170
|
+
run: {
|
|
171
|
+
model_profile: input.processTurnProfileId,
|
|
172
|
+
model_requirements: input.operatorTurnRequirements,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
160
175
|
},
|
|
161
176
|
};
|
|
162
177
|
const turn = createTestLlmTurn<string, Record<string, never>, Record<string, never>>(
|
|
163
178
|
"run",
|
|
164
179
|
{},
|
|
165
180
|
{
|
|
181
|
+
modelRequirements: input.turnRequirements,
|
|
166
182
|
...(input.modelPurpose || input.purposeProfileId !== undefined
|
|
167
183
|
? { modelPurpose: "process_title_generation" as const }
|
|
168
184
|
: {}),
|
|
@@ -176,7 +192,12 @@ export function createTestModelPolicy(
|
|
|
176
192
|
config,
|
|
177
193
|
graph,
|
|
178
194
|
processActionRegistry,
|
|
179
|
-
policy: createServerProcessModelPolicy({
|
|
195
|
+
policy: createServerProcessModelPolicy({
|
|
196
|
+
config,
|
|
197
|
+
processGraphs: graph,
|
|
198
|
+
processActionRegistry,
|
|
199
|
+
capabilities: input.capabilities,
|
|
200
|
+
}),
|
|
180
201
|
};
|
|
181
202
|
}
|
|
182
203
|
|