@orbit-build/cli 0.1.11 → 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 +596 -538
  3. package/package.json +1 -1
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
@@ -221285,7 +221285,7 @@ import {
221285
221285
  } from "fs";
221286
221286
  import { createHash as createHash7 } from "crypto";
221287
221287
  import { dirname as dirname7, join as join13 } from "path";
221288
- import { z as z29 } from "zod";
221288
+ import { z as z30 } from "zod";
221289
221289
  import { z as z210 } from "zod";
221290
221290
 
221291
221291
  // ../tools/dist/index.js
@@ -225276,6 +225276,7 @@ toolRegistry.register(new UpdatePlanTool());
225276
225276
  // ../sandbox/dist/index.js
225277
225277
  import {
225278
225278
  existsSync as existsSync10,
225279
+ lstatSync as lstatSync3,
225279
225280
  readFileSync as readFileSync13,
225280
225281
  writeFileSync as writeFileSync6,
225281
225282
  mkdirSync as mkdirSync6,
@@ -225283,38 +225284,63 @@ import {
225283
225284
  rmSync as rmSync2
225284
225285
  } from "fs";
225285
225286
  import { join as join10 } from "path";
225287
+ import { z as z20 } from "zod";
225286
225288
  import { existsSync as existsSync24, writeFileSync as writeFileSync24, unlinkSync as unlinkSync3 } from "fs";
225287
225289
  import { execFileSync as execFileSync3 } from "child_process";
225288
225290
  import fs from "fs";
225289
225291
  import path3 from "path";
225292
+ var SafePathSegmentSchema = z20.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/);
225293
+ var CheckpointIdSchema = z20.string().regex(/^cp_[a-f0-9]{32}$/);
225294
+ var PersistedCheckpointMetadataSchema = z20.object({
225295
+ id: CheckpointIdSchema,
225296
+ timestamp: z20.string().datetime(),
225297
+ toolCallId: z20.string().min(1).max(256),
225298
+ filePath: z20.string().min(1).max(4096),
225299
+ exists: z20.boolean()
225300
+ }).strict();
225290
225301
  var CheckpointManager = class {
225291
225302
  constructor(cwd, sessionId) {
225292
225303
  this.cwd = cwd;
225293
225304
  this.sessionId = sessionId;
225305
+ if (!SafePathSegmentSchema.safeParse(sessionId).success) {
225306
+ throw new Error(`Invalid checkpoint session id: ${sessionId}`);
225307
+ }
225308
+ this.checkpointRoot = resolveSafePath(
225309
+ cwd,
225310
+ join10(".orbit", "checkpoints", sessionId)
225311
+ );
225294
225312
  this.loadPersistedCheckpoints();
225295
225313
  }
225296
225314
  cwd;
225297
225315
  sessionId;
225298
225316
  checkpoints = [];
225317
+ checkpointRoot;
225299
225318
  getSessionCheckpointDir() {
225300
- return join10(this.cwd, ".orbit", "checkpoints", this.sessionId);
225319
+ return this.checkpointRoot;
225301
225320
  }
225302
225321
  loadPersistedCheckpoints() {
225303
225322
  const sessionDir = this.getSessionCheckpointDir();
225304
225323
  if (!existsSync10(sessionDir)) return;
225305
225324
  const loaded = [];
225306
225325
  for (const entry of readdirSync3(sessionDir, { withFileTypes: true })) {
225307
- if (!entry.isDirectory()) continue;
225308
- const checkpointDir = join10(sessionDir, entry.name);
225309
- const metaPath = join10(checkpointDir, "meta.json");
225326
+ if (!entry.isDirectory() || !CheckpointIdSchema.safeParse(entry.name).success) {
225327
+ continue;
225328
+ }
225329
+ const checkpointDir = resolveSafePath(sessionDir, entry.name);
225330
+ const metaPath = resolveSafePath(checkpointDir, "meta.json");
225310
225331
  if (!existsSync10(metaPath)) continue;
225311
225332
  try {
225312
- const meta = JSON.parse(readFileSync13(metaPath, "utf8"));
225313
- if (typeof meta.id !== "string" || typeof meta.timestamp !== "string" || typeof meta.toolCallId !== "string" || typeof meta.filePath !== "string") {
225333
+ const parsed = PersistedCheckpointMetadataSchema.safeParse(
225334
+ JSON.parse(readFileSync13(metaPath, "utf8"))
225335
+ );
225336
+ if (!parsed.success || parsed.data.id !== entry.name) {
225314
225337
  continue;
225315
225338
  }
225316
- const backupPath = join10(checkpointDir, "backup_content.txt");
225317
- const originalContent = meta.exists === true && existsSync10(backupPath) ? readFileSync13(backupPath, "utf8") : null;
225339
+ const meta = parsed.data;
225340
+ resolveSafePath(this.cwd, meta.filePath);
225341
+ const backupPath = resolveSafePath(checkpointDir, "backup_content.txt");
225342
+ if (meta.exists && !existsSync10(backupPath)) continue;
225343
+ const originalContent = meta.exists ? readFileSync13(backupPath, "utf8") : null;
225318
225344
  loaded.push({
225319
225345
  id: meta.id,
225320
225346
  sessionId: this.sessionId,
@@ -225334,23 +225360,26 @@ var CheckpointManager = class {
225334
225360
  this.checkpoints = loaded;
225335
225361
  }
225336
225362
  async captureBeforeState(toolCallId, filePath) {
225363
+ const validToolCallId = z20.string().min(1).max(256).parse(toolCallId);
225364
+ const validFilePath = z20.string().min(1).max(4096).parse(filePath);
225365
+ const safePath = resolveSafePath(this.cwd, validFilePath);
225337
225366
  let originalContent = null;
225338
- try {
225339
- const safePath = resolveSafePath(this.cwd, filePath);
225340
- if (existsSync10(safePath)) {
225341
- originalContent = readFileSync13(safePath, "utf8");
225367
+ if (existsSync10(safePath)) {
225368
+ const stats = lstatSync3(safePath);
225369
+ if (!stats.isFile() && !stats.isSymbolicLink()) {
225370
+ throw new Error(`Checkpoint target must be a file: ${validFilePath}`);
225342
225371
  }
225343
- } catch {
225372
+ originalContent = readFileSync13(safePath, "utf8");
225344
225373
  }
225345
225374
  const backup = {
225346
- path: filePath,
225375
+ path: validFilePath,
225347
225376
  originalContent
225348
225377
  };
225349
225378
  const checkpoint = {
225350
225379
  id: generateId("cp"),
225351
225380
  sessionId: this.sessionId,
225352
225381
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
225353
- toolCallId,
225382
+ toolCallId: validToolCallId,
225354
225383
  backups: [backup]
225355
225384
  };
225356
225385
  this.checkpoints.push(checkpoint);
@@ -225368,8 +225397,8 @@ var CheckpointManager = class {
225368
225397
  JSON.stringify({
225369
225398
  id: checkpoint.id,
225370
225399
  timestamp: checkpoint.timestamp,
225371
- toolCallId,
225372
- filePath,
225400
+ toolCallId: validToolCallId,
225401
+ filePath: validFilePath,
225373
225402
  exists: originalContent !== null
225374
225403
  }),
225375
225404
  "utf8"
@@ -225380,10 +225409,16 @@ var CheckpointManager = class {
225380
225409
  return [...this.checkpoints];
225381
225410
  }
225382
225411
  removeCheckpoint(checkpointId) {
225412
+ if (!CheckpointIdSchema.safeParse(checkpointId).success) {
225413
+ throw new Error(`Invalid checkpoint id: ${checkpointId}`);
225414
+ }
225383
225415
  this.checkpoints = this.checkpoints.filter(
225384
225416
  (checkpoint) => checkpoint.id !== checkpointId
225385
225417
  );
225386
- const checkpointDir = join10(this.getSessionCheckpointDir(), checkpointId);
225418
+ const checkpointDir = resolveSafePath(
225419
+ this.getSessionCheckpointDir(),
225420
+ checkpointId
225421
+ );
225387
225422
  if (existsSync10(checkpointDir)) {
225388
225423
  rmSync2(checkpointDir, { recursive: true, force: true });
225389
225424
  }
@@ -225394,18 +225429,28 @@ var RollbackManager = class {
225394
225429
  this.cwd = cwd;
225395
225430
  }
225396
225431
  cwd;
225432
+ /** Restore a checkpoint without allowing one filesystem failure to crash the caller. */
225397
225433
  rollback(checkpoint) {
225398
225434
  const restored = [];
225399
225435
  for (const backup of checkpoint.backups) {
225400
- const safePath = resolveSafePath(this.cwd, backup.path);
225401
- if (backup.originalContent === null) {
225402
- if (existsSync24(safePath)) {
225403
- unlinkSync3(safePath);
225436
+ try {
225437
+ const safePath = resolveSafePath(this.cwd, backup.path);
225438
+ if (backup.originalContent === null) {
225439
+ if (existsSync24(safePath)) {
225440
+ unlinkSync3(safePath);
225441
+ restored.push(backup.path);
225442
+ }
225443
+ } else {
225444
+ writeFileSync24(safePath, backup.originalContent, "utf8");
225404
225445
  restored.push(backup.path);
225405
225446
  }
225406
- } else {
225407
- writeFileSync24(safePath, backup.originalContent, "utf8");
225408
- restored.push(backup.path);
225447
+ } catch (error) {
225448
+ const detail = error instanceof Error ? error.message : String(error);
225449
+ return {
225450
+ success: false,
225451
+ error: `Could not restore ${backup.path}: ${detail}`,
225452
+ restored
225453
+ };
225409
225454
  }
225410
225455
  }
225411
225456
  return {
@@ -225674,7 +225719,7 @@ var import_typescript = __toESM(require_typescript(), 1);
225674
225719
  import { existsSync as existsSync11, promises as fsPromises2 } from "fs";
225675
225720
  import { dirname as dirname5, resolve as resolve5 } from "path";
225676
225721
  import { randomUUID as randomUUID3 } from "crypto";
225677
- import { z as z20 } from "zod";
225722
+ import { z as z21 } from "zod";
225678
225723
  import { basename as basename3, join as join11 } from "path";
225679
225724
  import { existsSync as existsSync25, promises as fsPromises3 } from "fs";
225680
225725
  import { dirname as dirname22, resolve as resolve23 } from "path";
@@ -225845,29 +225890,29 @@ function getOrbitCachePath(cwd, fileName) {
225845
225890
  const relativePath = branchName ? join11(".orbit", "branches", branchName, fileName) : join11(".orbit", fileName);
225846
225891
  return resolveSafePath(cwd, relativePath);
225847
225892
  }
225848
- var EmbeddingVectorSchema = z20.array(z20.number().finite()).min(1).max(32768);
225849
- var DocumentSchema = z20.object({
225850
- id: z20.string().min(1).max(4096),
225851
- text: z20.string().max(2e6),
225893
+ var EmbeddingVectorSchema = z21.array(z21.number().finite()).min(1).max(32768);
225894
+ var DocumentSchema = z21.object({
225895
+ id: z21.string().min(1).max(4096),
225896
+ text: z21.string().max(2e6),
225852
225897
  vector: EmbeddingVectorSchema.optional(),
225853
- metadata: z20.object({
225854
- filePath: z20.string().min(1).max(4096),
225855
- symbolName: z20.string().max(4096).optional(),
225856
- symbolType: z20.string().max(256).optional(),
225857
- startLine: z20.number().int().positive(),
225858
- endLine: z20.number().int().positive()
225898
+ metadata: z21.object({
225899
+ filePath: z21.string().min(1).max(4096),
225900
+ symbolName: z21.string().max(4096).optional(),
225901
+ symbolType: z21.string().max(256).optional(),
225902
+ startLine: z21.number().int().positive(),
225903
+ endLine: z21.number().int().positive()
225859
225904
  })
225860
225905
  });
225861
- var DBHeaderSchema = z20.object({
225862
- modelName: z20.string().min(1).max(1024),
225863
- dimension: z20.number().int().positive().max(32768),
225864
- updatedAt: z20.string().min(1)
225906
+ var DBHeaderSchema = z21.object({
225907
+ modelName: z21.string().min(1).max(1024),
225908
+ dimension: z21.number().int().positive().max(32768),
225909
+ updatedAt: z21.string().min(1)
225865
225910
  });
225866
- var VectorStoreFileSchema = z20.object({
225911
+ var VectorStoreFileSchema = z21.object({
225867
225912
  header: DBHeaderSchema.nullable(),
225868
- documents: z20.array(DocumentSchema)
225913
+ documents: z21.array(DocumentSchema)
225869
225914
  });
225870
- var LegacyVectorStoreFileSchema = z20.array(DocumentSchema);
225915
+ var LegacyVectorStoreFileSchema = z21.array(DocumentSchema);
225871
225916
  var JSVectorStore = class {
225872
225917
  constructor(cwd, modelName) {
225873
225918
  this.cwd = cwd;
@@ -225886,7 +225931,7 @@ var JSVectorStore = class {
225886
225931
  if (!this.loaded) {
225887
225932
  await this.load();
225888
225933
  }
225889
- const validatedDocs = z20.array(DocumentSchema).parse(docs);
225934
+ const validatedDocs = z21.array(DocumentSchema).parse(docs);
225890
225935
  const vectorDimensions = new Set(
225891
225936
  validatedDocs.flatMap(
225892
225937
  (doc) => doc.vector === void 0 ? [] : [doc.vector.length]
@@ -227852,7 +227897,7 @@ function lD(e2) {
227852
227897
  function v(e2, u) {
227853
227898
  e2.isTTY && e2.setRawMode(u);
227854
227899
  }
227855
- var z21 = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
227900
+ var z25 = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
227856
227901
  var xD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
227857
227902
  var x = class {
227858
227903
  constructor({ render: u, input: F = $2, output: t = k, ...s }, C2 = true) {
@@ -227887,7 +227932,7 @@ var x = class {
227887
227932
  this.subscribers.clear();
227888
227933
  }
227889
227934
  onKeypress(u, F) {
227890
- if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z21.has(F.name) && this.emit("cursor", z21.get(F.name)), F?.name && xD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
227935
+ if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z25.has(F.name) && this.emit("cursor", z25.get(F.name)), F?.name && xD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
227891
227936
  if (this.opts.validate) {
227892
227937
  const t = this.opts.validate(this.value);
227893
227938
  t && (this.error = t, this.state = "error", this.rl.write(this.value));
@@ -228098,7 +228143,7 @@ var M2 = o("\u25FB", "[ ]");
228098
228143
  var U2 = o("\u25AA", "\u2022");
228099
228144
  var B = o("\u2500", "-");
228100
228145
  var Z2 = o("\u256E", "+");
228101
- var z25 = o("\u251C", "+");
228146
+ var z26 = o("\u251C", "+");
228102
228147
  var X2 = o("\u256F", "+");
228103
228148
  var J2 = o("\u25CF", "\u2022");
228104
228149
  var Y2 = o("\u25C6", "*");
@@ -228961,35 +229006,35 @@ import { promisify } from "util";
228961
229006
  // ../mcp/dist/index.js
228962
229007
  import { spawn } from "child_process";
228963
229008
  import { createHash as createHash5 } from "crypto";
228964
- import { z as z26 } from "zod";
229009
+ import { z as z27 } from "zod";
228965
229010
  import { randomUUID as randomUUID4 } from "crypto";
228966
229011
  var MCP_REQUEST_TIMEOUT_MS = 3e4;
228967
229012
  var MCP_STDIO_LINE_LIMIT_BYTES = 8 * 1024 * 1024;
228968
229013
  var MCP_STDERR_LIMIT_CHARS = 4e3;
228969
- var MCPToolDefinitionSchema = z26.object({
228970
- name: z26.string().min(1).max(512),
228971
- description: z26.string().max(1e4).default(""),
228972
- inputSchema: z26.record(z26.unknown()).default({})
229014
+ var MCPToolDefinitionSchema = z27.object({
229015
+ name: z27.string().min(1).max(512),
229016
+ description: z27.string().max(1e4).default(""),
229017
+ inputSchema: z27.record(z27.unknown()).default({})
228973
229018
  });
228974
- var MCPToolsListSchema = z26.object({
228975
- tools: z26.array(MCPToolDefinitionSchema).max(1e4).default([])
229019
+ var MCPToolsListSchema = z27.object({
229020
+ tools: z27.array(MCPToolDefinitionSchema).max(1e4).default([])
228976
229021
  });
228977
- var MCPToolCallResultSchema = z26.object({
228978
- content: z26.array(
228979
- z26.object({
228980
- type: z26.string().max(100),
228981
- text: z26.string().max(MCP_STDIO_LINE_LIMIT_BYTES).optional()
229022
+ var MCPToolCallResultSchema = z27.object({
229023
+ content: z27.array(
229024
+ z27.object({
229025
+ type: z27.string().max(100),
229026
+ text: z27.string().max(MCP_STDIO_LINE_LIMIT_BYTES).optional()
228982
229027
  }).passthrough()
228983
229028
  ).max(1e4).default([]),
228984
- isError: z26.boolean().default(false)
229029
+ isError: z27.boolean().default(false)
228985
229030
  }).passthrough();
228986
- var MCPResponseSchema = z26.object({
228987
- jsonrpc: z26.literal("2.0"),
228988
- id: z26.number().int().positive(),
228989
- result: z26.unknown().optional(),
228990
- error: z26.object({
228991
- code: z26.number().int(),
228992
- message: z26.string().max(1e4)
229031
+ var MCPResponseSchema = z27.object({
229032
+ jsonrpc: z27.literal("2.0"),
229033
+ id: z27.number().int().positive(),
229034
+ result: z27.unknown().optional(),
229035
+ error: z27.object({
229036
+ code: z27.number().int(),
229037
+ message: z27.string().max(1e4)
228993
229038
  }).passthrough().optional()
228994
229039
  }).refine((message) => message.result !== void 0 || message.error, {
228995
229040
  message: "MCP response requires a result or error."
@@ -229272,7 +229317,7 @@ var DynamicMCPTool = class {
229272
229317
  client;
229273
229318
  name;
229274
229319
  description;
229275
- inputSchema = z26.record(z26.unknown());
229320
+ inputSchema = z27.record(z27.unknown());
229276
229321
  inputJsonSchema;
229277
229322
  risk;
229278
229323
  originalToolName;
@@ -229795,7 +229840,7 @@ function firstString(...values) {
229795
229840
  }
229796
229841
 
229797
229842
  // ../session/dist/index.js
229798
- import { z as z27 } from "zod";
229843
+ import { z as z28 } from "zod";
229799
229844
  import { createHash as createHash6, randomUUID as randomUUID5 } from "crypto";
229800
229845
  import { dirname as dirname6, isAbsolute as isAbsolute4, join as join12, relative as relative3, resolve as resolve6, sep } from "path";
229801
229846
  import {
@@ -229805,7 +229850,7 @@ import {
229805
229850
  copyFileSync as copyFileSync2,
229806
229851
  existsSync as existsSync12,
229807
229852
  fsyncSync,
229808
- lstatSync as lstatSync3,
229853
+ lstatSync as lstatSync4,
229809
229854
  mkdirSync as mkdirSync8,
229810
229855
  openSync,
229811
229856
  readFileSync as readFileSync15,
@@ -229829,89 +229874,89 @@ import {
229829
229874
  } from "fs";
229830
229875
  import { homedir as homedir5 } from "os";
229831
229876
  import { basename as basename4, isAbsolute as isAbsolute22, join as join25, parse as parse2, resolve as resolve24 } from "path";
229832
- import { z as z28 } from "zod";
229833
- var SafeObjectKeySchema = z27.string().refine(
229877
+ import { z as z29 } from "zod";
229878
+ var SafeObjectKeySchema = z28.string().refine(
229834
229879
  (key) => !["__proto__", "constructor", "prototype"].includes(key),
229835
229880
  "Unsafe object key."
229836
229881
  );
229837
- var JsonValueSchema = z27.lazy(
229838
- () => z27.union([
229839
- z27.string(),
229840
- z27.number().finite(),
229841
- z27.boolean(),
229842
- z27.null(),
229843
- z27.array(JsonValueSchema),
229844
- z27.record(SafeObjectKeySchema, JsonValueSchema)
229882
+ var JsonValueSchema = z28.lazy(
229883
+ () => z28.union([
229884
+ z28.string(),
229885
+ z28.number().finite(),
229886
+ z28.boolean(),
229887
+ z28.null(),
229888
+ z28.array(JsonValueSchema),
229889
+ z28.record(SafeObjectKeySchema, JsonValueSchema)
229845
229890
  ])
229846
229891
  );
229847
- var JsonTextSchema = z27.string().superRefine((value, context) => {
229892
+ var JsonTextSchema = z28.string().superRefine((value, context) => {
229848
229893
  try {
229849
229894
  const parsed = JSON.parse(value);
229850
229895
  if (JsonValueSchema.safeParse(parsed).success) return;
229851
229896
  } catch {
229852
229897
  }
229853
229898
  context.addIssue({
229854
- code: z27.ZodIssueCode.custom,
229899
+ code: z28.ZodIssueCode.custom,
229855
229900
  message: "Expected valid, safe JSON text."
229856
229901
  });
229857
229902
  });
229858
- var SessionIdSchema = z27.string().regex(/^sess_[a-z]+-[a-z]+-\d{3}$/, "Invalid Orbit session id.");
229859
- var SessionSchema = z27.object({
229860
- schemaVersion: z27.literal(1).default(1),
229903
+ var SessionIdSchema = z28.string().regex(/^sess_[a-z]+-[a-z]+-\d{3}$/, "Invalid Orbit session id.");
229904
+ var SessionSchema = z28.object({
229905
+ schemaVersion: z28.literal(1).default(1),
229861
229906
  id: SessionIdSchema,
229862
- cwd: z27.string().min(1),
229863
- title: z27.string(),
229864
- goal: z27.string().trim().min(1).max(4e3).optional(),
229865
- status: z27.enum(["active", "completed", "failed", "aborted"]),
229866
- createdAt: z27.string().datetime(),
229867
- updatedAt: z27.string().datetime(),
229868
- provider: z27.string().min(1),
229869
- model: z27.string().min(1),
229870
- totalInputTokens: z27.number().int().nonnegative(),
229871
- totalOutputTokens: z27.number().int().nonnegative(),
229872
- totalCostEstimate: z27.number().finite().nonnegative(),
229873
- totalCacheReadTokens: z27.number().int().nonnegative().optional(),
229874
- archivedAt: z27.string().datetime().optional()
229907
+ cwd: z28.string().min(1),
229908
+ title: z28.string(),
229909
+ goal: z28.string().trim().min(1).max(4e3).optional(),
229910
+ status: z28.enum(["active", "completed", "failed", "aborted"]),
229911
+ createdAt: z28.string().datetime(),
229912
+ updatedAt: z28.string().datetime(),
229913
+ provider: z28.string().min(1),
229914
+ model: z28.string().min(1),
229915
+ totalInputTokens: z28.number().int().nonnegative(),
229916
+ totalOutputTokens: z28.number().int().nonnegative(),
229917
+ totalCostEstimate: z28.number().finite().nonnegative(),
229918
+ totalCacheReadTokens: z28.number().int().nonnegative().optional(),
229919
+ archivedAt: z28.string().datetime().optional()
229875
229920
  });
229876
- var SessionEventSchema = z27.object({
229877
- id: z27.string().min(1),
229921
+ var SessionEventSchema = z28.object({
229922
+ id: z28.string().min(1),
229878
229923
  sessionId: SessionIdSchema,
229879
- type: z27.string().min(1),
229924
+ type: z28.string().min(1),
229880
229925
  payload: JsonValueSchema,
229881
- createdAt: z27.string().datetime()
229926
+ createdAt: z28.string().datetime()
229882
229927
  });
229883
- var TaskPlanItemSchema = z27.object({
229884
- id: z27.string().regex(/^step_[a-z0-9-]+$/, "Invalid task-plan item id."),
229885
- text: z27.string().trim().min(1).max(1e3),
229886
- status: z27.enum(["pending", "in_progress", "completed"]),
229887
- createdAt: z27.string().datetime(),
229888
- updatedAt: z27.string().datetime()
229928
+ var TaskPlanItemSchema = z28.object({
229929
+ id: z28.string().regex(/^step_[a-z0-9-]+$/, "Invalid task-plan item id."),
229930
+ text: z28.string().trim().min(1).max(1e3),
229931
+ status: z28.enum(["pending", "in_progress", "completed"]),
229932
+ createdAt: z28.string().datetime(),
229933
+ updatedAt: z28.string().datetime()
229889
229934
  });
229890
- var TaskPlanSchema = z27.object({
229891
- schemaVersion: z27.literal(1).default(1),
229935
+ var TaskPlanSchema = z28.object({
229936
+ schemaVersion: z28.literal(1).default(1),
229892
229937
  sessionId: SessionIdSchema,
229893
- goal: z27.string().trim().min(1).max(4e3).optional(),
229894
- items: z27.array(TaskPlanItemSchema).max(100),
229895
- updatedAt: z27.string().datetime()
229938
+ goal: z28.string().trim().min(1).max(4e3).optional(),
229939
+ items: z28.array(TaskPlanItemSchema).max(100),
229940
+ updatedAt: z28.string().datetime()
229896
229941
  });
229897
- var SessionMetricsSchema = z27.object({
229942
+ var SessionMetricsSchema = z28.object({
229898
229943
  sessionId: SessionIdSchema,
229899
- eventCount: z27.number().int().nonnegative(),
229900
- toolRuns: z27.number().int().nonnegative(),
229901
- toolFailures: z27.number().int().nonnegative(),
229902
- deniedTools: z27.number().int().nonnegative(),
229903
- filesChanged: z27.number().int().nonnegative(),
229904
- modelSwitches: z27.number().int().nonnegative(),
229905
- routingDecisions: z27.number().int().nonnegative(),
229906
- fastRoutes: z27.number().int().nonnegative(),
229907
- qualityRoutes: z27.number().int().nonnegative(),
229908
- compactions: z27.number().int().nonnegative(),
229909
- resumedCount: z27.number().int().nonnegative()
229944
+ eventCount: z28.number().int().nonnegative(),
229945
+ toolRuns: z28.number().int().nonnegative(),
229946
+ toolFailures: z28.number().int().nonnegative(),
229947
+ deniedTools: z28.number().int().nonnegative(),
229948
+ filesChanged: z28.number().int().nonnegative(),
229949
+ modelSwitches: z28.number().int().nonnegative(),
229950
+ routingDecisions: z28.number().int().nonnegative(),
229951
+ fastRoutes: z28.number().int().nonnegative(),
229952
+ qualityRoutes: z28.number().int().nonnegative(),
229953
+ compactions: z28.number().int().nonnegative(),
229954
+ resumedCount: z28.number().int().nonnegative()
229910
229955
  });
229911
- var RunJournalSchema = z27.object({
229912
- schemaVersion: z27.literal(1).default(1),
229956
+ var RunJournalSchema = z28.object({
229957
+ schemaVersion: z28.literal(1).default(1),
229913
229958
  sessionId: SessionIdSchema,
229914
- state: z27.enum([
229959
+ state: z28.enum([
229915
229960
  "running",
229916
229961
  "awaiting_approval",
229917
229962
  "verifying",
@@ -229920,99 +229965,99 @@ var RunJournalSchema = z27.object({
229920
229965
  "aborted",
229921
229966
  "interrupted"
229922
229967
  ]),
229923
- phase: z27.string().trim().min(1).max(200),
229924
- attempt: z27.number().int().nonnegative().default(0),
229925
- activeToolCallId: z27.string().min(1).max(512).optional(),
229926
- startedAt: z27.string().datetime(),
229927
- updatedAt: z27.string().datetime(),
229928
- recoveryCount: z27.number().int().nonnegative().default(0)
229968
+ phase: z28.string().trim().min(1).max(200),
229969
+ attempt: z28.number().int().nonnegative().default(0),
229970
+ activeToolCallId: z28.string().min(1).max(512).optional(),
229971
+ startedAt: z28.string().datetime(),
229972
+ updatedAt: z28.string().datetime(),
229973
+ recoveryCount: z28.number().int().nonnegative().default(0)
229929
229974
  });
229930
- var SessionRecoveryReportSchema = z27.object({
229975
+ var SessionRecoveryReportSchema = z28.object({
229931
229976
  sessionId: SessionIdSchema,
229932
229977
  previousState: RunJournalSchema.shape.state,
229933
- previousPhase: z27.string().trim().min(1).max(200),
229934
- attempt: z27.number().int().nonnegative(),
229935
- recoveryCount: z27.number().int().positive(),
229936
- repairedToolCalls: z27.number().int().nonnegative(),
229937
- resetPlanItems: z27.number().int().nonnegative(),
229938
- recoveredAt: z27.string().datetime()
229978
+ previousPhase: z28.string().trim().min(1).max(200),
229979
+ attempt: z28.number().int().nonnegative(),
229980
+ recoveryCount: z28.number().int().positive(),
229981
+ repairedToolCalls: z28.number().int().nonnegative(),
229982
+ resetPlanItems: z28.number().int().nonnegative(),
229983
+ recoveredAt: z28.string().datetime()
229939
229984
  });
229940
- var StoredToolCallSchema = z27.object({
229941
- id: z27.string().min(1),
229942
- name: z27.string().min(1),
229985
+ var StoredToolCallSchema = z28.object({
229986
+ id: z28.string().min(1),
229987
+ name: z28.string().min(1),
229943
229988
  arguments: JsonTextSchema
229944
229989
  });
229945
- var StoredToolResultSchema = z27.object({
229946
- toolCallId: z27.string().min(1),
229947
- name: z27.string().min(1),
229948
- content: z27.string(),
229949
- isError: z27.boolean().optional()
229990
+ var StoredToolResultSchema = z28.object({
229991
+ toolCallId: z28.string().min(1),
229992
+ name: z28.string().min(1),
229993
+ content: z28.string(),
229994
+ isError: z28.boolean().optional()
229950
229995
  });
229951
- var StoredContentBlockSchema = z27.discriminatedUnion("type", [
229952
- z27.object({ type: z27.literal("text"), text: z27.string() }),
229953
- z27.object({
229954
- type: z27.literal("image"),
229955
- mediaType: z27.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
229956
- data: z27.string().max(8e6),
229957
- name: z27.string().max(255).optional()
229996
+ var StoredContentBlockSchema = z28.discriminatedUnion("type", [
229997
+ z28.object({ type: z28.literal("text"), text: z28.string() }),
229998
+ z28.object({
229999
+ type: z28.literal("image"),
230000
+ mediaType: z28.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
230001
+ data: z28.string().max(8e6),
230002
+ name: z28.string().max(255).optional()
229958
230003
  }),
229959
- z27.object({ type: z27.literal("tool_call"), toolCall: StoredToolCallSchema }),
229960
- z27.object({
229961
- type: z27.literal("tool_result"),
230004
+ z28.object({ type: z28.literal("tool_call"), toolCall: StoredToolCallSchema }),
230005
+ z28.object({
230006
+ type: z28.literal("tool_result"),
229962
230007
  toolResult: StoredToolResultSchema
229963
230008
  }),
229964
- z27.object({
229965
- type: z27.literal("thinking"),
229966
- text: z27.string(),
229967
- signature: z27.string().optional()
230009
+ z28.object({
230010
+ type: z28.literal("thinking"),
230011
+ text: z28.string(),
230012
+ signature: z28.string().optional()
229968
230013
  })
229969
230014
  ]);
229970
- var StoredHistoryMessageSchema = z27.object({
229971
- id: z27.string().min(1),
229972
- role: z27.enum(["system", "user", "assistant", "tool"]),
229973
- content: z27.array(StoredContentBlockSchema),
229974
- createdAt: z27.string().datetime(),
229975
- metadata: z27.record(SafeObjectKeySchema, JsonValueSchema).optional()
230015
+ var StoredHistoryMessageSchema = z28.object({
230016
+ id: z28.string().min(1),
230017
+ role: z28.enum(["system", "user", "assistant", "tool"]),
230018
+ content: z28.array(StoredContentBlockSchema),
230019
+ createdAt: z28.string().datetime(),
230020
+ metadata: z28.record(SafeObjectKeySchema, JsonValueSchema).optional()
229976
230021
  });
229977
- var StoredHistorySchema = z27.array(StoredHistoryMessageSchema);
229978
- var ToolCallRecordSchema = z27.object({
229979
- id: z27.string().min(1),
230022
+ var StoredHistorySchema = z28.array(StoredHistoryMessageSchema);
230023
+ var ToolCallRecordSchema = z28.object({
230024
+ id: z28.string().min(1),
229980
230025
  sessionId: SessionIdSchema,
229981
- toolName: z27.string().min(1),
230026
+ toolName: z28.string().min(1),
229982
230027
  inputJson: JsonTextSchema,
229983
230028
  outputJson: JsonTextSchema.optional(),
229984
- risk: z27.string().min(1),
229985
- permissionDecision: z27.string().min(1),
229986
- status: z27.enum(["pending", "success", "failed", "denied"]),
229987
- startedAt: z27.string().datetime(),
229988
- endedAt: z27.string().datetime().optional()
230029
+ risk: z28.string().min(1),
230030
+ permissionDecision: z28.string().min(1),
230031
+ status: z28.enum(["pending", "success", "failed", "denied"]),
230032
+ startedAt: z28.string().datetime(),
230033
+ endedAt: z28.string().datetime().optional()
229989
230034
  });
229990
- var FileChangeRecordSchema = z27.object({
229991
- id: z27.string().min(1),
230035
+ var FileChangeRecordSchema = z28.object({
230036
+ id: z28.string().min(1),
229992
230037
  sessionId: SessionIdSchema,
229993
- path: z27.string().min(1),
229994
- beforeHash: z27.string().optional(),
229995
- afterHash: z27.string().optional(),
229996
- diff: z27.string(),
229997
- createdAt: z27.string().datetime()
230038
+ path: z28.string().min(1),
230039
+ beforeHash: z28.string().optional(),
230040
+ afterHash: z28.string().optional(),
230041
+ diff: z28.string(),
230042
+ createdAt: z28.string().datetime()
229998
230043
  });
229999
- var SessionTraceBundleSchema = z27.object({
230000
- schemaVersion: z27.literal(1),
230001
- exportedAt: z27.string().datetime(),
230002
- workspace: z27.object({
230003
- id: z27.string().regex(/^[a-f0-9]{16}$/),
230004
- path: z27.literal("<workspace>")
230044
+ var SessionTraceBundleSchema = z28.object({
230045
+ schemaVersion: z28.literal(1),
230046
+ exportedAt: z28.string().datetime(),
230047
+ workspace: z28.object({
230048
+ id: z28.string().regex(/^[a-f0-9]{16}$/),
230049
+ path: z28.literal("<workspace>")
230005
230050
  }),
230006
230051
  session: SessionSchema.omit({ cwd: true }).extend({
230007
- cwd: z27.literal("<workspace>")
230052
+ cwd: z28.literal("<workspace>")
230008
230053
  }),
230009
230054
  journal: RunJournalSchema.optional(),
230010
230055
  plan: TaskPlanSchema.optional(),
230011
230056
  metrics: SessionMetricsSchema,
230012
- events: z27.array(SessionEventSchema),
230013
- toolCalls: z27.array(ToolCallRecordSchema),
230014
- fileChanges: z27.array(FileChangeRecordSchema),
230015
- history: z27.array(JsonValueSchema).optional()
230057
+ events: z28.array(SessionEventSchema),
230058
+ toolCalls: z28.array(ToolCallRecordSchema),
230059
+ fileChanges: z28.array(FileChangeRecordSchema),
230060
+ history: z28.array(JsonValueSchema).optional()
230016
230061
  });
230017
230062
  var CREDENTIAL_ASSIGNMENT_PATTERN = /(\b(?:api[-_]?key|authorization|credentials?|password|passwd|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|bearer[-_]?token|session[-_]?token|client[-_]?secret|private[-_]?key|cookie)\b\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;}]*)/gi;
230018
230063
  var SENSITIVE_KEY_PATTERN2 = /(?:^|_)(?:api_key|authorization|credentials?|password|passwd|secret|access_token|refresh_token|auth_token|bearer_token|session_token|client_secret|private_key|cookie)(?:$|_)/;
@@ -230654,7 +230699,7 @@ var SessionStore = class {
230654
230699
  throw new Error("Orbit session root cannot be the workspace root.");
230655
230700
  }
230656
230701
  if (existsSync12(sessionRoot)) {
230657
- const rootStats = lstatSync3(sessionRoot);
230702
+ const rootStats = lstatSync4(sessionRoot);
230658
230703
  if (rootStats.isSymbolicLink() || !rootStats.isDirectory()) {
230659
230704
  throw new Error("Orbit session root must be a real directory.");
230660
230705
  }
@@ -230670,7 +230715,7 @@ var SessionStore = class {
230670
230715
  throw new Error(`Invalid session directory: ${id}`);
230671
230716
  }
230672
230717
  if (existsSync12(resolved)) {
230673
- const stats = lstatSync3(resolved);
230718
+ const stats = lstatSync4(resolved);
230674
230719
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
230675
230720
  throw new Error(`Invalid session directory: ${id}`);
230676
230721
  }
@@ -230939,21 +230984,21 @@ var SessionManager = class {
230939
230984
  var PRIVATE_DIRECTORY_MODE2 = 448;
230940
230985
  var PRIVATE_FILE_MODE2 = 384;
230941
230986
  var MAX_PROJECTS = 200;
230942
- var ProjectRecordSchema = z28.object({
230943
- id: z28.string().regex(/^proj_[a-f0-9]{16}$/),
230944
- path: z28.string().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value)),
230945
- name: z28.string().trim().min(1).max(200),
230946
- createdAt: z28.string().datetime(),
230947
- lastOpenedAt: z28.string().datetime(),
230948
- lastSessionId: z28.string().min(1).optional(),
230949
- archivedAt: z28.string().datetime().optional()
230987
+ var ProjectRecordSchema = z29.object({
230988
+ id: z29.string().regex(/^proj_[a-f0-9]{16}$/),
230989
+ path: z29.string().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value)),
230990
+ name: z29.string().trim().min(1).max(200),
230991
+ createdAt: z29.string().datetime(),
230992
+ lastOpenedAt: z29.string().datetime(),
230993
+ lastSessionId: z29.string().min(1).optional(),
230994
+ archivedAt: z29.string().datetime().optional()
230950
230995
  });
230951
- var ProjectRegistrySnapshotSchema = z28.object({
230952
- schemaVersion: z28.literal(1),
230953
- projects: z28.array(ProjectRecordSchema).max(MAX_PROJECTS)
230996
+ var ProjectRegistrySnapshotSchema = z29.object({
230997
+ schemaVersion: z29.literal(1),
230998
+ projects: z29.array(ProjectRecordSchema).max(MAX_PROJECTS)
230954
230999
  });
230955
- var LegacyProjectRegistrySnapshotSchema = z28.object({
230956
- projects: z28.array(ProjectRecordSchema).max(MAX_PROJECTS)
231000
+ var LegacyProjectRegistrySnapshotSchema = z29.object({
231001
+ projects: z29.array(ProjectRecordSchema).max(MAX_PROJECTS)
230957
231002
  });
230958
231003
  function parseProjectRegistrySnapshot(value) {
230959
231004
  const current = ProjectRegistrySnapshotSchema.safeParse(value);
@@ -231117,7 +231162,7 @@ import {
231117
231162
  chmodSync as chmodSync4,
231118
231163
  copyFileSync as copyFileSync3,
231119
231164
  existsSync as existsSync27,
231120
- lstatSync as lstatSync4,
231165
+ lstatSync as lstatSync5,
231121
231166
  mkdirSync as mkdirSync23,
231122
231167
  readFileSync as readFileSync26,
231123
231168
  renameSync as renameSync23,
@@ -231306,20 +231351,20 @@ ${this.normalizeContextText(options.repoMapText)}` : "",
231306
231351
  );
231307
231352
  }
231308
231353
  };
231309
- var PromptCacheTelemetrySampleSchema = z29.object({
231310
- recordedAt: z29.string(),
231311
- inputTokens: z29.number().int().nonnegative(),
231312
- hitTokens: z29.number().int().nonnegative(),
231313
- missTokens: z29.number().int().nonnegative(),
231314
- hitRate: z29.number().min(0).max(1),
231315
- degraded: z29.boolean()
231354
+ var PromptCacheTelemetrySampleSchema = z30.object({
231355
+ recordedAt: z30.string(),
231356
+ inputTokens: z30.number().int().nonnegative(),
231357
+ hitTokens: z30.number().int().nonnegative(),
231358
+ missTokens: z30.number().int().nonnegative(),
231359
+ hitRate: z30.number().min(0).max(1),
231360
+ degraded: z30.boolean()
231316
231361
  });
231317
- var PromptCacheSlabMetadataSchema = z29.object({
231318
- hash: z29.string().optional(),
231319
- model: z29.string().optional(),
231320
- tokenEstimate: z29.number().int().nonnegative().optional(),
231321
- lastPrimedAt: z29.string().optional(),
231322
- telemetry: z29.array(PromptCacheTelemetrySampleSchema).max(100).optional()
231362
+ var PromptCacheSlabMetadataSchema = z30.object({
231363
+ hash: z30.string().optional(),
231364
+ model: z30.string().optional(),
231365
+ tokenEstimate: z30.number().int().nonnegative().optional(),
231366
+ lastPrimedAt: z30.string().optional(),
231367
+ telemetry: z30.array(PromptCacheTelemetrySampleSchema).max(100).optional()
231323
231368
  }).passthrough();
231324
231369
  var PromptCacheSlabBuilder = class {
231325
231370
  static build(input) {
@@ -232703,7 +232748,7 @@ var ProjectMemoryStore = class {
232703
232748
  const validated = ProjectMemorySchema.parse(value);
232704
232749
  const directory = dirname23(this.memoryPath);
232705
232750
  if (existsSync27(directory)) {
232706
- const stats = lstatSync4(directory);
232751
+ const stats = lstatSync5(directory);
232707
232752
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
232708
232753
  throw new Error("Orbit memory directory must be a real directory.");
232709
232754
  }
@@ -232732,7 +232777,7 @@ var ProjectMemoryStore = class {
232732
232777
  }
232733
232778
  assertSafeFile(filePath) {
232734
232779
  if (!existsSync27(filePath)) return;
232735
- const stats = lstatSync4(filePath);
232780
+ const stats = lstatSync5(filePath);
232736
232781
  if (stats.isSymbolicLink() || !stats.isFile()) {
232737
232782
  throw new Error("Orbit project memory must be a real file.");
232738
232783
  }
@@ -237428,9 +237473,10 @@ function buildSlashCommandHelp(isZh) {
237428
237473
  }
237429
237474
 
237430
237475
  // src/tui/TerminalText.ts
237431
- 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";
237432
237478
  function stripAnsiCodes(str) {
237433
- return str.replace(ANSI_PATTERN, "");
237479
+ return str.replace(TERMINAL_CONTROL_PATTERN, "");
237434
237480
  }
237435
237481
  function isFullWidth(codePoint) {
237436
237482
  if (Number.isNaN(codePoint)) return false;
@@ -237473,19 +237519,22 @@ function wrapAnsiLine(line, maxWidth) {
237473
237519
  let currentLine = "";
237474
237520
  let currentWidth = 0;
237475
237521
  let activeColor = "";
237522
+ let activeHyperlink = "";
237476
237523
  let index = 0;
237477
237524
  while (index < line.length) {
237478
- ANSI_PATTERN.lastIndex = index;
237479
- const match = ANSI_PATTERN.exec(line);
237525
+ TERMINAL_CONTROL_PATTERN.lastIndex = index;
237526
+ const match = TERMINAL_CONTROL_PATTERN.exec(line);
237480
237527
  if (match?.index === index) {
237481
- const ansiCode = match[0];
237482
- currentLine += ansiCode;
237483
- if (ansiCode.includes("m") && !ansiCode.includes("[0m")) {
237484
- activeColor = ansiCode;
237485
- } 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")) {
237486
237535
  activeColor = "";
237487
237536
  }
237488
- index += ansiCode.length;
237537
+ index += controlSequence.length;
237489
237538
  continue;
237490
237539
  }
237491
237540
  const code = line.codePointAt(index) ?? 0;
@@ -237494,8 +237543,9 @@ function wrapAnsiLine(line, maxWidth) {
237494
237543
  const charWidth = isFullWidth(code) ? 2 : 1;
237495
237544
  if (currentWidth + charWidth > maxWidth) {
237496
237545
  if (activeColor) currentLine += "\x1B[0m";
237546
+ if (activeHyperlink) currentLine += HYPERLINK_CLOSE;
237497
237547
  lines.push(currentLine);
237498
- currentLine = activeColor + char;
237548
+ currentLine = activeColor + activeHyperlink + char;
237499
237549
  currentWidth = charWidth;
237500
237550
  } else {
237501
237551
  currentLine += char;
@@ -237692,8 +237742,8 @@ function findPreviousHistoryEntry(history, query, startIndex = history.length) {
237692
237742
  import { dirname as dirname8, join as join14 } from "path";
237693
237743
  import { homedir as homedir6 } from "os";
237694
237744
  import { existsSync as existsSync14, mkdirSync as mkdirSync10, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
237695
- import { z as z30 } from "zod";
237696
- var inputHistorySchema = z30.array(z30.string());
237745
+ import { z as z31 } from "zod";
237746
+ var inputHistorySchema = z31.array(z31.string());
237697
237747
  var InputHistoryStore = class {
237698
237748
  constructor(filePath = join14(homedir6(), ".orbit", "input_history.json")) {
237699
237749
  this.filePath = filePath;
@@ -238256,13 +238306,13 @@ function renderPromptScreen(state, viewport, theme = MORANDI) {
238256
238306
 
238257
238307
  // src/runtime/UpdateManager.ts
238258
238308
  import { execFile as execFile4, execFileSync as execFileSync4 } from "child_process";
238259
- import { z as z31 } from "zod";
238260
- var SemanticVersionSchema = z31.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
238261
- var UpdateChannelSchema = z31.enum(["stable", "beta"]);
238262
- var UpdateCheckSchema = z31.object({
238309
+ import { z as z35 } from "zod";
238310
+ var SemanticVersionSchema = z35.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
238311
+ var UpdateChannelSchema = z35.enum(["stable", "beta"]);
238312
+ var UpdateCheckSchema = z35.object({
238263
238313
  currentVersion: SemanticVersionSchema,
238264
238314
  latestVersion: SemanticVersionSchema,
238265
- updateAvailable: z31.boolean()
238315
+ updateAvailable: z35.boolean()
238266
238316
  });
238267
238317
  var UpdateManager = class {
238268
238318
  executable;
@@ -238346,9 +238396,9 @@ var UpdateManager = class {
238346
238396
  ],
238347
238397
  { timeoutMs: this.timeoutMs, inheritOutput: false }
238348
238398
  );
238349
- const parsed = z31.object({
238350
- dependencies: z31.object({
238351
- "@orbit-build/cli": z31.object({ version: SemanticVersionSchema })
238399
+ const parsed = z35.object({
238400
+ dependencies: z35.object({
238401
+ "@orbit-build/cli": z35.object({ version: SemanticVersionSchema })
238352
238402
  })
238353
238403
  }).parse(JSON.parse(raw));
238354
238404
  return parsed.dependencies["@orbit-build/cli"].version;
@@ -238547,6 +238597,9 @@ async function pageText(text) {
238547
238597
 
238548
238598
  // src/tui/FullscreenTui.ts
238549
238599
  var INPUT_PREFIX_WIDTH = 12;
238600
+ function terminalHyperlink(label, url) {
238601
+ return `\x1B]8;;${url}\x07${label}\x1B]8;;\x07`;
238602
+ }
238550
238603
  var FullscreenTui = class {
238551
238604
  constructor(cwd, modelName, version, config, dependencies = {}) {
238552
238605
  this.cwd = cwd;
@@ -238703,7 +238756,7 @@ var FullscreenTui = class {
238703
238756
  this.inputHistory = this.inputHistoryStore.load();
238704
238757
  this.terminalInitialized = true;
238705
238758
  }
238706
- formatSystemStatusLine(rawLine, prefixUnknown) {
238759
+ formatSystemStatusLine(rawLine, prefixUnknown, actionLink) {
238707
238760
  const morandi2 = MORANDI;
238708
238761
  const plain = stripAnsiCodes(rawLine.trim()).trim();
238709
238762
  if (!plain) return "";
@@ -238711,7 +238764,11 @@ var FullscreenTui = class {
238711
238764
  return "";
238712
238765
  }
238713
238766
  if (plain.startsWith("\u2714")) {
238714
- 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));
238715
238772
  }
238716
238773
  if (plain.startsWith("\u2716")) {
238717
238774
  return morandi2.failed("failed") + morandi2.gray(plain.substring(1));
@@ -238753,6 +238810,7 @@ var FullscreenTui = class {
238753
238810
  lastLiveLookupQuery = "";
238754
238811
  };
238755
238812
  for (const sys of system) {
238813
+ let pendingActionLink = sys.actionLink;
238756
238814
  const rawLines = sys.text.split("\n");
238757
238815
  for (const rawLine of rawLines) {
238758
238816
  const plain = stripAnsiCodes(rawLine.trim()).trim();
@@ -238791,10 +238849,12 @@ var FullscreenTui = class {
238791
238849
  flushLiveLookupSummary();
238792
238850
  const formatted = this.formatSystemStatusLine(
238793
238851
  rawLine,
238794
- options.prefixUnknown
238852
+ options.prefixUnknown,
238853
+ pendingActionLink
238795
238854
  );
238796
238855
  if (formatted) {
238797
238856
  lines.push(formatted);
238857
+ pendingActionLink = void 0;
238798
238858
  }
238799
238859
  }
238800
238860
  }
@@ -238816,11 +238876,12 @@ var FullscreenTui = class {
238816
238876
  saveInputHistory() {
238817
238877
  this.inputHistoryStore.save(this.inputHistory);
238818
238878
  }
238819
- addSystemMessage(text, _raw = false) {
238879
+ addSystemMessage(text, _raw = false, actionLink) {
238820
238880
  if (!text) return;
238821
238881
  this.history.push({
238822
238882
  role: "system",
238823
- text
238883
+ text,
238884
+ actionLink
238824
238885
  });
238825
238886
  this.render();
238826
238887
  }
@@ -240628,7 +240689,7 @@ import { dirname as dirname10, resolve as resolve10 } from "path";
240628
240689
  import { homedir as homedir10 } from "os";
240629
240690
  import http2 from "http";
240630
240691
  import { randomBytes as randomBytes2, randomUUID as randomUUID9, timingSafeEqual as timingSafeEqual2 } from "crypto";
240631
- import { z as z47 } from "zod";
240692
+ import { z as z48 } from "zod";
240632
240693
 
240633
240694
  // src/runtime/CommandRouter.ts
240634
240695
  import picocolors18 from "picocolors";
@@ -240638,11 +240699,11 @@ import { existsSync as existsSync16, readFileSync as readFileSync19, readdirSync
240638
240699
  import { basename as basename5, extname as extname2, join as join16 } from "path";
240639
240700
  import { homedir as homedir8 } from "os";
240640
240701
  import { parse as parse3 } from "yaml";
240641
- import { z as z35 } from "zod";
240642
- var CommandMetadataSchema = z35.object({
240643
- description: z35.string().max(240).optional(),
240644
- argumentHint: z35.string().max(120).optional(),
240645
- "argument-hint": z35.string().max(120).optional()
240702
+ import { z as z36 } from "zod";
240703
+ var CommandMetadataSchema = z36.object({
240704
+ description: z36.string().max(240).optional(),
240705
+ argumentHint: z36.string().max(120).optional(),
240706
+ "argument-hint": z36.string().max(120).optional()
240646
240707
  });
240647
240708
  var VALID_COMMAND_NAME = /^[a-z0-9][a-z0-9-_]{0,47}$/i;
240648
240709
  var MAX_COMMAND_FILE_BYTES = 256 * 1024;
@@ -240782,26 +240843,23 @@ ${args}`;
240782
240843
  // src/runtime/CommandRouter.ts
240783
240844
  import { createRequire as createRequire2 } from "module";
240784
240845
 
240785
- // src/runtime/webui/WebUiServer.ts
240786
- import { spawn as spawn2 } from "child_process";
240787
-
240788
240846
  // src/runtime/webui/WebUiRuntime.ts
240789
240847
  import http from "http";
240790
240848
  import { randomBytes, randomUUID as randomUUID7 } from "crypto";
240791
- import { z as z38 } from "zod";
240849
+ import { z as z39 } from "zod";
240792
240850
 
240793
240851
  // src/runtime/AutocompleteCandidates.ts
240794
240852
  import glob6 from "fast-glob";
240795
240853
  import { existsSync as existsSync17, readFileSync as readFileSync20, readdirSync as readdirSync7 } from "fs";
240796
240854
  import { homedir as homedir9 } from "os";
240797
240855
  import { dirname as dirname9, join as join17, resolve as resolve7 } from "path";
240798
- import { z as z36 } from "zod";
240799
- var symbolIndexSchema = z36.object({
240800
- files: z36.record(
240801
- z36.object({
240802
- symbols: z36.array(
240803
- z36.object({
240804
- name: z36.string().min(1)
240856
+ import { z as z37 } from "zod";
240857
+ var symbolIndexSchema = z37.object({
240858
+ files: z37.record(
240859
+ z37.object({
240860
+ symbols: z37.array(
240861
+ z37.object({
240862
+ name: z37.string().min(1)
240805
240863
  })
240806
240864
  ).optional()
240807
240865
  })
@@ -244996,7 +245054,7 @@ var WEB_UI_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4
244996
245054
 
244997
245055
  // src/runtime/webui/WebUiSecurity.ts
244998
245056
  import { timingSafeEqual } from "crypto";
244999
- import { z as z37 } from "zod";
245057
+ import { z as z38 } from "zod";
245000
245058
  function sanitizeWebEventPayload(type, payload) {
245001
245059
  if (!isRecord3(payload)) return void 0;
245002
245060
  switch (type) {
@@ -245189,7 +245247,7 @@ function sanitizeBaseUrl(value) {
245189
245247
  }
245190
245248
  }
245191
245249
  function webRequestErrorStatus(error) {
245192
- if (error instanceof z37.ZodError) return 400;
245250
+ if (error instanceof z38.ZodError) return 400;
245193
245251
  if (error instanceof Error && error.message === "Request body too large.") {
245194
245252
  return 413;
245195
245253
  }
@@ -246680,8 +246738,8 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
246680
246738
  }
246681
246739
 
246682
246740
  .empty-composer-slot .composer {
246683
- border-radius: 16px;
246684
- box-shadow: none;
246741
+ border-radius: 18px;
246742
+ box-shadow: 0 18px 46px rgba(25, 43, 39, 0.09), 0 3px 10px rgba(25, 43, 39, 0.04);
246685
246743
  }
246686
246744
 
246687
246745
  .empty-composer-slot .composer-dock::before {
@@ -246727,18 +246785,18 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
246727
246785
  .composer {
246728
246786
  position: relative;
246729
246787
  padding: 13px 13px 10px;
246730
- background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
246731
- border: 1px solid var(--border-strong);
246788
+ background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
246789
+ border: 1px solid color-mix(in srgb, var(--border-strong) 92%, transparent);
246732
246790
  border-radius: 18px;
246733
- box-shadow: none;
246734
- backdrop-filter: none;
246735
- transition: border-color 160ms ease, background 160ms ease;
246791
+ box-shadow: 0 12px 34px rgba(25, 43, 39, 0.075), 0 2px 6px rgba(25, 43, 39, 0.035);
246792
+ backdrop-filter: blur(18px) saturate(118%);
246793
+ transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
246736
246794
  }
246737
246795
 
246738
246796
  .composer:focus-within {
246739
- border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
246797
+ border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
246740
246798
  background: var(--surface-raised);
246741
- box-shadow: none;
246799
+ box-shadow: 0 18px 48px rgba(25, 43, 39, 0.11), 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
246742
246800
  }
246743
246801
 
246744
246802
  .slash-command-menu {
@@ -247126,7 +247184,7 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
247126
247184
 
247127
247185
  .app-shell.is-disconnected .composer {
247128
247186
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
247129
- box-shadow: none;
247187
+ box-shadow: 0 12px 34px rgba(25, 43, 39, 0.06);
247130
247188
  }
247131
247189
 
247132
247190
  .jump-bottom {
@@ -247728,8 +247786,12 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
247728
247786
  position: absolute;
247729
247787
  inset: 0;
247730
247788
  background:
247731
- radial-gradient(circle at 42% -16%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 34%),
247732
- radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--brand-coral) 2%, transparent), transparent 24%);
247789
+ radial-gradient(circle at 42% -16%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 36%),
247790
+ radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--brand-coral) 3%, transparent), transparent 26%),
247791
+ linear-gradient(color-mix(in srgb, var(--border) 18%, transparent) 1px, transparent 1px),
247792
+ linear-gradient(90deg, color-mix(in srgb, var(--border) 14%, transparent) 1px, transparent 1px);
247793
+ background-size: auto, auto, 48px 48px, 48px 48px;
247794
+ mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 48%);
247733
247795
  pointer-events: none;
247734
247796
  }
247735
247797
 
@@ -247761,7 +247823,7 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
247761
247823
  min-height: 100%;
247762
247824
  display: flex;
247763
247825
  flex-direction: column;
247764
- gap: 28px;
247826
+ gap: 30px;
247765
247827
  margin: 0 auto;
247766
247828
  padding: 34px 0 40px;
247767
247829
  }
@@ -247807,6 +247869,10 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
247807
247869
  min-width: 0;
247808
247870
  }
247809
247871
 
247872
+ .message.assistant .message-content {
247873
+ max-width: min(100%, 800px);
247874
+ }
247875
+
247810
247876
  .message-role {
247811
247877
  display: flex;
247812
247878
  align-items: center;
@@ -248435,7 +248501,7 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
248435
248501
  align-items: stretch;
248436
248502
  justify-content: flex-start;
248437
248503
  margin: 0 auto;
248438
- padding: clamp(76px, 12vh, 136px) 0 clamp(44px, 8vh, 86px);
248504
+ padding: clamp(72px, 11vh, 124px) 0 clamp(44px, 8vh, 86px);
248439
248505
  text-align: left;
248440
248506
  }
248441
248507
 
@@ -248472,8 +248538,8 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
248472
248538
  max-width: 720px;
248473
248539
  margin: 0;
248474
248540
  color: var(--ink-strong);
248475
- font-size: clamp(32px, 2.45vw, 44px);
248476
- font-weight: 670;
248541
+ font-size: clamp(34px, 2.65vw, 48px);
248542
+ font-weight: 690;
248477
248543
  letter-spacing: -0.035em;
248478
248544
  line-height: 1.16;
248479
248545
  }
@@ -248482,7 +248548,8 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
248482
248548
  max-width: 600px;
248483
248549
  margin: 10px 0 0;
248484
248550
  color: var(--muted);
248485
- font-size: 14px;
248551
+ font-size: 14.5px;
248552
+ line-height: 1.65;
248486
248553
  }
248487
248554
 
248488
248555
  .connection-help {
@@ -248569,17 +248636,17 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
248569
248636
 
248570
248637
  .suggestion-card {
248571
248638
  min-width: 0;
248572
- min-height: 66px;
248639
+ min-height: 62px;
248573
248640
  display: flex;
248574
248641
  align-items: center;
248575
248642
  gap: 11px;
248576
248643
  padding: 10px 13px;
248577
248644
  color: var(--ink);
248578
- background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
248645
+ background: color-mix(in srgb, var(--surface-raised) 72%, transparent);
248579
248646
  border: 1px solid var(--border);
248580
248647
  border-radius: 13px;
248581
248648
  text-align: left;
248582
- box-shadow: var(--shadow-sm);
248649
+ box-shadow: 0 1px 2px rgba(26, 43, 40, 0.035);
248583
248650
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
248584
248651
  }
248585
248652
 
@@ -248968,8 +249035,8 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
248968
249035
  var WEB_UI_FOUNDATION_STYLES = String.raw`
248969
249036
  :root {
248970
249037
  color-scheme: light;
248971
- --canvas: #f5f7f6;
248972
- --canvas-deep: #e9eeed;
249038
+ --canvas: #f7f8f6;
249039
+ --canvas-deep: #e7ece9;
248973
249040
  --sidebar: #edf1f0;
248974
249041
  --sidebar-ink: #202a2a;
248975
249042
  --sidebar-muted: #596765;
@@ -248977,21 +249044,21 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
248977
249044
  --sidebar-border: rgba(42, 61, 59, 0.12);
248978
249045
  --sidebar-surface: rgba(255, 255, 255, 0.68);
248979
249046
  --sidebar-active: rgba(255, 255, 255, 0.84);
248980
- --surface: #fafbf9;
249047
+ --surface: #fbfcfa;
248981
249048
  --surface-raised: #ffffff;
248982
249049
  --surface-subtle: #f0f3f1;
248983
249050
  --surface-hover: #e8edeb;
248984
249051
  --surface-glass: rgba(250, 252, 251, 0.88);
248985
- --ink: #343f3d;
248986
- --ink-strong: #182321;
248987
- --muted: #64716f;
249052
+ --ink: #303b38;
249053
+ --ink-strong: #14201d;
249054
+ --muted: #5f6c68;
248988
249055
  --faint: #87928f;
248989
249056
  --border: rgba(39, 57, 54, 0.1);
248990
249057
  --border-strong: rgba(39, 57, 54, 0.17);
248991
- --accent: #6e8d92;
248992
- --accent-strong: #456d74;
248993
- --accent-soft: #e2ecec;
248994
- --accent-glow: rgba(92, 133, 140, 0.15);
249058
+ --accent: #638c85;
249059
+ --accent-strong: #356b63;
249060
+ --accent-soft: #e0eeea;
249061
+ --accent-glow: rgba(72, 121, 111, 0.15);
248995
249062
  --brand-coral: #dd7069;
248996
249063
  --brand-coral-soft: #f7e4e1;
248997
249064
  --success: #4f815e;
@@ -249002,8 +249069,8 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
249002
249069
  --danger-soft: #f7e4e2;
249003
249070
  --code: #182027;
249004
249071
  --code-ink: #e7edf0;
249005
- --shadow-sm: 0 1px 2px rgba(26, 43, 40, 0.05), 0 1px 5px rgba(26, 43, 40, 0.025);
249006
- --shadow-md: 0 18px 52px rgba(26, 43, 40, 0.09), 0 3px 10px rgba(26, 43, 40, 0.04);
249072
+ --shadow-sm: 0 1px 2px rgba(26, 43, 40, 0.06), 0 3px 10px rgba(26, 43, 40, 0.035);
249073
+ --shadow-md: 0 20px 54px rgba(26, 43, 40, 0.1), 0 4px 12px rgba(26, 43, 40, 0.045);
249007
249074
  --shadow-lg: 0 30px 86px rgba(21, 34, 32, 0.15), 0 5px 18px rgba(21, 34, 32, 0.06);
249008
249075
  --sidebar-width: clamp(232px, 14vw, 258px);
249009
249076
  --content-width: 880px;
@@ -250734,10 +250801,11 @@ var WEB_UI_SHELL_STYLES = String.raw`
250734
250801
  height: 100dvh;
250735
250802
  display: grid;
250736
250803
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
250737
- gap: 8px;
250738
- padding: 8px 8px 8px 0;
250804
+ gap: 10px;
250805
+ padding: 10px 10px 10px 0;
250739
250806
  background:
250740
- radial-gradient(circle at 8% 4%, var(--accent-glow), transparent 28%),
250807
+ radial-gradient(circle at 6% 2%, var(--accent-glow), transparent 26%),
250808
+ linear-gradient(135deg, color-mix(in srgb, var(--canvas-deep) 92%, white), var(--canvas-deep)),
250741
250809
  var(--canvas-deep);
250742
250810
  transition: grid-template-columns 210ms cubic-bezier(0.2, 0.75, 0.3, 1), gap 210ms ease, padding 210ms ease;
250743
250811
  }
@@ -251610,25 +251678,25 @@ var WEB_UI_SHELL_STYLES = String.raw`
251610
251678
  min-width: 0;
251611
251679
  min-height: 0;
251612
251680
  display: grid;
251613
- grid-template-rows: 58px auto minmax(0, 1fr);
251681
+ grid-template-rows: 62px auto minmax(0, 1fr);
251614
251682
  overflow: hidden;
251615
251683
  background: var(--canvas);
251616
251684
  border: 1px solid color-mix(in srgb, var(--border-strong) 82%, transparent);
251617
- border-radius: 18px;
251618
- box-shadow: 0 18px 54px rgba(25, 43, 39, 0.08), 0 2px 8px rgba(25, 43, 39, 0.035);
251685
+ border-radius: 20px;
251686
+ box-shadow: 0 22px 62px rgba(25, 43, 39, 0.09), 0 2px 8px rgba(25, 43, 39, 0.04);
251619
251687
  }
251620
251688
 
251621
251689
  .topbar {
251622
251690
  grid-row: 1;
251623
251691
  min-width: 0;
251624
- height: 58px;
251692
+ height: 62px;
251625
251693
  display: flex;
251626
251694
  align-items: center;
251627
251695
  justify-content: space-between;
251628
251696
  gap: 16px;
251629
251697
  padding: 0 clamp(16px, 2vw, 28px);
251630
- border-bottom: 1px solid var(--border);
251631
- background: color-mix(in srgb, var(--surface-glass) 92%, var(--canvas));
251698
+ border-bottom: 1px solid color-mix(in srgb, var(--border-strong) 72%, transparent);
251699
+ background: color-mix(in srgb, var(--surface-glass) 96%, var(--canvas));
251632
251700
  backdrop-filter: blur(22px) saturate(130%);
251633
251701
  z-index: 15;
251634
251702
  }
@@ -251727,8 +251795,8 @@ var WEB_UI_SHELL_STYLES = String.raw`
251727
251795
 
251728
251796
  .workspace-heading strong {
251729
251797
  color: var(--ink-strong);
251730
- font-size: 14px;
251731
- font-weight: 680;
251798
+ font-size: 14.5px;
251799
+ font-weight: 700;
251732
251800
  }
251733
251801
 
251734
251802
  .workspace-heading span {
@@ -251782,8 +251850,8 @@ var WEB_UI_SHELL_STYLES = String.raw`
251782
251850
  gap: 6px;
251783
251851
  padding: 0 9px;
251784
251852
  color: var(--faint);
251785
- background: transparent;
251786
- border: 0;
251853
+ background: color-mix(in srgb, var(--surface-raised) 58%, transparent);
251854
+ border: 1px solid var(--border);
251787
251855
  border-radius: 9px;
251788
251856
  font-size: 11px;
251789
251857
  white-space: nowrap;
@@ -251859,56 +251927,56 @@ var WEB_UI_STYLE_SECTIONS = [
251859
251927
  var WEB_UI_STYLES = WEB_UI_STYLE_SECTIONS.join("");
251860
251928
 
251861
251929
  // src/runtime/webui/WebUiRuntime.ts
251862
- var WebTurnIdSchema = z38.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
251863
- var ChatRequestSchema = z38.object({
251864
- prompt: z38.string().trim().min(1).max(1e5),
251930
+ var WebTurnIdSchema = z39.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
251931
+ var ChatRequestSchema = z39.object({
251932
+ prompt: z39.string().trim().min(1).max(1e5),
251865
251933
  turnId: WebTurnIdSchema.optional(),
251866
- attachmentIds: z38.array(WebTurnIdSchema).max(4).optional()
251934
+ attachmentIds: z39.array(WebTurnIdSchema).max(4).optional()
251867
251935
  }).strict();
251868
- var CancelRequestSchema = z38.object({ turnId: WebTurnIdSchema.nullish() }).strict();
251869
- var ApprovalDecisionSchema = z38.object({
251936
+ var CancelRequestSchema = z39.object({ turnId: WebTurnIdSchema.nullish() }).strict();
251937
+ var ApprovalDecisionSchema = z39.object({
251870
251938
  id: WebTurnIdSchema,
251871
- approved: z38.boolean()
251939
+ approved: z39.boolean()
251872
251940
  }).strict();
251873
- var SettingsPatchSchema = z38.object({
251874
- provider: z38.string().trim().min(1).max(256).optional(),
251875
- model: z38.string().trim().min(1).max(200).optional(),
251876
- permissionMode: z38.enum(["strict", "normal", "auto", "plan"]).optional(),
251877
- webSearchEnabled: z38.boolean().optional(),
251878
- webSearchProvider: z38.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
251879
- webSearchMaxResults: z38.number().int().min(1).max(20).optional()
251941
+ var SettingsPatchSchema = z39.object({
251942
+ provider: z39.string().trim().min(1).max(256).optional(),
251943
+ model: z39.string().trim().min(1).max(200).optional(),
251944
+ permissionMode: z39.enum(["strict", "normal", "auto", "plan"]).optional(),
251945
+ webSearchEnabled: z39.boolean().optional(),
251946
+ webSearchProvider: z39.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
251947
+ webSearchMaxResults: z39.number().int().min(1).max(20).optional()
251880
251948
  }).strict();
251881
- var SessionActionSchema = z38.discriminatedUnion("action", [
251882
- z38.object({ action: z38.literal("new") }).strict(),
251949
+ var SessionActionSchema = z39.discriminatedUnion("action", [
251950
+ z39.object({ action: z39.literal("new") }).strict(),
251883
251951
  ...["resume", "archive", "restore", "delete"].map(
251884
- (action) => z38.object({
251885
- action: z38.literal(action),
251886
- sessionId: z38.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251952
+ (action) => z39.object({
251953
+ action: z39.literal(action),
251954
+ sessionId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251887
251955
  }).strict()
251888
251956
  )
251889
251957
  ]);
251890
- var ProjectActionSchema = z38.discriminatedUnion("action", [
251891
- z38.object({ action: z38.literal("pick") }).strict(),
251892
- z38.object({
251893
- action: z38.enum(["open", "create"]),
251894
- path: z38.string().trim().min(1).max(4096)
251958
+ var ProjectActionSchema = z39.discriminatedUnion("action", [
251959
+ z39.object({ action: z39.literal("pick") }).strict(),
251960
+ z39.object({
251961
+ action: z39.enum(["open", "create"]),
251962
+ path: z39.string().trim().min(1).max(4096)
251895
251963
  }).strict(),
251896
- z38.object({
251897
- action: z38.literal("remove"),
251898
- projectId: z38.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
251964
+ z39.object({
251965
+ action: z39.literal("remove"),
251966
+ projectId: z39.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
251899
251967
  }).strict()
251900
251968
  ]);
251901
- var ReviewActionSchema = z38.discriminatedUnion("action", [
251902
- z38.object({
251903
- action: z38.literal("rollback-file"),
251904
- path: z38.string().trim().min(1).max(4096)
251969
+ var ReviewActionSchema = z39.discriminatedUnion("action", [
251970
+ z39.object({
251971
+ action: z39.literal("rollback-file"),
251972
+ path: z39.string().trim().min(1).max(4096)
251905
251973
  }).strict(),
251906
- z38.object({
251907
- action: z38.literal("rewind"),
251908
- checkpointId: z38.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251974
+ z39.object({
251975
+ action: z39.literal("rewind"),
251976
+ checkpointId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251909
251977
  }).strict()
251910
251978
  ]);
251911
- var CompletionQuerySchema = z38.string().trim().max(200);
251979
+ var CompletionQuerySchema = z39.string().trim().max(200);
251912
251980
  var IMAGE_ATTACHMENT_LIMIT_BYTES = 5 * 1024 * 1024;
251913
251981
  var IMAGE_ATTACHMENT_STORE_LIMIT = 16;
251914
251982
  var ALLOWED_IMAGE_TYPES = /* @__PURE__ */ new Set([
@@ -252010,6 +252078,7 @@ var OrbitWebUiRuntime = class {
252010
252078
  const handle = {
252011
252079
  port: actualPort,
252012
252080
  url: `http://127.0.0.1:${actualPort}/#token=${encodeURIComponent(token)}`,
252081
+ browserOpened: false,
252013
252082
  close: () => this.stop()
252014
252083
  };
252015
252084
  this.handle = handle;
@@ -252548,13 +252617,8 @@ var activeRuntime;
252548
252617
  function parseWebUiArgs(rawArgs) {
252549
252618
  const args = rawArgs.split(/\s+/).map((item) => item.trim()).filter(Boolean);
252550
252619
  let port;
252551
- let open = true;
252552
252620
  for (let index = 0; index < args.length; index++) {
252553
252621
  const arg = args[index];
252554
- if (arg === "--no-open") {
252555
- open = false;
252556
- continue;
252557
- }
252558
252622
  if (arg === "--port") {
252559
252623
  const next = args[index + 1];
252560
252624
  if (/^\d+$/.test(next || "")) {
@@ -252575,35 +252639,13 @@ function parseWebUiArgs(rawArgs) {
252575
252639
  }
252576
252640
  }
252577
252641
  }
252578
- return { port, open };
252579
- }
252580
- async function openBrowser(url) {
252581
- const { command, args } = resolveBrowserLaunch(url);
252582
- const child = spawn2(command, args, {
252583
- detached: true,
252584
- stdio: "ignore",
252585
- windowsHide: true
252586
- });
252587
- child.on("error", () => {
252588
- });
252589
- child.unref();
252590
- }
252591
- function resolveBrowserLaunch(url, platform = process.platform) {
252592
- if (platform === "win32") {
252593
- return { command: "explorer.exe", args: [url] };
252594
- }
252595
- return {
252596
- command: platform === "darwin" ? "open" : "xdg-open",
252597
- args: [url]
252598
- };
252642
+ return { port, open: false };
252599
252643
  }
252600
252644
  async function startOrbitWebUi(options) {
252601
252645
  const current = activeRuntime;
252602
252646
  if (current?.canReuse(options.port)) {
252603
252647
  current.updateOptions(options);
252604
- const handle2 = current.getHandle();
252605
- if (options.open !== false) await openBrowser(handle2.url);
252606
- return handle2;
252648
+ return current.getHandle();
252607
252649
  }
252608
252650
  if (current?.hasActiveTurn) {
252609
252651
  throw new Error(
@@ -252617,7 +252659,6 @@ async function startOrbitWebUi(options) {
252617
252659
  const runtime = new OrbitWebUiRuntime(options);
252618
252660
  const handle = await runtime.start();
252619
252661
  activeRuntime = runtime;
252620
- if (options.open !== false) await openBrowser(handle.url);
252621
252662
  return handle;
252622
252663
  }
252623
252664
  async function stopOrbitWebUi() {
@@ -253457,9 +253498,9 @@ async function handleContextCommand(command, argument, dependencies) {
253457
253498
  import { execFileSync as execFileSync5 } from "child_process";
253458
253499
  import { existsSync as existsSync19, rmSync as rmSync5 } from "fs";
253459
253500
  import picocolors13 from "picocolors";
253460
- import { z as z39 } from "zod";
253461
- var GitStatusCodeSchema = z39.string().length(2).regex(/^[ MADRCU?!]{2}$/);
253462
- var GitStatusPathSchema = z39.string().min(1).max(32768);
253501
+ import { z as z40 } from "zod";
253502
+ var GitStatusCodeSchema = z40.string().length(2).regex(/^[ MADRCU?!]{2}$/);
253503
+ var GitStatusPathSchema = z40.string().min(1).max(32768);
253463
253504
  var defaultGitAdapter = {
253464
253505
  status: (cwd) => execFileSync5("git", ["status", "--porcelain=v1", "-z"], {
253465
253506
  cwd,
@@ -253957,32 +253998,32 @@ function ensureSessionTitle(loop, prompt) {
253957
253998
  }
253958
253999
 
253959
254000
  // src/runtime/ModelDiscovery.ts
253960
- import { z as z40 } from "zod";
253961
- var ModelEntrySchema = z40.object({
253962
- id: z40.unknown().optional(),
253963
- model: z40.unknown().optional(),
253964
- context_length: z40.unknown().optional(),
253965
- context_window: z40.unknown().optional(),
253966
- max_context_tokens: z40.unknown().optional(),
253967
- max_output_tokens: z40.unknown().optional(),
253968
- input_modalities: z40.unknown().optional(),
253969
- output_modalities: z40.unknown().optional(),
253970
- modalities: z40.unknown().optional(),
253971
- architecture: z40.unknown().optional(),
253972
- capabilities: z40.unknown().optional(),
253973
- supported_parameters: z40.unknown().optional(),
253974
- type: z40.unknown().optional(),
253975
- kind: z40.unknown().optional(),
253976
- task: z40.unknown().optional(),
253977
- endpoint: z40.unknown().optional(),
253978
- details: z40.unknown().optional()
254001
+ import { z as z41 } from "zod";
254002
+ var ModelEntrySchema = z41.object({
254003
+ id: z41.unknown().optional(),
254004
+ model: z41.unknown().optional(),
254005
+ context_length: z41.unknown().optional(),
254006
+ context_window: z41.unknown().optional(),
254007
+ max_context_tokens: z41.unknown().optional(),
254008
+ max_output_tokens: z41.unknown().optional(),
254009
+ input_modalities: z41.unknown().optional(),
254010
+ output_modalities: z41.unknown().optional(),
254011
+ modalities: z41.unknown().optional(),
254012
+ architecture: z41.unknown().optional(),
254013
+ capabilities: z41.unknown().optional(),
254014
+ supported_parameters: z41.unknown().optional(),
254015
+ type: z41.unknown().optional(),
254016
+ kind: z41.unknown().optional(),
254017
+ task: z41.unknown().optional(),
254018
+ endpoint: z41.unknown().optional(),
254019
+ details: z41.unknown().optional()
253979
254020
  }).passthrough();
253980
- var ModelListSchema = z40.union([
253981
- z40.object({ data: z40.array(ModelEntrySchema).max(1e3) }),
253982
- z40.object({ models: z40.array(ModelEntrySchema).max(1e3) }),
253983
- z40.array(ModelEntrySchema).max(1e3)
254021
+ var ModelListSchema = z41.union([
254022
+ z41.object({ data: z41.array(ModelEntrySchema).max(1e3) }),
254023
+ z41.object({ models: z41.array(ModelEntrySchema).max(1e3) }),
254024
+ z41.array(ModelEntrySchema).max(1e3)
253984
254025
  ]);
253985
- var DiscoveryUrlSchema = z40.string().url().max(4096).transform((value) => new URL(value));
254026
+ var DiscoveryUrlSchema = z41.string().url().max(4096).transform((value) => new URL(value));
253986
254027
  var MAX_MODEL_RESPONSE_BYTES = 2 * 1024 * 1024;
253987
254028
  async function discoverProviderModels(options) {
253988
254029
  const base = DiscoveryUrlSchema.parse(options.baseUrl.trim());
@@ -254149,9 +254190,9 @@ function normalizeModelEntries(entries) {
254149
254190
  }
254150
254191
  return { models, modelCapabilities };
254151
254192
  }
254152
- var OllamaShowSchema = z40.object({
254153
- capabilities: z40.array(z40.string().max(128)).max(64).optional(),
254154
- model_info: z40.record(z40.unknown()).optional()
254193
+ var OllamaShowSchema = z41.object({
254194
+ capabilities: z41.array(z41.string().max(128)).max(64).optional(),
254195
+ model_info: z41.record(z41.unknown()).optional()
254155
254196
  }).passthrough();
254156
254197
  async function enrichOllamaCapabilities(base, models, target, fetchImpl, signal) {
254157
254198
  const endpoint = new URL(base);
@@ -254288,7 +254329,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
254288
254329
  }
254289
254330
 
254290
254331
  // src/runtime/ProjectLauncher.ts
254291
- import { spawn as spawn3 } from "child_process";
254332
+ import { spawn as spawn2 } from "child_process";
254292
254333
  import { existsSync as existsSync20, mkdirSync as mkdirSync12, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
254293
254334
  import { isAbsolute as isAbsolute6, parse as parse4, resolve as resolve9 } from "path";
254294
254335
  function launchOrbitProject(request, options = {}) {
@@ -254312,7 +254353,7 @@ function launchOrbitProject(request, options = {}) {
254312
254353
  (options.registry || new ProjectRegistry()).register(projectPath);
254313
254354
  const entryPoint = options.entryPoint || process.argv[1];
254314
254355
  if (!entryPoint) throw new Error("Orbit CLI entry point is unavailable.");
254315
- const launch = options.launch || spawn3;
254356
+ const launch = options.launch || spawn2;
254316
254357
  const child = launch(
254317
254358
  options.executable || process.execPath,
254318
254359
  [entryPoint, "webui", "--cwd", projectPath],
@@ -254398,9 +254439,9 @@ function isPickerCancellation(error) {
254398
254439
 
254399
254440
  // src/runtime/commands/SessionMetadataCommandHandler.ts
254400
254441
  import picocolors15 from "picocolors";
254401
- import { z as z41 } from "zod";
254402
- var GoalSchema = z41.string().trim().min(1).max(4e3);
254403
- var SessionTitleSchema = z41.string().trim().min(1).max(160);
254442
+ import { z as z45 } from "zod";
254443
+ var GoalSchema = z45.string().trim().min(1).max(4e3);
254444
+ var SessionTitleSchema = z45.string().trim().min(1).max(160);
254404
254445
  function handleSessionMetadataCommand(command, argument, dependencies) {
254405
254446
  if (command === "/goal") {
254406
254447
  handleGoal(argument, dependencies);
@@ -254465,9 +254506,9 @@ function handleRename(argument, { loop, isZh, printOutput }) {
254465
254506
 
254466
254507
  // src/runtime/commands/WorkspaceStateCommandHandler.ts
254467
254508
  import picocolors16 from "picocolors";
254468
- import { z as z45 } from "zod";
254469
- var TextSchema = z45.string().trim().min(1).max(2e3);
254470
- var ItemReferenceSchema = z45.string().trim().min(1).max(100);
254509
+ import { z as z46 } from "zod";
254510
+ var TextSchema = z46.string().trim().min(1).max(2e3);
254511
+ var ItemReferenceSchema = z46.string().trim().min(1).max(100);
254471
254512
  function handleWorkspaceStateCommand(command, argument, dependencies) {
254472
254513
  if (command === "/memory") {
254473
254514
  handleMemory(argument, dependencies);
@@ -254643,11 +254684,11 @@ function resolveItemId(reference, items) {
254643
254684
  // src/commands/update.ts
254644
254685
  import readline4 from "readline";
254645
254686
  import picocolors17 from "picocolors";
254646
- import { z as z46 } from "zod";
254647
- var UpdateCommandOptionsSchema = z46.object({
254648
- check: z46.boolean().default(false),
254649
- yes: z46.boolean().default(false),
254650
- json: z46.boolean().default(false),
254687
+ import { z as z47 } from "zod";
254688
+ var UpdateCommandOptionsSchema = z47.object({
254689
+ check: z47.boolean().default(false),
254690
+ yes: z47.boolean().default(false),
254691
+ json: z47.boolean().default(false),
254651
254692
  channel: UpdateChannelSchema.default("stable")
254652
254693
  }).strict();
254653
254694
  async function runUpdate(currentVersion, rawOptions, dependencies = {}) {
@@ -254784,6 +254825,9 @@ var require2 = createRequire2(import.meta.url);
254784
254825
  function stripAnsi4(value) {
254785
254826
  return value.replace(/\u001b\[[0-9;]*m/g, "");
254786
254827
  }
254828
+ function terminalHyperlink2(label, url) {
254829
+ return `\x1B]8;;${url}\x07${label}\x1B]8;;\x07`;
254830
+ }
254787
254831
  var CommandRouter = class {
254788
254832
  constructor(cwd, config, providerInstance, setProviderInstance, loop, tui, useFullscreenTui, getCandidates, setCandidates, getLocalState2, saveLocalState, tuiInteraction, multi, updateOrbit = runUpdate) {
254789
254833
  this.cwd = cwd;
@@ -254925,7 +254969,7 @@ var CommandRouter = class {
254925
254969
  }
254926
254970
  if (command === "/webui") {
254927
254971
  const isZh = config.language === "zh";
254928
- const { port, open } = parseWebUiArgs(parts.slice(1).join(" "));
254972
+ const { port } = parseWebUiArgs(parts.slice(1).join(" "));
254929
254973
  try {
254930
254974
  await this.refreshProviderModels(config.provider.default);
254931
254975
  const handle = await startOrbitWebUi({
@@ -254933,7 +254977,6 @@ var CommandRouter = class {
254933
254977
  config,
254934
254978
  loop,
254935
254979
  port,
254936
- open,
254937
254980
  getProjects: () => new ProjectRegistry().list().slice(0, 20),
254938
254981
  submitPrompt: (prompt, attachments) => this.submitWebPrompt(prompt, attachments),
254939
254982
  cancelPrompt: () => this.cancelWebPrompt(),
@@ -254979,9 +255022,25 @@ var CommandRouter = class {
254979
255022
  });
254980
255023
  const displayUrl = new URL(handle.url);
254981
255024
  displayUrl.hash = "";
254982
- this.printOutput(
254983
- isZh ? picocolors18.green(`\u2714 Orbit Web UI \u5DF2\u542F\u52A8: ${displayUrl.href}`) : picocolors18.green(`\u2714 Orbit Web UI running: ${displayUrl.href}`)
254984
- );
255025
+ const statusText = isZh ? "\u2714 Orbit Web UI \u5DF2\u542F\u52A8" : "\u2714 Orbit Web UI started";
255026
+ if (this.tui?.isActive) {
255027
+ this.tui.addSystemMessage(picocolors18.green(statusText), false, {
255028
+ label: displayUrl.href,
255029
+ url: handle.url
255030
+ });
255031
+ } else {
255032
+ console.log(
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(" ")
255039
+ );
255040
+ }
255041
+ eventBus.emitEvent("info", {
255042
+ message: `${statusText}: ${displayUrl.href}`
255043
+ });
254985
255044
  } catch (error) {
254986
255045
  const message = error instanceof Error ? error.message : String(error);
254987
255046
  this.printOutput(
@@ -255832,20 +255891,20 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
255832
255891
  };
255833
255892
 
255834
255893
  // src/runtime/ReplController.ts
255835
- var AutocompleteRequestSchema = z47.object({
255836
- prefix: z47.string().max(2e4),
255837
- suffix: z47.string().max(2e4),
255838
- windowId: z47.string().max(1e3).optional()
255894
+ var AutocompleteRequestSchema = z48.object({
255895
+ prefix: z48.string().max(2e4),
255896
+ suffix: z48.string().max(2e4),
255897
+ windowId: z48.string().max(1e3).optional()
255839
255898
  });
255840
255899
  var AUTOCOMPLETE_BODY_LIMIT_BYTES = 1e5;
255841
255900
  var AUTOCOMPLETE_MAX_CONCURRENCY = 4;
255842
- var LocalStateSchema = z47.object({
255843
- lastSessionId: z47.string().optional(),
255844
- lastModel: z47.string().optional()
255901
+ var LocalStateSchema = z48.object({
255902
+ lastSessionId: z48.string().optional(),
255903
+ lastModel: z48.string().optional()
255845
255904
  });
255846
- var AutocompleteEndpointSchema = z47.object({
255847
- port: z47.number().int().min(1).max(65535),
255848
- token: z47.string().min(32).max(256)
255905
+ var AutocompleteEndpointSchema = z48.object({
255906
+ port: z48.number().int().min(1).max(65535),
255907
+ token: z48.string().min(32).max(256)
255849
255908
  });
255850
255909
  function getRunOutcomeMessage(outcome) {
255851
255910
  if (!outcome || outcome.status === "completed") return void 0;
@@ -256218,8 +256277,7 @@ Risk Warning: ${reason}`);
256218
256277
  if (this.webUiOnly) {
256219
256278
  const command = [
256220
256279
  "/webui",
256221
- this.webUiOnly.port !== void 0 ? `--port ${this.webUiOnly.port}` : "",
256222
- this.webUiOnly.open ? "" : "--no-open"
256280
+ this.webUiOnly.port !== void 0 ? `--port ${this.webUiOnly.port}` : ""
256223
256281
  ].filter(Boolean).join(" ");
256224
256282
  const result = await commandRouter.route(command);
256225
256283
  if (!result.processed) {
@@ -256727,36 +256785,36 @@ function isRecord6(value) {
256727
256785
  }
256728
256786
 
256729
256787
  // src/commands/LSPServer.ts
256730
- import { z as z48 } from "zod";
256788
+ import { z as z49 } from "zod";
256731
256789
  var MAX_LSP_HEADER_BYTES = 8 * 1024;
256732
256790
  var MAX_LSP_BODY_BYTES = 8 * 1024 * 1024;
256733
- var JsonRpcIdSchema = z48.union([z48.string(), z48.number(), z48.null()]);
256734
- var JSONRPCMessageSchema = z48.object({
256735
- jsonrpc: z48.literal("2.0"),
256791
+ var JsonRpcIdSchema = z49.union([z49.string(), z49.number(), z49.null()]);
256792
+ var JSONRPCMessageSchema = z49.object({
256793
+ jsonrpc: z49.literal("2.0"),
256736
256794
  id: JsonRpcIdSchema.optional(),
256737
- method: z48.string().min(1).max(512),
256738
- params: z48.unknown().optional()
256795
+ method: z49.string().min(1).max(512),
256796
+ params: z49.unknown().optional()
256739
256797
  }).strict();
256740
- var TextDocumentIdentifierSchema = z48.object({
256741
- uri: z48.string().min(1).max(16384)
256798
+ var TextDocumentIdentifierSchema = z49.object({
256799
+ uri: z49.string().min(1).max(16384)
256742
256800
  });
256743
- var DidOpenParamsSchema = z48.object({
256801
+ var DidOpenParamsSchema = z49.object({
256744
256802
  textDocument: TextDocumentIdentifierSchema.extend({
256745
- text: z48.string().max(MAX_LSP_BODY_BYTES)
256803
+ text: z49.string().max(MAX_LSP_BODY_BYTES)
256746
256804
  }).passthrough()
256747
256805
  });
256748
- var DidChangeParamsSchema = z48.object({
256806
+ var DidChangeParamsSchema = z49.object({
256749
256807
  textDocument: TextDocumentIdentifierSchema,
256750
- contentChanges: z48.array(z48.object({ text: z48.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
256808
+ contentChanges: z49.array(z49.object({ text: z49.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
256751
256809
  });
256752
- var DidCloseParamsSchema = z48.object({
256810
+ var DidCloseParamsSchema = z49.object({
256753
256811
  textDocument: TextDocumentIdentifierSchema
256754
256812
  });
256755
- var CompletionParamsSchema = z48.object({
256813
+ var CompletionParamsSchema = z49.object({
256756
256814
  textDocument: TextDocumentIdentifierSchema,
256757
- position: z48.object({
256758
- line: z48.number().int().nonnegative(),
256759
- character: z48.number().int().nonnegative()
256815
+ position: z49.object({
256816
+ line: z49.number().int().nonnegative(),
256817
+ character: z49.number().int().nonnegative()
256760
256818
  })
256761
256819
  });
256762
256820
  var JSONRPCReader = class {
@@ -257002,7 +257060,7 @@ ${completion}
257002
257060
  );
257003
257061
  }
257004
257062
  } catch (error) {
257005
- if (error instanceof z48.ZodError) {
257063
+ if (error instanceof z49.ZodError) {
257006
257064
  sendError(message.id, -32602, "Invalid method parameters.");
257007
257065
  return;
257008
257066
  }
@@ -257368,17 +257426,17 @@ async function runLogin(options = {}) {
257368
257426
  // src/commands/trace.ts
257369
257427
  import {
257370
257428
  existsSync as existsSync29,
257371
- lstatSync as lstatSync5,
257429
+ lstatSync as lstatSync6,
257372
257430
  mkdirSync as mkdirSync14,
257373
257431
  renameSync as renameSync9,
257374
257432
  rmSync as rmSync7,
257375
257433
  writeFileSync as writeFileSync13
257376
257434
  } from "fs";
257377
257435
  import { dirname as dirname11, resolve as resolve11 } from "path";
257378
- import { z as z49 } from "zod";
257379
- var TraceOptionsSchema = z49.object({
257380
- full: z49.boolean().default(false),
257381
- out: z49.string().trim().min(1).max(4096).optional()
257436
+ import { z as z50 } from "zod";
257437
+ var TraceOptionsSchema = z50.object({
257438
+ full: z50.boolean().default(false),
257439
+ out: z50.string().trim().min(1).max(4096).optional()
257382
257440
  });
257383
257441
  function runTraceExport(cwd, sessionId, options = {}) {
257384
257442
  const value = TraceOptionsSchema.parse(options);
@@ -257395,7 +257453,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
257395
257453
  const outputPath = resolveSafePath(cwd, value.out);
257396
257454
  const directory = dirname11(outputPath);
257397
257455
  if (existsSync29(directory)) {
257398
- const stats = lstatSync5(directory);
257456
+ const stats = lstatSync6(directory);
257399
257457
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
257400
257458
  throw new Error("Trace output directory must be a real directory.");
257401
257459
  }
@@ -257422,7 +257480,7 @@ import { exec as execCallback, execFileSync as execFileSync6 } from "child_proce
257422
257480
  import {
257423
257481
  copyFileSync as copyFileSync4,
257424
257482
  existsSync as existsSync30,
257425
- lstatSync as lstatSync6,
257483
+ lstatSync as lstatSync7,
257426
257484
  mkdirSync as mkdirSync15,
257427
257485
  readFileSync as readFileSync28,
257428
257486
  renameSync as renameSync10,
@@ -257433,16 +257491,16 @@ import { basename as basename6, dirname as dirname12, join as join19 } from "pat
257433
257491
  import { promisify as promisify5 } from "util";
257434
257492
  import picocolors23 from "picocolors";
257435
257493
  import { parse as parseYaml3 } from "yaml";
257436
- import { z as z50 } from "zod";
257494
+ import { z as z51 } from "zod";
257437
257495
  var exec4 = promisify5(execCallback);
257438
257496
  var MAX_SUITE_BYTES = 1024 * 1024;
257439
257497
  var MAX_VERIFICATION_OUTPUT = 4e3;
257440
- var EvalOptionsSchema = z50.object({
257441
- provider: z50.string().trim().min(1).optional(),
257442
- model: z50.string().trim().min(1).optional(),
257443
- task: z50.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
257444
- allowCommands: z50.boolean().default(false),
257445
- json: z50.boolean().default(false)
257498
+ var EvalOptionsSchema = z51.object({
257499
+ provider: z51.string().trim().min(1).optional(),
257500
+ model: z51.string().trim().min(1).optional(),
257501
+ task: z51.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
257502
+ allowCommands: z51.boolean().default(false),
257503
+ json: z51.boolean().default(false)
257446
257504
  });
257447
257505
  async function runEval(cwd, suiteFile, options = {}) {
257448
257506
  const value = EvalOptionsSchema.parse(options);
@@ -257588,7 +257646,7 @@ async function runEval(cwd, suiteFile, options = {}) {
257588
257646
  }
257589
257647
  function loadAcceptanceSuite(cwd, suiteFile) {
257590
257648
  const filePath = resolveSafePath(cwd, suiteFile);
257591
- const stats = lstatSync6(filePath);
257649
+ const stats = lstatSync7(filePath);
257592
257650
  if (stats.isSymbolicLink() || !stats.isFile()) {
257593
257651
  throw new Error("Acceptance suite must be a real file.");
257594
257652
  }
@@ -257676,7 +257734,7 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
257676
257734
  if (isSensitiveSnapshotPath2(relativePath)) continue;
257677
257735
  const sourcePath = resolveSafePath(sourceCwd, relativePath);
257678
257736
  const targetPath = resolveSafePath(worktreeCwd, relativePath);
257679
- const stats = lstatSync6(sourcePath);
257737
+ const stats = lstatSync7(sourcePath);
257680
257738
  if (stats.isSymbolicLink() || !stats.isFile()) continue;
257681
257739
  mkdirSync15(dirname12(targetPath), { recursive: true });
257682
257740
  copyFileSync4(sourcePath, targetPath);
@@ -257736,7 +257794,7 @@ function writeEvaluationReport(cwd, runId, report) {
257736
257794
  function writeJsonAtomically2(filePath, value) {
257737
257795
  const directory = dirname12(filePath);
257738
257796
  if (existsSync30(directory)) {
257739
- const stats = lstatSync6(directory);
257797
+ const stats = lstatSync7(directory);
257740
257798
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
257741
257799
  throw new Error("Evaluation output directory must be a real directory.");
257742
257800
  }
@@ -257765,16 +257823,16 @@ function safeSummary(value) {
257765
257823
  import readline6 from "readline";
257766
257824
  import picocolors24 from "picocolors";
257767
257825
  import { resolve as resolve13 } from "path";
257768
- import { z as z54 } from "zod";
257826
+ import { z as z55 } from "zod";
257769
257827
 
257770
257828
  // src/runtime/CleanupManager.ts
257771
- import { lstatSync as lstatSync7, readdirSync as readdirSync8, rmSync as rmSync9 } from "fs";
257829
+ import { lstatSync as lstatSync8, readdirSync as readdirSync8, rmSync as rmSync9 } from "fs";
257772
257830
  import { homedir as homedir11 } from "os";
257773
257831
  import { basename as basename7, join as join20, parse as parse5, resolve as resolve12 } from "path";
257774
- import { z as z51 } from "zod";
257775
- var CleanupScopeSchema = z51.enum(["user", "project"]);
257832
+ import { z as z54 } from "zod";
257833
+ var CleanupScopeSchema = z54.enum(["user", "project"]);
257776
257834
  function buildCleanupPlan(options) {
257777
- const scopes = z51.array(CleanupScopeSchema).min(1).parse(options.scopes);
257835
+ const scopes = z54.array(CleanupScopeSchema).min(1).parse(options.scopes);
257778
257836
  const homeDirectory = resolve12(options.homeDirectory ?? homedir11());
257779
257837
  const projectDirectory = resolve12(options.projectDirectory ?? options.cwd);
257780
257838
  const candidates = scopes.map((scope) => ({
@@ -257838,7 +257896,7 @@ function inspectPath(targetPath) {
257838
257896
  const visit = (currentPath) => {
257839
257897
  let stat;
257840
257898
  try {
257841
- stat = lstatSync7(currentPath);
257899
+ stat = lstatSync8(currentPath);
257842
257900
  } catch (error) {
257843
257901
  warnings.push(safeInventoryWarning(currentPath, error));
257844
257902
  return;
@@ -257885,7 +257943,7 @@ function pathIdentity(targetPath) {
257885
257943
  }
257886
257944
  function pathExists(targetPath) {
257887
257945
  try {
257888
- lstatSync7(targetPath);
257946
+ lstatSync8(targetPath);
257889
257947
  return true;
257890
257948
  } catch {
257891
257949
  return false;
@@ -257897,12 +257955,12 @@ function safeInventoryWarning(targetPath, error) {
257897
257955
  }
257898
257956
 
257899
257957
  // src/commands/clean.ts
257900
- var CleanCommandOptionsSchema = z54.object({
257901
- user: z54.boolean().default(false),
257902
- project: z54.union([z54.boolean(), z54.string().min(1).max(4096)]).optional(),
257903
- all: z54.boolean().default(false),
257904
- yes: z54.boolean().default(false),
257905
- json: z54.boolean().default(false)
257958
+ var CleanCommandOptionsSchema = z55.object({
257959
+ user: z55.boolean().default(false),
257960
+ project: z55.union([z55.boolean(), z55.string().min(1).max(4096)]).optional(),
257961
+ all: z55.boolean().default(false),
257962
+ yes: z55.boolean().default(false),
257963
+ json: z55.boolean().default(false)
257906
257964
  }).strict();
257907
257965
  async function runClean(cwd, rawOptions, dependencies = {}) {
257908
257966
  const options = CleanCommandOptionsSchema.parse(rawOptions);
@@ -258017,12 +258075,12 @@ async function confirmDeletion(prompt) {
258017
258075
  // src/commands/backup.ts
258018
258076
  import { basename as basename8, resolve as resolve15 } from "path";
258019
258077
  import picocolors25 from "picocolors";
258020
- import { z as z56 } from "zod";
258078
+ import { z as z57 } from "zod";
258021
258079
 
258022
258080
  // src/runtime/ProjectBackup.ts
258023
258081
  import {
258024
258082
  existsSync as existsSync31,
258025
- lstatSync as lstatSync8,
258083
+ lstatSync as lstatSync9,
258026
258084
  mkdirSync as mkdirSync16,
258027
258085
  readFileSync as readFileSync29,
258028
258086
  readdirSync as readdirSync9,
@@ -258033,23 +258091,23 @@ import {
258033
258091
  } from "fs";
258034
258092
  import { createHash as createHash8, randomUUID as randomUUID10 } from "crypto";
258035
258093
  import { dirname as dirname13, isAbsolute as isAbsolute7, join as join21, relative as relative5, resolve as resolve14, sep as sep2 } from "path";
258036
- import { z as z55 } from "zod";
258094
+ import { z as z56 } from "zod";
258037
258095
  var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
258038
258096
  var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
258039
258097
  var MAX_BACKUP_FILES = 1e4;
258040
258098
  var SHA256_PATTERN = /^[a-f0-9]{64}$/;
258041
- var BackupFileSchema = z55.object({
258042
- path: z55.string().min(1).max(4096),
258043
- size: z55.number().int().min(0).max(MAX_BACKUP_BYTES),
258044
- sha256: z55.string().regex(SHA256_PATTERN),
258045
- content: z55.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
258099
+ var BackupFileSchema = z56.object({
258100
+ path: z56.string().min(1).max(4096),
258101
+ size: z56.number().int().min(0).max(MAX_BACKUP_BYTES),
258102
+ sha256: z56.string().regex(SHA256_PATTERN),
258103
+ content: z56.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
258046
258104
  });
258047
- var ProjectBackupBundleSchema = z55.object({
258048
- schemaVersion: z55.literal(1),
258049
- kind: z55.literal("orbit-project-backup"),
258050
- createdAt: z55.string().datetime(),
258051
- sourceName: z55.string().min(1).max(512),
258052
- files: z55.array(BackupFileSchema).max(MAX_BACKUP_FILES)
258105
+ var ProjectBackupBundleSchema = z56.object({
258106
+ schemaVersion: z56.literal(1),
258107
+ kind: z56.literal("orbit-project-backup"),
258108
+ createdAt: z56.string().datetime(),
258109
+ sourceName: z56.string().min(1).max(512),
258110
+ files: z56.array(BackupFileSchema).max(MAX_BACKUP_FILES)
258053
258111
  }).superRefine((bundle, context) => {
258054
258112
  let totalBytes = 0;
258055
258113
  const seen = /* @__PURE__ */ new Set();
@@ -258057,7 +258115,7 @@ var ProjectBackupBundleSchema = z55.object({
258057
258115
  totalBytes += file.size;
258058
258116
  if (totalBytes > MAX_BACKUP_BYTES) {
258059
258117
  context.addIssue({
258060
- code: z55.ZodIssueCode.custom,
258118
+ code: z56.ZodIssueCode.custom,
258061
258119
  message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
258062
258120
  });
258063
258121
  break;
@@ -258065,14 +258123,14 @@ var ProjectBackupBundleSchema = z55.object({
258065
258123
  const normalized = normalizeBundlePath(file.path);
258066
258124
  if (!normalized || normalized !== file.path) {
258067
258125
  context.addIssue({
258068
- code: z55.ZodIssueCode.custom,
258126
+ code: z56.ZodIssueCode.custom,
258069
258127
  message: `Unsafe backup path: ${file.path}`
258070
258128
  });
258071
258129
  continue;
258072
258130
  }
258073
258131
  if (seen.has(normalized.toLowerCase())) {
258074
258132
  context.addIssue({
258075
- code: z55.ZodIssueCode.custom,
258133
+ code: z56.ZodIssueCode.custom,
258076
258134
  message: `Duplicate backup path: ${file.path}`
258077
258135
  });
258078
258136
  }
@@ -258201,7 +258259,7 @@ function listBackupFiles(root) {
258201
258259
  const relativePath = relative5(root, absolutePath).split(sep2).join("/");
258202
258260
  const topLevel = relativePath.split("/")[0]?.toLowerCase() ?? "";
258203
258261
  if (EXCLUDED_TOP_LEVEL.has(topLevel)) continue;
258204
- const status = lstatSync8(absolutePath);
258262
+ const status = lstatSync9(absolutePath);
258205
258263
  if (status.isSymbolicLink()) continue;
258206
258264
  if (status.isDirectory()) visit(absolutePath);
258207
258265
  else if (status.isFile()) output.push(absolutePath);
@@ -258240,12 +258298,12 @@ function assertDirectoryChainHasNoSymlink(root, target) {
258240
258298
  throw new Error("Backup restore directory escapes the project.");
258241
258299
  }
258242
258300
  let current = absoluteRoot;
258243
- if (existsSync31(current) && lstatSync8(current).isSymbolicLink()) {
258301
+ if (existsSync31(current) && lstatSync9(current).isSymbolicLink()) {
258244
258302
  throw new Error(`Refusing to restore through symbolic link: ${current}`);
258245
258303
  }
258246
258304
  for (const part of relativeTarget.split(sep2).filter(Boolean)) {
258247
258305
  current = join21(current, part);
258248
- if (existsSync31(current) && lstatSync8(current).isSymbolicLink()) {
258306
+ if (existsSync31(current) && lstatSync9(current).isSymbolicLink()) {
258249
258307
  throw new Error(`Refusing to restore through symbolic link: ${current}`);
258250
258308
  }
258251
258309
  }
@@ -258282,9 +258340,9 @@ function formatBytes2(bytes) {
258282
258340
  }
258283
258341
 
258284
258342
  // src/commands/backup.ts
258285
- var BackupOptionsSchema = z56.object({
258286
- output: z56.string().min(1).max(4096).optional(),
258287
- json: z56.boolean().default(false)
258343
+ var BackupOptionsSchema = z57.object({
258344
+ output: z57.string().min(1).max(4096).optional(),
258345
+ json: z57.boolean().default(false)
258288
258346
  }).strict();
258289
258347
  function runBackupCreate(cwd, rawOptions = {}) {
258290
258348
  const options = BackupOptionsSchema.parse(rawOptions);
@@ -258374,7 +258432,7 @@ import picocolors26 from "picocolors";
258374
258432
  // src/runtime/ExtensionManager.ts
258375
258433
  import {
258376
258434
  existsSync as existsSync36,
258377
- lstatSync as lstatSync9,
258435
+ lstatSync as lstatSync10,
258378
258436
  mkdirSync as mkdirSync17,
258379
258437
  readFileSync as readFileSync30,
258380
258438
  readdirSync as readdirSync10,
@@ -258385,20 +258443,20 @@ import {
258385
258443
  import { createHash as createHash9, randomUUID as randomUUID11 } from "crypto";
258386
258444
  import { dirname as dirname14, join as join26, relative as relative6, resolve as resolve16 } from "path";
258387
258445
  import { homedir as homedir12 } from "os";
258388
- import { z as z57 } from "zod";
258389
- var InstalledExtensionSchema2 = z57.object({
258390
- id: z57.string(),
258391
- displayName: z57.string(),
258392
- version: z57.string(),
258393
- digest: z57.string().regex(/^[a-f0-9]{64}$/),
258394
- installedAt: z57.string().datetime(),
258395
- trusted: z57.boolean(),
258396
- path: z57.string(),
258397
- manifestFile: z57.string().default("extension.yaml")
258446
+ import { z as z58 } from "zod";
258447
+ var InstalledExtensionSchema2 = z58.object({
258448
+ id: z58.string(),
258449
+ displayName: z58.string(),
258450
+ version: z58.string(),
258451
+ digest: z58.string().regex(/^[a-f0-9]{64}$/),
258452
+ installedAt: z58.string().datetime(),
258453
+ trusted: z58.boolean(),
258454
+ path: z58.string(),
258455
+ manifestFile: z58.string().default("extension.yaml")
258398
258456
  });
258399
- var ExtensionRegistrySchema2 = z57.object({
258400
- schemaVersion: z57.literal(1),
258401
- extensions: z57.array(InstalledExtensionSchema2).default([])
258457
+ var ExtensionRegistrySchema2 = z58.object({
258458
+ schemaVersion: z58.literal(1),
258459
+ extensions: z58.array(InstalledExtensionSchema2).default([])
258402
258460
  });
258403
258461
  var ExtensionManager = class {
258404
258462
  orbitDir;
@@ -258415,7 +258473,7 @@ var ExtensionManager = class {
258415
258473
  return ExtensionRegistrySchema2.parse(
258416
258474
  JSON.parse(readFileSync30(this.registryPath, "utf8"))
258417
258475
  ).extensions.filter(
258418
- (extension) => this.isManagedExtensionPath(extension) && existsSync36(extension.path) && !lstatSync9(extension.path).isSymbolicLink()
258476
+ (extension) => this.isManagedExtensionPath(extension) && existsSync36(extension.path) && !lstatSync10(extension.path).isSymbolicLink()
258419
258477
  );
258420
258478
  } catch {
258421
258479
  return [];
@@ -258566,7 +258624,7 @@ function validateContributionFiles(root, manifest) {
258566
258624
  `Invalid extension contribution path: ${contribution.path}`
258567
258625
  );
258568
258626
  }
258569
- if (!existsSync36(target) || lstatSync9(target).isSymbolicLink()) {
258627
+ if (!existsSync36(target) || lstatSync10(target).isSymbolicLink()) {
258570
258628
  throw new Error(
258571
258629
  `Extension contribution is missing or unsafe: ${contribution.path}`
258572
258630
  );
@@ -258574,7 +258632,7 @@ function validateContributionFiles(root, manifest) {
258574
258632
  }
258575
258633
  }
258576
258634
  function copyDirectorySafely(source, target) {
258577
- const stats = lstatSync9(source);
258635
+ const stats = lstatSync10(source);
258578
258636
  if (stats.isSymbolicLink())
258579
258637
  throw new Error("Extension directories cannot contain symlinks.");
258580
258638
  if (stats.isDirectory()) {
@@ -258612,7 +258670,7 @@ function hashDirectory2(root) {
258612
258670
  const visit = (directory) => {
258613
258671
  for (const entry of readdirSync10(directory).sort()) {
258614
258672
  const path6 = join26(directory, entry);
258615
- const stats = lstatSync9(path6);
258673
+ const stats = lstatSync10(path6);
258616
258674
  const name = relative6(root, path6).replace(/\\/g, "/");
258617
258675
  hash2.update(name);
258618
258676
  if (stats.isDirectory()) visit(path6);
@@ -258882,7 +258940,7 @@ program.command("trace").description("export a redacted, versioned session audit
258882
258940
  program.command("lsp").description("start the local LSP autocomplete server").action(async () => {
258883
258941
  await runLSPServer(process.cwd());
258884
258942
  });
258885
- 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) => {
258886
258944
  const options = command.optsWithGlobals();
258887
258945
  const rawPort = localOptions.port;
258888
258946
  const port = rawPort === void 0 ? void 0 : Number(rawPort);
@@ -258907,7 +258965,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
258907
258965
  }
258908
258966
  const cwd = realpathSync4.native(requestedCwd);
258909
258967
  const outcome = await runAgent(cwd, void 0, overrides, false, {
258910
- webUi: { port, open: localOptions.open !== false }
258968
+ webUi: { port }
258911
258969
  });
258912
258970
  applyOutcomeExitCode(outcome);
258913
258971
  });