open-agents-ai 0.15.7 → 0.15.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.
Files changed (2) hide show
  1. package/dist/index.js +86 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15422,10 +15422,8 @@ async function startInteractive(config, repoPath) {
15422
15422
  const needsSetup = isFirstRun() || !await isModelAvailable(config);
15423
15423
  if (needsSetup && config.backendType === "ollama") {
15424
15424
  const setupModel = await runSetupWizard(config);
15425
- if (setupModel === null) {
15426
- process.exit(0);
15427
- }
15428
- config = { ...config, model: setupModel };
15425
+ const freshConfig = loadConfig();
15426
+ config = { ...config, ...freshConfig, model: setupModel ?? freshConfig.model };
15429
15427
  }
15430
15428
  }
15431
15429
  if (config.backendType === "ollama" && !config.model.startsWith("open-agents-")) {
@@ -15444,16 +15442,18 @@ async function startInteractive(config, repoPath) {
15444
15442
  if (!isResumed) {
15445
15443
  try {
15446
15444
  const healthUrl = config.backendType === "ollama" ? `${config.backendUrl}/api/tags` : `${config.backendUrl}/v1/models`;
15447
- const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(1e4) });
15445
+ const headers = {};
15446
+ if (config.apiKey)
15447
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
15448
+ const resp = await fetch(healthUrl, { headers, signal: AbortSignal.timeout(1e4) });
15448
15449
  if (!resp.ok)
15449
15450
  throw new Error(`HTTP ${resp.status}`);
15450
15451
  } catch {
15451
- renderError(`Cannot reach ${config.backendType} at ${config.backendUrl}`);
15452
+ renderWarning(`Cannot reach ${config.backendType} at ${config.backendUrl}`);
15452
15453
  if (config.backendType === "ollama") {
15453
15454
  renderInfo("Start Ollama with: ollama serve");
15454
15455
  }
15455
- renderInfo("Use /endpoint to configure a different backend.");
15456
- process.exit(1);
15456
+ renderInfo("Use /endpoint to configure a different backend. Starting anyway...");
15457
15457
  }
15458
15458
  }
15459
15459
  const carousel = new Carousel();
@@ -15736,12 +15736,57 @@ async function startInteractive(config, repoPath) {
15736
15736
  }, 100);
15737
15737
  }
15738
15738
  }
