@orbit-build/cli 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -259028,7 +259028,7 @@ import http from "http";
259028
259028
  import { createHash as createHash32 } from "crypto";
259029
259029
  var MAX_MCP_INPUT_SCHEMA_BYTES = 256 * 1024;
259030
259030
  var MAX_VALIDATION_ERRORS = 12;
259031
- var ajv = new import_ajv.default({
259031
+ var ajv = new import_ajv.Ajv({
259032
259032
  allErrors: true,
259033
259033
  strict: false,
259034
259034
  allowUnionTypes: true,
@@ -267059,7 +267059,9 @@ function generateXMLToolsPrompt(tools) {
267059
267059
  for (const tool of tools) {
267060
267060
  lines.push(`- **${tool.name}**: ${tool.description}`, " Parameters:");
267061
267061
  if (tool.inputSchema instanceof z55.ZodObject) {
267062
- for (const [key, property] of Object.entries(tool.inputSchema.shape)) {
267062
+ for (const [key, property] of Object.entries(
267063
+ tool.inputSchema.shape
267064
+ )) {
267063
267065
  const field = describeZodPromptField(property);
267064
267066
  const values = field.values ? `, values: ${field.values}` : "";
267065
267067
  const description = field.description ? ` - ${field.description.replace(/\s+/g, " ").trim()}` : "";
@@ -267266,7 +267268,11 @@ function resolveLocalPackageBinary(cwd, packageName, binaryName) {
267266
267268
  }
267267
267269
  function resolveManifestBinary(bin, binaryName) {
267268
267270
  if (typeof bin === "string") return bin;
267269
- return bin?.[binaryName];
267271
+ if (typeof bin !== "object" || bin === null || Array.isArray(bin)) {
267272
+ return void 0;
267273
+ }
267274
+ const candidate = bin[binaryName];
267275
+ return typeof candidate === "string" ? candidate : void 0;
267270
267276
  }
267271
267277
  function isValidPackageName(packageName) {
267272
267278
  if (packageName.length === 0 || packageName.length > 214) return false;
@@ -275214,41 +275220,53 @@ function createProviderFromConfig(config) {
275214
275220
  modelCapabilities: pConfig.modelCapabilities,
275215
275221
  apiKeyResolver: () => pConfig.apiKey
275216
275222
  };
275217
- if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && isOfficialDeepSeekApi(pConfig.baseUrl)) {
275218
- return new DeepSeekProvider(void 0, pConfig.baseUrl, providerOptions);
275223
+ const baseUrl = pConfig.baseUrl;
275224
+ if (pConfig.type === "deepseek" || pConfig.type === "openai-compatible" && baseUrl !== void 0 && isOfficialDeepSeekApi(baseUrl)) {
275225
+ return new DeepSeekProvider(
275226
+ void 0,
275227
+ baseUrl ?? "https://api.deepseek.com",
275228
+ providerOptions
275229
+ );
275219
275230
  }
275220
275231
  if (pConfig.type === "anthropic-compatible") {
275221
275232
  return new AnthropicCompatibleProvider(
275222
275233
  void 0,
275223
- pConfig.baseUrl,
275234
+ baseUrl ?? "https://api.anthropic.com",
275224
275235
  providerOptions
275225
275236
  );
275226
275237
  }
275227
275238
  if (pConfig.type === "openai-compatible") {
275228
275239
  const generic = new OpenAICompatibleProvider(
275229
275240
  void 0,
275230
- pConfig.baseUrl,
275241
+ baseUrl ?? "https://api.openai.com/v1",
275231
275242
  providerOptions
275232
275243
  );
275233
275244
  const deepSeek = new DeepSeekProvider(
275234
275245
  void 0,
275235
- pConfig.baseUrl,
275246
+ baseUrl ?? "https://api.openai.com/v1",
275236
275247
  providerOptions
275237
275248
  );
275238
275249
  return new ModelAwareProvider(generic, deepSeek);
275239
275250
  }
275240
275251
  if (pConfig.type === "openai") {
275241
- return new OpenAIProvider(pConfig.apiKey, pConfig.baseUrl, providerOptions);
275252
+ return new OpenAIProvider(
275253
+ pConfig.apiKey,
275254
+ baseUrl ?? "https://api.openai.com/v1",
275255
+ providerOptions
275256
+ );
275242
275257
  }
275243
275258
  if (pConfig.type === "anthropic") {
275244
275259
  return new AnthropicProvider(
275245
275260
  pConfig.apiKey,
275246
- pConfig.baseUrl,
275261
+ baseUrl ?? "https://api.anthropic.com",
275247
275262
  providerOptions
275248
275263
  );
275249
275264
  }
275250
275265
  if (pConfig.type === "ollama") {
275251
- return new OllamaProvider(pConfig.baseUrl, providerOptions);
275266
+ return new OllamaProvider(
275267
+ pConfig.baseUrl ?? "http://localhost:11434",
275268
+ providerOptions
275269
+ );
275252
275270
  }
275253
275271
  throw new Error(`Unsupported provider type "${pConfig.type}".`);
275254
275272
  }
@@ -281837,16 +281855,17 @@ var FullscreenTui = class {
281837
281855
  const loopMsg = loopAsst[i2];
281838
281856
  const textBlock = loopMsg.content.find((block2) => block2.type === "text");
281839
281857
  if (textBlock && textBlock.text) {
281858
+ const model = typeof loopMsg.metadata?.model === "string" ? loopMsg.metadata.model : void 0;
281840
281859
  const localIdx = localAsstIdx[i2];
281841
281860
  if (localIdx !== void 0) {
281842
281861
  this.history[localIdx].text = textBlock.text;
281843
- this.history[localIdx].model = loopMsg.metadata?.model;
281862
+ this.history[localIdx].model = model;
281844
281863
  } else {
281845
281864
  this.history.push({
281846
281865
  role: "assistant",
281847
281866
  text: textBlock.text,
281848
281867
  attempt: i2 + 1,
281849
- model: loopMsg.metadata?.model
281868
+ model
281850
281869
  });
281851
281870
  }
281852
281871
  }
@@ -281869,11 +281888,12 @@ var FullscreenTui = class {
281869
281888
  } else if (msg.role === "assistant") {
281870
281889
  attempt++;
281871
281890
  const textBlock = msg.content.find((block2) => block2.type === "text");
281891
+ const model = typeof msg.metadata?.model === "string" ? msg.metadata.model : void 0;
281872
281892
  this.history.push({
281873
281893
  role: "assistant",
281874
281894
  text: textBlock?.text || "",
281875
281895
  attempt,
281876
- model: msg.metadata?.model
281896
+ model
281877
281897
  });
281878
281898
  } else if (msg.role === "system") {
281879
281899
  const text2 = msg.content.map((content) => content.type === "text" ? content.text : "").join("");
@@ -283192,9 +283212,6 @@ function stripQuotes(value) {
283192
283212
  return value.length >= 2 && value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
283193
283213
  }
283194
283214
 
283195
- // src/runtime/CommandRouter.ts
283196
- import { createRequire as createRequire2 } from "module";
283197
-
283198
283215
  // src/runtime/webui/WebUiRuntime.ts
283199
283216
  import http2 from "http";
283200
283217
  import { randomBytes as randomBytes4, randomUUID as randomUUID10 } from "crypto";
@@ -290017,10 +290034,11 @@ function safeWebMessage(error) {
290017
290034
  function summarizeWebToolValue(value, options = {}) {
290018
290035
  let candidate = value;
290019
290036
  if (typeof candidate === "string") {
290037
+ const rawText = candidate;
290020
290038
  try {
290021
- candidate = JSON.parse(candidate);
290039
+ candidate = JSON.parse(rawText);
290022
290040
  } catch {
290023
- return options.allowPlainText ? safeWebToolText(candidate, 700) : "";
290041
+ return options.allowPlainText ? safeWebToolText(rawText, 700) : "";
290024
290042
  }
290025
290043
  }
290026
290044
  if (!isRecord7(candidate)) return "";
@@ -290325,16 +290343,17 @@ function collectWebUiStatus(options, activeTurn) {
290325
290343
  lastOpenedAt: typeof project.lastOpenedAt === "string" ? project.lastOpenedAt.slice(0, 64) : "",
290326
290344
  available: project.available === true
290327
290345
  }));
290346
+ const taskStatus = activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready";
290328
290347
  const agentRuns = summarizeWebUiAgentRuns(
290329
290348
  safeCall(() => options.getAgentRuns?.()) || []
290330
290349
  );
290331
- return {
290350
+ const snapshot = {
290332
290351
  language: config.language,
290333
290352
  workspace: cwd,
290334
290353
  projects,
290335
290354
  agentRuns,
290336
290355
  task: {
290337
- status: activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready",
290356
+ status: taskStatus,
290338
290357
  reason: approval?.reason || ""
290339
290358
  },
290340
290359
  agentTeam: {
@@ -290463,6 +290482,7 @@ function collectWebUiStatus(options, activeTurn) {
290463
290482
  cacheDiagnostics: redactSecrets(stripAnsi3(buildCacheDiagnostics(cwd))),
290464
290483
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
290465
290484
  };
290485
+ return snapshot;
290466
290486
  }
290467
290487
  function summarizeWebUiBackgroundTasks(value) {
290468
290488
  const statuses = /* @__PURE__ */ new Set([
@@ -290486,8 +290506,15 @@ function summarizeWebUiBackgroundTasks(value) {
290486
290506
  })).filter((task) => task.id);
290487
290507
  }
290488
290508
  function summarizeWebUiInputQueue(value) {
290489
- const modes = /* @__PURE__ */ new Set(["follow_up", "steer"]);
290490
- const sources = /* @__PURE__ */ new Set(["terminal", "web", "api"]);
290509
+ const modes = /* @__PURE__ */ new Set([
290510
+ "follow_up",
290511
+ "steer"
290512
+ ]);
290513
+ const sources = /* @__PURE__ */ new Set([
290514
+ "terminal",
290515
+ "web",
290516
+ "api"
290517
+ ]);
290491
290518
  return (Array.isArray(value) ? value : []).filter(isRecord9).slice(0, 12).map((item) => ({
290492
290519
  id: safeLabel(typeof item.id === "string" ? item.id : "", 200),
290493
290520
  mode: typeof item.mode === "string" && modes.has(item.mode) ? item.mode : "follow_up",
@@ -303312,8 +303339,42 @@ function normalizeCommitMessage(message2) {
303312
303339
  ) ? subject : `chore: ${subject}`.slice(0, MAX_COMMIT_SUBJECT_LENGTH).trim();
303313
303340
  }
303314
303341
 
303342
+ // src/runtime/Clipboard.ts
303343
+ import { execFileSync as execFileSync8 } from "child_process";
303344
+ var DEFAULT_RUNTIME = {
303345
+ platform: process.platform,
303346
+ execute(executable, args, input) {
303347
+ execFileSync8(executable, [...args], {
303348
+ ...HIDDEN_CHILD_PROCESS_OPTIONS,
303349
+ input
303350
+ });
303351
+ }
303352
+ };
303353
+ function copyTextToClipboard(text2, runtime = DEFAULT_RUNTIME) {
303354
+ const candidates = clipboardCandidates(runtime.platform);
303355
+ for (const candidate of candidates) {
303356
+ try {
303357
+ runtime.execute(candidate.executable, candidate.args, text2);
303358
+ return true;
303359
+ } catch (error) {
303360
+ void redactSecrets(
303361
+ error instanceof Error ? error.message : String(error)
303362
+ );
303363
+ }
303364
+ }
303365
+ return false;
303366
+ }
303367
+ function clipboardCandidates(platform) {
303368
+ if (platform === "win32") return [{ executable: "clip", args: [] }];
303369
+ if (platform === "darwin") return [{ executable: "pbcopy", args: [] }];
303370
+ return [
303371
+ { executable: "xclip", args: ["-selection", "clipboard"] },
303372
+ { executable: "xsel", args: ["-ib"] },
303373
+ { executable: "wl-copy", args: [] }
303374
+ ];
303375
+ }
303376
+
303315
303377
  // src/runtime/CommandRouter.ts
303316
- var require2 = createRequire2(import.meta.url);
303317
303378
  function stripAnsi4(value) {
303318
303379
  return value.replace(/\u001b\[[0-9;]*m/g, "");
303319
303380
  }
@@ -304199,7 +304260,7 @@ var CommandRouter = class {
304199
304260
  if (command === "/commit") {
304200
304261
  const commitMsg = parts.slice(1).join(" ").trim();
304201
304262
  const isZh = config.language !== "en";
304202
- const { execFileSync: execFileSync9, execSync: execSync3 } = await import("child_process");
304263
+ const { execFileSync: execFileSync10, execSync: execSync3 } = await import("child_process");
304203
304264
  const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
304204
304265
  try {
304205
304266
  let diff = execSync3("git diff --cached", {
@@ -304289,7 +304350,7 @@ ${buildCommitDiffForModel(diff)}`
304289
304350
  this.printOutput(
304290
304351
  `Committing changes with message: "${picocolors18.green(finalMsg)}"`
304291
304352
  );
304292
- execFileSync9("git", ["commit", "-m", finalMsg], {
304353
+ execFileSync10("git", ["commit", "-m", finalMsg], {
304293
304354
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
304294
304355
  cwd,
304295
304356
  env: childEnvironment
@@ -305334,50 +305395,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
305334
305395
  }
305335
305396
  }
305336
305397
  copyToClipboard(text2) {
305337
- const { execSync: execSync3 } = require2("child_process");
305338
- try {
305339
- if (process.platform === "win32") {
305340
- execSync3("clip", {
305341
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305342
- input: text2
305343
- });
305344
- return true;
305345
- } else if (process.platform === "darwin") {
305346
- execSync3("pbcopy", {
305347
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305348
- input: text2
305349
- });
305350
- return true;
305351
- } else {
305352
- try {
305353
- execSync3("xclip -selection clipboard", {
305354
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305355
- input: text2
305356
- });
305357
- return true;
305358
- } catch {
305359
- try {
305360
- execSync3("xsel -ib", {
305361
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305362
- input: text2
305363
- });
305364
- return true;
305365
- } catch {
305366
- try {
305367
- execSync3("wl-copy", {
305368
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
305369
- input: text2
305370
- });
305371
- return true;
305372
- } catch {
305373
- return false;
305374
- }
305375
- }
305376
- }
305377
- }
305378
- } catch {
305379
- return false;
305380
- }
305398
+ return copyTextToClipboard(text2);
305381
305399
  }
305382
305400
  };
305383
305401
  function validateImageAttachments(model, capabilities, attachments) {
@@ -306676,7 +306694,7 @@ Risk Warning: ${reason}`);
306676
306694
  providerInstance,
306677
306695
  interaction,
306678
306696
  multi,
306679
- !!cliOverrides?.direct,
306697
+ isDirectRun(cliOverrides),
306680
306698
  options?.webUi,
306681
306699
  selectedProfile
306682
306700
  );
@@ -306745,6 +306763,9 @@ Risk Warning: ${reason}`);
306745
306763
  cleanupJsonl();
306746
306764
  }
306747
306765
  }
306766
+ function isDirectRun(value) {
306767
+ return typeof value === "object" && value !== null && !Array.isArray(value) && value.direct === true;
306768
+ }
306748
306769
  function exitCodeForOutcome(outcome) {
306749
306770
  if (!outcome || outcome.status === "completed") return 0;
306750
306771
  if (outcome.status === "aborted") return 130;
@@ -313250,16 +313271,21 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313250
313271
  if (action === "verify") {
313251
313272
  const selected = artifactName ? artifacts.filter((item) => item.name === validateName(artifactName)) : artifacts;
313252
313273
  const blockedFindings = selected.flatMap(
313253
- ({ name, value }) => value.findings.filter(
313254
- (finding2) => (finding2.severity === "P0" || finding2.severity === "P1") && finding2.disposition === "open"
313255
- ).map((finding2) => ({
313256
- artifact: name,
313257
- id: finding2.id,
313258
- severity: finding2.severity,
313259
- file: finding2.file,
313260
- line: finding2.line,
313261
- title: finding2.title
313262
- }))
313274
+ ({ name, value }) => value.findings.flatMap((finding2) => {
313275
+ if (finding2.severity !== "P0" && finding2.severity !== "P1" || finding2.disposition !== "open") {
313276
+ return [];
313277
+ }
313278
+ return [
313279
+ {
313280
+ artifact: name,
313281
+ id: finding2.id,
313282
+ severity: finding2.severity,
313283
+ file: finding2.file,
313284
+ line: finding2.line,
313285
+ title: finding2.title
313286
+ }
313287
+ ];
313288
+ })
313263
313289
  );
313264
313290
  const result = {
313265
313291
  ok: blockedFindings.length === 0,
@@ -313302,7 +313328,8 @@ function runReviewCommand(action, artifactName, findingId, options = {}) {
313302
313328
  if (!artifact)
313303
313329
  return fail(`Review artifact not found: ${safeName}`, options);
313304
313330
  if (action === "show") {
313305
- emit(options.json ? artifact : [artifact], options.json === true);
313331
+ if (options.json) emit(artifact, true);
313332
+ else emit([{ name: safeName, value: artifact }], false);
313306
313333
  return 0;
313307
313334
  }
313308
313335
  const nextDisposition = options.disposition;
@@ -313473,6 +313500,12 @@ function emit(value, json) {
313473
313500
  console.log(JSON.stringify({ schemaVersion: 1, reviews: value }, null, 2));
313474
313501
  return;
313475
313502
  }
313503
+ if ("artifact" in value) {
313504
+ console.log(
313505
+ `\u2714 ${value.artifact}:${value.findingId} ${value.previousDisposition} \u2192 ${value.disposition}`
313506
+ );
313507
+ return;
313508
+ }
313476
313509
  if (!Array.isArray(value)) {
313477
313510
  console.log(picocolors28.bold(`
313478
313511
  ${value.perspective} \xB7 ${value.verdict}
@@ -314233,10 +314266,7 @@ var InputsSchema = z89.record(
314233
314266
  ).default({}).superRefine((value, context) => {
314234
314267
  if (Object.keys(value).length > MAX_INPUTS) {
314235
314268
  context.addIssue({
314236
- code: z89.ZodIssueCode.too_big,
314237
- type: "object",
314238
- maximum: MAX_INPUTS,
314239
- inclusive: true,
314269
+ code: z89.ZodIssueCode.custom,
314240
314270
  path: [],
314241
314271
  message: `Workflow dispatch accepts at most ${MAX_INPUTS} inputs.`
314242
314272
  });
@@ -314404,7 +314434,7 @@ function isRecord16(value) {
314404
314434
  }
314405
314435
 
314406
314436
  // src/commands/eval.ts
314407
- import { exec as execCallback, execFileSync as execFileSync8 } from "child_process";
314437
+ import { exec as execCallback, execFileSync as execFileSync9 } from "child_process";
314408
314438
  import {
314409
314439
  copyFileSync,
314410
314440
  existsSync as existsSync38,
@@ -314718,7 +314748,7 @@ ${result.stderr}`)
314718
314748
  }
314719
314749
  function readChangedFiles(cwd) {
314720
314750
  try {
314721
- const output = execFileSync8(
314751
+ const output = execFileSync9(
314722
314752
  "git",
314723
314753
  ["status", "--porcelain=v1", "-z", "--untracked-files=all"],
314724
314754
  {
@@ -314734,7 +314764,7 @@ function readChangedFiles(cwd) {
314734
314764
  }
314735
314765
  }
314736
314766
  function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
314737
- const patch = execFileSync8(
314767
+ const patch = execFileSync9(
314738
314768
  "git",
314739
314769
  ["diff", "HEAD", "--binary", "--no-ext-diff"],
314740
314770
  {
@@ -314746,7 +314776,7 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
314746
314776
  }
314747
314777
  );
314748
314778
  if (patch.length > 0) {
314749
- execFileSync8("git", ["apply", "--whitespace=nowarn", "-"], {
314779
+ execFileSync9("git", ["apply", "--whitespace=nowarn", "-"], {
314750
314780
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
314751
314781
  cwd: worktreeCwd,
314752
314782
  input: patch,
@@ -314754,7 +314784,7 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
314754
314784
  maxBuffer: 64 * 1024 * 1024
314755
314785
  });
314756
314786
  }
314757
- const untracked = execFileSync8(
314787
+ const untracked = execFileSync9(
314758
314788
  "git",
314759
314789
  ["ls-files", "--others", "--exclude-standard", "-z"],
314760
314790
  {
@@ -314774,19 +314804,19 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
314774
314804
  mkdirSync10(dirname16(targetPath), { recursive: true });
314775
314805
  copyFileSync(sourcePath, targetPath);
314776
314806
  }
314777
- execFileSync8("git", ["add", "-A"], {
314807
+ execFileSync9("git", ["add", "-A"], {
314778
314808
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
314779
314809
  cwd: worktreeCwd,
314780
314810
  stdio: ["ignore", "pipe", "pipe"]
314781
314811
  });
314782
- const dirty = execFileSync8("git", ["status", "--porcelain"], {
314812
+ const dirty = execFileSync9("git", ["status", "--porcelain"], {
314783
314813
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
314784
314814
  cwd: worktreeCwd,
314785
314815
  encoding: "utf8",
314786
314816
  stdio: ["ignore", "pipe", "pipe"]
314787
314817
  }).trim();
314788
314818
  if (!dirty) return;
314789
- execFileSync8(
314819
+ execFileSync9(
314790
314820
  "git",
314791
314821
  [
314792
314822
  "-c",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
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: