agent-valley 4.2.1 → 4.4.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/README.md +5 -0
- package/dist/assets/plugin.json +1 -1
- package/dist/index.js +109 -72
- package/dist/supervisor.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,6 +194,9 @@ linear:
|
|
|
194
194
|
# in_progress: valley:wip
|
|
195
195
|
# done: valley:done
|
|
196
196
|
# cancelled: valley:cancelled
|
|
197
|
+
# comment_relay:
|
|
198
|
+
# enabled: false
|
|
199
|
+
# ignore_authors: []
|
|
197
200
|
|
|
198
201
|
workspace:
|
|
199
202
|
root: /absolute/path/to/target-repo
|
|
@@ -391,6 +394,8 @@ PixiJS-rendered office scene showing real-time actor status:
|
|
|
391
394
|
|
|
392
395
|
Alongside Linear, GitHub Issues can drive the orchestrator. Set `tracker.kind: github` in `av.yaml` and configure the GitHub section — the domain `IssueTracker` / `WebhookReceiver` ports swap transparently. Both trackers reuse the same orchestration, retry, and delivery pipeline.
|
|
393
396
|
|
|
397
|
+
With `github.comment_relay.enabled: true` and the webhook subscribed to **Issue comments**, a new comment from a repository owner, member or collaborator on an issue whose actor is running reaches that actor as an added instruction. Codex receives it in the running session; stateless actors such as Claude restart the attempt with the comment. Agent Valley's own comments, bot accounts, outside contributors, `ignore_authors`, edited comments and pull request comments are not relayed. Add the account behind `GITHUB_TOKEN` to `ignore_authors` when actors comment with it.
|
|
398
|
+
|
|
394
399
|
### Observability (v0.2+)
|
|
395
400
|
|
|
396
401
|
OpenTelemetry OTLP HTTP traces and Prometheus metrics ship built in but **default to off**. Enable per deployment via the `observability` section in `av.yaml`. When enabled:
|
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.4.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
|
@@ -15170,7 +15170,11 @@ function mergeConfigs(global2, project, env) {
|
|
|
15170
15170
|
owner: project.github.owner ?? "",
|
|
15171
15171
|
repo: project.github.repo ?? "",
|
|
15172
15172
|
webhookSecret: project.github.webhook_secret ?? "",
|
|
15173
|
-
labels
|
|
15173
|
+
labels,
|
|
15174
|
+
commentRelay: {
|
|
15175
|
+
enabled: project.github.comment_relay?.enabled ?? false,
|
|
15176
|
+
ignoreAuthors: project.github.comment_relay?.ignore_authors ?? []
|
|
15177
|
+
}
|
|
15174
15178
|
};
|
|
15175
15179
|
githubWorkflowStates = labels;
|
|
15176
15180
|
}
|
|
@@ -15310,6 +15314,10 @@ var init_yaml_loader = __esm(() => {
|
|
|
15310
15314
|
in_progress: string2().min(1).optional(),
|
|
15311
15315
|
done: string2().min(1).optional(),
|
|
15312
15316
|
cancelled: string2().min(1).optional()
|
|
15317
|
+
}).optional(),
|
|
15318
|
+
comment_relay: object({
|
|
15319
|
+
enabled: boolean2().optional(),
|
|
15320
|
+
ignore_authors: array(string2().min(1)).optional()
|
|
15313
15321
|
}).optional()
|
|
15314
15322
|
}).optional(),
|
|
15315
15323
|
workspace: object({
|
|
@@ -15362,7 +15370,11 @@ var init_yaml_loader = __esm(() => {
|
|
|
15362
15370
|
Fix: Add it to av.yaml`),
|
|
15363
15371
|
cancelled: string2().min(1, `github.labels.cancelled is not set.
|
|
15364
15372
|
Fix: Add it to av.yaml`)
|
|
15365
|
-
})
|
|
15373
|
+
}),
|
|
15374
|
+
commentRelay: object({
|
|
15375
|
+
enabled: boolean2(),
|
|
15376
|
+
ignoreAuthors: array(string2())
|
|
15377
|
+
}).optional()
|
|
15366
15378
|
});
|
|
15367
15379
|
mergedConfigSchema = object({
|
|
15368
15380
|
trackerKind: _enum(["linear", "github"]),
|
|
@@ -23965,7 +23977,7 @@ function canonicalConfig(config) {
|
|
|
23965
23977
|
import { spawn as spawn11 } from "node:child_process";
|
|
23966
23978
|
import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
|
|
23967
23979
|
import { homedir as homedir8, tmpdir as tmpdir4 } from "node:os";
|
|
23968
|
-
import { delimiter as delimiter3, join as
|
|
23980
|
+
import { delimiter as delimiter3, join as join58 } from "node:path";
|
|
23969
23981
|
function runTerminalCommand(request, spawnCommand = spawn11) {
|
|
23970
23982
|
return new Promise((resolve) => {
|
|
23971
23983
|
let child;
|
|
@@ -24014,7 +24026,7 @@ function defaults2() {
|
|
|
24014
24026
|
discover: discoverAgents,
|
|
24015
24027
|
runCommand: runTerminalCommand,
|
|
24016
24028
|
supportsLoginCommand: (agent, path, env) => supportsNativeLoginCommand(agent, path, { env }),
|
|
24017
|
-
makeTempDir: () => mkdtempSync(
|
|
24029
|
+
makeTempDir: () => mkdtempSync(join58(tmpdir4(), "av-agent-install-")),
|
|
24018
24030
|
removeTempDir: (path) => rmSync2(path, { recursive: true, force: true })
|
|
24019
24031
|
};
|
|
24020
24032
|
}
|
|
@@ -24041,7 +24053,7 @@ async function runOfficialInstaller(installerUrl, deps, options = {}) {
|
|
|
24041
24053
|
let directory;
|
|
24042
24054
|
try {
|
|
24043
24055
|
directory = deps.makeTempDir();
|
|
24044
|
-
const scriptPath =
|
|
24056
|
+
const scriptPath = join58(directory, "install.sh");
|
|
24045
24057
|
const request = { env: options.env ?? deps.env, ...options.cwd ? { cwd: options.cwd } : {} };
|
|
24046
24058
|
const download = await deps.runCommand({
|
|
24047
24059
|
command: curl,
|
|
@@ -24112,7 +24124,7 @@ async function installChiefAgent(agent, overrides = {}) {
|
|
|
24112
24124
|
const install = await runOfficialInstaller(plan.installerUrl, deps);
|
|
24113
24125
|
if (!install.success)
|
|
24114
24126
|
return commandFailure(install.stage === "download" ? "Installer download" : "Installation", install, plan.documentation);
|
|
24115
|
-
const localBin =
|
|
24127
|
+
const localBin = join58(deps.home, ".local", "bin");
|
|
24116
24128
|
const pathParts = (deps.env.PATH ?? "").split(delimiter3);
|
|
24117
24129
|
if (!pathParts.includes(localBin))
|
|
24118
24130
|
deps.env.PATH = [localBin, ...pathParts.filter(Boolean)].join(delimiter3);
|
|
@@ -24215,16 +24227,16 @@ var init_agent_provisioning = __esm(() => {
|
|
|
24215
24227
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync3 } from "node:fs";
|
|
24216
24228
|
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
24229
|
import { homedir as homedir9, tmpdir as tmpdir5 } from "node:os";
|
|
24218
|
-
import { delimiter as delimiter4, isAbsolute as isAbsolute22, join as
|
|
24230
|
+
import { delimiter as delimiter4, isAbsolute as isAbsolute22, join as join59, relative as relative21, resolve as resolve40 } from "node:path";
|
|
24219
24231
|
function defaults3() {
|
|
24220
24232
|
const home = homedir9();
|
|
24221
24233
|
return {
|
|
24222
24234
|
platform: process.platform,
|
|
24223
24235
|
home,
|
|
24224
24236
|
env: process.env,
|
|
24225
|
-
resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [
|
|
24237
|
+
resolveBinary: (name) => resolveBinaryPath(name, name === "bun" ? [join59(process.env.BUN_INSTALL ?? join59(home, ".bun"), "bin", "bun")] : []),
|
|
24226
24238
|
runCommand: runTerminalCommand,
|
|
24227
|
-
makeTempDir: () => mkdtempSync2(
|
|
24239
|
+
makeTempDir: () => mkdtempSync2(join59(tmpdir5(), "av-oma-install-")),
|
|
24228
24240
|
removeTempDir: (path) => rmSync3(path, { recursive: true, force: true })
|
|
24229
24241
|
};
|
|
24230
24242
|
}
|
|
@@ -24245,7 +24257,7 @@ async function present(path) {
|
|
|
24245
24257
|
}
|
|
24246
24258
|
async function installedVersion2(skills) {
|
|
24247
24259
|
try {
|
|
24248
|
-
const marker = JSON.parse(await readFile20(
|
|
24260
|
+
const marker = JSON.parse(await readFile20(join59(skills, "_version.json"), "utf8"));
|
|
24249
24261
|
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
24262
|
} catch {
|
|
24251
24263
|
return null;
|
|
@@ -24254,7 +24266,7 @@ async function installedVersion2(skills) {
|
|
|
24254
24266
|
async function snapshotConfig(agents) {
|
|
24255
24267
|
const snapshots = [];
|
|
24256
24268
|
for (const name of CUSTOM_CONFIG_NAMES) {
|
|
24257
|
-
const path =
|
|
24269
|
+
const path = join59(agents, name);
|
|
24258
24270
|
if (!await present(path))
|
|
24259
24271
|
continue;
|
|
24260
24272
|
const file = await lstat24(path);
|
|
@@ -24274,10 +24286,10 @@ async function restoreConfig(agents, snapshots) {
|
|
|
24274
24286
|
["oma-config.yaml", "oma-config.cue"],
|
|
24275
24287
|
["oma-config.local.yaml", "oma-config.local.cue"]
|
|
24276
24288
|
]) {
|
|
24277
|
-
if (!pair.some((name) => original.has(
|
|
24289
|
+
if (!pair.some((name) => original.has(join59(agents, name))))
|
|
24278
24290
|
continue;
|
|
24279
24291
|
for (const name of pair) {
|
|
24280
|
-
const path =
|
|
24292
|
+
const path = join59(agents, name);
|
|
24281
24293
|
if (!original.has(path))
|
|
24282
24294
|
await unlink7(path).catch((error) => {
|
|
24283
24295
|
if (error.code !== "ENOENT")
|
|
@@ -24292,7 +24304,7 @@ async function workspacePath(input) {
|
|
|
24292
24304
|
const root = resolve40(input);
|
|
24293
24305
|
if (!await directory2(root))
|
|
24294
24306
|
return null;
|
|
24295
|
-
for (const path of [
|
|
24307
|
+
for (const path of [join59(root, ".agents"), join59(root, ".agents", "skills")]) {
|
|
24296
24308
|
if (!await present(path))
|
|
24297
24309
|
continue;
|
|
24298
24310
|
const actual = await realpath33(path);
|
|
@@ -24307,7 +24319,7 @@ async function inspectOma(workspaceRoot, _overrides = {}) {
|
|
|
24307
24319
|
const root = await workspacePath(workspaceRoot);
|
|
24308
24320
|
if (!root)
|
|
24309
24321
|
return { success: false, message: "Choose an existing absolute workspace with project-local OMA files." };
|
|
24310
|
-
const skills =
|
|
24322
|
+
const skills = join59(root, ".agents", "skills");
|
|
24311
24323
|
const version = await installedVersion2(skills);
|
|
24312
24324
|
if (!version)
|
|
24313
24325
|
throw new Error("Invalid installed metadata");
|
|
@@ -24315,7 +24327,7 @@ async function inspectOma(workspaceRoot, _overrides = {}) {
|
|
|
24315
24327
|
if (!entries.length)
|
|
24316
24328
|
throw new Error("No installed skills");
|
|
24317
24329
|
for (const entry of entries) {
|
|
24318
|
-
if (!entry.isDirectory() || !(await lstat24(
|
|
24330
|
+
if (!entry.isDirectory() || !(await lstat24(join59(skills, entry.name, "SKILL.md"))).isFile())
|
|
24319
24331
|
throw new Error("Incomplete installed skill");
|
|
24320
24332
|
}
|
|
24321
24333
|
return {
|
|
@@ -24363,16 +24375,16 @@ async function prepareOma(workspaceRoot, overrides = {}) {
|
|
|
24363
24375
|
delete environment.OMA_YES;
|
|
24364
24376
|
environment.CI = "true";
|
|
24365
24377
|
const paths = [
|
|
24366
|
-
deps.env.BUN_INSTALL_BIN ??
|
|
24367
|
-
|
|
24378
|
+
deps.env.BUN_INSTALL_BIN ?? join59(deps.env.BUN_INSTALL ?? join59(deps.home, ".bun"), "bin"),
|
|
24379
|
+
join59(deps.home, ".local", "bin")
|
|
24368
24380
|
];
|
|
24369
24381
|
environment.PATH = [...new Set([...paths, ...(environment.PATH ?? "").split(delimiter4).filter(Boolean)])].join(delimiter4);
|
|
24370
24382
|
const request = { command: bun, env: environment, cwd: root, timeoutMs: 300000 };
|
|
24371
24383
|
const latest = await deps.runCommand({ ...request, args: ["install", "--global", LATEST_PACKAGE] });
|
|
24372
24384
|
if (!latest.success)
|
|
24373
24385
|
return failure3("OMA CLI update", latest);
|
|
24374
|
-
const agents =
|
|
24375
|
-
const existing = await installedVersion2(
|
|
24386
|
+
const agents = join59(root, ".agents");
|
|
24387
|
+
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
24388
|
const custom = await snapshotConfig(agents);
|
|
24377
24389
|
const args = existing ? ["update", "--yes", "--with-new-skills", "--all"] : ["install"];
|
|
24378
24390
|
let installed;
|
|
@@ -25915,7 +25927,7 @@ var init_workspace_step = __esm(() => {
|
|
|
25915
25927
|
|
|
25916
25928
|
// src/setup/noninteractive-config.ts
|
|
25917
25929
|
import { lstat as lstat25, realpath as realpath34 } from "node:fs/promises";
|
|
25918
|
-
import { isAbsolute as isAbsolute24, join as
|
|
25930
|
+
import { isAbsolute as isAbsolute24, join as join60, parse as parsePath, resolve as resolve41 } from "node:path";
|
|
25919
25931
|
function validateNoninteractiveOptions(options) {
|
|
25920
25932
|
if (!options.yes || options.edit || options.mode !== undefined && options.mode !== "order")
|
|
25921
25933
|
throw new Error("Use av setup --yes only for local order setup; --edit and --mode tracker require interactive setup.");
|
|
@@ -25959,7 +25971,7 @@ function selectChief(options, deps, project, global2) {
|
|
|
25959
25971
|
const globalActor = actor(global2);
|
|
25960
25972
|
const selected = options.actor ?? runtime?.actorType ?? projectActor.type ?? globalActor.type;
|
|
25961
25973
|
if (!selected)
|
|
25962
|
-
throw new Error(`actor.type is missing in ${
|
|
25974
|
+
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
25975
|
const actorType = selected;
|
|
25964
25976
|
const actorSource = options.actor !== undefined ? "explicit" : runtime ? "runtime" : projectActor.type ? "project" : "global";
|
|
25965
25977
|
const previousType = projectActor.type ?? globalActor.type;
|
|
@@ -26004,7 +26016,7 @@ async function prepareNoninteractiveConfig(options, deps) {
|
|
|
26004
26016
|
throw new Error(`AV configuration directory ${deps.projectRoot} does not exist. Run av setup from an existing directory.`);
|
|
26005
26017
|
}
|
|
26006
26018
|
const globalPath = resolve41(deps.globalConfigPath);
|
|
26007
|
-
const projectPath =
|
|
26019
|
+
const projectPath = join60(projectRoot, "av.yaml");
|
|
26008
26020
|
const project = await configFile(projectPath, projectConfigSchema);
|
|
26009
26021
|
const global2 = await configFile(globalPath, globalConfigSchema);
|
|
26010
26022
|
const chief = selectChief(options, { ...deps, projectRoot, globalConfigPath: globalPath }, project.raw, global2.raw);
|
|
@@ -26057,7 +26069,7 @@ var init_noninteractive_config = __esm(() => {
|
|
|
26057
26069
|
});
|
|
26058
26070
|
|
|
26059
26071
|
// src/setup/noninteractive.ts
|
|
26060
|
-
import { join as
|
|
26072
|
+
import { join as join61, parse as parsePath2, resolve as resolve42 } from "node:path";
|
|
26061
26073
|
function rerunCommand(result, options) {
|
|
26062
26074
|
const quote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
|
|
26063
26075
|
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 +26083,7 @@ async function setupNoninteractive(options, overrides = {}) {
|
|
|
26071
26083
|
projectRoot: resolve42(deps.projectRoot),
|
|
26072
26084
|
workspace: null,
|
|
26073
26085
|
config: {
|
|
26074
|
-
project:
|
|
26086
|
+
project: join61(resolve42(deps.projectRoot), "av.yaml"),
|
|
26075
26087
|
global: resolve42(deps.globalConfigPath),
|
|
26076
26088
|
saved: false
|
|
26077
26089
|
},
|
|
@@ -28524,9 +28536,9 @@ var init_setup = __esm(() => {
|
|
|
28524
28536
|
// ../../packages/core/src/relay/credentials.ts
|
|
28525
28537
|
import { readFileSync as readFileSync13 } from "node:fs";
|
|
28526
28538
|
import { homedir as homedir10 } from "node:os";
|
|
28527
|
-
import { join as
|
|
28539
|
+
import { join as join62 } from "node:path";
|
|
28528
28540
|
function defaultCredentialsPath() {
|
|
28529
|
-
return
|
|
28541
|
+
return join62(homedir10(), ".agent-valley", "credentials.json");
|
|
28530
28542
|
}
|
|
28531
28543
|
function validateRelayCredentials(value, binding, now = Date.now()) {
|
|
28532
28544
|
const result = credentialsSchema.safeParse(value);
|
|
@@ -77724,7 +77736,7 @@ function registerAgentClientCommands(program) {
|
|
|
77724
77736
|
// src/chief.ts
|
|
77725
77737
|
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
77726
77738
|
import { realpath as realpath31 } from "node:fs/promises";
|
|
77727
|
-
import { join as
|
|
77739
|
+
import { join as join52 } from "node:path";
|
|
77728
77740
|
|
|
77729
77741
|
// ../../node_modules/.bun/@langchain+core@1.2.20+ea9f70ecde856c26/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.js
|
|
77730
77742
|
var __defProp4 = Object.defineProperty;
|
|
@@ -130167,6 +130179,9 @@ function createMissionContainerPorts(dependencies = {}) {
|
|
|
130167
130179
|
};
|
|
130168
130180
|
}
|
|
130169
130181
|
|
|
130182
|
+
// src/chief-missions.ts
|
|
130183
|
+
import { join as join50 } from "node:path";
|
|
130184
|
+
|
|
130170
130185
|
// src/chief-reconcile.ts
|
|
130171
130186
|
init_execution();
|
|
130172
130187
|
import { join as join48 } from "node:path";
|
|
@@ -130295,9 +130310,47 @@ async function watchOrders(root = process.cwd(), dependencies = {}) {
|
|
|
130295
130310
|
}
|
|
130296
130311
|
}
|
|
130297
130312
|
|
|
130313
|
+
// src/chief-missions.ts
|
|
130314
|
+
function registerMissionCommands(program) {
|
|
130315
|
+
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) => {
|
|
130316
|
+
if (options.json && options.watch)
|
|
130317
|
+
throw new Error("Use av missions --json for a snapshot, or av missions --watch to resume eligible orders; choose one.");
|
|
130318
|
+
if (options.service && !options.watch)
|
|
130319
|
+
throw new Error("Use --service with av missions --watch.");
|
|
130320
|
+
if (options.watch) {
|
|
130321
|
+
await watchOrders(process.cwd(), { service: options.service });
|
|
130322
|
+
return;
|
|
130323
|
+
}
|
|
130324
|
+
const missions = await new MissionStore(join50(process.cwd(), ".agent-valley/missions")).list();
|
|
130325
|
+
if (options.json) {
|
|
130326
|
+
console.log(JSON.stringify(missions.map((mission) => ({
|
|
130327
|
+
id: mission.id,
|
|
130328
|
+
status: mission.status,
|
|
130329
|
+
goal: mission.goal,
|
|
130330
|
+
workspacePath: mission.workspace.path,
|
|
130331
|
+
branch: mission.workspace.branch,
|
|
130332
|
+
completedTasks: mission.tasks.filter((task) => task.status === "completed").length,
|
|
130333
|
+
totalTasks: mission.tasks.length,
|
|
130334
|
+
reason: mission.codeDelivery?.error ?? mission.execution?.pauseReason ?? mission.error ?? null,
|
|
130335
|
+
nextRunAt: mission.codeDelivery?.nextRunAt ?? mission.execution?.nextRunAt ?? null,
|
|
130336
|
+
delivery: mission.codeDelivery ? { phase: mission.codeDelivery.phase, commitSha: mission.codeDelivery.commitSha ?? null } : null
|
|
130337
|
+
}))));
|
|
130338
|
+
return;
|
|
130339
|
+
}
|
|
130340
|
+
if (!missions.length)
|
|
130341
|
+
console.log("No orders yet. Run bun av order --help.");
|
|
130342
|
+
for (const mission of missions) {
|
|
130343
|
+
console.log(`${mission.id} ${mission.status} ${mission.tasks.filter((task) => task.status === "completed").length}/${mission.tasks.length} ${mission.goal.slice(0, 100)}`);
|
|
130344
|
+
console.log(` ${mission.workspace.path}${mission.error ? `
|
|
130345
|
+
${mission.error}` : ""}`);
|
|
130346
|
+
}
|
|
130347
|
+
});
|
|
130348
|
+
registerMissionReconciliation(missions);
|
|
130349
|
+
}
|
|
130350
|
+
|
|
130298
130351
|
// src/chief-workspace-dependencies.ts
|
|
130299
130352
|
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
|
|
130353
|
+
import { join as join51, relative as relative18, resolve as resolve33, sep as sep17 } from "node:path";
|
|
130301
130354
|
var caches = new Set([".cache", ".vite", ".vite-temp"]);
|
|
130302
130355
|
var inside3 = (root, path) => path === root || path.startsWith(`${root}${sep17}`);
|
|
130303
130356
|
async function prepareMissionDependencies(repository, workspace) {
|
|
@@ -130305,7 +130358,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130305
130358
|
const target = await realpath30(workspace);
|
|
130306
130359
|
if (source === target)
|
|
130307
130360
|
throw new Error("Dependency preparation requires a separate mission workspace.");
|
|
130308
|
-
const packagePath =
|
|
130361
|
+
const packagePath = join51(source, "package.json");
|
|
130309
130362
|
const metadata = await readFile18(packagePath, "utf8").catch((error) => {
|
|
130310
130363
|
if (error.code === "ENOENT")
|
|
130311
130364
|
return null;
|
|
@@ -130337,10 +130390,10 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130337
130390
|
if (segment === "*") {
|
|
130338
130391
|
for (const entry of await readdir14(directory, { withFileTypes: true }).catch(() => [])) {
|
|
130339
130392
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules")
|
|
130340
|
-
await expand(
|
|
130393
|
+
await expand(join51(directory, entry.name), rest);
|
|
130341
130394
|
}
|
|
130342
130395
|
} else if (segment)
|
|
130343
|
-
await expand(
|
|
130396
|
+
await expand(join51(directory, segment), rest);
|
|
130344
130397
|
}
|
|
130345
130398
|
for (const pattern of patterns) {
|
|
130346
130399
|
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 +130429,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130376
130429
|
await symlink(installed, to, (await stat5(installed)).isDirectory() ? "dir" : "file");
|
|
130377
130430
|
}
|
|
130378
130431
|
for (const root of roots) {
|
|
130379
|
-
const modules =
|
|
130432
|
+
const modules = join51(root, "node_modules");
|
|
130380
130433
|
const installed = await stat5(modules).catch(() => {
|
|
130381
130434
|
return;
|
|
130382
130435
|
});
|
|
@@ -130385,7 +130438,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130385
130438
|
const destinationRoot = await realpath30(resolve33(target, relative18(source, root)));
|
|
130386
130439
|
if (!inside3(target, destinationRoot))
|
|
130387
130440
|
throw new Error("A mission package directory escapes its workspace.");
|
|
130388
|
-
const destination =
|
|
130441
|
+
const destination = join51(destinationRoot, "node_modules");
|
|
130389
130442
|
const existing = await lstat21(destination).catch(() => {
|
|
130390
130443
|
return;
|
|
130391
130444
|
});
|
|
@@ -130395,8 +130448,8 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130395
130448
|
for (const entry of await readdir14(modules, { withFileTypes: true })) {
|
|
130396
130449
|
if (caches.has(entry.name))
|
|
130397
130450
|
continue;
|
|
130398
|
-
const from =
|
|
130399
|
-
const to =
|
|
130451
|
+
const from = join51(modules, entry.name);
|
|
130452
|
+
const to = join51(destination, entry.name);
|
|
130400
130453
|
if (entry.name.startsWith("@") && entry.isDirectory()) {
|
|
130401
130454
|
const scope = await lstat21(to).catch(() => {
|
|
130402
130455
|
return;
|
|
@@ -130405,7 +130458,7 @@ async function prepareMissionDependencies(repository, workspace) {
|
|
|
130405
130458
|
throw new Error("A dependency scope must be a local directory.");
|
|
130406
130459
|
await mkdir26(to, { recursive: true });
|
|
130407
130460
|
for (const member of await readdir14(from))
|
|
130408
|
-
await link(
|
|
130461
|
+
await link(join51(from, member), join51(to, member));
|
|
130409
130462
|
} else
|
|
130410
130463
|
await link(from, to);
|
|
130411
130464
|
}
|
|
@@ -130435,7 +130488,7 @@ async function runOrder(goal, options, root = process.cwd()) {
|
|
|
130435
130488
|
throw new Error("Code delivery retains its saved branch, paths, commit message and hook policy. Resume without replacement delivery options.");
|
|
130436
130489
|
if (!options.resume && [options.retry, options.resolveEffect, options.effectResult, options.accountRun, options.accountCost].some((value) => value !== undefined && value !== false))
|
|
130437
130490
|
throw new Error("Use --resume <id> for retry, external-effect resolution or cost reconciliation.");
|
|
130438
|
-
const store = new MissionStore(
|
|
130491
|
+
const store = new MissionStore(join52(root, ".agent-valley/missions"));
|
|
130439
130492
|
const id = options.resume ?? options.missionId ?? randomUUID22();
|
|
130440
130493
|
const unlock = await store.lock(id);
|
|
130441
130494
|
const abortController = new AbortController;
|
|
@@ -130480,7 +130533,7 @@ async function runOrder(goal, options, root = process.cwd()) {
|
|
|
130480
130533
|
throw new Error("Internal child launch does not match its saved operation, goal and accepted baseline. Restore the original operation checkpoint.");
|
|
130481
130534
|
if (Boolean(options.baselineWorkspace) !== Boolean(options.operationId))
|
|
130482
130535
|
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 ?
|
|
130536
|
+
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
130537
|
if (options.operationId)
|
|
130485
130538
|
await restoreOperationOrigin(config.workspace, workspace.path);
|
|
130486
130539
|
if (!codeDelivery)
|
|
@@ -130645,7 +130698,7 @@ async function dispatchOrder(goal, options, root = process.cwd(), dependencies =
|
|
|
130645
130698
|
};
|
|
130646
130699
|
const [operation, mission] = await Promise.all([
|
|
130647
130700
|
operationStore(root).load(options.resume).catch(missing),
|
|
130648
|
-
new MissionStore(
|
|
130701
|
+
new MissionStore(join52(root, ".agent-valley", "missions")).load(options.resume).catch(missing)
|
|
130649
130702
|
]);
|
|
130650
130703
|
if (operation && mission)
|
|
130651
130704
|
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 +130747,12 @@ function registerChiefCommands(program) {
|
|
|
130694
130747
|
process.exitCode = orderExitCode(result);
|
|
130695
130748
|
}
|
|
130696
130749
|
});
|
|
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);
|
|
130750
|
+
registerMissionCommands(program);
|
|
130714
130751
|
}
|
|
130715
130752
|
|
|
130716
130753
|
// src/chief-organization.ts
|
|
130717
130754
|
import { readFile as readFile19, stat as stat6 } from "node:fs/promises";
|
|
130718
|
-
import { isAbsolute as isAbsolute20, join as
|
|
130755
|
+
import { isAbsolute as isAbsolute20, join as join53, resolve as resolve34 } from "node:path";
|
|
130719
130756
|
init_chief_schema();
|
|
130720
130757
|
init_yaml_loader();
|
|
130721
130758
|
function organizationRepository(root, workspace) {
|
|
@@ -130769,13 +130806,13 @@ function registerOrganizationCommands(program) {
|
|
|
130769
130806
|
});
|
|
130770
130807
|
const reports = program.command("reports").description("Inspect and retry third-party report attachments");
|
|
130771
130808
|
reports.command("list").option("--workspace <path>", "Source repository").action(async (opts) => {
|
|
130772
|
-
console.log(JSON.stringify(await listReportDeliveries(
|
|
130809
|
+
console.log(JSON.stringify(await listReportDeliveries(join53(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
|
|
130773
130810
|
});
|
|
130774
130811
|
reports.command("retry").option("--workspace <path>", "Source repository").action(async (opts) => {
|
|
130775
130812
|
const config = mergeChiefConfig(loadGlobalConfig()?.chief, loadProjectConfig()?.chief);
|
|
130776
130813
|
if (!config.reporting)
|
|
130777
130814
|
throw new Error("Set chief.reporting.destinations in av.yaml before retrying reports.");
|
|
130778
|
-
console.log(JSON.stringify(await retryPendingReports(config.reporting,
|
|
130815
|
+
console.log(JSON.stringify(await retryPendingReports(config.reporting, join53(organizationRepository(process.cwd(), opts.workspace), ".agent-valley")), null, 2));
|
|
130779
130816
|
});
|
|
130780
130817
|
}
|
|
130781
130818
|
|
|
@@ -130800,10 +130837,10 @@ var import_picocolors = __toESM(require_picocolors(), 1);
|
|
|
130800
130837
|
init_project_config_path();
|
|
130801
130838
|
init_yaml_loader();
|
|
130802
130839
|
init_doctor_checks();
|
|
130803
|
-
import { join as
|
|
130840
|
+
import { join as join57 } from "node:path";
|
|
130804
130841
|
|
|
130805
130842
|
// src/doctor-oma-checks.ts
|
|
130806
|
-
import { join as
|
|
130843
|
+
import { join as join56 } from "node:path";
|
|
130807
130844
|
function checkOma(project, deps) {
|
|
130808
130845
|
const strict = project?.oma?.mode === "strict";
|
|
130809
130846
|
const order = !!project && !project.tracker && !project.linear && !project.github;
|
|
@@ -130891,7 +130928,7 @@ function checkOma(project, deps) {
|
|
|
130891
130928
|
fix: "Set verify.command to a deterministic non-build check in av.yaml before using oma.mode: strict.",
|
|
130892
130929
|
critical: true
|
|
130893
130930
|
});
|
|
130894
|
-
const triggerPath =
|
|
130931
|
+
const triggerPath = join56(deps.cwd, ".agents", "hooks", "core", "triggers.json");
|
|
130895
130932
|
let table = null;
|
|
130896
130933
|
try {
|
|
130897
130934
|
table = parseTriggerTable(deps.readFileSync(triggerPath));
|
|
@@ -130908,7 +130945,7 @@ function checkOma(project, deps) {
|
|
|
130908
130945
|
return results;
|
|
130909
130946
|
}
|
|
130910
130947
|
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]) =>
|
|
130948
|
+
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
130949
|
results.push(missing.length === 0 ? {
|
|
130913
130950
|
id: "oma.workflows",
|
|
130914
130951
|
name: "OMA workflow files",
|
|
@@ -130983,7 +131020,7 @@ function checkTunnel(project, deps) {
|
|
|
130983
131020
|
}
|
|
130984
131021
|
const mode = project?.tunnel?.cloudflare?.mode ?? "quick";
|
|
130985
131022
|
if (mode === "named") {
|
|
130986
|
-
const certPath =
|
|
131023
|
+
const certPath = join57(deps.home, ".cloudflared", "cert.pem");
|
|
130987
131024
|
if (!deps.existsSync(certPath)) {
|
|
130988
131025
|
return {
|
|
130989
131026
|
id: "tunnel",
|
|
@@ -131023,7 +131060,7 @@ function checkTunnel(project, deps) {
|
|
|
131023
131060
|
critical: false
|
|
131024
131061
|
};
|
|
131025
131062
|
}
|
|
131026
|
-
const ngrokConfigPath = deps.platform === "darwin" ?
|
|
131063
|
+
const ngrokConfigPath = deps.platform === "darwin" ? join57(deps.home, "Library", "Application Support", "ngrok", "ngrok.yml") : join57(deps.home, ".config", "ngrok", "ngrok.yml");
|
|
131027
131064
|
if (!deps.existsSync(ngrokConfigPath)) {
|
|
131028
131065
|
return {
|
|
131029
131066
|
id: "tunnel",
|
|
@@ -131094,7 +131131,7 @@ function checkConfig(deps) {
|
|
|
131094
131131
|
critical: true
|
|
131095
131132
|
});
|
|
131096
131133
|
}
|
|
131097
|
-
const projectPath =
|
|
131134
|
+
const projectPath = join57(deps.cwd, PROJECT_CONFIG_FILENAME);
|
|
131098
131135
|
try {
|
|
131099
131136
|
project = deps.loadProjectConfig(deps.cwd);
|
|
131100
131137
|
results.push(project ? {
|
|
@@ -135651,7 +135688,7 @@ init_team_relay_error();
|
|
|
135651
135688
|
// ../../packages/core/src/relay/turso-migration-assets.ts
|
|
135652
135689
|
init_zod();
|
|
135653
135690
|
import { copyFile as copyFile3, lstat as lstat26, mkdir as mkdir27, readFile as readFile21 } from "node:fs/promises";
|
|
135654
|
-
import { dirname as dirname13, join as
|
|
135691
|
+
import { dirname as dirname13, join as join63 } from "node:path";
|
|
135655
135692
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
135656
135693
|
var TURSO_MIGRATION_ASSET_PATH = "assets/turso/migrations";
|
|
135657
135694
|
var journalSchema = object({
|
|
@@ -135689,10 +135726,10 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
|
|
|
135689
135726
|
if (!info.isDirectory() || info.isSymbolicLink())
|
|
135690
135727
|
throw new Error(`Turso migration directory ${directory} must be a regular directory. Restore the checkout or reinstall the CLI package.`);
|
|
135691
135728
|
try {
|
|
135692
|
-
const meta = await lstat26(
|
|
135729
|
+
const meta = await lstat26(join63(directory, "meta"));
|
|
135693
135730
|
if (!meta.isDirectory() || meta.isSymbolicLink())
|
|
135694
135731
|
throw new Error("Invalid migration metadata directory");
|
|
135695
|
-
const journalPath =
|
|
135732
|
+
const journalPath = join63(directory, "meta/_journal.json");
|
|
135696
135733
|
await regularFile(journalPath);
|
|
135697
135734
|
const journal = journalSchema.parse(JSON.parse(await readFile21(journalPath, "utf8")));
|
|
135698
135735
|
const tags = journal.entries.map((entry) => entry.tag);
|
|
@@ -135700,8 +135737,8 @@ async function loadTursoMigrationAssets(candidates = tursoMigrationAssetCandidat
|
|
|
135700
135737
|
throw new Error("Duplicate migration tags");
|
|
135701
135738
|
const files = ["meta/_journal.json", ...tags.map((tag) => `${tag}.sql`)];
|
|
135702
135739
|
for (const file of files.slice(1)) {
|
|
135703
|
-
await regularFile(
|
|
135704
|
-
if (!(await readFile21(
|
|
135740
|
+
await regularFile(join63(directory, file));
|
|
135741
|
+
if (!(await readFile21(join63(directory, file), "utf8")).trim())
|
|
135705
135742
|
throw new Error("Empty migration SQL");
|
|
135706
135743
|
}
|
|
135707
135744
|
return { directory, files };
|
package/dist/supervisor.js
CHANGED
|
@@ -15170,7 +15170,11 @@ function mergeConfigs(global, project, env) {
|
|
|
15170
15170
|
owner: project.github.owner ?? "",
|
|
15171
15171
|
repo: project.github.repo ?? "",
|
|
15172
15172
|
webhookSecret: project.github.webhook_secret ?? "",
|
|
15173
|
-
labels
|
|
15173
|
+
labels,
|
|
15174
|
+
commentRelay: {
|
|
15175
|
+
enabled: project.github.comment_relay?.enabled ?? false,
|
|
15176
|
+
ignoreAuthors: project.github.comment_relay?.ignore_authors ?? []
|
|
15177
|
+
}
|
|
15174
15178
|
};
|
|
15175
15179
|
githubWorkflowStates = labels;
|
|
15176
15180
|
}
|
|
@@ -15310,6 +15314,10 @@ var init_yaml_loader = __esm(() => {
|
|
|
15310
15314
|
in_progress: string2().min(1).optional(),
|
|
15311
15315
|
done: string2().min(1).optional(),
|
|
15312
15316
|
cancelled: string2().min(1).optional()
|
|
15317
|
+
}).optional(),
|
|
15318
|
+
comment_relay: object({
|
|
15319
|
+
enabled: boolean2().optional(),
|
|
15320
|
+
ignore_authors: array(string2().min(1)).optional()
|
|
15313
15321
|
}).optional()
|
|
15314
15322
|
}).optional(),
|
|
15315
15323
|
workspace: object({
|
|
@@ -15362,7 +15370,11 @@ var init_yaml_loader = __esm(() => {
|
|
|
15362
15370
|
Fix: Add it to av.yaml`),
|
|
15363
15371
|
cancelled: string2().min(1, `github.labels.cancelled is not set.
|
|
15364
15372
|
Fix: Add it to av.yaml`)
|
|
15365
|
-
})
|
|
15373
|
+
}),
|
|
15374
|
+
commentRelay: object({
|
|
15375
|
+
enabled: boolean2(),
|
|
15376
|
+
ignoreAuthors: array(string2())
|
|
15377
|
+
}).optional()
|
|
15366
15378
|
});
|
|
15367
15379
|
mergedConfigSchema = object({
|
|
15368
15380
|
trackerKind: _enum(["linear", "github"]),
|