@orbit-build/cli 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +549 -241
- package/package.json +1 -1
- package/skills/math-model-draft/SKILL.md +18 -0
- 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 +1 -0
- package/skills/math-model-draft/assets/project-template/paper/main.tex +5 -0
- package/skills/math-model-draft/scripts/audit_paper.py +73 -16
- package/skills/math-model-draft/scripts/build_paper.py +4 -1
- package/skills/math-model-draft/scripts/evidence_freeze.py +107 -0
- package/skills/math-model-draft/scripts/finalize_project.py +8 -0
- package/skills/math-model-draft/scripts/inspect_inputs.py +63 -18
- package/skills/math-model-draft/scripts/package_support.py +4 -0
- package/skills/math-model-draft/scripts/validate_project.py +22 -3
package/dist/index.js
CHANGED
|
@@ -28461,9 +28461,9 @@ ${lanes.join("\n")}
|
|
|
28461
28461
|
path6,
|
|
28462
28462
|
data,
|
|
28463
28463
|
!!writeBom,
|
|
28464
|
-
(
|
|
28465
|
-
(
|
|
28466
|
-
(
|
|
28464
|
+
(path24, data2, writeByteOrderMark) => originalWriteFile.call(sys2, path24, data2, writeByteOrderMark),
|
|
28465
|
+
(path24) => sys2.createDirectory(path24),
|
|
28466
|
+
(path24) => sys2.directoryExists(path24)
|
|
28467
28467
|
);
|
|
28468
28468
|
}
|
|
28469
28469
|
var sys = (() => {
|
|
@@ -42938,13 +42938,13 @@ ${lanes.join("\n")}
|
|
|
42938
42938
|
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
|
42939
42939
|
}
|
|
42940
42940
|
return flatten(results);
|
|
42941
|
-
function visitDirectory(
|
|
42941
|
+
function visitDirectory(path24, absolutePath, depth2) {
|
|
42942
42942
|
const canonicalPath = toCanonical(realpath(absolutePath));
|
|
42943
42943
|
if (visited.has(canonicalPath)) return;
|
|
42944
42944
|
visited.set(canonicalPath, true);
|
|
42945
|
-
const { files, directories } = getFileSystemEntries(
|
|
42945
|
+
const { files, directories } = getFileSystemEntries(path24);
|
|
42946
42946
|
for (const current of toSorted(files, compareStringsCaseSensitive)) {
|
|
42947
|
-
const name = combinePaths(
|
|
42947
|
+
const name = combinePaths(path24, current);
|
|
42948
42948
|
const absoluteName = combinePaths(absolutePath, current);
|
|
42949
42949
|
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
|
|
42950
42950
|
if (excludeRegex && excludeRegex.test(absoluteName)) continue;
|
|
@@ -42964,7 +42964,7 @@ ${lanes.join("\n")}
|
|
|
42964
42964
|
}
|
|
42965
42965
|
}
|
|
42966
42966
|
for (const current of toSorted(directories, compareStringsCaseSensitive)) {
|
|
42967
|
-
const name = combinePaths(
|
|
42967
|
+
const name = combinePaths(path24, current);
|
|
42968
42968
|
const absoluteName = combinePaths(absolutePath, current);
|
|
42969
42969
|
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) {
|
|
42970
42970
|
visitDirectory(name, absoluteName, depth2);
|
|
@@ -43225,10 +43225,10 @@ ${lanes.join("\n")}
|
|
|
43225
43225
|
const match = str.match(/\//g);
|
|
43226
43226
|
return match ? match.length : 0;
|
|
43227
43227
|
}
|
|
43228
|
-
function compareNumberOfDirectorySeparators(path1,
|
|
43228
|
+
function compareNumberOfDirectorySeparators(path1, path24) {
|
|
43229
43229
|
return compareValues(
|
|
43230
43230
|
numberOfDirectorySeparators(path1),
|
|
43231
|
-
numberOfDirectorySeparators(
|
|
43231
|
+
numberOfDirectorySeparators(path24)
|
|
43232
43232
|
);
|
|
43233
43233
|
}
|
|
43234
43234
|
var extensionsToRemove = [
|
|
@@ -65889,12 +65889,12 @@ ${lanes.join("\n")}
|
|
|
65889
65889
|
const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames);
|
|
65890
65890
|
if (includeRe) {
|
|
65891
65891
|
if (excludeRe) {
|
|
65892
|
-
return (
|
|
65892
|
+
return (path24) => !(includeRe.test(path24) && !excludeRe.test(path24));
|
|
65893
65893
|
}
|
|
65894
|
-
return (
|
|
65894
|
+
return (path24) => !includeRe.test(path24);
|
|
65895
65895
|
}
|
|
65896
65896
|
if (excludeRe) {
|
|
65897
|
-
return (
|
|
65897
|
+
return (path24) => excludeRe.test(path24);
|
|
65898
65898
|
}
|
|
65899
65899
|
return returnTrue;
|
|
65900
65900
|
}
|
|
@@ -66692,7 +66692,7 @@ ${lanes.join("\n")}
|
|
|
66692
66692
|
if (extendedConfigCache && (value = extendedConfigCache.get(path6))) {
|
|
66693
66693
|
({ extendedResult, extendedConfig } = value);
|
|
66694
66694
|
} else {
|
|
66695
|
-
extendedResult = readJsonConfigFile(extendedConfigPath, (
|
|
66695
|
+
extendedResult = readJsonConfigFile(extendedConfigPath, (path24) => host.readFile(path24));
|
|
66696
66696
|
if (!extendedResult.parseDiagnostics.length) {
|
|
66697
66697
|
extendedConfig = parseConfig(
|
|
66698
66698
|
/*json*/
|
|
@@ -67345,9 +67345,9 @@ ${lanes.join("\n")}
|
|
|
67345
67345
|
return typeRoots;
|
|
67346
67346
|
}
|
|
67347
67347
|
var nodeModulesAtTypes = combinePaths("node_modules", "@types");
|
|
67348
|
-
function arePathsEqual(path1,
|
|
67348
|
+
function arePathsEqual(path1, path24, host) {
|
|
67349
67349
|
const useCaseSensitiveFileNames2 = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
67350
|
-
return comparePaths(path1,
|
|
67350
|
+
return comparePaths(path1, path24, !useCaseSensitiveFileNames2) === 0;
|
|
67351
67351
|
}
|
|
67352
67352
|
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
67353
67353
|
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
@@ -69603,9 +69603,9 @@ ${lanes.join("\n")}
|
|
|
69603
69603
|
}
|
|
69604
69604
|
const extension = tryGetExtensionFromPath2(subst);
|
|
69605
69605
|
if (extension !== void 0) {
|
|
69606
|
-
const
|
|
69607
|
-
if (
|
|
69608
|
-
return noPackageId({ path:
|
|
69606
|
+
const path24 = tryFile(candidate, onlyRecordFailures, state);
|
|
69607
|
+
if (path24 !== void 0) {
|
|
69608
|
+
return noPackageId({ path: path24, ext: extension, resolvedUsingTsExtension: void 0 });
|
|
69609
69609
|
}
|
|
69610
69610
|
}
|
|
69611
69611
|
return loader(extensions, candidate, onlyRecordFailures || !directoryProbablyExists(getDirectoryPath(candidate), state.host), state);
|
|
@@ -162090,7 +162090,7 @@ ${lanes.join("\n")}
|
|
|
162090
162090
|
const watcher = fileWatchesOfAffectingLocations.get(path6);
|
|
162091
162091
|
if (watcher == null ? void 0 : watcher.resolutions) (affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path6);
|
|
162092
162092
|
if (watcher == null ? void 0 : watcher.files) (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path6);
|
|
162093
|
-
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((
|
|
162093
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path24) => invalidateAffectingFileWatcher(path24, packageJsonMap));
|
|
162094
162094
|
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path6));
|
|
162095
162095
|
}
|
|
162096
162096
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
|
|
@@ -197548,12 +197548,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
197548
197548
|
];
|
|
197549
197549
|
}
|
|
197550
197550
|
return patternWorker(path6, pattern, initializer, dotDotDotToken, { tabstop: 1 });
|
|
197551
|
-
function patternWorker(
|
|
197551
|
+
function patternWorker(path24, pattern2, initializer2, dotDotDotToken2, counter) {
|
|
197552
197552
|
if (isObjectBindingPattern(pattern2) && !dotDotDotToken2) {
|
|
197553
197553
|
const oldTabstop = counter.tabstop;
|
|
197554
197554
|
const childCounter = { tabstop: oldTabstop };
|
|
197555
197555
|
const rootParam = getJSDocParamAnnotation(
|
|
197556
|
-
|
|
197556
|
+
path24,
|
|
197557
197557
|
initializer2,
|
|
197558
197558
|
dotDotDotToken2,
|
|
197559
197559
|
isJs,
|
|
@@ -197567,7 +197567,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
197567
197567
|
);
|
|
197568
197568
|
let childTags = [];
|
|
197569
197569
|
for (const element of pattern2.elements) {
|
|
197570
|
-
const elementTags = elementWorker(
|
|
197570
|
+
const elementTags = elementWorker(path24, element, childCounter);
|
|
197571
197571
|
if (!elementTags) {
|
|
197572
197572
|
childTags = void 0;
|
|
197573
197573
|
break;
|
|
@@ -197582,7 +197582,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
197582
197582
|
}
|
|
197583
197583
|
return [
|
|
197584
197584
|
getJSDocParamAnnotation(
|
|
197585
|
-
|
|
197585
|
+
path24,
|
|
197586
197586
|
initializer2,
|
|
197587
197587
|
dotDotDotToken2,
|
|
197588
197588
|
isJs,
|
|
@@ -197596,13 +197596,13 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
197596
197596
|
)
|
|
197597
197597
|
];
|
|
197598
197598
|
}
|
|
197599
|
-
function elementWorker(
|
|
197599
|
+
function elementWorker(path24, element, counter) {
|
|
197600
197600
|
if (!element.propertyName && isIdentifier(element.name) || isIdentifier(element.name)) {
|
|
197601
197601
|
const propertyName = element.propertyName ? tryGetTextOfPropertyName(element.propertyName) : element.name.text;
|
|
197602
197602
|
if (!propertyName) {
|
|
197603
197603
|
return void 0;
|
|
197604
197604
|
}
|
|
197605
|
-
const paramName = `${
|
|
197605
|
+
const paramName = `${path24}.${propertyName}`;
|
|
197606
197606
|
return [
|
|
197607
197607
|
getJSDocParamAnnotation(
|
|
197608
197608
|
paramName,
|
|
@@ -197620,7 +197620,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
197620
197620
|
];
|
|
197621
197621
|
} else if (element.propertyName) {
|
|
197622
197622
|
const propertyName = tryGetTextOfPropertyName(element.propertyName);
|
|
197623
|
-
return propertyName && patternWorker(`${
|
|
197623
|
+
return propertyName && patternWorker(`${path24}.${propertyName}`, element.name, element.initializer, element.dotDotDotToken, counter);
|
|
197624
197624
|
}
|
|
197625
197625
|
return void 0;
|
|
197626
197626
|
}
|
|
@@ -222740,12 +222740,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
222740
222740
|
project.markAutoImportProviderAsDirty();
|
|
222741
222741
|
} else {
|
|
222742
222742
|
if (project.initialLoadPending) {
|
|
222743
|
-
(_b = (_a = this.configFileExistenceInfoCache.get(projectCanonicalPath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.forEach((
|
|
222743
|
+
(_b = (_a = this.configFileExistenceInfoCache.get(projectCanonicalPath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.forEach((path24) => {
|
|
222744
222744
|
var _a2;
|
|
222745
|
-
if (!((_a2 = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a2.has(
|
|
222745
|
+
if (!((_a2 = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a2.has(path24))) {
|
|
222746
222746
|
(this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(
|
|
222747
|
-
|
|
222748
|
-
this.configFileForOpenFiles.get(
|
|
222747
|
+
path24,
|
|
222748
|
+
this.configFileForOpenFiles.get(path24)
|
|
222749
222749
|
);
|
|
222750
222750
|
}
|
|
222751
222751
|
});
|
|
@@ -238026,6 +238026,8 @@ function localizeOrbit(language, english, simplifiedChinese, traditionalChinese)
|
|
|
238026
238026
|
return language === "zh" ? simplifiedChinese : english;
|
|
238027
238027
|
}
|
|
238028
238028
|
var ORBIT_CONFIG_SCHEMA_VERSION = 1;
|
|
238029
|
+
var DEFAULT_AGENT_MAX_ITERATIONS = 64;
|
|
238030
|
+
var MAX_AGENT_MAX_ITERATIONS = 200;
|
|
238029
238031
|
var EnvironmentVariableNameSchema = z2.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/);
|
|
238030
238032
|
var HttpHeaderNameSchema = z2.string().max(256).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/);
|
|
238031
238033
|
var HttpHeaderValueSchema = z2.string().max(16384).refine((value) => !/[\r\n]/.test(value));
|
|
@@ -238284,8 +238286,8 @@ var ConfigSchema = z2.object({
|
|
|
238284
238286
|
testCommands: z2.array(z2.string().max(2e4)).max(100).default([])
|
|
238285
238287
|
}).default({}),
|
|
238286
238288
|
agent: z2.object({
|
|
238287
|
-
maxIterations: z2.number().int().min(1).max(
|
|
238288
|
-
fastMaxOutputTokens: z2.number().int().min(256).max(384e3).default(
|
|
238289
|
+
maxIterations: z2.number().int().min(1).max(MAX_AGENT_MAX_ITERATIONS).default(DEFAULT_AGENT_MAX_ITERATIONS),
|
|
238290
|
+
fastMaxOutputTokens: z2.number().int().min(256).max(384e3).default(32768),
|
|
238289
238291
|
maxOutputTokens: z2.number().int().min(256).max(384e3).default(16384),
|
|
238290
238292
|
teamPreset: z2.enum(["fast", "balanced", "thorough"]).default("balanced"),
|
|
238291
238293
|
maxReviewAttempts: z2.number().int().min(1).max(10).default(3),
|
|
@@ -238356,6 +238358,8 @@ var ConfigSchema = z2.object({
|
|
|
238356
238358
|
allowedProviders: z2.array(z2.string().min(1).max(1024)).max(1e3).optional(),
|
|
238357
238359
|
allowedModels: z2.array(z2.string().min(1).max(1024)).max(1e3).optional(),
|
|
238358
238360
|
minimumPermissionMode: z2.enum(["auto", "normal", "strict", "plan"]).optional(),
|
|
238361
|
+
requireWriteApproval: z2.boolean().default(false),
|
|
238362
|
+
requireBashApproval: z2.boolean().default(false),
|
|
238359
238363
|
disableWebSearch: z2.boolean().default(false),
|
|
238360
238364
|
disableMcp: z2.boolean().default(false)
|
|
238361
238365
|
}).optional(),
|
|
@@ -238484,10 +238488,10 @@ var DEFAULT_CONFIG = {
|
|
|
238484
238488
|
testCommands: []
|
|
238485
238489
|
},
|
|
238486
238490
|
agent: {
|
|
238487
|
-
//
|
|
238488
|
-
//
|
|
238489
|
-
maxIterations:
|
|
238490
|
-
fastMaxOutputTokens:
|
|
238491
|
+
// Long enough for document, migration, and verification workflows; the
|
|
238492
|
+
// progress guard, periodic checkpoints, and budget still bound bad runs.
|
|
238493
|
+
maxIterations: DEFAULT_AGENT_MAX_ITERATIONS,
|
|
238494
|
+
fastMaxOutputTokens: 32768,
|
|
238491
238495
|
maxOutputTokens: 16384,
|
|
238492
238496
|
teamPreset: "balanced",
|
|
238493
238497
|
maxReviewAttempts: 3,
|
|
@@ -239203,6 +239207,8 @@ function applyManagedPolicy(source, policy) {
|
|
|
239203
239207
|
allowedProviders: policy.allowedProviders,
|
|
239204
239208
|
allowedModels: policy.allowedModels,
|
|
239205
239209
|
minimumPermissionMode: policy.minimumPermissionMode,
|
|
239210
|
+
requireWriteApproval: policy.requireWriteApproval,
|
|
239211
|
+
requireBashApproval: policy.requireBashApproval,
|
|
239206
239212
|
disableWebSearch: policy.disableWebSearch,
|
|
239207
239213
|
disableMcp: policy.disableMcp
|
|
239208
239214
|
};
|
|
@@ -239220,6 +239226,12 @@ function validateManagedRuntimeChange(config, change) {
|
|
|
239220
239226
|
if (change.permissionMode && policy.minimumPermissionMode && permissionRank(change.permissionMode) < permissionRank(policy.minimumPermissionMode)) {
|
|
239221
239227
|
return `Managed policy requires ${policy.minimumPermissionMode} mode or stricter.`;
|
|
239222
239228
|
}
|
|
239229
|
+
if (change.requireWriteApproval === false && policy.requireWriteApproval) {
|
|
239230
|
+
return "Managed policy requires write approval.";
|
|
239231
|
+
}
|
|
239232
|
+
if (change.requireBashApproval === false && policy.requireBashApproval) {
|
|
239233
|
+
return "Managed policy requires command approval.";
|
|
239234
|
+
}
|
|
239223
239235
|
if (change.webSearchEnabled && policy.disableWebSearch) {
|
|
239224
239236
|
return "Managed policy disables web search.";
|
|
239225
239237
|
}
|
|
@@ -239937,6 +239949,36 @@ function redactValue(value, seen) {
|
|
|
239937
239949
|
}
|
|
239938
239950
|
return output;
|
|
239939
239951
|
}
|
|
239952
|
+
function applyPermissionModePreset(config, mode) {
|
|
239953
|
+
const fullAccess = mode === "auto";
|
|
239954
|
+
const violation = validateManagedRuntimeChange(config, {
|
|
239955
|
+
permissionMode: mode,
|
|
239956
|
+
requireWriteApproval: !fullAccess,
|
|
239957
|
+
requireBashApproval: !fullAccess
|
|
239958
|
+
});
|
|
239959
|
+
if (violation) return { ok: false, message: violation };
|
|
239960
|
+
config.permissions.mode = mode;
|
|
239961
|
+
config.permissions.requireApprovalForWrite = !fullAccess;
|
|
239962
|
+
config.permissions.requireApprovalForBash = !fullAccess;
|
|
239963
|
+
config.permissions.blockDangerousCommands = true;
|
|
239964
|
+
config.permissions.protectSecrets = true;
|
|
239965
|
+
return { ok: true };
|
|
239966
|
+
}
|
|
239967
|
+
function isFullAccessEnabled(config) {
|
|
239968
|
+
return config.permissions.mode === "auto" && !config.permissions.requireApprovalForWrite && !config.permissions.requireApprovalForBash && config.permissions.blockDangerousCommands && config.permissions.protectSecrets;
|
|
239969
|
+
}
|
|
239970
|
+
function createPermissionModeOverride(mode) {
|
|
239971
|
+
const fullAccess = mode === "auto";
|
|
239972
|
+
return {
|
|
239973
|
+
permissions: {
|
|
239974
|
+
mode,
|
|
239975
|
+
requireApprovalForWrite: !fullAccess,
|
|
239976
|
+
requireApprovalForBash: !fullAccess,
|
|
239977
|
+
blockDangerousCommands: true,
|
|
239978
|
+
protectSecrets: true
|
|
239979
|
+
}
|
|
239980
|
+
};
|
|
239981
|
+
}
|
|
239940
239982
|
|
|
239941
239983
|
// src/commands/config.ts
|
|
239942
239984
|
import picocolors2 from "picocolors";
|
|
@@ -239948,7 +239990,7 @@ function runConfig(cwd) {
|
|
|
239948
239990
|
|
|
239949
239991
|
// src/commands/doctor.ts
|
|
239950
239992
|
import { execSync as execSync2 } from "child_process";
|
|
239951
|
-
import { existsSync as
|
|
239993
|
+
import { existsSync as existsSync12 } from "fs";
|
|
239952
239994
|
import { basename as basename3, join as join11 } from "path";
|
|
239953
239995
|
import picocolors6 from "picocolors";
|
|
239954
239996
|
import { z as z41 } from "zod";
|
|
@@ -243005,11 +243047,6 @@ function validateToolFinishReason(finishReason, toolCallCount) {
|
|
|
243005
243047
|
"DeepSeek reported a tool-call finish without returning a tool call."
|
|
243006
243048
|
);
|
|
243007
243049
|
}
|
|
243008
|
-
if (toolCallCount > 0 && finishReason !== "tool_calls") {
|
|
243009
|
-
throw new Error(
|
|
243010
|
-
"DeepSeek returned a tool call without the tool_calls finish reason."
|
|
243011
|
-
);
|
|
243012
|
-
}
|
|
243013
243050
|
}
|
|
243014
243051
|
function normalizeOfficialMaxTokens(value) {
|
|
243015
243052
|
if (value === void 0) return void 0;
|
|
@@ -244129,12 +244166,12 @@ function normalizeOllamaOpenAiBaseUrl(baseUrl) {
|
|
|
244129
244166
|
}
|
|
244130
244167
|
|
|
244131
244168
|
// src/runtime/CacheDiagnostics.ts
|
|
244132
|
-
import { existsSync as
|
|
244169
|
+
import { existsSync as existsSync11, readdirSync as readdirSync5 } from "fs";
|
|
244133
244170
|
import { join as join10 } from "path";
|
|
244134
244171
|
import picocolors4 from "picocolors";
|
|
244135
244172
|
|
|
244136
244173
|
// ../core/dist/index.js
|
|
244137
|
-
import { existsSync as
|
|
244174
|
+
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "fs";
|
|
244138
244175
|
import { createHash as createHash5 } from "crypto";
|
|
244139
244176
|
import { join as join9 } from "path";
|
|
244140
244177
|
import { z as z30 } from "zod";
|
|
@@ -245759,9 +245796,11 @@ import { z as z14 } from "zod";
|
|
|
245759
245796
|
import glob2 from "fast-glob";
|
|
245760
245797
|
import { z as z15 } from "zod";
|
|
245761
245798
|
import { z as z16 } from "zod";
|
|
245762
|
-
import { z as z17 } from "zod";
|
|
245763
245799
|
import { existsSync as existsSync52 } from "fs";
|
|
245764
245800
|
import { join as join23 } from "path";
|
|
245801
|
+
import { z as z17 } from "zod";
|
|
245802
|
+
import { existsSync as existsSync6 } from "fs";
|
|
245803
|
+
import { join as join32 } from "path";
|
|
245765
245804
|
import { z as z19 } from "zod";
|
|
245766
245805
|
var import_ipaddr = __toESM(require_ipaddr(), 1);
|
|
245767
245806
|
import { lookup } from "dns/promises";
|
|
@@ -247371,6 +247410,53 @@ function readProcessFailureMessage(result) {
|
|
|
247371
247410
|
const message2 = typeof record.shortMessage === "string" ? record.shortMessage : typeof record.message === "string" ? record.message : "The child process failed.";
|
|
247372
247411
|
return safeProcessFailureMessage(message2);
|
|
247373
247412
|
}
|
|
247413
|
+
function firstExistingPath(candidates, pathExists2 = existsSync52) {
|
|
247414
|
+
for (const candidate of candidates) {
|
|
247415
|
+
if (candidate && pathExists2(candidate)) return candidate;
|
|
247416
|
+
}
|
|
247417
|
+
return null;
|
|
247418
|
+
}
|
|
247419
|
+
function resolveCommandShellInvocation(command, options = {}) {
|
|
247420
|
+
const platform = options.platform ?? process.platform;
|
|
247421
|
+
const environment = options.environment ?? process.env;
|
|
247422
|
+
const pathExists2 = options.pathExists ?? existsSync52;
|
|
247423
|
+
if (platform !== "win32") {
|
|
247424
|
+
const bash2 = firstExistingPath(
|
|
247425
|
+
[environment.ORBIT_BASH_PATH, "/bin/bash", "/usr/bin/bash"],
|
|
247426
|
+
pathExists2
|
|
247427
|
+
);
|
|
247428
|
+
if (bash2) {
|
|
247429
|
+
return {
|
|
247430
|
+
file: bash2,
|
|
247431
|
+
args: ["--noprofile", "--norc", "-c", command]
|
|
247432
|
+
};
|
|
247433
|
+
}
|
|
247434
|
+
return {
|
|
247435
|
+
file: "/bin/sh",
|
|
247436
|
+
args: ["-c", command]
|
|
247437
|
+
};
|
|
247438
|
+
}
|
|
247439
|
+
const bash = firstExistingPath(
|
|
247440
|
+
[
|
|
247441
|
+
environment.ORBIT_BASH_PATH,
|
|
247442
|
+
environment.ProgramFiles ? join23(environment.ProgramFiles, "Git", "bin", "bash.exe") : void 0,
|
|
247443
|
+
environment["ProgramFiles(x86)"] ? join23(environment["ProgramFiles(x86)"], "Git", "bin", "bash.exe") : void 0,
|
|
247444
|
+
environment.LOCALAPPDATA ? join23(environment.LOCALAPPDATA, "Programs", "Git", "bin", "bash.exe") : void 0,
|
|
247445
|
+
environment.LOCALAPPDATA ? join23(environment.LOCALAPPDATA, "hermes", "git", "bin", "bash.exe") : void 0
|
|
247446
|
+
],
|
|
247447
|
+
pathExists2
|
|
247448
|
+
);
|
|
247449
|
+
if (bash) {
|
|
247450
|
+
return {
|
|
247451
|
+
file: bash,
|
|
247452
|
+
args: ["--noprofile", "--norc", "-lc", command]
|
|
247453
|
+
};
|
|
247454
|
+
}
|
|
247455
|
+
return {
|
|
247456
|
+
file: environment.ComSpec?.trim() || "cmd.exe",
|
|
247457
|
+
args: ["/d", "/s", "/c", command]
|
|
247458
|
+
};
|
|
247459
|
+
}
|
|
247374
247460
|
var BashInputSchema = z16.object({
|
|
247375
247461
|
command: z16.string().min(1).max(1e5),
|
|
247376
247462
|
timeoutMs: z16.number().int().positive().optional(),
|
|
@@ -247423,9 +247509,9 @@ var BashTool = class {
|
|
|
247423
247509
|
}
|
|
247424
247510
|
}
|
|
247425
247511
|
try {
|
|
247426
|
-
const
|
|
247512
|
+
const invocation = resolveCommandShellInvocation(input.command);
|
|
247513
|
+
const result = await execa(invocation.file, invocation.args, {
|
|
247427
247514
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247428
|
-
shell: true,
|
|
247429
247515
|
cwd: ctx.cwd,
|
|
247430
247516
|
timeout,
|
|
247431
247517
|
reject: false,
|
|
@@ -247499,9 +247585,9 @@ var RunTestsTool = class {
|
|
|
247499
247585
|
const configuredTimeout = ctx.config?.tools?.bash?.timeoutMs;
|
|
247500
247586
|
const timeout = typeof configuredTimeout === "number" && Number.isFinite(configuredTimeout) ? Math.max(1e3, configuredTimeout) : 12e4;
|
|
247501
247587
|
try {
|
|
247502
|
-
const
|
|
247588
|
+
const invocation = resolveCommandShellInvocation(testCommand);
|
|
247589
|
+
const result = await execa(invocation.file, invocation.args, {
|
|
247503
247590
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247504
|
-
shell: true,
|
|
247505
247591
|
cwd: ctx.cwd,
|
|
247506
247592
|
reject: false,
|
|
247507
247593
|
signal: ctx.abortSignal,
|
|
@@ -247556,36 +247642,36 @@ Exit code: ${exitCode}`,
|
|
|
247556
247642
|
}
|
|
247557
247643
|
}
|
|
247558
247644
|
inferTestCommand(cwd) {
|
|
247559
|
-
if (
|
|
247645
|
+
if (existsSync6(join32(cwd, "Cargo.toml"))) {
|
|
247560
247646
|
return "cargo test";
|
|
247561
247647
|
}
|
|
247562
|
-
if (
|
|
247648
|
+
if (existsSync6(join32(cwd, "go.mod"))) {
|
|
247563
247649
|
return "go test ./...";
|
|
247564
247650
|
}
|
|
247565
|
-
if (
|
|
247651
|
+
if (existsSync6(join32(cwd, "pom.xml"))) {
|
|
247566
247652
|
return "mvn test";
|
|
247567
247653
|
}
|
|
247568
|
-
if (
|
|
247654
|
+
if (existsSync6(join32(cwd, "build.gradle"))) {
|
|
247569
247655
|
return "./gradlew test";
|
|
247570
247656
|
}
|
|
247571
|
-
if (
|
|
247657
|
+
if (existsSync6(join32(cwd, "package.json"))) {
|
|
247572
247658
|
try {
|
|
247573
247659
|
const raw = readBoundedRegularFile(
|
|
247574
|
-
|
|
247660
|
+
join32(cwd, "package.json"),
|
|
247575
247661
|
1024 * 1024
|
|
247576
247662
|
);
|
|
247577
247663
|
if (raw === void 0) return "npm test";
|
|
247578
247664
|
const pkg = JSON.parse(raw);
|
|
247579
247665
|
if (pkg.scripts?.test) {
|
|
247580
|
-
if (
|
|
247581
|
-
if (
|
|
247666
|
+
if (existsSync6(join32(cwd, "pnpm-lock.yaml"))) return "pnpm test";
|
|
247667
|
+
if (existsSync6(join32(cwd, "yarn.lock"))) return "yarn test";
|
|
247582
247668
|
return "npm test";
|
|
247583
247669
|
}
|
|
247584
247670
|
} catch {
|
|
247585
247671
|
}
|
|
247586
247672
|
return "npm test";
|
|
247587
247673
|
}
|
|
247588
|
-
if (
|
|
247674
|
+
if (existsSync6(join32(cwd, "pytest.ini")) || existsSync6(join32(cwd, "pyproject.toml"))) {
|
|
247589
247675
|
return "pytest";
|
|
247590
247676
|
}
|
|
247591
247677
|
return "npm test";
|
|
@@ -249076,10 +249162,10 @@ var BackgroundTaskRuntime = class {
|
|
|
249076
249162
|
const startedAt = Date.now();
|
|
249077
249163
|
let child;
|
|
249078
249164
|
try {
|
|
249079
|
-
|
|
249165
|
+
const invocation = resolveCommandShellInvocation(request.command);
|
|
249166
|
+
child = spawn(invocation.file, invocation.args, {
|
|
249080
249167
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249081
249168
|
cwd: safeCwd,
|
|
249082
|
-
shell: true,
|
|
249083
249169
|
detached: process.platform !== "win32",
|
|
249084
249170
|
stdio: ["ignore", "pipe", "pipe"]
|
|
249085
249171
|
});
|
|
@@ -249390,7 +249476,7 @@ function errorMessage(error) {
|
|
|
249390
249476
|
}
|
|
249391
249477
|
|
|
249392
249478
|
// ../sandbox/dist/index.js
|
|
249393
|
-
import { existsSync as
|
|
249479
|
+
import { existsSync as existsSync7, lstatSync as lstatSync3, mkdirSync as mkdirSync3, readdirSync as readdirSync2, rmSync as rmSync2 } from "fs";
|
|
249394
249480
|
import { join as join6 } from "path";
|
|
249395
249481
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
249396
249482
|
import { z as z24 } from "zod";
|
|
@@ -249470,7 +249556,7 @@ var CheckpointManager = class {
|
|
|
249470
249556
|
}
|
|
249471
249557
|
loadPersistedCheckpoints() {
|
|
249472
249558
|
const sessionDir = this.getSessionCheckpointDir();
|
|
249473
|
-
if (!
|
|
249559
|
+
if (!existsSync7(sessionDir)) return;
|
|
249474
249560
|
const loaded = [];
|
|
249475
249561
|
for (const entry of readdirSync2(sessionDir, { withFileTypes: true })) {
|
|
249476
249562
|
if (!entry.isDirectory() || !CheckpointIdSchema.safeParse(entry.name).success) {
|
|
@@ -249478,7 +249564,7 @@ var CheckpointManager = class {
|
|
|
249478
249564
|
}
|
|
249479
249565
|
const checkpointDir = resolveSafePath(sessionDir, entry.name);
|
|
249480
249566
|
const metaPath = resolveSafePath(checkpointDir, "meta.json");
|
|
249481
|
-
if (!
|
|
249567
|
+
if (!existsSync7(metaPath)) continue;
|
|
249482
249568
|
try {
|
|
249483
249569
|
const parsed = PersistedCheckpointMetadataSchema.safeParse(
|
|
249484
249570
|
JSON.parse(
|
|
@@ -249517,7 +249603,7 @@ var CheckpointManager = class {
|
|
|
249517
249603
|
*/
|
|
249518
249604
|
readPersistedBackup(checkpointDir) {
|
|
249519
249605
|
const encryptedPath = resolveSafePath(checkpointDir, "backup_content.enc");
|
|
249520
|
-
if (
|
|
249606
|
+
if (existsSync7(encryptedPath)) {
|
|
249521
249607
|
const key = this.resolveEncryptionKey();
|
|
249522
249608
|
if (!key) return null;
|
|
249523
249609
|
try {
|
|
@@ -249531,7 +249617,7 @@ var CheckpointManager = class {
|
|
|
249531
249617
|
}
|
|
249532
249618
|
}
|
|
249533
249619
|
const plaintextPath = resolveSafePath(checkpointDir, "backup_content.txt");
|
|
249534
|
-
if (!
|
|
249620
|
+
if (!existsSync7(plaintextPath)) return null;
|
|
249535
249621
|
return readBoundedRegularFile(plaintextPath, CHECKPOINT_CONTENT_MAX_BYTES) ?? null;
|
|
249536
249622
|
}
|
|
249537
249623
|
async captureBeforeState(toolCallId, filePath) {
|
|
@@ -249539,7 +249625,7 @@ var CheckpointManager = class {
|
|
|
249539
249625
|
const validFilePath = z24.string().min(1).max(4096).parse(filePath);
|
|
249540
249626
|
const safePath = resolveSafePath(this.cwd, validFilePath);
|
|
249541
249627
|
let originalContent = null;
|
|
249542
|
-
if (
|
|
249628
|
+
if (existsSync7(safePath)) {
|
|
249543
249629
|
const stats = lstatSync3(safePath);
|
|
249544
249630
|
if (!stats.isFile() && !stats.isSymbolicLink()) {
|
|
249545
249631
|
throw new Error(`Checkpoint target must be a file: ${validFilePath}`);
|
|
@@ -249604,7 +249690,7 @@ var CheckpointManager = class {
|
|
|
249604
249690
|
this.getSessionCheckpointDir(),
|
|
249605
249691
|
checkpointId
|
|
249606
249692
|
);
|
|
249607
|
-
if (
|
|
249693
|
+
if (existsSync7(checkpointDir)) {
|
|
249608
249694
|
rmSync2(checkpointDir, { recursive: true, force: true });
|
|
249609
249695
|
}
|
|
249610
249696
|
}
|
|
@@ -249911,7 +249997,7 @@ import { createHash as createHash2, randomUUID as randomUUID32 } from "crypto";
|
|
|
249911
249997
|
import glob3 from "fast-glob";
|
|
249912
249998
|
import { z as z35 } from "zod";
|
|
249913
249999
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
249914
|
-
import { existsSync as
|
|
250000
|
+
import { existsSync as existsSync8, promises as fsPromises2 } from "fs";
|
|
249915
250001
|
import { dirname as dirname4, resolve as resolve4 } from "path";
|
|
249916
250002
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
249917
250003
|
import { z as z25 } from "zod";
|
|
@@ -249924,7 +250010,7 @@ import { existsSync as existsSync43 } from "fs";
|
|
|
249924
250010
|
import { pathToFileURL } from "url";
|
|
249925
250011
|
import { z as z43 } from "zod";
|
|
249926
250012
|
import { dirname as dirname5 } from "path";
|
|
249927
|
-
import { isAbsolute as isAbsolute22, join as
|
|
250013
|
+
import { isAbsolute as isAbsolute22, join as join33, resolve as resolve42 } from "path";
|
|
249928
250014
|
import { homedir as homedir4 } from "os";
|
|
249929
250015
|
import { existsSync as existsSync53, promises as fs2 } from "fs";
|
|
249930
250016
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -250227,7 +250313,7 @@ var JSVectorStore = class {
|
|
|
250227
250313
|
this.initializeCachePath();
|
|
250228
250314
|
try {
|
|
250229
250315
|
const parentDir = dirname4(this.dbPath);
|
|
250230
|
-
if (!
|
|
250316
|
+
if (!existsSync8(parentDir)) {
|
|
250231
250317
|
await fsPromises2.mkdir(parentDir, { recursive: true });
|
|
250232
250318
|
}
|
|
250233
250319
|
const dataToSave = {
|
|
@@ -250261,7 +250347,7 @@ var JSVectorStore = class {
|
|
|
250261
250347
|
}
|
|
250262
250348
|
async loadFromDisk() {
|
|
250263
250349
|
this.initializeCachePath();
|
|
250264
|
-
if (!
|
|
250350
|
+
if (!existsSync8(this.dbPath)) {
|
|
250265
250351
|
this.documents = [];
|
|
250266
250352
|
this.header = null;
|
|
250267
250353
|
this.cacheState = "missing";
|
|
@@ -250307,7 +250393,7 @@ var JSVectorStore = class {
|
|
|
250307
250393
|
this.header = null;
|
|
250308
250394
|
this.loaded = true;
|
|
250309
250395
|
this.cacheState = "missing";
|
|
250310
|
-
if (
|
|
250396
|
+
if (existsSync8(this.dbPath)) {
|
|
250311
250397
|
try {
|
|
250312
250398
|
await fsPromises2.unlink(this.dbPath);
|
|
250313
250399
|
} catch {
|
|
@@ -251770,13 +251856,13 @@ async function findSkillFiles(root) {
|
|
|
251770
251856
|
continue;
|
|
251771
251857
|
}
|
|
251772
251858
|
queue.push({
|
|
251773
|
-
path:
|
|
251859
|
+
path: join33(directory, entry.name),
|
|
251774
251860
|
depth: current.depth + 1
|
|
251775
251861
|
});
|
|
251776
251862
|
discoveredDirectories += 1;
|
|
251777
251863
|
} else if (entry.isFile() && entry.name === "SKILL.md") {
|
|
251778
251864
|
if (files.length < MAX_SKILL_FILES) {
|
|
251779
|
-
files.push(
|
|
251865
|
+
files.push(join33(directory, entry.name));
|
|
251780
251866
|
} else if (!fileLimitReported) {
|
|
251781
251867
|
diagnostics.push({
|
|
251782
251868
|
path: normalizePath2(root),
|
|
@@ -252589,7 +252675,7 @@ import { z as z38 } from "zod";
|
|
|
252589
252675
|
import { z as z83 } from "zod";
|
|
252590
252676
|
import picocolors3 from "picocolors";
|
|
252591
252677
|
import path42 from "path";
|
|
252592
|
-
import
|
|
252678
|
+
import fs32 from "fs";
|
|
252593
252679
|
import { randomUUID as randomUUID42 } from "crypto";
|
|
252594
252680
|
import { exec as exec2, execFile as execFile3 } from "child_process";
|
|
252595
252681
|
import { promisify as promisify3 } from "util";
|
|
@@ -253719,6 +253805,9 @@ import path32 from "path";
|
|
|
253719
253805
|
// ../permissions/dist/index.js
|
|
253720
253806
|
import os2 from "os";
|
|
253721
253807
|
import path4 from "path";
|
|
253808
|
+
import fs3 from "fs";
|
|
253809
|
+
import os22 from "os";
|
|
253810
|
+
import path22 from "path";
|
|
253722
253811
|
var DANGEROUS_COMMAND_REGEXES = [
|
|
253723
253812
|
/\brm\s+-rf\b/i,
|
|
253724
253813
|
/\brm\s+.*(?:--recursive|-r)\b/i,
|
|
@@ -253808,6 +253897,9 @@ function tokenize2(command) {
|
|
|
253808
253897
|
if (current) tokens.push(current);
|
|
253809
253898
|
return tokens;
|
|
253810
253899
|
}
|
|
253900
|
+
function extractCommandExecutable(command) {
|
|
253901
|
+
return tokenize2(command)[0];
|
|
253902
|
+
}
|
|
253811
253903
|
function extractCommandPaths(command) {
|
|
253812
253904
|
const pathTokens = [];
|
|
253813
253905
|
const bareTokens = [];
|
|
@@ -253823,7 +253915,11 @@ function extractCommandPaths(command) {
|
|
|
253823
253915
|
}
|
|
253824
253916
|
for (const candidate of candidates) {
|
|
253825
253917
|
if (!candidate || candidate.includes("://")) continue;
|
|
253826
|
-
|
|
253918
|
+
if (/^\/dev\/(?:null|stdin|stdout|stderr|tty)$/i.test(candidate)) {
|
|
253919
|
+
continue;
|
|
253920
|
+
}
|
|
253921
|
+
const hasBackslashPath = /^\\\\/.test(candidate) || /(?:^|[\w.)-])\\[\w.(~-]/.test(candidate);
|
|
253922
|
+
const looksLikePath = candidate.includes("/") || hasBackslashPath || /^[A-Za-z]:/.test(candidate) || candidate.startsWith("~") || /^\.[\w.-]+$/.test(candidate);
|
|
253827
253923
|
if (looksLikePath) {
|
|
253828
253924
|
pathTokens.push(candidate);
|
|
253829
253925
|
} else if (/^[\w][\w.-]*$/.test(candidate)) {
|
|
@@ -253835,8 +253931,14 @@ function extractCommandPaths(command) {
|
|
|
253835
253931
|
}
|
|
253836
253932
|
function resolveCommandPathCandidate(token, workspaceRoot) {
|
|
253837
253933
|
const home = os2.homedir();
|
|
253838
|
-
|
|
253934
|
+
let expanded = token.replace(/^~(?=$|[\\/])/, home).replace(/^\$HOME(?=$|[\\/])/, home).replace(/^%USERPROFILE%/i, home);
|
|
253839
253935
|
if (/[%$]/.test(expanded)) return null;
|
|
253936
|
+
if (process.platform === "win32") {
|
|
253937
|
+
const msysPath = /^\/([A-Za-z])(?:\/(.*))?$/.exec(expanded);
|
|
253938
|
+
if (msysPath) {
|
|
253939
|
+
expanded = `${msysPath[1].toUpperCase()}:\\${(msysPath[2] || "").replace(/\//g, "\\")}`;
|
|
253940
|
+
}
|
|
253941
|
+
}
|
|
253840
253942
|
try {
|
|
253841
253943
|
return path4.resolve(workspaceRoot, expanded);
|
|
253842
253944
|
} catch {
|
|
@@ -253850,6 +253952,38 @@ var PermissionEngine = class {
|
|
|
253850
253952
|
}
|
|
253851
253953
|
config;
|
|
253852
253954
|
workspaceRoot;
|
|
253955
|
+
trustedRoots = [];
|
|
253956
|
+
/** Active, validated Skill roots authorized for this turn. */
|
|
253957
|
+
setTrustedRoots(roots) {
|
|
253958
|
+
this.trustedRoots = roots;
|
|
253959
|
+
}
|
|
253960
|
+
commandTrustedRoots(mode) {
|
|
253961
|
+
if (mode !== "auto") return this.trustedRoots;
|
|
253962
|
+
const fontRoots = process.platform === "win32" ? [path22.join(process.env.WINDIR || "C:\\Windows", "Fonts")] : process.platform === "darwin" ? [
|
|
253963
|
+
"/Library/Fonts",
|
|
253964
|
+
"/System/Library/Fonts",
|
|
253965
|
+
path22.join(os22.homedir(), "Library", "Fonts")
|
|
253966
|
+
] : [
|
|
253967
|
+
"/usr/share/fonts",
|
|
253968
|
+
"/usr/local/share/fonts",
|
|
253969
|
+
path22.join(os22.homedir(), ".local", "share", "fonts")
|
|
253970
|
+
];
|
|
253971
|
+
return Array.from(
|
|
253972
|
+
/* @__PURE__ */ new Set([...this.trustedRoots, os22.tmpdir(), ...fontRoots])
|
|
253973
|
+
);
|
|
253974
|
+
}
|
|
253975
|
+
isTrustedExecutable(resolved) {
|
|
253976
|
+
const executableDirectory = path22.resolve(path22.dirname(resolved));
|
|
253977
|
+
const pathRoots = (process.env.PATH || "").split(path22.delimiter).map((entry) => entry.trim()).filter(Boolean).map((entry) => path22.resolve(entry));
|
|
253978
|
+
if (!pathRoots.some((entry) => entry === executableDirectory)) return false;
|
|
253979
|
+
try {
|
|
253980
|
+
const stat = fs3.statSync(resolved);
|
|
253981
|
+
if (!stat.isFile()) return false;
|
|
253982
|
+
return process.platform === "win32" ? /\.(?:exe|cmd|bat|com)$/i.test(resolved) : (stat.mode & 73) !== 0;
|
|
253983
|
+
} catch {
|
|
253984
|
+
return false;
|
|
253985
|
+
}
|
|
253986
|
+
}
|
|
253853
253987
|
evaluate(toolName, args, declaredRisk) {
|
|
253854
253988
|
const mode = this.config.permissions.mode;
|
|
253855
253989
|
const protectedPaths = this.config.permissions.protectedPaths;
|
|
@@ -253958,6 +254092,8 @@ var PermissionEngine = class {
|
|
|
253958
254092
|
}
|
|
253959
254093
|
if (this.workspaceRoot) {
|
|
253960
254094
|
const workspaceRoot = this.workspaceRoot;
|
|
254095
|
+
const trustedRoots = this.commandTrustedRoots(mode);
|
|
254096
|
+
const executableToken = extractCommandExecutable(cmdString);
|
|
253961
254097
|
const unresolvedPath = commandPaths.pathTokens.find(
|
|
253962
254098
|
(token) => resolveCommandPathCandidate(token, workspaceRoot) === null
|
|
253963
254099
|
);
|
|
@@ -253977,7 +254113,9 @@ var PermissionEngine = class {
|
|
|
253977
254113
|
}
|
|
253978
254114
|
const outsidePath = commandPaths.pathTokens.find((token) => {
|
|
253979
254115
|
const resolved = resolveCommandPathCandidate(token, workspaceRoot);
|
|
253980
|
-
return resolved !== null && !checkWorkspaceBoundary(workspaceRoot, resolved)
|
|
254116
|
+
return resolved !== null && !checkWorkspaceBoundary(workspaceRoot, resolved) && !trustedRoots.some(
|
|
254117
|
+
(root) => checkWorkspaceBoundary(root, resolved)
|
|
254118
|
+
) && !(mode === "auto" && token === executableToken && this.isTrustedExecutable(resolved));
|
|
253981
254119
|
});
|
|
253982
254120
|
if (outsidePath) {
|
|
253983
254121
|
if (mode === "strict") {
|
|
@@ -254059,7 +254197,7 @@ var PermissionEngine = class {
|
|
|
254059
254197
|
};
|
|
254060
254198
|
}
|
|
254061
254199
|
if (mode === "auto") {
|
|
254062
|
-
if (risk === "read" || risk === "write" || risk === "execute") {
|
|
254200
|
+
if (risk === "read" || risk === "write" || risk === "execute" || risk === "network") {
|
|
254063
254201
|
return {
|
|
254064
254202
|
action: "allow",
|
|
254065
254203
|
reason: `Automatically allowed under auto mode.`,
|
|
@@ -254093,7 +254231,7 @@ import { dirname as dirname7, isAbsolute as isAbsolute4, join as join8, relative
|
|
|
254093
254231
|
import {
|
|
254094
254232
|
appendFileSync,
|
|
254095
254233
|
closeSync as closeSync2,
|
|
254096
|
-
existsSync as
|
|
254234
|
+
existsSync as existsSync9,
|
|
254097
254235
|
fsyncSync as fsyncSync2,
|
|
254098
254236
|
lstatSync as lstatSync5,
|
|
254099
254237
|
mkdirSync as mkdirSync5,
|
|
@@ -254116,7 +254254,7 @@ import { homedir as homedir5 } from "os";
|
|
|
254116
254254
|
import { basename as basename2, dirname as dirname23, isAbsolute as isAbsolute23, join as join25, parse as parse2, resolve as resolve24 } from "path";
|
|
254117
254255
|
import { z as z210 } from "zod";
|
|
254118
254256
|
import { existsSync as existsSync26, lstatSync as lstatSync32, mkdirSync as mkdirSync22, readdirSync as readdirSync22 } from "fs";
|
|
254119
|
-
import { basename as basename22, join as
|
|
254257
|
+
import { basename as basename22, join as join34, resolve as resolve32 } from "path";
|
|
254120
254258
|
import { z as z37 } from "zod";
|
|
254121
254259
|
var SafeObjectKeySchema = z29.string().refine(
|
|
254122
254260
|
(key) => !["__proto__", "constructor", "prototype"].includes(key),
|
|
@@ -254527,7 +254665,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
254527
254665
|
const backupPath = `${destinationPath}.${process.pid}.${randomUUID6()}.bak`;
|
|
254528
254666
|
let previousMoved = false;
|
|
254529
254667
|
try {
|
|
254530
|
-
if (
|
|
254668
|
+
if (existsSync9(destinationPath)) {
|
|
254531
254669
|
renameSync3(destinationPath, backupPath);
|
|
254532
254670
|
previousMoved = true;
|
|
254533
254671
|
}
|
|
@@ -254539,7 +254677,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
254539
254677
|
}
|
|
254540
254678
|
}
|
|
254541
254679
|
} catch (error) {
|
|
254542
|
-
if (previousMoved &&
|
|
254680
|
+
if (previousMoved && existsSync9(backupPath) && !existsSync9(destinationPath)) {
|
|
254543
254681
|
try {
|
|
254544
254682
|
renameSync3(backupPath, destinationPath);
|
|
254545
254683
|
} catch {
|
|
@@ -254547,7 +254685,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
254547
254685
|
}
|
|
254548
254686
|
throw error;
|
|
254549
254687
|
} finally {
|
|
254550
|
-
if (
|
|
254688
|
+
if (existsSync9(destinationPath)) {
|
|
254551
254689
|
try {
|
|
254552
254690
|
rmSync4(backupPath, { force: true });
|
|
254553
254691
|
} catch {
|
|
@@ -254649,9 +254787,9 @@ var SessionStore = class {
|
|
|
254649
254787
|
} catch {
|
|
254650
254788
|
return void 0;
|
|
254651
254789
|
}
|
|
254652
|
-
if (!
|
|
254790
|
+
if (!existsSync9(sessionFile)) return void 0;
|
|
254653
254791
|
for (const candidate of [sessionFile, `${sessionFile}.bak`]) {
|
|
254654
|
-
if (!
|
|
254792
|
+
if (!existsSync9(candidate)) continue;
|
|
254655
254793
|
const parsed = readValidatedSnapshot(candidate, SessionSchema);
|
|
254656
254794
|
if (parsed?.id === id) return parsed;
|
|
254657
254795
|
}
|
|
@@ -254674,7 +254812,7 @@ var SessionStore = class {
|
|
|
254674
254812
|
let dirs;
|
|
254675
254813
|
try {
|
|
254676
254814
|
sessionRoot = this.resolveSessionRoot();
|
|
254677
|
-
if (!
|
|
254815
|
+
if (!existsSync9(sessionRoot)) return [];
|
|
254678
254816
|
dirs = readdirSync3(sessionRoot);
|
|
254679
254817
|
} catch {
|
|
254680
254818
|
return [];
|
|
@@ -254707,7 +254845,7 @@ var SessionStore = class {
|
|
|
254707
254845
|
} catch {
|
|
254708
254846
|
return [];
|
|
254709
254847
|
}
|
|
254710
|
-
if (!
|
|
254848
|
+
if (!existsSync9(file)) return [];
|
|
254711
254849
|
let content;
|
|
254712
254850
|
try {
|
|
254713
254851
|
content = readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "";
|
|
@@ -254791,7 +254929,7 @@ var SessionStore = class {
|
|
|
254791
254929
|
return void 0;
|
|
254792
254930
|
}
|
|
254793
254931
|
for (const candidate of [file, `${file}.bak`]) {
|
|
254794
|
-
if (!
|
|
254932
|
+
if (!existsSync9(candidate)) continue;
|
|
254795
254933
|
const parsed = readValidatedSnapshot(candidate, RunJournalSchema);
|
|
254796
254934
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
254797
254935
|
}
|
|
@@ -254875,7 +255013,7 @@ var SessionStore = class {
|
|
|
254875
255013
|
return void 0;
|
|
254876
255014
|
}
|
|
254877
255015
|
for (const candidate of [file, `${file}.bak`]) {
|
|
254878
|
-
if (!
|
|
255016
|
+
if (!existsSync9(candidate)) continue;
|
|
254879
255017
|
const parsed = readValidatedSnapshot(candidate, TaskPlanSchema);
|
|
254880
255018
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
254881
255019
|
}
|
|
@@ -254902,7 +255040,7 @@ var SessionStore = class {
|
|
|
254902
255040
|
return void 0;
|
|
254903
255041
|
}
|
|
254904
255042
|
for (const candidate of [file, `${file}.bak`]) {
|
|
254905
|
-
if (!
|
|
255043
|
+
if (!existsSync9(candidate)) continue;
|
|
254906
255044
|
const parsed = readValidatedSnapshot(candidate, AgentInputQueueSchema);
|
|
254907
255045
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
254908
255046
|
}
|
|
@@ -254960,7 +255098,7 @@ var SessionStore = class {
|
|
|
254960
255098
|
} catch {
|
|
254961
255099
|
return [];
|
|
254962
255100
|
}
|
|
254963
|
-
if (!
|
|
255101
|
+
if (!existsSync9(file)) return [];
|
|
254964
255102
|
try {
|
|
254965
255103
|
return (readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "").split("\n").filter((line) => line.trim()).flatMap((line) => {
|
|
254966
255104
|
try {
|
|
@@ -254988,7 +255126,7 @@ var SessionStore = class {
|
|
|
254988
255126
|
return [];
|
|
254989
255127
|
}
|
|
254990
255128
|
for (const candidate of [file, `${file}.bak`]) {
|
|
254991
|
-
if (!
|
|
255129
|
+
if (!existsSync9(candidate)) continue;
|
|
254992
255130
|
const parsed = readValidatedSnapshot(candidate, StoredHistorySchema);
|
|
254993
255131
|
if (parsed) return parsed;
|
|
254994
255132
|
}
|
|
@@ -254997,7 +255135,7 @@ var SessionStore = class {
|
|
|
254997
255135
|
deleteSession(id) {
|
|
254998
255136
|
SessionIdSchema.parse(id);
|
|
254999
255137
|
const dir = this.resolveSessionDirectory(id);
|
|
255000
|
-
if (
|
|
255138
|
+
if (existsSync9(dir)) {
|
|
255001
255139
|
rmSync4(dir, { recursive: true, force: true });
|
|
255002
255140
|
}
|
|
255003
255141
|
}
|
|
@@ -255020,7 +255158,7 @@ var SessionStore = class {
|
|
|
255020
255158
|
if (sessionRoot === this.cwd) {
|
|
255021
255159
|
throw new Error("Orbit session root cannot be the workspace root.");
|
|
255022
255160
|
}
|
|
255023
|
-
if (
|
|
255161
|
+
if (existsSync9(sessionRoot)) {
|
|
255024
255162
|
const rootStats = lstatSync5(sessionRoot);
|
|
255025
255163
|
if (rootStats.isSymbolicLink() || !rootStats.isDirectory()) {
|
|
255026
255164
|
throw new Error("Orbit session root must be a real directory.");
|
|
@@ -255036,7 +255174,7 @@ var SessionStore = class {
|
|
|
255036
255174
|
if (relativePath !== validId || relativePath.includes(sep) || isAbsolute4(relativePath)) {
|
|
255037
255175
|
throw new Error(`Invalid session directory: ${id}`);
|
|
255038
255176
|
}
|
|
255039
|
-
if (
|
|
255177
|
+
if (existsSync9(resolved)) {
|
|
255040
255178
|
const stats = lstatSync5(resolved);
|
|
255041
255179
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
255042
255180
|
throw new Error(`Invalid session directory: ${id}`);
|
|
@@ -255819,7 +255957,7 @@ var AgentRunStore = class {
|
|
|
255819
255957
|
try {
|
|
255820
255958
|
return [
|
|
255821
255959
|
this.read(
|
|
255822
|
-
resolveSafePath(this.cwd,
|
|
255960
|
+
resolveSafePath(this.cwd, join34(".orbit", "agent-runs", name))
|
|
255823
255961
|
)
|
|
255824
255962
|
];
|
|
255825
255963
|
} catch {
|
|
@@ -255860,7 +255998,7 @@ var AgentRunStore = class {
|
|
|
255860
255998
|
AgentRunIdSchema.parse(runId);
|
|
255861
255999
|
return resolveSafePath(
|
|
255862
256000
|
this.cwd,
|
|
255863
|
-
|
|
256001
|
+
join34(".orbit", "agent-runs", `${runId}.json`)
|
|
255864
256002
|
);
|
|
255865
256003
|
}
|
|
255866
256004
|
assertInitialized() {
|
|
@@ -255881,7 +256019,7 @@ import { randomUUID as randomUUID33 } from "crypto";
|
|
|
255881
256019
|
import { z as z64 } from "zod";
|
|
255882
256020
|
import { z as z73 } from "zod";
|
|
255883
256021
|
import fs23 from "fs";
|
|
255884
|
-
import
|
|
256022
|
+
import path23 from "path";
|
|
255885
256023
|
import { exec, execFile as execFile22 } from "child_process";
|
|
255886
256024
|
import { promisify as promisify2 } from "util";
|
|
255887
256025
|
import { z as z103 } from "zod";
|
|
@@ -256122,7 +256260,7 @@ var PromptCacheSlabBuilder = class {
|
|
|
256122
256260
|
}
|
|
256123
256261
|
static buildDiagnostics(cwd) {
|
|
256124
256262
|
const dir = join9(cwd, ".orbit", "cache-slabs");
|
|
256125
|
-
if (!
|
|
256263
|
+
if (!existsSync10(dir)) {
|
|
256126
256264
|
return [
|
|
256127
256265
|
"Cache diagnostics:",
|
|
256128
256266
|
"- No cache slab metadata found yet.",
|
|
@@ -256224,7 +256362,7 @@ function resolveContextWindowStatus(input) {
|
|
|
256224
256362
|
modelCapabilities.maxContextTokens || DEFAULT_MODEL_CONTEXT_TOKENS
|
|
256225
256363
|
)
|
|
256226
256364
|
);
|
|
256227
|
-
const configuredMaxOutputTokens = model === config.models.fast ? config.agent?.fastMaxOutputTokens ??
|
|
256365
|
+
const configuredMaxOutputTokens = model === config.models.fast ? config.agent?.fastMaxOutputTokens ?? 32768 : config.agent?.maxOutputTokens ?? 16384;
|
|
256228
256366
|
const modelMaxOutputTokens = modelCapabilities.maxOutputTokens || configuredMaxOutputTokens;
|
|
256229
256367
|
const maxOutputByContext = Math.max(1, Math.floor(maxContextTokens * 0.25));
|
|
256230
256368
|
const reservedOutputTokens = Math.max(
|
|
@@ -256899,6 +257037,7 @@ var AgentCompletedEventSchema = z38.object({
|
|
|
256899
257037
|
payload: z38.object({
|
|
256900
257038
|
taskId: z38.string(),
|
|
256901
257039
|
success: z38.boolean(),
|
|
257040
|
+
status: z38.enum(["completed", "failed", "aborted"]).optional(),
|
|
256902
257041
|
result: z38.unknown().optional(),
|
|
256903
257042
|
error: z38.string().optional()
|
|
256904
257043
|
})
|
|
@@ -258029,7 +258168,7 @@ var VerificationContractManager = class {
|
|
|
258029
258168
|
this.loadContract();
|
|
258030
258169
|
}
|
|
258031
258170
|
loadContract() {
|
|
258032
|
-
const contractPath =
|
|
258171
|
+
const contractPath = path23.join(this.cwd, ".orbit", "verification.json");
|
|
258033
258172
|
if (fs23.existsSync(contractPath)) {
|
|
258034
258173
|
try {
|
|
258035
258174
|
const content = readBoundedRegularFile(
|
|
@@ -258303,8 +258442,8 @@ function restoreSessionHistory(sessionManager, state) {
|
|
|
258303
258442
|
}
|
|
258304
258443
|
function resolveMaxLoopAttempts(config) {
|
|
258305
258444
|
const raw = config.agent?.maxIterations;
|
|
258306
|
-
if (!Number.isFinite(raw)) return
|
|
258307
|
-
return Math.max(1, Math.min(
|
|
258445
|
+
if (!Number.isFinite(raw)) return DEFAULT_AGENT_MAX_ITERATIONS;
|
|
258446
|
+
return Math.max(1, Math.min(MAX_AGENT_MAX_ITERATIONS, Math.floor(raw)));
|
|
258308
258447
|
}
|
|
258309
258448
|
function workspaceUserId(cwd) {
|
|
258310
258449
|
const workspaceIdentity = path32.resolve(cwd).replace(/\\/g, "/");
|
|
@@ -258351,6 +258490,22 @@ function hookErrorOutput(error) {
|
|
|
258351
258490
|
if (output.trim()) return output;
|
|
258352
258491
|
return typeof record.message === "string" ? record.message : String(error);
|
|
258353
258492
|
}
|
|
258493
|
+
function hasSuccessfulFileMutations(history) {
|
|
258494
|
+
const mutationCallIds = /* @__PURE__ */ new Set();
|
|
258495
|
+
for (const message2 of history) {
|
|
258496
|
+
for (const block of message2.content) {
|
|
258497
|
+
if (block.type === "tool_call" && isFileMutationTool(block.toolCall.name)) {
|
|
258498
|
+
mutationCallIds.add(block.toolCall.id);
|
|
258499
|
+
}
|
|
258500
|
+
}
|
|
258501
|
+
}
|
|
258502
|
+
if (mutationCallIds.size === 0) return false;
|
|
258503
|
+
return history.some(
|
|
258504
|
+
(message2) => message2.content.some(
|
|
258505
|
+
(block) => block.type === "tool_result" && mutationCallIds.has(block.toolResult.toolCallId) && block.toolResult.isError !== true
|
|
258506
|
+
)
|
|
258507
|
+
);
|
|
258508
|
+
}
|
|
258354
258509
|
var AgentLoop = class _AgentLoop {
|
|
258355
258510
|
constructor(cwd, config, provider, interaction, options, bootstrap) {
|
|
258356
258511
|
this.cwd = cwd;
|
|
@@ -258405,6 +258560,7 @@ var AgentLoop = class _AgentLoop {
|
|
|
258405
258560
|
this.stepRunner.setReadRoots(
|
|
258406
258561
|
active.map((skill) => ({ name: skill.name, path: skill.rootDir }))
|
|
258407
258562
|
);
|
|
258563
|
+
this.permissionEngine.setTrustedRoots(active.map((skill) => skill.rootDir));
|
|
258408
258564
|
const signature = JSON.stringify(
|
|
258409
258565
|
active.map((skill) => [skill.name, skill.activation])
|
|
258410
258566
|
);
|
|
@@ -258459,6 +258615,7 @@ var AgentLoop = class _AgentLoop {
|
|
|
258459
258615
|
fallbackExpiresAfterAttempt = 0;
|
|
258460
258616
|
contextOverflowRetriesForRun = 0;
|
|
258461
258617
|
outputLimitRetriesForRun = 0;
|
|
258618
|
+
completionVerificationNudgedForRun = false;
|
|
258462
258619
|
approvedToolScopes = /* @__PURE__ */ new Set();
|
|
258463
258620
|
terminalFailure = null;
|
|
258464
258621
|
verificationStatus = "not_run";
|
|
@@ -258678,6 +258835,7 @@ ${normalized}`);
|
|
|
258678
258835
|
}
|
|
258679
258836
|
async executeRun() {
|
|
258680
258837
|
const runStartedAt = /* @__PURE__ */ new Date();
|
|
258838
|
+
let iterationLimitReached = false;
|
|
258681
258839
|
eventBus.emitEvent("agent_start", {
|
|
258682
258840
|
taskId: this.state.sessionId,
|
|
258683
258841
|
task: this.state.task
|
|
@@ -258689,6 +258847,7 @@ ${normalized}`);
|
|
|
258689
258847
|
this.fallbackExpiresAfterAttempt = 0;
|
|
258690
258848
|
this.contextOverflowRetriesForRun = 0;
|
|
258691
258849
|
this.outputLimitRetriesForRun = 0;
|
|
258850
|
+
this.completionVerificationNudgedForRun = false;
|
|
258692
258851
|
this.approvedToolScopes.clear();
|
|
258693
258852
|
this.terminalFailure = null;
|
|
258694
258853
|
this.verificationStatus = "not_run";
|
|
@@ -258822,8 +258981,8 @@ ${normalized}`);
|
|
|
258822
258981
|
try {
|
|
258823
258982
|
const indexer = new SymbolIndexer(this.cwd);
|
|
258824
258983
|
const indexPath = indexer.indexPath;
|
|
258825
|
-
if (
|
|
258826
|
-
const stat =
|
|
258984
|
+
if (fs32.existsSync(indexPath)) {
|
|
258985
|
+
const stat = fs32.statSync(indexPath);
|
|
258827
258986
|
if (stat.mtimeMs === this.lastSymbolsMtime && this.cachedRepoMapText) {
|
|
258828
258987
|
repoMapText = this.cachedRepoMapText;
|
|
258829
258988
|
} else {
|
|
@@ -259352,11 +259511,7 @@ Orbit: ${this.interaction.formatMarkdown?.(responseText) || responseText}`
|
|
|
259352
259511
|
if (steeringApplied || backgroundReconciled) continue;
|
|
259353
259512
|
}
|
|
259354
259513
|
if (toolCallsToExecute.length === 0) {
|
|
259355
|
-
const hasEdits = this.state.history
|
|
259356
|
-
(msg) => msg.role === "assistant" && msg.content.some(
|
|
259357
|
-
(b3) => b3.type === "tool_call" && (b3.toolCall.name === "write_file" || b3.toolCall.name === "edit_file" || b3.toolCall.name === "replace_file_content" || b3.toolCall.name === "multi_replace_file_content")
|
|
259358
|
-
)
|
|
259359
|
-
);
|
|
259514
|
+
const hasEdits = hasSuccessfulFileMutations(this.state.history);
|
|
259360
259515
|
if (hasEdits) {
|
|
259361
259516
|
if (this.verificationManager.hasContract()) {
|
|
259362
259517
|
this.sessionManager.setRunState("verifying", "verification", {
|
|
@@ -259527,6 +259682,38 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
259527
259682
|
}
|
|
259528
259683
|
}
|
|
259529
259684
|
}
|
|
259685
|
+
if (hasEdits && this.verificationStatus === "not_run" && !this.completionVerificationNudgedForRun) {
|
|
259686
|
+
this.completionVerificationNudgedForRun = true;
|
|
259687
|
+
this.state.history.push({
|
|
259688
|
+
id: `msg_completion_verification_${Date.now()}`,
|
|
259689
|
+
role: "user",
|
|
259690
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
259691
|
+
content: [
|
|
259692
|
+
{
|
|
259693
|
+
type: "text",
|
|
259694
|
+
text: [
|
|
259695
|
+
"Orbit completion gate: files were modified, but no verification has run.",
|
|
259696
|
+
"Use run_tests now with the smallest relevant build, test, compile, or syntax check for the changed files.",
|
|
259697
|
+
"If it fails, repair the root cause before claiming completion. Do not repeat discovery."
|
|
259698
|
+
].join(" ")
|
|
259699
|
+
}
|
|
259700
|
+
],
|
|
259701
|
+
metadata: { kind: "completion_verification" }
|
|
259702
|
+
});
|
|
259703
|
+
this.sessionManager.saveHistory(this.state.history);
|
|
259704
|
+
this.interaction.showText(
|
|
259705
|
+
picocolors3.yellow(
|
|
259706
|
+
"\n\u26A0 Completion gate: modified files require a verification check before Orbit can finish."
|
|
259707
|
+
)
|
|
259708
|
+
);
|
|
259709
|
+
continue;
|
|
259710
|
+
}
|
|
259711
|
+
if (hasEdits && this.verificationStatus !== "passed") {
|
|
259712
|
+
this.terminalFailure = {
|
|
259713
|
+
code: "verification_failed",
|
|
259714
|
+
message: this.verificationStatus === "failed" ? "The final verification check failed." : "Modified files were not verified before completion."
|
|
259715
|
+
};
|
|
259716
|
+
}
|
|
259530
259717
|
this.state.done = true;
|
|
259531
259718
|
break;
|
|
259532
259719
|
}
|
|
@@ -260121,7 +260308,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260121
260308
|
}
|
|
260122
260309
|
if (finalResult.ok && targetPath && absoluteTargetPath && (tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content")) {
|
|
260123
260310
|
try {
|
|
260124
|
-
if (
|
|
260311
|
+
if (fs32.existsSync(path42.join(this.cwd, "biome.json")) || fs32.existsSync(path42.join(this.cwd, "biome.jsonc"))) {
|
|
260125
260312
|
this.interaction.showText(`\u25CF Running Biome Auto-Format...`);
|
|
260126
260313
|
await executeLocalPackageBinary(
|
|
260127
260314
|
this.cwd,
|
|
@@ -260140,7 +260327,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260140
260327
|
];
|
|
260141
260328
|
let hasPrettierConfig = false;
|
|
260142
260329
|
for (const c2 of prettierCandidates) {
|
|
260143
|
-
if (
|
|
260330
|
+
if (fs32.existsSync(path42.join(this.cwd, c2))) {
|
|
260144
260331
|
hasPrettierConfig = true;
|
|
260145
260332
|
break;
|
|
260146
260333
|
}
|
|
@@ -260165,7 +260352,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260165
260352
|
];
|
|
260166
260353
|
let hasEslintConfig = false;
|
|
260167
260354
|
for (const c2 of eslintCandidates) {
|
|
260168
|
-
if (
|
|
260355
|
+
if (fs32.existsSync(path42.join(this.cwd, c2))) {
|
|
260169
260356
|
hasEslintConfig = true;
|
|
260170
260357
|
break;
|
|
260171
260358
|
}
|
|
@@ -260183,7 +260370,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260183
260370
|
let lintPackage = "eslint";
|
|
260184
260371
|
let lintBinary = "eslint";
|
|
260185
260372
|
let lintArgs = ["--quiet", absoluteTargetPath];
|
|
260186
|
-
if (
|
|
260373
|
+
if (fs32.existsSync(path42.join(this.cwd, "biome.json")) || fs32.existsSync(path42.join(this.cwd, "biome.jsonc"))) {
|
|
260187
260374
|
lintPackage = "@biomejs/biome";
|
|
260188
260375
|
lintBinary = "biome";
|
|
260189
260376
|
lintArgs = ["lint", absoluteTargetPath];
|
|
@@ -260241,10 +260428,10 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260241
260428
|
);
|
|
260242
260429
|
if (installPkg) {
|
|
260243
260430
|
this.interaction.showText(`\u25CF Installing "${pkg}"...`);
|
|
260244
|
-
const isPnpm =
|
|
260431
|
+
const isPnpm = fs32.existsSync(
|
|
260245
260432
|
path42.join(this.cwd, "pnpm-lock.yaml")
|
|
260246
260433
|
);
|
|
260247
|
-
const isYarn =
|
|
260434
|
+
const isYarn = fs32.existsSync(
|
|
260248
260435
|
path42.join(this.cwd, "yarn.lock")
|
|
260249
260436
|
);
|
|
260250
260437
|
try {
|
|
@@ -260340,7 +260527,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260340
260527
|
`;
|
|
260341
260528
|
}
|
|
260342
260529
|
if (newImports) {
|
|
260343
|
-
|
|
260530
|
+
fs32.writeFileSync(
|
|
260344
260531
|
absoluteTargetPath,
|
|
260345
260532
|
newImports + fileContent,
|
|
260346
260533
|
"utf8"
|
|
@@ -260561,7 +260748,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260561
260748
|
lastB = hunk.endB;
|
|
260562
260749
|
}
|
|
260563
260750
|
mergedLines.push(...linesBefore.slice(lastB));
|
|
260564
|
-
|
|
260751
|
+
fs32.writeFileSync(
|
|
260565
260752
|
absoluteTargetPath,
|
|
260566
260753
|
mergedLines.join("\n"),
|
|
260567
260754
|
"utf8"
|
|
@@ -260628,6 +260815,9 @@ ${stdout.substring(0, 2e4)}`
|
|
|
260628
260815
|
status,
|
|
260629
260816
|
{ startedAt: toolStartedAt }
|
|
260630
260817
|
);
|
|
260818
|
+
if (tc.name === "run_tests") {
|
|
260819
|
+
this.verificationStatus = finalResult.ok ? "passed" : "failed";
|
|
260820
|
+
}
|
|
260631
260821
|
if (finalResult.ok) {
|
|
260632
260822
|
const statusText = this.truncatePlain(
|
|
260633
260823
|
redactSecrets(finalResult.display || "Done"),
|
|
@@ -260699,13 +260889,10 @@ ${guardNudge.message}` : ""),
|
|
|
260699
260889
|
this.sessionManager.saveHistory(this.state.history);
|
|
260700
260890
|
}
|
|
260701
260891
|
if (this.state.attemptCount >= this.state.maxAttempts && !this.state.done) {
|
|
260702
|
-
|
|
260703
|
-
code: "iteration_limit",
|
|
260704
|
-
message: `Maximum loop iterations (${this.state.maxAttempts}) reached before the task completed.`
|
|
260705
|
-
};
|
|
260892
|
+
iterationLimitReached = true;
|
|
260706
260893
|
this.interaction.showText(
|
|
260707
260894
|
`
|
|
260708
|
-
\
|
|
260895
|
+
\u26A0\uFE0F Paused: Maximum consecutive loop iterations (${this.state.maxAttempts}) completed. Resume this session to continue; completed tool results and verification evidence were preserved.`
|
|
260709
260896
|
);
|
|
260710
260897
|
}
|
|
260711
260898
|
const sessions = this.sessionManager.getSessionStore().getEvents(this.state.sessionId);
|
|
@@ -260724,7 +260911,7 @@ ${guardNudge.message}` : ""),
|
|
|
260724
260911
|
this.interaction.showText(
|
|
260725
260912
|
` Session Cost: $${this.sessionCost.toFixed(4)}`
|
|
260726
260913
|
);
|
|
260727
|
-
if (!this.terminalFailure && this.config.autoCommit && modifiedFiles.length > 0) {
|
|
260914
|
+
if (!this.terminalFailure && !iterationLimitReached && this.config.autoCommit && modifiedFiles.length > 0) {
|
|
260728
260915
|
this.interaction.showText(`
|
|
260729
260916
|
\u25CF Auto-committing changes...`);
|
|
260730
260917
|
try {
|
|
@@ -260804,6 +260991,12 @@ ${diff.substring(0, 2e4)}`
|
|
|
260804
260991
|
this.terminalFailure.message
|
|
260805
260992
|
);
|
|
260806
260993
|
}
|
|
260994
|
+
if (iterationLimitReached) {
|
|
260995
|
+
return this.createAbortedOutcome(
|
|
260996
|
+
"iteration_limit",
|
|
260997
|
+
`Paused after ${this.state.maxAttempts} consecutive loop iterations. Resume the session to continue.`
|
|
260998
|
+
);
|
|
260999
|
+
}
|
|
260807
261000
|
return {
|
|
260808
261001
|
status: "completed",
|
|
260809
261002
|
sessionId: this.state.sessionId,
|
|
@@ -260820,9 +261013,10 @@ ${diff.substring(0, 2e4)}`
|
|
|
260820
261013
|
}
|
|
260821
261014
|
finalizeOutcome(outcome) {
|
|
260822
261015
|
try {
|
|
261016
|
+
const iterationPause = outcome.status === "aborted" && outcome.reason === "iteration_limit";
|
|
260823
261017
|
this.sessionManager.setRunState(
|
|
260824
261018
|
outcome.status,
|
|
260825
|
-
outcome.status === "completed" ? "finished" : "terminated",
|
|
261019
|
+
outcome.status === "completed" ? "finished" : iterationPause ? "paused" : "terminated",
|
|
260826
261020
|
{ attempt: this.state.attemptCount }
|
|
260827
261021
|
);
|
|
260828
261022
|
this.sessionManager.setStatus(
|
|
@@ -260838,6 +261032,7 @@ ${diff.substring(0, 2e4)}`
|
|
|
260838
261032
|
eventBus.emitEvent("agent_completed", {
|
|
260839
261033
|
taskId: this.state.sessionId,
|
|
260840
261034
|
success: outcome.status === "completed",
|
|
261035
|
+
status: outcome.status,
|
|
260841
261036
|
result: outcome,
|
|
260842
261037
|
error: outcome.status === "failed" ? outcome.error.message : outcome.status === "aborted" ? outcome.message : void 0
|
|
260843
261038
|
});
|
|
@@ -261411,11 +261606,11 @@ ${diff.substring(0, 2e4)}`
|
|
|
261411
261606
|
const safePath = resolveSafePath(this.cwd, backup.path);
|
|
261412
261607
|
try {
|
|
261413
261608
|
if (backup.originalContent === null) {
|
|
261414
|
-
if (
|
|
261415
|
-
|
|
261609
|
+
if (fs32.existsSync(safePath)) {
|
|
261610
|
+
fs32.unlinkSync(safePath);
|
|
261416
261611
|
}
|
|
261417
261612
|
} else {
|
|
261418
|
-
|
|
261613
|
+
fs32.writeFileSync(safePath, backup.originalContent, "utf8");
|
|
261419
261614
|
}
|
|
261420
261615
|
return true;
|
|
261421
261616
|
} catch {
|
|
@@ -263106,7 +263301,7 @@ function latestObservation(metadata) {
|
|
|
263106
263301
|
}
|
|
263107
263302
|
function buildCacheDiagnostics(cwd) {
|
|
263108
263303
|
const dir = join10(cwd, ".orbit", "cache-slabs");
|
|
263109
|
-
if (!
|
|
263304
|
+
if (!existsSync11(dir)) {
|
|
263110
263305
|
return picocolors4.gray(
|
|
263111
263306
|
"\u25CF No cache telemetry yet. It will appear after a completed DeepSeek request."
|
|
263112
263307
|
);
|
|
@@ -263786,11 +263981,11 @@ function statusLine(ok, text, warn = false) {
|
|
|
263786
263981
|
return warn ? picocolors6.yellow(`\u26A0\uFE0F ${text}`) : picocolors6.red(`\u2716 ${text}`);
|
|
263787
263982
|
}
|
|
263788
263983
|
function packageManager(cwd) {
|
|
263789
|
-
if (
|
|
263790
|
-
if (
|
|
263791
|
-
if (
|
|
263792
|
-
if (
|
|
263793
|
-
if (
|
|
263984
|
+
if (existsSync12(join11(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
263985
|
+
if (existsSync12(join11(cwd, "yarn.lock"))) return "yarn";
|
|
263986
|
+
if (existsSync12(join11(cwd, "bun.lockb"))) return "bun";
|
|
263987
|
+
if (existsSync12(join11(cwd, "package-lock.json"))) return "npm";
|
|
263988
|
+
if (existsSync12(join11(cwd, "package.json"))) return "npm";
|
|
263794
263989
|
return "unknown";
|
|
263795
263990
|
}
|
|
263796
263991
|
function boolText(value) {
|
|
@@ -264054,7 +264249,7 @@ function buildDeepSeekDoctorSection(cwd, config) {
|
|
|
264054
264249
|
);
|
|
264055
264250
|
lines.push(
|
|
264056
264251
|
picocolors6.gray(
|
|
264057
|
-
`\u25CF Orbit 0731 policy: Flash=${config.agent?.fastMaxOutputTokens ??
|
|
264252
|
+
`\u25CF Orbit 0731 policy: Flash=${config.agent?.fastMaxOutputTokens ?? 32768} output tokens with thinking low for simple work, high for complex work, and max for repair; Pro=${config.agent?.maxOutputTokens ?? 16384} with thinking high/max.`
|
|
264058
264253
|
)
|
|
264059
264254
|
);
|
|
264060
264255
|
lines.push(
|
|
@@ -266103,7 +266298,7 @@ import picocolors20 from "picocolors";
|
|
|
266103
266298
|
// src/tui/FullscreenTui.ts
|
|
266104
266299
|
import { join as join13 } from "path";
|
|
266105
266300
|
import { homedir as homedir7 } from "os";
|
|
266106
|
-
import { existsSync as
|
|
266301
|
+
import { existsSync as existsSync13 } from "fs";
|
|
266107
266302
|
import { exec as exec3 } from "child_process";
|
|
266108
266303
|
import readline3 from "readline";
|
|
266109
266304
|
|
|
@@ -266688,9 +266883,9 @@ var SLASH_COMMAND_DEFINITIONS = [
|
|
|
266688
266883
|
{
|
|
266689
266884
|
value: "auto",
|
|
266690
266885
|
description: {
|
|
266691
|
-
en: "
|
|
266692
|
-
zh: "\
|
|
266693
|
-
"zh-TW": "\
|
|
266886
|
+
en: "Full access with dangerous-command, secret, and workspace guards",
|
|
266887
|
+
zh: "\u5168\u81EA\u52A8\u6267\u884C\uFF0C\u4FDD\u7559\u5371\u9669\u547D\u4EE4\u3001\u5BC6\u94A5\u548C\u5DE5\u4F5C\u533A\u4FDD\u62A4",
|
|
266888
|
+
"zh-TW": "\u5168\u81EA\u52D5\u57F7\u884C\uFF0C\u4FDD\u7559\u5371\u96AA\u547D\u4EE4\u3001\u5BC6\u9470\u548C\u5DE5\u4F5C\u5340\u4FDD\u8B77"
|
|
266694
266889
|
}
|
|
266695
266890
|
},
|
|
266696
266891
|
{
|
|
@@ -268105,9 +268300,9 @@ var FullscreenTui = class {
|
|
|
268105
268300
|
const planPath2 = join13(this.cwd, ".orbit", "task.md");
|
|
268106
268301
|
const planPath1 = join13(this.cwd, "task.md");
|
|
268107
268302
|
let planPath = "";
|
|
268108
|
-
if (
|
|
268303
|
+
if (existsSync13(planPath2)) {
|
|
268109
268304
|
planPath = planPath2;
|
|
268110
|
-
} else if (
|
|
268305
|
+
} else if (existsSync13(planPath1)) {
|
|
268111
268306
|
planPath = planPath1;
|
|
268112
268307
|
}
|
|
268113
268308
|
if (!planPath) {
|
|
@@ -270106,7 +270301,7 @@ import { z as z67 } from "zod";
|
|
|
270106
270301
|
import picocolors18 from "picocolors";
|
|
270107
270302
|
|
|
270108
270303
|
// src/commands/customCommands.ts
|
|
270109
|
-
import { existsSync as
|
|
270304
|
+
import { existsSync as existsSync14, readdirSync as readdirSync6 } from "fs";
|
|
270110
270305
|
import { basename as basename4, extname as extname2, join as join14 } from "path";
|
|
270111
270306
|
import { homedir as homedir8 } from "os";
|
|
270112
270307
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -270163,7 +270358,7 @@ function parseCommandFile(filePath, source) {
|
|
|
270163
270358
|
};
|
|
270164
270359
|
}
|
|
270165
270360
|
function loadDirectory(directory, source) {
|
|
270166
|
-
if (!
|
|
270361
|
+
if (!existsSync14(directory)) return [];
|
|
270167
270362
|
const commands = [];
|
|
270168
270363
|
const queue = [directory];
|
|
270169
270364
|
while (queue.length > 0 && commands.length < 200) {
|
|
@@ -270233,7 +270428,7 @@ function resolveBundledCommandsDirectory() {
|
|
|
270233
270428
|
new URL("../../commands/", import.meta.url),
|
|
270234
270429
|
new URL("../commands/", import.meta.url)
|
|
270235
270430
|
].map((candidate) => fileURLToPath3(candidate));
|
|
270236
|
-
return candidates.find((candidate) =>
|
|
270431
|
+
return candidates.find((candidate) => existsSync14(candidate)) ?? candidates[0];
|
|
270237
270432
|
}
|
|
270238
270433
|
function expandCustomCommand(command, rawArguments) {
|
|
270239
270434
|
const args = rawArguments.trim();
|
|
@@ -270323,7 +270518,7 @@ import { z as z56 } from "zod";
|
|
|
270323
270518
|
|
|
270324
270519
|
// src/runtime/AutocompleteCandidates.ts
|
|
270325
270520
|
import glob4 from "fast-glob";
|
|
270326
|
-
import { existsSync as
|
|
270521
|
+
import { existsSync as existsSync15, readdirSync as readdirSync7 } from "fs";
|
|
270327
270522
|
import { homedir as homedir9 } from "os";
|
|
270328
270523
|
import { dirname as dirname8, join as join15, resolve as resolve7 } from "path";
|
|
270329
270524
|
import { z as z51 } from "zod";
|
|
@@ -270386,7 +270581,7 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
270386
270581
|
}
|
|
270387
270582
|
try {
|
|
270388
270583
|
const indexPath = join15(cwd, ".orbit", "symbols.json");
|
|
270389
|
-
if (
|
|
270584
|
+
if (existsSync15(indexPath)) {
|
|
270390
270585
|
const raw = await readBoundedRegularFileAsync(
|
|
270391
270586
|
indexPath,
|
|
270392
270587
|
AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES
|
|
@@ -270408,9 +270603,9 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
270408
270603
|
cwd,
|
|
270409
270604
|
config.session?.path ?? ".orbit/sessions"
|
|
270410
270605
|
);
|
|
270411
|
-
if (
|
|
270606
|
+
if (existsSync15(sessionDir)) {
|
|
270412
270607
|
for (const dir of readdirSync7(sessionDir)) {
|
|
270413
|
-
if (
|
|
270608
|
+
if (existsSync15(join15(sessionDir, dir, "session.json"))) {
|
|
270414
270609
|
sessions.push(dir);
|
|
270415
270610
|
}
|
|
270416
270611
|
}
|
|
@@ -272180,8 +272375,15 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
272180
272375
|
collapseNavigation: '收起导航',
|
|
272181
272376
|
modeStrict: '严格',
|
|
272182
272377
|
modeNormal: '标准',
|
|
272183
|
-
modeAuto: '
|
|
272378
|
+
modeAuto: '全自动',
|
|
272184
272379
|
modePlan: '规划',
|
|
272380
|
+
permissionFullAccess: chinese('全自动已开启:写入、命令和联网工具无需逐次确认。', '全自動已開啟:寫入、命令和聯網工具無需逐次確認。'),
|
|
272381
|
+
permissionAutoLimited: chinese('全自动尚未完全生效,部分操作仍需确认。', '全自動尚未完全生效,部分操作仍需確認。'),
|
|
272382
|
+
permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
|
|
272383
|
+
permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
|
|
272384
|
+
permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
|
|
272385
|
+
permissionGuards: chinese('危险命令、密钥和工作区边界仍受保护。', '危險命令、密鑰和工作區邊界仍受保護。'),
|
|
272386
|
+
permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
|
|
272185
272387
|
}
|
|
272186
272388
|
: {
|
|
272187
272389
|
connected: 'Connected',
|
|
@@ -272317,8 +272519,15 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
272317
272519
|
collapseNavigation: 'Collapse navigation',
|
|
272318
272520
|
modeStrict: 'Strict',
|
|
272319
272521
|
modeNormal: 'Normal',
|
|
272320
|
-
modeAuto: '
|
|
272522
|
+
modeAuto: 'Full access',
|
|
272321
272523
|
modePlan: 'Plan',
|
|
272524
|
+
permissionFullAccess: 'Full access is on: writes, commands, and network tools run without per-action approval.',
|
|
272525
|
+
permissionAutoLimited: 'Full access is not fully active; some actions still require approval.',
|
|
272526
|
+
permissionStrict: 'Strict mode asks before consequential operations.',
|
|
272527
|
+
permissionNormal: 'Normal mode asks before writes and command execution.',
|
|
272528
|
+
permissionPlan: 'Plan mode analyzes and reads without changing files.',
|
|
272529
|
+
permissionGuards: 'Dangerous commands, secrets, and workspace boundaries stay protected.',
|
|
272530
|
+
permissionGuardsReduced: 'Warning: some hard safety guards are disabled in configuration.',
|
|
272322
272531
|
};
|
|
272323
272532
|
|
|
272324
272533
|
if (language === 'zh-TW') {
|
|
@@ -272517,6 +272726,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
272517
272726
|
customModel: byId('customModel'),
|
|
272518
272727
|
permissionSelect: byId('permissionSelect'),
|
|
272519
272728
|
permissionSegments: byId('permissionSegments'),
|
|
272729
|
+
permissionSummary: byId('permissionSummary'),
|
|
272520
272730
|
searchToggle: byId('searchToggle'),
|
|
272521
272731
|
searchEnabled: byId('searchEnabled'),
|
|
272522
272732
|
searchDependencies: byId('searchDependencies'),
|
|
@@ -275212,6 +275422,23 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
275212
275422
|
button.classList.toggle('is-active', active);
|
|
275213
275423
|
button.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
275214
275424
|
});
|
|
275425
|
+
const permissions = data.permissions || {};
|
|
275426
|
+
const modeSummary = mode === 'auto'
|
|
275427
|
+
? (permissions.fullAccess ? copy.permissionFullAccess : copy.permissionAutoLimited)
|
|
275428
|
+
: mode === 'strict'
|
|
275429
|
+
? copy.permissionStrict
|
|
275430
|
+
: mode === 'plan'
|
|
275431
|
+
? copy.permissionPlan
|
|
275432
|
+
: copy.permissionNormal;
|
|
275433
|
+
const hardGuardsEnabled = permissions.dangerousCommandsBlocked !== false
|
|
275434
|
+
&& permissions.secretsProtected !== false
|
|
275435
|
+
&& permissions.workspaceBoundary !== false;
|
|
275436
|
+
const permissionSummary = modeSummary + ' ' + (hardGuardsEnabled ? copy.permissionGuards : copy.permissionGuardsReduced);
|
|
275437
|
+
if (elements.permissionSummary.textContent !== permissionSummary) {
|
|
275438
|
+
elements.permissionSummary.textContent = permissionSummary;
|
|
275439
|
+
}
|
|
275440
|
+
elements.permissionSummary.classList.toggle('is-full-access', Boolean(permissions.fullAccess));
|
|
275441
|
+
elements.permissionSummary.classList.toggle('is-warning', !hardGuardsEnabled || (mode === 'auto' && !permissions.fullAccess));
|
|
275215
275442
|
const webSearch = data.tools && data.tools.webSearch || {};
|
|
275216
275443
|
elements.searchProvider.value = webSearch.provider || 'auto';
|
|
275217
275444
|
syncSelectControl(elements.searchProvider);
|
|
@@ -275773,8 +276000,9 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
275773
276000
|
} else if (['agent_start', 'agent_spawn', 'agent_status', 'agent_completed'].includes(event.type)) {
|
|
275774
276001
|
const agentId = payload.childId || payload.taskId || payload.role || 'agent';
|
|
275775
276002
|
const role = payload.role || payload.task || agentId;
|
|
275776
|
-
const
|
|
275777
|
-
const
|
|
276003
|
+
const paused = event.type === 'agent_completed' && payload.status === 'aborted';
|
|
276004
|
+
const status = paused ? 'paused' : (payload.status || (event.type === 'agent_completed' ? (payload.success ? copy.done : copy.error) : copy.running));
|
|
276005
|
+
const kind = event.type === 'agent_completed' ? (paused ? 'warning' : (payload.success ? 'success' : 'error')) : '';
|
|
275778
276006
|
addActivity(role + ' · ' + status, kind, 'agent-' + agentId);
|
|
275779
276007
|
void reconcileStatus();
|
|
275780
276008
|
} else if (['agent_input_queued', 'agent_input_consumed', 'agent_input_removed', 'agent_input_updated', 'agent_input_moved', 'agent_input_queue_cleared'].includes(event.type)) {
|
|
@@ -276280,9 +276508,13 @@ function sanitizeWebEventPayload(type, payload) {
|
|
|
276280
276508
|
case "agent_completed": {
|
|
276281
276509
|
const taskId = safeWebText(payload.taskId, 200);
|
|
276282
276510
|
if (!taskId) return void 0;
|
|
276511
|
+
const status = ["completed", "failed", "aborted"].includes(
|
|
276512
|
+
String(payload.status)
|
|
276513
|
+
) ? String(payload.status) : void 0;
|
|
276283
276514
|
return {
|
|
276284
276515
|
taskId,
|
|
276285
276516
|
success: payload.success === true,
|
|
276517
|
+
...status ? { status } : {},
|
|
276286
276518
|
error: safeWebText(payload.error, 1e3)
|
|
276287
276519
|
};
|
|
276288
276520
|
}
|
|
@@ -276726,7 +276958,15 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
276726
276958
|
modelSelection: modelOverride || "__auto__",
|
|
276727
276959
|
modelRouting: modelOverride ? "locked" : "auto",
|
|
276728
276960
|
modelOptions: buildModelOptions(options, activeModel2),
|
|
276729
|
-
permissions: {
|
|
276961
|
+
permissions: {
|
|
276962
|
+
mode: config.permissions.mode,
|
|
276963
|
+
fullAccess: isFullAccessEnabled(config),
|
|
276964
|
+
writeApproval: config.permissions.requireApprovalForWrite,
|
|
276965
|
+
commandApproval: config.permissions.requireApprovalForBash,
|
|
276966
|
+
dangerousCommandsBlocked: config.permissions.blockDangerousCommands,
|
|
276967
|
+
secretsProtected: config.permissions.protectSecrets,
|
|
276968
|
+
workspaceBoundary: true
|
|
276969
|
+
},
|
|
276730
276970
|
tools: {
|
|
276731
276971
|
webSearch: {
|
|
276732
276972
|
enabled: config.tools.webSearch.enabled,
|
|
@@ -277603,9 +277843,11 @@ var BASE_COPY = {
|
|
|
277603
277843
|
customModel: "Custom model ID",
|
|
277604
277844
|
apply: "Apply",
|
|
277605
277845
|
permission: "Permission mode",
|
|
277846
|
+
permissionDescription: "Choose how much Orbit may do without interrupting you.",
|
|
277847
|
+
permissionGuardLabel: "Dangerous commands, secrets, and workspace boundaries stay protected.",
|
|
277606
277848
|
modeStrict: "Strict",
|
|
277607
277849
|
modeNormal: "Normal",
|
|
277608
|
-
modeAuto: "
|
|
277850
|
+
modeAuto: "Full access",
|
|
277609
277851
|
modePlan: "Plan",
|
|
277610
277852
|
searchProvider: "Search provider",
|
|
277611
277853
|
searchResults: "Maximum results",
|
|
@@ -277776,9 +278018,11 @@ var BASE_COPY = {
|
|
|
277776
278018
|
customModel: "\u81EA\u5B9A\u4E49\u6A21\u578B ID",
|
|
277777
278019
|
apply: "\u5E94\u7528",
|
|
277778
278020
|
permission: "\u6743\u9650\u6A21\u5F0F",
|
|
278021
|
+
permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
278022
|
+
permissionGuardLabel: "\u5371\u9669\u547D\u4EE4\u3001\u5BC6\u94A5\u548C\u5DE5\u4F5C\u533A\u8FB9\u754C\u59CB\u7EC8\u53D7\u5230\u4FDD\u62A4\u3002",
|
|
277779
278023
|
modeStrict: "\u4E25\u683C",
|
|
277780
278024
|
modeNormal: "\u6807\u51C6",
|
|
277781
|
-
modeAuto: "\u81EA\u52A8",
|
|
278025
|
+
modeAuto: "\u5168\u81EA\u52A8",
|
|
277782
278026
|
modePlan: "\u89C4\u5212",
|
|
277783
278027
|
searchProvider: "\u641C\u7D22\u670D\u52A1",
|
|
277784
278028
|
searchResults: "\u6700\u5927\u7ED3\u679C\u6570",
|
|
@@ -277922,9 +278166,11 @@ var COPY = {
|
|
|
277922
278166
|
customModel: "\u81EA\u8A02\u6A21\u578B ID",
|
|
277923
278167
|
apply: "\u5957\u7528",
|
|
277924
278168
|
permission: "\u6B0A\u9650\u6A21\u5F0F",
|
|
278169
|
+
permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
278170
|
+
permissionGuardLabel: "\u5371\u96AA\u547D\u4EE4\u3001\u5BC6\u9470\u548C\u5DE5\u4F5C\u5340\u908A\u754C\u59CB\u7D42\u53D7\u5230\u4FDD\u8B77\u3002",
|
|
277925
278171
|
modeStrict: "\u56B4\u683C",
|
|
277926
278172
|
modeNormal: "\u6A19\u6E96",
|
|
277927
|
-
modeAuto: "\u81EA\u52D5",
|
|
278173
|
+
modeAuto: "\u5168\u81EA\u52D5",
|
|
277928
278174
|
modePlan: "\u898F\u5283",
|
|
277929
278175
|
searchProvider: "\u641C\u5C0B\u670D\u52D9",
|
|
277930
278176
|
searchResults: "\u6700\u5927\u7D50\u679C\u6578",
|
|
@@ -278395,13 +278641,16 @@ function renderWebUiPage(language) {
|
|
|
278395
278641
|
</div>
|
|
278396
278642
|
</section>
|
|
278397
278643
|
<section class="settings-group">
|
|
278398
|
-
<
|
|
278644
|
+
<div class="setting-row setting-row-stacked">
|
|
278645
|
+
<div><h3>${copy.permission}</h3><p>${copy.permissionDescription}</p></div>
|
|
278646
|
+
</div>
|
|
278399
278647
|
<div class="segmented" id="permissionSegments">
|
|
278400
278648
|
<button type="button" data-mode="strict" aria-pressed="false">${copy.modeStrict}</button>
|
|
278401
278649
|
<button type="button" data-mode="normal" aria-pressed="false">${copy.modeNormal}</button>
|
|
278402
278650
|
<button type="button" data-mode="auto" aria-pressed="false">${copy.modeAuto}</button>
|
|
278403
278651
|
<button type="button" data-mode="plan" aria-pressed="false">${copy.modePlan}</button>
|
|
278404
278652
|
</div>
|
|
278653
|
+
<p class="permission-summary" id="permissionSummary" role="status" aria-live="polite">${copy.permissionGuardLabel}</p>
|
|
278405
278654
|
</section>
|
|
278406
278655
|
<section class="settings-group">
|
|
278407
278656
|
<div class="setting-row">
|
|
@@ -282536,6 +282785,29 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
|
|
|
282536
282785
|
font-weight: 650;
|
|
282537
282786
|
}
|
|
282538
282787
|
|
|
282788
|
+
.permission-summary {
|
|
282789
|
+
margin: 0;
|
|
282790
|
+
padding: 9px 10px;
|
|
282791
|
+
color: var(--muted);
|
|
282792
|
+
background: var(--surface-subtle);
|
|
282793
|
+
border: 1px solid var(--border);
|
|
282794
|
+
border-radius: 9px;
|
|
282795
|
+
font-size: 10px;
|
|
282796
|
+
line-height: 1.55;
|
|
282797
|
+
}
|
|
282798
|
+
|
|
282799
|
+
.permission-summary.is-full-access {
|
|
282800
|
+
color: var(--ink-strong);
|
|
282801
|
+
background: color-mix(in srgb, var(--success) 8%, var(--surface-subtle));
|
|
282802
|
+
border-color: color-mix(in srgb, var(--success) 32%, var(--border));
|
|
282803
|
+
}
|
|
282804
|
+
|
|
282805
|
+
.permission-summary.is-warning {
|
|
282806
|
+
color: var(--warning);
|
|
282807
|
+
background: color-mix(in srgb, var(--warning) 8%, var(--surface-subtle));
|
|
282808
|
+
border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
|
|
282809
|
+
}
|
|
282810
|
+
|
|
282539
282811
|
.switch {
|
|
282540
282812
|
position: relative;
|
|
282541
282813
|
width: 34px;
|
|
@@ -286449,7 +286721,7 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
286449
286721
|
|
|
286450
286722
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
286451
286723
|
import glob5 from "fast-glob";
|
|
286452
|
-
import { existsSync as
|
|
286724
|
+
import { existsSync as existsSync16, statSync as statSync3 } from "fs";
|
|
286453
286725
|
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve10 } from "path";
|
|
286454
286726
|
import picocolors12 from "picocolors";
|
|
286455
286727
|
function parseAddArgument(argument) {
|
|
@@ -286599,7 +286871,7 @@ async function handleAdd(argument, dependencies) {
|
|
|
286599
286871
|
);
|
|
286600
286872
|
return HANDLED_COMMAND;
|
|
286601
286873
|
}
|
|
286602
|
-
if (!
|
|
286874
|
+
if (!existsSync16(absolutePath)) {
|
|
286603
286875
|
const normalizedArgument = fileArgument.toLowerCase();
|
|
286604
286876
|
const matched = candidates.filter(
|
|
286605
286877
|
(file) => file.toLowerCase().includes(normalizedArgument) || file.toLowerCase().endsWith(`/${normalizedArgument}`)
|
|
@@ -286802,7 +287074,7 @@ async function handleContextCommand(command, argument, dependencies) {
|
|
|
286802
287074
|
|
|
286803
287075
|
// src/runtime/commands/RollbackCommandHandler.ts
|
|
286804
287076
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
286805
|
-
import { existsSync as
|
|
287077
|
+
import { existsSync as existsSync17, rmSync as rmSync5 } from "fs";
|
|
286806
287078
|
import picocolors13 from "picocolors";
|
|
286807
287079
|
import { z as z57 } from "zod";
|
|
286808
287080
|
var GitStatusCodeSchema = z57.string().length(2).regex(/^[ MADRCU?!]{2}$/);
|
|
@@ -286912,7 +287184,7 @@ async function handleRollbackCommand(command, argument, dependencies) {
|
|
|
286912
287184
|
try {
|
|
286913
287185
|
git.checkout(dependencies.cwd, filePath);
|
|
286914
287186
|
} catch {
|
|
286915
|
-
if (
|
|
287187
|
+
if (existsSync17(absolutePath)) {
|
|
286916
287188
|
(dependencies.removePath ?? removeWorkspacePath)(absolutePath);
|
|
286917
287189
|
}
|
|
286918
287190
|
}
|
|
@@ -287637,7 +287909,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
287637
287909
|
|
|
287638
287910
|
// src/runtime/ProjectLauncher.ts
|
|
287639
287911
|
import { spawn as spawn3 } from "child_process";
|
|
287640
|
-
import { existsSync as
|
|
287912
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync6, realpathSync as realpathSync3, statSync as statSync4 } from "fs";
|
|
287641
287913
|
import { dirname as dirname9, isAbsolute as isAbsolute7, parse as parse4, resolve as resolve11 } from "path";
|
|
287642
287914
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
287643
287915
|
async function launchOrbitProject(request, options = {}) {
|
|
@@ -287728,11 +288000,11 @@ function parseReadyUrl(message2) {
|
|
|
287728
288000
|
return sanitizeLocalWebUiUrl(message2.url);
|
|
287729
288001
|
}
|
|
287730
288002
|
function createProjectDirectory(projectPath) {
|
|
287731
|
-
if (
|
|
288003
|
+
if (existsSync18(projectPath)) {
|
|
287732
288004
|
throw new Error("Project folder already exists. Use Open folder instead.");
|
|
287733
288005
|
}
|
|
287734
288006
|
const parentPath = dirname9(projectPath);
|
|
287735
|
-
if (!
|
|
288007
|
+
if (!existsSync18(parentPath)) {
|
|
287736
288008
|
throw new Error(
|
|
287737
288009
|
"The parent folder does not exist. Choose an existing location first."
|
|
287738
288010
|
);
|
|
@@ -287754,7 +288026,7 @@ function createProjectDirectory(projectPath) {
|
|
|
287754
288026
|
}
|
|
287755
288027
|
}
|
|
287756
288028
|
function requireProjectDirectory(projectPath) {
|
|
287757
|
-
if (!
|
|
288029
|
+
if (!existsSync18(projectPath)) {
|
|
287758
288030
|
throw new Error("Project folder does not exist.");
|
|
287759
288031
|
}
|
|
287760
288032
|
if (!statSync4(projectPath).isDirectory()) {
|
|
@@ -289426,12 +289698,12 @@ ${diff.substring(0, 2e4)}`
|
|
|
289426
289698
|
const modeDescriptions = isZh ? {
|
|
289427
289699
|
strict: "Strict \u2014 \u6240\u6709\u5DE5\u5177\u8C03\u7528\u5FC5\u987B\u9010\u4E00\u786E\u8BA4",
|
|
289428
289700
|
normal: "Normal \u2014 \u5199\u5165/\u6267\u884C\u64CD\u4F5C\u9700\u8981\u786E\u8BA4",
|
|
289429
|
-
auto: "
|
|
289701
|
+
auto: "Full Access \u2014 \u81EA\u52A8\u5199\u5165\u3001\u6267\u884C\u4E0E\u8054\u7F51\uFF0C\u4FDD\u7559\u786C\u5B89\u5168\u4FDD\u62A4",
|
|
289430
289702
|
plan: "Plan \u2014 \u89C4\u5212\u6A21\u5F0F\uFF0C\u65E0\u5B9E\u9645\u6587\u4EF6\u4FEE\u6539"
|
|
289431
289703
|
} : {
|
|
289432
289704
|
strict: "Strict \u2014 Confirm every tool call before execution",
|
|
289433
289705
|
normal: "Normal \u2014 Confirm write/exec operations only",
|
|
289434
|
-
auto: "
|
|
289706
|
+
auto: "Full Access \u2014 Auto write, execute, and network with hard guards",
|
|
289435
289707
|
plan: "Plan \u2014 Planning mode, no actual file changes"
|
|
289436
289708
|
};
|
|
289437
289709
|
if (!targetMode) {
|
|
@@ -289447,15 +289719,18 @@ Select a security mode:`;
|
|
|
289447
289719
|
{ value: "auto", label: modeDescriptions.auto },
|
|
289448
289720
|
{ value: "plan", label: modeDescriptions.plan }
|
|
289449
289721
|
]);
|
|
289450
|
-
if (choice
|
|
289451
|
-
const
|
|
289452
|
-
|
|
289453
|
-
|
|
289454
|
-
|
|
289455
|
-
|
|
289722
|
+
if (choice) {
|
|
289723
|
+
const result2 = applyPermissionModePreset(
|
|
289724
|
+
loop.getConfig(),
|
|
289725
|
+
choice
|
|
289726
|
+
);
|
|
289727
|
+
if (!result2.ok) {
|
|
289728
|
+
this.printOutput(picocolors18.red(`\u2716 ${result2.message}`));
|
|
289456
289729
|
return { shouldExit: false, processed: true };
|
|
289457
289730
|
}
|
|
289458
|
-
|
|
289731
|
+
this.saveLocalState({
|
|
289732
|
+
permissionMode: choice
|
|
289733
|
+
});
|
|
289459
289734
|
tui.syncFromLoop(loop);
|
|
289460
289735
|
}
|
|
289461
289736
|
} else {
|
|
@@ -289476,14 +289751,17 @@ Select a security mode:`;
|
|
|
289476
289751
|
);
|
|
289477
289752
|
return { shouldExit: false, processed: true };
|
|
289478
289753
|
}
|
|
289479
|
-
const
|
|
289480
|
-
|
|
289481
|
-
|
|
289482
|
-
|
|
289483
|
-
|
|
289754
|
+
const result = applyPermissionModePreset(
|
|
289755
|
+
loop.getConfig(),
|
|
289756
|
+
targetMode
|
|
289757
|
+
);
|
|
289758
|
+
if (!result.ok) {
|
|
289759
|
+
this.printOutput(picocolors18.red(`\u2716 ${result.message}`));
|
|
289484
289760
|
return { shouldExit: false, processed: true };
|
|
289485
289761
|
}
|
|
289486
|
-
|
|
289762
|
+
this.saveLocalState({
|
|
289763
|
+
permissionMode: targetMode
|
|
289764
|
+
});
|
|
289487
289765
|
tui.syncFromLoop(loop);
|
|
289488
289766
|
if (useFullscreenTui && tui.isActive) {
|
|
289489
289767
|
const msg = isZh ? `\u5F53\u524D\u6A21\u5F0F: ${picocolors18.cyan(currentMode.toUpperCase())}
|
|
@@ -289554,7 +289832,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
289554
289832
|
);
|
|
289555
289833
|
return { shouldExit: false, processed: true };
|
|
289556
289834
|
}
|
|
289557
|
-
return { shouldExit: false, processed: false };
|
|
289835
|
+
return { shouldExit: false, processed: false, input: trimmed };
|
|
289558
289836
|
}
|
|
289559
289837
|
async submitWebPrompt(prompt, attachments = [], executionMode = "default") {
|
|
289560
289838
|
const trimmed = prompt.trim();
|
|
@@ -289596,13 +289874,14 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
289596
289874
|
if (routeResult.processed) {
|
|
289597
289875
|
return { ok: true };
|
|
289598
289876
|
}
|
|
289877
|
+
const routedPrompt = routeResult.input ?? trimmed;
|
|
289599
289878
|
if (this.tui.isActive) {
|
|
289600
289879
|
this.tui.addUserMessage(trimmed);
|
|
289601
289880
|
} else {
|
|
289602
289881
|
console.log(picocolors18.cyan(`web \u203A ${trimmed}`));
|
|
289603
289882
|
}
|
|
289604
289883
|
this.loop.prepareUserTurn(
|
|
289605
|
-
|
|
289884
|
+
routedPrompt,
|
|
289606
289885
|
attachments.map((attachment) => ({
|
|
289607
289886
|
type: "image",
|
|
289608
289887
|
mediaType: attachment.mediaType,
|
|
@@ -289624,7 +289903,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
289624
289903
|
this.cwd,
|
|
289625
289904
|
this.config,
|
|
289626
289905
|
this.providerInstance,
|
|
289627
|
-
|
|
289906
|
+
routedPrompt,
|
|
289628
289907
|
webInteraction
|
|
289629
289908
|
);
|
|
289630
289909
|
}
|
|
@@ -289855,7 +290134,8 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
289855
290134
|
draft.provider.default = patch.provider;
|
|
289856
290135
|
}
|
|
289857
290136
|
if (patch.permissionMode) {
|
|
289858
|
-
|
|
290137
|
+
const preset = applyPermissionModePreset(draft, patch.permissionMode);
|
|
290138
|
+
if (!preset.ok) return preset;
|
|
289859
290139
|
}
|
|
289860
290140
|
if (typeof patch.webSearchEnabled === "boolean") {
|
|
289861
290141
|
draft.tools.webSearch.enabled = patch.webSearchEnabled;
|
|
@@ -289907,8 +290187,13 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
289907
290187
|
this.saveLocalState({ language: patch.language });
|
|
289908
290188
|
}
|
|
289909
290189
|
if (patch.permissionMode) {
|
|
289910
|
-
|
|
290190
|
+
const preset = applyPermissionModePreset(
|
|
290191
|
+
this.config,
|
|
290192
|
+
patch.permissionMode
|
|
290193
|
+
);
|
|
290194
|
+
if (!preset.ok) return preset;
|
|
289911
290195
|
this.tui.setPermissionsMode(patch.permissionMode);
|
|
290196
|
+
this.saveLocalState({ permissionMode: patch.permissionMode });
|
|
289912
290197
|
}
|
|
289913
290198
|
if (typeof patch.webSearchEnabled === "boolean") {
|
|
289914
290199
|
this.config.tools.webSearch.enabled = patch.webSearchEnabled;
|
|
@@ -290180,6 +290465,7 @@ var LocalRuntimeStateSchema = z66.object({
|
|
|
290180
290465
|
lastProvider: z66.string().min(1).max(256).optional(),
|
|
290181
290466
|
lastModel: z66.string().max(512).optional(),
|
|
290182
290467
|
language: OrbitLanguageSchema.optional(),
|
|
290468
|
+
permissionMode: z66.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
290183
290469
|
skills: LocalSkillsStateSchema.optional()
|
|
290184
290470
|
});
|
|
290185
290471
|
function readLocalRuntimeState(cwd) {
|
|
@@ -290469,7 +290755,8 @@ Risk Warning: ${reason}`);
|
|
|
290469
290755
|
tuiInteraction,
|
|
290470
290756
|
{
|
|
290471
290757
|
disableStatusBar: useFullscreenTui,
|
|
290472
|
-
sessionId: resumeSessionId
|
|
290758
|
+
sessionId: resumeSessionId,
|
|
290759
|
+
autoContinueRunaway: isFullAccessEnabled(this.config)
|
|
290473
290760
|
}
|
|
290474
290761
|
);
|
|
290475
290762
|
tui.setActiveInputHandler((submitted) => {
|
|
@@ -290744,7 +291031,8 @@ Risk Warning: ${reason}`);
|
|
|
290744
291031
|
if (routeResult.processed) {
|
|
290745
291032
|
continue;
|
|
290746
291033
|
}
|
|
290747
|
-
|
|
291034
|
+
const routedInput = routeResult.input ?? trimmed;
|
|
291035
|
+
loop.prepareUserTurn(routedInput);
|
|
290748
291036
|
const terminalTurnId = randomUUID11();
|
|
290749
291037
|
eventBus.emitEvent("ui_turn_started", {
|
|
290750
291038
|
turnId: terminalTurnId,
|
|
@@ -290758,7 +291046,7 @@ Risk Warning: ${reason}`);
|
|
|
290758
291046
|
this.cwd,
|
|
290759
291047
|
this.config,
|
|
290760
291048
|
this.providerInstance,
|
|
290761
|
-
|
|
291049
|
+
routedInput,
|
|
290762
291050
|
tuiInteraction
|
|
290763
291051
|
);
|
|
290764
291052
|
tui.setActiveRunnable(orchestratorInstance);
|
|
@@ -290943,6 +291231,13 @@ function shouldUseStoredModel(cliOverrides) {
|
|
|
290943
291231
|
function shouldUseStoredProvider(cliOverrides) {
|
|
290944
291232
|
return getExplicitProviderOverride(cliOverrides) === void 0;
|
|
290945
291233
|
}
|
|
291234
|
+
function shouldUseStoredPermissionMode(cliOverrides) {
|
|
291235
|
+
if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
|
|
291236
|
+
return true;
|
|
291237
|
+
}
|
|
291238
|
+
const permissions = cliOverrides.permissions;
|
|
291239
|
+
return !(typeof permissions === "object" && permissions !== null && !Array.isArray(permissions) && typeof permissions.mode === "string");
|
|
291240
|
+
}
|
|
290946
291241
|
function getExplicitModelOverride(cliOverrides) {
|
|
290947
291242
|
if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
|
|
290948
291243
|
return void 0;
|
|
@@ -290977,6 +291272,9 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
|
|
|
290977
291272
|
if (shouldUseStoredModel(cliOverrides) && storedModelMatchesProvider && localState.lastModel) {
|
|
290978
291273
|
config.models.default = localState.lastModel;
|
|
290979
291274
|
}
|
|
291275
|
+
if (shouldUseStoredPermissionMode(cliOverrides) && localState.permissionMode) {
|
|
291276
|
+
applyPermissionModePreset(config, localState.permissionMode);
|
|
291277
|
+
}
|
|
290980
291278
|
}
|
|
290981
291279
|
async function runAgent(cwd, task, cliOverrides, multi, options) {
|
|
290982
291280
|
const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
|
|
@@ -291112,7 +291410,7 @@ Risk Warning: ${reason}`);
|
|
|
291112
291410
|
requireSession: Boolean(options?.resumeSessionId),
|
|
291113
291411
|
disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
|
|
291114
291412
|
nonInteractive: !!options?.nonInteractive,
|
|
291115
|
-
autoContinueRunaway: !!options?.autoContinueRunaway
|
|
291413
|
+
autoContinueRunaway: !!options?.autoContinueRunaway || isFullAccessEnabled(config)
|
|
291116
291414
|
}
|
|
291117
291415
|
);
|
|
291118
291416
|
return await loop.run();
|
|
@@ -292019,7 +292317,7 @@ async function runSkillsCommand(action, options = {}) {
|
|
|
292019
292317
|
|
|
292020
292318
|
// src/commands/trace.ts
|
|
292021
292319
|
import {
|
|
292022
|
-
existsSync as
|
|
292320
|
+
existsSync as existsSync19,
|
|
292023
292321
|
lstatSync as lstatSync6,
|
|
292024
292322
|
mkdirSync as mkdirSync7,
|
|
292025
292323
|
renameSync as renameSync4,
|
|
@@ -292047,7 +292345,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
292047
292345
|
}
|
|
292048
292346
|
const outputPath = resolveSafePath(cwd, value.out);
|
|
292049
292347
|
const directory = dirname11(outputPath);
|
|
292050
|
-
if (
|
|
292348
|
+
if (existsSync19(directory)) {
|
|
292051
292349
|
const stats = lstatSync6(directory);
|
|
292052
292350
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
292053
292351
|
throw new Error("Trace output directory must be a real directory.");
|
|
@@ -292062,7 +292360,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
292062
292360
|
flag: "wx",
|
|
292063
292361
|
mode: 384
|
|
292064
292362
|
});
|
|
292065
|
-
if (
|
|
292363
|
+
if (existsSync19(outputPath)) rmSync7(outputPath, { force: true });
|
|
292066
292364
|
renameSync4(temporaryPath, outputPath);
|
|
292067
292365
|
} finally {
|
|
292068
292366
|
rmSync7(temporaryPath, { force: true });
|
|
@@ -292074,7 +292372,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
292074
292372
|
import { exec as execCallback, execFileSync as execFileSync7 } from "child_process";
|
|
292075
292373
|
import {
|
|
292076
292374
|
copyFileSync,
|
|
292077
|
-
existsSync as
|
|
292375
|
+
existsSync as existsSync20,
|
|
292078
292376
|
lstatSync as lstatSync7,
|
|
292079
292377
|
mkdirSync as mkdirSync8,
|
|
292080
292378
|
renameSync as renameSync5,
|
|
@@ -292413,7 +292711,7 @@ function writeEvaluationReport(cwd, runId, report) {
|
|
|
292413
292711
|
}
|
|
292414
292712
|
function writeJsonAtomically2(filePath, value) {
|
|
292415
292713
|
const directory = dirname12(filePath);
|
|
292416
|
-
if (
|
|
292714
|
+
if (existsSync20(directory)) {
|
|
292417
292715
|
const stats = lstatSync7(directory);
|
|
292418
292716
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
292419
292717
|
throw new Error("Evaluation output directory must be a real directory.");
|
|
@@ -292428,7 +292726,7 @@ function writeJsonAtomically2(filePath, value) {
|
|
|
292428
292726
|
flag: "wx",
|
|
292429
292727
|
mode: 384
|
|
292430
292728
|
});
|
|
292431
|
-
if (
|
|
292729
|
+
if (existsSync20(filePath)) rmSync8(filePath, { force: true });
|
|
292432
292730
|
renameSync5(temporaryPath, filePath);
|
|
292433
292731
|
} finally {
|
|
292434
292732
|
rmSync8(temporaryPath, { force: true });
|
|
@@ -292699,7 +292997,7 @@ import { z as z76 } from "zod";
|
|
|
292699
292997
|
|
|
292700
292998
|
// src/runtime/ProjectBackup.ts
|
|
292701
292999
|
import {
|
|
292702
|
-
existsSync as
|
|
293000
|
+
existsSync as existsSync21,
|
|
292703
293001
|
lstatSync as lstatSync9,
|
|
292704
293002
|
mkdirSync as mkdirSync9,
|
|
292705
293003
|
readdirSync as readdirSync9,
|
|
@@ -292775,7 +293073,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
292775
293073
|
const orbitRoot = join19(projectRoot, ".orbit");
|
|
292776
293074
|
const files = [];
|
|
292777
293075
|
let totalBytes = 0;
|
|
292778
|
-
if (
|
|
293076
|
+
if (existsSync21(orbitRoot)) {
|
|
292779
293077
|
for (const absolutePath of listBackupFiles(orbitRoot)) {
|
|
292780
293078
|
if (files.length >= MAX_BACKUP_FILES) {
|
|
292781
293079
|
throw new Error(`Project backup exceeds ${MAX_BACKUP_FILES} files.`);
|
|
@@ -292854,7 +293152,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
292854
293152
|
file,
|
|
292855
293153
|
destination: resolveBackupDestination(orbitRoot, file.path)
|
|
292856
293154
|
}));
|
|
292857
|
-
const conflicts2 = planned.filter(({ destination }) =>
|
|
293155
|
+
const conflicts2 = planned.filter(({ destination }) => existsSync21(destination)).map(({ file }) => file.path);
|
|
292858
293156
|
if (conflicts2.length > 0 && !options.force) {
|
|
292859
293157
|
throw new Error(
|
|
292860
293158
|
`Restore would overwrite ${conflicts2.length} file(s). Re-run with --force after reviewing the backup.`
|
|
@@ -292941,18 +293239,18 @@ function assertDirectoryChainHasNoSymlink(root, target) {
|
|
|
292941
293239
|
throw new Error("Backup restore directory escapes the project.");
|
|
292942
293240
|
}
|
|
292943
293241
|
let current = absoluteRoot;
|
|
292944
|
-
if (
|
|
293242
|
+
if (existsSync21(current) && lstatSync9(current).isSymbolicLink()) {
|
|
292945
293243
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
292946
293244
|
}
|
|
292947
293245
|
for (const part of relativeTarget.split(sep2).filter(Boolean)) {
|
|
292948
293246
|
current = join19(current, part);
|
|
292949
|
-
if (
|
|
293247
|
+
if (existsSync21(current) && lstatSync9(current).isSymbolicLink()) {
|
|
292950
293248
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
292951
293249
|
}
|
|
292952
293250
|
}
|
|
292953
293251
|
}
|
|
292954
293252
|
function replaceFileAtomically2(temporaryPath, destination) {
|
|
292955
|
-
if (!
|
|
293253
|
+
if (!existsSync21(destination)) {
|
|
292956
293254
|
renameSync6(temporaryPath, destination);
|
|
292957
293255
|
return;
|
|
292958
293256
|
}
|
|
@@ -292962,7 +293260,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
292962
293260
|
renameSync6(temporaryPath, destination);
|
|
292963
293261
|
rmSync10(previousPath, { force: true });
|
|
292964
293262
|
} catch (error) {
|
|
292965
|
-
if (!
|
|
293263
|
+
if (!existsSync21(destination) && existsSync21(previousPath)) {
|
|
292966
293264
|
renameSync6(previousPath, destination);
|
|
292967
293265
|
}
|
|
292968
293266
|
throw error;
|
|
@@ -293074,7 +293372,7 @@ import picocolors28 from "picocolors";
|
|
|
293074
293372
|
|
|
293075
293373
|
// src/runtime/ExtensionManager.ts
|
|
293076
293374
|
import {
|
|
293077
|
-
existsSync as
|
|
293375
|
+
existsSync as existsSync28,
|
|
293078
293376
|
lstatSync as lstatSync10,
|
|
293079
293377
|
mkdirSync as mkdirSync10,
|
|
293080
293378
|
readdirSync as readdirSync10,
|
|
@@ -293113,7 +293411,7 @@ var ExtensionManager = class {
|
|
|
293113
293411
|
list() {
|
|
293114
293412
|
try {
|
|
293115
293413
|
return this.readRegistry().filter(
|
|
293116
|
-
(extension) => this.isManagedExtensionPath(extension) &&
|
|
293414
|
+
(extension) => this.isManagedExtensionPath(extension) && existsSync28(extension.path) && !lstatSync10(extension.path).isSymbolicLink()
|
|
293117
293415
|
);
|
|
293118
293416
|
} catch {
|
|
293119
293417
|
return [];
|
|
@@ -293166,12 +293464,12 @@ var ExtensionManager = class {
|
|
|
293166
293464
|
try {
|
|
293167
293465
|
copyDirectorySafely(sourceRoot, staging);
|
|
293168
293466
|
const digest = hashExtensionDirectory(staging);
|
|
293169
|
-
if (
|
|
293467
|
+
if (existsSync28(target)) {
|
|
293170
293468
|
renameSync7(target, targetBackup);
|
|
293171
293469
|
targetBackedUp = true;
|
|
293172
293470
|
}
|
|
293173
293471
|
for (const prompt of promptTargets) {
|
|
293174
|
-
if (!
|
|
293472
|
+
if (!existsSync28(prompt.target)) continue;
|
|
293175
293473
|
mkdirSync10(dirname14(prompt.backup), { recursive: true });
|
|
293176
293474
|
renameSync7(prompt.target, prompt.backup);
|
|
293177
293475
|
prompt.backedUp = true;
|
|
@@ -293207,14 +293505,14 @@ var ExtensionManager = class {
|
|
|
293207
293505
|
if (targetInstalled) {
|
|
293208
293506
|
rmSync11(target, { recursive: true, force: true });
|
|
293209
293507
|
}
|
|
293210
|
-
if (targetBackedUp &&
|
|
293508
|
+
if (targetBackedUp && existsSync28(targetBackup)) {
|
|
293211
293509
|
renameSync7(targetBackup, target);
|
|
293212
293510
|
}
|
|
293213
293511
|
for (const prompt of promptTargets) {
|
|
293214
293512
|
if (promptMutationStarted) {
|
|
293215
293513
|
rmSync11(prompt.target, { recursive: true, force: true });
|
|
293216
293514
|
}
|
|
293217
|
-
if (prompt.backedUp &&
|
|
293515
|
+
if (prompt.backedUp && existsSync28(prompt.backup)) {
|
|
293218
293516
|
mkdirSync10(dirname14(prompt.target), { recursive: true });
|
|
293219
293517
|
renameSync7(prompt.backup, prompt.target);
|
|
293220
293518
|
}
|
|
@@ -293242,7 +293540,7 @@ var ExtensionManager = class {
|
|
|
293242
293540
|
);
|
|
293243
293541
|
}
|
|
293244
293542
|
const installed = registry.find(
|
|
293245
|
-
(entry) => entry.id === id &&
|
|
293543
|
+
(entry) => entry.id === id && existsSync28(entry.path) && !lstatSync10(entry.path).isSymbolicLink()
|
|
293246
293544
|
);
|
|
293247
293545
|
if (!installed) return false;
|
|
293248
293546
|
const rollbackRoot = join20(
|
|
@@ -293262,7 +293560,7 @@ var ExtensionManager = class {
|
|
|
293262
293560
|
].map((entry) => ({ ...entry, backedUp: false }));
|
|
293263
293561
|
try {
|
|
293264
293562
|
for (const entry of targets) {
|
|
293265
|
-
if (!
|
|
293563
|
+
if (!existsSync28(entry.target)) continue;
|
|
293266
293564
|
mkdirSync10(dirname14(entry.backup), { recursive: true });
|
|
293267
293565
|
renameSync7(entry.target, entry.backup);
|
|
293268
293566
|
entry.backedUp = true;
|
|
@@ -293273,7 +293571,7 @@ var ExtensionManager = class {
|
|
|
293273
293571
|
} catch (error) {
|
|
293274
293572
|
try {
|
|
293275
293573
|
for (const entry of targets) {
|
|
293276
|
-
if (!entry.backedUp || !
|
|
293574
|
+
if (!entry.backedUp || !existsSync28(entry.backup)) continue;
|
|
293277
293575
|
mkdirSync10(dirname14(entry.target), { recursive: true });
|
|
293278
293576
|
renameSync7(entry.backup, entry.target);
|
|
293279
293577
|
}
|
|
@@ -293402,7 +293700,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
293402
293700
|
`Invalid extension contribution path: ${contribution.path}`
|
|
293403
293701
|
);
|
|
293404
293702
|
}
|
|
293405
|
-
if (!
|
|
293703
|
+
if (!existsSync28(target) || lstatSync10(target).isSymbolicLink()) {
|
|
293406
293704
|
throw new Error(
|
|
293407
293705
|
`Extension contribution is missing or unsafe: ${contribution.path}`
|
|
293408
293706
|
);
|
|
@@ -293553,15 +293851,11 @@ function removeExtension(id) {
|
|
|
293553
293851
|
}
|
|
293554
293852
|
|
|
293555
293853
|
// src/index.ts
|
|
293556
|
-
import { existsSync as
|
|
293854
|
+
import { existsSync as existsSync29, realpathSync as realpathSync4, statSync as statSync5 } from "fs";
|
|
293557
293855
|
import { resolve as resolve19 } from "path";
|
|
293558
|
-
|
|
293559
|
-
|
|
293560
|
-
|
|
293561
|
-
process.exitCode = Math.max(currentExitCode, exitCodeForOutcome(outcome));
|
|
293562
|
-
}
|
|
293563
|
-
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) => {
|
|
293564
|
-
const cwd = process.cwd();
|
|
293856
|
+
|
|
293857
|
+
// src/runtime/CliRunOverrides.ts
|
|
293858
|
+
function createCliRunOverrides(options) {
|
|
293565
293859
|
const overrides = {};
|
|
293566
293860
|
if (options.provider) {
|
|
293567
293861
|
overrides.provider = { default: options.provider };
|
|
@@ -293572,9 +293866,29 @@ program.name("orbit").description("Orbit - Local AI Coding Agent Runtime").versi
|
|
|
293572
293866
|
if (options.direct) {
|
|
293573
293867
|
overrides.direct = true;
|
|
293574
293868
|
}
|
|
293575
|
-
if (options.
|
|
293576
|
-
overrides.permissions =
|
|
293869
|
+
if (options.fullAccess) {
|
|
293870
|
+
overrides.permissions = createPermissionModeOverride("auto").permissions;
|
|
293577
293871
|
}
|
|
293872
|
+
return overrides;
|
|
293873
|
+
}
|
|
293874
|
+
|
|
293875
|
+
// src/index.ts
|
|
293876
|
+
var program = new Command();
|
|
293877
|
+
function applyOutcomeExitCode(outcome) {
|
|
293878
|
+
const currentExitCode = typeof process.exitCode === "number" ? process.exitCode : 0;
|
|
293879
|
+
process.exitCode = Math.max(currentExitCode, exitCodeForOutcome(outcome));
|
|
293880
|
+
}
|
|
293881
|
+
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(
|
|
293882
|
+
"--yes",
|
|
293883
|
+
"enable guarded Full Access for this run (dangerous commands and secrets stay protected)"
|
|
293884
|
+
).option("--multi", "run in multi-agent planning/coding/review mode").option("--direct", "run interactive REPL in direct console streaming mode").action(async (task, options) => {
|
|
293885
|
+
const cwd = process.cwd();
|
|
293886
|
+
const overrides = createCliRunOverrides({
|
|
293887
|
+
provider: options.provider,
|
|
293888
|
+
model: options.model,
|
|
293889
|
+
direct: !!options.direct,
|
|
293890
|
+
fullAccess: !!options.yes
|
|
293891
|
+
});
|
|
293578
293892
|
const outcome = await runAgent(cwd, task, overrides, !!options.multi);
|
|
293579
293893
|
applyOutcomeExitCode(outcome);
|
|
293580
293894
|
});
|
|
@@ -293760,18 +294074,14 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
293760
294074
|
if (port !== void 0 && (!Number.isInteger(port) || port < 0 || port > 65535)) {
|
|
293761
294075
|
throw new Error("Web UI port must be an integer from 0 to 65535.");
|
|
293762
294076
|
}
|
|
293763
|
-
const overrides = {
|
|
293764
|
-
|
|
293765
|
-
|
|
293766
|
-
|
|
293767
|
-
|
|
293768
|
-
|
|
293769
|
-
}
|
|
293770
|
-
if (options.yes) {
|
|
293771
|
-
overrides.permissions = { mode: "auto" };
|
|
293772
|
-
}
|
|
294077
|
+
const overrides = createCliRunOverrides({
|
|
294078
|
+
provider: options.provider,
|
|
294079
|
+
model: options.model,
|
|
294080
|
+
direct: true,
|
|
294081
|
+
fullAccess: !!options.yes
|
|
294082
|
+
});
|
|
293773
294083
|
const requestedCwd = resolve19(localOptions.cwd || process.cwd());
|
|
293774
|
-
if (!
|
|
294084
|
+
if (!existsSync29(requestedCwd) || !statSync5(requestedCwd).isDirectory()) {
|
|
293775
294085
|
throw new Error(
|
|
293776
294086
|
`Web UI project directory does not exist: ${requestedCwd}`
|
|
293777
294087
|
);
|
|
@@ -293785,13 +294095,11 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
293785
294095
|
program.command("exec").description("run a task in non-interactive mode and stream events as JSONL").argument("<prompt>", "the task prompt to execute").option("--provider <provider>", "specify model provider").option("--model <model>", "specify model name").option("--resume <session>", "resume a persisted Orbit session").option("--jsonl", "output event logs in JSONL format").action(async (prompt, localOptions, command) => {
|
|
293786
294096
|
const options = { ...command.optsWithGlobals(), ...localOptions };
|
|
293787
294097
|
const cwd = process.cwd();
|
|
293788
|
-
const overrides = {
|
|
293789
|
-
|
|
293790
|
-
|
|
293791
|
-
|
|
293792
|
-
|
|
293793
|
-
overrides.models = { default: options.model };
|
|
293794
|
-
}
|
|
294098
|
+
const overrides = createCliRunOverrides({
|
|
294099
|
+
provider: options.provider,
|
|
294100
|
+
model: options.model,
|
|
294101
|
+
fullAccess: !!options.yes
|
|
294102
|
+
});
|
|
293795
294103
|
const outcome = await runAgent(cwd, prompt, overrides, false, {
|
|
293796
294104
|
nonInteractive: true,
|
|
293797
294105
|
jsonl: !!options.jsonl,
|