opencara 0.5.0 → 0.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/index.js +35 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -96,6 +96,7 @@ function parseAnonymousAgents(data) {
|
|
|
96
96
|
model: obj.model,
|
|
97
97
|
tool: obj.tool
|
|
98
98
|
};
|
|
99
|
+
if (typeof obj.name === "string") anon.name = obj.name;
|
|
99
100
|
if (obj.repo_config && typeof obj.repo_config === "object") {
|
|
100
101
|
const rc = obj.repo_config;
|
|
101
102
|
if (typeof rc.mode === "string" && VALID_REPO_MODES.includes(rc.mode)) {
|
|
@@ -127,6 +128,7 @@ function parseAgents(data) {
|
|
|
127
128
|
continue;
|
|
128
129
|
}
|
|
129
130
|
const agent = { model: obj.model, tool: obj.tool };
|
|
131
|
+
if (typeof obj.name === "string") agent.name = obj.name;
|
|
130
132
|
if (typeof obj.command === "string") agent.command = obj.command;
|
|
131
133
|
const agentLimits = parseLimits(obj);
|
|
132
134
|
if (agentLimits) agent.limits = agentLimits;
|
|
@@ -192,6 +194,9 @@ function saveConfig(config) {
|
|
|
192
194
|
model: a.model,
|
|
193
195
|
tool: a.tool
|
|
194
196
|
};
|
|
197
|
+
if (a.name) {
|
|
198
|
+
entry.name = a.name;
|
|
199
|
+
}
|
|
195
200
|
if (a.repoConfig) {
|
|
196
201
|
entry.repo_config = a.repoConfig;
|
|
197
202
|
}
|
|
@@ -916,6 +921,7 @@ function formatTable(agents, trustLabels) {
|
|
|
916
921
|
}
|
|
917
922
|
const header = [
|
|
918
923
|
"ID".padEnd(38),
|
|
924
|
+
"Name".padEnd(20),
|
|
919
925
|
"Model".padEnd(22),
|
|
920
926
|
"Tool".padEnd(16),
|
|
921
927
|
"Status".padEnd(10),
|
|
@@ -924,8 +930,16 @@ function formatTable(agents, trustLabels) {
|
|
|
924
930
|
console.log(header);
|
|
925
931
|
for (const a of agents) {
|
|
926
932
|
const trust = trustLabels?.get(a.id) ?? "--";
|
|
933
|
+
const name = a.displayName ?? "--";
|
|
927
934
|
console.log(
|
|
928
|
-
[
|
|
935
|
+
[
|
|
936
|
+
a.id.padEnd(38),
|
|
937
|
+
name.padEnd(20),
|
|
938
|
+
a.model.padEnd(22),
|
|
939
|
+
a.tool.padEnd(16),
|
|
940
|
+
a.status.padEnd(10),
|
|
941
|
+
trust
|
|
942
|
+
].join("")
|
|
929
943
|
);
|
|
930
944
|
}
|
|
931
945
|
}
|
|
@@ -940,6 +954,7 @@ function startAgent(agentId, platformUrl, apiKey, reviewDeps, consumptionDeps, o
|
|
|
940
954
|
const verbose = options?.verbose ?? false;
|
|
941
955
|
const stabilityThreshold = options?.stabilityThresholdMs ?? CONNECTION_STABILITY_THRESHOLD_MS;
|
|
942
956
|
const repoConfig = options?.repoConfig;
|
|
957
|
+
const displayName = options?.displayName;
|
|
943
958
|
let attempt = 0;
|
|
944
959
|
let intentionalClose = false;
|
|
945
960
|
let heartbeatTimer = null;
|
|
@@ -1020,7 +1035,16 @@ function startAgent(agentId, platformUrl, apiKey, reviewDeps, consumptionDeps, o
|
|
|
1020
1035
|
} catch {
|
|
1021
1036
|
return;
|
|
1022
1037
|
}
|
|
1023
|
-
handleMessage(
|
|
1038
|
+
handleMessage(
|
|
1039
|
+
ws,
|
|
1040
|
+
msg,
|
|
1041
|
+
resetHeartbeatTimer,
|
|
1042
|
+
reviewDeps,
|
|
1043
|
+
consumptionDeps,
|
|
1044
|
+
verbose,
|
|
1045
|
+
repoConfig,
|
|
1046
|
+
displayName
|
|
1047
|
+
);
|
|
1024
1048
|
});
|
|
1025
1049
|
ws.on("close", (code, reason) => {
|
|
1026
1050
|
if (intentionalClose) return;
|
|
@@ -1096,7 +1120,7 @@ async function logPostReviewStats(type, verdict, tokensUsed, tokensEstimated, co
|
|
|
1096
1120
|
}
|
|
1097
1121
|
console.log(formatPostReviewStats(tokensUsed, consumptionDeps.session, consumptionDeps.limits));
|
|
1098
1122
|
}
|
|
1099
|
-
function handleMessage(ws, msg, resetHeartbeat, reviewDeps, consumptionDeps, verbose, repoConfig) {
|
|
1123
|
+
function handleMessage(ws, msg, resetHeartbeat, reviewDeps, consumptionDeps, verbose, repoConfig, displayName) {
|
|
1100
1124
|
switch (msg.type) {
|
|
1101
1125
|
case "connected":
|
|
1102
1126
|
console.log(`Authenticated. Protocol v${msg.version ?? "unknown"}`);
|
|
@@ -1104,6 +1128,7 @@ function handleMessage(ws, msg, resetHeartbeat, reviewDeps, consumptionDeps, ver
|
|
|
1104
1128
|
type: "agent_preferences",
|
|
1105
1129
|
id: crypto2.randomUUID(),
|
|
1106
1130
|
timestamp: Date.now(),
|
|
1131
|
+
...displayName ? { displayName } : {},
|
|
1107
1132
|
repoConfig: repoConfig ?? { mode: "all" }
|
|
1108
1133
|
});
|
|
1109
1134
|
break;
|
|
@@ -1303,6 +1328,9 @@ async function syncAgentToServer(client, serverAgents, localAgent) {
|
|
|
1303
1328
|
return { agentId: existing.id, created: false };
|
|
1304
1329
|
}
|
|
1305
1330
|
const body = { model: localAgent.model, tool: localAgent.tool };
|
|
1331
|
+
if (localAgent.name) {
|
|
1332
|
+
body.displayName = localAgent.name;
|
|
1333
|
+
}
|
|
1306
1334
|
if (localAgent.repos) {
|
|
1307
1335
|
body.repoConfig = localAgent.repos;
|
|
1308
1336
|
}
|
|
@@ -1582,6 +1610,7 @@ agentCommand.command("start [agentIdOrModel]").description("Connect agent to pla
|
|
|
1582
1610
|
startAgent(entry.agentId, config.platformUrl, entry.apiKey, reviewDeps2, consumptionDeps2, {
|
|
1583
1611
|
verbose: opts.verbose,
|
|
1584
1612
|
stabilityThresholdMs,
|
|
1613
|
+
displayName: entry.name,
|
|
1585
1614
|
repoConfig: entry.repoConfig
|
|
1586
1615
|
});
|
|
1587
1616
|
return;
|
|
@@ -1695,6 +1724,7 @@ agentCommand.command("start [agentIdOrModel]").description("Connect agent to pla
|
|
|
1695
1724
|
startAgent(agentId2, config.platformUrl, apiKey2, reviewDeps2, consumptionDeps2, {
|
|
1696
1725
|
verbose: opts.verbose,
|
|
1697
1726
|
stabilityThresholdMs,
|
|
1727
|
+
displayName: selected.local.name,
|
|
1698
1728
|
repoConfig: selected.local.repos
|
|
1699
1729
|
});
|
|
1700
1730
|
startedCount++;
|
|
@@ -1728,6 +1758,7 @@ agentCommand.command("start [agentIdOrModel]").description("Connect agent to pla
|
|
|
1728
1758
|
startAgent(anon.agentId, config.platformUrl, anon.apiKey, reviewDeps2, consumptionDeps2, {
|
|
1729
1759
|
verbose: opts.verbose,
|
|
1730
1760
|
stabilityThresholdMs,
|
|
1761
|
+
displayName: anon.name,
|
|
1731
1762
|
repoConfig: anon.repoConfig
|
|
1732
1763
|
});
|
|
1733
1764
|
startedCount++;
|
|
@@ -1968,7 +1999,7 @@ var statsCommand = new Command3("stats").description("Display agent dashboard: t
|
|
|
1968
1999
|
});
|
|
1969
2000
|
|
|
1970
2001
|
// src/index.ts
|
|
1971
|
-
var program = new Command4().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version("0.
|
|
2002
|
+
var program = new Command4().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version("0.5.0");
|
|
1972
2003
|
program.addCommand(loginCommand);
|
|
1973
2004
|
program.addCommand(agentCommand);
|
|
1974
2005
|
program.addCommand(statsCommand);
|