15739
- rl.on("line", async (line) => {
15739
+ let pasteBuffer = [];
15740
+ let pasteTimer = null;
15741
+ let pasteIndicatorShown = false;
15742
+ function flushPasteBuffer() {
15743
+ if (pasteBuffer.length === 0)
15744
+ return;
15745
+ const lines = pasteBuffer.slice();
15746
+ pasteBuffer = [];
15747
+ pasteIndicatorShown = false;
15748
+ if (pasteTimer) {
15749
+ clearTimeout(pasteTimer);
15750
+ pasteTimer = null;
15751
+ }
15752
+ const combined = lines.join("\n");
15753
+ processLine(combined);
15754
+ }
15755
+ function showPasteIndicator() {
15756
+ const count = pasteBuffer.length;
15757
+ const label = ` ${c2.dim("[")}${c2.bold(c2.cyan(String(count)))}${c2.dim(" pasted line" + (count !== 1 ? "s" : "") + " \u2014 press Enter to submit]")}`;
15758
+ process.stdout.write(`\r\x1B[K${label}`);
15759
+ pasteIndicatorShown = true;
15760
+ }
15761
+ rl.on("line", (line) => {
15740
15762
  const input = line.trim();
15741
15763
  if (!input) {
15764
+ if (pasteBuffer.length > 0) {
15765
+ flushPasteBuffer();
15766
+ return;
15767
+ }
15742
15768
  showPrompt();
15743
15769
  return;
15744
15770
  }
15771
+ if (pasteBuffer.length === 0 && input.startsWith("/")) {
15772
+ processLine(input);
15773
+ return;
15774
+ }
15775
+ pasteBuffer.push(input);
15776
+ if (pasteTimer)
15777
+ clearTimeout(pasteTimer);
15778
+ pasteTimer = setTimeout(() => {
15779
+ pasteTimer = null;
15780
+ if (pasteBuffer.length === 1) {
15781
+ const solo = pasteBuffer.shift();
15782
+ pasteIndicatorShown = false;
15783
+ processLine(solo);
15784
+ } else {
15785
+ showPasteIndicator();
15786
+ }
15787
+ }, 50);
15788
+ });
15789
+ async function processLine(input) {
15745
15790
  if (input.startsWith("/")) {
15746
15791
  if (statusBar.isActive)
15747
15792
  statusBar.beginContentWrite();
@@ -15836,7 +15881,12 @@ ${result.text}`;
15836
15881
  }
15837
15882
  } else {
15838
15883
  activeTask.runner.injectUserMessage(input);
15839
- writeContent(() => renderUserInterrupt(input));
15884
+ const lineCount = input.split("\n").length;
15885
+ if (lineCount > 1) {
15886
+ writeContent(() => renderUserInterrupt(`[pasted ${lineCount} lines]`));
15887
+ } else {
15888
+ writeContent(() => renderUserInterrupt(input));
15889
+ }
15840
15890
  }
15841
15891
  showPrompt();
15842
15892
  return;
@@ -15871,7 +15921,9 @@ Summarize or analyze this transcription as appropriate.`;
15871
15921
  if (statusBar.isActive)
15872
15922
  statusBar.setScrollRegionTop(1);
15873
15923
  }
15874
- writeContent(() => renderUserMessage(isImage ? `[Image: ${cleanPath}]` : fullInput));
15924
+ const inputLineCount = fullInput.split("\n").length;
15925
+ const displayText = isImage ? `[Image: ${cleanPath}]` : inputLineCount > 1 ? `[pasted ${inputLineCount} lines]` : fullInput;
15926
+ writeContent(() => renderUserMessage(displayText));
15875
15927
  lastSubmittedPrompt = fullInput;
15876
15928
  try {
15877
15929
  const task = startTask(fullInput, currentConfig, repoRoot, voiceEngine, {
@@ -15931,7 +15983,7 @@ Summarize or analyze this transcription as appropriate.`;
15931
15983
  }
15932
15984
  }
15933
15985
  showPrompt();
15934
- });
15986
+ }
15935
15987
  rl.on("close", () => {
15936
15988
  statusBar.deactivate();
15937
15989
  const closeRows = process.stdout.rows ?? 24;
@@ -15941,6 +15993,19 @@ ${c2.dim("Goodbye!")}
15941
15993
  process.exit(0);
15942
15994
  });
15943
15995
  rl.on("SIGINT", () => {
15996
+ if (pasteBuffer.length > 0) {
15997
+ pasteBuffer = [];
15998
+ pasteIndicatorShown = false;
15999
+ if (pasteTimer) {
16000
+ clearTimeout(pasteTimer);
16001
+ pasteTimer = null;
16002
+ }
16003
+ writeContent(() => process.stdout.write(`
16004
+ ${c2.dim("(paste cancelled)")}
16005
+ `));
16006
+ showPrompt();
16007
+ return;
16008
+ }
15944
16009
  if (activeTask) {
15945
16010
  activeTask.runner.abort();
15946
16011
  writeContent(() => renderTaskAborted());
@@ -15957,10 +16022,8 @@ async function runWithTUI(task, config, repoPath) {
15957
16022
  const needsSetup = isFirstRun() || !await isModelAvailable(config);
15958
16023
  if (needsSetup && config.backendType === "ollama") {
15959
16024
  const setupModel = await runSetupWizard(config);
15960
- if (setupModel === null) {
15961
- process.exit(0);
15962
- }
15963
- config = { ...config, model: setupModel };
16025
+ const freshConfig = loadConfig();
16026
+ config = { ...config, ...freshConfig, model: setupModel ?? freshConfig.model };
15964
16027
  }
15965
16028
  if (config.backendType === "ollama" && !config.model.startsWith("open-agents-")) {
15966
16029
  try {
@@ -15973,15 +16036,18 @@ async function runWithTUI(task, config, repoPath) {
15973
16036
  }
15974
16037
  try {
15975
16038
  const healthUrl = config.backendType === "ollama" ? `${config.backendUrl}/api/tags` : `${config.backendUrl}/v1/models`;
15976
- const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(1e4) });
16039
+ const headers = {};
16040
+ if (config.apiKey)
16041
+ headers["Authorization"] = `Bearer ${config.apiKey}`;
16042
+ const resp = await fetch(healthUrl, { headers, signal: AbortSignal.timeout(1e4) });
15977
16043
  if (!resp.ok)
15978
16044
  throw new Error(`HTTP ${resp.status}`);
15979
16045
  } catch {
15980
- renderError(`Cannot reach ${config.backendType} at ${config.backendUrl}`);
16046
+ renderWarning(`Cannot reach ${config.backendType} at ${config.backendUrl}`);
15981
16047
  if (config.backendType === "ollama") {
15982
16048
  renderInfo("Start Ollama with: ollama serve");
15983
16049
  }
15984
- process.exit(1);
16050
+ renderInfo("The agent will retry when you submit a task. Use /endpoint to reconfigure.");
15985
16051
  }
15986
16052
  renderCompactHeader(config.model);
15987
16053
  renderUserMessage(task);
@@ -16000,6 +16066,7 @@ var init_interactive = __esm({
16000
16066
  init_dist5();
16001
16067
  init_dist2();
16002
16068
  init_listen();
16069
+ init_config();
16003
16070
  init_updater();
16004
16071
  init_commands();
16005
16072
  init_setup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.15.7",
3
+ "version": "0.15.9",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",