open-agents-ai 0.34.3 → 0.34.5
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 +186 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -90,7 +90,7 @@ function setConfigValue(key, value) {
|
|
|
90
90
|
const configPath = join(dir, "config.json");
|
|
91
91
|
const existing = loadConfigFile();
|
|
92
92
|
existing[key] = coerceConfigValue(key, value);
|
|
93
|
-
writeFileSync(configPath, JSON.stringify(existing, null, 2) + "\n", "utf8");
|
|
93
|
+
writeFileSync(configPath, JSON.stringify(existing, null, 2) + "\n", { encoding: "utf8", mode: 384 });
|
|
94
94
|
}
|
|
95
95
|
function coerceConfigValue(key, value) {
|
|
96
96
|
const intKeys = /* @__PURE__ */ new Set(["maxRetries", "timeoutMs"]);
|
|
@@ -12855,9 +12855,13 @@ ${tail}`;
|
|
|
12855
12855
|
const combinedSummary = previousSummary ? this.progressiveSummarize(previousSummary, newSummary) : newSummary;
|
|
12856
12856
|
const strategyLabel = strategy !== "default" ? ` (${strategy})` : "";
|
|
12857
12857
|
const forceLabel = force ? " [manual]" : "";
|
|
12858
|
+
const preTokens = Math.ceil(totalChars / 4);
|
|
12859
|
+
const postChars = combinedSummary.length + recent.reduce((s, m) => s + (typeof m.content === "string" ? m.content.length : 100), 0) + head.reduce((s, m) => s + (typeof m.content === "string" ? m.content.length : 100), 0);
|
|
12860
|
+
const postTokens = Math.ceil(postChars / 4);
|
|
12861
|
+
const savedTokens = preTokens - postTokens;
|
|
12858
12862
|
this.emit({
|
|
12859
12863
|
type: "compaction",
|
|
12860
|
-
content: `Compacted ${middle.length} messages${strategyLabel}${forceLabel}${previousSummary ? " (progressive)" : ""}`,
|
|
12864
|
+
content: `Compacted ${middle.length} messages${strategyLabel}${forceLabel}${previousSummary ? " (progressive)" : ""} | ~${preTokens.toLocaleString()} \u2192 ~${postTokens.toLocaleString()} tokens (saved ~${savedTokens.toLocaleString()})`,
|
|
12861
12865
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12862
12866
|
});
|
|
12863
12867
|
const enrichments = [combinedSummary];
|
|
@@ -15505,6 +15509,12 @@ function renderWarning(message) {
|
|
|
15505
15509
|
`);
|
|
15506
15510
|
_contentWriteHook?.end();
|
|
15507
15511
|
}
|
|
15512
|
+
function renderVerbose(message) {
|
|
15513
|
+
_contentWriteHook?.begin();
|
|
15514
|
+
process.stdout.write(`${c2.dim(` > ${message}`)}
|
|
15515
|
+
`);
|
|
15516
|
+
_contentWriteHook?.end();
|
|
15517
|
+
}
|
|
15508
15518
|
function renderRichHeader(opts) {
|
|
15509
15519
|
const w = getTermWidth();
|
|
15510
15520
|
const divider = c2.dim("\u2500".repeat(Math.min(w - 4, 72)));
|
|
@@ -16181,6 +16191,17 @@ function initOaDirectory(repoRoot) {
|
|
|
16181
16191
|
for (const sub of SUBDIRS) {
|
|
16182
16192
|
mkdirSync6(join25(oaPath, sub), { recursive: true });
|
|
16183
16193
|
}
|
|
16194
|
+
try {
|
|
16195
|
+
const gitignorePath = join25(repoRoot, ".gitignore");
|
|
16196
|
+
const settingsPattern = ".oa/settings.json";
|
|
16197
|
+
if (existsSync19(gitignorePath)) {
|
|
16198
|
+
const content = readFileSync13(gitignorePath, "utf-8");
|
|
16199
|
+
if (!content.includes(settingsPattern)) {
|
|
16200
|
+
writeFileSync6(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
|
|
16201
|
+
}
|
|
16202
|
+
}
|
|
16203
|
+
} catch {
|
|
16204
|
+
}
|
|
16184
16205
|
return oaPath;
|
|
16185
16206
|
}
|
|
16186
16207
|
function hasOaDirectory(repoRoot) {
|
|
@@ -16201,7 +16222,7 @@ function saveProjectSettings(repoRoot, settings) {
|
|
|
16201
16222
|
mkdirSync6(oaPath, { recursive: true });
|
|
16202
16223
|
const existing = loadProjectSettings(repoRoot);
|
|
16203
16224
|
const merged = { ...existing, ...settings };
|
|
16204
|
-
writeFileSync6(join25(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
16225
|
+
writeFileSync6(join25(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
16205
16226
|
}
|
|
16206
16227
|
function loadGlobalSettings() {
|
|
16207
16228
|
const settingsPath = join25(homedir9(), ".open-agents", "settings.json");
|
|
@@ -16218,7 +16239,7 @@ function saveGlobalSettings(settings) {
|
|
|
16218
16239
|
mkdirSync6(dir, { recursive: true });
|
|
16219
16240
|
const existing = loadGlobalSettings();
|
|
16220
16241
|
const merged = { ...existing, ...settings };
|
|
16221
|
-
writeFileSync6(join25(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
16242
|
+
writeFileSync6(join25(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
16222
16243
|
}
|
|
16223
16244
|
function resolveSettings(repoRoot) {
|
|
16224
16245
|
const global = loadGlobalSettings();
|
|
@@ -16670,6 +16691,49 @@ function ask(rl, question) {
|
|
|
16670
16691
|
rl.question(question, (answer) => resolve23(answer.trim()));
|
|
16671
16692
|
});
|
|
16672
16693
|
}
|
|
16694
|
+
function askSecret(rl, question) {
|
|
16695
|
+
return new Promise((resolve23) => {
|
|
16696
|
+
process.stdout.write(question);
|
|
16697
|
+
let secret = "";
|
|
16698
|
+
const stdin = process.stdin;
|
|
16699
|
+
const hadRawMode = stdin.isRaw;
|
|
16700
|
+
if (typeof stdin.setRawMode === "function") {
|
|
16701
|
+
stdin.setRawMode(true);
|
|
16702
|
+
}
|
|
16703
|
+
stdin.resume();
|
|
16704
|
+
const onData = (chunk) => {
|
|
16705
|
+
const ch = chunk.toString("utf8");
|
|
16706
|
+
for (const c3 of ch) {
|
|
16707
|
+
if (c3 === "\r" || c3 === "\n") {
|
|
16708
|
+
stdin.removeListener("data", onData);
|
|
16709
|
+
if (typeof stdin.setRawMode === "function") {
|
|
16710
|
+
stdin.setRawMode(hadRawMode ?? false);
|
|
16711
|
+
}
|
|
16712
|
+
process.stdout.write("\n");
|
|
16713
|
+
resolve23(secret.trim());
|
|
16714
|
+
return;
|
|
16715
|
+
} else if (c3 === "") {
|
|
16716
|
+
stdin.removeListener("data", onData);
|
|
16717
|
+
if (typeof stdin.setRawMode === "function") {
|
|
16718
|
+
stdin.setRawMode(hadRawMode ?? false);
|
|
16719
|
+
}
|
|
16720
|
+
process.stdout.write("\n");
|
|
16721
|
+
resolve23("");
|
|
16722
|
+
return;
|
|
16723
|
+
} else if (c3 === "\x7F" || c3 === "\b") {
|
|
16724
|
+
if (secret.length > 0) {
|
|
16725
|
+
secret = secret.slice(0, -1);
|
|
16726
|
+
process.stdout.write("\b \b");
|
|
16727
|
+
}
|
|
16728
|
+
} else if (c3.charCodeAt(0) >= 32) {
|
|
16729
|
+
secret += c3;
|
|
16730
|
+
process.stdout.write("*");
|
|
16731
|
+
}
|
|
16732
|
+
}
|
|
16733
|
+
};
|
|
16734
|
+
stdin.on("data", onData);
|
|
16735
|
+
});
|
|
16736
|
+
}
|
|
16673
16737
|
async function autoInstallOllama(rl) {
|
|
16674
16738
|
const plat = platform();
|
|
16675
16739
|
if (plat === "linux") {
|
|
@@ -16899,7 +16963,7 @@ async function promptForCustomEndpoint(config, rl) {
|
|
|
16899
16963
|
${c2.bold("Does this endpoint require an API key?")} (y/n) `);
|
|
16900
16964
|
let apiKey = "";
|
|
16901
16965
|
if (needsKey.toLowerCase() === "y" || needsKey.toLowerCase() === "yes") {
|
|
16902
|
-
apiKey = await
|
|
16966
|
+
apiKey = await askSecret(rl, ` ${c2.bold("API key:")} `);
|
|
16903
16967
|
}
|
|
16904
16968
|
process.stdout.write(`
|
|
16905
16969
|
${c2.cyan("\u25CF")} Enter the model name for this endpoint.
|
|
@@ -18353,7 +18417,7 @@ async function handleEndpoint(arg, ctx, local = false) {
|
|
|
18353
18417
|
process.stdout.write(` ${c2.cyan("Type".padEnd(12))} ${backendType}
|
|
18354
18418
|
`);
|
|
18355
18419
|
if (apiKey) {
|
|
18356
|
-
process.stdout.write(` ${c2.cyan("Auth".padEnd(12))} Bearer ${apiKey.slice(0,
|
|
18420
|
+
process.stdout.write(` ${c2.cyan("Auth".padEnd(12))} Bearer ${apiKey.slice(0, 4)}...
|
|
18357
18421
|
`);
|
|
18358
18422
|
} else {
|
|
18359
18423
|
process.stdout.write(` ${c2.cyan("Auth".padEnd(12))} ${provider.authRequired ? c2.yellow("none (may be required)") : "none"}
|
|
@@ -21970,7 +22034,7 @@ var init_braille_spinner = __esm({
|
|
|
21970
22034
|
});
|
|
21971
22035
|
|
|
21972
22036
|
// packages/cli/dist/tui/status-bar.js
|
|
21973
|
-
var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, HumanSpeedTracker, StatusBar;
|
|
22037
|
+
var EXPERT_TOOL_BASELINES, CONTEXT_SWITCH_OVERHEAD, TURN_PLANNING_OVERHEAD, DEFAULT_TOOL_BASELINE, CODE_READ_CHARS_PER_SEC, PROSE_READ_CHARS_PER_SEC, MIN_CONTENT_FOR_READING, CODE_CONTENT_TOOLS, PROSE_CONTENT_TOOLS, HumanSpeedTracker, StatusBar;
|
|
21974
22038
|
var init_status_bar = __esm({
|
|
21975
22039
|
"packages/cli/dist/tui/status-bar.js"() {
|
|
21976
22040
|
"use strict";
|
|
@@ -22026,6 +22090,40 @@ var init_status_bar = __esm({
|
|
|
22026
22090
|
CONTEXT_SWITCH_OVERHEAD = 5;
|
|
22027
22091
|
TURN_PLANNING_OVERHEAD = 15;
|
|
22028
22092
|
DEFAULT_TOOL_BASELINE = 20;
|
|
22093
|
+
CODE_READ_CHARS_PER_SEC = 12.5;
|
|
22094
|
+
PROSE_READ_CHARS_PER_SEC = 20.8;
|
|
22095
|
+
MIN_CONTENT_FOR_READING = 100;
|
|
22096
|
+
CODE_CONTENT_TOOLS = /* @__PURE__ */ new Set([
|
|
22097
|
+
"file_read",
|
|
22098
|
+
"structured_read",
|
|
22099
|
+
"grep_search",
|
|
22100
|
+
"glob_find",
|
|
22101
|
+
"list_directory",
|
|
22102
|
+
"shell",
|
|
22103
|
+
"codebase_map",
|
|
22104
|
+
"git_info",
|
|
22105
|
+
"diagnostic",
|
|
22106
|
+
"task_output",
|
|
22107
|
+
"file_edit",
|
|
22108
|
+
"file_patch",
|
|
22109
|
+
"batch_edit",
|
|
22110
|
+
"file_write",
|
|
22111
|
+
"structured_file",
|
|
22112
|
+
"explore_tools"
|
|
22113
|
+
]);
|
|
22114
|
+
PROSE_CONTENT_TOOLS = /* @__PURE__ */ new Set([
|
|
22115
|
+
"web_fetch",
|
|
22116
|
+
"web_search",
|
|
22117
|
+
"web_crawl",
|
|
22118
|
+
"memory_read",
|
|
22119
|
+
"memory_search",
|
|
22120
|
+
"pdf_to_text",
|
|
22121
|
+
"ocr",
|
|
22122
|
+
"ocr_pdf",
|
|
22123
|
+
"ocr_image_advanced",
|
|
22124
|
+
"transcribe_file",
|
|
22125
|
+
"transcribe_url"
|
|
22126
|
+
]);
|
|
22029
22127
|
HumanSpeedTracker = class {
|
|
22030
22128
|
/** Accumulated estimated human-expert time in seconds */
|
|
22031
22129
|
humanTimeS = 0;
|
|
@@ -22037,12 +22135,34 @@ var init_status_bar = __esm({
|
|
|
22037
22135
|
toolCalls = 0;
|
|
22038
22136
|
/** Number of turns in current session */
|
|
22039
22137
|
turns = 0;
|
|
22138
|
+
/** Accumulated reading time in seconds (subset of humanTimeS) */
|
|
22139
|
+
readingTimeS = 0;
|
|
22040
22140
|
/** Record a tool call — adds the expert baseline time */
|
|
22041
22141
|
recordToolCall(toolName) {
|
|
22042
22142
|
const baseline = EXPERT_TOOL_BASELINES[toolName] ?? DEFAULT_TOOL_BASELINE;
|
|
22043
22143
|
this.humanTimeS += baseline + CONTEXT_SWITCH_OVERHEAD;
|
|
22044
22144
|
this.toolCalls++;
|
|
22045
22145
|
}
|
|
22146
|
+
/**
|
|
22147
|
+
* Record a tool result — adds human reading time based on content volume.
|
|
22148
|
+
* A human expert must read and comprehend tool output (file contents,
|
|
22149
|
+
* web pages, search results, etc.) before acting on it.
|
|
22150
|
+
*/
|
|
22151
|
+
recordToolResult(toolName, contentLength) {
|
|
22152
|
+
if (contentLength < MIN_CONTENT_FOR_READING)
|
|
22153
|
+
return;
|
|
22154
|
+
let charsPerSec;
|
|
22155
|
+
if (CODE_CONTENT_TOOLS.has(toolName)) {
|
|
22156
|
+
charsPerSec = CODE_READ_CHARS_PER_SEC;
|
|
22157
|
+
} else if (PROSE_CONTENT_TOOLS.has(toolName)) {
|
|
22158
|
+
charsPerSec = PROSE_READ_CHARS_PER_SEC;
|
|
22159
|
+
} else {
|
|
22160
|
+
return;
|
|
22161
|
+
}
|
|
22162
|
+
const readSec = contentLength / charsPerSec;
|
|
22163
|
+
this.humanTimeS += readSec;
|
|
22164
|
+
this.readingTimeS += readSec;
|
|
22165
|
+
}
|
|
22046
22166
|
/** Record a turn (assistant reasoning cycle) */
|
|
22047
22167
|
recordTurn() {
|
|
22048
22168
|
this.humanTimeS += TURN_PLANNING_OVERHEAD;
|
|
@@ -22221,6 +22341,10 @@ var init_status_bar = __esm({
|
|
|
22221
22341
|
recordSpeedToolCall(toolName) {
|
|
22222
22342
|
this._speedTracker.recordToolCall(toolName);
|
|
22223
22343
|
}
|
|
22344
|
+
/** Record a tool result — adds human reading time based on content volume */
|
|
22345
|
+
recordSpeedToolResult(toolName, contentLength) {
|
|
22346
|
+
this._speedTracker.recordToolResult(toolName, contentLength);
|
|
22347
|
+
}
|
|
22224
22348
|
/** Record a turn for speed ratio tracking */
|
|
22225
22349
|
recordSpeedTurn() {
|
|
22226
22350
|
this._speedTracker.recordTurn();
|
|
@@ -23044,6 +23168,8 @@ ${entry.fullContent}`
|
|
|
23044
23168
|
const editSessionId = `task-${Date.now()}`;
|
|
23045
23169
|
const editHistory = createEditHistoryLogger(repoRoot, editSessionId);
|
|
23046
23170
|
let lastToolCall = null;
|
|
23171
|
+
let toolCallStartMs = 0;
|
|
23172
|
+
let streamStartMs = 0;
|
|
23047
23173
|
const contentWrite = (fn) => {
|
|
23048
23174
|
if (statusBar?.isActive) {
|
|
23049
23175
|
statusBar.beginContentWrite();
|
|
@@ -23068,6 +23194,7 @@ ${entry.fullContent}`
|
|
|
23068
23194
|
}
|
|
23069
23195
|
lastToolCall = { name: event.toolName ?? "unknown", args: event.toolArgs ?? {} };
|
|
23070
23196
|
statusBar?.recordSpeedToolCall(event.toolName ?? "unknown");
|
|
23197
|
+
toolCallStartMs = Date.now();
|
|
23071
23198
|
statusBar?.setActiveTool(event.toolName ?? null);
|
|
23072
23199
|
contentWrite(() => {
|
|
23073
23200
|
if (voice?.enabled) {
|
|
@@ -23078,14 +23205,25 @@ ${entry.fullContent}`
|
|
|
23078
23205
|
renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {});
|
|
23079
23206
|
});
|
|
23080
23207
|
break;
|
|
23081
|
-
case "tool_result":
|
|
23208
|
+
case "tool_result": {
|
|
23082
23209
|
if (lastToolCall) {
|
|
23083
23210
|
editHistory.logToolCall(lastToolCall.name, lastToolCall.args, event.success ?? false);
|
|
23084
23211
|
lastToolCall = null;
|
|
23085
23212
|
}
|
|
23213
|
+
const resultLen = event.content?.length ?? 0;
|
|
23214
|
+
if (resultLen > 0) {
|
|
23215
|
+
statusBar?.recordSpeedToolResult(event.toolName ?? "unknown", resultLen);
|
|
23216
|
+
}
|
|
23086
23217
|
statusBar?.setActiveTool(null);
|
|
23218
|
+
const toolDurationMs = toolCallStartMs > 0 ? Date.now() - toolCallStartMs : 0;
|
|
23219
|
+
toolCallStartMs = 0;
|
|
23087
23220
|
contentWrite(() => {
|
|
23088
23221
|
renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "");
|
|
23222
|
+
if (config.verbose && toolDurationMs > 0) {
|
|
23223
|
+
const durStr = toolDurationMs < 1e3 ? `${toolDurationMs}ms` : `${(toolDurationMs / 1e3).toFixed(1)}s`;
|
|
23224
|
+
const sizeStr = resultLen > 0 ? ` | ${resultLen.toLocaleString()} chars (~${Math.ceil(resultLen / 4).toLocaleString()} tokens)` : "";
|
|
23225
|
+
renderVerbose(`${event.toolName ?? "unknown"}: ${durStr}${sizeStr}`);
|
|
23226
|
+
}
|
|
23089
23227
|
if (voice?.enabled && !(event.success ?? true)) {
|
|
23090
23228
|
const desc = describeToolResult(event.toolName ?? "unknown", false);
|
|
23091
23229
|
if (desc) {
|
|
@@ -23095,6 +23233,7 @@ ${entry.fullContent}`
|
|
|
23095
23233
|
}
|
|
23096
23234
|
});
|
|
23097
23235
|
break;
|
|
23236
|
+
}
|
|
23098
23237
|
case "model_response":
|
|
23099
23238
|
statusBar?.recordSpeedTurn();
|
|
23100
23239
|
if (config.verbose && !stream?.enabled && event.content) {
|
|
@@ -23102,11 +23241,15 @@ ${entry.fullContent}`
|
|
|
23102
23241
|
}
|
|
23103
23242
|
break;
|
|
23104
23243
|
case "stream_start":
|
|
23244
|
+
streamStartMs = Date.now();
|
|
23105
23245
|
if (stream?.enabled) {
|
|
23106
23246
|
if (statusBar?.isActive)
|
|
23107
23247
|
statusBar.beginContentWrite();
|
|
23108
23248
|
stream.renderer.onStreamStart();
|
|
23109
23249
|
}
|
|
23250
|
+
if (config.verbose) {
|
|
23251
|
+
contentWrite(() => renderVerbose(`Stream started (turn ${event.turn ?? "?"})`));
|
|
23252
|
+
}
|
|
23110
23253
|
break;
|
|
23111
23254
|
case "stream_token":
|
|
23112
23255
|
if (stream?.enabled) {
|
|
@@ -23117,13 +23260,22 @@ ${entry.fullContent}`
|
|
|
23117
23260
|
statusBar.incrementStreamingTokens(estimatedNewTokens);
|
|
23118
23261
|
}
|
|
23119
23262
|
break;
|
|
23120
|
-
case "stream_end":
|
|
23263
|
+
case "stream_end": {
|
|
23264
|
+
const streamDurationMs = streamStartMs > 0 ? Date.now() - streamStartMs : 0;
|
|
23265
|
+
streamStartMs = 0;
|
|
23121
23266
|
if (stream?.enabled) {
|
|
23122
23267
|
stream.renderer.onStreamEnd();
|
|
23123
23268
|
if (statusBar?.isActive)
|
|
23124
23269
|
statusBar.endContentWrite();
|
|
23125
23270
|
}
|
|
23271
|
+
if (config.verbose && streamDurationMs > 0) {
|
|
23272
|
+
const streamChars = event.content?.length ?? 0;
|
|
23273
|
+
const estTokens = Math.ceil(streamChars / 4);
|
|
23274
|
+
const tokPerSec = streamDurationMs > 0 ? (estTokens / (streamDurationMs / 1e3)).toFixed(1) : "?";
|
|
23275
|
+
contentWrite(() => renderVerbose(`Stream ended: ~${estTokens.toLocaleString()} tokens in ${(streamDurationMs / 1e3).toFixed(1)}s (${tokPerSec} tok/s)`));
|
|
23276
|
+
}
|
|
23126
23277
|
break;
|
|
23278
|
+
}
|
|
23127
23279
|
case "user_interrupt":
|
|
23128
23280
|
break;
|
|
23129
23281
|
case "compaction":
|
|
@@ -23145,6 +23297,11 @@ ${entry.fullContent}`
|
|
|
23145
23297
|
estimatedCost: costTracker?.currentCost,
|
|
23146
23298
|
hasPricing: costTracker?.hasPricing
|
|
23147
23299
|
});
|
|
23300
|
+
if (config.verbose) {
|
|
23301
|
+
const tu = event.tokenUsage;
|
|
23302
|
+
const ctxPct = tu.estimatedContextTokens > 0 && statusBar ? ` (ctx: ~${tu.estimatedContextTokens.toLocaleString()} tokens)` : "";
|
|
23303
|
+
contentWrite(() => renderVerbose(`Tokens \u2014 prompt: ${tu.promptTokens.toLocaleString()} | completion: ${tu.completionTokens.toLocaleString()} | total: ${tu.totalTokens.toLocaleString()}${ctxPct}`));
|
|
23304
|
+
}
|
|
23148
23305
|
}
|
|
23149
23306
|
break;
|
|
23150
23307
|
case "sudo_request":
|
|
@@ -24654,12 +24811,18 @@ async function statusCommand(opts, config) {
|
|
|
24654
24811
|
"OPEN_AGENTS_TIMEOUT_MS",
|
|
24655
24812
|
"OPEN_AGENTS_DRY_RUN",
|
|
24656
24813
|
"OPEN_AGENTS_VERBOSE",
|
|
24657
|
-
"VLLM_BASE_URL"
|
|
24814
|
+
"VLLM_BASE_URL",
|
|
24815
|
+
"VLLM_API_KEY"
|
|
24658
24816
|
];
|
|
24817
|
+
const sensitiveEnvVars = /* @__PURE__ */ new Set([
|
|
24818
|
+
"OPEN_AGENTS_API_KEY",
|
|
24819
|
+
"VLLM_API_KEY"
|
|
24820
|
+
]);
|
|
24659
24821
|
for (const key of envVars) {
|
|
24660
24822
|
const val = process.env[key];
|
|
24661
24823
|
if (val !== void 0) {
|
|
24662
|
-
|
|
24824
|
+
const display = sensitiveEnvVars.has(key) ? val.length > 4 ? `[set \u2014 ${val.slice(0, 4)}...]` : val.length > 0 ? "[set]" : "[empty]" : val;
|
|
24825
|
+
printKeyValue(key, display, 2);
|
|
24663
24826
|
}
|
|
24664
24827
|
}
|
|
24665
24828
|
}
|
|
@@ -24777,6 +24940,12 @@ __export(config_exports, {
|
|
|
24777
24940
|
import { join as join34, resolve as resolve22 } from "node:path";
|
|
24778
24941
|
import { homedir as homedir13 } from "node:os";
|
|
24779
24942
|
import { cwd as cwd3 } from "node:process";
|
|
24943
|
+
function redactIfSensitive(key, value) {
|
|
24944
|
+
if (SENSITIVE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
24945
|
+
return value.length > 4 ? `[set \u2014 ${value.slice(0, 4)}...]` : "[set]";
|
|
24946
|
+
}
|
|
24947
|
+
return String(value);
|
|
24948
|
+
}
|
|
24780
24949
|
function coerceForSettings(key, value) {
|
|
24781
24950
|
if (INT_KEYS.has(key))
|
|
24782
24951
|
return parseInt(value, 10);
|
|
@@ -24812,7 +24981,7 @@ function handleShow(opts, config) {
|
|
|
24812
24981
|
if (projectKeys.length > 0) {
|
|
24813
24982
|
printSection(`Project Overrides (.oa/settings.json)`);
|
|
24814
24983
|
for (const [k, v] of projectKeys) {
|
|
24815
|
-
printKeyValue(k,
|
|
24984
|
+
printKeyValue(k, redactIfSensitive(k, v), 2);
|
|
24816
24985
|
}
|
|
24817
24986
|
} else {
|
|
24818
24987
|
printSection("Project Overrides");
|
|
@@ -24823,7 +24992,7 @@ function handleShow(opts, config) {
|
|
|
24823
24992
|
if (globalKeys.length > 0) {
|
|
24824
24993
|
printSection("Global Settings (~/.open-agents/settings.json)");
|
|
24825
24994
|
for (const [k, v] of globalKeys) {
|
|
24826
|
-
printKeyValue(k,
|
|
24995
|
+
printKeyValue(k, redactIfSensitive(k, v), 2);
|
|
24827
24996
|
}
|
|
24828
24997
|
}
|
|
24829
24998
|
printSection("Config File");
|
|
@@ -24865,7 +25034,7 @@ function handleSet(opts, _config) {
|
|
|
24865
25034
|
initOaDirectory(repoRoot);
|
|
24866
25035
|
const coerced = coerceForSettings(key, value);
|
|
24867
25036
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
24868
|
-
printSuccess(`Project override set: ${key} = ${value}`);
|
|
25037
|
+
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
|
|
24869
25038
|
printInfo(`Saved to ${join34(repoRoot, ".oa", "settings.json")}`);
|
|
24870
25039
|
printInfo("This override applies only when running in this workspace.");
|
|
24871
25040
|
} catch (err) {
|
|
@@ -24875,7 +25044,7 @@ function handleSet(opts, _config) {
|
|
|
24875
25044
|
} else {
|
|
24876
25045
|
try {
|
|
24877
25046
|
setConfigValue(key, value);
|
|
24878
|
-
printSuccess(`Config updated: ${key} = ${value}`);
|
|
25047
|
+
printSuccess(`Config updated: ${key} = ${redactIfSensitive(key, value)}`);
|
|
24879
25048
|
printInfo(`Saved to ~/.open-agents/config.json`);
|
|
24880
25049
|
printInfo("Tip: Use --local to set project-specific overrides.");
|
|
24881
25050
|
} catch (err) {
|
|
@@ -24894,7 +25063,7 @@ function handleKeys() {
|
|
|
24894
25063
|
printInfo(" oa config set model qwen3.5:122b # global default");
|
|
24895
25064
|
printInfo(" oa config set model qwen3.5:122b --local # this project only");
|
|
24896
25065
|
}
|
|
24897
|
-
var CONFIG_KEYS, INT_KEYS, BOOL_KEYS;
|
|
25066
|
+
var CONFIG_KEYS, SENSITIVE_KEYS, INT_KEYS, BOOL_KEYS;
|
|
24898
25067
|
var init_config3 = __esm({
|
|
24899
25068
|
"packages/cli/dist/commands/config.js"() {
|
|
24900
25069
|
"use strict";
|
|
@@ -24916,6 +25085,7 @@ var init_config3 = __esm({
|
|
|
24916
25085
|
stream: "Enable real-time token streaming with pastel syntax highlighting (true/false)",
|
|
24917
25086
|
bruteforce: "Brute-force mode: auto re-engage agent when turn limit hit (true/false)"
|
|
24918
25087
|
};
|
|
25088
|
+
SENSITIVE_KEYS = /* @__PURE__ */ new Set(["apiKey", "api_key", "secret", "password", "token"]);
|
|
24919
25089
|
INT_KEYS = /* @__PURE__ */ new Set(["maxRetries", "timeoutMs"]);
|
|
24920
25090
|
BOOL_KEYS = /* @__PURE__ */ new Set(["dryRun", "verbose", "voice", "stream", "bruteforce"]);
|
|
24921
25091
|
}
|
package/package.json
CHANGED