agent-valley 4.2.1 → 4.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/assets/plugin.json +1 -1
- package/dist/index.js +95 -70
- package/package.json +1 -1
package/dist/assets/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "av",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.0",
|
|
5
5
|
"description": "Delegate repository goals to Agent Valley and inspect mission progress and verification evidence.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Agent Valley"
|
package/dist/index.js
CHANGED
|
@@ -23965,7 +23965,7 @@ function canonicalConfig(config) {
|
|
|
23965
23965
|
import { spawn as spawn11 } from "node:child_process";
|
|
23966
23966
|
import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
|
|
23967
23967
|
import { homedir as homedir8, tmpdir as tmpdir4 } from "node:os";
|
|
23968
|
-
import { delimiter as delimiter3, join as
|
|
23968
|
+
import { delimiter as delimiter3, join as join58 } from "node:path";
|
|
23969
23969
|
function runTerminalCommand(request, spawnCommand = spawn11) {
|
|
23970
23970
|
return new Promise((resolve) => {
|
|
23971
23971
|
let child;
|
|
@@ -24014,7 +24014,7 @@ function defaults2() {
|
|
|
24014
24014
|
discover: discoverAgents,
|
|
24015
24015
|
runCommand: runTerminalCommand,
|
|
24016
24016
|
supportsLoginCommand: (agent, path, env) => supportsNativeLoginCommand(agent, path, { env }),
|
|
24017
|
-
makeTempDir: () => mkdtempSync(
|
|
24017
|
+
makeTempDir: () => mkdtempSync(join58(tmpdir4(), "av-agent-install-")),
|
|
24018
24018
|
removeTempDir: (path) => rmSync2(path, { recursive: true, force: true })
|
|
24019
24019
|
};
|
|
24020
24020
|
}
|
|
@@ -24041,7 +24041,7 @@ async function runOfficialInstaller(installerUrl, deps, options = {}) {
|
|
|
24041
24041
|
let directory;
|
|
24042
24042
|
try {
|
|
24043
24043
|
directory = deps.makeTempDir();
|
|
24044
|
-
const scriptPath =
|
|
24044
|
+
const scriptPath = join58(directory, "install.sh");
|
|
24045
24045
|
const request = { env: options.env ?? deps.env, ...options.cwd ? { cwd: options.cwd } : {} };
|
|
24046
24046
|
const download = await deps.runCommand({
|
|
24047
24047
|
command: curl,
|
|
@@ -24112,7 +24112,7 @@ async function installChiefAgent(agent, overrides = {}) {
|
|
|
24112
24112
|
const install = await runOfficialInstaller(plan.installerUrl, deps);
|
|
24113
24113
|
if (!install.success)
|
|
24114
24114
|
return commandFailure(install.stage === "download" ? "Installer download" : "Installation", install, plan.documentation);
|
|
24115
|
-
const localBin =
|
|
24115
|
+
const localBin = join58(deps.home, ".local", "bin");
|
|
24116
24116
|
const pathParts = (deps.env.PATH ?? "").split(delimiter3);
|
|
24117
24117
|
if (!pathParts.includes(localBin))
|
|
24118
24118
|
deps.env.PATH = [localBin, ...pathParts.filter(Boolean)].join(delimiter3);
|
|
@@ -24215,16 +24215,16 @@ var init_agent_provisioning = __esm(() => {
|
|
|
24215
24215
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "node:fs";
|
|
24216
24216
|
import { chmod as chmod5, lstat as lstat24, readdir as readdir17, readFile as readFile20, realpath as realpath33, unlink as unlink7, writeFile as writeFile13 } from "node:fs/promises";
|
|
24217
24217
|
import { homedir as homedir9, tmpdir as tmpdir5 } from "node:os";
|
|
24218
|
-
import { delimiter as delimiter4, isAbsolute as isAbsolute22, join as
|
|
24218
|
+
import { delimiter as delimiter4, isAbsolute as isAbsolute22, join as join59, relative as relative21, resolve as resolve40 } from "node:path";
|
|
24219
24219
|
function defaults3() {
|
|
24220
24220
|
const home = homedir9();
|
|
24221
24221
|
return {
|
|
24222
24222
|
platform: process.platform,
|
|
24223
24223
|
home,
|
|
24224
24224
|
env: process.env,
|
|
24225
|
-
resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [
|
|
24225
|
+
resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [join59(process.env.BUN_INSTALL ?? join59(home, ".bun"), "bin", "bun")] : []),
|
|
24226
24226
|
runCommand: runTerminalCommand,
|
|
24227
|
-
makeTempDir: () => mkdtempSync2(
|
|
24227
|
+
makeTempDir: () => mkdtempSync2(join59(tmpdir5(), "av-oma-install-")),
|
|
24228
24228
|
removeTempDir: (path) => rmSync3(path, { recursive: true, force: true })
|
|
24229
24229
|
};
|
|
24230
24230
|
}
|
|
@@ -24245,7 +24245,7 @@ async function present(path) {
|
|
|
24245
24245
|
}
|
|
24246
24246
|
async function installedVersion2(skills) {
|
|
24247
24247
|
try {
|
|
24248
|
-
const marker = JSON.parse(await readFile20(
|
|
24248
|
+
const marker = JSON.parse(await readFile20(join59(skills, "_version.json"), "utf8"));
|
|
24249
24249
|
return marker.schemaVersion === 2 && marker.mode === "project" && typeof marker.version === "string" && /^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/.test(marker.version) ? marker.version : null;
|
|
24250
24250
|
} catch {
|
|
24251
24251
|
return null;
|
|
@@ -24254,7 +24254,7 @@ async function installedVersion2(skills) {
|
|
|
24254
24254
|
async function snapshotConfig(agents) {
|
|
24255
24255
|
const snapshots = [];
|
|
24256
24256
|
for (const name of CUSTOM_CONFIG_NAMES) {
|
|
24257
|
-
const path =
|
|
24257
|
+
const path = join59(agents, name);
|
|
24258
24258
|
if (!await present(path))
|
|
24259
24259
|
continue;
|
|
24260
24260
|
const file = await lstat24(path);
|
|
@@ -24274,10 +24274,10 @@ async function restoreConfig(agents, snapshots) {
|
|
|
24274
24274
|
["oma-config.yaml", "oma-config.cue"],
|
|
24275
24275
|
["oma-config.local.yaml", "oma-config.local.cue"]
|
|
24276
24276
|
]) {
|
|
24277
|
-
if (!pair.some((name) => original.has(
|
|
24277
|
+
if (!pair.some((name) => original.has(join59(agents, name))))
|
|
24278
24278
|
continue;
|
|
24279
24279
|
for (const name of pair) {
|
|
24280
|
-
const path =
|
|
24280
|
+
const path = join59(agents, name);
|
|
24281
24281
|
if (!original.has(path))
|
|
24282
24282
|
await unlink7(path).catch((error) => {
|
|
24283
24283
|
if (error.code !== "ENOENT")
|
|
@@ -24292,7 +24292,7 @@ async function workspacePath(input) {
|
|
|
24292
24292
|
const root = resolve40(input);
|
|
24293
24293
|
if (!await directory2(root))
|
|
24294
24294
|
return null;
|
|
24295
|
-
for (const path of [
|
|
24295
|
+
for (const path of [join59(root, ".agents"), join59(root, ".agents", "skills")]) {
|
|
24296
24296
|
if (!await present(path))
|
|
24297
24297
|
continue;
|
|
24298
24298
|
const actual = await realpath33(path);
|
|
@@ -24307,7 +24307,7 @@ async function inspectOma(workspaceRoot, _overrides = {}) {
|
|
|
24307
24307
|
const root = await workspacePath(workspaceRoot);
|
|
24308
24308
|
if (!root)
|
|
24309
24309
|
return { success: false, message: "Choose an existing absolute workspace with project-local OMA files." };
|
|
24310
|
-
const skills =
|
|
24310
|
+
const skills = join59(root, ".agents", "skills");
|
|
24311
24311
|
const version = await installedVersion2(skills);
|
|
24312
24312
|
if (!version)
|
|
24313
24313
|
throw new Error("Invalid installed metadata");
|
|
@@ -24315,7 +24315,7 @@ async function inspectOma(workspaceRoot, _overrides = {}) {
|
|
|
24315
24315
|
if (!entries.length)
|
|
24316
24316
|
throw new Error("No installed skills");
|
|
24317
24317
|
for (const entry of entries) {
|
|
24318
|
-
if (!entry.isDirectory() || !(await lstat24(
|
|
24318
|
+
if (!entry.isDirectory() || !(await lstat24(join59(skills, entry.name, "SKILL.md"))).isFile())
|
|
24319
24319
|
throw new Error("Incomplete installed skill");
|
|
24320
24320
|
}
|
|
24321
24321
|
return {
|
|
@@ -24363,16 +24363,16 @@ async function prepareOma(workspaceRoot, overrides = {}) {
|
|
|
24363
24363
|
delete environment.OMA_YES;
|
|
24364
24364
|
environment.CI = "true";
|
|
24365
24365
|
const paths = [
|
|
24366
|
-
deps.env.BUN_INSTALL_BIN ??
|
|
24367
|
-
|
|
24366
|
+
deps.env.BUN_INSTALL_BIN ?? join59(deps.env.BUN_INSTALL ?? join59(deps.home, ".bun"), "bin"),
|
|
24367
|
+
join59(deps.home, ".local", "bin")
|
|
24368
24368
|
];
|
|
24369
24369
|
environment.PATH = [...new Set([...paths, ...(environment.PATH ?? "").split(delimiter4).filter(Boolean)])].join(delimiter4);
|
|
24370
24370
|
const request = { command: bun, env: environment, cwd: root, timeoutMs: 300000 };
|
|
24371
24371
|
const latest = await deps.runCommand({ ...request, args: ["install", "--global", LATEST_PACKAGE] });
|
|
24372
24372
|
if (!latest.success)
|
|
24373
24373
|
return failure3("OMA CLI update", latest);
|
|
24374
|
-
const agents =
|
|
24375
|
-
const existing = await installedVersion2(
|
|
24374
|
+
const agents = join59(root, ".agents");
|
|
24375
|
+
const existing = await installedVersion2(join59(agents, "skills")) !== null || await directory2(join59(agents, "skills")) && (await present(join59(agents, "oma-config.yaml")) || await present(join59(agents, "mcp.json")) || await directory2(join59(agents, "workflows")));
|
|
24376
24376
|
const custom = await snapshotConfig(agents);
|
|
24377
24377
|
const args = existing ? ["update", "--yes", "--with-new-skills", "--all"] : ["install"];
|
|
24378
24378
|
let installed;
|
|
@@ -25915,7 +25915,7 @@ var init_workspace_step = __esm(() => {
|
|
|
25915
25915
|
|
|
25916
25916
|
// src/setup/noninteractive-config.ts
|
|
25917
25917
|
import { lstat as lstat25, realpath as realpath34 } from "node:fs/promises";
|
|
25918
|
-
import { isAbsolute as isAbsolute24, join as
|
|
25918
|
+
import { isAbsolute as isAbsolute24, join as join60, parse as parsePath, resolve as resolve41 } from "node:path";
|
|
25919
25919
|
function validateNoninteractiveOptions(options) {
|
|
25920
25920
|
if (!options.yes || options.edit || options.mode !== undefined && options.mode !== "order")
|
|
25921
25921
|
throw new Error("Use av setup --yes only for local order setup; --edit and --mode tracker require interactive setup.");
|
|
@@ -25959,7 +25959,7 @@ function selectChief(options, deps, project, global2) {
|
|
|
25959
25959
|
const globalActor = actor(global2);
|
|
25960
25960
|
const selected = options.actor ?? runtime?.actorType ?? projectActor.type ?? globalActor.type;
|
|
25961
25961
|
if (!selected)
|
|
25962
|
-
throw new Error(`actor.type is missing in ${
|
|
25962
|
+
throw new Error(`actor.type is missing in ${join60(deps.projectRoot, "av.yaml")} and ${deps.globalConfigPath}, and the current agent runtime is unknown. Rerun av setup --yes --actor <current-vendor> --model <current-model-or-empty>.`);
|
|
25963
25963
|
const actorType = selected;
|
|
25964
25964
|
const actorSource = options.actor !== undefined ? "explicit" : runtime ? "runtime" : projectActor.type ? "project" : "global";
|
|
25965
25965
|
const previousType = projectActor.type ?? globalActor.type;
|
|
@@ -26004,7 +26004,7 @@ async function prepareNoninteractiveConfig(options, deps) {
|
|
|
26004
26004
|
throw new Error(`AV configuration directory ${deps.projectRoot} does not exist. Run av setup from an existing directory.`);
|
|
26005
26005
|
}
|
|
26006
26006
|
const globalPath = resolve41(deps.globalConfigPath);
|
|
26007
|
-
const projectPath =
|
|
26007
|
+
const projectPath = join60(projectRoot, "av.yaml");
|
|
26008
26008
|
const project = await configFile(projectPath, projectConfigSchema);
|
|
26009
26009
|
const global2 = await configFile(globalPath, globalConfigSchema);
|
|
26010
26010
|
const chief = selectChief(options, { ...deps, projectRoot, globalConfigPath: globalPath }, project.raw, global2.raw);
|
|
@@ -26057,7 +26057,7 @@ var init_noninteractive_config = __esm(() => {
|
|
|
26057
26057
|
});
|
|
26058
26058
|
|
|
26059
26059
|
// src/setup/noninteractive.ts
|
|
26060
|
-
import { join as
|
|
26060
|
+
import { join as join61, parse as parsePath2, resolve as resolve42 } from "node:path";
|
|
26061
26061
|
function rerunCommand(result, options) {
|
|
26062
26062
|
const quote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
|
|
26063
26063
|
return `cd ${quote(result.projectRoot)} && av setup --yes --actor ${result.chief.actorType} --model ${quote(result.chief.model ?? "")} --workspace ${quote(result.workspace ?? result.projectRoot)} --oma ${options.oma ?? "prepare"} --json`;
|
|
@@ -26071,7 +26071,7 @@ async function setupNoninteractive(options, overrides = {}) {
|
|
|
26071
26071
|
projectRoot: resolve42(deps.projectRoot),
|
|
26072
26072
|
workspace: null,
|
|
26073
26073
|
config: {
|
|
26074
|
-
project:
|
|
26074
|
+
project: join61(resolve42(deps.projectRoot), "av.yaml"),
|
|
26075
26075
|
global: resolve42(deps.globalConfigPath),
|
|
26076
26076
|
saved: false
|
|
26077
26077
|
},
|
|
@@ -28524,9 +28524,9 @@ var init_setup = __esm(() => {
|
|
|
28524
28524
|
// ../../packages/core/src/relay/credentials.ts
|
|
28525
28525
|
import { readFileSync as readFileSync13 } from "node:fs";
|
|
28526
28526
|
import { homedir as homedir10 } from "node:os";
|
|
28527
|
-
import { join as
|
|
28527
|
+
import { join as join62 } from "node:path";
|
|
28528
28528
|
function defaultCredentialsPath() {
|
|
28529
|
-
return
|
|
28529
|
+
return join62(homedir10(), ".agent-valley", "credentials.json");
|
|
28530
28530
|
}
|
|
28531
28531
|
function validateRelayCredentials(value, binding, now = Date.now()) {
|
|
28532
28532
|
const result = credentialsSchema.safeParse(value);
|
|
@@ -77724,7 +77724,7 @@ function registerAgentClientCommands(program) {
|
|
|
77724
77724
|
// src/chief.ts
|
|
77725
77725
|
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
77726
77726
|
import { realpath as realpath31 } from "node:fs/promises";
|
|
77727
|
-
import { join as
|
|
77727
|
+
import { join as join52 } from "node:path";
|
|
77728
77728
|
|
|
77729
77729
|
// ../../node_modules/.bun/@langchain+core@1.2.20+ea9f70ecde856c26/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.js
|
|
77730
77730
|
var __defProp4 = Object.defineProperty;
|
|
@@ -130167,6 +130167,9 @@ function createMissionContainerPorts(dependencies = {}) {
|
|
|
130167
130167
|
};
|
|
130168
130168
|
}
|
|
130169
130169
|
|
|
130170
|
+
// src/chief-missions.ts
|
|
130171
|
+
import { join as join50 } from "node:path";
|
|
130172
|
+
|
|
130170
130173
|
// src/chief-reconcile.ts
|
|
130171
130174
|
init_execution();
|
|
130172
130175
|
import { join as join48 } from "node:path";
|
|
@@ -130295,9 +130298,47 @@ async function watchOrders(root = process.cwd(), dependencies = {}) {
|
|
|
130295
130298
|
}
|
|
130296
130299
|
}
|
|
130297
130300
|
|
|
130301
|
+
// src/chief-missions.ts
|
|
130302
|
+
function registerMissionCommands(program) {
|
|
130303
|
+
const missions = program.command("missions").description("List saved Chief Director orders and their workspaces").option("--json", "Print a JSON snapshot of saved order status").option("--watch", "Resume due or interrupted orders from their saved checkpoints").option("--service", "Treat watcher SIGTERM as recoverable service shutdown; requires --watch").action(async (options) => {
|
|
130304
|
+
if (options.json && options.watch)
|
|
130305
|
+
throw new Error("Use av missions --json for a snapshot, or av missions --watch to resume eligible orders; choose one.");
|
|
130306
|
+
if (options.service && !options.watch)
|
|
130307
|
+
throw new Error("Use --service with av missions --watch.");
|
|
130308
|
+
if (options.watch) {
|
|
130309
|
+
await watchOrders(process.cwd(), { service: options.service });
|
|
130310
|
+
return;
|
|
130311
|
+
}
|
|
130312
|
+
const missions = await new MissionStore(join50(process.cwd(), ".agent-valley/missions")).list();
|
|
130313
|
+
if (options.json) {
|
|
130314
|
+
console.log(JSON.stringify(missions.map((mission) => ({
|
|
130315
|
+
id: mission.id,
|
|
130316
|
+
status: mission.status,
|
|
130317
|
+
goal: mission.goal,
|
|
130318
|
+
workspacePath: mission.workspace.path,
|
|
130319
|
+
branch: mission.workspace.branch,
|
|
130320
|
+
completedTasks: mission.tasks.filter((task) => task.status === "completed").length,
|
|
130321
|
+
totalTasks: mission.tasks.length,
|
|
130322
|
+
reason: mission.codeDelivery?.error ?? mission.execution?.pauseReason ?? mission.error ?? null,
|
|
130323
|
+
nextRunAt: mission.codeDelivery?.nextRunAt ?? mission.execution?.nextRunAt ?? null,
|
|
130324
|
+
delivery: mission.codeDelivery ? { phase: mission.codeDelivery.phase, commitSha: mission.codeDelivery.commitSha ?? null } : null
|
|
130325
|
+
}))));
|
|
130326
|
+
return;
|
|
130327
|
+
}
|
|
130328
|
+
if (!missions.length)
|
|
130329
|
+
console.log("No orders yet. Run bun av order --help.");
|
|
130330
|
+
for (const mission of missions) {
|
|
130331
|
+
console.log(`${mission.id} ${mission.status} ${mission.tasks.filter((task) => task.status === "completed").length}/${mission.tasks.length} ${mission.goal.slice(0, 100)}`);
|
|
130332
|
+
console.log(` ${mission.workspace.path}${mission.error ? `
|
|
130333
|
+
${mission.error}` : ""}`);
|
|
130334
|
+
}
|
|
130335
|
+
});
|
|
130336
|
+
registerMissionReconciliation(missions);
|
|
130337
|
+
}
|
|
130338
|
+
|
|
130298
130339
|
// src/chief-workspace-dependencies.ts
|
|
130299
130340
|
import { lstat as lstat21, mkdir as mkdir26, readdir as readdir14, readFile as readFile18, realpath as realpath30, stat as stat5, symlink } from "node:fs/promises";
|
|
130300
|
-
import { join as
|
|
130341
|
+
import { join as join51, relative as relative18, resolve as resolve33, sep as sep17 } from "node:path";
|
|
130301
130342
|
var caches = new Set([".cache", ".vite", ".vite-temp"]);
|
|
130302
130343
|
var inside3 = (root, path) => path === root || path.startsWith(`${root}${sep17}`);
|
|
130303
130344
|
async function prepareMissionDependencies(repository, workspace) {
|
|
@@ -130305,7 +130346,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130305
130346
|
const target = await realpath30(workspace);
|
|
130306
130347
|
if (source === target)
|
|
130307
130348
|
throw new Error("Dependency preparation requires a separate mission workspace.");
|
|
130308
|
-
const packagePath =
|
|
130349
|
+
const packagePath = join51(source, "package.json");
|
|
130309
130350
|
const metadata = await readFile18(packagePath, "utf8").catch((error) => {
|
|
130310
130351
|
if (error.code === "ENOENT")
|
|
130311
130352
|
return null;
|
|
@@ -130337,10 +130378,10 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130337
130378
|
if (segment === "*") {
|
|
130338
130379
|
for (const entry of await readdir14(directory, { withFileTypes: true }).catch(() => [])) {
|
|
130339
130380
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules")
|
|
130340
|
-
await expand(
|
|
130381
|
+
await expand(join51(directory, entry.name), rest);
|
|
130341
130382
|
}
|
|
130342
130383
|
} else if (segment)
|
|
130343
|
-
await expand(
|
|
130384
|
+
await expand(join51(directory, segment), rest);
|
|
130344
130385
|
}
|
|
130345
130386
|
for (const pattern of patterns) {
|
|
130346
130387
|
if (typeof pattern !== "string" || pattern.length > 1024 || pattern.startsWith("/") || pattern.split("/").some((part) => !part || part === "." || part === ".." || part.startsWith(".") || part === "node_modules" || part !== "*" && /[*?\\:]/.test(part)) || pattern.split("/").length > 8)
|
|
@@ -130376,7 +130417,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130376
130417
|
await symlink(installed, to, (await stat5(installed)).isDirectory() ? "dir" : "file");
|
|
130377
130418
|
}
|
|
130378
130419
|
for (const root of roots) {
|
|
130379
|
-
const modules =
|
|
130420
|
+
const modules = join51(root, "node_modules");
|
|
130380
130421
|
const installed = await stat5(modules).catch(() => {
|
|
130381
130422
|
return;
|
|
130382
130423
|
});
|
|
@@ -130385,7 +130426,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130385
130426
|
const destinationRoot = await realpath30(resolve33(target, relative18(source, root)));
|
|
130386
130427
|
if (!inside3(target, destinationRoot))
|
|
130387
130428
|
throw new Error("A mission package directory escapes its workspace.");
|
|
130388
|
-
const destination =
|
|
130429
|
+
const destination = join51(destinationRoot, "node_modules");
|
|
130389
130430
|
const existing = await lstat21(destination).catch(() => {
|
|
130390
130431
|
return;
|
|
130391
130432
|
});
|
|
@@ -130395,8 +130436,8 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130395
130436
|
for (const entry of await readdir14(modules, { withFileTypes: true })) {
|
|
130396
130437
|
if (caches.has(entry.name))
|
|
130397
130438
|
continue;
|
|
130398
|
-
const from =
|
|
130399
|
-
const to =
|
|
130439
|
+
const from = join51(modules, entry.name);
|
|
130440
|
+
const to = join51(destination, entry.name);
|
|
130400
130441
|
if (entry.name.startsWith("@") && entry.isDirectory()) {
|
|
130401
130442
|
const scope = await lstat21(to).catch(() => {
|
|
130402
130443
|
return;
|
|
@@ -130405,7 +130446,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130405
130446
|
throw new Error("A dependency scope must be a local directory.");
|
|
130406
130447
|
await mkdir26(to, { recursive: true });
|
|
130407
130448
|
for (const member of await readdir14(from))
|
|
130408
|
-
await link(
|
|
130449
|
+
await link(join51(from, member), join51(to, member));
|
|
130409
130450
|
} else
|
|
130410
130451
|
await link(from, to);
|
|
130411
130452
|
}
|
|
@@ -130435,7 +130476,7 @@ async function runOrder(goal, options, root = process.cwd()) {
|
|
|
130435
130476
|
throw new Error("Code delivery retains its saved branch, paths, commit message and hook policy. Resume without replacement delivery options.");
|
|
130436
130477
|
if (!options.resume && [options.retry, options.resolveEffect, options.effectResult, options.accountRun, options.accountCost].some((value) => value !== undefined && value !== false))
|
|
130437
130478
|
throw new Error("Use --resume <id> for retry, external-effect resolution or cost reconciliation.");
|
|
130438
|
-
const store = new MissionStore(
|
|
130479
|
+
const store = new MissionStore(join52(root, ".agent-valley/missions"));
|
|
130439
130480
|
const id = options.resume ?? options.missionId ?? randomUUID22();
|
|
130440
130481
|
const unlock = await store.lock(id);
|
|
130441
130482
|
const abortController = new AbortController;
|
|
@@ -130480,7 +130521,7 @@ async function runOrder(goal, options, root = process.cwd()) {
|
|
|
130480
130521
|
throw new Error("Internal child launch does not match its saved operation, goal and accepted baseline. Restore the original operation checkpoint.");
|
|
130481
130522
|
if (Boolean(options.baselineWorkspace) !== Boolean(options.operationId))
|
|
130482
130523
|
throw new Error("An internal operation snapshot requires both its operation identity and accepted baseline.");
|
|
130483
|
-
const workspace = options.baselineWorkspace && options.operationId ? await createContinuousMissionWorkspace(config.workspace, options.operationId, options.baselineWorkspace, id, goal) : await new WorkspaceManager(config.workspace).create(missionIssue(id, goal), undefined, codeDelivery ?
|
|
130524
|
+
const workspace = options.baselineWorkspace && options.operationId ? await createContinuousMissionWorkspace(config.workspace, options.operationId, options.baselineWorkspace, id, goal) : await new WorkspaceManager(config.workspace).create(missionIssue(id, goal), undefined, codeDelivery ? join52(config.workspace, ".agent-valley", "workspaces") : undefined);
|
|
130484
130525
|
if (options.operationId)
|
|
130485
130526
|
await restoreOperationOrigin(config.workspace, workspace.path);
|
|
130486
130527
|
if (!codeDelivery)
|
|
@@ -130645,7 +130686,7 @@ async function dispatchOrder(goal, options, root = process.cwd(), dependencies =
|
|
|
130645
130686
|
};
|
|
130646
130687
|
const [operation, mission] = await Promise.all([
|
|
130647
130688
|
operationStore(root).load(options.resume).catch(missing),
|
|
130648
|
-
new MissionStore(
|
|
130689
|
+
new MissionStore(join52(root, ".agent-valley", "missions")).load(options.resume).catch(missing)
|
|
130649
130690
|
]);
|
|
130650
130691
|
if (operation && mission)
|
|
130651
130692
|
throw new Error(`Saved ID ${options.resume} names both an operation and a mission. Use --once to resume the mission; inspect av operations before resuming the operation.`);
|
|
@@ -130694,28 +130735,12 @@ function registerChiefCommands(program) {
|
|
|
130694
130735
|
process.exitCode = orderExitCode(result);
|
|
130695
130736
|
}
|
|
130696
130737
|
});
|
|
130697
|
-
|
|
130698
|
-
if (options.service && !options.watch)
|
|
130699
|
-
throw new Error("Use --service with av missions --watch.");
|
|
130700
|
-
if (options.watch) {
|
|
130701
|
-
await watchOrders(process.cwd(), { service: options.service });
|
|
130702
|
-
return;
|
|
130703
|
-
}
|
|
130704
|
-
const missions = await new MissionStore(join51(process.cwd(), ".agent-valley/missions")).list();
|
|
130705
|
-
if (!missions.length)
|
|
130706
|
-
console.log("No orders yet. Run bun av order --help.");
|
|
130707
|
-
for (const mission of missions) {
|
|
130708
|
-
console.log(`${mission.id} ${mission.status} ${mission.tasks.filter((task) => task.status === "completed").length}/${mission.tasks.length} ${mission.goal.slice(0, 100)}`);
|
|
130709
|
-
console.log(` ${mission.workspace.path}${mission.error ? `
|
|
130710
|
-
${mission.error}` : ""}`);
|
|
130711
|
-
}
|
|
130712
|
-
});
|
|
130713
|
-
registerMissionReconciliation(missions);
|
|
130738
|
+
registerMissionCommands(program);
|
|
130714
130739
|
}
|
|
130715
130740
|
|
|
130716
130741
|
// src/chief-organization.ts
|
|
130717
130742
|
import { readFile as readFile19, stat as stat6 } from "node:fs/promises";
|
|
130718
|
-
import { isAbsolute as isAbsolute20, join as
|
|
130743
|
+
import { isAbsolute as isAbsolute20, join as join53, resolve as resolve34 } from "node:path";
|
|
130719
130744
|
init_chief_schema();
|
|
130720
130745
|
init_yaml_loader();
|
|
130721
130746
|
function organizationRepository(root, workspace) {
|
|
@@ -130769,13 +130794,13 @@ function registerOrganizationCommands(program) {
|
|
|
130769
130794
|
});
|
|
130770
130795
|
const reports = program.command("reports").description("Inspect and retry third-party report attachments");
|
|
130771
130796
|
reports.command("list").option("--workspace <path>", "Source repository").action(async (opts) => {
|
|
130772
|
-
console.log(JSON.stringify(await listReportDeliveries(
|
|
130797
|
+
console.log(JSON.stringify(await listReportDeliveries(join53(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
|
|
130773
130798
|
});
|
|
130774
130799
|
reports.command("retry").option("--workspace <path>", "Source repository").action(async (opts) => {
|
|
130775
130800
|
const config = mergeChiefConfig(loadGlobalConfig()?.chief, loadProjectConfig()?.chief);
|
|
130776
130801
|
if (!config.reporting)
|
|
130777
130802
|
throw new Error("Set chief.reporting.destinations in av.yaml before retrying reports.");
|
|
130778
|
-
console.log(JSON.stringify(await retryPendingReports(config.reporting,
|
|
130803
|
+
console.log(JSON.stringify(await retryPendingReports(config.reporting, join53(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
|
|
130779
130804
|
});
|
|
130780
130805
|
}
|
|
130781
130806
|
|
|
@@ -130800,10 +130825,10 @@ var import_picocolors = __toESM(require_picocolors(), 1);
|
|
|
130800
130825
|
init_project_config_path();
|
|
130801
130826
|
init_yaml_loader();
|
|
130802
130827
|
init_doctor_checks();
|
|
130803
|
-
import { join as
|
|
130828
|
+
import { join as join57 } from "node:path";
|
|
130804
130829
|
|
|
130805
130830
|
// src/doctor-oma-checks.ts
|
|
130806
|
-
import { join as
|
|
130831
|
+
import { join as join56 } from "node:path";
|
|
130807
130832
|
function checkOma(project, deps) {
|
|
130808
130833
|
const strict = project?.oma?.mode === "strict";
|
|
130809
130834
|
const order = !!project && !project.tracker && !project.linear && !project.github;
|
|
@@ -130891,7 +130916,7 @@ function checkOma(project, deps) {
|
|
|
130891
130916
|
fix: "Set verify.command to a deterministic non-build check in av.yaml before using oma.mode: strict.",
|
|
130892
130917
|
critical: true
|
|
130893
130918
|
});
|
|
130894
|
-
const triggerPath =
|
|
130919
|
+
const triggerPath = join56(deps.cwd, ".agents", "hooks", "core", "triggers.json");
|
|
130895
130920
|
let table = null;
|
|
130896
130921
|
try {
|
|
130897
130922
|
table = parseTriggerTable(deps.readFileSync(triggerPath));
|
|
@@ -130908,7 +130933,7 @@ function checkOma(project, deps) {
|
|
|
130908
130933
|
return results;
|
|
130909
130934
|
}
|
|
130910
130935
|
results.push({ id: "oma.triggers", name: "OMA trigger table", status: "pass", message: triggerPath, critical: false });
|
|
130911
|
-
const missing = Object.entries(table.workflows).filter(([name, workflow]) => !workflow.persistent && !table.excludedWorkflows.includes(name)).map(([name]) =>
|
|
130936
|
+
const missing = Object.entries(table.workflows).filter(([name, workflow]) => !workflow.persistent && !table.excludedWorkflows.includes(name)).map(([name]) => join56(deps.cwd, ".agents", "workflows", `${name}.md`)).filter((path) => !deps.existsSync(path));
|
|
130912
130937
|
results.push(missing.length === 0 ? {
|
|
130913
130938
|
id: "oma.workflows",
|
|
130914
130939
|
name: "OMA workflow files",
|
|
@@ -130983,7 +131008,7 @@ function checkTunnel(project, deps) {
|
|
|
130983
131008
|
}
|
|
130984
131009
|
const mode = project?.tunnel?.cloudflare?.mode ?? "quick";
|
|
130985
131010
|
if (mode === "named") {
|
|
130986
|
-
const certPath =
|
|
131011
|
+
const certPath = join57(deps.home, ".cloudflared", "cert.pem");
|
|
130987
131012
|
if (!deps.existsSync(certPath)) {
|
|
130988
131013
|
return {
|
|
130989
131014
|
id: "tunnel",
|
|
@@ -131023,7 +131048,7 @@ function checkTunnel(project, deps) {
|
|
|
131023
131048
|
critical: false
|
|
131024
131049
|
};
|
|
131025
131050
|
}
|
|
131026
|
-
const ngrokConfigPath = deps.platform === "darwin" ?
|
|
131051
|
+
const ngrokConfigPath = deps.platform === "darwin" ? join57(deps.home, "Library", "Application Support", "ngrok", "ngrok.yml") : join57(deps.home, ".config", "ngrok", "ngrok.yml");
|
|
131027
131052
|
if (!deps.existsSync(ngrokConfigPath)) {
|
|
131028
131053
|
return {
|
|
131029
131054
|
id: "tunnel",
|
|
@@ -131094,7 +131119,7 @@ function checkConfig(deps) {
|
|
|
131094
131119
|
critical: true
|
|
131095
131120
|
});
|
|
131096
131121
|
}
|
|
131097
|
-
const projectPath =
|
|
131122
|
+
const projectPath = join57(deps.cwd, PROJECT_CONFIG_FILENAME);
|
|
131098
131123
|
try {
|
|
131099
131124
|
project = deps.loadProjectConfig(deps.cwd);
|
|
131100
131125
|
results.push(project ? {
|
|
@@ -135651,7 +135676,7 @@ init_team_relay_error();
|
|
|
135651
135676
|
// ../../packages/core/src/relay/turso-migration-assets.ts
|
|
135652
135677
|
init_zod();
|
|
135653
135678
|
import { copyFile as copyFile3, lstat as lstat26, mkdir as mkdir27, readFile as readFile21 } from "node:fs/promises";
|
|
135654
|
-
import { dirname as dirname13, join as
|
|
135679
|
+
import { dirname as dirname13, join as join63 } from "node:path";
|
|
135655
135680
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
135656
135681
|
var TURSO_MIGRATION_ASSET_PATH = "assets/turso/migrations";
|
|
135657
135682
|
var journalSchema = object({
|
|
@@ -135689,10 +135714,10 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
|
|
|
135689
135714
|
if (!info.isDirectory() || info.isSymbolicLink())
|
|
135690
135715
|
throw new Error(`Turso migration directory ${directory} must be a regular directory. Restore the checkout or reinstall the CLI package.`);
|
|
135691
135716
|
try {
|
|
135692
|
-
const meta = await lstat26(
|
|
135717
|
+
const meta = await lstat26(join63(directory, "meta"));
|
|
135693
135718
|
if (!meta.isDirectory() || meta.isSymbolicLink())
|
|
135694
135719
|
throw new Error("Invalid migration metadata directory");
|
|
135695
|
-
const journalPath =
|
|
135720
|
+
const journalPath = join63(directory, "meta/_journal.json");
|
|
135696
135721
|
await regularFile(journalPath);
|
|
135697
135722
|
const journal = journalSchema.parse(JSON.parse(await readFile21(journalPath, "utf8")));
|
|
135698
135723
|
const tags = journal.entries.map((entry) => entry.tag);
|
|
@@ -135700,8 +135725,8 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
|
|
|
135700
135725
|
throw new Error("Duplicate migration tags");
|
|
135701
135726
|
const files = ["meta/_journal.json", ...tags.map((tag) => `${tag}.sql`)];
|
|
135702
135727
|
for (const file of files.slice(1)) {
|
|
135703
|
-
await regularFile(
|
|
135704
|
-
if (!(await readFile21(
|
|
135728
|
+
await regularFile(join63(directory, file));
|
|
135729
|
+
if (!(await readFile21(join63(directory, file), "utf8")).trim())
|
|
135705
135730
|
throw new Error("Empty migration SQL");
|
|
135706
135731
|
}
|
|
135707
135732
|
return { directory, files };
|