@indigoai-us/hq-cli 5.143.0 → 5.144.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/CHANGELOG.md +8 -0
- package/dist/commands/lanes.js +49 -6
- package/dist/lib/lanes/models.d.ts +6 -0
- package/dist/lib/lanes/models.js +24 -0
- package/dist/lib/lanes/reconcile.js +19 -2
- package/dist/lib/lanes/spawn.d.ts +4 -1
- package/dist/lib/lanes/spawn.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.144.0] — 2026-09-23
|
|
6
|
+
|
|
7
|
+
- Worker-profile models now use the same provider catalog validation as
|
|
8
|
+
`--model` during creation and before every later provider launch. The error
|
|
9
|
+
names the profile when its model is unsupported.
|
|
10
|
+
- Worker resolution continues to use the existing personal, core, installed
|
|
11
|
+
package, and company worker sources. hq-cli does not ship starter profiles.
|
|
12
|
+
|
|
5
13
|
## [5.143.0] — 2026-09-23
|
|
6
14
|
|
|
7
15
|
### Fixed
|
package/dist/commands/lanes.js
CHANGED
|
@@ -18,7 +18,7 @@ import { vaultApiFetch } from "../utils/vault-api.js";
|
|
|
18
18
|
import { openMeshTransport } from "../lib/mesh/client.js";
|
|
19
19
|
import { createLaneMesh, emitLaneDecisionEvents, } from "../lib/lanes/mesh-events.js";
|
|
20
20
|
import { sessionIdFromEnv } from "../lib/mesh/live/session-identity.js";
|
|
21
|
-
import { AccountResolutionError, coveredLaneIds, DEFAULT_ACCOUNT_HOMES, LANE_PROVIDERS, LANE_STATES, PROVIDER_HOME_ENV, QUESTION_STATUSES, SENIOR_KINDS, accountMaxRunning, accountStatus, appendCappedHistory, canonicalizeHome, createLane, decideAdmission, defaultLivenessDeps, defaultSystemdUserDir, defaultThrottleDeps, installDrainHook, installReconcileTimer, providerPathEnv, probeDrainHookRegistration, isLanesError, isLaneVersionConflict, isTerminalLaneState, listAccountStatuses, listLaneIds, listQuestionIds, listSessionLiveness, loadLanesConfig, MAX_LANE_DEPTH, MONITOR_ERROR_EXIT_CODE, MONITOR_ENGINES, MONITOR_MAX_TIMEOUT_MS, MONITOR_UNCOVERED_EXIT_CODE, MAX_WATCHED_LANES, monitorReminderText, readLiveMonitorEvidence, resolveMachineIdentity as lookupMachineIdentity, loadLivenessIndex, parseLaneProvider, parseLaneState, parseLivenessState, parseQuestionStatus, parseSeniorKind, readDaemonPresenceConnected, readLane, retryUpdateLane, readQuestion, resolveAccount, resolveLaneWorker, ignoredWorkerProfileFields, isLoggedOut, runReconcilePass, runLaneWatch, sessionLiveness, tryReadLane, uninstallReconcileTimer, updateLane, updateQuestion, writeLanesConfig, appendDropboxMessage, answerDropboxMessage, deliveryRefusalReason, resumeCommandRefusal, dropboxDir, dropboxInboxPath, laneAcceptsDropboxDelivery, laneAcceptsOperatorMessage, laneDeliveryMechanism, hasRecordedSessionId, providerSupportsSessionResume, laneIdForAnswerDelivery, operatorMessageRefusalReason, raiseLaneQuestion, sha256Text, writeQuestionBody, } from "../lib/lanes/index.js";
|
|
21
|
+
import { AccountResolutionError, coveredLaneIds, DEFAULT_ACCOUNT_HOMES, LANE_PROVIDERS, LANE_STATES, PROVIDER_HOME_ENV, QUESTION_STATUSES, SENIOR_KINDS, accountMaxRunning, accountStatus, appendCappedHistory, canonicalizeHome, createLane, decideAdmission, defaultLivenessDeps, defaultSystemdUserDir, defaultThrottleDeps, installDrainHook, installReconcileTimer, providerPathEnv, probeDrainHookRegistration, isLanesError, isLaneVersionConflict, isTerminalLaneState, listAccountStatuses, listLaneIds, listQuestionIds, listSessionLiveness, loadLanesConfig, MAX_LANE_DEPTH, MONITOR_ERROR_EXIT_CODE, MONITOR_ENGINES, MONITOR_MAX_TIMEOUT_MS, MONITOR_UNCOVERED_EXIT_CODE, MAX_WATCHED_LANES, monitorReminderText, readLiveMonitorEvidence, resolveMachineIdentity as lookupMachineIdentity, loadLivenessIndex, parseLaneProvider, parseLaneState, parseLivenessState, parseQuestionStatus, parseSeniorKind, readDaemonPresenceConnected, readLane, retryUpdateLane, readQuestion, resolveAccount, resolveLaneWorker, ignoredWorkerProfileFields, loadWorkerProfile, isLoggedOut, runReconcilePass, runLaneWatch, sessionLiveness, tryReadLane, uninstallReconcileTimer, updateLane, updateQuestion, writeLanesConfig, appendDropboxMessage, answerDropboxMessage, deliveryRefusalReason, resumeCommandRefusal, dropboxDir, dropboxInboxPath, laneAcceptsDropboxDelivery, laneAcceptsOperatorMessage, laneDeliveryMechanism, hasRecordedSessionId, providerSupportsSessionResume, laneIdForAnswerDelivery, operatorMessageRefusalReason, raiseLaneQuestion, sha256Text, writeQuestionBody, } from "../lib/lanes/index.js";
|
|
22
22
|
import { questionBodyAbsPath } from "../lib/lanes/questions.js";
|
|
23
23
|
import { compactionAfterUsage, } from "../lib/lanes/compaction.js";
|
|
24
24
|
import { providerCompactAfterMs } from "../lib/lanes/config.js";
|
|
@@ -26,7 +26,7 @@ import { parseCliEffort, resolveLaneEffort } from "../lib/lanes/effort.js";
|
|
|
26
26
|
import { LanesError } from "../lib/lanes/errors.js";
|
|
27
27
|
import { accountQuotaView, loadQuotaState, quotaBlockFor } from "../lib/lanes/quota.js";
|
|
28
28
|
import { SESSION_MOVE_REASON, copySessionFiles, planSessionCopy } from "../lib/lanes/move-account.js";
|
|
29
|
-
import { defaultProbe, validateLaneModel, } from "../lib/lanes/models.js";
|
|
29
|
+
import { defaultProbe, validateProfileLaneModel, validateLaneModel, } from "../lib/lanes/models.js";
|
|
30
30
|
import { parseCliModel, refuseOutpostSelfTarget, resolveLaneModel, FOREGROUND_ONLY_RULE, STANDING_AUTHORIZATION, spawnLaneWorker, stopLaneProcesses, } from "../lib/lanes/spawn.js";
|
|
31
31
|
export { spawnLaneWorker };
|
|
32
32
|
export { questionBodyAbsPath };
|
|
@@ -1530,13 +1530,16 @@ async function runCreate(ctx, opts) {
|
|
|
1530
1530
|
env: ctx.env,
|
|
1531
1531
|
};
|
|
1532
1532
|
const validatedAccounts = new Set();
|
|
1533
|
-
|
|
1533
|
+
const modelToValidate = cliModel ?? profileModel;
|
|
1534
|
+
const profileModelToValidate = cliModel === undefined && profileModel !== undefined ? profile : undefined;
|
|
1535
|
+
if (modelToValidate !== undefined && !outpostId) {
|
|
1534
1536
|
const accounts = config.providers[provider].accounts;
|
|
1535
1537
|
const candidate = pinnedAccount ??
|
|
1536
1538
|
resolveAccount(provider, undefined, config, {
|
|
1537
1539
|
hqRoot,
|
|
1538
1540
|
existsSync: ctx.existsSync,
|
|
1539
1541
|
cliModel,
|
|
1542
|
+
model: modelToValidate,
|
|
1540
1543
|
...(profileAccounts !== undefined
|
|
1541
1544
|
? { allowedAccounts: profileAccounts }
|
|
1542
1545
|
: {}),
|
|
@@ -1562,7 +1565,12 @@ async function runCreate(ctx, opts) {
|
|
|
1562
1565
|
continue;
|
|
1563
1566
|
checkedAccounts.push(id);
|
|
1564
1567
|
try {
|
|
1565
|
-
|
|
1568
|
+
if (profileModelToValidate !== undefined) {
|
|
1569
|
+
validateProfileLaneModel(provider, modelToValidate, home, profileModelToValidate.id, modelDeps);
|
|
1570
|
+
}
|
|
1571
|
+
else {
|
|
1572
|
+
validateLaneModel(provider, modelToValidate, home, modelDeps);
|
|
1573
|
+
}
|
|
1566
1574
|
}
|
|
1567
1575
|
catch (err) {
|
|
1568
1576
|
if (!(isLanesError(err) && err.error === "model_unsupported"))
|
|
@@ -1570,7 +1578,7 @@ async function runCreate(ctx, opts) {
|
|
|
1570
1578
|
unsupported.push({ account: id, error: err });
|
|
1571
1579
|
continue;
|
|
1572
1580
|
}
|
|
1573
|
-
const block = quotaBlockFor(quota, provider, id,
|
|
1581
|
+
const block = quotaBlockFor(quota, provider, id, modelToValidate, now);
|
|
1574
1582
|
if (block.blocked) {
|
|
1575
1583
|
quotaBlocked.push({ account: id, block });
|
|
1576
1584
|
continue;
|
|
@@ -1579,7 +1587,7 @@ async function runCreate(ctx, opts) {
|
|
|
1579
1587
|
}
|
|
1580
1588
|
if (validatedAccounts.size === 0 && quotaBlocked.length > 0) {
|
|
1581
1589
|
const blocked = quotaBlocked[0];
|
|
1582
|
-
const model = blocked.block.model ??
|
|
1590
|
+
const model = blocked.block.model ?? modelToValidate;
|
|
1583
1591
|
const checkedSuffix = ` Checked accounts: ${checkedAccounts.join(", ")}`;
|
|
1584
1592
|
if (blocked.block.reason === "account_model_unavailable") {
|
|
1585
1593
|
throw new AccountResolutionError("account_model_unavailable", `Account ${JSON.stringify(blocked.account)} cannot run model ${model ?? "(no model)"}: ${blocked.block.marker ?? "needs credits"}${checkedSuffix}`, {
|
|
@@ -1623,6 +1631,7 @@ async function runCreate(ctx, opts) {
|
|
|
1623
1631
|
hqRoot,
|
|
1624
1632
|
existsSync: ctx.existsSync,
|
|
1625
1633
|
cliModel,
|
|
1634
|
+
model: cliModel ?? profileModel,
|
|
1626
1635
|
...(allowedAccounts !== undefined ? { allowedAccounts } : {}),
|
|
1627
1636
|
}).id;
|
|
1628
1637
|
}
|
|
@@ -1748,6 +1757,11 @@ async function runCreate(ctx, opts) {
|
|
|
1748
1757
|
if (admission.action === "start") {
|
|
1749
1758
|
started = spawnLaneWorker(hqRoot, lane, {
|
|
1750
1759
|
env: ctx.env,
|
|
1760
|
+
modelDeps: {
|
|
1761
|
+
readFileSync: ctx.readFileSync,
|
|
1762
|
+
probe: ctx.probeProvider,
|
|
1763
|
+
env: ctx.env,
|
|
1764
|
+
},
|
|
1751
1765
|
existsSync: ctx.existsSync,
|
|
1752
1766
|
spawnProcess: ctx.spawnProcess,
|
|
1753
1767
|
proveDetached: ctx.proveDetached,
|
|
@@ -2049,6 +2063,11 @@ async function runPickup(ctx, opts) {
|
|
|
2049
2063
|
try {
|
|
2050
2064
|
started = spawnLaneWorker(hqRoot, afterAccount, {
|
|
2051
2065
|
env: ctx.env,
|
|
2066
|
+
modelDeps: {
|
|
2067
|
+
readFileSync: ctx.readFileSync,
|
|
2068
|
+
probe: ctx.probeProvider,
|
|
2069
|
+
env: ctx.env,
|
|
2070
|
+
},
|
|
2052
2071
|
existsSync: ctx.existsSync,
|
|
2053
2072
|
spawnProcess: ctx.spawnProcess,
|
|
2054
2073
|
proveDetached: ctx.proveDetached,
|
|
@@ -2219,6 +2238,20 @@ async function prepareAccountMove(ctx, lane, input) {
|
|
|
2219
2238
|
if (isLoggedOut(accountStatus(lane.provider, target, config, { existsSync: ctx.existsSync }))) {
|
|
2220
2239
|
throw new LanesError("account_not_logged_in", `Account ${target} for ${lane.provider} is not logged in (no credential file)`, { provider: lane.provider, account: target, lane_id: laneId });
|
|
2221
2240
|
}
|
|
2241
|
+
const profile = lane.worker_profile !== undefined
|
|
2242
|
+
? loadWorkerProfile(hqRoot, lane.worker_profile)
|
|
2243
|
+
: undefined;
|
|
2244
|
+
const profileDefaultsApply = profile !== undefined && profile.meta.provider === lane.provider;
|
|
2245
|
+
const pinnedModel = lane.model_source === undefined || lane.model_source === "cli"
|
|
2246
|
+
? lane.model
|
|
2247
|
+
: undefined;
|
|
2248
|
+
if (input.cliModel === undefined && profileDefaultsApply && pinnedModel === undefined) {
|
|
2249
|
+
validateProfileLaneModel(lane.provider, profile.meta.model, targetCfg.home, profile.id, {
|
|
2250
|
+
readFileSync: ctx.readFileSync,
|
|
2251
|
+
probe: ctx.probeProvider,
|
|
2252
|
+
env: ctx.env,
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2222
2255
|
// The model the moved run would use, resolved the way spawn resolves it:
|
|
2223
2256
|
// the operator's --model, else the lane's own, else the target account's
|
|
2224
2257
|
// default, else the provider's. The quota and validation checks use this
|
|
@@ -2383,6 +2416,11 @@ async function runMessage(ctx, laneId, opts) {
|
|
|
2383
2416
|
archiveResumeMessage(hqRoot, laneId, dropboxMessage);
|
|
2384
2417
|
resumed = spawnLaneWorker(hqRoot, lane, {
|
|
2385
2418
|
env: ctx.env,
|
|
2419
|
+
modelDeps: {
|
|
2420
|
+
readFileSync: ctx.readFileSync,
|
|
2421
|
+
probe: ctx.probeProvider,
|
|
2422
|
+
env: ctx.env,
|
|
2423
|
+
},
|
|
2386
2424
|
existsSync: ctx.existsSync,
|
|
2387
2425
|
spawnProcess: ctx.spawnProcess,
|
|
2388
2426
|
proveDetached: ctx.proveDetached,
|
|
@@ -2529,6 +2567,11 @@ async function runResume(ctx, laneId, opts) {
|
|
|
2529
2567
|
? lane
|
|
2530
2568
|
: spawnLaneWorker(hqRoot, lane, {
|
|
2531
2569
|
env: ctx.env,
|
|
2570
|
+
modelDeps: {
|
|
2571
|
+
readFileSync: ctx.readFileSync,
|
|
2572
|
+
probe: ctx.probeProvider,
|
|
2573
|
+
env: ctx.env,
|
|
2574
|
+
},
|
|
2532
2575
|
existsSync: ctx.existsSync,
|
|
2533
2576
|
spawnProcess: ctx.spawnProcess,
|
|
2534
2577
|
proveDetached: ctx.proveDetached,
|
|
@@ -75,4 +75,10 @@ export declare function modelIsKnown(known: KnownModels, model: string): boolean
|
|
|
75
75
|
* null when no source was readable and the value passed unvalidated.
|
|
76
76
|
*/
|
|
77
77
|
export declare function validateLaneModel(provider: LaneProvider, model: string, home: string, deps?: KnownModelsDeps): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Validate a model supplied by a reusable worker profile. Keep the provider
|
|
80
|
+
* catalog and refusal semantics identical to `--model`, while making the
|
|
81
|
+
* profile origin visible to callers and JSON error consumers.
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateProfileLaneModel(provider: LaneProvider, model: string, home: string, profileId: string, deps?: KnownModelsDeps): string | null;
|
|
78
84
|
//# sourceMappingURL=models.d.ts.map
|
package/dist/lib/lanes/models.js
CHANGED
|
@@ -202,4 +202,28 @@ export function validateLaneModel(provider, model, home, deps = {}) {
|
|
|
202
202
|
// `message` is in details too: LanesError.toJSON prints details only.
|
|
203
203
|
throw new LanesError("model_unsupported", message, { provider, model, accepted, source: known.source, message });
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Validate a model supplied by a reusable worker profile. Keep the provider
|
|
207
|
+
* catalog and refusal semantics identical to `--model`, while making the
|
|
208
|
+
* profile origin visible to callers and JSON error consumers.
|
|
209
|
+
*/
|
|
210
|
+
export function validateProfileLaneModel(provider, model, home, profileId, deps = {}) {
|
|
211
|
+
try {
|
|
212
|
+
return validateLaneModel(provider, model, home, deps);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
if (!(err instanceof LanesError) || err.error !== "model_unsupported") {
|
|
216
|
+
throw err;
|
|
217
|
+
}
|
|
218
|
+
const message = `Worker profile ${JSON.stringify(profileId)} supplied model ${JSON.stringify(model)}; ` +
|
|
219
|
+
`the model came from the profile. ${err.message}`;
|
|
220
|
+
throw new LanesError("model_unsupported", message, {
|
|
221
|
+
...err.details,
|
|
222
|
+
profile_id: profileId,
|
|
223
|
+
worker_profile: profileId,
|
|
224
|
+
model_source: "profile",
|
|
225
|
+
message,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
205
229
|
//# sourceMappingURL=models.js.map
|
|
@@ -13,7 +13,7 @@ import { MAX_LANE_DEPTH } from "./constants.js";
|
|
|
13
13
|
import { LanesError, isLaneVersionConflict } from "./errors.js";
|
|
14
14
|
import { loadWorkerProfile } from "./profile.js";
|
|
15
15
|
import { classifySessionLiveness, defaultLivenessDeps, loadLivenessIndex, readDaemonPresenceConnected, } from "./liveness.js";
|
|
16
|
-
import { ANSWERED_QUESTIONS_FILE, armLaneWatcher, isPidRecordAlive, laneRunDir, readPidRecord, readSpawnManifest, spawnEnvelopeRepair, spawnLaneWorker, } from "./spawn.js";
|
|
16
|
+
import { ANSWERED_QUESTIONS_FILE, armLaneWatcher, isPidRecordAlive, laneRunDir, readPidRecord, readSpawnManifest, markSpawnFailure, spawnEnvelopeRepair, spawnLaneWorker, } from "./spawn.js";
|
|
17
17
|
import { appendCappedHistory, lanesStoreRoot, parseLaneRecord, parseQuestionRecord, readLane, readQuestion, updateLane, updateQuestion, } from "./store.js";
|
|
18
18
|
import { applyThrottleDecision, defaultThrottleDeps, emptyThrottleState, evaluateThrottle, isCpuCheckEnabled, readAvailableMemMb, readThrottleState, resolveCpuBusyFraction, throttleStatePath, writeThrottleState, } from "./throttle.js";
|
|
19
19
|
import { applyDefaultQuotaHold, readQuotaSignal, recordAccountQuota } from "./quota.js";
|
|
@@ -60,6 +60,19 @@ function markDirty(summary, skip) {
|
|
|
60
60
|
summary.ok = false;
|
|
61
61
|
logSkip(skip);
|
|
62
62
|
}
|
|
63
|
+
function terminalizeModelUnsupported(hqRoot, lane, err) {
|
|
64
|
+
if (!(err instanceof LanesError) || err.error !== "model_unsupported")
|
|
65
|
+
return;
|
|
66
|
+
try {
|
|
67
|
+
markSpawnFailure(hqRoot, lane.lane_id, err.error, {
|
|
68
|
+
...err.details,
|
|
69
|
+
message: err.message,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (writeErr) {
|
|
73
|
+
process.stderr.write(`hq lanes reconcile: failed to terminalize ${lane.lane_id} after model validation: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
63
76
|
function markError(summary, err) {
|
|
64
77
|
const message = err instanceof Error ? err.message : String(err);
|
|
65
78
|
const code = err instanceof LanesError ? err.error : undefined;
|
|
@@ -843,7 +856,9 @@ async function heartbeatAndDeadHosts(hqRoot, lanes, summary, deps, now) {
|
|
|
843
856
|
!quota &&
|
|
844
857
|
rawLatest &&
|
|
845
858
|
rawLatest.envelope === null) {
|
|
846
|
-
const
|
|
859
|
+
const spawnRepair = deps.spawnRepair ??
|
|
860
|
+
((root, repairLane, input) => spawnEnvelopeRepair(root, repairLane, input, deps.spawnLaneDeps));
|
|
861
|
+
const repair = decideEnvelopeRepair(hqRoot, lane.lane_id, rawLatest, nowMs, spawnRepair, () => undefined);
|
|
847
862
|
if (repair.action === "spawned") {
|
|
848
863
|
armLaneWatcher(hqRoot, lane.lane_id, deps.spawnLaneDeps);
|
|
849
864
|
summary.heartbeats.push(`${lane.lane_id}:envelope-repair`);
|
|
@@ -1067,6 +1082,7 @@ async function admitQueued(hqRoot, lanes, summary, deps, now) {
|
|
|
1067
1082
|
break;
|
|
1068
1083
|
}
|
|
1069
1084
|
catch (err) {
|
|
1085
|
+
terminalizeModelUnsupported(hqRoot, lane, err);
|
|
1070
1086
|
markDirty(summary, {
|
|
1071
1087
|
kind: "lane",
|
|
1072
1088
|
id: lane.lane_id,
|
|
@@ -1110,6 +1126,7 @@ async function resumeAwaiting(hqRoot, lanes, questions, summary, deps) {
|
|
|
1110
1126
|
});
|
|
1111
1127
|
}
|
|
1112
1128
|
catch (err) {
|
|
1129
|
+
terminalizeModelUnsupported(hqRoot, lane, err);
|
|
1113
1130
|
markDirty(summary, {
|
|
1114
1131
|
kind: "lane",
|
|
1115
1132
|
id: lane.lane_id,
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { PROVIDER_HOME_ENV } from "./accounts.js";
|
|
11
11
|
import { type RunCompactionFn } from "./compaction.js";
|
|
12
|
+
import { type KnownModelsDeps } from "./models.js";
|
|
12
13
|
import { type LaunchTrigger } from "./delivery.js";
|
|
13
14
|
import { type MachineIdentity } from "./machine-identity.js";
|
|
14
15
|
import { type LaneCompanyRef, type LaneProvider, type LaneRecord } from "./types.js";
|
|
15
16
|
export declare const LANES_RUNS_REL: string;
|
|
16
17
|
/** Written by reconcile before a resume spawn; the worker prompt names this path. */
|
|
17
18
|
export declare const ANSWERED_QUESTIONS_FILE = "answered-questions.json";
|
|
18
|
-
export declare const SPAWN_TERMINAL_REASONS: readonly ["account_not_logged_in", "unknown_account", "account_disabled", "no_enabled_account", "spawn_failed", "not_detached", "watcher_not_armed"];
|
|
19
|
+
export declare const SPAWN_TERMINAL_REASONS: readonly ["account_not_logged_in", "unknown_account", "account_disabled", "no_enabled_account", "spawn_failed", "not_detached", "watcher_not_armed", "model_unsupported"];
|
|
19
20
|
export type SpawnTerminalReason = (typeof SPAWN_TERMINAL_REASONS)[number];
|
|
20
21
|
declare const PROVIDER_COMMAND: Record<LaneProvider, string>;
|
|
21
22
|
export declare function providerCommandOnPath(command: string, pathEnv: string | undefined): boolean;
|
|
@@ -62,6 +63,8 @@ export type ProveDetachedFn = (pid: number) => DetachProof;
|
|
|
62
63
|
export type KillProcessFn = (pid: number, signal?: NodeJS.Signals) => void;
|
|
63
64
|
export interface SpawnLaneDeps {
|
|
64
65
|
env?: NodeJS.ProcessEnv;
|
|
66
|
+
/** Provider model catalog dependencies, shared with create in tests. */
|
|
67
|
+
modelDeps?: KnownModelsDeps;
|
|
65
68
|
existsSync?: (p: string) => boolean;
|
|
66
69
|
spawnProcess?: SpawnProcessFn;
|
|
67
70
|
proveDetached?: ProveDetachedFn;
|
package/dist/lib/lanes/spawn.js
CHANGED
|
@@ -16,6 +16,7 @@ import { COMPACTION_PROMPT, compactionAfterUsage, compactionDue, compactLaneSess
|
|
|
16
16
|
import { installDrainHook } from "./hooks-install.js";
|
|
17
17
|
import { loadLanesConfig, providerAutoCompactTokens, providerCompactAfterMs, } from "./config.js";
|
|
18
18
|
import { appendEffortFlag, resolveLaneEffort } from "./effort.js";
|
|
19
|
+
import { validateProfileLaneModel, } from "./models.js";
|
|
19
20
|
import { claimableStatesFor, planLaneLaunch, providerSupportsSessionResume, } from "./delivery.js";
|
|
20
21
|
import { AccountResolutionError, LanesError } from "./errors.js";
|
|
21
22
|
import { ignoredWorkerProfileFields, loadWorkerProfile, materializeWorkerProfile, workerProfilePrompt, } from "./profile.js";
|
|
@@ -33,6 +34,7 @@ export const SPAWN_TERMINAL_REASONS = [
|
|
|
33
34
|
"spawn_failed",
|
|
34
35
|
"not_detached",
|
|
35
36
|
"watcher_not_armed",
|
|
37
|
+
"model_unsupported",
|
|
36
38
|
];
|
|
37
39
|
const PROVIDER_COMMAND = {
|
|
38
40
|
claude: "claude",
|
|
@@ -1065,6 +1067,10 @@ function inferTrigger(lane) {
|
|
|
1065
1067
|
*/
|
|
1066
1068
|
export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
1067
1069
|
const env = deps.env ?? process.env;
|
|
1070
|
+
const modelDeps = {
|
|
1071
|
+
...deps.modelDeps,
|
|
1072
|
+
env: deps.modelDeps?.env ?? env,
|
|
1073
|
+
};
|
|
1068
1074
|
const existsSync = deps.existsSync ?? ((p) => fs.existsSync(p));
|
|
1069
1075
|
const spawnProcess = deps.spawnProcess ?? defaultSpawnProcess;
|
|
1070
1076
|
const proveDetached = deps.proveDetached ?? defaultProveDetached;
|
|
@@ -1150,6 +1156,9 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
1150
1156
|
: existing;
|
|
1151
1157
|
throw new LanesError("account_not_logged_in", `Account ${resolved.id} for ${lane.provider} is not logged in (no credential file)`, { provider: lane.provider, account: resolved.id, lane_id: lane.lane_id, lane: failed });
|
|
1152
1158
|
}
|
|
1159
|
+
if (profileDefaultsApply && profileModel !== undefined && pinnedModel === undefined) {
|
|
1160
|
+
validateProfileLaneModel(existing.provider, profileModel, resolved.home, profile.id, modelDeps);
|
|
1161
|
+
}
|
|
1153
1162
|
if (lane.account !== resolved.id) {
|
|
1154
1163
|
retryUpdateLane(hqRoot, lane.lane_id, "spawn", (current) => {
|
|
1155
1164
|
if (current.account === resolved.id)
|
|
@@ -1532,6 +1541,12 @@ export function spawnEnvelopeRepair(hqRoot, lane, input, deps = {}) {
|
|
|
1532
1541
|
existsSync,
|
|
1533
1542
|
model: pinnedModel ?? profileModel,
|
|
1534
1543
|
});
|
|
1544
|
+
if (profileDefaultsApply && profileModel !== undefined && pinnedModel === undefined) {
|
|
1545
|
+
validateProfileLaneModel(lane.provider, profileModel, resolved.home, profile.id, {
|
|
1546
|
+
...deps.modelDeps,
|
|
1547
|
+
env: deps.modelDeps?.env ?? env,
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1535
1550
|
const autoCompactTokens = lane.provider === "claude"
|
|
1536
1551
|
? providerAutoCompactTokens(config.providers.claude)
|
|
1537
1552
|
: undefined;
|