Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { homedir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import YAML from 'yaml';
|
||||
import { canonicalizeRoleClass, type PersonaDirs } from '../commands/fleet-personas.js';
|
||||
@@ -646,11 +645,14 @@ export async function previewV1ToV2Migration(
|
||||
}
|
||||
}
|
||||
|
||||
const canonicalInventoryOnlyAgents = [...inventoryOnlyAgents].sort((left, right): number =>
|
||||
compareCodePoints(left.name, right.name),
|
||||
);
|
||||
const status = blockers.length === 0 ? 'ready' : 'blocked';
|
||||
return {
|
||||
status,
|
||||
inventory,
|
||||
inventoryOnlyAgents,
|
||||
inventoryOnlyAgents: canonicalInventoryOnlyAgents,
|
||||
blockers,
|
||||
...(status === 'ready' && canonicalRoster && canonicalYaml
|
||||
? { canonicalRoster, canonicalYaml }
|
||||
@@ -664,10 +666,12 @@ export async function previewV1ToV2Migration(
|
||||
...(status === 'ready' && canonicalYaml
|
||||
? { candidate: { sha256: sha256(canonicalYaml), generation: decisions.generation } }
|
||||
: {}),
|
||||
observations,
|
||||
observations: [...observations].sort((left, right): number =>
|
||||
compareCodePoints(left.agent, right.agent),
|
||||
),
|
||||
excludedInventory: [
|
||||
...(raw.connector === undefined ? [] : ['connector']),
|
||||
...inventoryOnlyAgents.map(({ name }): string => `agents.${name}`),
|
||||
...canonicalInventoryOnlyAgents.map(({ name }): string => `agents.${name}`),
|
||||
],
|
||||
recovery: {
|
||||
executable: false,
|
||||
@@ -1161,9 +1165,7 @@ function normalizeRuntimes(
|
||||
}
|
||||
const runtime = record(value);
|
||||
const resetCommand =
|
||||
stringValue(runtime.reset_command) ||
|
||||
stringValue(runtime.resetCommand) ||
|
||||
V1_RUNTIME_RESETS[name];
|
||||
stringValue(runtime.reset_command) || stringValue(runtime.resetCommand) || '/clear';
|
||||
result[name] = { reset_command: resetCommand };
|
||||
}
|
||||
return result;
|
||||
@@ -1294,15 +1296,11 @@ function generatedValues(
|
||||
MOSAIC_AGENT_MODEL: agent.model,
|
||||
MOSAIC_AGENT_REASONING: agent.reasoning,
|
||||
MOSAIC_AGENT_TOOL_POLICY: agent.toolPolicy,
|
||||
MOSAIC_AGENT_WORKDIR: expandHome(agent.workingDirectory),
|
||||
MOSAIC_AGENT_WORKDIR: agent.workingDirectory,
|
||||
MOSAIC_TMUX_SOCKET: roster.tmux.socketName,
|
||||
};
|
||||
}
|
||||
|
||||
function expandHome(path: string): string {
|
||||
return path === '~' ? homedir() : path.startsWith('~/') ? join(homedir(), path.slice(2)) : path;
|
||||
}
|
||||
|
||||
function safeEnvironmentDiagnostic(error: unknown): string {
|
||||
if (
|
||||
typeof error === 'object' &&
|
||||
|
||||
Reference in New Issue
Block a user