opencara 0.23.8 → 0.23.9
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 +44 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -562,6 +562,15 @@ function ensureConfigDir() {
|
|
|
562
562
|
var DEFAULT_MAX_DIFF_SIZE_KB = 100;
|
|
563
563
|
var DEFAULT_MAX_CONSECUTIVE_ERRORS = 10;
|
|
564
564
|
var DEFAULT_MAX_REPO_SIZE_MB = 100;
|
|
565
|
+
var DEFAULT_COMMAND_TEST_TIMEOUT_MS = 1e4;
|
|
566
|
+
function parseDurationMs(value) {
|
|
567
|
+
if (typeof value !== "string") return null;
|
|
568
|
+
const secMatch = value.match(/^(\d+)s$/);
|
|
569
|
+
if (secMatch) return parseInt(secMatch[1], 10) * 1e3;
|
|
570
|
+
const minMatch = value.match(/^(\d+)m$/);
|
|
571
|
+
if (minMatch) return parseInt(minMatch[1], 10) * 6e4;
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
565
574
|
var VALID_REPO_MODES = ["public", "private", "whitelist", "blacklist"];
|
|
566
575
|
var REPO_PATTERN = /^[^/]+\/[^/]+$/;
|
|
567
576
|
var REPO_MODE_ALIASES = {
|
|
@@ -797,6 +806,7 @@ function loadConfig() {
|
|
|
797
806
|
maxRepoSizeMb: DEFAULT_MAX_REPO_SIZE_MB,
|
|
798
807
|
codebaseDir: null,
|
|
799
808
|
codebaseTtl: null,
|
|
809
|
+
commandTestTimeoutMs: DEFAULT_COMMAND_TEST_TIMEOUT_MS,
|
|
800
810
|
agentCommand: null,
|
|
801
811
|
agents: null,
|
|
802
812
|
usageLimits: {
|
|
@@ -855,6 +865,23 @@ function loadConfig() {
|
|
|
855
865
|
maxRepoSizeMb: overrides.maxRepoSizeMb ?? (typeof data.max_repo_size_mb === "number" ? data.max_repo_size_mb : DEFAULT_MAX_REPO_SIZE_MB),
|
|
856
866
|
codebaseDir: typeof data.codebase_dir === "string" ? data.codebase_dir : null,
|
|
857
867
|
codebaseTtl: typeof data.codebase_ttl === "string" ? data.codebase_ttl : null,
|
|
868
|
+
commandTestTimeoutMs: (() => {
|
|
869
|
+
if (data.command_test_timeout === void 0) return DEFAULT_COMMAND_TEST_TIMEOUT_MS;
|
|
870
|
+
const ms = parseDurationMs(data.command_test_timeout);
|
|
871
|
+
if (ms === null) {
|
|
872
|
+
console.warn(
|
|
873
|
+
`\u26A0 Config warning: command_test_timeout must be a duration string like "10s" or "1m", got "${data.command_test_timeout}", using default (${DEFAULT_COMMAND_TEST_TIMEOUT_MS / 1e3}s)`
|
|
874
|
+
);
|
|
875
|
+
return DEFAULT_COMMAND_TEST_TIMEOUT_MS;
|
|
876
|
+
}
|
|
877
|
+
if (ms <= 0) {
|
|
878
|
+
console.warn(
|
|
879
|
+
`\u26A0 Config warning: command_test_timeout must be a positive duration, got "${data.command_test_timeout}", using default (${DEFAULT_COMMAND_TEST_TIMEOUT_MS / 1e3}s)`
|
|
880
|
+
);
|
|
881
|
+
return DEFAULT_COMMAND_TEST_TIMEOUT_MS;
|
|
882
|
+
}
|
|
883
|
+
return ms;
|
|
884
|
+
})(),
|
|
858
885
|
agentCommand: typeof data.agent_command === "string" ? data.agent_command : null,
|
|
859
886
|
agents: parseAgents(data),
|
|
860
887
|
usageLimits: {
|
|
@@ -2015,11 +2042,11 @@ function executeTool(commandTemplate, prompt2, timeoutMs, signal, vars, cwd, liv
|
|
|
2015
2042
|
});
|
|
2016
2043
|
}
|
|
2017
2044
|
var TEST_COMMAND_PROMPT = "Respond with: OK";
|
|
2018
|
-
var
|
|
2019
|
-
async function testCommand(commandTemplate) {
|
|
2045
|
+
var DEFAULT_TEST_COMMAND_TIMEOUT_MS = 1e4;
|
|
2046
|
+
async function testCommand(commandTemplate, timeoutMs = DEFAULT_TEST_COMMAND_TIMEOUT_MS) {
|
|
2020
2047
|
const start = Date.now();
|
|
2021
2048
|
try {
|
|
2022
|
-
await executeTool(commandTemplate, TEST_COMMAND_PROMPT,
|
|
2049
|
+
await executeTool(commandTemplate, TEST_COMMAND_PROMPT, timeoutMs);
|
|
2023
2050
|
return { ok: true, elapsedMs: Date.now() - start };
|
|
2024
2051
|
} catch (err) {
|
|
2025
2052
|
const elapsed = Date.now() - start;
|
|
@@ -2027,7 +2054,7 @@ async function testCommand(commandTemplate) {
|
|
|
2027
2054
|
return {
|
|
2028
2055
|
ok: false,
|
|
2029
2056
|
elapsedMs: elapsed,
|
|
2030
|
-
error: `command timed out after ${
|
|
2057
|
+
error: `command timed out after ${timeoutMs / 1e3}s`
|
|
2031
2058
|
};
|
|
2032
2059
|
}
|
|
2033
2060
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -5712,7 +5739,7 @@ function sleep2(ms, signal) {
|
|
|
5712
5739
|
async function startAgent(agentId, platformUrl, agentInfo, reviewDeps, consumptionDeps, options) {
|
|
5713
5740
|
const client = new ApiClient(platformUrl, {
|
|
5714
5741
|
authToken: options?.authToken,
|
|
5715
|
-
cliVersion: "0.23.
|
|
5742
|
+
cliVersion: "0.23.9",
|
|
5716
5743
|
versionOverride: options?.versionOverride,
|
|
5717
5744
|
onTokenRefresh: options?.onTokenRefresh
|
|
5718
5745
|
});
|
|
@@ -5746,7 +5773,7 @@ async function startAgent(agentId, platformUrl, agentInfo, reviewDeps, consumpti
|
|
|
5746
5773
|
}
|
|
5747
5774
|
if (reviewDeps.commandTemplate && !options?.routerRelay) {
|
|
5748
5775
|
log("Testing command...");
|
|
5749
|
-
const result = await testCommand(reviewDeps.commandTemplate);
|
|
5776
|
+
const result = await testCommand(reviewDeps.commandTemplate, options?.commandTestTimeoutMs);
|
|
5750
5777
|
if (result.ok) {
|
|
5751
5778
|
log(`${icons.success} Command test ok (${(result.elapsedMs / 1e3).toFixed(1)}s)`);
|
|
5752
5779
|
} else {
|
|
@@ -6008,7 +6035,7 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
|
|
|
6008
6035
|
const { versionOverride, verbose, instancesOverride, agentOwner, userOrgs } = options;
|
|
6009
6036
|
const client = new ApiClient(config.platformUrl, {
|
|
6010
6037
|
authToken: oauthToken,
|
|
6011
|
-
cliVersion: "0.23.
|
|
6038
|
+
cliVersion: "0.23.9",
|
|
6012
6039
|
versionOverride,
|
|
6013
6040
|
onTokenRefresh: () => getValidToken(config.platformUrl, { configPath: config.authFile })
|
|
6014
6041
|
});
|
|
@@ -6104,7 +6131,10 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
|
|
|
6104
6131
|
await Promise.all(
|
|
6105
6132
|
agentStates.filter((state) => state.reviewDeps.commandTemplate && !state.routerRelay).map(async (state) => {
|
|
6106
6133
|
state.logger.log("Testing command...");
|
|
6107
|
-
const result = await testCommand(
|
|
6134
|
+
const result = await testCommand(
|
|
6135
|
+
state.reviewDeps.commandTemplate,
|
|
6136
|
+
config.commandTestTimeoutMs
|
|
6137
|
+
);
|
|
6108
6138
|
if (result.ok) {
|
|
6109
6139
|
state.logger.log(
|
|
6110
6140
|
`${icons.success} Command test ok (${(result.elapsedMs / 1e3).toFixed(1)}s)`
|
|
@@ -6248,7 +6278,8 @@ async function startAgentRouter() {
|
|
|
6248
6278
|
userOrgs,
|
|
6249
6279
|
usageLimits: config.usageLimits,
|
|
6250
6280
|
versionOverride,
|
|
6251
|
-
codebaseTtl: config.codebaseTtl
|
|
6281
|
+
codebaseTtl: config.codebaseTtl,
|
|
6282
|
+
commandTestTimeoutMs: config.commandTestTimeoutMs
|
|
6252
6283
|
}
|
|
6253
6284
|
);
|
|
6254
6285
|
router.stop();
|
|
@@ -6326,7 +6357,8 @@ function startAgentByIndex(config, agentIndex, pollIntervalMs, oauthToken, versi
|
|
|
6326
6357
|
codebaseTtl: config.codebaseTtl,
|
|
6327
6358
|
verbose,
|
|
6328
6359
|
agentOwner,
|
|
6329
|
-
userOrgs
|
|
6360
|
+
userOrgs,
|
|
6361
|
+
commandTestTimeoutMs: config.commandTestTimeoutMs
|
|
6330
6362
|
}
|
|
6331
6363
|
).finally(() => {
|
|
6332
6364
|
routerRelay?.stop();
|
|
@@ -6354,7 +6386,7 @@ agentCommand.command("start").description("Start agents in polling mode").option
|
|
|
6354
6386
|
}
|
|
6355
6387
|
config = loadConfig();
|
|
6356
6388
|
}
|
|
6357
|
-
console.log(formatVersionBanner("0.23.
|
|
6389
|
+
console.log(formatVersionBanner("0.23.9", "84eda5a"));
|
|
6358
6390
|
if (config.agents && config.agents.length > 0) {
|
|
6359
6391
|
const toolEntries = config.agents.map((a) => ({
|
|
6360
6392
|
tool: a.tool,
|
|
@@ -7177,7 +7209,7 @@ var statusCommand = new Command4("status").description("Show agent config, conne
|
|
|
7177
7209
|
});
|
|
7178
7210
|
|
|
7179
7211
|
// src/index.ts
|
|
7180
|
-
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.23.
|
|
7212
|
+
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.23.9"} (${"84eda5a"})`);
|
|
7181
7213
|
program.addCommand(agentCommand);
|
|
7182
7214
|
program.addCommand(authCommand());
|
|
7183
7215
|
program.addCommand(dedupCommand());
|