sync: update from private repo (2ef0fa6)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-17 05:23:28 +00:00
parent 517142c61d
commit 1602d52510
42 changed files with 3387 additions and 64 deletions
+54
View File
@@ -38,6 +38,60 @@ export function buildWorkerEntry({ connectionType, endpoint, model, apiKey }) {
return entry;
}
// Build the single worker entry in **camelCase v2 shape** that
// ConfigManager.updateConfig expects (it snake-cases on save). The CLI writes
// raw YAML via buildWorkerEntry (snake_case); the browser wizard instead PUTs a
// JSON config object through updateConfig, which requires camelCase keys.
// Passing buildWorkerEntry's snake_case output to updateConfig double-converts
// and corrupts keys (Codex review P1 #1) — so the wizard MUST use this builder.
export function buildLlmWorkerCamel({ connectionType, endpoint, model, apiKey }) {
const entry = {
id: connectionType === 'aao_gateway' ? 'gateway' : 'local-llm',
connectionType,
endpoint,
model,
roles: [...ALL_ROLES],
maxConcurrency: 1,
enabled: true,
vlm: false,
};
if (connectionType === 'aao_gateway') entry.apiKey = apiKey;
return entry;
}
// Detect whether the runtime has a usable LLM connection. Operate on the
// RESOLVED worker list (provider.workers from ConfigManager.getConfig(), after
// loadConfig has applied OLLAMA_* env overrides). A fresh install's synthetic
// default worker carries an endpoint but an EMPTY model (config-normalize.ts
// EMPTY_MODEL=''), so requiring a non-empty model naturally excludes it.
// An env override (OLLAMA_MODEL) fills the model, so it counts as configured.
// (Codex review P1 #2.)
// Execution roles a worker must cover for normal task running. A worker that
// only serves e.g. 'title' or 'reflection' can't run user tasks, so the wizard
// must NOT consider the install configured (Codex P2 #6). Empty/missing roles
// mean "all roles" at runtime (src/worker.ts defaults to auto/fast/quality), so
// they count as covering execution.
const EXECUTION_ROLES = ['auto', 'fast', 'quality'];
function workerCoversExecution(w) {
const roles = w.roles;
if (!Array.isArray(roles) || roles.length === 0) return true;
return roles.some((r) => EXECUTION_ROLES.includes(r));
}
export function isLlmConfigured(workers) {
const list = Array.isArray(workers) ? workers : [];
return list.some(
(w) =>
w &&
w.enabled !== false &&
typeof w.endpoint === 'string' &&
w.endpoint.trim() !== '' &&
typeof w.model === 'string' &&
w.model.trim() !== '' &&
workerCoversExecution(w),
);
}
// Quote a scalar when a YAML plain scalar would be ambiguous or invalid.
function yamlScalar(v) {
if (typeof v === 'boolean' || typeof v === 'number') return String(v);