@orbit-build/cli 0.2.0 → 0.2.1

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 (3) hide show
  1. package/README.md +6 -4
  2. package/dist/index.js +57 -102
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -30,10 +30,12 @@ orbit doctor --probe --deepseek # configuration + live probe
30
30
  orbit update --check # check without installing
31
31
  ```
32
32
 
33
- Inside the TUI, use `/webui` for the synchronized browser workspace. One project
34
- maps to one codebase folder and can contain multiple persisted chats. Type `/`
35
- in either interface for the shared command catalog; use `/goal`, `/plan`,
36
- `/model`, `/compact`, `/timeline`, `/rewind`, and `/rollback` for durable work.
33
+ Inside the TUI, use `/webui` to start the synchronized browser workspace, then
34
+ open the authenticated URL beside its `completed` message. Orbit does not open
35
+ a browser automatically. One project maps to one codebase folder and can
36
+ contain multiple persisted chats. Type `/` in either interface for the shared
37
+ command catalog; use `/goal`, `/plan`, `/model`, `/compact`, `/timeline`,
38
+ `/rewind`, and `/rollback` for durable work.
37
39
 
38
40
  Accepted prompts are persisted before provider work starts. After an unexpected
39
41
  shutdown, Orbit resumes conservatively without silently replaying unfinished
package/dist/index.js CHANGED
@@ -518,7 +518,7 @@ var require_cross_spawn = __commonJS({
518
518
  var cp = __require("child_process");
519
519
  var parse6 = require_parse();
520
520
  var enoent = require_enoent();
521
- function spawn4(command, args, options) {
521
+ function spawn3(command, args, options) {
522
522
  const parsed = parse6(command, args, options);
523
523
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
524
524
  enoent.hookChildProcess(spawned, parsed);
@@ -530,8 +530,8 @@ var require_cross_spawn = __commonJS({
530
530
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
531
531
  return result;
532
532
  }
533
- module.exports = spawn4;
534
- module.exports.spawn = spawn4;
533
+ module.exports = spawn3;
534
+ module.exports.spawn = spawn3;
535
535
  module.exports.sync = spawnSync;
536
536
  module.exports._parse = parse6;
537
537
  module.exports._enoent = enoent;
@@ -211377,7 +211377,7 @@ var require_src = __commonJS({
211377
211377
  });
211378
211378
 
211379
211379
  // src/index.ts
211380
- import { Command } from "commander";
211380
+ import { Command, Option } from "commander";
211381
211381
  import picocolors27 from "picocolors";
211382
211382
 
211383
211383
  // ../shared/dist/index.js
@@ -237473,9 +237473,10 @@ function buildSlashCommandHelp(isZh) {
237473
237473
  }
237474
237474
 
237475
237475
  // src/tui/TerminalText.ts
237476
- var ANSI_PATTERN = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
237476
+ var TERMINAL_CONTROL_PATTERN = /(?:[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;;[^\u0007]*(?:\u0007|\u001b\\))/g;
237477
+ var HYPERLINK_CLOSE = "\x1B]8;;\x07";
237477
237478
  function stripAnsiCodes(str) {
237478
- return str.replace(ANSI_PATTERN, "");
237479
+ return str.replace(TERMINAL_CONTROL_PATTERN, "");
237479
237480
  }
237480
237481
  function isFullWidth(codePoint) {
237481
237482
  if (Number.isNaN(codePoint)) return false;
@@ -237518,19 +237519,22 @@ function wrapAnsiLine(line, maxWidth) {
237518
237519
  let currentLine = "";
237519
237520
  let currentWidth = 0;
237520
237521
  let activeColor = "";
237522
+ let activeHyperlink = "";
237521
237523
  let index = 0;
237522
237524
  while (index < line.length) {
237523
- ANSI_PATTERN.lastIndex = index;
237524
- const match = ANSI_PATTERN.exec(line);
237525
+ TERMINAL_CONTROL_PATTERN.lastIndex = index;
237526
+ const match = TERMINAL_CONTROL_PATTERN.exec(line);
237525
237527
  if (match?.index === index) {
237526
- const ansiCode = match[0];
237527
- currentLine += ansiCode;
237528
- if (ansiCode.includes("m") && !ansiCode.includes("[0m")) {
237529
- activeColor = ansiCode;
237530
- } else if (ansiCode.includes("[0m")) {
237528
+ const controlSequence = match[0];
237529
+ currentLine += controlSequence;
237530
+ if (controlSequence.startsWith("\x1B]8;;")) {
237531
+ activeHyperlink = controlSequence === HYPERLINK_CLOSE ? "" : controlSequence;
237532
+ } else if (controlSequence.includes("m") && !controlSequence.includes("[0m")) {
237533
+ activeColor = controlSequence;
237534
+ } else if (controlSequence.includes("[0m")) {
237531
237535
  activeColor = "";
237532
237536
  }
237533
- index += ansiCode.length;
237537
+ index += controlSequence.length;
237534
237538
  continue;
237535
237539
  }
237536
237540
  const code = line.codePointAt(index) ?? 0;
@@ -237539,8 +237543,9 @@ function wrapAnsiLine(line, maxWidth) {
237539
237543
  const charWidth = isFullWidth(code) ? 2 : 1;
237540
237544
  if (currentWidth + charWidth > maxWidth) {
237541
237545
  if (activeColor) currentLine += "\x1B[0m";
237546
+ if (activeHyperlink) currentLine += HYPERLINK_CLOSE;
237542
237547
  lines.push(currentLine);
237543
- currentLine = activeColor + char;
237548
+ currentLine = activeColor + activeHyperlink + char;
237544
237549
  currentWidth = charWidth;
237545
237550
  } else {
237546
237551
  currentLine += char;
@@ -238592,6 +238597,9 @@ async function pageText(text) {
238592
238597
 
238593
238598
  // src/tui/FullscreenTui.ts
238594
238599
  var INPUT_PREFIX_WIDTH = 12;
238600
+ function terminalHyperlink(label, url) {
238601
+ return `\x1B]8;;${url}\x07${label}\x1B]8;;\x07`;
238602
+ }
238595
238603
  var FullscreenTui = class {
238596
238604
  constructor(cwd, modelName, version, config, dependencies = {}) {
238597
238605
  this.cwd = cwd;
@@ -238620,7 +238628,6 @@ var FullscreenTui = class {
238620
238628
  cachedStaticLinesCount = 0;
238621
238629
  cachedStaticContent = "";
238622
238630
  lastRenderedBottomHeight = 0;
238623
- pinnedNotice = null;
238624
238631
  // DeepSeek real-time thinking
238625
238632
  currentThinking = "";
238626
238633
  // Timers and metrics
@@ -238749,7 +238756,7 @@ var FullscreenTui = class {
238749
238756
  this.inputHistory = this.inputHistoryStore.load();
238750
238757
  this.terminalInitialized = true;
238751
238758
  }
238752
- formatSystemStatusLine(rawLine, prefixUnknown) {
238759
+ formatSystemStatusLine(rawLine, prefixUnknown, actionLink) {
238753
238760
  const morandi2 = MORANDI;
238754
238761
  const plain = stripAnsiCodes(rawLine.trim()).trim();
238755
238762
  if (!plain) return "";
@@ -238757,7 +238764,11 @@ var FullscreenTui = class {
238757
238764
  return "";
238758
238765
  }
238759
238766
  if (plain.startsWith("\u2714")) {
238760
- return morandi2.completed("completed") + morandi2.gray(plain.substring(1));
238767
+ const renderedLink = actionLink ? ` ${terminalHyperlink(
238768
+ morandi2.accent(actionLink.label),
238769
+ actionLink.url
238770
+ )} ${morandi2.dim("\xB7")}` : "";
238771
+ return morandi2.completed("completed") + renderedLink + morandi2.gray(plain.substring(1));
238761
238772
  }
238762
238773
  if (plain.startsWith("\u2716")) {
238763
238774
  return morandi2.failed("failed") + morandi2.gray(plain.substring(1));
@@ -238799,6 +238810,7 @@ var FullscreenTui = class {
238799
238810
  lastLiveLookupQuery = "";
238800
238811
  };
238801
238812
  for (const sys of system) {
238813
+ let pendingActionLink = sys.actionLink;
238802
238814
  const rawLines = sys.text.split("\n");
238803
238815
  for (const rawLine of rawLines) {
238804
238816
  const plain = stripAnsiCodes(rawLine.trim()).trim();
@@ -238837,10 +238849,12 @@ var FullscreenTui = class {
238837
238849
  flushLiveLookupSummary();
238838
238850
  const formatted = this.formatSystemStatusLine(
238839
238851
  rawLine,
238840
- options.prefixUnknown
238852
+ options.prefixUnknown,
238853
+ pendingActionLink
238841
238854
  );
238842
238855
  if (formatted) {
238843
238856
  lines.push(formatted);
238857
+ pendingActionLink = void 0;
238844
238858
  }
238845
238859
  }
238846
238860
  }
@@ -238862,20 +238876,15 @@ var FullscreenTui = class {
238862
238876
  saveInputHistory() {
238863
238877
  this.inputHistoryStore.save(this.inputHistory);
238864
238878
  }
238865
- addSystemMessage(text, _raw = false) {
238879
+ addSystemMessage(text, _raw = false, actionLink) {
238866
238880
  if (!text) return;
238867
238881
  this.history.push({
238868
238882
  role: "system",
238869
- text
238883
+ text,
238884
+ actionLink
238870
238885
  });
238871
238886
  this.render();
238872
238887
  }
238873
- /** Keep one important action visible immediately above the terminal status row. */
238874
- setPinnedNotice(text, url) {
238875
- const normalized = text?.trim();
238876
- this.pinnedNotice = normalized ? { text: normalized, url } : null;
238877
- if (this.isActive) this.render();
238878
- }
238879
238888
  /** Mirror a prompt submitted by another local UI into this conversation. */
238880
238889
  addUserMessage(text) {
238881
238890
  const trimmed = text.trim();
@@ -240264,15 +240273,6 @@ var FullscreenTui = class {
240264
240273
  1,
240265
240274
  columns - 6 - statusTextLength - keybindingsLength
240266
240275
  );
240267
- if (this.pinnedNotice) {
240268
- const availableWidth2 = Math.max(12, columns - 7);
240269
- const noticeText = truncatePlainToWidth(
240270
- this.pinnedNotice.text,
240271
- availableWidth2
240272
- );
240273
- const renderedNotice = this.pinnedNotice.url ? `\x1B]8;;${this.pinnedNotice.url}\x07${morandi2.accent(noticeText)}\x1B]8;;\x07` : morandi2.accent(noticeText);
240274
- bottomLines.push(" " + morandi2.completed("\u25CF") + " " + renderedNotice);
240275
- }
240276
240276
  bottomLines.push(" " + statusText + " ".repeat(spacing) + keybindings);
240277
240277
  const bottomHeight = bottomLines.length;
240278
240278
  const displayedModel = environment.activeModelName || this.modelNameGetter();
@@ -240843,9 +240843,6 @@ ${args}`;
240843
240843
  // src/runtime/CommandRouter.ts
240844
240844
  import { createRequire as createRequire2 } from "module";
240845
240845
 
240846
- // src/runtime/webui/WebUiServer.ts
240847
- import { spawn as spawn2 } from "child_process";
240848
-
240849
240846
  // src/runtime/webui/WebUiRuntime.ts
240850
240847
  import http from "http";
240851
240848
  import { randomBytes, randomUUID as randomUUID7 } from "crypto";
@@ -252081,6 +252078,7 @@ var OrbitWebUiRuntime = class {
252081
252078
  const handle = {
252082
252079
  port: actualPort,
252083
252080
  url: `http://127.0.0.1:${actualPort}/#token=${encodeURIComponent(token)}`,
252081
+ browserOpened: false,
252084
252082
  close: () => this.stop()
252085
252083
  };
252086
252084
  this.handle = handle;
@@ -252619,13 +252617,8 @@ var activeRuntime;
252619
252617
  function parseWebUiArgs(rawArgs) {
252620
252618
  const args = rawArgs.split(/\s+/).map((item) => item.trim()).filter(Boolean);
252621
252619
  let port;
252622
- let open = true;
252623
252620
  for (let index = 0; index < args.length; index++) {
252624
252621
  const arg = args[index];
252625
- if (arg === "--no-open") {
252626
- open = false;
252627
- continue;
252628
- }
252629
252622
  if (arg === "--port") {
252630
252623
  const next = args[index + 1];
252631
252624
  if (/^\d+$/.test(next || "")) {
@@ -252646,46 +252639,13 @@ function parseWebUiArgs(rawArgs) {
252646
252639
  }
252647
252640
  }
252648
252641
  }
252649
- return { port, open };
252650
- }
252651
- async function openBrowser(url) {
252652
- const { command, args } = resolveBrowserLaunch(url);
252653
- return new Promise((resolve18) => {
252654
- const child = spawn2(command, args, {
252655
- detached: true,
252656
- stdio: "ignore",
252657
- windowsHide: true
252658
- });
252659
- let settled = false;
252660
- const finish = (opened) => {
252661
- if (settled) return;
252662
- settled = true;
252663
- clearTimeout(timeout);
252664
- resolve18(opened);
252665
- };
252666
- const timeout = setTimeout(() => finish(false), 2e3);
252667
- child.once("spawn", () => finish(true));
252668
- child.once("error", () => finish(false));
252669
- child.unref();
252670
- });
252671
- }
252672
- function resolveBrowserLaunch(url, platform = process.platform) {
252673
- if (platform === "win32") {
252674
- return { command: "explorer.exe", args: [url] };
252675
- }
252676
- return {
252677
- command: platform === "darwin" ? "open" : "xdg-open",
252678
- args: [url]
252679
- };
252642
+ return { port, open: false };
252680
252643
  }
252681
252644
  async function startOrbitWebUi(options) {
252682
252645
  const current = activeRuntime;
252683
252646
  if (current?.canReuse(options.port)) {
252684
252647
  current.updateOptions(options);
252685
- const handle2 = current.getHandle();
252686
- const browserOpened2 = options.open !== false ? await openBrowser(handle2.url) : false;
252687
- handle2.browserOpened = browserOpened2;
252688
- return handle2;
252648
+ return current.getHandle();
252689
252649
  }
252690
252650
  if (current?.hasActiveTurn) {
252691
252651
  throw new Error(
@@ -252699,8 +252659,6 @@ async function startOrbitWebUi(options) {
252699
252659
  const runtime = new OrbitWebUiRuntime(options);
252700
252660
  const handle = await runtime.start();
252701
252661
  activeRuntime = runtime;
252702
- const browserOpened = options.open !== false ? await openBrowser(handle.url) : false;
252703
- handle.browserOpened = browserOpened;
252704
252662
  return handle;
252705
252663
  }
252706
252664
  async function stopOrbitWebUi() {
@@ -254371,7 +254329,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
254371
254329
  }
254372
254330
 
254373
254331
  // src/runtime/ProjectLauncher.ts
254374
- import { spawn as spawn3 } from "child_process";
254332
+ import { spawn as spawn2 } from "child_process";
254375
254333
  import { existsSync as existsSync20, mkdirSync as mkdirSync12, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
254376
254334
  import { isAbsolute as isAbsolute6, parse as parse4, resolve as resolve9 } from "path";
254377
254335
  function launchOrbitProject(request, options = {}) {
@@ -254395,7 +254353,7 @@ function launchOrbitProject(request, options = {}) {
254395
254353
  (options.registry || new ProjectRegistry()).register(projectPath);
254396
254354
  const entryPoint = options.entryPoint || process.argv[1];
254397
254355
  if (!entryPoint) throw new Error("Orbit CLI entry point is unavailable.");
254398
- const launch = options.launch || spawn3;
254356
+ const launch = options.launch || spawn2;
254399
254357
  const child = launch(
254400
254358
  options.executable || process.execPath,
254401
254359
  [entryPoint, "webui", "--cwd", projectPath],
@@ -254867,7 +254825,7 @@ var require2 = createRequire2(import.meta.url);
254867
254825
  function stripAnsi4(value) {
254868
254826
  return value.replace(/\u001b\[[0-9;]*m/g, "");
254869
254827
  }
254870
- function terminalHyperlink(label, url) {
254828
+ function terminalHyperlink2(label, url) {
254871
254829
  return `\x1B]8;;${url}\x07${label}\x1B]8;;\x07`;
254872
254830
  }
254873
254831
  var CommandRouter = class {
@@ -255011,7 +254969,7 @@ var CommandRouter = class {
255011
254969
  }
255012
254970
  if (command === "/webui") {
255013
254971
  const isZh = config.language === "zh";
255014
- const { port, open } = parseWebUiArgs(parts.slice(1).join(" "));
254972
+ const { port } = parseWebUiArgs(parts.slice(1).join(" "));
255015
254973
  try {
255016
254974
  await this.refreshProviderModels(config.provider.default);
255017
254975
  const handle = await startOrbitWebUi({
@@ -255019,7 +254977,6 @@ var CommandRouter = class {
255019
254977
  config,
255020
254978
  loop,
255021
254979
  port,
255022
- open,
255023
254980
  getProjects: () => new ProjectRegistry().list().slice(0, 20),
255024
254981
  submitPrompt: (prompt, attachments) => this.submitWebPrompt(prompt, attachments),
255025
254982
  cancelPrompt: () => this.cancelWebPrompt(),
@@ -255065,20 +255022,20 @@ var CommandRouter = class {
255065
255022
  });
255066
255023
  const displayUrl = new URL(handle.url);
255067
255024
  displayUrl.hash = "";
255068
- const browserOpened = handle.browserOpened === true;
255069
- const statusText = browserOpened ? isZh ? "\u2714 Orbit Web UI \u5DF2\u542F\u52A8\u5E76\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668" : "\u2714 Orbit Web UI started and opened in your browser" : isZh ? "\u26A0\uFE0F Orbit Web UI \u5DF2\u542F\u52A8\uFF1B\u6D4F\u89C8\u5668\u672A\u80FD\u81EA\u52A8\u6253\u5F00" : "\u26A0\uFE0F Orbit Web UI started; the browser did not open automatically";
255070
- const linkLabel = isZh ? `\u6253\u5F00 Web UI \xB7 ${displayUrl.href}` : `Open Web UI \xB7 ${displayUrl.href}`;
255025
+ const statusText = isZh ? "\u2714 Orbit Web UI \u5DF2\u542F\u52A8" : "\u2714 Orbit Web UI started";
255071
255026
  if (this.tui?.isActive) {
255072
- this.tui.addSystemMessage(
255073
- browserOpened ? picocolors18.green(statusText) : picocolors18.yellow(statusText)
255074
- );
255075
- this.tui.setPinnedNotice(linkLabel, handle.url);
255027
+ this.tui.addSystemMessage(picocolors18.green(statusText), false, {
255028
+ label: displayUrl.href,
255029
+ url: handle.url
255030
+ });
255076
255031
  } else {
255077
255032
  console.log(
255078
- browserOpened ? picocolors18.green(statusText) : picocolors18.yellow(statusText)
255079
- );
255080
- console.log(
255081
- ` ${terminalHyperlink(picocolors18.cyan(linkLabel), handle.url)}`
255033
+ [
255034
+ picocolors18.green("\u2714"),
255035
+ terminalHyperlink2(picocolors18.cyan(displayUrl.href), handle.url),
255036
+ picocolors18.dim("\xB7"),
255037
+ picocolors18.green(statusText.substring(1).trim())
255038
+ ].join(" ")
255082
255039
  );
255083
255040
  }
255084
255041
  eventBus.emitEvent("info", {
@@ -255086,7 +255043,6 @@ var CommandRouter = class {
255086
255043
  });
255087
255044
  } catch (error) {
255088
255045
  const message = error instanceof Error ? error.message : String(error);
255089
- this.tui?.setPinnedNotice?.(null);
255090
255046
  this.printOutput(
255091
255047
  isZh ? picocolors18.red(`\u2716 \u65E0\u6CD5\u542F\u52A8 Orbit Web UI: ${message}`) : picocolors18.red(`\u2716 Failed to start Orbit Web UI: ${message}`)
255092
255048
  );
@@ -256321,8 +256277,7 @@ Risk Warning: ${reason}`);
256321
256277
  if (this.webUiOnly) {
256322
256278
  const command = [
256323
256279
  "/webui",
256324
- this.webUiOnly.port !== void 0 ? `--port ${this.webUiOnly.port}` : "",
256325
- this.webUiOnly.open ? "" : "--no-open"
256280
+ this.webUiOnly.port !== void 0 ? `--port ${this.webUiOnly.port}` : ""
256326
256281
  ].filter(Boolean).join(" ");
256327
256282
  const result = await commandRouter.route(command);
256328
256283
  if (!result.processed) {
@@ -258985,7 +258940,7 @@ program.command("trace").description("export a redacted, versioned session audit
258985
258940
  program.command("lsp").description("start the local LSP autocomplete server").action(async () => {
258986
258941
  await runLSPServer(process.cwd());
258987
258942
  });
258988
- program.command("webui").description("start Orbit as a browser-first local coding workspace").option("--port <port>", "preferred loopback port (default: 6047)").option("--cwd <path>", "open a specific project directory").option("--no-open", "start without opening the default browser").action(async (localOptions, command) => {
258943
+ program.command("webui").description("start Orbit as a browser-first local coding workspace").option("--port <port>", "preferred loopback port (default: 6047)").option("--cwd <path>", "open a specific project directory").addOption(new Option("--no-open").hideHelp()).action(async (localOptions, command) => {
258989
258944
  const options = command.optsWithGlobals();
258990
258945
  const rawPort = localOptions.port;
258991
258946
  const port = rawPort === void 0 ? void 0 : Number(rawPort);
@@ -259010,7 +258965,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
259010
258965
  }
259011
258966
  const cwd = realpathSync4.native(requestedCwd);
259012
258967
  const outcome = await runAgent(cwd, void 0, overrides, false, {
259013
- webUi: { port, open: localOptions.open !== false }
258968
+ webUi: { port }
259014
258969
  });
259015
258970
  applyOutcomeExitCode(outcome);
259016
258971
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
5
5
  "keywords": [
6
6
  "ai",