open-agents-ai 0.184.35 → 0.184.36

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 +26 -154
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -47641,8 +47641,8 @@ async function handleSlashCommand(input, ctx) {
47641
47641
  writeFileSync19(jwtFile, JSON.stringify(jwtPayload, null, 2));
47642
47642
  renderInfo(`Launching fortemi-react from ${fDir}...`);
47643
47643
  try {
47644
- const { spawn: spawn23 } = __require("node:child_process");
47645
- const child = spawn23("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
47644
+ const { spawn: spawn22 } = __require("node:child_process");
47645
+ const child = spawn22("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
47646
47646
  cwd: join58(fDir, "apps", "standalone"),
47647
47647
  stdio: "ignore",
47648
47648
  detached: true,
@@ -50459,8 +50459,8 @@ Environment="OLLAMA_NUM_PARALLEL=${n}"
50459
50459
  }
50460
50460
  await new Promise((r) => setTimeout(r, 1e3));
50461
50461
  process.env.OLLAMA_NUM_PARALLEL = String(n);
50462
- const { spawn: spawn23 } = await import("node:child_process");
50463
- const child = spawn23("ollama", ["serve"], {
50462
+ const { spawn: spawn22 } = await import("node:child_process");
50463
+ const child = spawn22("ollama", ["serve"], {
50464
50464
  stdio: "ignore",
50465
50465
  detached: true,
50466
50466
  env: { ...process.env, OLLAMA_NUM_PARALLEL: String(n) }
@@ -68115,161 +68115,33 @@ var serve_exports2 = {};
68115
68115
  __export(serve_exports2, {
68116
68116
  serveCommand: () => serveCommand
68117
68117
  });
68118
- import { spawn as spawn22 } from "node:child_process";
68119
68118
  async function serveCommand(opts, config) {
68120
- const backendType = config.backendType;
68121
- if (backendType === "ollama") {
68122
- await serveOllama(opts, config);
68123
- } else if (backendType === "vllm") {
68124
- await serveVllm(opts, config);
68125
- } else {
68126
- printHeader("Backend: fake");
68127
- printInfo("FakeBackend requires no server \u2014 it runs in-process.");
68128
- printInfo("Use --backend ollama or --backend vllm to connect to a real model.");
68129
- }
68130
- }
68131
- async function serveOllama(opts, config) {
68132
- const model = opts.model ?? config.model;
68133
- const baseUrl = config.backendUrl;
68134
- printHeader("Ollama Backend");
68135
- printSection("Active Configuration");
68136
- printKeyValue("Backend", "Ollama (manages its own server)", 2);
68137
- printKeyValue("URL", baseUrl, 2);
68138
- printKeyValue("Model", model, 2);
68139
- printInfo("Ollama manages its own server process \u2014 no startup needed via open-agents.");
68140
- printInfo("If Ollama is not running, start it with: ollama serve");
68141
- const backend = new OllamaBackend({ baseUrl, model });
68142
- let healthy;
68143
- try {
68144
- healthy = await backend.healthCheck();
68145
- } catch {
68146
- healthy = false;
68147
- }
68148
- if (!healthy) {
68149
- printWarning(`Ollama is not reachable at ${baseUrl}`);
68150
- printInfo("Start Ollama and then run: open-agents status");
68151
- return;
68152
- }
68153
- printSuccess(`Ollama is running at ${baseUrl}`);
68154
- let availableModels = [];
68119
+ const port = opts.port ?? 11435;
68120
+ const ollamaUrl = config.backendUrl || "http://127.0.0.1:11434";
68121
+ printHeader("Open Agents REST API");
68122
+ printInfo(`Starting API server on port ${port}...`);
68123
+ printInfo(`Backend: ${config.backendType} (${ollamaUrl})`);
68155
68124
  try {
68156
- availableModels = await OllamaBackend.listModels(baseUrl);
68157
- } catch {
68158
- }
68159
- if (availableModels.length > 0) {
68160
- printSection("Available Models");
68161
- for (const name of availableModels) {
68162
- const isActive = name === model;
68163
- printKeyValue(isActive ? `${name} (configured)` : name, "", 2);
68164
- }
68165
- if (!availableModels.includes(model)) {
68166
- printWarning(`Model "${model}" is not pulled yet.`);
68167
- printInfo(`Pull it with: ollama pull ${model}`);
68168
- }
68169
- }
68170
- if (opts.verbose) {
68171
- printSection("Next Steps");
68172
- printInfo(`Run a task: open-agents run "your task here" --backend ollama`);
68173
- printInfo(`Check status: open-agents status`);
68174
- }
68175
- const apiPort = opts.port ?? 11435;
68176
- printSection("Starting API Server");
68177
- printKeyValue("Port", String(apiPort), 2);
68178
- printKeyValue("Ollama proxy", baseUrl, 2);
68179
- const server = startApiServer({
68180
- port: apiPort,
68181
- verbose: opts.verbose,
68182
- ollamaUrl: baseUrl
68183
- });
68184
- await new Promise((resolve36) => {
68185
- server.on("close", resolve36);
68186
- });
68187
- }
68188
- async function serveVllm(opts, config) {
68189
- const port = opts.port ?? 8e3;
68190
- const host = opts.host ?? "0.0.0.0";
68191
- const model = opts.model ?? config.model;
68192
- printHeader("Start vLLM Server");
68193
- printSection("Server Configuration");
68194
- printKeyValue("Model", model, 2);
68195
- printKeyValue("Host", host, 2);
68196
- printKeyValue("Port", String(port), 2);
68197
- if (opts.extraArgs && opts.extraArgs.length > 0) {
68198
- printKeyValue("Extra args", opts.extraArgs.join(" "), 2);
68199
- }
68200
- const args = [
68201
- "-m",
68202
- "vllm.entrypoints.openai.api_server",
68203
- "--model",
68204
- model,
68205
- "--host",
68206
- host,
68207
- "--port",
68208
- String(port),
68209
- ...opts.extraArgs ?? []
68210
- ];
68211
- printInfo(`Running: python ${args.join(" ")}`);
68212
- printInfo(`Server will be available at http://${host}:${port}`);
68213
- printInfo("Press Ctrl+C to stop");
68214
- if (opts.verbose) {
68215
- printSection("Environment");
68216
- printKeyValue("CUDA_VISIBLE_DEVICES", process.env["CUDA_VISIBLE_DEVICES"] ?? "(not set)", 2);
68217
- printKeyValue("HF_TOKEN", process.env["HF_TOKEN"] ? "[set]" : "(not set)", 2);
68218
- }
68219
- await runVllmServer(args, opts.verbose ?? false);
68220
- }
68221
- async function runVllmServer(args, verbose) {
68222
- return new Promise((resolve36, reject) => {
68223
- const child = spawn22("python", args, {
68224
- stdio: verbose ? "inherit" : ["ignore", "pipe", "pipe"],
68225
- env: { ...process.env }
68226
- });
68227
- if (child.stdout) {
68228
- child.stdout.on("data", (chunk) => {
68229
- const line = chunk.toString().trim();
68230
- if (line)
68231
- printInfo(`[vllm] ${line}`);
68232
- });
68233
- }
68234
- if (child.stderr) {
68235
- child.stderr.on("data", (chunk) => {
68236
- const line = chunk.toString().trim();
68237
- if (line)
68238
- printWarning(`[vllm] ${line}`);
68239
- });
68240
- }
68241
- child.once("spawn", () => {
68242
- printSuccess("vLLM process started");
68243
- });
68244
- child.once("error", (err) => {
68245
- if (err.code === "ENOENT") {
68246
- printError("'python' not found. Ensure Python 3.10+ and vLLM are installed.");
68247
- printInfo("Install vLLM: pip install vllm");
68248
- reject(err);
68249
- } else {
68250
- printError(`Failed to start vLLM: ${err.message}`);
68251
- reject(err);
68252
- }
68253
- });
68254
- child.once("exit", (code, signal) => {
68255
- if (signal) {
68256
- printInfo(`vLLM server stopped by signal ${signal}`);
68125
+ const server = startApiServer({ port, ollamaUrl });
68126
+ await new Promise((resolve36) => {
68127
+ process.on("SIGINT", () => {
68128
+ server.close();
68257
68129
  resolve36();
68258
- } else if (code === 0) {
68259
- printSuccess("vLLM server exited cleanly");
68130
+ });
68131
+ process.on("SIGTERM", () => {
68132
+ server.close();
68260
68133
  resolve36();
68261
- } else {
68262
- printError(`vLLM server exited with code ${code}`);
68263
- reject(new Error(`vLLM exited with code ${code}`));
68264
- }
68134
+ });
68265
68135
  });
68266
- const forwardSignal = (sig) => {
68267
- if (!child.killed)
68268
- child.kill(sig);
68269
- };
68270
- process.once("SIGINT", () => forwardSignal("SIGINT"));
68271
- process.once("SIGTERM", () => forwardSignal("SIGTERM"));
68272
- });
68136
+ } catch (err) {
68137
+ const msg = err instanceof Error ? err.message : String(err);
68138
+ if (msg.includes("EADDRINUSE")) {
68139
+ printError(`Port ${port} already in use. Another OA instance may be running.`);
68140
+ printInfo(`Try: oa serve --port ${port + 1}`);
68141
+ } else {
68142
+ printError(`API server failed: ${msg}`);
68143
+ }
68144
+ }
68273
68145
  }
68274
68146
  var init_serve2 = __esm({
68275
68147
  "packages/cli/dist/commands/serve.js"() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.184.35",
3
+ "version": "0.184.36",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) \u2014 interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",