@orbit-build/cli 1.6.5 → 1.6.7

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.
package/dist/index.js CHANGED
@@ -238108,7 +238108,7 @@ import picocolors36 from "picocolors";
238108
238108
  // ../shared/dist/index.js
238109
238109
  import { randomUUID } from "crypto";
238110
238110
  import { dirname, isAbsolute, normalize, relative, resolve } from "path";
238111
- import { execSync as execSync2 } from "child_process";
238111
+ import { execSync } from "child_process";
238112
238112
  import { existsSync, realpathSync } from "fs";
238113
238113
  import { readFileSync } from "fs";
238114
238114
  import { z } from "zod";
@@ -238357,7 +238357,7 @@ function getGitBranch(cwd) {
238357
238357
  return "";
238358
238358
  }
238359
238359
  try {
238360
- const branch = execSync2("git rev-parse --abbrev-ref HEAD", {
238360
+ const branch = execSync("git rev-parse --abbrev-ref HEAD", {
238361
238361
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
238362
238362
  cwd,
238363
238363
  stdio: ["ignore", "pipe", "ignore"],
@@ -242619,7 +242619,7 @@ function runConfig(cwd) {
242619
242619
  }
242620
242620
 
242621
242621
  // src/commands/doctor.ts
242622
- import { execSync as execSync3 } from "child_process";
242622
+ import { execSync as execSync2 } from "child_process";
242623
242623
  import { existsSync as existsSync14 } from "fs";
242624
242624
  import { basename as basename5, join as join12 } from "path";
242625
242625
  import picocolors6 from "picocolors";
@@ -247529,6 +247529,7 @@ import { createHash as createHash5, createPublicKey as createPublicKey3, verify
247529
247529
  import { existsSync as existsSync33, lstatSync as lstatSync32, readFileSync as readFileSync2 } from "fs";
247530
247530
  import { dirname as dirname22, resolve as resolve23, win32 } from "path";
247531
247531
  import { z as z24 } from "zod";
247532
+ import { posix } from "path";
247532
247533
  var SafePathSegmentSchema = z13.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/);
247533
247534
  var CheckpointIdSchema = z13.string().regex(/^cp_[a-f0-9]{32}$/);
247534
247535
  var PersistedCheckpointMetadataSchema = z13.object({
@@ -248300,6 +248301,200 @@ function isSensitiveSnapshotPath(filePath) {
248300
248301
  function toErrorMessage2(error) {
248301
248302
  return error instanceof Error ? error.message : String(error);
248302
248303
  }
248304
+ var MACOS_RUNTIME_BASE_POLICY = String.raw`
248305
+ (version 1)
248306
+ (deny default)
248307
+
248308
+ (allow process-exec)
248309
+ (allow process-fork)
248310
+ (allow signal (target same-sandbox))
248311
+ (allow process-info* (target same-sandbox))
248312
+
248313
+ (allow sysctl-read)
248314
+ (allow sysctl-write (sysctl-name "kern.grade_cputype"))
248315
+ (allow system-mac-syscall (mac-policy-name "vnguard"))
248316
+ (allow system-mac-syscall
248317
+ (require-all
248318
+ (mac-policy-name "Sandbox")
248319
+ (mac-syscall-number 67)))
248320
+
248321
+ (allow iokit-open
248322
+ (iokit-registry-entry-class "RootDomainUserClient"))
248323
+
248324
+ (allow ipc-posix-sem)
248325
+ (allow ipc-posix-shm-read-data
248326
+ ipc-posix-shm-write-create
248327
+ ipc-posix-shm-write-unlink
248328
+ (ipc-posix-name-regex #"^/__KMP_REGISTERED_LIB_[0-9]+$"))
248329
+ (allow ipc-posix-shm-read*
248330
+ (ipc-posix-name-prefix "apple.cfprefs."))
248331
+ (allow ipc-posix-shm-read*
248332
+ (ipc-posix-name "apple.shm.notification_center"))
248333
+
248334
+ (allow mach-lookup
248335
+ (global-name "com.apple.PowerManagement.control")
248336
+ (global-name "com.apple.analyticsd")
248337
+ (global-name "com.apple.analyticsd.messagetracer")
248338
+ (global-name "com.apple.appsleep")
248339
+ (global-name "com.apple.bsd.dirhelper")
248340
+ (global-name "com.apple.cfprefsd.agent")
248341
+ (global-name "com.apple.cfprefsd.daemon")
248342
+ (global-name "com.apple.diagnosticd")
248343
+ (global-name "com.apple.dt.automationmode.reader")
248344
+ (global-name "com.apple.espd")
248345
+ (global-name "com.apple.logd")
248346
+ (global-name "com.apple.logd.events")
248347
+ (global-name "com.apple.runningboard")
248348
+ (global-name "com.apple.secinitd")
248349
+ (global-name "com.apple.system.DirectoryService.libinfo_v1")
248350
+ (global-name "com.apple.system.logger")
248351
+ (global-name "com.apple.system.notification_center")
248352
+ (global-name "com.apple.system.opendirectoryd.libinfo")
248353
+ (global-name "com.apple.system.opendirectoryd.membership")
248354
+ (global-name "com.apple.trustd")
248355
+ (global-name "com.apple.trustd.agent")
248356
+ (global-name "com.apple.xpc.activity.unmanaged")
248357
+ (local-name "com.apple.cfprefsd.agent"))
248358
+ (allow user-preference-read)
248359
+
248360
+ (allow pseudo-tty)
248361
+ (allow file-read* file-write* file-ioctl (literal "/dev/ptmx"))
248362
+ (allow file-read* file-write*
248363
+ (require-all
248364
+ (regex #"^/dev/ttys[0-9]+")
248365
+ (extension "com.apple.sandbox.pty")))
248366
+ (allow file-ioctl (regex #"^/dev/ttys[0-9]+"))
248367
+ `;
248368
+ var MACOS_PLATFORM_FILESYSTEM_POLICY = String.raw`
248369
+ (allow file-read* file-test-existence
248370
+ (subpath "/Library/Apple")
248371
+ (subpath "/Library/Filesystems/NetFSPlugins")
248372
+ (subpath "/Library/Preferences")
248373
+ (subpath "/Library/Preferences/Logging")
248374
+ (subpath "/private/var/db")
248375
+ (subpath "/usr/lib")
248376
+ (subpath "/usr/share")
248377
+ (subpath "/var/db"))
248378
+
248379
+ (allow file-map-executable
248380
+ (subpath "/Library/Apple/System/Library/Frameworks")
248381
+ (subpath "/Library/Apple/System/Library/PrivateFrameworks")
248382
+ (subpath "/Library/Apple/usr/lib")
248383
+ (subpath "/System/Library/Extensions")
248384
+ (subpath "/System/Library/Frameworks")
248385
+ (subpath "/System/Library/PrivateFrameworks")
248386
+ (subpath "/System/Library/SubFrameworks")
248387
+ (subpath "/System/iOSSupport/System/Library/Frameworks")
248388
+ (subpath "/System/iOSSupport/System/Library/PrivateFrameworks")
248389
+ (subpath "/System/iOSSupport/System/Library/SubFrameworks")
248390
+ (subpath "/usr/lib"))
248391
+
248392
+ (allow file-read-metadata file-test-existence
248393
+ (literal "/etc")
248394
+ (literal "/tmp")
248395
+ (literal "/var")
248396
+ (literal "/private/etc/localtime"))
248397
+ (allow file-read-metadata file-test-existence
248398
+ (path-ancestors "/System/Volumes/Data/private"))
248399
+ (allow file-read* file-test-existence (literal "/"))
248400
+
248401
+ (allow file-read* file-test-existence
248402
+ (literal "/dev/autofs_nowait")
248403
+ (literal "/dev/random")
248404
+ (literal "/dev/urandom")
248405
+ (literal "/private/etc/master.passwd")
248406
+ (literal "/private/etc/passwd")
248407
+ (literal "/private/etc/protocols")
248408
+ (literal "/private/etc/services"))
248409
+ (allow file-read* file-test-existence file-write-data
248410
+ (literal "/dev/null")
248411
+ (literal "/dev/zero"))
248412
+ (allow file-read-data file-test-existence file-write-data
248413
+ (subpath "/dev/fd"))
248414
+ (allow file-read* file-test-existence file-write-data file-ioctl
248415
+ (literal "/dev/dtracehelper"))
248416
+
248417
+ (allow file-read* file-test-existence file-write* (subpath "/tmp"))
248418
+ (allow file-read* file-test-existence file-write* (subpath "/private/tmp"))
248419
+ (allow file-read* file-test-existence file-write* (subpath "/var/tmp"))
248420
+ (allow file-read* file-test-existence file-write* (subpath "/private/var/tmp"))
248421
+
248422
+ (allow file-read* (subpath "/etc"))
248423
+ (allow file-read* (subpath "/private/etc"))
248424
+ (allow file-read-metadata (subpath "/var"))
248425
+ (allow file-read-metadata (subpath "/private/var"))
248426
+
248427
+ (allow file-read-data file-read-metadata (subpath "/bin"))
248428
+ (allow file-read-data file-read-metadata (subpath "/sbin"))
248429
+ (allow file-read-data file-read-metadata (subpath "/usr/bin"))
248430
+ (allow file-read-data file-read-metadata (subpath "/usr/sbin"))
248431
+ (allow file-read-data file-read-metadata (subpath "/usr/libexec"))
248432
+ (allow file-read* (subpath "/opt/homebrew/lib"))
248433
+ (allow file-read* (subpath "/usr/local/lib"))
248434
+
248435
+ (allow file-read* (regex #"^/dev/fd/(0|1|2)$"))
248436
+ (allow file-write* (regex #"^/dev/fd/(1|2)$"))
248437
+ (allow file-read* file-write* (literal "/dev/tty"))
248438
+ (allow file-read-metadata (literal "/dev"))
248439
+ (allow file-read-metadata (regex #"^/dev/.*$"))
248440
+ (allow file-read-metadata (literal "/dev/stdin"))
248441
+ (allow file-read-metadata (literal "/dev/stdout"))
248442
+ (allow file-read-metadata (literal "/dev/stderr"))
248443
+ (allow file-read-metadata (regex #"^/dev/tty[^/]*$"))
248444
+ (allow file-read-metadata (regex #"^/dev/pty[^/]*$"))
248445
+
248446
+ (allow file-read-metadata (literal "/System/Volumes") (vnode-type DIRECTORY))
248447
+ (allow file-read-metadata (literal "/System/Volumes/Data") (vnode-type DIRECTORY))
248448
+ (allow file-read-metadata (literal "/System/Volumes/Data/Users") (vnode-type DIRECTORY))
248449
+
248450
+ (allow file-read* (extension "com.apple.app-sandbox.read"))
248451
+ (allow file-read* file-write* (extension "com.apple.app-sandbox.read-write"))
248452
+ `;
248453
+ var SYSTEM_READABLE_ROOTS = ["/System", "/usr", "/bin", "/sbin", "/dev"];
248454
+ function createMacOsSeatbeltProfile(options) {
248455
+ const runtimeRoots = macOsRuntimeReadOnlyRoots(
248456
+ options.invocation.file,
248457
+ options.environment
248458
+ );
248459
+ const readableRoots = /* @__PURE__ */ new Set([
248460
+ ...SYSTEM_READABLE_ROOTS,
248461
+ options.cwd,
248462
+ ...options.writableRoots,
248463
+ ...options.readOnlyRoots,
248464
+ ...runtimeRoots
248465
+ ]);
248466
+ const lines = [
248467
+ MACOS_RUNTIME_BASE_POLICY.trim(),
248468
+ MACOS_PLATFORM_FILESYSTEM_POLICY.trim(),
248469
+ options.network === "deny" ? "(deny network*)" : "(allow network*)"
248470
+ ];
248471
+ for (const root of readableRoots) {
248472
+ const value = profileString(root);
248473
+ lines.push(
248474
+ `(allow file-read* file-test-existence (subpath ${value}))`,
248475
+ `(allow file-read-metadata file-test-existence (path-ancestors ${value}))`
248476
+ );
248477
+ }
248478
+ for (const root of runtimeRoots) {
248479
+ lines.push(`(allow file-map-executable (subpath ${profileString(root)}))`);
248480
+ }
248481
+ for (const root of options.writableRoots) {
248482
+ lines.push(`(allow file-write* (subpath ${profileString(root)}))`);
248483
+ }
248484
+ return lines.join("\n");
248485
+ }
248486
+ function macOsRuntimeReadOnlyRoots(command, environment) {
248487
+ const roots = [];
248488
+ if (posix.isAbsolute(command)) roots.push(posix.dirname(command));
248489
+ for (const candidate of (environment.PATH ?? "").split(":")) {
248490
+ if (!candidate || !posix.isAbsolute(candidate)) continue;
248491
+ if (!roots.includes(candidate)) roots.push(candidate);
248492
+ }
248493
+ return roots;
248494
+ }
248495
+ function profileString(value) {
248496
+ return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
248497
+ }
248303
248498
  var ProcessSandboxModeSchema = z24.enum(["off", "auto", "required"]);
248304
248499
  var ProcessSandboxNetworkSchema = z24.enum(["inherit", "deny", "allow"]);
248305
248500
  var ProcessSandboxBackendSchema = z24.enum([
@@ -248420,15 +248615,17 @@ function sandboxInvocation(invocation, request) {
248420
248615
  const selected = capabilities.selectedBackend;
248421
248616
  if (selected === "macos-sandbox-exec") {
248422
248617
  const executable2 = request.environment?.ORBIT_SANDBOX_EXEC_PATH ?? "/usr/bin/sandbox-exec";
248423
- const profile = createMacOsProfile(
248618
+ const profile = createMacOsSeatbeltProfile({
248619
+ invocation,
248424
248620
  cwd,
248425
248621
  writableRoots,
248426
248622
  readOnlyRoots,
248427
- network
248428
- );
248623
+ network,
248624
+ environment: request.environment ?? process.env
248625
+ });
248429
248626
  return {
248430
248627
  file: executable2,
248431
- args: ["-p", profile, invocation.file, ...invocation.args],
248628
+ args: ["-p", profile, "--", invocation.file, ...invocation.args],
248432
248629
  backend: selected,
248433
248630
  networkIsolation: network === "deny",
248434
248631
  degraded: false
@@ -248576,32 +248773,6 @@ function verifyWindowsSandboxHelper(options) {
248576
248773
  return void 0;
248577
248774
  }
248578
248775
  }
248579
- function createMacOsProfile(cwd, writableRoots, readOnlyRoots, network) {
248580
- const readable2 = [
248581
- "/System",
248582
- "/usr",
248583
- "/bin",
248584
- "/sbin",
248585
- "/private/tmp",
248586
- "/dev",
248587
- cwd,
248588
- ...writableRoots,
248589
- ...readOnlyRoots
248590
- ];
248591
- const lines = ["(version 1)", "(deny default)", "(allow process*)"];
248592
- if (network === "deny") {
248593
- lines.push("(deny network*)");
248594
- } else {
248595
- lines.push("(allow network*)");
248596
- }
248597
- for (const root of new Set(readable2)) {
248598
- lines.push(`(allow file-read* (subpath ${profileString(root)}))`);
248599
- }
248600
- for (const root of writableRoots) {
248601
- lines.push(`(allow file-write* (subpath ${profileString(root)}))`);
248602
- }
248603
- return lines.join(" ");
248604
- }
248605
248776
  function createBubblewrapArgs(invocation, cwd, writableRoots, readOnlyRoots, network) {
248606
248777
  const args = [
248607
248778
  "--die-with-parent",
@@ -248637,9 +248808,6 @@ function runtimeReadOnlyRoots(command) {
248637
248808
  }
248638
248809
  return roots;
248639
248810
  }
248640
- function profileString(value) {
248641
- return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
248642
- }
248643
248811
 
248644
248812
  // src/runtime/CacheDiagnostics.ts
248645
248813
  import { existsSync as existsSync13, readdirSync as readdirSync7 } from "fs";
@@ -253124,13 +253292,26 @@ var PROCESS_OUTPUT_MAX_BYTES = 8 * 1024 * 1024;
253124
253292
  function safeProcessFailureMessage(message2) {
253125
253293
  return redactSecrets(message2).replace(/[\r\n]+/g, " ").slice(0, 2e3);
253126
253294
  }
253127
- function readProcessFailureMessage(result) {
253295
+ function readProcessFailureMessage(result, context = {}) {
253296
+ const message2 = rawProcessFailureMessage(result);
253297
+ if (context.sandboxBackend === "macos-sandbox-exec" && message2.includes("sandbox-exec -p")) {
253298
+ const signal = message2.match(/\bSIG[A-Z0-9]+\b/)?.[0];
253299
+ return signal ? `The macOS sandboxed process was terminated by ${signal}.` : "The macOS sandboxed process failed before command completion.";
253300
+ }
253301
+ return safeProcessFailureMessage(message2);
253302
+ }
253303
+ function processOutputLimitExceeded(result) {
253304
+ if (typeof result !== "object" || result === null) return false;
253305
+ const record2 = result;
253306
+ return record2.isMaxBuffer === true || /maxBuffer exceeded/i.test(rawProcessFailureMessage(result));
253307
+ }
253308
+ function rawProcessFailureMessage(result) {
253128
253309
  if (typeof result !== "object" || result === null) {
253129
253310
  return "The child process failed.";
253130
253311
  }
253131
253312
  const record2 = result;
253132
253313
  const message2 = typeof record2.shortMessage === "string" ? record2.shortMessage : typeof record2.message === "string" ? record2.message : "The child process failed.";
253133
- return safeProcessFailureMessage(message2);
253314
+ return message2;
253134
253315
  }
253135
253316
  function firstExistingPath(candidates, pathExists = existsSync7) {
253136
253317
  for (const candidate of candidates) {
@@ -253292,8 +253473,10 @@ var BashTool = class {
253292
253473
  error: "Command execution was interrupted by the user."
253293
253474
  };
253294
253475
  }
253295
- const failureMessage = readProcessFailureMessage(result);
253296
- const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
253476
+ const failureMessage = readProcessFailureMessage(result, {
253477
+ sandboxBackend: sandboxed.backend
253478
+ });
253479
+ const outputLimitExceeded = result.failed && processOutputLimitExceeded(result);
253297
253480
  const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
253298
253481
  const displayStdout = redactSecrets(
253299
253482
  LogTruncator.truncate(stdout2, 150, 2e4)
@@ -253465,8 +253648,10 @@ var RunTestsTool = class {
253465
253648
  error: "Test execution was interrupted by the user."
253466
253649
  };
253467
253650
  }
253468
- const failureMessage = readProcessFailureMessage(result);
253469
- const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
253651
+ const failureMessage = readProcessFailureMessage(result, {
253652
+ sandboxBackend: sandboxed.backend
253653
+ });
253654
+ const outputLimitExceeded = result.failed && processOutputLimitExceeded(result);
253470
253655
  const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
253471
253656
  const terminalSuccess = detectTrustedTerminalSuccess(
253472
253657
  testCommand,
@@ -259028,7 +259213,7 @@ import http from "http";
259028
259213
  import { createHash as createHash32 } from "crypto";
259029
259214
  var MAX_MCP_INPUT_SCHEMA_BYTES = 256 * 1024;
259030
259215
  var MAX_VALIDATION_ERRORS = 12;
259031
- var ajv = new import_ajv.default({
259216
+ var ajv = new import_ajv.Ajv({
259032
259217
  allErrors: true,
259033
259218
  strict: false,
259034
259219
  allowUnionTypes: true,
@@ -267059,7 +267244,9 @@ function generateXMLToolsPrompt(tools) {
267059
267244
  for (const tool of tools) {
267060
267245
  lines.push(`- **${tool.name}**: ${tool.description}`, " Parameters:");
267061
267246
  if (tool.inputSchema instanceof z55.ZodObject) {
267062
- for (const [key, property] of Object.entries(tool.inputSchema.shape)) {
267247
+ for (const [key, property] of Object.entries(
267248
+ tool.inputSchema.shape
267249
+ )) {
267063
267250
  const field = describeZodPromptField(property);
267064
267251
  const values = field.values ? `, values: ${field.values}` : "";
267065
267252
  const description = field.description ? ` - ${field.description.replace(/\s+/g, " ").trim()}` : "";
@@ -267266,7 +267453,11 @@ function resolveLocalPackageBinary(cwd, packageName, binaryName) {
267266
267453
  }
267267
267454
  function resolveManifestBinary(bin, binaryName) {
267268
267455
  if (typeof bin === "string") return bin;
267269
- return bin?.[binaryName];
267456
+ if (typeof bin !== "object" || bin === null || Array.isArray(bin)) {
267457
+ return void 0;
267458
+ }
267459
+ const candidate = bin[binaryName];
267460
+ return typeof candidate === "string" ? candidate : void 0;
267270
267461
  }
267271
267462
  function isValidPackageName(packageName) {
267272
267463
  if (packageName.length === 0 || packageName.length > 214) return false;
@@ -275214,41 +275405,53 @@ function createProviderFromConfig(config) {
275214
275405
  modelCapabilities: pConfig.modelCapabilities,
275215
275406
  apiKeyResolver: () => pConfig.apiKey
275216
275407
  };
275217
- if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && isOfficialDeepSeekApi(pConfig.baseUrl)) {
275218
- return new DeepSeekProvider(void 0, pConfig.baseUrl, providerOptions);
275408
+ const baseUrl = pConfig.baseUrl;
275409
+ if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && baseUrl !== void 0 && isOfficialDeepSeekApi(baseUrl)) {
275410
+ return new DeepSeekProvider(
275411
+ void 0,
275412
+ baseUrl ?? "https://api.deepseek.com",
275413
+ providerOptions
275414
+ );
275219
275415
  }
275220
275416
  if (pConfig.type === "anthropic-compatible") {
275221
275417
  return new AnthropicCompatibleProvider(
275222
275418
  void 0,
275223
- pConfig.baseUrl,
275419
+ baseUrl ?? "https://api.anthropic.com",
275224
275420
  providerOptions
275225
275421
  );
275226
275422
  }
275227
275423
  if (pConfig.type === "openai-compatible") {
275228
275424
  const generic = new OpenAICompatibleProvider(
275229
275425
  void 0,
275230
- pConfig.baseUrl,
275426
+ baseUrl ?? "https://api.openai.com/v1",
275231
275427
  providerOptions
275232
275428
  );
275233
275429
  const deepSeek = new DeepSeekProvider(
275234
275430
  void 0,
275235
- pConfig.baseUrl,
275431
+ baseUrl ?? "https://api.openai.com/v1",
275236
275432
  providerOptions
275237
275433
  );
275238
275434
  return new ModelAwareProvider(generic, deepSeek);
275239
275435
  }
275240
275436
  if (pConfig.type === "openai") {
275241
- return new OpenAIProvider(pConfig.apiKey, pConfig.baseUrl, providerOptions);
275437
+ return new OpenAIProvider(
275438
+ pConfig.apiKey,
275439
+ baseUrl ?? "https://api.openai.com/v1",
275440
+ providerOptions
275441
+ );
275242
275442
  }
275243
275443
  if (pConfig.type === "anthropic") {
275244
275444
  return new AnthropicProvider(
275245
275445
  pConfig.apiKey,
275246
- pConfig.baseUrl,
275446
+ baseUrl ?? "https://api.anthropic.com",
275247
275447
  providerOptions
275248
275448
  );
275249
275449
  }
275250
275450
  if (pConfig.type === "ollama") {
275251
- return new OllamaProvider(pConfig.baseUrl, providerOptions);
275451
+ return new OllamaProvider(
275452
+ pConfig.baseUrl ?? "http://localhost:11434",
275453
+ providerOptions
275454
+ );
275252
275455
  }
275253
275456
  throw new Error(`Unsupported provider type "${pConfig.type}".`);
275254
275457
  }
@@ -275367,7 +275570,7 @@ var DoctorSnapshotSchema = z48.object({
275367
275570
  issues: z48.array(DoctorIssueSchema)
275368
275571
  });
275369
275572
  function defaultExec(command, options = {}) {
275370
- return execSync3(command, {
275573
+ return execSync2(command, {
275371
275574
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
275372
275575
  encoding: "utf8",
275373
275576
  stdio: ["ignore", "pipe", "ignore"],
@@ -281837,16 +282040,17 @@ var FullscreenTui = class {
281837
282040
  const loopMsg = loopAsst[i2];
281838
282041
  const textBlock = loopMsg.content.find((block2) => block2.type === "text");
281839
282042
  if (textBlock && textBlock.text) {
282043
+ const model = typeof loopMsg.metadata?.model === "string" ? loopMsg.metadata.model : void 0;
281840
282044
  const localIdx = localAsstIdx[i2];
281841
282045
  if (localIdx !== void 0) {
281842
282046
  this.history[localIdx].text = textBlock.text;
281843
- this.history[localIdx].model = loopMsg.metadata?.model;
282047
+ this.history[localIdx].model = model;
281844
282048
  } else {
281845
282049
  this.history.push({
281846
282050
  role: "assistant",
281847
282051
  text: textBlock.text,
281848
282052
  attempt: i2 + 1,
281849
- model: loopMsg.metadata?.model
282053
+ model
281850
282054
  });
281851
282055
  }
281852
282056
  }
@@ -281869,11 +282073,12 @@ var FullscreenTui = class {
281869
282073
  } else if (msg.role === "assistant") {
281870
282074
  attempt++;
281871
282075
  const textBlock = msg.content.find((block2) => block2.type === "text");
282076
+ const model = typeof msg.metadata?.model === "string" ? msg.metadata.model : void 0;
281872
282077
  this.history.push({
281873
282078
  role: "assistant",
281874
282079
  text: textBlock?.text || "",
281875
282080
  attempt,
281876
- model: msg.metadata?.model
282081
+ model
281877
282082
  });
281878
282083
  } else if (msg.role === "system") {
281879
282084
  const text2 = msg.content.map((content) => content.type === "text" ? content.text : "").join("");
@@ -283192,9 +283397,6 @@ function stripQuotes(value) {
283192
283397
  return value.length >= 2 && value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
283193
283398
  }
283194
283399
 
283195
- // src/runtime/CommandRouter.ts
283196
- import { execFileSync as execFileSync8 } from "child_process";
283197
-
283198
283400
  // src/runtime/webui/WebUiRuntime.ts
283199
283401
  import http2 from "http";
283200
283402
  import { randomBytes as randomBytes4, randomUUID as randomUUID10 } from "crypto";
@@ -290017,10 +290219,11 @@ function safeWebMessage(error) {
290017
290219
  function summarizeWebToolValue(value, options = {}) {
290018
290220
  let candidate = value;
290019
290221
  if (typeof candidate === "string") {
290222
+ const rawText = candidate;
290020
290223
  try {
290021
- candidate = JSON.parse(candidate);
290224
+ candidate = JSON.parse(rawText);
290022
290225
  } catch {
290023
- return options.allowPlainText ? safeWebToolText(candidate, 700) : "";
290226
+ return options.allowPlainText ? safeWebToolText(rawText, 700) : "";
290024
290227
  }
290025
290228
  }
290026
290229
  if (!isRecord7(candidate)) return "";
@@ -290325,16 +290528,17 @@ function collectWebUiStatus(options, activeTurn) {
290325
290528
  lastOpenedAt: typeof project.lastOpenedAt === "string" ? project.lastOpenedAt.slice(0, 64) : "",
290326
290529
  available: project.available === true
290327
290530
  }));
290531
+ const taskStatus = activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready";
290328
290532
  const agentRuns = summarizeWebUiAgentRuns(
290329
290533
  safeCall(() => options.getAgentRuns?.()) || []
290330
290534
  );
290331
- return {
290535
+ const snapshot = {
290332
290536
  language: config.language,
290333
290537
  workspace: cwd,
290334
290538
  projects,
290335
290539
  agentRuns,
290336
290540
  task: {
290337
- status: activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready",
290541
+ status: taskStatus,
290338
290542
  reason: approval?.reason || ""
290339
290543
  },
290340
290544
  agentTeam: {
@@ -290463,6 +290667,7 @@ function collectWebUiStatus(options, activeTurn) {
290463
290667
  cacheDiagnostics: redactSecrets(stripAnsi3(buildCacheDiagnostics(cwd))),
290464
290668
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
290465
290669
  };
290670
+ return snapshot;
290466
290671
  }
290467
290672
  function summarizeWebUiBackgroundTasks(value) {
290468
290673
  const statuses = /* @__PURE__ */ new Set([
@@ -290486,8 +290691,15 @@ function summarizeWebUiBackgroundTasks(value) {
290486
290691
  })).filter((task) => task.id);
290487
290692
  }
290488
290693
  function summarizeWebUiInputQueue(value) {
290489
- const modes = /* @__PURE__ */ new Set(["follow_up", "steer"]);
290490
- const sources = /* @__PURE__ */ new Set(["terminal", "web", "api"]);
290694
+ const modes = /* @__PURE__ */ new Set([
290695
+ "follow_up",
290696
+ "steer"
290697
+ ]);
290698
+ const sources = /* @__PURE__ */ new Set([
290699
+ "terminal",
290700
+ "web",
290701
+ "api"
290702
+ ]);
290491
290703
  return (Array.isArray(value) ? value : []).filter(isRecord9).slice(0, 12).map((item) => ({
290492
290704
  id: safeLabel(typeof item.id === "string" ? item.id : "", 200),
290493
290705
  mode: typeof item.mode === "string" && modes.has(item.mode) ? item.mode : "follow_up",
@@ -303312,6 +303524,41 @@ function normalizeCommitMessage(message2) {
303312
303524
  ) ? subject : `chore: ${subject}`.slice(0, MAX_COMMIT_SUBJECT_LENGTH).trim();
303313
303525
  }
303314
303526
 
303527
+ // src/runtime/Clipboard.ts
303528
+ import { execFileSync as execFileSync8 } from "child_process";
303529
+ var DEFAULT_RUNTIME = {
303530
+ platform: process.platform,
303531
+ execute(executable, args, input) {
303532
+ execFileSync8(executable, [...args], {
303533
+ ...HIDDEN_CHILD_PROCESS_OPTIONS,
303534
+ input
303535
+ });
303536
+ }
303537
+ };
303538
+ function copyTextToClipboard(text2, runtime = DEFAULT_RUNTIME) {
303539
+ const candidates = clipboardCandidates(runtime.platform);
303540
+ for (const candidate of candidates) {
303541
+ try {
303542
+ runtime.execute(candidate.executable, candidate.args, text2);
303543
+ return true;
303544
+ } catch (error) {
303545
+ void redactSecrets(
303546
+ error instanceof Error ? error.message : String(error)
303547
+ );
303548
+ }
303549
+ }
303550
+ return false;
303551
+ }
303552
+ function clipboardCandidates(platform) {
303553
+ if (platform === "win32") return [{ executable: "clip", args: [] }];
303554
+ if (platform === "darwin") return [{ executable: "pbcopy", args: [] }];
303555
+ return [
303556
+ { executable: "xclip", args: ["-selection", "clipboard"] },
303557
+ { executable: "xsel", args: ["-ib"] },
303558
+ { executable: "wl-copy", args: [] }
303559
+ ];
303560
+ }
303561
+
303315
303562
  // src/runtime/CommandRouter.ts
303316
303563
  function stripAnsi4(value) {
303317
303564
  return value.replace(/\u001b\[[0-9;]*m/g, "");
@@ -304198,16 +304445,16 @@ var CommandRouter = class {
304198
304445
  if (command === "/commit") {
304199
304446
  const commitMsg = parts.slice(1).join(" ").trim();
304200
304447
  const isZh = config.language !== "en";
304201
- const { execFileSync: execFileSync10, execSync: execSync4 } = await import("child_process");
304448
+ const { execFileSync: execFileSync10, execSync: execSync3 } = await import("child_process");
304202
304449
  const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
304203
304450
  try {
304204
- let diff = execSync4("git diff --cached", {
304451
+ let diff = execSync3("git diff --cached", {
304205
304452
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304206
304453
  cwd,
304207
304454
  env: childEnvironment
304208
304455
  }).toString().trim();
304209
304456
  if (!diff) {
304210
- const unstaged = execSync4("git status --porcelain", {
304457
+ const unstaged = execSync3("git status --porcelain", {
304211
304458
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304212
304459
  cwd,
304213
304460
  env: childEnvironment
@@ -304234,12 +304481,12 @@ var CommandRouter = class {
304234
304481
  this.printOutput(
304235
304482
  isZh ? "\u6B63\u5728\u6682\u5B58\u6240\u6709\u53D8\u66F4..." : "Staging all changes..."
304236
304483
  );
304237
- execSync4("git add -A", {
304484
+ execSync3("git add -A", {
304238
304485
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304239
304486
  cwd,
304240
304487
  env: childEnvironment
304241
304488
  });
304242
- diff = execSync4("git diff --cached", {
304489
+ diff = execSync3("git diff --cached", {
304243
304490
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304244
304491
  cwd,
304245
304492
  env: childEnvironment
@@ -305333,49 +305580,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
305333
305580
  }
305334
305581
  }
305335
305582
  copyToClipboard(text2) {
305336
- try {
305337
- if (process.platform === "win32") {
305338
- execFileSync8("clip", [], {
305339
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305340
- input: text2
305341
- });
305342
- return true;
305343
- } else if (process.platform === "darwin") {
305344
- execFileSync8("pbcopy", [], {
305345
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305346
- input: text2
305347
- });
305348
- return true;
305349
- } else {
305350
- try {
305351
- execFileSync8("xclip", ["-selection", "clipboard"], {
305352
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305353
- input: text2
305354
- });
305355
- return true;
305356
- } catch {
305357
- try {
305358
- execFileSync8("xsel", ["-ib"], {
305359
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305360
- input: text2
305361
- });
305362
- return true;
305363
- } catch {
305364
- try {
305365
- execSync("wl-copy", {
305366
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305367
- input: text2
305368
- });
305369
- return true;
305370
- } catch {
305371
- return false;
305372
- }
305373
- }
305374
- }
305375
- }
305376
- } catch {
305377
- return false;
305378
- }
305583
+ return copyTextToClipboard(text2);
305379
305584
  }
305380
305585
  };
305381
305586
  function validateImageAttachments(model, capabilities, attachments) {
@@ -306674,7 +306879,7 @@ Risk Warning: ${reason}`);
306674
306879
  providerInstance,
306675
306880
  interaction,
306676
306881
  multi,
306677
- !!cliOverrides?.direct,
306882
+ isDirectRun(cliOverrides),
306678
306883
  options?.webUi,
306679
306884
  selectedProfile
306680
306885
  );
@@ -306743,6 +306948,9 @@ Risk Warning: ${reason}`);
306743
306948
  cleanupJsonl();
306744
306949
  }
306745
306950
  }
306951
+ function isDirectRun(value) {
306952
+ return typeof value === "object" && value !== null && !Array.isArray(value) && value.direct === true;
306953
+ }
306746
306954
  function exitCodeForOutcome(outcome) {
306747
306955
  if (!outcome || outcome.status === "completed") return 0;
306748
306956
  if (outcome.status === "aborted") return 130;
@@ -313248,16 +313456,21 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313248
313456
  if (action === "verify") {
313249
313457
  const selected = artifactName ? artifacts.filter((item) => item.name === validateName(artifactName)) : artifacts;
313250
313458
  const blockedFindings = selected.flatMap(
313251
- ({ name, value }) => value.findings.filter(
313252
- (finding2) => (finding2.severity === "P0" || finding2.severity === "P1") && finding2.disposition === "open"
313253
- ).map((finding2) => ({
313254
- artifact: name,
313255
- id: finding2.id,
313256
- severity: finding2.severity,
313257
- file: finding2.file,
313258
- line: finding2.line,
313259
- title: finding2.title
313260
- }))
313459
+ ({ name, value }) => value.findings.flatMap((finding2) => {
313460
+ if (finding2.severity !== "P0" && finding2.severity !== "P1" || finding2.disposition !== "open") {
313461
+ return [];
313462
+ }
313463
+ return [
313464
+ {
313465
+ artifact: name,
313466
+ id: finding2.id,
313467
+ severity: finding2.severity,
313468
+ file: finding2.file,
313469
+ line: finding2.line,
313470
+ title: finding2.title
313471
+ }
313472
+ ];
313473
+ })
313261
313474
  );
313262
313475
  const result = {
313263
313476
  ok: blockedFindings.length === 0,
@@ -313300,7 +313513,8 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313300
313513
  if (!artifact)
313301
313514
  return fail(`Review artifact not found: ${safeName}`, options);
313302
313515
  if (action === "show") {
313303
- emit(options.json ? artifact : [artifact], options.json === true);
313516
+ if (options.json) emit(artifact, true);
313517
+ else emit([{ name: safeName, value: artifact }], false);
313304
313518
  return 0;
313305
313519
  }
313306
313520
  const nextDisposition = options.disposition;
@@ -313471,6 +313685,12 @@ function emit(value, json) {
313471
313685
  console.log(JSON.stringify({ schemaVersion: 1, reviews: value }, null, 2));
313472
313686
  return;
313473
313687
  }
313688
+ if ("artifact" in value) {
313689
+ console.log(
313690
+ `\u2714 ${value.artifact}:${value.findingId} ${value.previousDisposition} \u2192 ${value.disposition}`
313691
+ );
313692
+ return;
313693
+ }
313474
313694
  if (!Array.isArray(value)) {
313475
313695
  console.log(picocolors28.bold(`
313476
313696
  ${value.perspective} \xB7 ${value.verdict}
@@ -314231,10 +314451,7 @@ var InputsSchema = z89.record(
314231
314451
  ).default({}).superRefine((value, context) => {
314232
314452
  if (Object.keys(value).length > MAX_INPUTS) {
314233
314453
  context.addIssue({
314234
- code: z89.ZodIssueCode.too_big,
314235
- type: "object",
314236
- maximum: MAX_INPUTS,
314237
- inclusive: true,
314454
+ code: z89.ZodIssueCode.custom,
314238
314455
  path: [],
314239
314456
  message: `Workflow dispatch accepts at most ${MAX_INPUTS} inputs.`
314240
314457
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
6
6
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  interface:
2
- display_name: "CUMCM Draft"
2
+ display_name: "cumcm-draft"
3
3
  short_description: "Complete CUMCM paper, code, PDF, AI record, and support ZIP"
4
4
  default_prompt: "Use $cumcm-draft to ask which Python or Conda interpreter to use, audit the current official CUMCM rules, build responsibility-based q1/q2 code without project-local finalizers or Python caches, generate Chinese-named tables and Chinese PDF+SVG figures, keep final PDFs/TeX and required qN submission copies under happy/, inspect the full Chinese paper, and package the matching PDF/ZIP pair."
5
5
  policy: