@controlvector/cv-agent 1.5.0 → 1.6.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/bundle.cjs +64 -3
- package/dist/bundle.cjs.map +2 -2
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +55 -1
- package/dist/commands/agent.js.map +1 -1
- package/dist/utils/api.d.ts +15 -1
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +12 -4
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/config.d.ts +20 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +15 -0
- package/dist/utils/config.js.map +1 -1
- package/package.json +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -3643,7 +3643,7 @@ async function apiCall(creds, method, path, body) {
|
|
|
3643
3643
|
body: body ? JSON.stringify(body) : void 0
|
|
3644
3644
|
});
|
|
3645
3645
|
}
|
|
3646
|
-
async function registerExecutor(creds, machineName, workingDir, repositoryId) {
|
|
3646
|
+
async function registerExecutor(creds, machineName, workingDir, repositoryId, metadata) {
|
|
3647
3647
|
const body = {
|
|
3648
3648
|
name: `cva:${machineName}`,
|
|
3649
3649
|
machine_name: machineName,
|
|
@@ -3657,6 +3657,11 @@ async function registerExecutor(creds, machineName, workingDir, repositoryId) {
|
|
|
3657
3657
|
if (repositoryId) {
|
|
3658
3658
|
body.repository_id = repositoryId;
|
|
3659
3659
|
}
|
|
3660
|
+
if (metadata?.role) body.role = metadata.role;
|
|
3661
|
+
if (metadata?.dispatch_guard) body.dispatch_guard = metadata.dispatch_guard;
|
|
3662
|
+
if (metadata?.tags) body.tags = metadata.tags;
|
|
3663
|
+
if (metadata?.owner_project) body.owner_project = metadata.owner_project;
|
|
3664
|
+
if (metadata?.integration) body.integration = metadata.integration;
|
|
3660
3665
|
const res = await apiCall(creds, "POST", "/api/v1/executors", body);
|
|
3661
3666
|
if (!res.ok) {
|
|
3662
3667
|
const err = await res.text();
|
|
@@ -4072,6 +4077,15 @@ ${source_default.yellow("\u26A0")} ${label} failed, retrying in ${delay}s... (${
|
|
|
4072
4077
|
var import_fs2 = require("fs");
|
|
4073
4078
|
var import_os2 = require("os");
|
|
4074
4079
|
var import_path2 = require("path");
|
|
4080
|
+
async function readWorkspaceConfig(workspaceRoot) {
|
|
4081
|
+
try {
|
|
4082
|
+
const { readFile } = await import("fs/promises");
|
|
4083
|
+
const content = await readFile((0, import_path2.join)(workspaceRoot, ".cva", "agent.json"), "utf-8");
|
|
4084
|
+
return JSON.parse(content);
|
|
4085
|
+
} catch {
|
|
4086
|
+
return {};
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4075
4089
|
function getConfigPath() {
|
|
4076
4090
|
return (0, import_path2.join)((0, import_os2.homedir)(), ".config", "cva", "config.json");
|
|
4077
4091
|
}
|
|
@@ -5092,8 +5106,47 @@ async function runAgent(options) {
|
|
|
5092
5106
|
}
|
|
5093
5107
|
} catch {
|
|
5094
5108
|
}
|
|
5109
|
+
const wsConfig = await readWorkspaceConfig(workingDir);
|
|
5110
|
+
const globalConfig = await readConfig();
|
|
5111
|
+
const role = options.role || wsConfig.role || globalConfig.role || "development";
|
|
5112
|
+
const dispatchGuard = options.dispatchGuard || wsConfig.dispatch_guard || globalConfig.dispatch_guard || "open";
|
|
5113
|
+
const tags = (options.tags?.split(",") || wsConfig.tags || globalConfig.tags)?.map((t) => t.trim()).filter(Boolean);
|
|
5114
|
+
const ownerProject = options.ownerProject || wsConfig.owner_project || globalConfig.owner_project;
|
|
5115
|
+
let integration;
|
|
5116
|
+
if (options.integration || wsConfig.integration) {
|
|
5117
|
+
if (options.integration) {
|
|
5118
|
+
const safeTasks = options.safeTasks?.split(",").map((t) => t.trim()).filter(Boolean);
|
|
5119
|
+
const unsafeTasks = safeTasks ? ["code_change", "deploy", "test", "custom"].filter((t) => !safeTasks.includes(t)) : void 0;
|
|
5120
|
+
integration = {
|
|
5121
|
+
system: options.integration,
|
|
5122
|
+
description: options.integrationDescription || `Integrated into ${options.integration}`,
|
|
5123
|
+
service_port: options.integrationPort ? parseInt(options.integrationPort, 10) : void 0,
|
|
5124
|
+
safe_task_types: safeTasks,
|
|
5125
|
+
unsafe_task_types: unsafeTasks
|
|
5126
|
+
};
|
|
5127
|
+
} else if (wsConfig.integration) {
|
|
5128
|
+
integration = wsConfig.integration;
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
const executorMeta = {
|
|
5132
|
+
role,
|
|
5133
|
+
dispatch_guard: dispatchGuard,
|
|
5134
|
+
tags,
|
|
5135
|
+
owner_project: ownerProject,
|
|
5136
|
+
integration
|
|
5137
|
+
};
|
|
5138
|
+
if (role !== "development") {
|
|
5139
|
+
console.log(source_default.yellow(` Role: ${role}`));
|
|
5140
|
+
}
|
|
5141
|
+
if (integration) {
|
|
5142
|
+
console.log(source_default.yellow(` Integration: ${integration.system}${integration.service_port ? ` (port ${integration.service_port})` : ""}`));
|
|
5143
|
+
}
|
|
5144
|
+
if (dispatchGuard !== "open") {
|
|
5145
|
+
const guardIcon = dispatchGuard === "locked" ? "\u{1F512}" : "\u26A0\uFE0F";
|
|
5146
|
+
console.log(source_default.yellow(` Guard: ${guardIcon} ${dispatchGuard}`));
|
|
5147
|
+
}
|
|
5095
5148
|
const executor = await withRetry(
|
|
5096
|
-
() => registerExecutor(creds, machineName, workingDir, detectedRepoId),
|
|
5149
|
+
() => registerExecutor(creds, machineName, workingDir, detectedRepoId, executorMeta),
|
|
5097
5150
|
"Executor registration"
|
|
5098
5151
|
);
|
|
5099
5152
|
const mode = options.autoApprove ? "auto-approve" : "relay";
|
|
@@ -5441,6 +5494,14 @@ function agentCommand() {
|
|
|
5441
5494
|
cmd.option("--poll-interval <seconds>", "How often to check for tasks, minimum 3 (default: 5)", "5");
|
|
5442
5495
|
cmd.option("--working-dir <path>", "Working directory for Claude Code (default: current directory)", ".");
|
|
5443
5496
|
cmd.option("--auto-approve", "Pre-approve all tool permissions (uses -p mode)", false);
|
|
5497
|
+
cmd.option("--role <role>", "Executor role: development, production, ci, staging");
|
|
5498
|
+
cmd.option("--integration <system>", "System this executor is integrated into (e.g. nyx-forge)");
|
|
5499
|
+
cmd.option("--integration-description <desc>", "Description of the integration");
|
|
5500
|
+
cmd.option("--integration-port <port>", "Port the integrated service runs on");
|
|
5501
|
+
cmd.option("--safe-tasks <types>", "Comma-separated task types safe for this executor (e.g. review,research)");
|
|
5502
|
+
cmd.option("--dispatch-guard <guard>", "Dispatch guard: open, confirm, locked (default: open)");
|
|
5503
|
+
cmd.option("--tags <tags>", "Comma-separated tags for this executor");
|
|
5504
|
+
cmd.option("--owner-project <project>", "Project this executor belongs to");
|
|
5444
5505
|
cmd.action(async (opts) => {
|
|
5445
5506
|
await runAgent(opts);
|
|
5446
5507
|
});
|
|
@@ -5764,7 +5825,7 @@ function statusCommand() {
|
|
|
5764
5825
|
|
|
5765
5826
|
// src/index.ts
|
|
5766
5827
|
var program2 = new Command();
|
|
5767
|
-
program2.name("cva").description("CV-Hub Agent \u2014 bridges Claude Code with CV-Hub task dispatch").version(true ? "1.
|
|
5828
|
+
program2.name("cva").description("CV-Hub Agent \u2014 bridges Claude Code with CV-Hub task dispatch").version(true ? "1.6.0" : "1.1.0");
|
|
5768
5829
|
program2.addCommand(agentCommand());
|
|
5769
5830
|
program2.addCommand(authCommand());
|
|
5770
5831
|
program2.addCommand(remoteCommand());
|