@orbit-build/cli 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/commands/math-draft.md +11 -0
  2. package/dist/index.js +271 -40
  3. package/package.json +4 -2
  4. package/skills/math-model-draft/SKILL.md +216 -0
  5. package/skills/math-model-draft/agents/openai.yaml +6 -0
  6. package/skills/math-model-draft/assets/project-template/code/always/__init__.py +1 -0
  7. package/skills/math-model-draft/assets/project-template/code/always/config.py +17 -0
  8. package/skills/math-model-draft/assets/project-template/code/always/data.py +23 -0
  9. package/skills/math-model-draft/assets/project-template/code/always/plotting.py +24 -0
  10. package/skills/math-model-draft/assets/project-template/code/always/validation.py +20 -0
  11. package/skills/math-model-draft/assets/project-template/code/finalize.py +55 -0
  12. package/skills/math-model-draft/assets/project-template/code/requirements.txt +11 -0
  13. package/skills/math-model-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 +34 -0
  14. package/skills/math-model-draft/assets/project-template/paper/ai-use-log.md +7 -0
  15. package/skills/math-model-draft/assets/project-template/paper/contest-profile.json +25 -0
  16. package/skills/math-model-draft/assets/project-template/paper/main.tex +53 -0
  17. package/skills/math-model-draft/assets/project-template/paper/sections/abstract.tex +6 -0
  18. package/skills/math-model-draft/assets/project-template/paper/sections/ai-disclosure.tex +3 -0
  19. package/skills/math-model-draft/assets/project-template/paper/sections/appendix.tex +9 -0
  20. package/skills/math-model-draft/assets/project-template/paper/sections/assumptions.tex +5 -0
  21. package/skills/math-model-draft/assets/project-template/paper/sections/data.tex +19 -0
  22. package/skills/math-model-draft/assets/project-template/paper/sections/evaluation.tex +9 -0
  23. package/skills/math-model-draft/assets/project-template/paper/sections/problem-analysis.tex +3 -0
  24. package/skills/math-model-draft/assets/project-template/paper/sections/problem-restatement.tex +3 -0
  25. package/skills/math-model-draft/assets/project-template/paper/sections/references.tex +6 -0
  26. package/skills/math-model-draft/assets/project-template/paper/sections/source-code.tex +1 -0
  27. package/skills/math-model-draft/assets/project-template/paper/sections/support-files.tex +3 -0
  28. package/skills/math-model-draft/references/code-and-output-style.md +91 -0
  29. package/skills/math-model-draft/references/cumcm-compliance.md +56 -0
  30. package/skills/math-model-draft/references/latex-figures-tables.md +60 -0
  31. package/skills/math-model-draft/references/modeling-quality.md +91 -0
  32. package/skills/math-model-draft/references/paper-architecture.md +125 -0
  33. package/skills/math-model-draft/references/paper-revision.md +76 -0
  34. package/skills/math-model-draft/references/project-architecture.md +65 -0
  35. package/skills/math-model-draft/scripts/audit_paper.py +185 -0
  36. package/skills/math-model-draft/scripts/bootstrap_project.py +275 -0
  37. package/skills/math-model-draft/scripts/build_paper.py +226 -0
  38. package/skills/math-model-draft/scripts/capture_environment.py +46 -0
  39. package/skills/math-model-draft/scripts/clean_project.py +46 -0
  40. package/skills/math-model-draft/scripts/finalize_project.py +49 -0
  41. package/skills/math-model-draft/scripts/inspect_inputs.py +193 -0
  42. package/skills/math-model-draft/scripts/package_support.py +52 -0
  43. package/skills/math-model-draft/scripts/project_utils.py +106 -0
  44. package/skills/math-model-draft/scripts/validate_project.py +313 -0
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: 生成、修订或审计证据一致的数模项目与 TeX/PDF
3
+ argumentHint: <项目目录;可附“生成/修订/仅审计”,留空使用当前目录>
4
+ ---
5
+
6
+ 显式使用 `$math-model-draft` 处理 `$ARGUMENTS`;若路径为空则使用当前工作区。
7
+ 默认一键完成“读题—建模—代码—运行—结果/图表—完整论文—AI声明—编译—
8
+ 逐页检查—交付包”,不得停在脚手架、提纲或示例段落。自动判断生成、修订或审计模式,保护题目原件,以最新代码和程序生成的
9
+ JSON/CSV 为数值事实源,完成模型—代码—结果—图表—论文一致性核验、真实
10
+ TeX Live 编译和逐页排版检查。不要只润色或给提纲;不得编造代码中不存在的
11
+ 模型、算法、数据和数值。仅在会改变模型方向或可能误删重要资料时询问。
package/dist/index.js CHANGED
@@ -238356,6 +238356,8 @@ var ConfigSchema = z2.object({
238356
238356
  allowedProviders: z2.array(z2.string().min(1).max(1024)).max(1e3).optional(),
238357
238357
  allowedModels: z2.array(z2.string().min(1).max(1024)).max(1e3).optional(),
238358
238358
  minimumPermissionMode: z2.enum(["auto", "normal", "strict", "plan"]).optional(),
238359
+ requireWriteApproval: z2.boolean().default(false),
238360
+ requireBashApproval: z2.boolean().default(false),
238359
238361
  disableWebSearch: z2.boolean().default(false),
238360
238362
  disableMcp: z2.boolean().default(false)
238361
238363
  }).optional(),
