@orbit-build/cli 0.8.3 → 0.8.5

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 (44) hide show
  1. package/README.md +4 -1
  2. package/dist/index.js +558 -151
  3. package/package.json +1 -1
  4. package/skills/cumcm-draft/SKILL.md +92 -48
  5. package/skills/cumcm-draft/agents/openai.yaml +1 -1
  6. package/skills/cumcm-draft/assets/project-template/{code → .cumcm}/finalize.py +33 -4
  7. package/skills/cumcm-draft/assets/project-template/{paper/contest-profile.json → .cumcm/profile.json} +9 -6
  8. package/skills/cumcm-draft/assets/project-template/code/requirements.txt +1 -11
  9. package/skills/cumcm-draft/assets/project-template/paper/AI/345/267/245/345/205/267/344/275/277/347/224/250/350/257/246/346/203/205.tex +1 -11
  10. package/skills/cumcm-draft/assets/project-template/paper/main.tex +70 -11
  11. package/skills/cumcm-draft/references/code-and-output-style.md +9 -14
  12. package/skills/cumcm-draft/references/cumcm-compliance.md +28 -25
  13. package/skills/cumcm-draft/references/latex-figures-tables.md +1 -1
  14. package/skills/cumcm-draft/references/modeling-quality.md +1 -1
  15. package/skills/cumcm-draft/references/paper-architecture.md +3 -3
  16. package/skills/cumcm-draft/references/project-architecture.md +70 -89
  17. package/skills/cumcm-draft/scripts/audit_paper.py +37 -9
  18. package/skills/cumcm-draft/scripts/bootstrap_project.py +182 -56
  19. package/skills/cumcm-draft/scripts/build_paper.py +38 -23
  20. package/skills/cumcm-draft/scripts/capture_environment.py +3 -1
  21. package/skills/cumcm-draft/scripts/clean_project.py +7 -2
  22. package/skills/cumcm-draft/scripts/evidence_freeze.py +8 -4
  23. package/skills/cumcm-draft/scripts/finalize_project.py +4 -0
  24. package/skills/cumcm-draft/scripts/inspect_inputs.py +6 -4
  25. package/skills/cumcm-draft/scripts/package_support.py +41 -15
  26. package/skills/cumcm-draft/scripts/project_utils.py +40 -8
  27. package/skills/cumcm-draft/scripts/validate_project.py +374 -57
  28. package/skills/cumcm-draft/assets/project-template/code/always/__init__.py +0 -1
  29. package/skills/cumcm-draft/assets/project-template/code/always/config.py +0 -18
  30. package/skills/cumcm-draft/assets/project-template/code/always/data.py +0 -24
  31. package/skills/cumcm-draft/assets/project-template/code/always/plotting.py +0 -25
  32. package/skills/cumcm-draft/assets/project-template/code/always/validation.py +0 -21
  33. package/skills/cumcm-draft/assets/project-template/paper/sections/abstract.tex +0 -6
  34. package/skills/cumcm-draft/assets/project-template/paper/sections/ai-disclosure.tex +0 -3
  35. package/skills/cumcm-draft/assets/project-template/paper/sections/appendix.tex +0 -3
  36. package/skills/cumcm-draft/assets/project-template/paper/sections/assumptions.tex +0 -5
  37. package/skills/cumcm-draft/assets/project-template/paper/sections/data.tex +0 -19
  38. package/skills/cumcm-draft/assets/project-template/paper/sections/evaluation.tex +0 -9
  39. package/skills/cumcm-draft/assets/project-template/paper/sections/problem-analysis.tex +0 -3
  40. package/skills/cumcm-draft/assets/project-template/paper/sections/problem-restatement.tex +0 -3
  41. package/skills/cumcm-draft/assets/project-template/paper/sections/references.tex +0 -12
  42. package/skills/cumcm-draft/assets/project-template/paper/sections/source-code.tex +0 -1
  43. package/skills/cumcm-draft/assets/project-template/paper/sections/support-files.tex +0 -3
  44. /package/skills/cumcm-draft/assets/project-template/{paper → .cumcm}/ai-use-log.md +0 -0
package/dist/index.js CHANGED
@@ -239238,8 +239238,8 @@ function localizeOrbit(language, english, simplifiedChinese, traditionalChinese)
239238
239238
  return language === "zh" ? simplifiedChinese : english;
239239
239239
  }
239240
239240
  var ORBIT_CONFIG_SCHEMA_VERSION = 1;
239241
- var DEFAULT_AGENT_MAX_ITERATIONS = 64;
239242
- var MAX_AGENT_MAX_ITERATIONS = 200;
239241
+ var DEFAULT_AGENT_MAX_ITERATIONS = 200;
239242
+ var MAX_AGENT_MAX_ITERATIONS = 1e3;
239243
239243
  var EnvironmentVariableNameSchema = z22.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/);
239244
239244
  var HttpHeaderNameSchema = z22.string().max(256).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/);
239245
239245
  var HttpHeaderValueSchema = z22.string().max(16384).refine((value) => !/[\r\n]/.test(value));
@@ -239595,7 +239595,8 @@ var ConfigSchema = z22.object({
239595
239595
  requireWriteApproval: z22.boolean().default(false),
239596
239596
  requireBashApproval: z22.boolean().default(false),
239597
239597
  disableWebSearch: z22.boolean().default(false),
239598
- disableMcp: z22.boolean().default(false)
239598
+ disableMcp: z22.boolean().default(false),
239599
+ maxIterations: z22.number().int().positive().max(MAX_AGENT_MAX_ITERATIONS).optional()
239599
239600
  }).optional(),
239600
239601
  hooks: z22.object({
239601
239602
  preEdit: z22.string().max(2e4).optional(),
@@ -239732,8 +239733,10 @@ var DEFAULT_CONFIG = {
239732
239733
  testCommands: []
239733
239734
  },
239734
239735
  agent: {
239735
- // Long enough for document, migration, and verification workflows; the
239736
- // progress guard, periodic checkpoints, and budget still bound bad runs.
239736
+ // Long enough for complete document, migration, and verification
239737
+ // workflows. Normal modes retain periodic consent; Full Access continues
239738
+ // checkpoints without interruption. Progress and budget guards still
239739
+ // bound unhealthy runs.
239737
239740
  maxIterations: DEFAULT_AGENT_MAX_ITERATIONS,
239738
239741
  fastMaxOutputTokens: 32768,
239739
239742
  maxOutputTokens: 16384,
@@ -240603,7 +240606,8 @@ function applyManagedPolicy(source, policy) {
240603
240606
  requireWriteApproval: policy.requireWriteApproval,
240604
240607
  requireBashApproval: policy.requireBashApproval,
240605
240608
  disableWebSearch: policy.disableWebSearch,
240606
- disableMcp: policy.disableMcp
240609
+ disableMcp: policy.disableMcp,
240610
+ maxIterations: policy.maxIterations
240607
240611
  };
240608
240612
  return config;
240609
240613
  }
@@ -240628,6 +240632,9 @@ function validateManagedRuntimeChange(config, change) {
240628
240632
  if (change.webSearchEnabled && policy.disableWebSearch) {
240629
240633
  return "Managed policy disables web search.";
240630
240634
  }
240635
+ if (change.agentMaxIterations !== void 0 && policy.maxIterations !== void 0 && change.agentMaxIterations > policy.maxIterations) {
240636
+ return `Managed policy limits agent runs to ${policy.maxIterations} iterations.`;
240637
+ }
240631
240638
  return void 0;
240632
240639
  }
240633
240640
  function permissionRank(mode) {
@@ -247801,10 +247808,10 @@ import glob2 from "fast-glob";
247801
247808
  import { z as z16 } from "zod";
247802
247809
  import { z as z17 } from "zod";
247803
247810
  import { existsSync as existsSync7 } from "fs";
247804
- import { join as join32 } from "path";
247811
+ import { win32 as win322 } from "path";
247805
247812
  import { z as z18 } from "zod";
247806
247813
  import { existsSync as existsSync8 } from "fs";
247807
- import { join as join42 } from "path";
247814
+ import { join as join32, resolve as resolve32 } from "path";
247808
247815
  import { z as z20 } from "zod";
247809
247816
  var import_ipaddr = __toESM(require_ipaddr(), 1);
247810
247817
  import { lookup } from "dns/promises";
@@ -249563,45 +249570,73 @@ function firstExistingPath(candidates, pathExists = existsSync7) {
249563
249570
  }
249564
249571
  return null;
249565
249572
  }
249573
+ function normalizePowerShellCommand(command) {
249574
+ const leadingWhitespace = command.match(/^\s*/)?.[0] ?? "";
249575
+ const trimmed = command.slice(leadingWhitespace.length);
249576
+ if (/^&(?:\s|$)/.test(trimmed)) return command;
249577
+ const quotedExecutable = trimmed.match(/^(["'])([^"']+)\1(?=\s|$)/);
249578
+ const executablePath = quotedExecutable?.[2];
249579
+ if (!executablePath || !/[\\/]/.test(executablePath) && !/\.(?:exe|cmd|bat|com|ps1)$/i.test(executablePath)) {
249580
+ return command;
249581
+ }
249582
+ return `${leadingWhitespace}& ${trimmed}`;
249583
+ }
249566
249584
  function resolveCommandShellInvocation(command, options = {}) {
249567
249585
  const platform = options.platform ?? process.platform;
249568
249586
  const environment = options.environment ?? process.env;
249569
249587
  const pathExists = options.pathExists ?? existsSync7;
249570
249588
  if (platform !== "win32") {
249571
- const bash2 = firstExistingPath(
249589
+ const bash = firstExistingPath(
249572
249590
  [environment.ORBIT_BASH_PATH, "/bin/bash", "/usr/bin/bash"],
249573
249591
  pathExists
249574
249592
  );
249575
- if (bash2) {
249593
+ if (bash) {
249576
249594
  return {
249577
- file: bash2,
249578
- args: ["--noprofile", "--norc", "-c", command]
249595
+ file: bash,
249596
+ args: ["--noprofile", "--norc", "-c", command],
249597
+ dialect: "bash"
249579
249598
  };
249580
249599
  }
249581
249600
  return {
249582
249601
  file: "/bin/sh",
249583
- args: ["-c", command]
249602
+ args: ["-c", command],
249603
+ dialect: "sh"
249584
249604
  };
249585
249605
  }
249586
- const bash = firstExistingPath(
249606
+ const systemRoot = environment.SystemRoot || environment.WINDIR;
249607
+ const powershell = firstExistingPath(
249587
249608
  [
249588
- environment.ORBIT_BASH_PATH,
249589
- environment.ProgramFiles ? join32(environment.ProgramFiles, "Git", "bin", "bash.exe") : void 0,
249590
- environment["ProgramFiles(x86)"] ? join32(environment["ProgramFiles(x86)"], "Git", "bin", "bash.exe") : void 0,
249591
- environment.LOCALAPPDATA ? join32(environment.LOCALAPPDATA, "Programs", "Git", "bin", "bash.exe") : void 0,
249592
- environment.LOCALAPPDATA ? join32(environment.LOCALAPPDATA, "hermes", "git", "bin", "bash.exe") : void 0
249609
+ environment.ORBIT_POWERSHELL_PATH,
249610
+ environment.ProgramFiles ? win322.join(environment.ProgramFiles, "PowerShell", "7", "pwsh.exe") : void 0,
249611
+ environment.ProgramW6432 ? win322.join(environment.ProgramW6432, "PowerShell", "7", "pwsh.exe") : void 0,
249612
+ systemRoot ? win322.join(
249613
+ systemRoot,
249614
+ "System32",
249615
+ "WindowsPowerShell",
249616
+ "v1.0",
249617
+ "powershell.exe"
249618
+ ) : void 0
249593
249619
  ],
249594
249620
  pathExists
249595
249621
  );
249596
- if (bash) {
249622
+ if (powershell) {
249623
+ const normalizedCommand = normalizePowerShellCommand(command);
249624
+ const script = [
249625
+ "$ErrorActionPreference = 'Stop'",
249626
+ "$global:LASTEXITCODE = 0",
249627
+ `& { ${normalizedCommand} }`,
249628
+ "if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }"
249629
+ ].join("; ");
249597
249630
  return {
249598
- file: bash,
249599
- args: ["--noprofile", "--norc", "-lc", command]
249631
+ file: powershell,
249632
+ args: ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script],
249633
+ dialect: "powershell"
249600
249634
  };
249601
249635
  }
249602
249636
  return {
249603
249637
  file: environment.ComSpec?.trim() || "cmd.exe",
249604
- args: ["/d", "/s", "/c", command]
249638
+ args: ["/d", "/s", "/c", command],
249639
+ dialect: "cmd"
249605
249640
  };
249606
249641
  }
249607
249642
  var BashInputSchema = z17.object({
@@ -249611,7 +249646,7 @@ var BashInputSchema = z17.object({
249611
249646
  });
249612
249647
  var BashTool = class {
249613
249648
  name = "bash";
249614
- description = "Run a command in the local shell environment. Set background=true for dev servers, watchers, or long builds; this returns a task id immediately for use with the background task tools.";
249649
+ description = process.platform === "win32" ? "Run a command in native Windows PowerShell. The working directory is already the project root: use PowerShell cmdlets and do not prepend cd or use POSIX grep/sed/head/tail/heredoc syntax. Set background=true only for dev servers, watchers, or long builds." : "Run a command in non-interactive Bash/POSIX sh. The working directory is already the project root; do not prepend cd. Set background=true only for dev servers, watchers, or long builds.";
249615
249650
  inputSchema = BashInputSchema;
249616
249651
  risk = "execute";
249617
249652
  async execute(input, ctx) {
@@ -249706,7 +249741,8 @@ ${displayStderr}` : "",
249706
249741
  truncated,
249707
249742
  stdoutChars: stdout2.length,
249708
249743
  stderrChars: stderr.length,
249709
- outputLimitExceeded
249744
+ outputLimitExceeded,
249745
+ shellDialect: invocation.dialect
249710
249746
  }
249711
249747
  };
249712
249748
  } catch (error) {
@@ -249726,6 +249762,7 @@ ${displayStderr}` : "",
249726
249762
  var RunTestsInputSchema = z18.object({
249727
249763
  command: z18.string().trim().min(1).max(1e5).optional()
249728
249764
  });
249765
+ var ORBIT_TERMINAL_SUCCESS_MARKER = "[ORBIT_TERMINAL_SUCCESS]";
249729
249766
  function classifyVerificationCommand(command) {
249730
249767
  if (/[\r\n&]/.test(command) || /(?:--if-present|--passwithnotests|--allow-no-tests)(?:\s|=|$)/i.test(
249731
249768
  command
@@ -249764,19 +249801,46 @@ function classifyVerificationCommand(command) {
249764
249801
  )) {
249765
249802
  return "test";
249766
249803
  }
249767
- if (/^(?:python(?:\.exe)? -m compileall|(?:"[^"]*[\\/])?node(?:\.exe)?"? --check)(?:\s|$)/i.test(
249804
+ if (/^(?:python(?:\.exe)? -m (?:compileall|py_compile)|(?:"[^"]*[\\/])?node(?:\.exe)?"? --check)(?:\s|$)/i.test(
249768
249805
  normalized
249769
249806
  )) {
249770
249807
  return "syntax";
249771
249808
  }
249809
+ if (/^python(?:\.exe)? (?:"[^"]*(?:[\\/](?:code|\.cumcm)[\\/]finalize\.py)"|'[^']*(?:[\\/](?:code|\.cumcm)[\\/]finalize\.py)'|(?:\S*[\\/])?(?:code|\.cumcm)[\\/]finalize\.py)(?:\s|$)/i.test(
249810
+ normalized
249811
+ )) {
249812
+ return "build";
249813
+ }
249772
249814
  if (/^(?:cmake --build|dotnet build)(?:\s|$)/i.test(normalized)) {
249773
249815
  return "build";
249774
249816
  }
249775
249817
  return void 0;
249776
249818
  }
249819
+ function detectTrustedTerminalSuccess(command, cwd, output, exitCode) {
249820
+ if (exitCode !== 0 || classifyVerificationCommand(command) !== "build" || !output.includes(ORBIT_TERMINAL_SUCCESS_MARKER)) {
249821
+ return void 0;
249822
+ }
249823
+ const normalized = command.trim().replace(/\s+/g, " ");
249824
+ const match = /^python(?:\.exe)?\s+(?:"([^"]+)"|'([^']+)'|(\S+))(?=\s|$)/i.exec(
249825
+ normalized
249826
+ );
249827
+ const script = match?.[1] || match?.[2] || match?.[3];
249828
+ if (!script) return void 0;
249829
+ const actual = comparablePath(resolve32(cwd, script));
249830
+ const expected = [
249831
+ resolve32(cwd, ".cumcm", "finalize.py"),
249832
+ // Read compatibility for projects scaffolded by Orbit <= 0.8.3.
249833
+ resolve32(cwd, "code", "finalize.py")
249834
+ ].map(comparablePath);
249835
+ return expected.includes(actual) ? "cumcm-finalizer" : void 0;
249836
+ }
249837
+ function comparablePath(value) {
249838
+ const normalized = value.replace(/\\/g, "/");
249839
+ return process.platform === "win32" ? normalized.toLowerCase() : normalized;
249840
+ }
249777
249841
  var RunTestsTool = class {
249778
249842
  name = "run_tests";
249779
- description = "Run a standalone project verification command. Recognized test, build, lint, typecheck, or syntax commands count toward the completion gate; arbitrary shell commands do not. If omitted, Orbit auto-detects the project test runner.";
249843
+ description = "Run one standalone project verification command in the native OS shell. Recognized test, build, lint, typecheck, or syntax commands (including python -m py_compile) count toward the completion gate; arbitrary or piped shell commands do not. If omitted, Orbit auto-detects the project test runner.";
249780
249844
  inputSchema = RunTestsInputSchema;
249781
249845
  risk = "execute";
249782
249846
  async execute(input, ctx) {
@@ -249810,6 +249874,13 @@ var RunTestsTool = class {
249810
249874
  const failureMessage = readProcessFailureMessage(result);
249811
249875
  const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
249812
249876
  const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
249877
+ const terminalSuccess = detectTrustedTerminalSuccess(
249878
+ testCommand,
249879
+ ctx.cwd,
249880
+ `${stdout2}
249881
+ ${stderr}`,
249882
+ exitCode
249883
+ );
249813
249884
  const displayStdout = redactSecrets(
249814
249885
  LogTruncator.truncate(stdout2, 150, 2e4)
249815
249886
  );
@@ -249836,7 +249907,8 @@ Exit code: ${exitCode}`,
249836
249907
  stderrChars: stderr.length,
249837
249908
  outputLimitExceeded,
249838
249909
  verificationEvidence: verificationKind !== void 0,
249839
- ...verificationKind ? { verificationKind } : {}
249910
+ ...verificationKind ? { verificationKind } : {},
249911
+ ...terminalSuccess ? { terminalSuccess } : {}
249840
249912
  }
249841
249913
  };
249842
249914
  } catch (error) {
@@ -249853,36 +249925,36 @@ Exit code: ${exitCode}`,
249853
249925
  }
249854
249926
  }
249855
249927
  inferTestCommand(cwd) {
249856
- if (existsSync8(join42(cwd, "Cargo.toml"))) {
249928
+ if (existsSync8(join32(cwd, "Cargo.toml"))) {
249857
249929
  return "cargo test";
249858
249930
  }
249859
- if (existsSync8(join42(cwd, "go.mod"))) {
249931
+ if (existsSync8(join32(cwd, "go.mod"))) {
249860
249932
  return "go test ./...";
249861
249933
  }
249862
- if (existsSync8(join42(cwd, "pom.xml"))) {
249934
+ if (existsSync8(join32(cwd, "pom.xml"))) {
249863
249935
  return "mvn test";
249864
249936
  }
249865
- if (existsSync8(join42(cwd, "build.gradle"))) {
249937
+ if (existsSync8(join32(cwd, "build.gradle"))) {
249866
249938
  return "./gradlew test";
249867
249939
  }
249868
- if (existsSync8(join42(cwd, "package.json"))) {
249940
+ if (existsSync8(join32(cwd, "package.json"))) {
249869
249941
  try {
249870
249942
  const raw = readBoundedRegularFile(
249871
- join42(cwd, "package.json"),
249943
+ join32(cwd, "package.json"),
249872
249944
  1024 * 1024
249873
249945
  );
249874
249946
  if (raw === void 0) return "npm test";
249875
249947
  const pkg = JSON.parse(raw);
249876
249948
  if (pkg.scripts?.test) {
249877
- if (existsSync8(join42(cwd, "pnpm-lock.yaml"))) return "pnpm test";
249878
- if (existsSync8(join42(cwd, "yarn.lock"))) return "yarn test";
249949
+ if (existsSync8(join32(cwd, "pnpm-lock.yaml"))) return "pnpm test";
249950
+ if (existsSync8(join32(cwd, "yarn.lock"))) return "yarn test";
249879
249951
  return "npm test";
249880
249952
  }
249881
249953
  } catch {
249882
249954
  }
249883
249955
  return "npm test";
249884
249956
  }
249885
- if (existsSync8(join42(cwd, "pytest.ini")) || existsSync8(join42(cwd, "pyproject.toml"))) {
249957
+ if (existsSync8(join32(cwd, "pytest.ini")) || existsSync8(join32(cwd, "pyproject.toml"))) {
249886
249958
  return "pytest";
249887
249959
  }
249888
249960
  return "npm test";
@@ -249904,10 +249976,10 @@ var PUBLIC_DNS_ENDPOINTS = [
249904
249976
  ];
249905
249977
  async function resolveSystemAddresses(hostname, signal, lookupImplementation = lookup) {
249906
249978
  if (signal?.aborted) throw abortError("System DNS lookup was cancelled.");
249907
- return new Promise((resolve34, reject) => {
249979
+ return new Promise((resolve43, reject) => {
249908
249980
  const onAbort = () => reject(abortError("System DNS lookup was cancelled."));
249909
249981
  signal?.addEventListener("abort", onAbort, { once: true });
249910
- lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) => resolve34(entries.map((entry) => entry.address))).catch(reject).finally(() => signal?.removeEventListener("abort", onAbort));
249982
+ lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) => resolve43(entries.map((entry) => entry.address))).catch(reject).finally(() => signal?.removeEventListener("abort", onAbort));
249911
249983
  });
249912
249984
  }
249913
249985
  function createPublicDnsResolver(fetchImplementation = globalThis.fetch) {
@@ -251166,7 +251238,7 @@ Diagnostics:
251166
251238
  var TaskIdSchema = z222.string().regex(/^bg_[a-f0-9]{16}$/);
251167
251239
  var GetBackgroundTaskOutputInputSchema = z222.object({
251168
251240
  taskIds: z222.array(TaskIdSchema).min(1).max(20),
251169
- waitMs: z222.number().int().min(0).max(3e4).optional(),
251241
+ waitMs: z222.number().int().min(0).transform((value) => Math.min(value, 3e4)).optional(),
251170
251242
  waitFor: z222.enum(["any", "all"]).optional()
251171
251243
  });
251172
251244
  var KillBackgroundTaskInputSchema = z222.object({
@@ -251175,7 +251247,7 @@ var KillBackgroundTaskInputSchema = z222.object({
251175
251247
  var ListBackgroundTasksInputSchema = z222.object({}).strict();
251176
251248
  var GetBackgroundTaskOutputTool = class {
251177
251249
  name = "get_background_task_output";
251178
- description = "Get bounded output and status for one or more background tasks. Set waitMs to wait briefly for any or all tasks without polling or sleeping.";
251250
+ description = "Get bounded output and status for one or more background tasks. Set waitMs to wait briefly for any or all tasks without polling or sleeping; values above 30000 are safely capped to 30000.";
251179
251251
  inputSchema = GetBackgroundTaskOutputInputSchema;
251180
251252
  risk = "read";
251181
251253
  async execute(input, ctx) {
@@ -251396,8 +251468,8 @@ var BackgroundTaskRuntime = class {
251396
251468
  );
251397
251469
  }
251398
251470
  let resolveCompletion = () => void 0;
251399
- const completion = new Promise((resolve34) => {
251400
- resolveCompletion = resolve34;
251471
+ const completion = new Promise((resolve43) => {
251472
+ resolveCompletion = resolve43;
251401
251473
  });
251402
251474
  const task = {
251403
251475
  id,
@@ -251592,8 +251664,16 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
251592
251664
  if (task.status !== "running") return;
251593
251665
  task.requestedStop = status;
251594
251666
  const gracefulSignalConfirmed = await signalProcessTree(task.child, false);
251667
+ if (process.platform === "win32" && gracefulSignalConfirmed && task.status === "running") {
251668
+ this.settleTask(task, status, task.child.exitCode);
251669
+ return;
251670
+ }
251595
251671
  if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
251596
251672
  const forcedSignalConfirmed = await signalProcessTree(task.child, true);
251673
+ if (process.platform === "win32" && forcedSignalConfirmed && task.status === "running") {
251674
+ this.settleTask(task, status, task.child.exitCode);
251675
+ return;
251676
+ }
251597
251677
  if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
251598
251678
  if (task.status === "running" && (task.child.exitCode !== null || task.child.signalCode !== null)) {
251599
251679
  this.settleTask(
@@ -251604,10 +251684,6 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
251604
251684
  );
251605
251685
  return;
251606
251686
  }
251607
- if (process.platform === "win32" && task.status === "running" && (gracefulSignalConfirmed || forcedSignalConfirmed)) {
251608
- this.settleTask(task, status, task.child.exitCode);
251609
- return;
251610
- }
251611
251687
  throw new Error(
251612
251688
  `Background task ${task.id} did not exit after graceful and forced termination.`
251613
251689
  );
@@ -251642,12 +251718,12 @@ async function signalProcessTree(child, force) {
251642
251718
  const pid = child.pid;
251643
251719
  if (!pid) return false;
251644
251720
  if (process.platform === "win32") {
251645
- return new Promise((resolve34) => {
251721
+ return new Promise((resolve43) => {
251646
251722
  execFile(
251647
251723
  "taskkill.exe",
251648
251724
  ["/pid", String(pid), "/t", ...force ? ["/f"] : []],
251649
251725
  HIDDEN_CHILD_PROCESS_OPTIONS,
251650
- (error) => resolve34(error === null)
251726
+ (error) => resolve43(error === null)
251651
251727
  );
251652
251728
  });
251653
251729
  }
@@ -251668,17 +251744,17 @@ async function waitWithTimeout(promise, timeoutMs, abortSignal) {
251668
251744
  try {
251669
251745
  return await Promise.race([
251670
251746
  promise.then(() => true),
251671
- new Promise((resolve34) => {
251672
- timeout = setTimeout(() => resolve34(false), timeoutMs);
251747
+ new Promise((resolve43) => {
251748
+ timeout = setTimeout(() => resolve43(false), timeoutMs);
251673
251749
  timeout.unref?.();
251674
251750
  }),
251675
- new Promise((resolve34) => {
251751
+ new Promise((resolve43) => {
251676
251752
  if (!abortSignal) return;
251677
251753
  if (abortSignal.aborted) {
251678
- resolve34(false);
251754
+ resolve43(false);
251679
251755
  return;
251680
251756
  }
251681
- abortListener = () => resolve34(false);
251757
+ abortListener = () => resolve43(false);
251682
251758
  abortSignal.addEventListener("abort", abortListener, { once: true });
251683
251759
  })
251684
251760
  ]);
@@ -251711,7 +251787,7 @@ import { z as z25 } from "zod";
251711
251787
  import { basename, join as join7 } from "path";
251712
251788
  import { existsSync as existsSync43, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, renameSync as renameSync3, rmSync as rmSync2 } from "fs";
251713
251789
  import { promises as fsPromises3 } from "fs";
251714
- import { join as join24, dirname as dirname32, isAbsolute as isAbsolute4, resolve as resolve32 } from "path";
251790
+ import { join as join24, dirname as dirname32, isAbsolute as isAbsolute4, resolve as resolve33 } from "path";
251715
251791
  import { createHash as createHash4, randomUUID as randomUUID32 } from "crypto";
251716
251792
  import { execFile as execFile2 } from "child_process";
251717
251793
  import glob3 from "fast-glob";
@@ -251735,11 +251811,11 @@ import { existsSync as existsSync53, promises as fs2 } from "fs";
251735
251811
  import { fileURLToPath as fileURLToPath2 } from "url";
251736
251812
  import { parse as parseYaml3 } from "yaml";
251737
251813
  import { z as z53 } from "zod";
251738
- import { dirname as dirname42, join as join43 } from "path";
251814
+ import { dirname as dirname42, join as join42 } from "path";
251739
251815
  import { parse as parseYaml22 } from "yaml";
251740
251816
  import { z as z63 } from "zod";
251741
251817
  import { existsSync as existsSync62, lstatSync as lstatSync3, promises as fs22 } from "fs";
251742
- import { dirname as dirname6, isAbsolute as isAbsolute32, join as join52, win32 as win322 } from "path";
251818
+ import { dirname as dirname6, isAbsolute as isAbsolute32, join as join52, win32 as win323 } from "path";
251743
251819
  import { parse as parseYaml32 } from "yaml";
251744
251820
  var ProjectIndexer = class {
251745
251821
  constructor(cwd) {
@@ -252967,7 +253043,7 @@ function embeddingBatches(texts) {
252967
253043
  return batches;
252968
253044
  }
252969
253045
  function workspaceIndexKey(cwd) {
252970
- const absolute = resolve32(cwd).replace(/\\/g, "/");
253046
+ const absolute = resolve33(cwd).replace(/\\/g, "/");
252971
253047
  return process.platform === "win32" ? absolute.toLowerCase() : absolute;
252972
253048
  }
252973
253049
  function resolveConfiguredApiKey(provider) {
@@ -253172,7 +253248,7 @@ function getEmbeddingProvider(config) {
253172
253248
  var SymbolIndexer = class {
253173
253249
  constructor(cwd) {
253174
253250
  this.cwd = cwd;
253175
- this.indexPath = resolve32(cwd, ".orbit", "symbols.json");
253251
+ this.indexPath = resolve33(cwd, ".orbit", "symbols.json");
253176
253252
  }
253177
253253
  cwd;
253178
253254
  indexPath;
@@ -253194,9 +253270,9 @@ var SymbolIndexer = class {
253194
253270
  async performIndex() {
253195
253271
  try {
253196
253272
  this.initializeIndexPath();
253197
- const normCwd = resolve32(this.cwd).toLowerCase().replace(/\\/g, "/");
253273
+ const normCwd = resolve33(this.cwd).toLowerCase().replace(/\\/g, "/");
253198
253274
  const { homedir: homedir22 } = await import("os");
253199
- const normHome = resolve32(homedir22()).toLowerCase().replace(/\\/g, "/");
253275
+ const normHome = resolve33(homedir22()).toLowerCase().replace(/\\/g, "/");
253200
253276
  if (normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) || dirname32(normCwd) === normCwd) {
253201
253277
  return;
253202
253278
  }
@@ -254179,7 +254255,7 @@ var SkillPresentationSchema = z63.object({
254179
254255
  }).passthrough().optional()
254180
254256
  }).passthrough();
254181
254257
  async function loadSkillPresentation(skillFilePath) {
254182
- const metadataPath = join43(
254258
+ const metadataPath = join42(
254183
254259
  dirname42(skillFilePath),
254184
254260
  ...PRESENTATION_SIDECAR_SEGMENTS
254185
254261
  );
@@ -254537,7 +254613,7 @@ function validateReference(skill, reference, diagnostics) {
254537
254613
  return;
254538
254614
  }
254539
254615
  if (!relativePath) return;
254540
- if (isAbsolute32(relativePath) || win322.isAbsolute(relativePath)) {
254616
+ if (isAbsolute32(relativePath) || win323.isAbsolute(relativePath)) {
254541
254617
  diagnostics.push(
254542
254618
  diagnostic(
254543
254619
  skill.path,
@@ -258158,7 +258234,7 @@ import {
258158
258234
  readdirSync as readdirSync22,
258159
258235
  unlinkSync as unlinkSync22
258160
258236
  } from "fs";
258161
- import { basename as basename22, join as join34, resolve as resolve33 } from "path";
258237
+ import { basename as basename22, join as join34, resolve as resolve34 } from "path";
258162
258238
  import { z as z45 } from "zod";
258163
258239
  var SafeObjectKeySchema = z30.string().refine(
258164
258240
  (key) => !["__proto__", "constructor", "prototype"].includes(key),
@@ -259849,7 +259925,7 @@ var AgentRunSchema = z45.object({
259849
259925
  var AgentRunStore = class {
259850
259926
  constructor(cwd, options = {}) {
259851
259927
  this.cwd = cwd;
259852
- this.directory = resolve33(cwd, ".orbit", "agent-runs");
259928
+ this.directory = resolve34(cwd, ".orbit", "agent-runs");
259853
259929
  this.now = options.now ?? (() => /* @__PURE__ */ new Date());
259854
259930
  this.ownerPid = options.ownerPid ?? process.pid;
259855
259931
  this.ownerInstanceId = options.ownerInstanceId ?? generateId("orbit");
@@ -260180,7 +260256,7 @@ var AgentRunStore = class {
260180
260256
  this.cwd,
260181
260257
  join34(".orbit", "agent-runs")
260182
260258
  );
260183
- if (resolve33(safeDirectory) !== this.directory) {
260259
+ if (resolve34(safeDirectory) !== this.directory) {
260184
260260
  throw new Error("Orbit agent-run directory escaped the workspace.");
260185
260261
  }
260186
260262
  }
@@ -261211,7 +261287,7 @@ function getErrorMessage(error) {
261211
261287
  return error instanceof Error ? error.message : String(error);
261212
261288
  }
261213
261289
  var Planner = class {
261214
- static makeSystemPrompt(modelName = "DeepSeek", language = "en", providerId, sessionGoal, projectMemory, taskPlan, supportsThinking = false) {
261290
+ static makeSystemPrompt(modelName = "DeepSeek", language = "en", providerId, sessionGoal, projectMemory, taskPlan, supportsThinking = false, platform = process.platform) {
261215
261291
  const cleanModel = cleanRuntimeLabel(modelName, "unknown-model");
261216
261292
  const cleanProviderId = cleanRuntimeLabel(providerId || "", "");
261217
261293
  const normalizedProvider = cleanProviderId.toLowerCase();
@@ -261256,6 +261332,7 @@ Active Task Plan:
261256
261332
  ${planItems.map((item) => `- ${item}`).join("\n")}
261257
261333
  - Continue from the current in-progress item and keep plan status accurate.
261258
261334
  ` : "";
261335
+ const shellSection = runtimeShellGuidance(platform);
261259
261336
  const prompt = `You are Orbit, a local AI coding agent running inside the user's terminal, powered by ${providerName} (model: ${cleanModel}).
261260
261337
  Your job is to help the user modify, debug, test, document, and understand software projects.
261261
261338
  You have tools for reading files, searching code, editing files, running commands, inspecting git status, and managing diffs.
@@ -261270,6 +261347,14 @@ Self-Identity Rules:
261270
261347
  Language Rules:
261271
261348
  ${language !== "en" ? "- Reply in Simplified Chinese by default unless the user explicitly asks for another language. Keep commands, file paths, code identifiers, API names, and quoted source text in their original language." : "- Reply in the user's language when it is clear from their message. If the language is ambiguous, use concise English. Keep commands, file paths, code identifiers, API names, and quoted source text in their original language."}
261272
261349
 
261350
+ Runtime and tool rules:
261351
+ ${shellSection}
261352
+ - Shell commands already start in the workspace root. Do not prepend cd/chdir or repeat the absolute workspace path.
261353
+ - Prefer read_file, grep, glob, and edit_file over shell commands that merely read, search, or rewrite text. Use the shell for actual project executables, builds, tests, and operating-system tasks.
261354
+ - Keep each command single-purpose and directly executable in the declared shell. Avoid nested command strings, inline script heredocs, output-suppression pipelines, and byte-level probes when a structured file tool can answer the question.
261355
+ - For background work, poll with get_background_task_output using waitMs at most 30000. Read and obey tool validation ranges instead of retrying invalid inputs.
261356
+ - After a command failure, use its first actionable diagnostic to change the command or repair the cause. Do not repeat near-identical probes that return the same evidence.
261357
+
261273
261358
  Core rules:
261274
261359
  1. Understand the project before editing.
261275
261360
  2. Prefer minimal, precise changes.
@@ -261292,6 +261377,21 @@ Core rules:
261292
261377
  return prompt;
261293
261378
  }
261294
261379
  };
261380
+ function runtimeShellGuidance(platform) {
261381
+ if (platform === "win32") {
261382
+ return [
261383
+ "- Runtime OS: Windows. The tool named bash executes native non-interactive PowerShell for compatibility with the existing tool protocol.",
261384
+ "- Write PowerShell commands: Get-Content, Get-ChildItem, Select-String, Where-Object, Set-Location only when truly needed, and $LASTEXITCODE for native-process exit status.",
261385
+ "- Do not use POSIX-only grep/sed/head/tail, heredoc (<<), /dev/null, export, or Bash $? syntax. Do not join steps with &&; use one command per tool call or explicit PowerShell control flow.",
261386
+ "- Quote Windows paths with single quotes and use -LiteralPath for paths containing spaces, brackets, or non-ASCII characters."
261387
+ ].join("\n");
261388
+ }
261389
+ const os3 = platform === "darwin" ? "macOS" : "Linux/Unix";
261390
+ return [
261391
+ `- Runtime OS: ${os3}. The bash tool executes non-interactive Bash, falling back to POSIX sh when Bash is unavailable.`,
261392
+ "- Write portable POSIX commands and quote paths. Do not use PowerShell cmdlets, -LiteralPath, or $LASTEXITCODE."
261393
+ ].join("\n");
261394
+ }
261295
261395
  function cleanRuntimeGoal(value) {
261296
261396
  return (value || "").replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim().slice(0, 4e3);
261297
261397
  }
@@ -261780,13 +261880,38 @@ var AgentInputQueueController = class {
261780
261880
  var IDENTICAL_CALL_THRESHOLD = 3;
261781
261881
  var REPEATED_FAILURE_THRESHOLD = 2;
261782
261882
  var RENUDGE_INCREMENT = 2;
261783
- function canonicalizeArguments(rawArguments) {
261883
+ function canonicalizeArguments(toolName, rawArguments) {
261784
261884
  try {
261785
- return JSON.stringify(sortValue(JSON.parse(rawArguments)));
261885
+ const parsed = JSON.parse(rawArguments);
261886
+ if (toolName === "bash") {
261887
+ const probe = canonicalizeShellProbe(parsed);
261888
+ if (probe) return probe;
261889
+ }
261890
+ return JSON.stringify(sortValue(parsed));
261786
261891
  } catch {
261787
261892
  return rawArguments.trim();
261788
261893
  }
261789
261894
  }
261895
+ function canonicalizeShellProbe(value) {
261896
+ if (value === null || typeof value !== "object") return void 0;
261897
+ const command = value.command;
261898
+ if (typeof command !== "string") return void 0;
261899
+ const looksLikeProbe = /(?:\b(?:Get-Content|Select-String|grep|sed|head|tail|cat)\b|\bpython(?:\.exe)?\b[\s\S]*\b(?:open|read_text|read_bytes)\s*\()/i.test(
261900
+ command
261901
+ );
261902
+ const looksMutatingOrExecutable = /(?:\b(?:Set-Content|Add-Content|Remove-Item|Move-Item|Copy-Item|xelatex|pdflatex|npm|pnpm|yarn|pytest|vitest)\b|(?:^|\s)(?:>|>>)(?:\s|$)|\.write\s*\()/i.test(
261903
+ command
261904
+ );
261905
+ if (!looksLikeProbe || looksMutatingOrExecutable) return void 0;
261906
+ const files = command.match(
261907
+ /[\p{L}\p{N}_./\\:@+~-]+\.(?:[cm]?[jt]sx?|py|json|ya?ml|toml|md|tex|log|txt|csv|xml|html|css|scss|sql|rs|go|java|kt|swift)/giu
261908
+ );
261909
+ if (!files?.length) return void 0;
261910
+ const normalized = [
261911
+ ...new Set(files.map((file) => file.replace(/\\/g, "/")))
261912
+ ].sort();
261913
+ return `shell-probe:${normalized.join("|")}`;
261914
+ }
261790
261915
  function sortValue(value) {
261791
261916
  if (Array.isArray(value)) return value.map(sortValue);
261792
261917
  if (value !== null && typeof value === "object") {
@@ -261814,7 +261939,11 @@ var LoopProgressGuard = class {
261814
261939
  * no-progress streak past a threshold, or null when the loop looks healthy.
261815
261940
  */
261816
261941
  record(observation) {
261817
- const signature = `${observation.name}\0${canonicalizeArguments(observation.arguments)}`;
261942
+ const canonicalArguments = canonicalizeArguments(
261943
+ observation.name,
261944
+ observation.arguments
261945
+ );
261946
+ const signature = JSON.stringify([observation.name, canonicalArguments]);
261818
261947
  if (signature !== this.lastSignature) {
261819
261948
  this.lastSignature = signature;
261820
261949
  this.streakLength = 1;
@@ -261835,10 +261964,11 @@ var LoopProgressGuard = class {
261835
261964
  }
261836
261965
  if (this.streakLength >= IDENTICAL_CALL_THRESHOLD) {
261837
261966
  this.nextNudgeAt = this.streakLength + RENUDGE_INCREMENT;
261967
+ const repeatedProbe = canonicalArguments.startsWith("shell-probe:");
261838
261968
  return {
261839
- reason: "repeated_identical_call",
261969
+ reason: repeatedProbe ? "repeated_probe" : "repeated_identical_call",
261840
261970
  repeatCount: this.streakLength,
261841
- message: `[Loop guard] You have now made the exact same "${observation.name}" call ${this.streakLength} times in a row. The result will not change. Use the information you already have, take a different action, or report what is blocking you.`
261971
+ message: repeatedProbe ? `[Loop guard] You have made ${this.streakLength} consecutive read-only shell probes against the same file(s). Stop varying grep/sed/Python snippets. Use the evidence already collected, use read_file once with a focused range, or repair the reported line directly.` : `[Loop guard] You have now made the exact same "${observation.name}" call ${this.streakLength} times in a row. The result will not change. Use the information you already have, take a different action, or report what is blocking you.`
261842
261972
  };
261843
261973
  }
261844
261974
  return null;
@@ -263238,6 +263368,14 @@ function safeAgentLoopErrorMessage(error) {
263238
263368
  if (message2.length <= AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS) return message2;
263239
263369
  return `${message2.slice(0, AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS - 1)}\u2026`;
263240
263370
  }
263371
+ function formatToolInputValidationError(error) {
263372
+ const issues = error.issues.slice(0, 3).map((issue) => {
263373
+ const field = issue.path.length > 0 ? issue.path.join(".") : "input";
263374
+ return `${field}: ${issue.message}`;
263375
+ });
263376
+ const remaining = Math.max(0, error.issues.length - issues.length);
263377
+ return `Invalid tool input \u2014 ${issues.join("; ")}${remaining ? `; +${remaining} more` : ""}.`;
263378
+ }
263241
263379
  function waitForAgentRetry(delayMs, signal) {
263242
263380
  return new Promise((resolve26, reject) => {
263243
263381
  const cleanup = () => signal?.removeEventListener("abort", onAbort);
@@ -263462,6 +263600,7 @@ var AgentLoop = class _AgentLoop {
263462
263600
  outputLimitRetriesForRun = 0;
263463
263601
  providerRetriesForRun = 0;
263464
263602
  completionVerificationNudgedForRun = false;
263603
+ finalResponseOnlyReason = null;
263465
263604
  approvedToolScopes = /* @__PURE__ */ new Set();
263466
263605
  terminalFailure = null;
263467
263606
  verificationStatus = "not_run";
@@ -263696,6 +263835,7 @@ var AgentLoop = class _AgentLoop {
263696
263835
  this.completionVerificationNudgedForRun = false;
263697
263836
  this.approvedToolScopes.clear();
263698
263837
  this.terminalFailure = null;
263838
+ this.finalResponseOnlyReason = this.pendingTerminalCompletionReason();
263699
263839
  this.verificationStatus = "not_run";
263700
263840
  this.workspaceMutationRevision = 0;
263701
263841
  this.verifiedMutationRevision = -1;
@@ -263784,10 +263924,19 @@ var AgentLoop = class _AgentLoop {
263784
263924
  });
263785
263925
  if (this.state.attemptCount > 1 && Number.isFinite(this.getRunawayPromptInterval()) && (this.state.attemptCount - 1) % this.getRunawayPromptInterval() === 0) {
263786
263926
  const completedIterations = this.state.attemptCount - 1;
263787
- const continueExec = this.options.autoContinueRunaway ? true : await this.interaction.askApproval(
263927
+ const fullAccess = isFullAccessEnabled(this.config);
263928
+ const autoContinue = fullAccess || this.options.autoContinueRunaway === true;
263929
+ const continueExec = autoContinue ? true : await this.interaction.askApproval(
263788
263930
  `Agent loop has run for ${completedIterations} iterations. Continue executing to prevent runaway costs?`
263789
263931
  );
263790
- if (this.options.autoContinueRunaway) {
263932
+ if (autoContinue) {
263933
+ this.sessionManager.logEvent("runaway_checkpoint", {
263934
+ completedIterations,
263935
+ continuedAutomatically: true,
263936
+ reason: fullAccess ? "full_access" : "bounded_automation"
263937
+ });
263938
+ }
263939
+ if (this.options.autoContinueRunaway && !fullAccess) {
263791
263940
  this.interaction.showText(
263792
263941
  picocolors3.gray(
263793
263942
  `\u25CF Automated evaluation checkpoint: continuing after ${completedIterations} iterations within configured limits.`
@@ -263936,6 +264085,9 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
263936
264085
  (t2) => this.options.allowedTools.includes(t2.name)
263937
264086
  );
263938
264087
  }
264088
+ if (this.finalResponseOnlyReason) {
264089
+ toolDefs = [];
264090
+ }
263939
264091
  toolDefs.sort((a2, b) => a2.name.localeCompare(b.name));
263940
264092
  const capabilities = resolveModelCapabilities(
263941
264093
  this.provider,
@@ -264242,7 +264394,7 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
264242
264394
  this.contextOverflowRetriesForRun = 0;
264243
264395
  this.outputLimitRetriesForRun = 0;
264244
264396
  this.providerRetriesForRun = 0;
264245
- if (toolCallsToExecute.length === 0 && responseText && !capabilities.toolCalls) {
264397
+ if (toolCallsToExecute.length === 0 && responseText && !capabilities.toolCalls && !this.finalResponseOnlyReason) {
264246
264398
  const xmlToolCalls = parseXMLToolCalls(responseText);
264247
264399
  const textToolCalls = xmlToolCalls.length > 0 ? [] : parseTextToolCalls(
264248
264400
  responseText,
@@ -264672,8 +264824,18 @@ Please analyze this failure log, locate the files causing assertion or compile e
264672
264824
  { startedAt }
264673
264825
  );
264674
264826
  };
264827
+ let terminalSuccessReachedThisBatch;
264675
264828
  for (const tc of toolCallsToExecute) {
264676
264829
  const toolStartedAt = (/* @__PURE__ */ new Date()).toISOString();
264830
+ if (this.finalResponseOnlyReason) {
264831
+ rejectInvalidToolCall(
264832
+ tc,
264833
+ "A trusted finalizer already completed the delivery. Tool execution is locked; return the final delivery report now.",
264834
+ "read",
264835
+ toolStartedAt
264836
+ );
264837
+ continue;
264838
+ }
264677
264839
  let argSummary = "";
264678
264840
  try {
264679
264841
  const parsed = JSON.parse(tc.arguments);
@@ -264743,7 +264905,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
264743
264905
  if (!validation.success) {
264744
264906
  rejectInvalidToolCall(
264745
264907
  tc,
264746
- `Tool input validation failed: ${validation.error.message}`,
264908
+ formatToolInputValidationError(validation.error),
264747
264909
  declaredRisk,
264748
264910
  toolStartedAt
264749
264911
  );
@@ -265801,6 +265963,15 @@ ${stdout2.substring(0, 2e4)}`
265801
265963
  );
265802
265964
  }
265803
265965
  }
265966
+ const terminalSuccess = finalResult.ok && tc.name === "run_tests" && finalResult.metadata?.terminalSuccess === "cumcm-finalizer" ? "cumcm-finalizer" : void 0;
265967
+ if (terminalSuccess) {
265968
+ terminalSuccessReachedThisBatch = terminalSuccess;
265969
+ this.finalResponseOnlyReason = terminalSuccess;
265970
+ this.sessionManager.logEvent("terminal_completion_latched", {
265971
+ toolName: tc.name,
265972
+ kind: terminalSuccess
265973
+ });
265974
+ }
265804
265975
  if (finalResult.ok) {
265805
265976
  const statusText = truncateToolText(
265806
265977
  redactSecrets(finalResult.display || "Done"),
@@ -265868,6 +266039,27 @@ ${guardNudge.message}` : ""),
265868
266039
  content: toolResultBlocks
265869
266040
  };
265870
266041
  this.state.history.push(toolMsg);
266042
+ if (terminalSuccessReachedThisBatch) {
266043
+ this.state.history.push({
266044
+ id: `msg_terminal_completion_${Date.now()}`,
266045
+ role: "user",
266046
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
266047
+ content: [
266048
+ {
266049
+ type: "text",
266050
+ text: [
266051
+ "Orbit terminal completion contract: the trusted project finalizer succeeded.",
266052
+ "Do not call or describe any further tools, edits, probes, builds, or verification.",
266053
+ "Return only the concise final delivery report required by the active Skill, using the verified artifacts already present."
266054
+ ].join(" ")
266055
+ }
266056
+ ],
266057
+ metadata: {
266058
+ kind: "terminal_completion",
266059
+ terminalSuccess: terminalSuccessReachedThisBatch
266060
+ }
266061
+ });
266062
+ }
265871
266063
  this.abortController = null;
265872
266064
  this.sessionManager.saveHistory(this.state.history);
265873
266065
  }
@@ -266336,6 +266528,8 @@ ${diff.substring(0, 2e4)}`
266336
266528
  this.state.task = task;
266337
266529
  this.state.done = false;
266338
266530
  this.state.attemptCount = 0;
266531
+ this.state.maxAttempts = resolveAgentMaxLoopAttempts(this.config);
266532
+ this.finalResponseOnlyReason = null;
266339
266533
  this.progressGuard.reset();
266340
266534
  this.state.history.push({
266341
266535
  id: `msg_user_${Date.now()}`,
@@ -266345,10 +266539,15 @@ ${diff.substring(0, 2e4)}`
266345
266539
  });
266346
266540
  this.sessionManager.saveHistory(this.state.history);
266347
266541
  }
266542
+ pendingTerminalCompletionReason() {
266543
+ const lastMessage = this.state.history.at(-1);
266544
+ return lastMessage?.role === "user" && lastMessage.metadata?.kind === "terminal_completion" && lastMessage.metadata?.terminalSuccess === "cumcm-finalizer" ? "cumcm-finalizer" : null;
266545
+ }
266348
266546
  /** Apply all pending steering inputs at a provider-safe conversation boundary. */
266349
266547
  applyPendingSteeringInputs() {
266350
266548
  const inputs = this.inputQueue.drainSteering();
266351
266549
  if (inputs.length === 0) return false;
266550
+ this.finalResponseOnlyReason = null;
266352
266551
  for (const input of inputs) {
266353
266552
  this.state.history.push({
266354
266553
  id: `msg_user_steer_${randomUUID52().replace(/-/g, "")}`,
@@ -277382,6 +277581,10 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
277382
277581
  button.addEventListener('click', () => requestPermissionMode(button.dataset.mode).catch(() => {}));
277383
277582
  });
277384
277583
 
277584
+ elements.agentMaxIterations.addEventListener('change', () => {
277585
+ applySettings({ agentMaxIterations: Number(elements.agentMaxIterations.value) }, true).catch(() => {});
277586
+ });
277587
+
277385
277588
  elements.searchToggle.addEventListener('click', () => {
277386
277589
  const enabled = elements.searchToggle.getAttribute('aria-pressed') !== 'true';
277387
277590
  applySettings({ webSearchEnabled: enabled }, true).catch(() => {});
@@ -278409,6 +278612,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278409
278612
  table: '数据表格',
278410
278613
  reasoning: '思考过程',
278411
278614
  tool: '工具',
278615
+ toolBatch: '工具步骤',
278412
278616
  running: '运行中',
278413
278617
  done: '完成',
278414
278618
  error: '失败',
@@ -278534,9 +278738,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278534
278738
  permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
278535
278739
  permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
278536
278740
  permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
278537
- permissionGuards: chinese('危险操作会被阻止,显式文件路径会受保护;本机命令、成本与失控检查仍然有效。', '危險操作會被阻止,顯式檔案路徑會受保護;本機命令、成本與失控檢查仍然有效。'),
278741
+ permissionGuards: chinese('危险操作会被阻止,显式文件路径会受保护;本机命令、预算与长任务上限仍然有效。', '危險操作會被阻止,顯式檔案路徑會受保護;本機命令、預算與長任務上限仍然有效。'),
278538
278742
  permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
278539
- permissionNoGuards: chinese('权限策略不再拦截或复核危险、密钥、不透明、本地网络及工作区外操作。命令拥有当前系统账户权限并继承 Orbit 进程环境;已运行的子进程会保留这些权限直至停止。输出脱敏、项目钩子、验证契约、工具限制及成本与失控检查仍有效;工作区外改动无法由 Orbit 回滚。', '權限策略不再攔截或複核危險、密鑰、不透明、本機網路及工作區外操作。命令擁有目前系統帳戶權限並繼承 Orbit 程序環境;已執行的子程序會保留這些權限直至停止。輸出脫敏、專案掛鉤、驗證契約、工具限制及成本與失控檢查仍有效;工作區外變更無法由 Orbit 回滾。'),
278743
+ permissionNoGuards: chinese('权限策略不再拦截或复核危险、密钥、不透明、本地网络及工作区外操作。命令拥有当前系统账户权限并继承 Orbit 进程环境;已运行的子进程会保留这些权限直至停止。中间迭代检查点会自动继续且不再询问。输出脱敏、项目钩子、验证契约、预算、停滞循环检测和配置的最终迭代上限仍有效;工作区外改动无法由 Orbit 回滚。', '權限策略不再攔截或複核危險、密鑰、不透明、本機網路及工作區外操作。命令擁有目前系統帳戶權限並繼承 Orbit 程序環境;已執行的子程序會保留這些權限直至停止。中間迭代檢查點會自動繼續且不再詢問。輸出脫敏、專案掛鉤、驗證契約、預算、停滯迴圈偵測和設定的最終迭代上限仍有效;工作區外變更無法由 Orbit 回滾。'),
278540
278744
  }
278541
278745
  : {
278542
278746
  connected: 'Connected',
@@ -278562,6 +278766,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278562
278766
  table: 'Data table',
278563
278767
  reasoning: 'Reasoning',
278564
278768
  tool: 'Tool',
278769
+ toolBatch: 'Tool steps',
278565
278770
  running: 'Running',
278566
278771
  done: 'Done',
278567
278772
  error: 'Failed',
@@ -278687,9 +278892,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278687
278892
  permissionStrict: 'Strict mode asks before consequential operations.',
278688
278893
  permissionNormal: 'Normal mode asks before writes and command execution.',
278689
278894
  permissionPlan: 'Plan mode analyzes and reads without changing files.',
278690
- permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; commands remain host processes and periodic cost/runaway checks stay active.',
278895
+ permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; commands remain host processes and budget/long-task limits stay active.',
278691
278896
  permissionGuardsReduced: 'Warning: some hard safety guards are disabled in configuration.',
278692
- permissionNoGuards: "The permission policy no longer blocks or reviews dangerous, protected, opaque, local-network, or outside-workspace actions. Commands use host-account permissions and inherit Orbit's process environment; running children retain that authority until stopped. Output redaction, project hooks, verification contracts, tool limits, and cost/runaway checks remain; outside-workspace changes have no Orbit rollback.",
278897
+ permissionNoGuards: "The permission policy no longer blocks or reviews dangerous, protected, opaque, local-network, or outside-workspace actions. Commands use host-account permissions and inherit Orbit's process environment; running children retain that authority until stopped. Intermediate iteration checkpoints continue automatically without asking. Output redaction, project hooks, verification contracts, budget, stalled-loop detection, and the configured final iteration ceiling remain; outside-workspace changes have no Orbit rollback.",
278693
278898
  };
278694
278899
 
278695
278900
  if (language === 'zh-TW') {
@@ -278934,6 +279139,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278934
279139
  permissionSelect: byId('permissionSelect'),
278935
279140
  permissionSegments: byId('permissionSegments'),
278936
279141
  permissionSummary: byId('permissionSummary'),
279142
+ agentMaxIterations: byId('agentMaxIterations'),
278937
279143
  searchToggle: byId('searchToggle'),
278938
279144
  searchEnabled: byId('searchEnabled'),
278939
279145
  searchDependencies: byId('searchDependencies'),
@@ -280082,6 +280288,54 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
280082
280288
  return { root: details, body };
280083
280289
  }
280084
280290
 
280291
+ function displayToolName(name) {
280292
+ const normalized = String(name || copy.tool).trim();
280293
+ if (normalized === 'bash') return 'Shell';
280294
+ if (normalized === 'run_tests') return language === 'en' ? 'Verification' : '验证';
280295
+ return normalized.replace(/_/g, ' ');
280296
+ }
280297
+
280298
+ function isBatchableTool(block) {
280299
+ return block
280300
+ && block.type === 'tool'
280301
+ && block.status === 'success'
280302
+ && !block.isError
280303
+ && ['read_file', 'grep', 'glob', 'bash', 'get_background_task_output'].includes(block.name);
280304
+ }
280305
+
280306
+ function createToolBatch(blocks) {
280307
+ const root = document.createElement('details');
280308
+ root.className = 'tool-batch is-success';
280309
+ const summary = document.createElement('summary');
280310
+ summary.className = 'tool-batch-summary';
280311
+ const status = document.createElement('span');
280312
+ status.className = 'tool-status';
280313
+ const label = document.createElement('strong');
280314
+ label.textContent = copy.toolBatch;
280315
+ const names = [...new Set(blocks.map((block) => displayToolName(block.name)))];
280316
+ const context = document.createElement('span');
280317
+ context.className = 'tool-context';
280318
+ context.textContent = names.slice(0, 3).join(' · ');
280319
+ const count = document.createElement('span');
280320
+ count.className = 'tool-batch-count';
280321
+ count.textContent = '×' + blocks.length;
280322
+ const chevron = document.createElement('span');
280323
+ chevron.className = 'tool-chevron';
280324
+ chevron.setAttribute('aria-hidden', 'true');
280325
+ chevron.textContent = '›';
280326
+ summary.append(status, label, context, count, chevron);
280327
+ const body = document.createElement('div');
280328
+ body.className = 'tool-batch-body';
280329
+ blocks.forEach((block) => body.append(createToolCard(block)));
280330
+ root.append(summary, body);
280331
+ summary.setAttribute('aria-label', copy.toolBatch + ' · ' + blocks.length);
280332
+ summary.setAttribute('aria-expanded', 'false');
280333
+ root.addEventListener('toggle', () => {
280334
+ summary.setAttribute('aria-expanded', String(root.open));
280335
+ });
280336
+ return root;
280337
+ }
280338
+
280085
280339
  function createToolCard(block) {
280086
280340
  const root = document.createElement('details');
280087
280341
  const summary = document.createElement('summary');
@@ -280122,7 +280376,7 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
280122
280376
  const context = root.querySelector('.tool-context');
280123
280377
  const outcome = root.querySelector('.tool-outcome');
280124
280378
  const detail = root.querySelector('.tool-detail');
280125
- label.textContent = block.name || copy.tool;
280379
+ label.textContent = displayToolName(block.name);
280126
280380
  const summaryText = String(block.summary || '').trim();
280127
280381
  const detailText = String(block.detail || '').trim();
280128
280382
  context.textContent = summaryText || detailText.split('\n', 1)[0] || '';
@@ -280240,7 +280494,21 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
280240
280494
  const blocks = Array.isArray(message.blocks) && message.blocks.length
280241
280495
  ? message.blocks
280242
280496
  : [{ type: 'text', text: message.text || '' }];
280243
- for (const block of blocks) {
280497
+ for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
280498
+ const block = blocks[blockIndex];
280499
+ if (!streaming && isBatchableTool(block)) {
280500
+ const sequence = [block];
280501
+ while (blockIndex + 1 < blocks.length && isBatchableTool(blocks[blockIndex + 1])) {
280502
+ sequence.push(blocks[blockIndex + 1]);
280503
+ blockIndex += 1;
280504
+ }
280505
+ if (sequence.length >= 3) {
280506
+ content.append(createToolBatch(sequence));
280507
+ continue;
280508
+ }
280509
+ sequence.forEach((item) => content.append(createToolCard(item)));
280510
+ continue;
280511
+ }
280244
280512
  if (block.type === 'text' && block.text) {
280245
280513
  const body = document.createElement('div');
280246
280514
  body.className = 'rich-text' + (streaming ? ' stream-caret' : '');
@@ -281711,6 +281979,7 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
281711
281979
  }
281712
281980
  elements.permissionSummary.classList.toggle('is-full-access', Boolean(permissions.fullAccess));
281713
281981
  elements.permissionSummary.classList.toggle('is-warning', !hardGuardsEnabled || (mode === 'auto' && !permissions.fullAccess));
281982
+ elements.agentMaxIterations.value = String(data.agent && data.agent.maxIterations || 200);
281714
281983
  const webSearch = data.tools && data.tools.webSearch || {};
281715
281984
  elements.searchProvider.value = webSearch.provider || 'auto';
281716
281985
  syncSelectControl(elements.searchProvider);
@@ -282971,7 +283240,8 @@ function summarizeWebToolValue(value, options = {}) {
282971
283240
  "symbol",
282972
283241
  "url",
282973
283242
  "language",
282974
- "description"
283243
+ "description",
283244
+ "command"
282975
283245
  ];
282976
283246
  const entries = [];
282977
283247
  for (const field of safeFields) {
@@ -283077,6 +283347,9 @@ function safeWebText(value, maxLength) {
283077
283347
  }
283078
283348
  function safeWebToolText(value, maxLength) {
283079
283349
  return safeWebText(value, maxLength).replace(
283350
+ /(--(?:api-?key|token|password|secret)(?:=|\s+))(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi,
283351
+ "$1***REDACTED***"
283352
+ ).replace(
283080
283353
  /((?:api[_-]?key|token|password|secret)\s*[=:]\s*)[^\s,;]+/gi,
283081
283354
  "$1***REDACTED***"
283082
283355
  ).trim();
@@ -283268,6 +283541,9 @@ function collectWebUiStatus(options, activeTurn) {
283268
283541
  maxReviewAttempts: config.agent.maxReviewAttempts,
283269
283542
  maxReviewConcurrency: config.agent.maxReviewConcurrency
283270
283543
  },
283544
+ agent: {
283545
+ maxIterations: config.agent.maxIterations
283546
+ },
283271
283547
  backgroundTasks,
283272
283548
  inputQueue,
283273
283549
  provider: {
@@ -283582,6 +283858,7 @@ function collectWebUiSettings(options) {
283582
283858
  model: activeModel2,
283583
283859
  modelOptions: buildModelOptions(options, activeModel2),
283584
283860
  permissionMode: config.permissions.mode,
283861
+ agentMaxIterations: config.agent.maxIterations,
283585
283862
  webSearchEnabled: config.tools.webSearch.enabled,
283586
283863
  webSearchProvider: config.tools.webSearch.provider,
283587
283864
  webSearchMaxResults: config.tools.webSearch.maxResults,
@@ -284194,11 +284471,13 @@ var BASE_COPY = {
284194
284471
  permission: "Permission mode",
284195
284472
  permissionDescription: "Choose how much Orbit may do without interrupting you.",
284196
284473
  permissionGuardLabel: "The active permission scope and remaining safeguards appear here.",
284474
+ agentMaxIterations: "Long-task iteration limit",
284475
+ agentMaxIterationsDescription: "Maximum model/tool rounds in one task. Full Access continues intermediate checkpoints without asking; this final ceiling, cancellation, budget, and stalled-loop detection remain active.",
284197
284476
  fullAccessConfirmTitle: "Grant unrestricted Full Access?",
284198
284477
  fullAccessConfirmBody: "Orbit's permission policy will approve every enabled tool action without asking or requesting post-write review.",
284199
284478
  fullAccessConfirmScope: "Reads, writes, local/private network calls, dangerous operations, protected paths, and outside-workspace commands run automatically.",
284200
284479
  fullAccessConfirmGuards: "No permission guard remains. Opaque interpreters and commands that can delete or overwrite host data are also approved.",
284201
- fullAccessConfirmHost: "Actions receive your operating-system account's permissions, and child commands inherit the Orbit process environment, including credential variables; already-running children keep that authority until stopped. Credential values remain redacted from logs and model-visible output. Outside-workspace changes are not covered by Orbit rollback. Project hooks, verification contracts, tool limits, cancellation, and cost/runaway checks remain active.",
284480
+ fullAccessConfirmHost: "Actions receive your operating-system account's permissions, and child commands inherit the Orbit process environment, including credential variables; already-running children keep that authority until stopped. Credential values remain redacted from logs and model-visible output. Outside-workspace changes are not covered by Orbit rollback. Intermediate iteration checkpoints continue automatically without asking; the configured final iteration ceiling, cancellation, budget, stalled-loop detection, project hooks, and verification contracts remain active.",
284202
284481
  fullAccessConfirmAction: "Grant Full Access",
284203
284482
  modeStrict: "Strict",
284204
284483
  modeNormal: "Normal",
@@ -284380,11 +284659,13 @@ var BASE_COPY = {
284380
284659
  permission: "\u6743\u9650\u6A21\u5F0F",
284381
284660
  permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
284382
284661
  permissionGuardLabel: "\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u6743\u9650\u8303\u56F4\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u62A4\u673A\u5236\u3002",
284662
+ agentMaxIterations: "\u957F\u4EFB\u52A1\u8FED\u4EE3\u4E0A\u9650",
284663
+ agentMaxIterationsDescription: "\u5355\u6B21\u4EFB\u52A1\u5141\u8BB8\u7684\u6700\u5927\u6A21\u578B/\u5DE5\u5177\u8F6E\u6570\u3002Full Access \u4F1A\u65E0\u8BE2\u95EE\u8D8A\u8FC7\u4E2D\u95F4\u68C0\u67E5\u70B9\uFF1B\u6700\u7EC8\u4E0A\u9650\u3001\u53D6\u6D88\u3001\u9884\u7B97\u548C\u505C\u6EDE\u5FAA\u73AF\u68C0\u6D4B\u4ECD\u7136\u6709\u6548\u3002",
284383
284664
  fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
284384
284665
  fullAccessConfirmBody: "Orbit \u7684\u6743\u9650\u7B56\u7565\u5C06\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8BE2\u95EE\u6216\u8981\u6C42\u5199\u5165\u540E\u590D\u6838\u3002",
284385
284666
  fullAccessConfirmScope: "\u8BFB\u53D6\u3001\u5199\u5165\u3001\u672C\u5730\u6216\u79C1\u6709\u7F51\u7EDC\u8BBF\u95EE\u3001\u5371\u9669\u64CD\u4F5C\u3001\u5BC6\u94A5\u8DEF\u5F84\u53CA\u5DE5\u4F5C\u533A\u5916\u547D\u4EE4\u5747\u4F1A\u81EA\u52A8\u6267\u884C\u3002",
284386
284667
  fullAccessConfirmGuards: "\u6743\u9650\u4FDD\u62A4\u5C06\u5168\u90E8\u5173\u95ED\uFF1B\u4E0D\u900F\u660E\u89E3\u91CA\u5668\u4EE5\u53CA\u53EF\u80FD\u5220\u9664\u6216\u8986\u76D6\u4E3B\u673A\u6570\u636E\u7684\u547D\u4EE4\u4E5F\u4F1A\u83B7\u51C6\u6267\u884C\u3002",
284387
- fullAccessConfirmHost: "\u64CD\u4F5C\u62E5\u6709\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u7684\u6743\u9650\uFF0C\u5B50\u547D\u4EE4\u4F1A\u7EE7\u627F Orbit \u8FDB\u7A0B\u73AF\u5883\uFF0C\u5305\u62EC\u51ED\u636E\u53D8\u91CF\uFF1B\u5DF2\u8FD0\u884C\u7684\u5B50\u8FDB\u7A0B\u4F1A\u4FDD\u7559\u8FD9\u4E9B\u6743\u9650\u76F4\u81F3\u505C\u6B62\u3002\u51ED\u636E\u503C\u4ECD\u4F1A\u4ECE\u65E5\u5FD7\u548C\u6A21\u578B\u53EF\u89C1\u8F93\u51FA\u4E2D\u8131\u654F\uFF0C\u5DE5\u4F5C\u533A\u5916\u6539\u52A8\u4E0D\u53D7 Orbit \u56DE\u6EDA\u4FDD\u62A4\u3002\u9879\u76EE\u94A9\u5B50\u3001\u9A8C\u8BC1\u5951\u7EA6\u3001\u5DE5\u5177\u9650\u5236\u3001\u53D6\u6D88\u80FD\u529B\u4EE5\u53CA\u6210\u672C\u4E0E\u5931\u63A7\u68C0\u67E5\u4ECD\u7136\u6709\u6548\u3002",
284668
+ fullAccessConfirmHost: "\u64CD\u4F5C\u62E5\u6709\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u7684\u6743\u9650\uFF0C\u5B50\u547D\u4EE4\u4F1A\u7EE7\u627F Orbit \u8FDB\u7A0B\u73AF\u5883\uFF0C\u5305\u62EC\u51ED\u636E\u53D8\u91CF\uFF1B\u5DF2\u8FD0\u884C\u7684\u5B50\u8FDB\u7A0B\u4F1A\u4FDD\u7559\u8FD9\u4E9B\u6743\u9650\u76F4\u81F3\u505C\u6B62\u3002\u51ED\u636E\u503C\u4ECD\u4F1A\u4ECE\u65E5\u5FD7\u548C\u6A21\u578B\u53EF\u89C1\u8F93\u51FA\u4E2D\u8131\u654F\uFF0C\u5DE5\u4F5C\u533A\u5916\u6539\u52A8\u4E0D\u53D7 Orbit \u56DE\u6EDA\u4FDD\u62A4\u3002\u4E2D\u95F4\u8FED\u4EE3\u68C0\u67E5\u70B9\u4F1A\u65E0\u8BE2\u95EE\u81EA\u52A8\u7EE7\u7EED\uFF1B\u914D\u7F6E\u7684\u6700\u7EC8\u8FED\u4EE3\u4E0A\u9650\u3001\u53D6\u6D88\u80FD\u529B\u3001\u9884\u7B97\u3001\u505C\u6EDE\u5FAA\u73AF\u68C0\u6D4B\u3001\u9879\u76EE\u94A9\u5B50\u53CA\u9A8C\u8BC1\u5951\u7EA6\u4ECD\u7136\u6709\u6548\u3002",
284388
284669
  fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6743\u9650",
284389
284670
  modeStrict: "\u4E25\u683C",
284390
284671
  modeNormal: "\u6807\u51C6",
@@ -284538,11 +284819,13 @@ var COPY = {
284538
284819
  permission: "\u6B0A\u9650\u6A21\u5F0F",
284539
284820
  permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
284540
284821
  permissionGuardLabel: "\u9019\u88E1\u6703\u986F\u793A\u76EE\u524D\u6B0A\u9650\u7BC4\u570D\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u8B77\u6A5F\u5236\u3002",
284822
+ agentMaxIterations: "\u9577\u4EFB\u52D9\u8FED\u4EE3\u4E0A\u9650",
284823
+ agentMaxIterationsDescription: "\u55AE\u6B21\u4EFB\u52D9\u5141\u8A31\u7684\u6700\u5927\u6A21\u578B/\u5DE5\u5177\u8F2A\u6578\u3002Full Access \u6703\u4E0D\u7D93\u8A62\u554F\u8D8A\u904E\u4E2D\u9593\u6AA2\u67E5\u9EDE\uFF1B\u6700\u7D42\u4E0A\u9650\u3001\u53D6\u6D88\u3001\u9810\u7B97\u548C\u505C\u6EEF\u8FF4\u5708\u5075\u6E2C\u4ECD\u7136\u6709\u6548\u3002",
284541
284824
  fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
284542
284825
  fullAccessConfirmBody: "Orbit \u7684\u6B0A\u9650\u7B56\u7565\u5C07\u81EA\u52D5\u6279\u51C6\u6240\u6709\u5DF2\u555F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8A62\u554F\u6216\u8981\u6C42\u5BEB\u5165\u5F8C\u8907\u6838\u3002",
284543
284826
  fullAccessConfirmScope: "\u8B80\u53D6\u3001\u5BEB\u5165\u3001\u672C\u6A5F\u6216\u79C1\u6709\u7DB2\u8DEF\u5B58\u53D6\u3001\u5371\u96AA\u64CD\u4F5C\u3001\u5BC6\u9470\u8DEF\u5F91\u53CA\u5DE5\u4F5C\u5340\u5916\u547D\u4EE4\u5747\u6703\u81EA\u52D5\u57F7\u884C\u3002",
284544
284827
  fullAccessConfirmGuards: "\u6B0A\u9650\u4FDD\u8B77\u5C07\u5168\u90E8\u95DC\u9589\uFF1B\u4E0D\u900F\u660E\u89E3\u8B6F\u5668\u4EE5\u53CA\u53EF\u80FD\u522A\u9664\u6216\u8986\u5BEB\u4E3B\u6A5F\u8CC7\u6599\u7684\u547D\u4EE4\u4E5F\u6703\u7372\u51C6\u57F7\u884C\u3002",
284545
- fullAccessConfirmHost: "\u64CD\u4F5C\u64C1\u6709\u76EE\u524D\u7CFB\u7D71\u5E33\u6236\u7684\u6B0A\u9650\uFF0C\u5B50\u547D\u4EE4\u6703\u7E7C\u627F Orbit \u7A0B\u5E8F\u74B0\u5883\uFF0C\u5305\u62EC\u6191\u64DA\u8B8A\u6578\uFF1B\u5DF2\u57F7\u884C\u7684\u5B50\u7A0B\u5E8F\u6703\u4FDD\u7559\u9019\u4E9B\u6B0A\u9650\u76F4\u81F3\u505C\u6B62\u3002\u6191\u64DA\u503C\u4ECD\u6703\u5F9E\u65E5\u8A8C\u548C\u6A21\u578B\u53EF\u898B\u8F38\u51FA\u4E2D\u812B\u654F\uFF0C\u5DE5\u4F5C\u5340\u5916\u8B8A\u66F4\u4E0D\u53D7 Orbit \u56DE\u6EFE\u4FDD\u8B77\u3002\u5C08\u6848\u639B\u9264\u3001\u9A57\u8B49\u5951\u7D04\u3001\u5DE5\u5177\u9650\u5236\u3001\u53D6\u6D88\u80FD\u529B\u4EE5\u53CA\u6210\u672C\u8207\u5931\u63A7\u6AA2\u67E5\u4ECD\u7136\u6709\u6548\u3002",
284828
+ fullAccessConfirmHost: "\u64CD\u4F5C\u64C1\u6709\u76EE\u524D\u7CFB\u7D71\u5E33\u6236\u7684\u6B0A\u9650\uFF0C\u5B50\u547D\u4EE4\u6703\u7E7C\u627F Orbit \u7A0B\u5E8F\u74B0\u5883\uFF0C\u5305\u62EC\u6191\u64DA\u8B8A\u6578\uFF1B\u5DF2\u57F7\u884C\u7684\u5B50\u7A0B\u5E8F\u6703\u4FDD\u7559\u9019\u4E9B\u6B0A\u9650\u76F4\u81F3\u505C\u6B62\u3002\u6191\u64DA\u503C\u4ECD\u6703\u5F9E\u65E5\u8A8C\u548C\u6A21\u578B\u53EF\u898B\u8F38\u51FA\u4E2D\u812B\u654F\uFF0C\u5DE5\u4F5C\u5340\u5916\u8B8A\u66F4\u4E0D\u53D7 Orbit \u56DE\u6EFE\u4FDD\u8B77\u3002\u4E2D\u9593\u8FED\u4EE3\u6AA2\u67E5\u9EDE\u6703\u4E0D\u7D93\u8A62\u554F\u81EA\u52D5\u7E7C\u7E8C\uFF1B\u8A2D\u5B9A\u7684\u6700\u7D42\u8FED\u4EE3\u4E0A\u9650\u3001\u53D6\u6D88\u80FD\u529B\u3001\u9810\u7B97\u3001\u505C\u6EEF\u8FF4\u5708\u5075\u6E2C\u3001\u5C08\u6848\u639B\u9264\u53CA\u9A57\u8B49\u5951\u7D04\u4ECD\u7136\u6709\u6548\u3002",
284546
284829
  fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6B0A\u9650",
284547
284830
  modeStrict: "\u56B4\u683C",
284548
284831
  modeNormal: "\u6A19\u6E96",
@@ -285034,6 +285317,10 @@ function renderWebUiPage(language) {
285034
285317
  <button type="button" data-mode="plan" aria-pressed="false">${copy.modePlan}</button>
285035
285318
  </div>
285036
285319
  <p class="permission-summary" id="permissionSummary" role="status" aria-live="polite">${copy.permissionGuardLabel}</p>
285320
+ <div class="setting-row setting-row-stacked long-task-setting">
285321
+ <div><label for="agentMaxIterations"><h3>${copy.agentMaxIterations}</h3></label><p id="agentMaxIterationsDescription">${copy.agentMaxIterationsDescription}</p></div>
285322
+ <input class="field-control" id="agentMaxIterations" type="number" min="1" max="1000" step="20" value="200" inputmode="numeric" aria-describedby="agentMaxIterationsDescription" />
285323
+ </div>
285037
285324
  </section>
285038
285325
  <section class="settings-group">
285039
285326
  <div class="setting-row">
@@ -287159,6 +287446,64 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
287159
287446
  color: var(--danger);
287160
287447
  }
287161
287448
 
287449
+ .tool-batch {
287450
+ margin: 11px 0;
287451
+ overflow: hidden;
287452
+ color: var(--muted);
287453
+ background: color-mix(in srgb, var(--surface-subtle) 72%, transparent);
287454
+ border: 1px solid var(--border);
287455
+ border-radius: 11px;
287456
+ }
287457
+
287458
+ .tool-batch-summary {
287459
+ min-height: 40px;
287460
+ display: grid;
287461
+ grid-template-columns: auto auto minmax(0, 1fr) auto auto;
287462
+ align-items: center;
287463
+ gap: 9px;
287464
+ padding: 8px 11px;
287465
+ cursor: pointer;
287466
+ list-style: none;
287467
+ }
287468
+
287469
+ .tool-batch-summary::-webkit-details-marker {
287470
+ display: none;
287471
+ }
287472
+
287473
+ .tool-batch-summary strong {
287474
+ color: var(--ink-strong);
287475
+ font-size: 11.5px;
287476
+ }
287477
+
287478
+ .tool-batch-count {
287479
+ min-width: 30px;
287480
+ padding: 2px 7px;
287481
+ color: var(--accent-strong);
287482
+ background: var(--accent-soft);
287483
+ border-radius: 999px;
287484
+ font: 600 10.5px/1.4 var(--font-mono);
287485
+ text-align: center;
287486
+ }
287487
+
287488
+ .tool-batch-body {
287489
+ padding: 1px 9px 9px;
287490
+ border-top: 1px solid var(--border);
287491
+ }
287492
+
287493
+ .tool-batch-body .tool-card {
287494
+ margin: 8px 0 0;
287495
+ background: var(--surface-raised);
287496
+ }
287497
+
287498
+ .tool-batch.is-success > .tool-batch-summary .tool-status {
287499
+ background: var(--success);
287500
+ box-shadow: 0 0 0 3px var(--success-soft);
287501
+ }
287502
+
287503
+ .tool-batch[open] > .tool-batch-summary .tool-chevron {
287504
+ transform: rotate(90deg);
287505
+ }
287506
+
287162
287507
  .stream-caret > p:last-child::after,
287163
287508
  .stream-caret > h1:last-child::after,
287164
287509
  .stream-caret > h2:last-child::after,
@@ -290349,6 +290694,7 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
290349
290694
  textarea,
290350
290695
  .message.user .message-content,
290351
290696
  .tool-card,
290697
+ .tool-batch,
290352
290698
  .code-block,
290353
290699
  .composer-shell,
290354
290700
  .inspector,
@@ -291984,6 +292330,7 @@ var SettingsPatchSchema = z58.object({
291984
292330
  model: z58.string().trim().min(1).max(200).optional(),
291985
292331
  permissionMode: z58.enum(["strict", "normal", "auto", "plan"]).optional(),
291986
292332
  fullAccessConfirmed: z58.literal(true).optional(),
292333
+ agentMaxIterations: z58.number().int().min(1).max(MAX_AGENT_MAX_ITERATIONS).optional(),
291987
292334
  webSearchEnabled: z58.boolean().optional(),
291988
292335
  webSearchProvider: z58.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
291989
292336
  webSearchMaxResults: z58.number().int().min(1).max(20).optional(),
@@ -297483,6 +297830,9 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
297483
297830
  const preset = applyPermissionModePreset(draft, patch.permissionMode);
297484
297831
  if (!preset.ok) return preset;
297485
297832
  }
297833
+ if (typeof patch.agentMaxIterations === "number") {
297834
+ draft.agent.maxIterations = patch.agentMaxIterations;
297835
+ }
297486
297836
  if (typeof patch.webSearchEnabled === "boolean") {
297487
297837
  draft.tools.webSearch.enabled = patch.webSearchEnabled;
297488
297838
  }
@@ -297541,6 +297891,10 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
297541
297891
  this.tui.setPermissionsMode(patch.permissionMode);
297542
297892
  this.saveLocalState({ permissionMode: patch.permissionMode });
297543
297893
  }
297894
+ if (typeof patch.agentMaxIterations === "number") {
297895
+ this.config.agent.maxIterations = patch.agentMaxIterations;
297896
+ this.saveLocalState({ agentMaxIterations: patch.agentMaxIterations });
297897
+ }
297544
297898
  if (typeof patch.webSearchEnabled === "boolean") {
297545
297899
  this.config.tools.webSearch.enabled = patch.webSearchEnabled;
297546
297900
  }
@@ -297812,6 +298166,7 @@ var LocalRuntimeStateSchema = z68.object({
297812
298166
  lastModel: z68.string().max(512).optional(),
297813
298167
  language: OrbitLanguageSchema.optional(),
297814
298168
  permissionMode: z68.enum(["strict", "normal", "auto", "plan"]).optional(),
298169
+ agentMaxIterations: z68.number().int().min(1).max(MAX_AGENT_MAX_ITERATIONS).optional(),
297815
298170
  skills: LocalSkillsStateSchema.optional()
297816
298171
  });
297817
298172
  function readLocalRuntimeState(cwd) {
@@ -298102,8 +298457,9 @@ Risk Warning: ${reason}`);
298102
298457
  {
298103
298458
  disableStatusBar: useFullscreenTui,
298104
298459
  sessionId: resumeSessionId,
298105
- // Permission elevation never opts the user out of periodic cost guards.
298106
- autoContinueRunaway: false
298460
+ // Full Access is an explicit request for uninterrupted autonomous work.
298461
+ // Budget, cancellation, progress, and the configured hard ceiling remain.
298462
+ autoContinueRunaway: isFullAccessEnabled(this.config)
298107
298463
  }
298108
298464
  );
298109
298465
  tui.setActiveInputHandler((submitted) => {
@@ -298587,6 +298943,13 @@ function shouldUseStoredPermissionMode(cliOverrides) {
298587
298943
  const permissions = cliOverrides.permissions;
298588
298944
  return !(typeof permissions === "object" && permissions !== null && !Array.isArray(permissions) && typeof permissions.mode === "string");
298589
298945
  }
298946
+ function shouldUseStoredAgentMaxIterations(cliOverrides) {
298947
+ if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
298948
+ return true;
298949
+ }
298950
+ const agent = cliOverrides.agent;
298951
+ return !(typeof agent === "object" && agent !== null && !Array.isArray(agent) && typeof agent.maxIterations === "number");
298952
+ }
298590
298953
  function getExplicitModelOverride(cliOverrides) {
298591
298954
  if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
298592
298955
  return void 0;
@@ -298624,9 +298987,15 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
298624
298987
  if (shouldUseStoredPermissionMode(cliOverrides) && localState.permissionMode) {
298625
298988
  applyPermissionModePreset(config, localState.permissionMode);
298626
298989
  }
298990
+ if (shouldUseStoredAgentMaxIterations(cliOverrides) && localState.agentMaxIterations) {
298991
+ config.agent.maxIterations = Math.min(
298992
+ localState.agentMaxIterations,
298993
+ config.managedPolicy?.maxIterations ?? MAX_AGENT_MAX_ITERATIONS
298994
+ );
298995
+ }
298627
298996
  }
298628
- function shouldAutoContinueRunaway(options) {
298629
- return options?.autoContinueRunaway === true;
298997
+ function shouldAutoContinueRunaway(config, options) {
298998
+ return isFullAccessEnabled(config) || options?.autoContinueRunaway === true;
298630
298999
  }
298631
299000
  async function runAgent(cwd, task, cliOverrides, multi, options) {
298632
299001
  const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
@@ -298762,7 +299131,7 @@ Risk Warning: ${reason}`);
298762
299131
  requireSession: Boolean(options?.resumeSessionId),
298763
299132
  disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
298764
299133
  nonInteractive: !!options?.nonInteractive,
298765
- autoContinueRunaway: shouldAutoContinueRunaway(options)
299134
+ autoContinueRunaway: shouldAutoContinueRunaway(config, options)
298766
299135
  }
298767
299136
  );
298768
299137
  return await loop.run();
@@ -299574,10 +299943,36 @@ async function runMcpLogin(serverName, options = {}) {
299574
299943
 
299575
299944
  // src/commands/skills.ts
299576
299945
  import picocolors24 from "picocolors";
299946
+ import { z as z71 } from "zod";
299947
+ var SkillDirectoryOverrideSchema = z71.array(z71.string().trim().min(1).max(4096)).min(1).max(50);
299577
299948
  async function runSkillsCommand(action, options = {}) {
299578
299949
  const cwd = options.cwd ?? process.cwd();
299579
299950
  const config = ConfigLoader.loadSync(cwd);
299580
- if (config.skills.enabled === false) {
299951
+ const directoryOverride = options.directories ? SkillDirectoryOverrideSchema.safeParse(options.directories) : void 0;
299952
+ if (directoryOverride && !directoryOverride.success) {
299953
+ const message2 = directoryOverride.error.issues.map((issue) => issue.message).join("; ");
299954
+ if (options.json) {
299955
+ console.log(
299956
+ JSON.stringify({
299957
+ enabled: true,
299958
+ skills: [],
299959
+ diagnostics: [
299960
+ {
299961
+ path: cwd,
299962
+ severity: "error",
299963
+ code: "invalid-directory-override",
299964
+ message: message2
299965
+ }
299966
+ ]
299967
+ })
299968
+ );
299969
+ } else {
299970
+ console.error(picocolors24.red(`\u2716 Invalid Skill directory: ${message2}`));
299971
+ }
299972
+ return 1;
299973
+ }
299974
+ const targeted = Boolean(directoryOverride?.success);
299975
+ if (config.skills.enabled === false && !targeted) {
299581
299976
  if (options.json) {
299582
299977
  console.log(
299583
299978
  JSON.stringify({ enabled: false, skills: [], diagnostics: [] })
@@ -299587,7 +299982,12 @@ async function runSkillsCommand(action, options = {}) {
299587
299982
  }
299588
299983
  return 0;
299589
299984
  }
299590
- const catalog = await discoverSkills(cwd, config.skills);
299985
+ const skillConfig = targeted ? {
299986
+ ...config.skills,
299987
+ enabled: true,
299988
+ directories: directoryOverride.data
299989
+ } : config.skills;
299990
+ const catalog = await discoverSkills(cwd, skillConfig);
299591
299991
  if (options.deep) {
299592
299992
  catalog.diagnostics.push(
299593
299993
  ...await validateSkillCatalogBundles(catalog.skills)
@@ -299602,6 +300002,7 @@ async function runSkillsCommand(action, options = {}) {
299602
300002
  {
299603
300003
  enabled: true,
299604
300004
  deep: options.deep === true,
300005
+ targeted,
299605
300006
  directories: catalog.directories,
299606
300007
  skills: catalog.skills.map((skill) => ({
299607
300008
  name: skill.name,
@@ -299670,10 +300071,10 @@ import {
299670
300071
  } from "fs";
299671
300072
  import { dirname as dirname15, resolve as resolve15 } from "path";
299672
300073
  import { randomUUID as randomUUID14 } from "crypto";
299673
- import { z as z71 } from "zod";
299674
- var TraceOptionsSchema = z71.object({
299675
- full: z71.boolean().default(false),
299676
- out: z71.string().trim().min(1).max(4096).optional()
300074
+ import { z as z74 } from "zod";
300075
+ var TraceOptionsSchema = z74.object({
300076
+ full: z74.boolean().default(false),
300077
+ out: z74.string().trim().min(1).max(4096).optional()
299677
300078
  });
299678
300079
  function runTraceExport(cwd, sessionId, options = {}) {
299679
300080
  const value = TraceOptionsSchema.parse(options);
@@ -299728,16 +300129,16 @@ import { randomUUID as randomUUID15 } from "crypto";
299728
300129
  import { promisify as promisify5 } from "util";
299729
300130
  import picocolors25 from "picocolors";
299730
300131
  import { parse as parseYaml4 } from "yaml";
299731
- import { z as z74 } from "zod";
300132
+ import { z as z75 } from "zod";
299732
300133
  var exec5 = promisify5(execCallback);
299733
300134
  var MAX_SUITE_BYTES = 1024 * 1024;
299734
300135
  var MAX_VERIFICATION_OUTPUT = 4e3;
299735
- var EvalOptionsSchema = z74.object({
299736
- provider: z74.string().trim().min(1).optional(),
299737
- model: z74.string().trim().min(1).optional(),
299738
- task: z74.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
299739
- allowCommands: z74.boolean().default(false),
299740
- json: z74.boolean().default(false)
300136
+ var EvalOptionsSchema = z75.object({
300137
+ provider: z75.string().trim().min(1).optional(),
300138
+ model: z75.string().trim().min(1).optional(),
300139
+ task: z75.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
300140
+ allowCommands: z75.boolean().default(false),
300141
+ json: z75.boolean().default(false)
299741
300142
  });
299742
300143
  async function runEval(cwd, suiteFile, options = {}) {
299743
300144
  const value = EvalOptionsSchema.parse(options);
@@ -300085,7 +300486,7 @@ function safeSummary(value) {
300085
300486
  import readline6 from "readline";
300086
300487
  import picocolors26 from "picocolors";
300087
300488
  import { resolve as resolve17 } from "path";
300088
- import { z as z76 } from "zod";
300489
+ import { z as z77 } from "zod";
300089
300490
 
300090
300491
  // src/runtime/CleanupManager.ts
300091
300492
  import {
@@ -300097,10 +300498,10 @@ import {
300097
300498
  } from "fs";
300098
300499
  import { homedir as homedir11 } from "os";
300099
300500
  import { basename as basename6, join as join20, parse as parse5, resolve as resolve16 } from "path";
300100
- import { z as z75 } from "zod";
300101
- var CleanupScopeSchema = z75.enum(["user", "project"]);
300501
+ import { z as z76 } from "zod";
300502
+ var CleanupScopeSchema = z76.enum(["user", "project"]);
300102
300503
  function buildCleanupPlan(options) {
300103
- const scopes = z75.array(CleanupScopeSchema).min(1).parse(options.scopes);
300504
+ const scopes = z76.array(CleanupScopeSchema).min(1).parse(options.scopes);
300104
300505
  const homeDirectory = resolve16(options.homeDirectory ?? homedir11());
300105
300506
  const projectDirectory = resolve16(options.projectDirectory ?? options.cwd);
300106
300507
  const candidates = scopes.map((scope) => ({
@@ -300258,12 +300659,12 @@ function safeInventoryWarning(targetPath, error) {
300258
300659
  }
300259
300660
 
300260
300661
  // src/commands/clean.ts
300261
- var CleanCommandOptionsSchema = z76.object({
300262
- user: z76.boolean().default(false),
300263
- project: z76.union([z76.boolean(), z76.string().min(1).max(4096)]).optional(),
300264
- all: z76.boolean().default(false),
300265
- yes: z76.boolean().default(false),
300266
- json: z76.boolean().default(false)
300662
+ var CleanCommandOptionsSchema = z77.object({
300663
+ user: z77.boolean().default(false),
300664
+ project: z77.union([z77.boolean(), z77.string().min(1).max(4096)]).optional(),
300665
+ all: z77.boolean().default(false),
300666
+ yes: z77.boolean().default(false),
300667
+ json: z77.boolean().default(false)
300267
300668
  }).strict();
300268
300669
  async function runClean(cwd, rawOptions, dependencies = {}) {
300269
300670
  const options = CleanCommandOptionsSchema.parse(rawOptions);
@@ -300378,7 +300779,7 @@ async function confirmDeletion(prompt) {
300378
300779
  // src/commands/backup.ts
300379
300780
  import { basename as basename7, resolve as resolve19 } from "path";
300380
300781
  import picocolors27 from "picocolors";
300381
- import { z as z78 } from "zod";
300782
+ import { z as z79 } from "zod";
300382
300783
 
300383
300784
  // src/runtime/ProjectBackup.ts
300384
300785
  import {
@@ -300392,25 +300793,25 @@ import {
300392
300793
  } from "fs";
300393
300794
  import { createHash as createHash10, randomUUID as randomUUID16 } from "crypto";
300394
300795
  import { dirname as dirname17, isAbsolute as isAbsolute9, join as join21, relative as relative10, resolve as resolve18, sep as sep2 } from "path";
300395
- import { z as z77 } from "zod";
300796
+ import { z as z78 } from "zod";
300396
300797
  var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
300397
300798
  var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
300398
300799
  var MAX_BACKUP_FILES = 1e4;
300399
300800
  var MAX_BACKUP_TREE_ENTRIES = 5e4;
300400
300801
  var MAX_BACKUP_TREE_DEPTH = 64;
300401
300802
  var SHA256_PATTERN = /^[a-f0-9]{64}$/;
300402
- var BackupFileSchema = z77.object({
300403
- path: z77.string().min(1).max(4096),
300404
- size: z77.number().int().min(0).max(MAX_BACKUP_BYTES),
300405
- sha256: z77.string().regex(SHA256_PATTERN),
300406
- content: z77.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
300803
+ var BackupFileSchema = z78.object({
300804
+ path: z78.string().min(1).max(4096),
300805
+ size: z78.number().int().min(0).max(MAX_BACKUP_BYTES),
300806
+ sha256: z78.string().regex(SHA256_PATTERN),
300807
+ content: z78.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
300407
300808
  });
300408
- var ProjectBackupBundleSchema = z77.object({
300409
- schemaVersion: z77.literal(1),
300410
- kind: z77.literal("orbit-project-backup"),
300411
- createdAt: z77.string().datetime(),
300412
- sourceName: z77.string().min(1).max(512),
300413
- files: z77.array(BackupFileSchema).max(MAX_BACKUP_FILES)
300809
+ var ProjectBackupBundleSchema = z78.object({
300810
+ schemaVersion: z78.literal(1),
300811
+ kind: z78.literal("orbit-project-backup"),
300812
+ createdAt: z78.string().datetime(),
300813
+ sourceName: z78.string().min(1).max(512),
300814
+ files: z78.array(BackupFileSchema).max(MAX_BACKUP_FILES)
300414
300815
  }).superRefine((bundle, context) => {
300415
300816
  let totalBytes = 0;
300416
300817
  const seen = /* @__PURE__ */ new Set();
@@ -300418,7 +300819,7 @@ var ProjectBackupBundleSchema = z77.object({
300418
300819
  totalBytes += file.size;
300419
300820
  if (totalBytes > MAX_BACKUP_BYTES) {
300420
300821
  context.addIssue({
300421
- code: z77.ZodIssueCode.custom,
300822
+ code: z78.ZodIssueCode.custom,
300422
300823
  message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
300423
300824
  });
300424
300825
  break;
@@ -300426,14 +300827,14 @@ var ProjectBackupBundleSchema = z77.object({
300426
300827
  const normalized = normalizeBundlePath(file.path);
300427
300828
  if (!normalized || normalized !== file.path) {
300428
300829
  context.addIssue({
300429
- code: z77.ZodIssueCode.custom,
300830
+ code: z78.ZodIssueCode.custom,
300430
300831
  message: `Unsafe backup path: ${file.path}`
300431
300832
  });
300432
300833
  continue;
300433
300834
  }
300434
300835
  if (seen.has(normalized.toLowerCase())) {
300435
300836
  context.addIssue({
300436
- code: z77.ZodIssueCode.custom,
300837
+ code: z78.ZodIssueCode.custom,
300437
300838
  message: `Duplicate backup path: ${file.path}`
300438
300839
  });
300439
300840
  }
@@ -300666,9 +301067,9 @@ function formatBytes2(bytes) {
300666
301067
  }
300667
301068
 
300668
301069
  // src/commands/backup.ts
300669
- var BackupOptionsSchema = z78.object({
300670
- output: z78.string().min(1).max(4096).optional(),
300671
- json: z78.boolean().default(false)
301070
+ var BackupOptionsSchema = z79.object({
301071
+ output: z79.string().min(1).max(4096).optional(),
301072
+ json: z79.boolean().default(false)
300672
301073
  }).strict();
300673
301074
  function runBackupCreate(cwd, rawOptions = {}) {
300674
301075
  const options = BackupOptionsSchema.parse(rawOptions);
@@ -300768,21 +301169,21 @@ import {
300768
301169
  import { randomUUID as randomUUID17 } from "crypto";
300769
301170
  import { dirname as dirname18, isAbsolute as isAbsolute10, join as join26, relative as relative11, resolve as resolve20, sep as sep3 } from "path";
300770
301171
  import { homedir as homedir12 } from "os";
300771
- import { z as z79 } from "zod";
300772
- var InstalledExtensionSchema2 = z79.object({
301172
+ import { z as z80 } from "zod";
301173
+ var InstalledExtensionSchema2 = z80.object({
300773
301174
  id: InstalledExtensionIdSchema,
300774
- displayName: z79.string().min(1).max(256),
300775
- version: z79.string().min(1).max(128),
300776
- digest: z79.string().regex(/^[a-f0-9]{64}$/),
301175
+ displayName: z80.string().min(1).max(256),
301176
+ version: z80.string().min(1).max(128),
301177
+ digest: z80.string().regex(/^[a-f0-9]{64}$/),
300777
301178
  digestAlgorithm: ExtensionDigestAlgorithmSchema.default("sha256-v1"),
300778
- installedAt: z79.string().datetime(),
300779
- trusted: z79.boolean(),
300780
- path: z79.string().min(1).max(4096),
300781
- manifestFile: z79.string().min(1).max(4096).default("extension.yaml")
301179
+ installedAt: z80.string().datetime(),
301180
+ trusted: z80.boolean(),
301181
+ path: z80.string().min(1).max(4096),
301182
+ manifestFile: z80.string().min(1).max(4096).default("extension.yaml")
300782
301183
  });
300783
- var ExtensionRegistrySchema2 = z79.object({
300784
- schemaVersion: z79.literal(1),
300785
- extensions: z79.array(InstalledExtensionSchema2).max(500).default([])
301184
+ var ExtensionRegistrySchema2 = z80.object({
301185
+ schemaVersion: z80.literal(1),
301186
+ extensions: z80.array(InstalledExtensionSchema2).max(500).default([])
300786
301187
  });
300787
301188
  var ExtensionManager = class {
300788
301189
  orbitDir;
@@ -301340,14 +301741,20 @@ skillsCommand.command("list").description("list discovered skills with their dia
301340
301741
  process.exitCode = await runSkillsCommand("list", { json: !!options.json });
301341
301742
  });
301342
301743
  skillsCommand.command("validate").description("validate SKILL.md files; non-zero exit on errors (CI-friendly)").option("--json", "print a machine-readable report").option(
301744
+ "-d, --directory <paths...>",
301745
+ "validate only the specified Skill source directories"
301746
+ ).option(
301343
301747
  "--deep",
301344
301748
  "validate bundled references, assets, and filesystem safety"
301345
- ).action(async (options) => {
301346
- process.exitCode = await runSkillsCommand("validate", {
301347
- json: !!options.json,
301348
- deep: !!options.deep
301349
- });
301350
- });
301749
+ ).action(
301750
+ async (options) => {
301751
+ process.exitCode = await runSkillsCommand("validate", {
301752
+ json: !!options.json,
301753
+ deep: !!options.deep,
301754
+ directories: options.directory
301755
+ });
301756
+ }
301757
+ );
301351
301758
  var mcpCommand = program.command("mcp").description("manage Model Context Protocol servers");
301352
301759
  mcpCommand.command("login <server>").description("authorize an MCP server via OAuth (PKCE) and save the login").option("--port <port>", "fixed loopback port for the OAuth redirect").action(async (server2, options) => {
301353
301760
  const port = options.port ? Number.parseInt(options.port, 10) : void 0;