sparkecoder 0.1.5 → 0.1.6

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.
@@ -1,6 +1,6 @@
1
1
  import 'ai';
2
2
  import '../schema-CkrIadxa.js';
3
- export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, d as buildSystemPrompt } from '../index-Btr542-G.js';
3
+ export { A as Agent, a as AgentOptions, b as AgentRunOptions, c as AgentStreamResult, C as ContextManager, d as buildSystemPrompt } from '../index-BeKylVnB.js';
4
4
  import '../bash-CGAqW7HR.js';
5
5
  import 'drizzle-orm/sqlite-core';
6
6
  import 'zod';
package/dist/cli.js CHANGED
@@ -5234,7 +5234,24 @@ async function runChat(options) {
5234
5234
  try {
5235
5235
  const running = await isServerRunning(baseUrl);
5236
5236
  if (running) {
5237
- const webUrl = `http://localhost:${options.webPort || "6969"}`;
5237
+ const webPortSequence = [6969, 6970, 6971, 6972, 6973, 6974, 6975, 6976, 6977, 6978];
5238
+ let actualWebPort = options.webPort || "6969";
5239
+ for (const port of webPortSequence) {
5240
+ try {
5241
+ const response = await fetch(`http://localhost:${port}/api/health`, {
5242
+ signal: AbortSignal.timeout(500)
5243
+ });
5244
+ if (response.ok) {
5245
+ const data = await response.json();
5246
+ if (data.name === "sparkecoder-web") {
5247
+ actualWebPort = String(port);
5248
+ break;
5249
+ }
5250
+ }
5251
+ } catch {
5252
+ }
5253
+ }
5254
+ const webUrl = `http://localhost:${actualWebPort}`;
5238
5255
  console.log(`\u2714 Web UI: ${chalk.cyan(webUrl)}`);
5239
5256
  } else {
5240
5257
  if (options.autoStart === false) {
@@ -5244,7 +5261,7 @@ async function runChat(options) {
5244
5261
  }
5245
5262
  const spinner = ora("Starting server...").start();
5246
5263
  try {
5247
- await startServer({
5264
+ const serverResult = await startServer({
5248
5265
  port: parseInt(options.port),
5249
5266
  host: options.host,
5250
5267
  configPath: options.config,
@@ -5256,7 +5273,7 @@ async function runChat(options) {
5256
5273
  webPort: parseInt(options.webPort || "6969")
5257
5274
  });
5258
5275
  serverStartedByUs = true;
5259
- const webUrl = `http://localhost:${options.webPort || "6969"}`;
5276
+ const webUrl = `http://localhost:${serverResult.webPort || options.webPort || "6969"}`;
5260
5277
  spinner.succeed(`Web UI: ${chalk.cyan(webUrl)}`);
5261
5278
  const cleanup = () => {
5262
5279
  if (serverStartedByUs) {