@@ -238526,7 +238528,8 @@ var DEFAULT_CONFIG = {
238526
238528
  ".agents/skills",
238527
238529
  ".claude/skills",
238528
238530
  "~/.claude/skills",
238529
- "~/.orbit/skills"
238531
+ "~/.orbit/skills",
238532
+ "@orbit/builtin-skills"
238530
238533
  ],
238531
238534
  activation: "auto",
238532
238535
  maxActive: 3,
@@ -239202,6 +239205,8 @@ function applyManagedPolicy(source, policy) {
239202
239205
  allowedProviders: policy.allowedProviders,
239203
239206
  allowedModels: policy.allowedModels,
239204
239207
  minimumPermissionMode: policy.minimumPermissionMode,
239208
+ requireWriteApproval: policy.requireWriteApproval,
239209
+ requireBashApproval: policy.requireBashApproval,
239205
239210
  disableWebSearch: policy.disableWebSearch,
239206
239211
  disableMcp: policy.disableMcp
239207
239212
  };
@@ -239219,6 +239224,12 @@ function validateManagedRuntimeChange(config, change) {
239219
239224
  if (change.permissionMode && policy.minimumPermissionMode && permissionRank(change.permissionMode) < permissionRank(policy.minimumPermissionMode)) {
239220
239225
  return `Managed policy requires ${policy.minimumPermissionMode} mode or stricter.`;
239221
239226
  }
239227
+ if (change.requireWriteApproval === false && policy.requireWriteApproval) {
239228
+ return "Managed policy requires write approval.";
239229
+ }
239230
+ if (change.requireBashApproval === false && policy.requireBashApproval) {
239231
+ return "Managed policy requires command approval.";
239232
+ }
239222
239233
  if (change.webSearchEnabled && policy.disableWebSearch) {
239223
239234
  return "Managed policy disables web search.";
239224
239235
  }
@@ -239936,6 +239947,36 @@ function redactValue(value, seen) {
239936
239947
  }
239937
239948
  return output;
239938
239949
  }
239950
+ function applyPermissionModePreset(config, mode) {
239951
+ const fullAccess = mode === "auto";
239952
+ const violation = validateManagedRuntimeChange(config, {
239953
+ permissionMode: mode,
239954
+ requireWriteApproval: !fullAccess,
239955
+ requireBashApproval: !fullAccess
239956
+ });
239957
+ if (violation) return { ok: false, message: violation };
239958
+ config.permissions.mode = mode;
239959
+ config.permissions.requireApprovalForWrite = !fullAccess;
239960
+ config.permissions.requireApprovalForBash = !fullAccess;
239961
+ config.permissions.blockDangerousCommands = true;
239962
+ config.permissions.protectSecrets = true;
239963
+ return { ok: true };
239964
+ }
239965
+ function isFullAccessEnabled(config) {
239966
+ return config.permissions.mode === "auto" && !config.permissions.requireApprovalForWrite && !config.permissions.requireApprovalForBash && config.permissions.blockDangerousCommands && config.permissions.protectSecrets;
239967
+ }
239968
+ function createPermissionModeOverride(mode) {
239969
+ const fullAccess = mode === "auto";
239970
+ return {
239971
+ permissions: {
239972
+ mode,
239973
+ requireApprovalForWrite: !fullAccess,
239974
+ requireApprovalForBash: !fullAccess,
239975
+ blockDangerousCommands: true,
239976
+ protectSecrets: true
239977
+ }
239978
+ };
239979
+ }
239939
239980
 
239940
239981
  // src/commands/config.ts
239941
239982
  import picocolors2 from "picocolors";
@@ -249925,13 +249966,14 @@ import { z as z43 } from "zod";
249925
249966
  import { dirname as dirname5 } from "path";
249926
249967
  import { isAbsolute as isAbsolute22, join as join32, resolve as resolve42 } from "path";
249927
249968
  import { homedir as homedir4 } from "os";
249928
- import { promises as fs2 } from "fs";
249969
+ import { existsSync as existsSync53, promises as fs2 } from "fs";
249970
+ import { fileURLToPath as fileURLToPath2 } from "url";
249929
249971
  import { parse as parseYaml3 } from "yaml";
249930
249972
  import { z as z53 } from "zod";
249931
249973
  import { dirname as dirname42, join as join42 } from "path";
249932
249974
  import { parse as parseYaml22 } from "yaml";
249933
249975
  import { z as z63 } from "zod";
249934
- import { existsSync as existsSync53, lstatSync as lstatSync4, promises as fs22 } from "fs";
249976
+ import { existsSync as existsSync62, lstatSync as lstatSync4, promises as fs22 } from "fs";
249935
249977
  import { dirname as dirname6, isAbsolute as isAbsolute32, join as join52, win32 as win322 } from "path";
249936
249978
  import { parse as parseYaml32 } from "yaml";
249937
249979
  var ProjectIndexer = class {
@@ -251691,12 +251733,22 @@ function normalizePath2(path6) {
251691
251733
  return path6.replace(/\\/g, "/");
251692
251734
  }
251693
251735
  function resolveSkillDirectory(cwd, directory) {
251736
+ if (directory === "@orbit/builtin-skills") {
251737
+ return resolveBundledSkillsDirectory();
251738
+ }
251694
251739
  if (directory === "~") return homedir4();
251695
251740
  if (directory.startsWith("~/") || directory.startsWith("~\\")) {
251696
251741
  return resolve42(homedir4(), directory.slice(2));
251697
251742
  }
251698
251743
  return isAbsolute22(directory) ? resolve42(directory) : resolve42(cwd, directory);
251699
251744
  }
251745
+ function resolveBundledSkillsDirectory() {
251746
+ const candidates = [
251747
+ new URL("../../cli/skills/", import.meta.url),
251748
+ new URL("../../../cli/skills/", import.meta.url)
251749
+ ].map((candidate) => fileURLToPath2(candidate));
251750
+ return candidates.find((candidate) => existsSync53(candidate)) ?? candidates[0];
251751
+ }
251700
251752
  function resolveSkillDirectories(cwd, directories) {
251701
251753
  const resolved = /* @__PURE__ */ new Map();
251702
251754
  for (const directory of directories) {
@@ -252304,7 +252356,7 @@ function stripQueryAndFragment(value) {
252304
252356
  }
252305
252357
  function readable(path6) {
252306
252358
  try {
252307
- if (!existsSync53(path6)) return false;
252359
+ if (!existsSync62(path6)) return false;
252308
252360
  const stats = lstatSync4(path6);
252309
252361
  return !stats.isSymbolicLink() && (stats.isFile() || stats.isDirectory());
252310
252362
  } catch {
@@ -254047,7 +254099,7 @@ var PermissionEngine = class {
254047
254099
  };
254048
254100
  }
254049
254101
  if (mode === "auto") {
254050
- if (risk === "read" || risk === "write" || risk === "execute") {
254102
+ if (risk === "read" || risk === "write" || risk === "execute" || risk === "network") {
254051
254103
  return {
254052
254104
  action: "allow",
254053
254105
  reason: `Automatically allowed under auto mode.`,
@@ -256247,7 +256299,14 @@ function resolveContextWindowStatus(input) {
256247
256299
  }
256248
256300
  function isContextWindowError(error) {
256249
256301
  const message2 = error instanceof Error ? error.message : String(error);
256250
- return /(?:maximum context length|context(?: length| window)?.*(?:exceed|too long|maximum|max)|prompt is too long|input tokens?.*(?:exceed|limit)|token limit)/i.test(
256302
+ if (isOutputTokenLimitError(message2)) return false;
256303
+ return /(?:maximum context length|context(?: length| window)?.*(?:exceed|too long|maximum|max)|prompt is too long|input tokens?.*(?:exceed|limit))/i.test(
256304
+ message2
256305
+ );
256306
+ }
256307
+ function isOutputTokenLimitError(error) {
256308
+ const message2 = error instanceof Error ? error.message : String(error);
256309
+ return /(?:model output.*(?:truncated|token limit)|output tokens?.*(?:exceed|limit)|finish(?:_reason)?.*(?:length|max_tokens)|configured output token limit)/i.test(
256251
256310
  message2
256252
256311
  );
256253
256312
  }
@@ -258439,6 +258498,7 @@ var AgentLoop = class _AgentLoop {
258439
258498
  fallbackModelForRun = null;
258440
258499
  fallbackExpiresAfterAttempt = 0;
258441
258500
  contextOverflowRetriesForRun = 0;
258501
+ outputLimitRetriesForRun = 0;
258442
258502
  approvedToolScopes = /* @__PURE__ */ new Set();
258443
258503
  terminalFailure = null;
258444
258504
  verificationStatus = "not_run";
@@ -258668,6 +258728,7 @@ ${normalized}`);
258668
258728
  this.fallbackModelForRun = null;
258669
258729
  this.fallbackExpiresAfterAttempt = 0;
258670
258730
  this.contextOverflowRetriesForRun = 0;
258731
+ this.outputLimitRetriesForRun = 0;
258671
258732
  this.approvedToolScopes.clear();
258672
258733
  this.terminalFailure = null;
258673
258734
  this.verificationStatus = "not_run";
@@ -258773,9 +258834,17 @@ ${normalized}`);
258773
258834
  attempt: this.state.attemptCount
258774
258835
  });
258775
258836
  if (this.state.attemptCount > 1 && Number.isFinite(this.getRunawayPromptInterval()) && (this.state.attemptCount - 1) % this.getRunawayPromptInterval() === 0) {
258776
- const continueExec = await this.interaction.askApproval(
258777
- `Agent loop has run for ${this.state.attemptCount - 1} iterations. Continue executing to prevent runaway costs?`
258837
+ const completedIterations = this.state.attemptCount - 1;
258838
+ const continueExec = this.options.autoContinueRunaway ? true : await this.interaction.askApproval(
258839
+ `Agent loop has run for ${completedIterations} iterations. Continue executing to prevent runaway costs?`
258778
258840
  );
258841
+ if (this.options.autoContinueRunaway) {
258842
+ this.interaction.showText(
258843
+ picocolors3.gray(
258844
+ `\u25CF Automated evaluation checkpoint: continuing after ${completedIterations} iterations within configured limits.`
258845
+ )
258846
+ );
258847
+ }
258779
258848
  if (!continueExec) {
258780
258849
  this.interaction.showText(
258781
258850
  "\u25CF Terminated by user to prevent runaway iterations."
@@ -259077,13 +259146,49 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
259077
259146
  }
259078
259147
  } else if (this.abortController?.signal.aborted) {
259079
259148
  } else {
259149
+ const outputLimitReached = isOutputTokenLimitError(chatError);
259150
+ if (outputLimitReached && this.outputLimitRetriesForRun < 2) {
259151
+ this.outputLimitRetriesForRun++;
259152
+ this.state.history.push({
259153
+ id: `msg_output_limit_recovery_${Date.now()}`,
259154
+ role: "user",
259155
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
259156
+ content: [
259157
+ {
259158
+ type: "text",
259159
+ text: [
259160
+ "Orbit recovery instruction: the previous response exceeded the model's output-token allowance before its actions could be completed.",
259161
+ "Continue the same task without repeating discovery. Emit at most four tool calls in this response, keep each write bounded, and split remaining work across later turns.",
259162
+ "Do not stop at an outline; execute the next concrete batch now."
259163
+ ].join(" ")
259164
+ }
259165
+ ],
259166
+ metadata: { kind: "output_limit_recovery" }
259167
+ });
259168
+ this.sessionManager.saveHistory(this.state.history);
259169
+ this.interaction.showText(
259170
+ picocolors3.yellow(
259171
+ `\u26A0 ${activeModel2} exceeded its output limit; retrying with a bounded action batch (${this.outputLimitRetriesForRun}/2).`
259172
+ )
259173
+ );
259174
+ continue;
259175
+ }
259080
259176
  const contextWindowRejected = this.config.context.autoCompact && this.contextOverflowRetriesForRun < 2 && isContextWindowError(chatError);
259081
259177
  if (contextWindowRejected) {
259082
259178
  this.contextOverflowRetriesForRun++;
259083
259179
  const retryStatus = this.getContextWindowStatus(activeModel2);
259180
+ const adaptiveRatio = this.contextOverflowRetriesForRun === 1 ? 0.6 : 0.4;
259084
259181
  const compacted = await this.compactHistory(
259085
259182
  "automatic",
259086
- Math.max(256, Math.floor(retryStatus.compactAtTokens * 0.5))
259183
+ Math.max(
259184
+ 256,
259185
+ Math.floor(
259186
+ Math.min(
259187
+ retryStatus.compactAtTokens * 0.5,
259188
+ retryStatus.estimatedHistoryTokens * adaptiveRatio
259189
+ )
259190
+ )
259191
+ )
259087
259192
  );
259088
259193
  if (compacted.changed) {
259089
259194
  this.interaction.showText(
@@ -259118,6 +259223,8 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
259118
259223
  } finally {
259119
259224
  this.interaction.progress?.stop();
259120
259225
  }
259226
+ this.contextOverflowRetriesForRun = 0;
259227
+ this.outputLimitRetriesForRun = 0;
259121
259228
  if (toolCallsToExecute.length === 0 && responseText) {
259122
259229
  const xmlToolCalls = parseXMLToolCalls(responseText);
259123
259230
  const textToolCalls = xmlToolCalls.length > 0 ? [] : parseTextToolCalls(
@@ -266621,9 +266728,9 @@ var SLASH_COMMAND_DEFINITIONS = [
266621
266728
  {
266622
266729
  value: "auto",
266623
266730
  description: {
266624
- en: "Run autonomously with safety guards",
266625
- zh: "\u5728\u5B89\u5168\u9632\u62A4\u4E0B\u81EA\u52A8\u6267\u884C",
266626
- "zh-TW": "\u5728\u5B89\u5168\u9632\u8B77\u4E0B\u81EA\u52D5\u57F7\u884C"
266731
+ en: "Full access with dangerous-command, secret, and workspace guards",
266732
+ zh: "\u5168\u81EA\u52A8\u6267\u884C\uFF0C\u4FDD\u7559\u5371\u9669\u547D\u4EE4\u3001\u5BC6\u94A5\u548C\u5DE5\u4F5C\u533A\u4FDD\u62A4",
266733
+ "zh-TW": "\u5168\u81EA\u52D5\u57F7\u884C\uFF0C\u4FDD\u7559\u5371\u96AA\u547D\u4EE4\u3001\u5BC6\u9470\u548C\u5DE5\u4F5C\u5340\u4FDD\u8B77"
266627
266734
  }
266628
266735
  },
266629
266736
  {
@@ -270042,6 +270149,7 @@ import picocolors18 from "picocolors";
270042
270149
  import { existsSync as existsSync13, readdirSync as readdirSync6 } from "fs";
270043
270150
  import { basename as basename4, extname as extname2, join as join14 } from "path";
270044
270151
  import { homedir as homedir8 } from "os";
270152
+ import { fileURLToPath as fileURLToPath3 } from "url";
270045
270153
  import { parse as parse3 } from "yaml";
270046
270154
  import { z as z50 } from "zod";
270047
270155
  var CommandMetadataSchema = z50.object({
@@ -270138,6 +270246,10 @@ function loadCustomCommands(cwd, reservedNames = [], options = {}) {
270138
270246
  );
270139
270247
  const merged = /* @__PURE__ */ new Map();
270140
270248
  const userHome = options.homeDir || homedir8();
270249
+ const builtinDirectory = options.builtinDir === false ? void 0 : options.builtinDir || resolveBundledCommandsDirectory();
270250
+ if (builtinDirectory) {
270251
+ mergeDirectory(merged, builtinDirectory, "builtin", reserved);
270252
+ }
270141
270253
  mergeDirectory(
270142
270254
  merged,
270143
270255
  join14(userHome, ".claude", "commands"),
@@ -270156,6 +270268,13 @@ function loadCustomCommands(cwd, reservedNames = [], options = {}) {
270156
270268
  (a3, b3) => a3.name.localeCompare(b3.name)
270157
270269
  );
270158
270270
  }
270271
+ function resolveBundledCommandsDirectory() {
270272
+ const candidates = [
270273
+ new URL("../../commands/", import.meta.url),
270274
+ new URL("../commands/", import.meta.url)
270275
+ ].map((candidate) => fileURLToPath3(candidate));
270276
+ return candidates.find((candidate) => existsSync13(candidate)) ?? candidates[0];
270277
+ }
270159
270278
  function expandCustomCommand(command, rawArguments) {
270160
270279
  const args = rawArguments.trim();
270161
270280
  const positional = args ? args.split(/\s+/) : [];
@@ -272101,8 +272220,15 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
272101
272220
  collapseNavigation: '收起导航',
272102
272221
  modeStrict: '严格',
272103
272222
  modeNormal: '标准',
272104
- modeAuto: '自动',
272223
+ modeAuto: '全自动',
272105
272224
  modePlan: '规划',
272225
+ permissionFullAccess: chinese('全自动已开启:写入、命令和联网工具无需逐次确认。', '全自動已開啟:寫入、命令和聯網工具無需逐次確認。'),
272226
+ permissionAutoLimited: chinese('全自动尚未完全生效,部分操作仍需确认。', '全自動尚未完全生效,部分操作仍需確認。'),
272227
+ permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
272228
+ permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
272229
+ permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
272230
+ permissionGuards: chinese('危险命令、密钥和工作区边界仍受保护。', '危險命令、密鑰和工作區邊界仍受保護。'),
272231
+ permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
272106
272232
  }
272107
272233
  : {
272108
272234
  connected: 'Connected',
@@ -272238,8 +272364,15 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
272238
272364
  collapseNavigation: 'Collapse navigation',
272239
272365
  modeStrict: 'Strict',
272240
272366
  modeNormal: 'Normal',
272241
- modeAuto: 'Auto',
272367
+ modeAuto: 'Full access',
272242
272368
  modePlan: 'Plan',
272369
+ permissionFullAccess: 'Full access is on: writes, commands, and network tools run without per-action approval.',
272370
+ permissionAutoLimited: 'Full access is not fully active; some actions still require approval.',
272371
+ permissionStrict: 'Strict mode asks before consequential operations.',
272372
+ permissionNormal: 'Normal mode asks before writes and command execution.',
272373
+ permissionPlan: 'Plan mode analyzes and reads without changing files.',
272374
+ permissionGuards: 'Dangerous commands, secrets, and workspace boundaries stay protected.',
272375
+ permissionGuardsReduced: 'Warning: some hard safety guards are disabled in configuration.',
272243
272376
  };
272244
272377
 
272245
272378
  if (language === 'zh-TW') {
@@ -272438,6 +272571,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
272438
272571
  customModel: byId('customModel'),
272439
272572
  permissionSelect: byId('permissionSelect'),
272440
272573
  permissionSegments: byId('permissionSegments'),
272574
+ permissionSummary: byId('permissionSummary'),
272441
272575
  searchToggle: byId('searchToggle'),
272442
272576
  searchEnabled: byId('searchEnabled'),
272443
272577
  searchDependencies: byId('searchDependencies'),
@@ -275133,6 +275267,23 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
275133
275267
  button.classList.toggle('is-active', active);
275134
275268
  button.setAttribute('aria-pressed', active ? 'true' : 'false');
275135
275269
  });
275270
+ const permissions = data.permissions || {};
275271
+ const modeSummary = mode === 'auto'
275272
+ ? (permissions.fullAccess ? copy.permissionFullAccess : copy.permissionAutoLimited)
275273
+ : mode === 'strict'
275274
+ ? copy.permissionStrict
275275
+ : mode === 'plan'
275276
+ ? copy.permissionPlan
275277
+ : copy.permissionNormal;
275278
+ const hardGuardsEnabled = permissions.dangerousCommandsBlocked !== false
275279
+ && permissions.secretsProtected !== false
275280
+ && permissions.workspaceBoundary !== false;
275281
+ const permissionSummary = modeSummary + ' ' + (hardGuardsEnabled ? copy.permissionGuards : copy.permissionGuardsReduced);
275282
+ if (elements.permissionSummary.textContent !== permissionSummary) {
275283
+ elements.permissionSummary.textContent = permissionSummary;
275284
+ }
275285
+ elements.permissionSummary.classList.toggle('is-full-access', Boolean(permissions.fullAccess));
275286
+ elements.permissionSummary.classList.toggle('is-warning', !hardGuardsEnabled || (mode === 'auto' && !permissions.fullAccess));
275136
275287
  const webSearch = data.tools && data.tools.webSearch || {};
275137
275288
  elements.searchProvider.value = webSearch.provider || 'auto';
275138
275289
  syncSelectControl(elements.searchProvider);
@@ -276647,7 +276798,15 @@ function collectWebUiStatus(options, activeTurn) {
276647
276798
  modelSelection: modelOverride || "__auto__",
276648
276799
  modelRouting: modelOverride ? "locked" : "auto",
276649
276800
  modelOptions: buildModelOptions(options, activeModel2),
276650
- permissions: { mode: config.permissions.mode },
276801
+ permissions: {
276802
+ mode: config.permissions.mode,
276803
+ fullAccess: isFullAccessEnabled(config),
276804
+ writeApproval: config.permissions.requireApprovalForWrite,
276805
+ commandApproval: config.permissions.requireApprovalForBash,
276806
+ dangerousCommandsBlocked: config.permissions.blockDangerousCommands,
276807
+ secretsProtected: config.permissions.protectSecrets,
276808
+ workspaceBoundary: true
276809
+ },
276651
276810
  tools: {
276652
276811
  webSearch: {
276653
276812
  enabled: config.tools.webSearch.enabled,
@@ -277524,9 +277683,11 @@ var BASE_COPY = {
277524
277683
  customModel: "Custom model ID",
277525
277684
  apply: "Apply",
277526
277685
  permission: "Permission mode",
277686
+ permissionDescription: "Choose how much Orbit may do without interrupting you.",
277687
+ permissionGuardLabel: "Dangerous commands, secrets, and workspace boundaries stay protected.",
277527
277688
  modeStrict: "Strict",
277528
277689
  modeNormal: "Normal",
277529
- modeAuto: "Auto",
277690
+ modeAuto: "Full access",
277530
277691
  modePlan: "Plan",
277531
277692
  searchProvider: "Search provider",
277532
277693
  searchResults: "Maximum results",
@@ -277697,9 +277858,11 @@ var BASE_COPY = {
277697
277858
  customModel: "\u81EA\u5B9A\u4E49\u6A21\u578B ID",
277698
277859
  apply: "\u5E94\u7528",
277699
277860
  permission: "\u6743\u9650\u6A21\u5F0F",
277861
+ permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
277862
+ permissionGuardLabel: "\u5371\u9669\u547D\u4EE4\u3001\u5BC6\u94A5\u548C\u5DE5\u4F5C\u533A\u8FB9\u754C\u59CB\u7EC8\u53D7\u5230\u4FDD\u62A4\u3002",
277700
277863
  modeStrict: "\u4E25\u683C",
277701
277864
  modeNormal: "\u6807\u51C6",
277702
- modeAuto: "\u81EA\u52A8",
277865
+ modeAuto: "\u5168\u81EA\u52A8",
277703
277866
  modePlan: "\u89C4\u5212",
277704
277867
  searchProvider: "\u641C\u7D22\u670D\u52A1",
277705
277868
  searchResults: "\u6700\u5927\u7ED3\u679C\u6570",
@@ -277843,9 +278006,11 @@ var COPY = {
277843
278006
  customModel: "\u81EA\u8A02\u6A21\u578B ID",
277844
278007
  apply: "\u5957\u7528",
277845
278008
  permission: "\u6B0A\u9650\u6A21\u5F0F",
278009
+ permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
278010
+ permissionGuardLabel: "\u5371\u96AA\u547D\u4EE4\u3001\u5BC6\u9470\u548C\u5DE5\u4F5C\u5340\u908A\u754C\u59CB\u7D42\u53D7\u5230\u4FDD\u8B77\u3002",
277846
278011
  modeStrict: "\u56B4\u683C",
277847
278012
  modeNormal: "\u6A19\u6E96",
277848
- modeAuto: "\u81EA\u52D5",
278013
+ modeAuto: "\u5168\u81EA\u52D5",
277849
278014
  modePlan: "\u898F\u5283",
277850
278015
  searchProvider: "\u641C\u5C0B\u670D\u52D9",
277851
278016
  searchResults: "\u6700\u5927\u7D50\u679C\u6578",
@@ -278316,13 +278481,16 @@ function renderWebUiPage(language) {
278316
278481
  </div>
278317
278482
  </section>
278318
278483
  <section class="settings-group">
278319
- <h3>${copy.permission}</h3>
278484
+ <div class="setting-row setting-row-stacked">
278485
+ <div><h3>${copy.permission}</h3><p>${copy.permissionDescription}</p></div>
278486
+ </div>
278320
278487
  <div class="segmented" id="permissionSegments">
278321
278488
  <button type="button" data-mode="strict" aria-pressed="false">${copy.modeStrict}</button>
278322
278489
  <button type="button" data-mode="normal" aria-pressed="false">${copy.modeNormal}</button>
278323
278490
  <button type="button" data-mode="auto" aria-pressed="false">${copy.modeAuto}</button>
278324
278491
  <button type="button" data-mode="plan" aria-pressed="false">${copy.modePlan}</button>
278325
278492
  </div>
278493
+ <p class="permission-summary" id="permissionSummary" role="status" aria-live="polite">${copy.permissionGuardLabel}</p>
278326
278494
  </section>
278327
278495
  <section class="settings-group">
278328
278496
  <div class="setting-row">
@@ -282457,6 +282625,29 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
282457
282625
  font-weight: 650;
282458
282626
  }
282459
282627
 
282628
+ .permission-summary {
282629
+ margin: 0;
282630
+ padding: 9px 10px;
282631
+ color: var(--muted);
282632
+ background: var(--surface-subtle);
282633
+ border: 1px solid var(--border);
282634
+ border-radius: 9px;
282635
+ font-size: 10px;
282636
+ line-height: 1.55;
282637
+ }
282638
+
282639
+ .permission-summary.is-full-access {
282640
+ color: var(--ink-strong);
282641
+ background: color-mix(in srgb, var(--success) 8%, var(--surface-subtle));
282642
+ border-color: color-mix(in srgb, var(--success) 32%, var(--border));
282643
+ }
282644
+
282645
+ .permission-summary.is-warning {
282646
+ color: var(--warning);
282647
+ background: color-mix(in srgb, var(--warning) 8%, var(--surface-subtle));
282648
+ border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
282649
+ }
282650
+
282460
282651
  .switch {
282461
282652
  position: relative;
282462
282653
  width: 34px;
@@ -289347,12 +289538,12 @@ ${diff.substring(0, 2e4)}`
289347
289538
  const modeDescriptions = isZh ? {
289348
289539
  strict: "Strict \u2014 \u6240\u6709\u5DE5\u5177\u8C03\u7528\u5FC5\u987B\u9010\u4E00\u786E\u8BA4",
289349
289540
  normal: "Normal \u2014 \u5199\u5165/\u6267\u884C\u64CD\u4F5C\u9700\u8981\u786E\u8BA4",
289350
- auto: "Auto \u2014 \u5B8C\u5168\u81EA\u52A8\u6267\u884C\uFF0C\u4EC5\u963B\u6B62\u5371\u9669\u64CD\u4F5C",
289541
+ auto: "Full Access \u2014 \u81EA\u52A8\u5199\u5165\u3001\u6267\u884C\u4E0E\u8054\u7F51\uFF0C\u4FDD\u7559\u786C\u5B89\u5168\u4FDD\u62A4",
289351
289542
  plan: "Plan \u2014 \u89C4\u5212\u6A21\u5F0F\uFF0C\u65E0\u5B9E\u9645\u6587\u4EF6\u4FEE\u6539"
289352
289543
  } : {
289353
289544
  strict: "Strict \u2014 Confirm every tool call before execution",
289354
289545
  normal: "Normal \u2014 Confirm write/exec operations only",
289355
- auto: "Auto \u2014 Fully autonomous, blocks dangerous cmds only",
289546
+ auto: "Full Access \u2014 Auto write, execute, and network with hard guards",
289356
289547
  plan: "Plan \u2014 Planning mode, no actual file changes"
289357
289548
  };
289358
289549
  if (!targetMode) {
@@ -289368,15 +289559,18 @@ Select a security mode:`;
289368
289559
  { value: "auto", label: modeDescriptions.auto },
289369
289560
  { value: "plan", label: modeDescriptions.plan }
289370
289561
  ]);
289371
- if (choice && choice !== currentMode) {
289372
- const violation2 = validateManagedRuntimeChange(loop.getConfig(), {
289373
- permissionMode: choice
289374
- });
289375
- if (violation2) {
289376
- this.printOutput(picocolors18.red(`\u2716 ${violation2}`));
289562
+ if (choice) {
289563
+ const result2 = applyPermissionModePreset(
289564
+ loop.getConfig(),
289565
+ choice
289566
+ );
289567
+ if (!result2.ok) {
289568
+ this.printOutput(picocolors18.red(`\u2716 ${result2.message}`));
289377
289569
  return { shouldExit: false, processed: true };
289378
289570
  }
289379
- loop.getConfig().permissions.mode = choice;
289571
+ this.saveLocalState({
289572
+ permissionMode: choice
289573
+ });
289380
289574
  tui.syncFromLoop(loop);
289381
289575
  }
289382
289576
  } else {
@@ -289397,14 +289591,17 @@ Select a security mode:`;
289397
289591
  );
289398
289592
  return { shouldExit: false, processed: true };
289399
289593
  }
289400
- const violation = validateManagedRuntimeChange(loop.getConfig(), {
289401
- permissionMode: targetMode
289402
- });
289403
- if (violation) {
289404
- this.printOutput(picocolors18.red(`\u2716 ${violation}`));
289594
+ const result = applyPermissionModePreset(
289595
+ loop.getConfig(),
289596
+ targetMode
289597
+ );
289598
+ if (!result.ok) {
289599
+ this.printOutput(picocolors18.red(`\u2716 ${result.message}`));
289405
289600
  return { shouldExit: false, processed: true };
289406
289601
  }
289407
- loop.getConfig().permissions.mode = targetMode;
289602
+ this.saveLocalState({
289603
+ permissionMode: targetMode
289604
+ });
289408
289605
  tui.syncFromLoop(loop);
289409
289606
  if (useFullscreenTui && tui.isActive) {
289410
289607
  const msg = isZh ? `\u5F53\u524D\u6A21\u5F0F: ${picocolors18.cyan(currentMode.toUpperCase())}
@@ -289776,7 +289973,8 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
289776
289973
  draft.provider.default = patch.provider;
289777
289974
  }
289778
289975
  if (patch.permissionMode) {
289779
- draft.permissions.mode = patch.permissionMode;
289976
+ const preset = applyPermissionModePreset(draft, patch.permissionMode);
289977
+ if (!preset.ok) return preset;
289780
289978
  }
289781
289979
  if (typeof patch.webSearchEnabled === "boolean") {
289782
289980
  draft.tools.webSearch.enabled = patch.webSearchEnabled;
@@ -289828,8 +290026,13 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
289828
290026
  this.saveLocalState({ language: patch.language });
289829
290027
  }
289830
290028
  if (patch.permissionMode) {
289831
- this.config.permissions.mode = patch.permissionMode;
290029
+ const preset = applyPermissionModePreset(
290030
+ this.config,
290031
+ patch.permissionMode
290032
+ );
290033
+ if (!preset.ok) return preset;
289832
290034
  this.tui.setPermissionsMode(patch.permissionMode);
290035
+ this.saveLocalState({ permissionMode: patch.permissionMode });
289833
290036
  }
289834
290037
  if (typeof patch.webSearchEnabled === "boolean") {
289835
290038
  this.config.tools.webSearch.enabled = patch.webSearchEnabled;
@@ -290101,6 +290304,7 @@ var LocalRuntimeStateSchema = z66.object({
290101
290304
  lastProvider: z66.string().min(1).max(256).optional(),
290102
290305
  lastModel: z66.string().max(512).optional(),
290103
290306
  language: OrbitLanguageSchema.optional(),
290307
+ permissionMode: z66.enum(["strict", "normal", "auto", "plan"]).optional(),
290104
290308
  skills: LocalSkillsStateSchema.optional()
290105
290309
  });
290106
290310
  function readLocalRuntimeState(cwd) {
@@ -290864,6 +291068,13 @@ function shouldUseStoredModel(cliOverrides) {
290864
291068
  function shouldUseStoredProvider(cliOverrides) {
290865
291069
  return getExplicitProviderOverride(cliOverrides) === void 0;
290866
291070
  }
291071
+ function shouldUseStoredPermissionMode(cliOverrides) {
291072
+ if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
291073
+ return true;
291074
+ }
291075
+ const permissions = cliOverrides.permissions;
291076
+ return !(typeof permissions === "object" && permissions !== null && !Array.isArray(permissions) && typeof permissions.mode === "string");
291077
+ }
290867
291078
  function getExplicitModelOverride(cliOverrides) {
290868
291079
  if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
290869
291080
  return void 0;
@@ -290898,6 +291109,9 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
290898
291109
  if (shouldUseStoredModel(cliOverrides) && storedModelMatchesProvider && localState.lastModel) {
290899
291110
  config.models.default = localState.lastModel;
290900
291111
  }
291112
+ if (shouldUseStoredPermissionMode(cliOverrides) && localState.permissionMode) {
291113
+ applyPermissionModePreset(config, localState.permissionMode);
291114
+ }
290901
291115
  }
290902
291116
  async function runAgent(cwd, task, cliOverrides, multi, options) {
290903
291117
  const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
@@ -291032,7 +291246,8 @@ Risk Warning: ${reason}`);
291032
291246
  sessionId: options?.resumeSessionId,
291033
291247
  requireSession: Boolean(options?.resumeSessionId),
291034
291248
  disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
291035
- nonInteractive: !!options?.nonInteractive
291249
+ nonInteractive: !!options?.nonInteractive,
291250
+ autoContinueRunaway: !!options?.autoContinueRunaway
291036
291251
  }
291037
291252
  );
291038
291253
  return await loop.run();
@@ -292058,10 +292273,23 @@ async function runEval(cwd, suiteFile, options = {}) {
292058
292273
  mode: "auto",
292059
292274
  requireApprovalForWrite: false,
292060
292275
  requireApprovalForBash: !value.allowCommands
292276
+ },
292277
+ agent: {
292278
+ ...DEFAULT_CONFIG.agent,
292279
+ // Acceptance tasks commonly include implementation plus their
292280
+ // verification-repair loop. Keep them bounded, but do not inherit
292281
+ // the shorter conversational default that truncates long Skills.
292282
+ maxIterations: 50
292061
292283
  }
292062
292284
  },
292063
292285
  task.mode === "multi",
292064
- { nonInteractive: true }
292286
+ {
292287
+ nonInteractive: true,
292288
+ // Eval already has explicit task, iteration, cost, worktree, and
292289
+ // verification bounds. Periodic UI prompts would otherwise abort
292290
+ // every long acceptance task without weakening tool approvals.
292291
+ autoContinueRunaway: true
292292
+ }
292065
292293
  );
292066
292294
  const checks = value.allowCommands ? await runVerificationChecks(worktree.path, task.verification) : [];
292067
292295
  const changedFiles = readChangedFiles(worktree.path);
@@ -293467,7 +293695,10 @@ function applyOutcomeExitCode(outcome) {
293467
293695
  const currentExitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
293468
293696
  process.exitCode = Math.max(currentExitCode, exitCodeForOutcome(outcome));
293469
293697
  }
293470
- program.name("orbit").description("Orbit - Local AI Coding Agent Runtime").version(readCliVersion()).argument("[task]", "task description for Orbit to execute").option("--provider <provider>", "specify model provider").option("--model <model>", "specify model name").option("--yes", "bypass low-risk approvals").option("--multi", "run in multi-agent planning/coding/review mode").option("--direct", "run interactive REPL in direct console streaming mode").action(async (task, options) => {
293698
+ program.name("orbit").description("Orbit - Local AI Coding Agent Runtime").version(readCliVersion()).argument("[task]", "task description for Orbit to execute").option("--provider <provider>", "specify model provider").option("--model <model>", "specify model name").option(
293699
+ "--yes",
293700
+ "enable guarded Full Access for this run (dangerous commands and secrets stay protected)"
293701
+ ).option("--multi", "run in multi-agent planning/coding/review mode").option("--direct", "run interactive REPL in direct console streaming mode").action(async (task, options) => {
293471
293702
  const cwd = process.cwd();
293472
293703
  const overrides = {};
293473
293704
  if (options.provider) {
@@ -293480,7 +293711,7 @@ program.name("orbit").description("Orbit - Local AI Coding Agent Runtime").versi
293480
293711
  overrides.direct = true;
293481
293712
  }
293482
293713
  if (options.yes) {
293483
- overrides.permissions = { mode: "auto" };
293714
+ overrides.permissions = createPermissionModeOverride("auto").permissions;
293484
293715
  }
293485
293716
  const outcome = await runAgent(cwd, task, overrides, !!options.multi);
293486
293717
  applyOutcomeExitCode(outcome);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
5
5
  "keywords": [
6
6
  "ai",
@@ -35,7 +35,9 @@
35
35
  },
36
36
  "files": [
37
37
  "dist",
38
- "README.md"
38
+ "README.md",
39
+ "commands",
40
+ "skills"
39
41
  ],
40
42
  "publishConfig": {
41
43
  "access": "public"