@orbit-build/cli 0.8.2 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/index.js +1407 -582
- package/package.json +1 -1
- package/skills/cumcm-draft/SKILL.md +92 -48
- package/skills/cumcm-draft/agents/openai.yaml +1 -1
- package/skills/cumcm-draft/assets/project-template/{code → .cumcm}/finalize.py +33 -4
- package/skills/cumcm-draft/assets/project-template/{paper/contest-profile.json → .cumcm/profile.json} +9 -6
- package/skills/cumcm-draft/assets/project-template/code/requirements.txt +1 -11
- package/skills/cumcm-draft/assets/project-template/paper/AI/345/267/245/345/205/267/344/275/277/347/224/250/350/257/246/346/203/205.tex +1 -11
- package/skills/cumcm-draft/assets/project-template/paper/main.tex +70 -11
- package/skills/cumcm-draft/references/code-and-output-style.md +9 -14
- package/skills/cumcm-draft/references/cumcm-compliance.md +28 -25
- package/skills/cumcm-draft/references/latex-figures-tables.md +1 -1
- package/skills/cumcm-draft/references/modeling-quality.md +1 -1
- package/skills/cumcm-draft/references/paper-architecture.md +3 -3
- package/skills/cumcm-draft/references/project-architecture.md +70 -89
- package/skills/cumcm-draft/scripts/audit_paper.py +37 -9
- package/skills/cumcm-draft/scripts/bootstrap_project.py +182 -56
- package/skills/cumcm-draft/scripts/build_paper.py +38 -23
- package/skills/cumcm-draft/scripts/capture_environment.py +3 -1
- package/skills/cumcm-draft/scripts/clean_project.py +7 -2
- package/skills/cumcm-draft/scripts/evidence_freeze.py +8 -4
- package/skills/cumcm-draft/scripts/finalize_project.py +4 -0
- package/skills/cumcm-draft/scripts/inspect_inputs.py +6 -4
- package/skills/cumcm-draft/scripts/package_support.py +41 -15
- package/skills/cumcm-draft/scripts/project_utils.py +40 -8
- package/skills/cumcm-draft/scripts/validate_project.py +374 -57
- package/skills/cumcm-draft/assets/project-template/code/always/__init__.py +0 -1
- package/skills/cumcm-draft/assets/project-template/code/always/config.py +0 -18
- package/skills/cumcm-draft/assets/project-template/code/always/data.py +0 -24
- package/skills/cumcm-draft/assets/project-template/code/always/plotting.py +0 -25
- package/skills/cumcm-draft/assets/project-template/code/always/validation.py +0 -21
- package/skills/cumcm-draft/assets/project-template/paper/sections/abstract.tex +0 -6
- package/skills/cumcm-draft/assets/project-template/paper/sections/ai-disclosure.tex +0 -3
- package/skills/cumcm-draft/assets/project-template/paper/sections/appendix.tex +0 -3
- package/skills/cumcm-draft/assets/project-template/paper/sections/assumptions.tex +0 -5
- package/skills/cumcm-draft/assets/project-template/paper/sections/data.tex +0 -19
- package/skills/cumcm-draft/assets/project-template/paper/sections/evaluation.tex +0 -9
- package/skills/cumcm-draft/assets/project-template/paper/sections/problem-analysis.tex +0 -3
- package/skills/cumcm-draft/assets/project-template/paper/sections/problem-restatement.tex +0 -3
- package/skills/cumcm-draft/assets/project-template/paper/sections/references.tex +0 -12
- package/skills/cumcm-draft/assets/project-template/paper/sections/source-code.tex +0 -1
- package/skills/cumcm-draft/assets/project-template/paper/sections/support-files.tex +0 -3
- /package/skills/cumcm-draft/assets/project-template/{paper → .cumcm}/ai-use-log.md +0 -0
package/dist/index.js
CHANGED
|
@@ -134,12 +134,12 @@ var require_isexe = __commonJS({
|
|
|
134
134
|
if (typeof Promise !== "function") {
|
|
135
135
|
throw new TypeError("callback not provided");
|
|
136
136
|
}
|
|
137
|
-
return new Promise(function(
|
|
137
|
+
return new Promise(function(resolve26, reject) {
|
|
138
138
|
isexe(path9, options || {}, function(er, is) {
|
|
139
139
|
if (er) {
|
|
140
140
|
reject(er);
|
|
141
141
|
} else {
|
|
142
|
-
|
|
142
|
+
resolve26(is);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
});
|
|
@@ -206,27 +206,27 @@ var require_which = __commonJS({
|
|
|
206
206
|
opt = {};
|
|
207
207
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
208
208
|
const found = [];
|
|
209
|
-
const step = (i2) => new Promise((
|
|
209
|
+
const step = (i2) => new Promise((resolve26, reject) => {
|
|
210
210
|
if (i2 === pathEnv.length)
|
|
211
|
-
return opt.all && found.length ?
|
|
211
|
+
return opt.all && found.length ? resolve26(found) : reject(getNotFoundError(cmd));
|
|
212
212
|
const ppRaw = pathEnv[i2];
|
|
213
213
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
214
214
|
const pCmd = path9.join(pathPart, cmd);
|
|
215
215
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
216
|
-
|
|
216
|
+
resolve26(subStep(p, i2, 0));
|
|
217
217
|
});
|
|
218
|
-
const subStep = (p, i2, ii) => new Promise((
|
|
218
|
+
const subStep = (p, i2, ii) => new Promise((resolve26, reject) => {
|
|
219
219
|
if (ii === pathExt.length)
|
|
220
|
-
return
|
|
220
|
+
return resolve26(step(i2 + 1));
|
|
221
221
|
const ext = pathExt[ii];
|
|
222
222
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
223
223
|
if (!er && is) {
|
|
224
224
|
if (opt.all)
|
|
225
225
|
found.push(p + ext);
|
|
226
226
|
else
|
|
227
|
-
return
|
|
227
|
+
return resolve26(p + ext);
|
|
228
228
|
}
|
|
229
|
-
return
|
|
229
|
+
return resolve26(subStep(p, i2, ii + 1));
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -3207,9 +3207,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
3207
3207
|
}
|
|
3208
3208
|
close(callback) {
|
|
3209
3209
|
if (callback === void 0) {
|
|
3210
|
-
return new Promise((
|
|
3210
|
+
return new Promise((resolve26, reject) => {
|
|
3211
3211
|
this.close((err, data) => {
|
|
3212
|
-
return err ? reject(err) :
|
|
3212
|
+
return err ? reject(err) : resolve26(data);
|
|
3213
3213
|
});
|
|
3214
3214
|
});
|
|
3215
3215
|
}
|
|
@@ -3247,12 +3247,12 @@ var require_dispatcher_base = __commonJS({
|
|
|
3247
3247
|
err = null;
|
|
3248
3248
|
}
|
|
3249
3249
|
if (callback === void 0) {
|
|
3250
|
-
return new Promise((
|
|
3250
|
+
return new Promise((resolve26, reject) => {
|
|
3251
3251
|
this.destroy(err, (err2, data) => {
|
|
3252
3252
|
return err2 ? (
|
|
3253
3253
|
/* istanbul ignore next: should never error */
|
|
3254
3254
|
reject(err2)
|
|
3255
|
-
) :
|
|
3255
|
+
) : resolve26(data);
|
|
3256
3256
|
});
|
|
3257
3257
|
});
|
|
3258
3258
|
}
|
|
@@ -5519,8 +5519,8 @@ var require_util2 = __commonJS({
|
|
|
5519
5519
|
function createDeferredPromise() {
|
|
5520
5520
|
let res;
|
|
5521
5521
|
let rej;
|
|
5522
|
-
const promise = new Promise((
|
|
5523
|
-
res =
|
|
5522
|
+
const promise = new Promise((resolve26, reject) => {
|
|
5523
|
+
res = resolve26;
|
|
5524
5524
|
rej = reject;
|
|
5525
5525
|
});
|
|
5526
5526
|
return { promise, resolve: res, reject: rej };
|
|
@@ -7766,12 +7766,12 @@ upgrade: ${upgrade}\r
|
|
|
7766
7766
|
cb();
|
|
7767
7767
|
}
|
|
7768
7768
|
}
|
|
7769
|
-
const waitForDrain = () => new Promise((
|
|
7769
|
+
const waitForDrain = () => new Promise((resolve26, reject) => {
|
|
7770
7770
|
assert(callback === null);
|
|
7771
7771
|
if (socket[kError]) {
|
|
7772
7772
|
reject(socket[kError]);
|
|
7773
7773
|
} else {
|
|
7774
|
-
callback =
|
|
7774
|
+
callback = resolve26;
|
|
7775
7775
|
}
|
|
7776
7776
|
});
|
|
7777
7777
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -8408,12 +8408,12 @@ var require_client_h2 = __commonJS({
|
|
|
8408
8408
|
cb();
|
|
8409
8409
|
}
|
|
8410
8410
|
}
|
|
8411
|
-
const waitForDrain = () => new Promise((
|
|
8411
|
+
const waitForDrain = () => new Promise((resolve26, reject) => {
|
|
8412
8412
|
assert(callback === null);
|
|
8413
8413
|
if (socket[kError]) {
|
|
8414
8414
|
reject(socket[kError]);
|
|
8415
8415
|
} else {
|
|
8416
|
-
callback =
|
|
8416
|
+
callback = resolve26;
|
|
8417
8417
|
}
|
|
8418
8418
|
});
|
|
8419
8419
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -8891,16 +8891,16 @@ var require_client = __commonJS({
|
|
|
8891
8891
|
return this[kNeedDrain] < 2;
|
|
8892
8892
|
}
|
|
8893
8893
|
async [kClose]() {
|
|
8894
|
-
return new Promise((
|
|
8894
|
+
return new Promise((resolve26) => {
|
|
8895
8895
|
if (this[kSize]) {
|
|
8896
|
-
this[kClosedResolve] =
|
|
8896
|
+
this[kClosedResolve] = resolve26;
|
|
8897
8897
|
} else {
|
|
8898
|
-
|
|
8898
|
+
resolve26(null);
|
|
8899
8899
|
}
|
|
8900
8900
|
});
|
|
8901
8901
|
}
|
|
8902
8902
|
async [kDestroy](err) {
|
|
8903
|
-
return new Promise((
|
|
8903
|
+
return new Promise((resolve26) => {
|
|
8904
8904
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
8905
8905
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
8906
8906
|
const request = requests[i2];
|
|
@@ -8911,7 +8911,7 @@ var require_client = __commonJS({
|
|
|
8911
8911
|
this[kClosedResolve]();
|
|
8912
8912
|
this[kClosedResolve] = null;
|
|
8913
8913
|
}
|
|
8914
|
-
|
|
8914
|
+
resolve26(null);
|
|
8915
8915
|
};
|
|
8916
8916
|
if (this[kHTTPContext]) {
|
|
8917
8917
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -8962,7 +8962,7 @@ var require_client = __commonJS({
|
|
|
8962
8962
|
});
|
|
8963
8963
|
}
|
|
8964
8964
|
try {
|
|
8965
|
-
const socket = await new Promise((
|
|
8965
|
+
const socket = await new Promise((resolve26, reject) => {
|
|
8966
8966
|
client[kConnector]({
|
|
8967
8967
|
host,
|
|
8968
8968
|
hostname,
|
|
@@ -8974,7 +8974,7 @@ var require_client = __commonJS({
|
|
|
8974
8974
|
if (err) {
|
|
8975
8975
|
reject(err);
|
|
8976
8976
|
} else {
|
|
8977
|
-
|
|
8977
|
+
resolve26(socket2);
|
|
8978
8978
|
}
|
|
8979
8979
|
});
|
|
8980
8980
|
});
|
|
@@ -9311,8 +9311,8 @@ var require_pool_base = __commonJS({
|
|
|
9311
9311
|
if (this[kQueue].isEmpty()) {
|
|
9312
9312
|
await Promise.all(this[kClients].map((c2) => c2.close()));
|
|
9313
9313
|
} else {
|
|
9314
|
-
await new Promise((
|
|
9315
|
-
this[kClosedResolve] =
|
|
9314
|
+
await new Promise((resolve26) => {
|
|
9315
|
+
this[kClosedResolve] = resolve26;
|
|
9316
9316
|
});
|
|
9317
9317
|
}
|
|
9318
9318
|
}
|
|
@@ -10555,7 +10555,7 @@ var require_readable = __commonJS({
|
|
|
10555
10555
|
if (this._readableState.closeEmitted) {
|
|
10556
10556
|
return null;
|
|
10557
10557
|
}
|
|
10558
|
-
return await new Promise((
|
|
10558
|
+
return await new Promise((resolve26, reject) => {
|
|
10559
10559
|
if (this[kContentLength] > limit) {
|
|
10560
10560
|
this.destroy(new AbortError());
|
|
10561
10561
|
}
|
|
@@ -10568,7 +10568,7 @@ var require_readable = __commonJS({
|
|
|
10568
10568
|
if (signal?.aborted) {
|
|
10569
10569
|
reject(signal.reason ?? new AbortError());
|
|
10570
10570
|
} else {
|
|
10571
|
-
|
|
10571
|
+
resolve26(null);
|
|
10572
10572
|
}
|
|
10573
10573
|
}).on("error", noop2).on("data", function(chunk) {
|
|
10574
10574
|
limit -= chunk.length;
|
|
@@ -10587,7 +10587,7 @@ var require_readable = __commonJS({
|
|
|
10587
10587
|
}
|
|
10588
10588
|
async function consume(stream, type) {
|
|
10589
10589
|
assert(!stream[kConsume]);
|
|
10590
|
-
return new Promise((
|
|
10590
|
+
return new Promise((resolve26, reject) => {
|
|
10591
10591
|
if (isUnusable(stream)) {
|
|
10592
10592
|
const rState = stream._readableState;
|
|
10593
10593
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -10604,7 +10604,7 @@ var require_readable = __commonJS({
|
|
|
10604
10604
|
stream[kConsume] = {
|
|
10605
10605
|
type,
|
|
10606
10606
|
stream,
|
|
10607
|
-
resolve:
|
|
10607
|
+
resolve: resolve26,
|
|
10608
10608
|
reject,
|
|
10609
10609
|
length: 0,
|
|
10610
10610
|
body: []
|
|
@@ -10674,18 +10674,18 @@ var require_readable = __commonJS({
|
|
|
10674
10674
|
return buffer;
|
|
10675
10675
|
}
|
|
10676
10676
|
function consumeEnd(consume2) {
|
|
10677
|
-
const { type, body, resolve:
|
|
10677
|
+
const { type, body, resolve: resolve26, stream, length } = consume2;
|
|
10678
10678
|
try {
|
|
10679
10679
|
if (type === "text") {
|
|
10680
|
-
|
|
10680
|
+
resolve26(chunksDecode(body, length));
|
|
10681
10681
|
} else if (type === "json") {
|
|
10682
|
-
|
|
10682
|
+
resolve26(JSON.parse(chunksDecode(body, length)));
|
|
10683
10683
|
} else if (type === "arrayBuffer") {
|
|
10684
|
-
|
|
10684
|
+
resolve26(chunksConcat(body, length).buffer);
|
|
10685
10685
|
} else if (type === "blob") {
|
|
10686
|
-
|
|
10686
|
+
resolve26(new Blob(body, { type: stream[kContentType] }));
|
|
10687
10687
|
} else if (type === "bytes") {
|
|
10688
|
-
|
|
10688
|
+
resolve26(chunksConcat(body, length));
|
|
10689
10689
|
}
|
|
10690
10690
|
consumeFinish(consume2);
|
|
10691
10691
|
} catch (err) {
|
|
@@ -10943,9 +10943,9 @@ var require_api_request = __commonJS({
|
|
|
10943
10943
|
};
|
|
10944
10944
|
function request(opts, callback) {
|
|
10945
10945
|
if (callback === void 0) {
|
|
10946
|
-
return new Promise((
|
|
10946
|
+
return new Promise((resolve26, reject) => {
|
|
10947
10947
|
request.call(this, opts, (err, data) => {
|
|
10948
|
-
return err ? reject(err) :
|
|
10948
|
+
return err ? reject(err) : resolve26(data);
|
|
10949
10949
|
});
|
|
10950
10950
|
});
|
|
10951
10951
|
}
|
|
@@ -11169,9 +11169,9 @@ var require_api_stream = __commonJS({
|
|
|
11169
11169
|
};
|
|
11170
11170
|
function stream(opts, factory, callback) {
|
|
11171
11171
|
if (callback === void 0) {
|
|
11172
|
-
return new Promise((
|
|
11172
|
+
return new Promise((resolve26, reject) => {
|
|
11173
11173
|
stream.call(this, opts, factory, (err, data) => {
|
|
11174
|
-
return err ? reject(err) :
|
|
11174
|
+
return err ? reject(err) : resolve26(data);
|
|
11175
11175
|
});
|
|
11176
11176
|
});
|
|
11177
11177
|
}
|
|
@@ -11456,9 +11456,9 @@ var require_api_upgrade = __commonJS({
|
|
|
11456
11456
|
};
|
|
11457
11457
|
function upgrade(opts, callback) {
|
|
11458
11458
|
if (callback === void 0) {
|
|
11459
|
-
return new Promise((
|
|
11459
|
+
return new Promise((resolve26, reject) => {
|
|
11460
11460
|
upgrade.call(this, opts, (err, data) => {
|
|
11461
|
-
return err ? reject(err) :
|
|
11461
|
+
return err ? reject(err) : resolve26(data);
|
|
11462
11462
|
});
|
|
11463
11463
|
});
|
|
11464
11464
|
}
|
|
@@ -11550,9 +11550,9 @@ var require_api_connect = __commonJS({
|
|
|
11550
11550
|
};
|
|
11551
11551
|
function connect(opts, callback) {
|
|
11552
11552
|
if (callback === void 0) {
|
|
11553
|
-
return new Promise((
|
|
11553
|
+
return new Promise((resolve26, reject) => {
|
|
11554
11554
|
connect.call(this, opts, (err, data) => {
|
|
11555
|
-
return err ? reject(err) :
|
|
11555
|
+
return err ? reject(err) : resolve26(data);
|
|
11556
11556
|
});
|
|
11557
11557
|
});
|
|
11558
11558
|
}
|
|
@@ -15414,7 +15414,7 @@ var require_fetch = __commonJS({
|
|
|
15414
15414
|
function dispatch({ body }) {
|
|
15415
15415
|
const url = requestCurrentURL(request);
|
|
15416
15416
|
const agent = fetchParams.controller.dispatcher;
|
|
15417
|
-
return new Promise((
|
|
15417
|
+
return new Promise((resolve26, reject) => agent.dispatch(
|
|
15418
15418
|
{
|
|
15419
15419
|
path: url.pathname + url.search,
|
|
15420
15420
|
origin: url.origin,
|
|
@@ -15490,7 +15490,7 @@ var require_fetch = __commonJS({
|
|
|
15490
15490
|
}
|
|
15491
15491
|
}
|
|
15492
15492
|
const onError = this.onError.bind(this);
|
|
15493
|
-
|
|
15493
|
+
resolve26({
|
|
15494
15494
|
status,
|
|
15495
15495
|
statusText,
|
|
15496
15496
|
headersList,
|
|
@@ -15536,7 +15536,7 @@ var require_fetch = __commonJS({
|
|
|
15536
15536
|
for (let i2 = 0; i2 < rawHeaders.length; i2 += 2) {
|
|
15537
15537
|
headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i2]), rawHeaders[i2 + 1].toString("latin1"), true);
|
|
15538
15538
|
}
|
|
15539
|
-
|
|
15539
|
+
resolve26({
|
|
15540
15540
|
status,
|
|
15541
15541
|
statusText: STATUS_CODES[status],
|
|
15542
15542
|
headersList,
|
|
@@ -19266,8 +19266,8 @@ var require_util8 = __commonJS({
|
|
|
19266
19266
|
return true;
|
|
19267
19267
|
}
|
|
19268
19268
|
function delay(ms) {
|
|
19269
|
-
return new Promise((
|
|
19270
|
-
setTimeout(
|
|
19269
|
+
return new Promise((resolve26) => {
|
|
19270
|
+
setTimeout(resolve26, ms).unref();
|
|
19271
19271
|
});
|
|
19272
19272
|
}
|
|
19273
19273
|
module.exports = {
|
|
@@ -144240,7 +144240,7 @@ ${lanes.join("\n")}
|
|
|
144240
144240
|
}
|
|
144241
144241
|
}
|
|
144242
144242
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
144243
|
-
const
|
|
144243
|
+
const resolve26 = factory2.createUniqueName("resolve");
|
|
144244
144244
|
const reject = factory2.createUniqueName("reject");
|
|
144245
144245
|
const parameters = [
|
|
144246
144246
|
factory2.createParameterDeclaration(
|
|
@@ -144249,7 +144249,7 @@ ${lanes.join("\n")}
|
|
|
144249
144249
|
/*dotDotDotToken*/
|
|
144250
144250
|
void 0,
|
|
144251
144251
|
/*name*/
|
|
144252
|
-
|
|
144252
|
+
resolve26
|
|
144253
144253
|
),
|
|
144254
144254
|
factory2.createParameterDeclaration(
|
|
144255
144255
|
/*modifiers*/
|
|
@@ -144266,7 +144266,7 @@ ${lanes.join("\n")}
|
|
|
144266
144266
|
factory2.createIdentifier("require"),
|
|
144267
144267
|
/*typeArguments*/
|
|
144268
144268
|
void 0,
|
|
144269
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
144269
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve26, reject]
|
|
144270
144270
|
)
|
|
144271
144271
|
)
|
|
144272
144272
|
]);
|
|
@@ -231197,8 +231197,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
231197
231197
|
installPackage(options) {
|
|
231198
231198
|
this.packageInstallId++;
|
|
231199
231199
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
231200
|
-
const promise = new Promise((
|
|
231201
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
231200
|
+
const promise = new Promise((resolve26, reject) => {
|
|
231201
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve26, reject });
|
|
231202
231202
|
});
|
|
231203
231203
|
this.installer.send(request);
|
|
231204
231204
|
return promise;
|
|
@@ -234431,7 +234431,7 @@ var require_compile = __commonJS({
|
|
|
234431
234431
|
const schOrFunc = root.refs[ref];
|
|
234432
234432
|
if (schOrFunc)
|
|
234433
234433
|
return schOrFunc;
|
|
234434
|
-
let _sch =
|
|
234434
|
+
let _sch = resolve26.call(this, root, ref);
|
|
234435
234435
|
if (_sch === void 0) {
|
|
234436
234436
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
234437
234437
|
const { schemaId } = this.opts;
|
|
@@ -234458,7 +234458,7 @@ var require_compile = __commonJS({
|
|
|
234458
234458
|
function sameSchemaEnv(s1, s2) {
|
|
234459
234459
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
234460
234460
|
}
|
|
234461
|
-
function
|
|
234461
|
+
function resolve26(root, ref) {
|
|
234462
234462
|
let sch;
|
|
234463
234463
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
234464
234464
|
ref = sch;
|
|
@@ -235089,7 +235089,7 @@ var require_fast_uri = __commonJS({
|
|
|
235089
235089
|
}
|
|
235090
235090
|
return uri;
|
|
235091
235091
|
}
|
|
235092
|
-
function
|
|
235092
|
+
function resolve26(baseURI, relativeURI, options) {
|
|
235093
235093
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
235094
235094
|
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
235095
235095
|
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
@@ -235373,7 +235373,7 @@ var require_fast_uri = __commonJS({
|
|
|
235373
235373
|
var fastUri = {
|
|
235374
235374
|
SCHEMES,
|
|
235375
235375
|
normalize: normalize3,
|
|
235376
|
-
resolve:
|
|
235376
|
+
resolve: resolve26,
|
|
235377
235377
|
resolveComponent,
|
|
235378
235378
|
equal,
|
|
235379
235379
|
serialize,
|
|
@@ -238283,6 +238283,13 @@ function buildSanitizedChildEnvironment(options = {}) {
|
|
|
238283
238283
|
environment.ORBIT_CHILD_PROCESS = "1";
|
|
238284
238284
|
return environment;
|
|
238285
238285
|
}
|
|
238286
|
+
function buildInheritedChildEnvironment(options = {}) {
|
|
238287
|
+
return {
|
|
238288
|
+
...options.source ?? process.env,
|
|
238289
|
+
...options.extra,
|
|
238290
|
+
ORBIT_CHILD_PROCESS: "1"
|
|
238291
|
+
};
|
|
238292
|
+
}
|
|
238286
238293
|
function normalizePath(p) {
|
|
238287
238294
|
return normalize(p).replace(/\\/g, "/");
|
|
238288
238295
|
}
|
|
@@ -239231,8 +239238,8 @@ function localizeOrbit(language, english, simplifiedChinese, traditionalChinese)
|
|
|
239231
239238
|
return language === "zh" ? simplifiedChinese : english;
|
|
239232
239239
|
}
|
|
239233
239240
|
var ORBIT_CONFIG_SCHEMA_VERSION = 1;
|
|
239234
|
-
var DEFAULT_AGENT_MAX_ITERATIONS =
|
|
239235
|
-
var MAX_AGENT_MAX_ITERATIONS =
|
|
239241
|
+
var DEFAULT_AGENT_MAX_ITERATIONS = 200;
|
|
239242
|
+
var MAX_AGENT_MAX_ITERATIONS = 1e3;
|
|
239236
239243
|
var EnvironmentVariableNameSchema = z22.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/);
|
|
239237
239244
|
var HttpHeaderNameSchema = z22.string().max(256).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/);
|
|
239238
239245
|
var HttpHeaderValueSchema = z22.string().max(16384).refine((value) => !/[\r\n]/.test(value));
|
|
@@ -239588,7 +239595,8 @@ var ConfigSchema = z22.object({
|
|
|
239588
239595
|
requireWriteApproval: z22.boolean().default(false),
|
|
239589
239596
|
requireBashApproval: z22.boolean().default(false),
|
|
239590
239597
|
disableWebSearch: z22.boolean().default(false),
|
|
239591
|
-
disableMcp: z22.boolean().default(false)
|
|
239598
|
+
disableMcp: z22.boolean().default(false),
|
|
239599
|
+
maxIterations: z22.number().int().positive().max(MAX_AGENT_MAX_ITERATIONS).optional()
|
|
239592
239600
|
}).optional(),
|
|
239593
239601
|
hooks: z22.object({
|
|
239594
239602
|
preEdit: z22.string().max(2e4).optional(),
|
|
@@ -239725,8 +239733,10 @@ var DEFAULT_CONFIG = {
|
|
|
239725
239733
|
testCommands: []
|
|
239726
239734
|
},
|
|
239727
239735
|
agent: {
|
|
239728
|
-
// Long enough for document, migration, and verification
|
|
239729
|
-
//
|
|
239736
|
+
// Long enough for complete document, migration, and verification
|
|
239737
|
+
// workflows. Normal modes retain periodic consent; Full Access continues
|
|
239738
|
+
// checkpoints without interruption. Progress and budget guards still
|
|
239739
|
+
// bound unhealthy runs.
|
|
239730
239740
|
maxIterations: DEFAULT_AGENT_MAX_ITERATIONS,
|
|
239731
239741
|
fastMaxOutputTokens: 32768,
|
|
239732
239742
|
maxOutputTokens: 16384,
|
|
@@ -240571,6 +240581,10 @@ function applyManagedPolicy(source, policy) {
|
|
|
240571
240581
|
if (policy.requireBashApproval) {
|
|
240572
240582
|
config.permissions.requireApprovalForBash = true;
|
|
240573
240583
|
}
|
|
240584
|
+
if (config.permissions.mode !== "auto" || policy.requireWriteApproval || policy.requireBashApproval) {
|
|
240585
|
+
config.permissions.blockDangerousCommands = true;
|
|
240586
|
+
config.permissions.protectSecrets = true;
|
|
240587
|
+
}
|
|
240574
240588
|
config.permissions.protectedPaths = Array.from(
|
|
240575
240589
|
/* @__PURE__ */ new Set([...config.permissions.protectedPaths, ...policy.protectedPaths])
|
|
240576
240590
|
);
|
|
@@ -240592,7 +240606,8 @@ function applyManagedPolicy(source, policy) {
|
|
|
240592
240606
|
requireWriteApproval: policy.requireWriteApproval,
|
|
240593
240607
|
requireBashApproval: policy.requireBashApproval,
|
|
240594
240608
|
disableWebSearch: policy.disableWebSearch,
|
|
240595
|
-
disableMcp: policy.disableMcp
|
|
240609
|
+
disableMcp: policy.disableMcp,
|
|
240610
|
+
maxIterations: policy.maxIterations
|
|
240596
240611
|
};
|
|
240597
240612
|
return config;
|
|
240598
240613
|
}
|
|
@@ -240617,6 +240632,9 @@ function validateManagedRuntimeChange(config, change) {
|
|
|
240617
240632
|
if (change.webSearchEnabled && policy.disableWebSearch) {
|
|
240618
240633
|
return "Managed policy disables web search.";
|
|
240619
240634
|
}
|
|
240635
|
+
if (change.agentMaxIterations !== void 0 && policy.maxIterations !== void 0 && change.agentMaxIterations > policy.maxIterations) {
|
|
240636
|
+
return `Managed policy limits agent runs to ${policy.maxIterations} iterations.`;
|
|
240637
|
+
}
|
|
240620
240638
|
return void 0;
|
|
240621
240639
|
}
|
|
240622
240640
|
function permissionRank(mode) {
|
|
@@ -240832,6 +240850,38 @@ function validateExtensionFileSize(fileBytes, previousTotalBytes) {
|
|
|
240832
240850
|
throw new Error("Extension tree exceeds the 256 MiB limit.");
|
|
240833
240851
|
}
|
|
240834
240852
|
}
|
|
240853
|
+
function applyPermissionModePreset(config, mode) {
|
|
240854
|
+
const fullAccess = mode === "auto";
|
|
240855
|
+
const violation = validateManagedRuntimeChange(config, {
|
|
240856
|
+
permissionMode: mode,
|
|
240857
|
+
requireWriteApproval: !fullAccess,
|
|
240858
|
+
requireBashApproval: !fullAccess
|
|
240859
|
+
});
|
|
240860
|
+
if (violation) return { ok: false, message: violation };
|
|
240861
|
+
config.permissions.mode = mode;
|
|
240862
|
+
config.permissions.allowRead = true;
|
|
240863
|
+
config.permissions.requireApprovalForWrite = !fullAccess;
|
|
240864
|
+
config.permissions.requireApprovalForBash = !fullAccess;
|
|
240865
|
+
config.permissions.blockDangerousCommands = !fullAccess;
|
|
240866
|
+
config.permissions.protectSecrets = !fullAccess;
|
|
240867
|
+
return { ok: true };
|
|
240868
|
+
}
|
|
240869
|
+
function isFullAccessEnabled(config) {
|
|
240870
|
+
return config.permissions.mode === "auto" && config.permissions.allowRead && !config.permissions.requireApprovalForWrite && !config.permissions.requireApprovalForBash && !config.permissions.blockDangerousCommands && !config.permissions.protectSecrets;
|
|
240871
|
+
}
|
|
240872
|
+
function createPermissionModeOverride(mode) {
|
|
240873
|
+
const fullAccess = mode === "auto";
|
|
240874
|
+
return {
|
|
240875
|
+
permissions: {
|
|
240876
|
+
mode,
|
|
240877
|
+
allowRead: true,
|
|
240878
|
+
requireApprovalForWrite: !fullAccess,
|
|
240879
|
+
requireApprovalForBash: !fullAccess,
|
|
240880
|
+
blockDangerousCommands: !fullAccess,
|
|
240881
|
+
protectSecrets: !fullAccess
|
|
240882
|
+
}
|
|
240883
|
+
};
|
|
240884
|
+
}
|
|
240835
240885
|
var MAX_CONFIG_FILE_BYTES = 2 * 1024 * 1024;
|
|
240836
240886
|
var MAX_PRICING_FILE_BYTES = 1024 * 1024;
|
|
240837
240887
|
function isRecord(value) {
|
|
@@ -241137,6 +241187,14 @@ var ConfigLoader = class {
|
|
|
241137
241187
|
ConfigSchema.parse(config),
|
|
241138
241188
|
homeDirectory
|
|
241139
241189
|
);
|
|
241190
|
+
if (config.permissions.mode === "auto") {
|
|
241191
|
+
const fullAccess = applyPermissionModePreset(config, "auto");
|
|
241192
|
+
if (!fullAccess.ok) {
|
|
241193
|
+
throw new Error(
|
|
241194
|
+
`Full Access configuration failed: ${fullAccess.message || "unknown policy conflict"}`
|
|
241195
|
+
);
|
|
241196
|
+
}
|
|
241197
|
+
}
|
|
241140
241198
|
const managedPolicyPath = env.ORBIT_MANAGED_POLICY ? resolve22(env.ORBIT_MANAGED_POLICY) : join4(homeDirectory, ".orbit", "policy.yaml");
|
|
241141
241199
|
if (existsSync22(managedPolicyPath)) {
|
|
241142
241200
|
try {
|
|
@@ -241353,36 +241411,6 @@ function redactValue(value, seen) {
|
|
|
241353
241411
|
}
|
|
241354
241412
|
return output;
|
|
241355
241413
|
}
|
|
241356
|
-
function applyPermissionModePreset(config, mode) {
|
|
241357
|
-
const fullAccess = mode === "auto";
|
|
241358
|
-
const violation = validateManagedRuntimeChange(config, {
|
|
241359
|
-
permissionMode: mode,
|
|
241360
|
-
requireWriteApproval: !fullAccess,
|
|
241361
|
-
requireBashApproval: !fullAccess
|
|
241362
|
-
});
|
|
241363
|
-
if (violation) return { ok: false, message: violation };
|
|
241364
|
-
config.permissions.mode = mode;
|
|
241365
|
-
config.permissions.requireApprovalForWrite = !fullAccess;
|
|
241366
|
-
config.permissions.requireApprovalForBash = !fullAccess;
|
|
241367
|
-
config.permissions.blockDangerousCommands = true;
|
|
241368
|
-
config.permissions.protectSecrets = true;
|
|
241369
|
-
return { ok: true };
|
|
241370
|
-
}
|
|
241371
|
-
function isFullAccessEnabled(config) {
|
|
241372
|
-
return config.permissions.mode === "auto" && !config.permissions.requireApprovalForWrite && !config.permissions.requireApprovalForBash && config.permissions.blockDangerousCommands && config.permissions.protectSecrets;
|
|
241373
|
-
}
|
|
241374
|
-
function createPermissionModeOverride(mode) {
|
|
241375
|
-
const fullAccess = mode === "auto";
|
|
241376
|
-
return {
|
|
241377
|
-
permissions: {
|
|
241378
|
-
mode,
|
|
241379
|
-
requireApprovalForWrite: !fullAccess,
|
|
241380
|
-
requireApprovalForBash: !fullAccess,
|
|
241381
|
-
blockDangerousCommands: true,
|
|
241382
|
-
protectSecrets: true
|
|
241383
|
-
}
|
|
241384
|
-
};
|
|
241385
|
-
}
|
|
241386
241414
|
|
|
241387
241415
|
// src/commands/config.ts
|
|
241388
241416
|
import picocolors2 from "picocolors";
|
|
@@ -241394,7 +241422,7 @@ function runConfig(cwd) {
|
|
|
241394
241422
|
|
|
241395
241423
|
// src/commands/doctor.ts
|
|
241396
241424
|
import { execSync as execSync2 } from "child_process";
|
|
241397
|
-
import { existsSync as
|
|
241425
|
+
import { existsSync as existsSync14 } from "fs";
|
|
241398
241426
|
import { basename as basename3, join as join12 } from "path";
|
|
241399
241427
|
import picocolors6 from "picocolors";
|
|
241400
241428
|
import { z as z47 } from "zod";
|
|
@@ -243050,11 +243078,11 @@ function modelFinishReasonError(reason) {
|
|
|
243050
243078
|
return new Error(`Model generation stopped unexpectedly (${reason}).`);
|
|
243051
243079
|
}
|
|
243052
243080
|
function abortableDelay(delayMs, signal) {
|
|
243053
|
-
return new Promise((
|
|
243081
|
+
return new Promise((resolve26, reject) => {
|
|
243054
243082
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
243055
243083
|
const timeoutId = setTimeout(() => {
|
|
243056
243084
|
cleanup();
|
|
243057
|
-
|
|
243085
|
+
resolve26();
|
|
243058
243086
|
}, delayMs);
|
|
243059
243087
|
timeoutId.unref?.();
|
|
243060
243088
|
function onAbort() {
|
|
@@ -246136,12 +246164,12 @@ function normalizeOllamaOpenAiBaseUrl(baseUrl) {
|
|
|
246136
246164
|
}
|
|
246137
246165
|
|
|
246138
246166
|
// src/runtime/CacheDiagnostics.ts
|
|
246139
|
-
import { existsSync as
|
|
246167
|
+
import { existsSync as existsSync13, readdirSync as readdirSync5 } from "fs";
|
|
246140
246168
|
import { join as join11 } from "path";
|
|
246141
246169
|
import picocolors4 from "picocolors";
|
|
246142
246170
|
|
|
246143
246171
|
// ../core/dist/index.js
|
|
246144
|
-
import { existsSync as
|
|
246172
|
+
import { existsSync as existsSync12, readdirSync as readdirSync4 } from "fs";
|
|
246145
246173
|
import { createHash as createHash7 } from "crypto";
|
|
246146
246174
|
import { join as join10 } from "path";
|
|
246147
246175
|
import { z as z31 } from "zod";
|
|
@@ -246161,9 +246189,10 @@ import {
|
|
|
246161
246189
|
unlinkSync as unlinkSync2,
|
|
246162
246190
|
writeFileSync as writeFileSync3
|
|
246163
246191
|
} from "fs";
|
|
246164
|
-
import { dirname as dirname4, join as join5 } from "path";
|
|
246192
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join5, resolve as resolve4 } from "path";
|
|
246193
|
+
import { isAbsolute as isAbsolute22, resolve as resolve23 } from "path";
|
|
246165
246194
|
import { z as z34 } from "zod";
|
|
246166
|
-
import { isAbsolute as
|
|
246195
|
+
import { isAbsolute as isAbsolute3, relative as relative4, win32 } from "path";
|
|
246167
246196
|
import glob from "fast-glob";
|
|
246168
246197
|
import { existsSync as existsSync23 } from "fs";
|
|
246169
246198
|
import { z as z42 } from "zod";
|
|
@@ -247084,7 +247113,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
|
|
|
247084
247113
|
return spawnedPromise;
|
|
247085
247114
|
}
|
|
247086
247115
|
let timeoutId;
|
|
247087
|
-
const timeoutPromise = new Promise((
|
|
247116
|
+
const timeoutPromise = new Promise((resolve26, reject) => {
|
|
247088
247117
|
timeoutId = setTimeout(() => {
|
|
247089
247118
|
timeoutKill(spawned, killSignal, reject);
|
|
247090
247119
|
}, timeout);
|
|
@@ -247450,9 +247479,9 @@ var mergePromise = (spawned, promise) => {
|
|
|
247450
247479
|
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
247451
247480
|
}
|
|
247452
247481
|
};
|
|
247453
|
-
var getSpawnedPromise = (spawned) => new Promise((
|
|
247482
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve26, reject) => {
|
|
247454
247483
|
spawned.on("exit", (exitCode, signal) => {
|
|
247455
|
-
|
|
247484
|
+
resolve26({ exitCode, signal });
|
|
247456
247485
|
});
|
|
247457
247486
|
spawned.on("error", (error) => {
|
|
247458
247487
|
reject(error);
|
|
@@ -247761,27 +247790,28 @@ import { z as z52 } from "zod";
|
|
|
247761
247790
|
import { z as z62 } from "zod";
|
|
247762
247791
|
import { z as z72 } from "zod";
|
|
247763
247792
|
import { createHash as createHash3 } from "crypto";
|
|
247793
|
+
import { existsSync as existsSync32 } from "fs";
|
|
247764
247794
|
import { z as z82 } from "zod";
|
|
247765
247795
|
import { z as z92 } from "zod";
|
|
247766
247796
|
import { z as z102 } from "zod";
|
|
247767
247797
|
import { relative as relative22 } from "path";
|
|
247768
247798
|
import { z as z11 } from "zod";
|
|
247769
247799
|
import { z as z12 } from "zod";
|
|
247770
|
-
import { existsSync as
|
|
247800
|
+
import { existsSync as existsSync42 } from "fs";
|
|
247771
247801
|
import { join as join23 } from "path";
|
|
247772
247802
|
import { z as z14 } from "zod";
|
|
247773
|
-
import { existsSync as
|
|
247803
|
+
import { existsSync as existsSync6 } from "fs";
|
|
247774
247804
|
import { z as z13 } from "zod";
|
|
247775
|
-
import { existsSync as
|
|
247805
|
+
import { existsSync as existsSync52 } from "fs";
|
|
247776
247806
|
import { z as z15 } from "zod";
|
|
247777
247807
|
import glob2 from "fast-glob";
|
|
247778
247808
|
import { z as z16 } from "zod";
|
|
247779
247809
|
import { z as z17 } from "zod";
|
|
247780
|
-
import { existsSync as existsSync6 } from "fs";
|
|
247781
|
-
import { join as join32 } from "path";
|
|
247782
|
-
import { z as z18 } from "zod";
|
|
247783
247810
|
import { existsSync as existsSync7 } from "fs";
|
|
247784
|
-
import {
|
|
247811
|
+
import { win32 as win322 } from "path";
|
|
247812
|
+
import { z as z18 } from "zod";
|
|
247813
|
+
import { existsSync as existsSync8 } from "fs";
|
|
247814
|
+
import { join as join32, resolve as resolve32 } from "path";
|
|
247785
247815
|
import { z as z20 } from "zod";
|
|
247786
247816
|
var import_ipaddr = __toESM(require_ipaddr(), 1);
|
|
247787
247817
|
import { lookup } from "dns/promises";
|
|
@@ -247829,11 +247859,14 @@ var ToolRegistry = class {
|
|
|
247829
247859
|
var toolRegistry = new ToolRegistry();
|
|
247830
247860
|
var MAX_TOOL_FILE_BYTES = 16 * 1024 * 1024;
|
|
247831
247861
|
var MAX_GREP_FALLBACK_FILE_BYTES = 2 * 1024 * 1024;
|
|
247832
|
-
function
|
|
247833
|
-
|
|
247862
|
+
function atomicWriteToolFile(cwd, requestedPath, content, expectedCurrentContent, options = {}) {
|
|
247863
|
+
const resolveRequestedPath = () => options.allowOutsideWorkspace ? normalizePath(
|
|
247864
|
+
isAbsolute2(requestedPath) ? resolve4(requestedPath) : resolve4(cwd, requestedPath)
|
|
247865
|
+
) : resolveSafePath(cwd, requestedPath);
|
|
247866
|
+
let safePath = resolveRequestedPath();
|
|
247834
247867
|
const parent = dirname4(safePath);
|
|
247835
247868
|
mkdirSync2(parent, { recursive: true });
|
|
247836
|
-
safePath =
|
|
247869
|
+
safePath = resolveRequestedPath();
|
|
247837
247870
|
assertExpectedContent(safePath, expectedCurrentContent);
|
|
247838
247871
|
const temporaryPath = join5(parent, `.orbit-write-${randomUUID3()}.tmp`);
|
|
247839
247872
|
let descriptor;
|
|
@@ -247843,7 +247876,7 @@ function atomicWriteWorkspaceFile(cwd, requestedPath, content, expectedCurrentCo
|
|
|
247843
247876
|
fsyncSync2(descriptor);
|
|
247844
247877
|
closeSync3(descriptor);
|
|
247845
247878
|
descriptor = void 0;
|
|
247846
|
-
const revalidatedPath =
|
|
247879
|
+
const revalidatedPath = resolveRequestedPath();
|
|
247847
247880
|
if (revalidatedPath !== safePath) {
|
|
247848
247881
|
throw new Error("File path changed while preparing the atomic write.");
|
|
247849
247882
|
}
|
|
@@ -247871,6 +247904,18 @@ function assertExpectedContent(safePath, expected) {
|
|
|
247871
247904
|
);
|
|
247872
247905
|
}
|
|
247873
247906
|
}
|
|
247907
|
+
function hasFullHostAccess(ctx) {
|
|
247908
|
+
return Boolean(ctx.config && isFullAccessEnabled(ctx.config));
|
|
247909
|
+
}
|
|
247910
|
+
function resolveToolPath(ctx, requestedPath) {
|
|
247911
|
+
if (!hasFullHostAccess(ctx)) return resolveSafePath(ctx.cwd, requestedPath);
|
|
247912
|
+
return normalizePath(
|
|
247913
|
+
isAbsolute22(requestedPath) ? resolve23(requestedPath) : resolve23(ctx.cwd, requestedPath)
|
|
247914
|
+
);
|
|
247915
|
+
}
|
|
247916
|
+
function buildToolChildEnvironment(ctx) {
|
|
247917
|
+
return ctx.config && isFullAccessEnabled(ctx.config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
|
|
247918
|
+
}
|
|
247874
247919
|
var EditFileInputSchema = z24.object({
|
|
247875
247920
|
path: z24.string().trim().min(1).max(4096),
|
|
247876
247921
|
oldText: z24.string().max(5e6),
|
|
@@ -247879,12 +247924,12 @@ var EditFileInputSchema = z24.object({
|
|
|
247879
247924
|
});
|
|
247880
247925
|
var EditFileTool = class {
|
|
247881
247926
|
name = "edit_file";
|
|
247882
|
-
description = "Replace oldText with newText inside a file. If replaceAll is false (default), oldText must occur exactly once in the file to prevent accidental edits.";
|
|
247927
|
+
description = "Replace oldText with newText inside a project file, or any host file when unrestricted Full Access is active. If replaceAll is false (default), oldText must occur exactly once in the file to prevent accidental edits.";
|
|
247883
247928
|
inputSchema = EditFileInputSchema;
|
|
247884
247929
|
risk = "write";
|
|
247885
247930
|
async execute(input, ctx) {
|
|
247886
247931
|
try {
|
|
247887
|
-
const safePath =
|
|
247932
|
+
const safePath = resolveToolPath(ctx, input.path);
|
|
247888
247933
|
const originalContent = readBoundedRegularFile(
|
|
247889
247934
|
safePath,
|
|
247890
247935
|
MAX_TOOL_FILE_BYTES
|
|
@@ -247905,7 +247950,7 @@ var EditFileTool = class {
|
|
|
247905
247950
|
}
|
|
247906
247951
|
const updated = fileContent.split(oldTextNorm).join(newTextNorm);
|
|
247907
247952
|
const writeError = await this.checkAndWrite(
|
|
247908
|
-
ctx
|
|
247953
|
+
ctx,
|
|
247909
247954
|
input.path,
|
|
247910
247955
|
safePath,
|
|
247911
247956
|
updated,
|
|
@@ -247956,7 +248001,7 @@ var EditFileTool = class {
|
|
|
247956
248001
|
fileLines.splice(matchedIndex, M, ...adjustedNewLines);
|
|
247957
248002
|
const updated = fileLines.join("\n");
|
|
247958
248003
|
const writeError = await this.checkAndWrite(
|
|
247959
|
-
ctx
|
|
248004
|
+
ctx,
|
|
247960
248005
|
input.path,
|
|
247961
248006
|
safePath,
|
|
247962
248007
|
updated,
|
|
@@ -247985,7 +248030,7 @@ var EditFileTool = class {
|
|
|
247985
248030
|
fileLines.splice(index, M, ...adjustedNewLines);
|
|
247986
248031
|
}
|
|
247987
248032
|
const writeError = await this.checkAndWrite(
|
|
247988
|
-
ctx
|
|
248033
|
+
ctx,
|
|
247989
248034
|
input.path,
|
|
247990
248035
|
safePath,
|
|
247991
248036
|
fileLines.join("\n"),
|
|
@@ -248041,7 +248086,7 @@ var EditFileTool = class {
|
|
|
248041
248086
|
fileLines.splice(bestIndex, M, ...adjustedNewLines);
|
|
248042
248087
|
const updated = fileLines.join("\n");
|
|
248043
248088
|
const writeError = await this.checkAndWrite(
|
|
248044
|
-
ctx
|
|
248089
|
+
ctx,
|
|
248045
248090
|
input.path,
|
|
248046
248091
|
safePath,
|
|
248047
248092
|
updated,
|
|
@@ -248063,11 +248108,12 @@ var EditFileTool = class {
|
|
|
248063
248108
|
input.path,
|
|
248064
248109
|
fileContent,
|
|
248065
248110
|
oldTextNorm,
|
|
248066
|
-
newTextNorm
|
|
248111
|
+
newTextNorm,
|
|
248112
|
+
buildToolChildEnvironment(ctx)
|
|
248067
248113
|
);
|
|
248068
248114
|
if (astUpdated) {
|
|
248069
248115
|
const writeError = await this.checkAndWrite(
|
|
248070
|
-
ctx
|
|
248116
|
+
ctx,
|
|
248071
248117
|
input.path,
|
|
248072
248118
|
safePath,
|
|
248073
248119
|
astUpdated,
|
|
@@ -248098,8 +248144,12 @@ var EditFileTool = class {
|
|
|
248098
248144
|
};
|
|
248099
248145
|
}
|
|
248100
248146
|
}
|
|
248101
|
-
async checkAndWrite(
|
|
248102
|
-
const syntaxError = await verifySyntax(
|
|
248147
|
+
async checkAndWrite(ctx, filePath, safePath, updated, originalContent) {
|
|
248148
|
+
const syntaxError = await verifySyntax(
|
|
248149
|
+
filePath,
|
|
248150
|
+
updated,
|
|
248151
|
+
buildToolChildEnvironment(ctx)
|
|
248152
|
+
);
|
|
248103
248153
|
if (syntaxError) {
|
|
248104
248154
|
return {
|
|
248105
248155
|
ok: false,
|
|
@@ -248108,16 +248158,13 @@ ${syntaxError}`
|
|
|
248108
248158
|
};
|
|
248109
248159
|
}
|
|
248110
248160
|
const finalContent = originalContent.includes("\r\n") ? updated.replace(/\n/g, "\r\n") : updated;
|
|
248111
|
-
|
|
248112
|
-
|
|
248113
|
-
|
|
248114
|
-
finalContent,
|
|
248115
|
-
originalContent
|
|
248116
|
-
);
|
|
248161
|
+
atomicWriteToolFile(ctx.cwd, safePath, finalContent, originalContent, {
|
|
248162
|
+
allowOutsideWorkspace: hasFullHostAccess(ctx)
|
|
248163
|
+
});
|
|
248117
248164
|
return null;
|
|
248118
248165
|
}
|
|
248119
248166
|
};
|
|
248120
|
-
async function verifySyntax(filePath, content) {
|
|
248167
|
+
async function verifySyntax(filePath, content, environment) {
|
|
248121
248168
|
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
248122
248169
|
if (ext === "json") {
|
|
248123
248170
|
try {
|
|
@@ -248167,6 +248214,7 @@ ${errors.join("\n")}`;
|
|
|
248167
248214
|
["-c", "import sys; compile(sys.stdin.read(), 'file.py', 'exec')"],
|
|
248168
248215
|
{
|
|
248169
248216
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248217
|
+
env: environment,
|
|
248170
248218
|
input: content,
|
|
248171
248219
|
encoding: "utf8"
|
|
248172
248220
|
}
|
|
@@ -248292,7 +248340,7 @@ function describeReplacedRegion(original, updated) {
|
|
|
248292
248340
|
startLine: original.slice(0, prefix).split("\n").length
|
|
248293
248341
|
};
|
|
248294
248342
|
}
|
|
248295
|
-
async function astMatchAndReplace(filePath, fileContent, oldText, newText) {
|
|
248343
|
+
async function astMatchAndReplace(filePath, fileContent, oldText, newText, environment) {
|
|
248296
248344
|
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
248297
248345
|
if (ext !== "ts" && ext !== "tsx" && ext !== "js" && ext !== "jsx" && ext !== "py") {
|
|
248298
248346
|
return null;
|
|
@@ -248365,6 +248413,7 @@ if __name__ == "__main__":
|
|
|
248365
248413
|
["-c", pythonScript, fileContent, oldText, newText],
|
|
248366
248414
|
{
|
|
248367
248415
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248416
|
+
env: environment,
|
|
248368
248417
|
encoding: "utf8"
|
|
248369
248418
|
}
|
|
248370
248419
|
);
|
|
@@ -248492,7 +248541,7 @@ var IGNORED_DIRECTORIES = [
|
|
|
248492
248541
|
function isWorkspaceRelativeGlob(pattern) {
|
|
248493
248542
|
const candidate = pattern.startsWith("!") ? pattern.slice(1) : pattern;
|
|
248494
248543
|
const normalized = candidate.replace(/\\/g, "/");
|
|
248495
|
-
return candidate.length > 0 && !
|
|
248544
|
+
return candidate.length > 0 && !isAbsolute3(candidate) && !win32.isAbsolute(candidate) && !normalized.includes("..");
|
|
248496
248545
|
}
|
|
248497
248546
|
async function findWorkspaceFiles(root, pattern, options = {}) {
|
|
248498
248547
|
if (!isWorkspaceRelativeGlob(pattern)) {
|
|
@@ -248560,7 +248609,7 @@ function resolveReadableFile(ctx, inputPath) {
|
|
|
248560
248609
|
return void 0;
|
|
248561
248610
|
};
|
|
248562
248611
|
try {
|
|
248563
|
-
const workspacePath =
|
|
248612
|
+
const workspacePath = resolveToolPath(ctx, inputPath);
|
|
248564
248613
|
if (existsSync23(workspacePath)) return workspacePath;
|
|
248565
248614
|
return fromRoots() ?? workspacePath;
|
|
248566
248615
|
} catch (workspaceError) {
|
|
@@ -248583,20 +248632,21 @@ function normalizedReadRoots(ctx) {
|
|
|
248583
248632
|
}
|
|
248584
248633
|
var GlobInputSchema = z34.object({
|
|
248585
248634
|
pattern: z34.string().min(1).max(4096).refine(isReadableGlob, {
|
|
248586
|
-
message: "Glob pattern must stay relative to the
|
|
248635
|
+
message: "Glob pattern must stay relative to the selected root or use skill://<skill-name>/<pattern>."
|
|
248587
248636
|
}),
|
|
248637
|
+
path: z34.string().trim().min(1).max(4096).optional(),
|
|
248588
248638
|
maxResults: z34.number().int().min(1).max(5e3).optional()
|
|
248589
248639
|
});
|
|
248590
248640
|
var GlobTool = class {
|
|
248591
248641
|
name = "glob";
|
|
248592
|
-
description = "Find files matching a
|
|
248642
|
+
description = "Find files matching a relative glob in the project, a selected host directory when unrestricted Full Access is active, or an active skill:// resource, with a configurable bounded result count.";
|
|
248593
248643
|
inputSchema = GlobInputSchema;
|
|
248594
248644
|
risk = "read";
|
|
248595
248645
|
async execute(input, ctx) {
|
|
248596
248646
|
try {
|
|
248597
248647
|
const skillUri = parseSkillUri(input.pattern);
|
|
248598
248648
|
const skillRoot = skillUri ? resolveSkillRoot(ctx, skillUri.name) : void 0;
|
|
248599
|
-
const root = skillRoot?.path ?? ctx.cwd;
|
|
248649
|
+
const root = skillRoot?.path ?? (input.path ? resolveToolPath(ctx, input.path) : ctx.cwd);
|
|
248600
248650
|
const pattern = skillUri?.relativePath ?? input.pattern;
|
|
248601
248651
|
const files = await findWorkspaceFiles(root, pattern, {
|
|
248602
248652
|
dot: true
|
|
@@ -248662,7 +248712,7 @@ function buildLineMatcher(pattern) {
|
|
|
248662
248712
|
}
|
|
248663
248713
|
var GrepTool = class {
|
|
248664
248714
|
name = "grep";
|
|
248665
|
-
description = "Search for string patterns across project files or an active skill:// resource. Uses ripgrep if available, falling back to a Node-based search.";
|
|
248715
|
+
description = "Search for string patterns across project files, any host directory when unrestricted Full Access is active, or an active skill:// resource. Uses ripgrep if available, falling back to a Node-based search.";
|
|
248666
248716
|
inputSchema = GrepInputSchema;
|
|
248667
248717
|
risk = "read";
|
|
248668
248718
|
async execute(input, ctx) {
|
|
@@ -248678,7 +248728,10 @@ var GrepTool = class {
|
|
|
248678
248728
|
resultRoot = resource.root.path;
|
|
248679
248729
|
searchDir = resource.path;
|
|
248680
248730
|
} else {
|
|
248681
|
-
searchDir = input.path ?
|
|
248731
|
+
searchDir = input.path ? resolveToolPath(ctx, input.path) : ctx.cwd;
|
|
248732
|
+
if (!checkWorkspaceBoundary(ctx.cwd, searchDir)) {
|
|
248733
|
+
resultRoot = searchDir;
|
|
248734
|
+
}
|
|
248682
248735
|
}
|
|
248683
248736
|
} catch (error) {
|
|
248684
248737
|
return {
|
|
@@ -248708,6 +248761,8 @@ var GrepTool = class {
|
|
|
248708
248761
|
args.push(searchDir);
|
|
248709
248762
|
const result = await execa("rg", args, {
|
|
248710
248763
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248764
|
+
env: buildToolChildEnvironment(ctx),
|
|
248765
|
+
extendEnv: false,
|
|
248711
248766
|
reject: false,
|
|
248712
248767
|
signal: ctx.abortSignal,
|
|
248713
248768
|
maxBuffer: 2 * 1024 * 1024
|
|
@@ -248818,14 +248873,14 @@ var ListFilesInputSchema = z52.object({
|
|
|
248818
248873
|
});
|
|
248819
248874
|
var ListFilesTool = class {
|
|
248820
248875
|
name = "list_files";
|
|
248821
|
-
description = "List files recursively in the project or an active skill:// resource with bounded depth/results, ignoring dependencies and build output folders.";
|
|
248876
|
+
description = "List files recursively in the project, any host directory when unrestricted Full Access is active, or an active skill:// resource with bounded depth/results, ignoring dependencies and build output folders.";
|
|
248822
248877
|
inputSchema = ListFilesInputSchema;
|
|
248823
248878
|
risk = "read";
|
|
248824
248879
|
async execute(input, ctx) {
|
|
248825
248880
|
try {
|
|
248826
248881
|
const skillUri = input.path ? parseSkillUri(input.path) : void 0;
|
|
248827
248882
|
const skillResource = skillUri ? resolveSkillResource(ctx, skillUri) : void 0;
|
|
248828
|
-
const targetDir = skillResource ? skillResource.path : input.path ?
|
|
248883
|
+
const targetDir = skillResource ? skillResource.path : input.path ? resolveToolPath(ctx, input.path) : ctx.cwd;
|
|
248829
248884
|
const files = await findWorkspaceFiles(targetDir, "**/*", {
|
|
248830
248885
|
deep: input.depth || 3,
|
|
248831
248886
|
dot: true
|
|
@@ -248859,13 +248914,15 @@ var ReadFileInputSchema = z62.object({
|
|
|
248859
248914
|
});
|
|
248860
248915
|
var ReadFileTool = class {
|
|
248861
248916
|
name = "read_file";
|
|
248862
|
-
description = "Read a project file or an active Skill resource addressed as skill://<skill-name>/<path>. Defaults to at most 400 lines and bounds oversized output for the model context.";
|
|
248917
|
+
description = "Read a project file, any host file when unrestricted Full Access is active, or an active Skill resource addressed as skill://<skill-name>/<path>. Defaults to at most 400 lines and bounds oversized output for the model context.";
|
|
248863
248918
|
inputSchema = ReadFileInputSchema;
|
|
248864
248919
|
risk = "read";
|
|
248865
248920
|
async execute(input, ctx) {
|
|
248866
248921
|
try {
|
|
248867
248922
|
const safePath = resolveReadableFile(ctx, input.path);
|
|
248868
|
-
const content = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES
|
|
248923
|
+
const content = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES, {
|
|
248924
|
+
allowSymbolicLink: hasFullHostAccess(ctx)
|
|
248925
|
+
});
|
|
248869
248926
|
if (content === void 0) {
|
|
248870
248927
|
throw new Error(`File not found: ${input.path}`);
|
|
248871
248928
|
}
|
|
@@ -248897,20 +248954,35 @@ var WriteFileInputSchema = z72.object({
|
|
|
248897
248954
|
});
|
|
248898
248955
|
var WriteFileTool = class {
|
|
248899
248956
|
name = "write_file";
|
|
248900
|
-
description = "Atomically write complete content inside the project. Use intent=create or overwrite when existence matters, and expectedHash to reject concurrent changes.";
|
|
248957
|
+
description = "Atomically write complete content inside the project, or to any host path when unrestricted Full Access is active. Use intent=create or overwrite when existence matters, and expectedHash to reject concurrent changes.";
|
|
248901
248958
|
inputSchema = WriteFileInputSchema;
|
|
248902
248959
|
risk = "write";
|
|
248903
248960
|
async execute(input, ctx) {
|
|
248904
248961
|
try {
|
|
248905
|
-
const safePath =
|
|
248906
|
-
const
|
|
248907
|
-
|
|
248962
|
+
const safePath = resolveToolPath(ctx, input.path);
|
|
248963
|
+
const fullHostAccess = hasFullHostAccess(ctx);
|
|
248964
|
+
let current;
|
|
248965
|
+
let currentContentKnown = true;
|
|
248966
|
+
try {
|
|
248967
|
+
current = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES);
|
|
248968
|
+
} catch (error) {
|
|
248969
|
+
if (!fullHostAccess) throw error;
|
|
248970
|
+
currentContentKnown = false;
|
|
248971
|
+
}
|
|
248972
|
+
const fileExists = currentContentKnown ? current !== void 0 : existsSync32(safePath);
|
|
248973
|
+
if (input.intent === "create" && fileExists) {
|
|
248908
248974
|
return { ok: false, error: `File already exists: ${input.path}` };
|
|
248909
248975
|
}
|
|
248910
|
-
if (input.intent === "overwrite" &&
|
|
248976
|
+
if (input.intent === "overwrite" && !fileExists) {
|
|
248911
248977
|
return { ok: false, error: `File does not exist: ${input.path}` };
|
|
248912
248978
|
}
|
|
248913
248979
|
if (input.expectedHash) {
|
|
248980
|
+
if (!currentContentKnown) {
|
|
248981
|
+
return {
|
|
248982
|
+
ok: false,
|
|
248983
|
+
error: `Cannot verify expectedHash because the existing file could not be read within tool bounds: ${input.path}`
|
|
248984
|
+
};
|
|
248985
|
+
}
|
|
248914
248986
|
if (current === void 0) {
|
|
248915
248987
|
return {
|
|
248916
248988
|
ok: false,
|
|
@@ -248925,11 +248997,14 @@ var WriteFileTool = class {
|
|
|
248925
248997
|
};
|
|
248926
248998
|
}
|
|
248927
248999
|
}
|
|
248928
|
-
|
|
249000
|
+
atomicWriteToolFile(
|
|
248929
249001
|
ctx.cwd,
|
|
248930
249002
|
input.path,
|
|
248931
249003
|
input.content,
|
|
248932
|
-
current ?? null
|
|
249004
|
+
currentContentKnown ? current ?? null : void 0,
|
|
249005
|
+
{
|
|
249006
|
+
allowOutsideWorkspace: fullHostAccess
|
|
249007
|
+
}
|
|
248933
249008
|
);
|
|
248934
249009
|
return {
|
|
248935
249010
|
ok: true,
|
|
@@ -248957,7 +249032,8 @@ var GitCommitTool = class {
|
|
|
248957
249032
|
const { stdout: stdout2 } = await execa("git", ["commit", "-m", commitMessage], {
|
|
248958
249033
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248959
249034
|
cwd: ctx.cwd,
|
|
248960
|
-
env:
|
|
249035
|
+
env: buildToolChildEnvironment(ctx),
|
|
249036
|
+
extendEnv: false,
|
|
248961
249037
|
signal: ctx.abortSignal
|
|
248962
249038
|
});
|
|
248963
249039
|
return {
|
|
@@ -248991,7 +249067,8 @@ var GitDiffTool = class {
|
|
|
248991
249067
|
const { stdout: stdout2 } = await execa("git", args, {
|
|
248992
249068
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248993
249069
|
cwd: ctx.cwd,
|
|
248994
|
-
env:
|
|
249070
|
+
env: buildToolChildEnvironment(ctx),
|
|
249071
|
+
extendEnv: false,
|
|
248995
249072
|
signal: ctx.abortSignal
|
|
248996
249073
|
});
|
|
248997
249074
|
const bounded = redactSecrets(LogTruncator.truncate(stdout2, 300, 4e4));
|
|
@@ -249031,7 +249108,8 @@ var GitRestoreTool = class {
|
|
|
249031
249108
|
{
|
|
249032
249109
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249033
249110
|
cwd: ctx.cwd,
|
|
249034
|
-
env:
|
|
249111
|
+
env: buildToolChildEnvironment(ctx),
|
|
249112
|
+
extendEnv: false,
|
|
249035
249113
|
signal: ctx.abortSignal
|
|
249036
249114
|
}
|
|
249037
249115
|
);
|
|
@@ -249059,7 +249137,8 @@ var GitStatusTool = class {
|
|
|
249059
249137
|
const { stdout: stdout2 } = await execa("git", ["status", "--short"], {
|
|
249060
249138
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249061
249139
|
cwd: ctx.cwd,
|
|
249062
|
-
env:
|
|
249140
|
+
env: buildToolChildEnvironment(ctx),
|
|
249141
|
+
extendEnv: false,
|
|
249063
249142
|
signal: ctx.abortSignal
|
|
249064
249143
|
});
|
|
249065
249144
|
return {
|
|
@@ -249094,11 +249173,11 @@ var DetectProjectTool = class {
|
|
|
249094
249173
|
const entrypoints = [];
|
|
249095
249174
|
const importantFiles = [];
|
|
249096
249175
|
const ignoredFiles = ["node_modules", ".git", "dist", "build"];
|
|
249097
|
-
if (
|
|
249176
|
+
if (existsSync42(join23(root, "package.json"))) {
|
|
249098
249177
|
languages.push("javascript", "typescript");
|
|
249099
|
-
if (
|
|
249100
|
-
else if (
|
|
249101
|
-
else if (
|
|
249178
|
+
if (existsSync42(join23(root, "pnpm-lock.yaml"))) packageManager2 = "pnpm";
|
|
249179
|
+
else if (existsSync42(join23(root, "yarn.lock"))) packageManager2 = "yarn";
|
|
249180
|
+
else if (existsSync42(join23(root, "bun.lockb"))) packageManager2 = "bun";
|
|
249102
249181
|
else packageManager2 = "npm";
|
|
249103
249182
|
try {
|
|
249104
249183
|
const raw = readBoundedRegularFile(
|
|
@@ -249126,35 +249205,35 @@ var DetectProjectTool = class {
|
|
|
249126
249205
|
} catch {
|
|
249127
249206
|
}
|
|
249128
249207
|
}
|
|
249129
|
-
if (
|
|
249208
|
+
if (existsSync42(join23(root, "requirements.txt")) || existsSync42(join23(root, "pyproject.toml")) || existsSync42(join23(root, "poetry.lock"))) {
|
|
249130
249209
|
languages.push("python");
|
|
249131
|
-
if (
|
|
249210
|
+
if (existsSync42(join23(root, "poetry.lock"))) packageManager2 = "poetry";
|
|
249132
249211
|
else packageManager2 = "pip";
|
|
249133
|
-
if (
|
|
249134
|
-
if (
|
|
249212
|
+
if (existsSync42(join23(root, "manage.py"))) frameworks.push("Django");
|
|
249213
|
+
if (existsSync42(join23(root, "main.py"))) entrypoints.push("main.py");
|
|
249135
249214
|
testCommands.push("pytest");
|
|
249136
249215
|
importantFiles.push("pyproject.toml");
|
|
249137
249216
|
}
|
|
249138
|
-
if (
|
|
249217
|
+
if (existsSync42(join23(root, "Cargo.toml"))) {
|
|
249139
249218
|
languages.push("rust");
|
|
249140
249219
|
packageManager2 = "cargo";
|
|
249141
249220
|
testCommands.push("cargo test");
|
|
249142
249221
|
buildCommands.push("cargo build");
|
|
249143
249222
|
importantFiles.push("Cargo.toml");
|
|
249144
|
-
if (
|
|
249223
|
+
if (existsSync42(join23(root, "src/main.rs")))
|
|
249145
249224
|
entrypoints.push("src/main.rs");
|
|
249146
|
-
if (
|
|
249225
|
+
if (existsSync42(join23(root, "src/lib.rs")))
|
|
249147
249226
|
entrypoints.push("src/lib.rs");
|
|
249148
249227
|
}
|
|
249149
|
-
if (
|
|
249228
|
+
if (existsSync42(join23(root, "go.mod"))) {
|
|
249150
249229
|
languages.push("go");
|
|
249151
249230
|
packageManager2 = "go";
|
|
249152
249231
|
testCommands.push("go test ./...");
|
|
249153
249232
|
buildCommands.push("go build ./...");
|
|
249154
249233
|
importantFiles.push("go.mod");
|
|
249155
|
-
if (
|
|
249234
|
+
if (existsSync42(join23(root, "main.go"))) entrypoints.push("main.go");
|
|
249156
249235
|
}
|
|
249157
|
-
if (
|
|
249236
|
+
if (existsSync42(join23(root, "pom.xml"))) {
|
|
249158
249237
|
languages.push("java");
|
|
249159
249238
|
packageManager2 = "maven";
|
|
249160
249239
|
testCommands.push("mvn test");
|
|
@@ -249224,7 +249303,7 @@ var SearchSymbolsTool = class {
|
|
|
249224
249303
|
async execute(input, ctx) {
|
|
249225
249304
|
try {
|
|
249226
249305
|
const indexPath = resolveSafePath(ctx.cwd, ".orbit/symbols.json");
|
|
249227
|
-
if (!
|
|
249306
|
+
if (!existsSync52(indexPath)) {
|
|
249228
249307
|
return {
|
|
249229
249308
|
ok: true,
|
|
249230
249309
|
data: [],
|
|
@@ -249295,7 +249374,7 @@ var FindSymbolReferencesTool = class {
|
|
|
249295
249374
|
async execute(input, ctx) {
|
|
249296
249375
|
try {
|
|
249297
249376
|
const indexPath = resolveSafePath(ctx.cwd, ".orbit/symbols.json");
|
|
249298
|
-
if (!
|
|
249377
|
+
if (!existsSync6(indexPath)) {
|
|
249299
249378
|
return {
|
|
249300
249379
|
ok: true,
|
|
249301
249380
|
data: [],
|
|
@@ -249328,7 +249407,7 @@ var FindSymbolReferencesTool = class {
|
|
|
249328
249407
|
} catch {
|
|
249329
249408
|
continue;
|
|
249330
249409
|
}
|
|
249331
|
-
if (
|
|
249410
|
+
if (existsSync6(absPath)) {
|
|
249332
249411
|
let lines;
|
|
249333
249412
|
try {
|
|
249334
249413
|
const content = await readBoundedRegularFileAsync(
|
|
@@ -249485,51 +249564,79 @@ function readProcessFailureMessage(result) {
|
|
|
249485
249564
|
const message2 = typeof record.shortMessage === "string" ? record.shortMessage : typeof record.message === "string" ? record.message : "The child process failed.";
|
|
249486
249565
|
return safeProcessFailureMessage(message2);
|
|
249487
249566
|
}
|
|
249488
|
-
function firstExistingPath(candidates, pathExists =
|
|
249567
|
+
function firstExistingPath(candidates, pathExists = existsSync7) {
|
|
249489
249568
|
for (const candidate of candidates) {
|
|
249490
249569
|
if (candidate && pathExists(candidate)) return candidate;
|
|
249491
249570
|
}
|
|
249492
249571
|
return null;
|
|
249493
249572
|
}
|
|
249573
|
+
function normalizePowerShellCommand(command) {
|
|
249574
|
+
const leadingWhitespace = command.match(/^\s*/)?.[0] ?? "";
|
|
249575
|
+
const trimmed = command.slice(leadingWhitespace.length);
|
|
249576
|
+
if (/^&(?:\s|$)/.test(trimmed)) return command;
|
|
249577
|
+
const quotedExecutable = trimmed.match(/^(["'])([^"']+)\1(?=\s|$)/);
|
|
249578
|
+
const executablePath = quotedExecutable?.[2];
|
|
249579
|
+
if (!executablePath || !/[\\/]/.test(executablePath) && !/\.(?:exe|cmd|bat|com|ps1)$/i.test(executablePath)) {
|
|
249580
|
+
return command;
|
|
249581
|
+
}
|
|
249582
|
+
return `${leadingWhitespace}& ${trimmed}`;
|
|
249583
|
+
}
|
|
249494
249584
|
function resolveCommandShellInvocation(command, options = {}) {
|
|
249495
249585
|
const platform = options.platform ?? process.platform;
|
|
249496
249586
|
const environment = options.environment ?? process.env;
|
|
249497
|
-
const pathExists = options.pathExists ??
|
|
249587
|
+
const pathExists = options.pathExists ?? existsSync7;
|
|
249498
249588
|
if (platform !== "win32") {
|
|
249499
|
-
const
|
|
249589
|
+
const bash = firstExistingPath(
|
|
249500
249590
|
[environment.ORBIT_BASH_PATH, "/bin/bash", "/usr/bin/bash"],
|
|
249501
249591
|
pathExists
|
|
249502
249592
|
);
|
|
249503
|
-
if (
|
|
249593
|
+
if (bash) {
|
|
249504
249594
|
return {
|
|
249505
|
-
file:
|
|
249506
|
-
args: ["--noprofile", "--norc", "-c", command]
|
|
249595
|
+
file: bash,
|
|
249596
|
+
args: ["--noprofile", "--norc", "-c", command],
|
|
249597
|
+
dialect: "bash"
|
|
249507
249598
|
};
|
|
249508
249599
|
}
|
|
249509
249600
|
return {
|
|
249510
249601
|
file: "/bin/sh",
|
|
249511
|
-
args: ["-c", command]
|
|
249602
|
+
args: ["-c", command],
|
|
249603
|
+
dialect: "sh"
|
|
249512
249604
|
};
|
|
249513
249605
|
}
|
|
249514
|
-
const
|
|
249606
|
+
const systemRoot = environment.SystemRoot || environment.WINDIR;
|
|
249607
|
+
const powershell = firstExistingPath(
|
|
249515
249608
|
[
|
|
249516
|
-
environment.
|
|
249517
|
-
environment.ProgramFiles ?
|
|
249518
|
-
environment
|
|
249519
|
-
|
|
249520
|
-
|
|
249609
|
+
environment.ORBIT_POWERSHELL_PATH,
|
|
249610
|
+
environment.ProgramFiles ? win322.join(environment.ProgramFiles, "PowerShell", "7", "pwsh.exe") : void 0,
|
|
249611
|
+
environment.ProgramW6432 ? win322.join(environment.ProgramW6432, "PowerShell", "7", "pwsh.exe") : void 0,
|
|
249612
|
+
systemRoot ? win322.join(
|
|
249613
|
+
systemRoot,
|
|
249614
|
+
"System32",
|
|
249615
|
+
"WindowsPowerShell",
|
|
249616
|
+
"v1.0",
|
|
249617
|
+
"powershell.exe"
|
|
249618
|
+
) : void 0
|
|
249521
249619
|
],
|
|
249522
249620
|
pathExists
|
|
249523
249621
|
);
|
|
249524
|
-
if (
|
|
249622
|
+
if (powershell) {
|
|
249623
|
+
const normalizedCommand = normalizePowerShellCommand(command);
|
|
249624
|
+
const script = [
|
|
249625
|
+
"$ErrorActionPreference = 'Stop'",
|
|
249626
|
+
"$global:LASTEXITCODE = 0",
|
|
249627
|
+
`& { ${normalizedCommand} }`,
|
|
249628
|
+
"if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }"
|
|
249629
|
+
].join("; ");
|
|
249525
249630
|
return {
|
|
249526
|
-
file:
|
|
249527
|
-
args: ["
|
|
249631
|
+
file: powershell,
|
|
249632
|
+
args: ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script],
|
|
249633
|
+
dialect: "powershell"
|
|
249528
249634
|
};
|
|
249529
249635
|
}
|
|
249530
249636
|
return {
|
|
249531
249637
|
file: environment.ComSpec?.trim() || "cmd.exe",
|
|
249532
|
-
args: ["/d", "/s", "/c", command]
|
|
249638
|
+
args: ["/d", "/s", "/c", command],
|
|
249639
|
+
dialect: "cmd"
|
|
249533
249640
|
};
|
|
249534
249641
|
}
|
|
249535
249642
|
var BashInputSchema = z17.object({
|
|
@@ -249539,7 +249646,7 @@ var BashInputSchema = z17.object({
|
|
|
249539
249646
|
});
|
|
249540
249647
|
var BashTool = class {
|
|
249541
249648
|
name = "bash";
|
|
249542
|
-
description = "Run a command in the
|
|
249649
|
+
description = process.platform === "win32" ? "Run a command in native Windows PowerShell. The working directory is already the project root: use PowerShell cmdlets and do not prepend cd or use POSIX grep/sed/head/tail/heredoc syntax. Set background=true only for dev servers, watchers, or long builds." : "Run a command in non-interactive Bash/POSIX sh. The working directory is already the project root; do not prepend cd. Set background=true only for dev servers, watchers, or long builds.";
|
|
249543
249650
|
inputSchema = BashInputSchema;
|
|
249544
249651
|
risk = "execute";
|
|
249545
249652
|
async execute(input, ctx) {
|
|
@@ -249559,6 +249666,7 @@ var BashTool = class {
|
|
|
249559
249666
|
command: input.command,
|
|
249560
249667
|
cwd: ctx.cwd,
|
|
249561
249668
|
sessionId: ctx.sessionId,
|
|
249669
|
+
environment: buildToolChildEnvironment(ctx),
|
|
249562
249670
|
...input.timeoutMs !== void 0 ? { timeoutMs: timeout } : {}
|
|
249563
249671
|
});
|
|
249564
249672
|
return {
|
|
@@ -249588,7 +249696,8 @@ var BashTool = class {
|
|
|
249588
249696
|
const result = await execa(invocation.file, invocation.args, {
|
|
249589
249697
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249590
249698
|
cwd: ctx.cwd,
|
|
249591
|
-
env:
|
|
249699
|
+
env: buildToolChildEnvironment(ctx),
|
|
249700
|
+
extendEnv: false,
|
|
249592
249701
|
timeout,
|
|
249593
249702
|
reject: false,
|
|
249594
249703
|
signal: ctx.abortSignal,
|
|
@@ -249632,7 +249741,8 @@ ${displayStderr}` : "",
|
|
|
249632
249741
|
truncated,
|
|
249633
249742
|
stdoutChars: stdout2.length,
|
|
249634
249743
|
stderrChars: stderr.length,
|
|
249635
|
-
outputLimitExceeded
|
|
249744
|
+
outputLimitExceeded,
|
|
249745
|
+
shellDialect: invocation.dialect
|
|
249636
249746
|
}
|
|
249637
249747
|
};
|
|
249638
249748
|
} catch (error) {
|
|
@@ -249652,6 +249762,7 @@ ${displayStderr}` : "",
|
|
|
249652
249762
|
var RunTestsInputSchema = z18.object({
|
|
249653
249763
|
command: z18.string().trim().min(1).max(1e5).optional()
|
|
249654
249764
|
});
|
|
249765
|
+
var ORBIT_TERMINAL_SUCCESS_MARKER = "[ORBIT_TERMINAL_SUCCESS]";
|
|
249655
249766
|
function classifyVerificationCommand(command) {
|
|
249656
249767
|
if (/[\r\n&]/.test(command) || /(?:--if-present|--passwithnotests|--allow-no-tests)(?:\s|=|$)/i.test(
|
|
249657
249768
|
command
|
|
@@ -249690,19 +249801,46 @@ function classifyVerificationCommand(command) {
|
|
|
249690
249801
|
)) {
|
|
249691
249802
|
return "test";
|
|
249692
249803
|
}
|
|
249693
|
-
if (/^(?:python(?:\.exe)? -m compileall|(?:"[^"]*[\\/])?node(?:\.exe)?"? --check)(?:\s|$)/i.test(
|
|
249804
|
+
if (/^(?:python(?:\.exe)? -m (?:compileall|py_compile)|(?:"[^"]*[\\/])?node(?:\.exe)?"? --check)(?:\s|$)/i.test(
|
|
249694
249805
|
normalized
|
|
249695
249806
|
)) {
|
|
249696
249807
|
return "syntax";
|
|
249697
249808
|
}
|
|
249809
|
+
if (/^python(?:\.exe)? (?:"[^"]*(?:[\\/](?:code|\.cumcm)[\\/]finalize\.py)"|'[^']*(?:[\\/](?:code|\.cumcm)[\\/]finalize\.py)'|(?:\S*[\\/])?(?:code|\.cumcm)[\\/]finalize\.py)(?:\s|$)/i.test(
|
|
249810
|
+
normalized
|
|
249811
|
+
)) {
|
|
249812
|
+
return "build";
|
|
249813
|
+
}
|
|
249698
249814
|
if (/^(?:cmake --build|dotnet build)(?:\s|$)/i.test(normalized)) {
|
|
249699
249815
|
return "build";
|
|
249700
249816
|
}
|
|
249701
249817
|
return void 0;
|
|
249702
249818
|
}
|
|
249819
|
+
function detectTrustedTerminalSuccess(command, cwd, output, exitCode) {
|
|
249820
|
+
if (exitCode !== 0 || classifyVerificationCommand(command) !== "build" || !output.includes(ORBIT_TERMINAL_SUCCESS_MARKER)) {
|
|
249821
|
+
return void 0;
|
|
249822
|
+
}
|
|
249823
|
+
const normalized = command.trim().replace(/\s+/g, " ");
|
|
249824
|
+
const match = /^python(?:\.exe)?\s+(?:"([^"]+)"|'([^']+)'|(\S+))(?=\s|$)/i.exec(
|
|
249825
|
+
normalized
|
|
249826
|
+
);
|
|
249827
|
+
const script = match?.[1] || match?.[2] || match?.[3];
|
|
249828
|
+
if (!script) return void 0;
|
|
249829
|
+
const actual = comparablePath(resolve32(cwd, script));
|
|
249830
|
+
const expected = [
|
|
249831
|
+
resolve32(cwd, ".cumcm", "finalize.py"),
|
|
249832
|
+
// Read compatibility for projects scaffolded by Orbit <= 0.8.3.
|
|
249833
|
+
resolve32(cwd, "code", "finalize.py")
|
|
249834
|
+
].map(comparablePath);
|
|
249835
|
+
return expected.includes(actual) ? "cumcm-finalizer" : void 0;
|
|
249836
|
+
}
|
|
249837
|
+
function comparablePath(value) {
|
|
249838
|
+
const normalized = value.replace(/\\/g, "/");
|
|
249839
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
249840
|
+
}
|
|
249703
249841
|
var RunTestsTool = class {
|
|
249704
249842
|
name = "run_tests";
|
|
249705
|
-
description = "Run
|
|
249843
|
+
description = "Run one standalone project verification command in the native OS shell. Recognized test, build, lint, typecheck, or syntax commands (including python -m py_compile) count toward the completion gate; arbitrary or piped shell commands do not. If omitted, Orbit auto-detects the project test runner.";
|
|
249706
249844
|
inputSchema = RunTestsInputSchema;
|
|
249707
249845
|
risk = "execute";
|
|
249708
249846
|
async execute(input, ctx) {
|
|
@@ -249718,7 +249856,8 @@ var RunTestsTool = class {
|
|
|
249718
249856
|
const result = await execa(invocation.file, invocation.args, {
|
|
249719
249857
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249720
249858
|
cwd: ctx.cwd,
|
|
249721
|
-
env:
|
|
249859
|
+
env: buildToolChildEnvironment(ctx),
|
|
249860
|
+
extendEnv: false,
|
|
249722
249861
|
reject: false,
|
|
249723
249862
|
signal: ctx.abortSignal,
|
|
249724
249863
|
timeout,
|
|
@@ -249735,6 +249874,13 @@ var RunTestsTool = class {
|
|
|
249735
249874
|
const failureMessage = readProcessFailureMessage(result);
|
|
249736
249875
|
const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
|
|
249737
249876
|
const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
|
|
249877
|
+
const terminalSuccess = detectTrustedTerminalSuccess(
|
|
249878
|
+
testCommand,
|
|
249879
|
+
ctx.cwd,
|
|
249880
|
+
`${stdout2}
|
|
249881
|
+
${stderr}`,
|
|
249882
|
+
exitCode
|
|
249883
|
+
);
|
|
249738
249884
|
const displayStdout = redactSecrets(
|
|
249739
249885
|
LogTruncator.truncate(stdout2, 150, 2e4)
|
|
249740
249886
|
);
|
|
@@ -249761,7 +249907,8 @@ Exit code: ${exitCode}`,
|
|
|
249761
249907
|
stderrChars: stderr.length,
|
|
249762
249908
|
outputLimitExceeded,
|
|
249763
249909
|
verificationEvidence: verificationKind !== void 0,
|
|
249764
|
-
...verificationKind ? { verificationKind } : {}
|
|
249910
|
+
...verificationKind ? { verificationKind } : {},
|
|
249911
|
+
...terminalSuccess ? { terminalSuccess } : {}
|
|
249765
249912
|
}
|
|
249766
249913
|
};
|
|
249767
249914
|
} catch (error) {
|
|
@@ -249778,36 +249925,36 @@ Exit code: ${exitCode}`,
|
|
|
249778
249925
|
}
|
|
249779
249926
|
}
|
|
249780
249927
|
inferTestCommand(cwd) {
|
|
249781
|
-
if (
|
|
249928
|
+
if (existsSync8(join32(cwd, "Cargo.toml"))) {
|
|
249782
249929
|
return "cargo test";
|
|
249783
249930
|
}
|
|
249784
|
-
if (
|
|
249931
|
+
if (existsSync8(join32(cwd, "go.mod"))) {
|
|
249785
249932
|
return "go test ./...";
|
|
249786
249933
|
}
|
|
249787
|
-
if (
|
|
249934
|
+
if (existsSync8(join32(cwd, "pom.xml"))) {
|
|
249788
249935
|
return "mvn test";
|
|
249789
249936
|
}
|
|
249790
|
-
if (
|
|
249937
|
+
if (existsSync8(join32(cwd, "build.gradle"))) {
|
|
249791
249938
|
return "./gradlew test";
|
|
249792
249939
|
}
|
|
249793
|
-
if (
|
|
249940
|
+
if (existsSync8(join32(cwd, "package.json"))) {
|
|
249794
249941
|
try {
|
|
249795
249942
|
const raw = readBoundedRegularFile(
|
|
249796
|
-
|
|
249943
|
+
join32(cwd, "package.json"),
|
|
249797
249944
|
1024 * 1024
|
|
249798
249945
|
);
|
|
249799
249946
|
if (raw === void 0) return "npm test";
|
|
249800
249947
|
const pkg = JSON.parse(raw);
|
|
249801
249948
|
if (pkg.scripts?.test) {
|
|
249802
|
-
if (
|
|
249803
|
-
if (
|
|
249949
|
+
if (existsSync8(join32(cwd, "pnpm-lock.yaml"))) return "pnpm test";
|
|
249950
|
+
if (existsSync8(join32(cwd, "yarn.lock"))) return "yarn test";
|
|
249804
249951
|
return "npm test";
|
|
249805
249952
|
}
|
|
249806
249953
|
} catch {
|
|
249807
249954
|
}
|
|
249808
249955
|
return "npm test";
|
|
249809
249956
|
}
|
|
249810
|
-
if (
|
|
249957
|
+
if (existsSync8(join32(cwd, "pytest.ini")) || existsSync8(join32(cwd, "pyproject.toml"))) {
|
|
249811
249958
|
return "pytest";
|
|
249812
249959
|
}
|
|
249813
249960
|
return "npm test";
|
|
@@ -249829,10 +249976,10 @@ var PUBLIC_DNS_ENDPOINTS = [
|
|
|
249829
249976
|
];
|
|
249830
249977
|
async function resolveSystemAddresses(hostname, signal, lookupImplementation = lookup) {
|
|
249831
249978
|
if (signal?.aborted) throw abortError("System DNS lookup was cancelled.");
|
|
249832
|
-
return new Promise((
|
|
249979
|
+
return new Promise((resolve43, reject) => {
|
|
249833
249980
|
const onAbort = () => reject(abortError("System DNS lookup was cancelled."));
|
|
249834
249981
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
249835
|
-
lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) =>
|
|
249982
|
+
lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) => resolve43(entries.map((entry) => entry.address))).catch(reject).finally(() => signal?.removeEventListener("abort", onAbort));
|
|
249836
249983
|
});
|
|
249837
249984
|
}
|
|
249838
249985
|
function createPublicDnsResolver(fetchImplementation = globalThis.fetch) {
|
|
@@ -249857,7 +250004,7 @@ function createPublicDnsResolver(fetchImplementation = globalThis.fetch) {
|
|
|
249857
250004
|
throw new Error(`Public DNS verification failed (${failures.join("; ")}).`);
|
|
249858
250005
|
};
|
|
249859
250006
|
}
|
|
249860
|
-
async function
|
|
250007
|
+
async function resolveHttpTarget(rawUrl, resolveAddresses = resolveSystemAddresses, resolvePublicAddresses = createPublicDnsResolver(), signal, options = {}) {
|
|
249861
250008
|
const url = new URL(rawUrl);
|
|
249862
250009
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
249863
250010
|
throw new Error("Only http:// and https:// URLs are supported.");
|
|
@@ -249866,10 +250013,10 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249866
250013
|
throw new Error("URLs containing credentials are not allowed.");
|
|
249867
250014
|
}
|
|
249868
250015
|
const hostname = url.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
249869
|
-
if (hostname === "localhost" || hostname.endsWith(".localhost") || hostname.endsWith(".local") || hostname.endsWith(".internal") || hostname.endsWith(".home.arpa")) {
|
|
250016
|
+
if (!options.allowPrivateNetwork && (hostname === "localhost" || hostname.endsWith(".localhost") || hostname.endsWith(".local") || hostname.endsWith(".internal") || hostname.endsWith(".home.arpa"))) {
|
|
249870
250017
|
throw new Error("Local and private network URLs are blocked.");
|
|
249871
250018
|
}
|
|
249872
|
-
if (isIP(hostname) > 0 && isPrivateOrReservedAddress(hostname)) {
|
|
250019
|
+
if (!options.allowPrivateNetwork && isIP(hostname) > 0 && isPrivateOrReservedAddress(hostname)) {
|
|
249873
250020
|
throw new Error(
|
|
249874
250021
|
"Local, private, or reserved network addresses are blocked."
|
|
249875
250022
|
);
|
|
@@ -249882,7 +250029,7 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249882
250029
|
throw new Error("The URL hostname did not resolve to an address.");
|
|
249883
250030
|
}
|
|
249884
250031
|
const syntheticAddresses = addresses.filter(isSyntheticProxyAddress);
|
|
249885
|
-
if (syntheticAddresses.length > 0) {
|
|
250032
|
+
if (!options.allowPrivateNetwork && syntheticAddresses.length > 0) {
|
|
249886
250033
|
if (syntheticAddresses.length !== addresses.length) {
|
|
249887
250034
|
throw new Error(
|
|
249888
250035
|
"The URL hostname resolved to a mixture of public and reserved addresses."
|
|
@@ -249897,7 +250044,7 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249897
250044
|
"The proxy-mapped hostname could not be verified as a public destination."
|
|
249898
250045
|
);
|
|
249899
250046
|
}
|
|
249900
|
-
} else if (addresses.some(isPrivateOrReservedAddress)) {
|
|
250047
|
+
} else if (!options.allowPrivateNetwork && addresses.some(isPrivateOrReservedAddress)) {
|
|
249901
250048
|
throw new Error(
|
|
249902
250049
|
"Local, private, or reserved network addresses are blocked."
|
|
249903
250050
|
);
|
|
@@ -250026,7 +250173,7 @@ var WEB_FETCH_MAX_BYTES = 1024 * 1024;
|
|
|
250026
250173
|
var WEB_FETCH_MAX_REDIRECTS = 5;
|
|
250027
250174
|
var WebFetchInputSchema = z20.object({
|
|
250028
250175
|
url: z20.string().url().max(8192).describe(
|
|
250029
|
-
"
|
|
250176
|
+
"HTTP(S) URL to read. Local and private targets require unrestricted Full Access."
|
|
250030
250177
|
),
|
|
250031
250178
|
maxChars: z20.number().int().min(1e3).max(5e4).describe("Maximum readable characters to return.").optional()
|
|
250032
250179
|
});
|
|
@@ -250044,7 +250191,7 @@ var WebFetchTool = class {
|
|
|
250044
250191
|
resolvePublicAddresses;
|
|
250045
250192
|
createDispatcher;
|
|
250046
250193
|
name = "web_fetch";
|
|
250047
|
-
description = "Read
|
|
250194
|
+
description = "Read bounded text from an HTTP(S) page. Local/private targets are blocked normally and available under unrestricted Full Access; URL credentials, binary responses, and unsafe redirects remain invalid inputs.";
|
|
250048
250195
|
inputSchema = WebFetchInputSchema;
|
|
250049
250196
|
risk = "network";
|
|
250050
250197
|
async execute(input, context) {
|
|
@@ -250060,11 +250207,15 @@ var WebFetchTool = class {
|
|
|
250060
250207
|
);
|
|
250061
250208
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
250062
250209
|
try {
|
|
250063
|
-
|
|
250210
|
+
const allowPrivateNetwork = Boolean(
|
|
250211
|
+
context.config && isFullAccessEnabled(context.config)
|
|
250212
|
+
);
|
|
250213
|
+
let currentTarget = await resolveHttpTarget(
|
|
250064
250214
|
input.url,
|
|
250065
250215
|
this.resolveAddresses,
|
|
250066
250216
|
this.resolvePublicAddresses,
|
|
250067
|
-
controller.signal
|
|
250217
|
+
controller.signal,
|
|
250218
|
+
{ allowPrivateNetwork }
|
|
250068
250219
|
);
|
|
250069
250220
|
for (let redirect = 0; redirect <= WEB_FETCH_MAX_REDIRECTS; redirect += 1) {
|
|
250070
250221
|
const lease = this.createDispatcher(
|
|
@@ -250101,11 +250252,12 @@ var WebFetchTool = class {
|
|
|
250101
250252
|
error: "Web fetch exceeded the redirect limit."
|
|
250102
250253
|
};
|
|
250103
250254
|
}
|
|
250104
|
-
currentTarget = await
|
|
250255
|
+
currentTarget = await resolveHttpTarget(
|
|
250105
250256
|
new URL(location, currentTarget.url).toString(),
|
|
250106
250257
|
this.resolveAddresses,
|
|
250107
250258
|
this.resolvePublicAddresses,
|
|
250108
|
-
controller.signal
|
|
250259
|
+
controller.signal,
|
|
250260
|
+
{ allowPrivateNetwork }
|
|
250109
250261
|
);
|
|
250110
250262
|
continue;
|
|
250111
250263
|
}
|
|
@@ -251086,7 +251238,7 @@ Diagnostics:
|
|
|
251086
251238
|
var TaskIdSchema = z222.string().regex(/^bg_[a-f0-9]{16}$/);
|
|
251087
251239
|
var GetBackgroundTaskOutputInputSchema = z222.object({
|
|
251088
251240
|
taskIds: z222.array(TaskIdSchema).min(1).max(20),
|
|
251089
|
-
waitMs: z222.number().int().min(0).
|
|
251241
|
+
waitMs: z222.number().int().min(0).transform((value) => Math.min(value, 3e4)).optional(),
|
|
251090
251242
|
waitFor: z222.enum(["any", "all"]).optional()
|
|
251091
251243
|
});
|
|
251092
251244
|
var KillBackgroundTaskInputSchema = z222.object({
|
|
@@ -251095,7 +251247,7 @@ var KillBackgroundTaskInputSchema = z222.object({
|
|
|
251095
251247
|
var ListBackgroundTasksInputSchema = z222.object({}).strict();
|
|
251096
251248
|
var GetBackgroundTaskOutputTool = class {
|
|
251097
251249
|
name = "get_background_task_output";
|
|
251098
|
-
description = "Get bounded output and status for one or more background tasks. Set waitMs to wait briefly for any or all tasks without polling or sleeping.";
|
|
251250
|
+
description = "Get bounded output and status for one or more background tasks. Set waitMs to wait briefly for any or all tasks without polling or sleeping; values above 30000 are safely capped to 30000.";
|
|
251099
251251
|
inputSchema = GetBackgroundTaskOutputInputSchema;
|
|
251100
251252
|
risk = "read";
|
|
251101
251253
|
async execute(input, ctx) {
|
|
@@ -251306,7 +251458,7 @@ var BackgroundTaskRuntime = class {
|
|
|
251306
251458
|
child = spawn(invocation.file, invocation.args, {
|
|
251307
251459
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
251308
251460
|
cwd: safeCwd,
|
|
251309
|
-
env: buildSanitizedChildEnvironment(),
|
|
251461
|
+
env: request.environment ? { ...request.environment } : buildSanitizedChildEnvironment(),
|
|
251310
251462
|
detached: process.platform !== "win32",
|
|
251311
251463
|
stdio: ["ignore", "pipe", "pipe"]
|
|
251312
251464
|
});
|
|
@@ -251316,8 +251468,8 @@ var BackgroundTaskRuntime = class {
|
|
|
251316
251468
|
);
|
|
251317
251469
|
}
|
|
251318
251470
|
let resolveCompletion = () => void 0;
|
|
251319
|
-
const completion = new Promise((
|
|
251320
|
-
resolveCompletion =
|
|
251471
|
+
const completion = new Promise((resolve43) => {
|
|
251472
|
+
resolveCompletion = resolve43;
|
|
251321
251473
|
});
|
|
251322
251474
|
const task = {
|
|
251323
251475
|
id,
|
|
@@ -251512,8 +251664,16 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
251512
251664
|
if (task.status !== "running") return;
|
|
251513
251665
|
task.requestedStop = status;
|
|
251514
251666
|
const gracefulSignalConfirmed = await signalProcessTree(task.child, false);
|
|
251667
|
+
if (process.platform === "win32" && gracefulSignalConfirmed && task.status === "running") {
|
|
251668
|
+
this.settleTask(task, status, task.child.exitCode);
|
|
251669
|
+
return;
|
|
251670
|
+
}
|
|
251515
251671
|
if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
|
|
251516
251672
|
const forcedSignalConfirmed = await signalProcessTree(task.child, true);
|
|
251673
|
+
if (process.platform === "win32" && forcedSignalConfirmed && task.status === "running") {
|
|
251674
|
+
this.settleTask(task, status, task.child.exitCode);
|
|
251675
|
+
return;
|
|
251676
|
+
}
|
|
251517
251677
|
if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
|
|
251518
251678
|
if (task.status === "running" && (task.child.exitCode !== null || task.child.signalCode !== null)) {
|
|
251519
251679
|
this.settleTask(
|
|
@@ -251524,10 +251684,6 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
251524
251684
|
);
|
|
251525
251685
|
return;
|
|
251526
251686
|
}
|
|
251527
|
-
if (process.platform === "win32" && task.status === "running" && (gracefulSignalConfirmed || forcedSignalConfirmed)) {
|
|
251528
|
-
this.settleTask(task, status, task.child.exitCode);
|
|
251529
|
-
return;
|
|
251530
|
-
}
|
|
251531
251687
|
throw new Error(
|
|
251532
251688
|
`Background task ${task.id} did not exit after graceful and forced termination.`
|
|
251533
251689
|
);
|
|
@@ -251562,12 +251718,12 @@ async function signalProcessTree(child, force) {
|
|
|
251562
251718
|
const pid = child.pid;
|
|
251563
251719
|
if (!pid) return false;
|
|
251564
251720
|
if (process.platform === "win32") {
|
|
251565
|
-
return new Promise((
|
|
251721
|
+
return new Promise((resolve43) => {
|
|
251566
251722
|
execFile(
|
|
251567
251723
|
"taskkill.exe",
|
|
251568
251724
|
["/pid", String(pid), "/t", ...force ? ["/f"] : []],
|
|
251569
251725
|
HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
251570
|
-
(error) =>
|
|
251726
|
+
(error) => resolve43(error === null)
|
|
251571
251727
|
);
|
|
251572
251728
|
});
|
|
251573
251729
|
}
|
|
@@ -251588,17 +251744,17 @@ async function waitWithTimeout(promise, timeoutMs, abortSignal) {
|
|
|
251588
251744
|
try {
|
|
251589
251745
|
return await Promise.race([
|
|
251590
251746
|
promise.then(() => true),
|
|
251591
|
-
new Promise((
|
|
251592
|
-
timeout = setTimeout(() =>
|
|
251747
|
+
new Promise((resolve43) => {
|
|
251748
|
+
timeout = setTimeout(() => resolve43(false), timeoutMs);
|
|
251593
251749
|
timeout.unref?.();
|
|
251594
251750
|
}),
|
|
251595
|
-
new Promise((
|
|
251751
|
+
new Promise((resolve43) => {
|
|
251596
251752
|
if (!abortSignal) return;
|
|
251597
251753
|
if (abortSignal.aborted) {
|
|
251598
|
-
|
|
251754
|
+
resolve43(false);
|
|
251599
251755
|
return;
|
|
251600
251756
|
}
|
|
251601
|
-
abortListener = () =>
|
|
251757
|
+
abortListener = () => resolve43(false);
|
|
251602
251758
|
abortSignal.addEventListener("abort", abortListener, { once: true });
|
|
251603
251759
|
})
|
|
251604
251760
|
]);
|
|
@@ -251625,41 +251781,41 @@ function errorMessage(error) {
|
|
|
251625
251781
|
|
|
251626
251782
|
// ../context-engine/dist/index.js
|
|
251627
251783
|
import { join as join6 } from "path";
|
|
251628
|
-
import { existsSync as
|
|
251784
|
+
import { existsSync as existsSync9 } from "fs";
|
|
251629
251785
|
import { pathToFileURL } from "url";
|
|
251630
251786
|
import { z as z25 } from "zod";
|
|
251631
251787
|
import { basename, join as join7 } from "path";
|
|
251632
251788
|
import { existsSync as existsSync43, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, renameSync as renameSync3, rmSync as rmSync2 } from "fs";
|
|
251633
251789
|
import { promises as fsPromises3 } from "fs";
|
|
251634
|
-
import { join as join24, dirname as dirname32, isAbsolute as
|
|
251790
|
+
import { join as join24, dirname as dirname32, isAbsolute as isAbsolute4, resolve as resolve33 } from "path";
|
|
251635
251791
|
import { createHash as createHash4, randomUUID as randomUUID32 } from "crypto";
|
|
251636
251792
|
import { execFile as execFile2 } from "child_process";
|
|
251637
251793
|
import glob3 from "fast-glob";
|
|
251638
251794
|
import { z as z43 } from "zod";
|
|
251639
251795
|
import { extname as extname2 } from "path";
|
|
251640
251796
|
import { existsSync as existsSync24, promises as fsPromises2 } from "fs";
|
|
251641
|
-
import { dirname as dirname5, resolve as
|
|
251797
|
+
import { dirname as dirname5, resolve as resolve5 } from "path";
|
|
251642
251798
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
251643
251799
|
import { z as z26 } from "zod";
|
|
251644
251800
|
import { existsSync as existsSync33, promises as fsPromises22 } from "fs";
|
|
251645
|
-
import { dirname as dirname22, resolve as
|
|
251801
|
+
import { dirname as dirname22, resolve as resolve24 } from "path";
|
|
251646
251802
|
import { randomUUID as randomUUID23 } from "crypto";
|
|
251647
251803
|
import { z as z35 } from "zod";
|
|
251648
251804
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
251649
251805
|
import { extname as extname22 } from "path";
|
|
251650
251806
|
import { resolve as resolve42 } from "path";
|
|
251651
251807
|
import { dirname as dirname52 } from "path";
|
|
251652
|
-
import { isAbsolute as
|
|
251808
|
+
import { isAbsolute as isAbsolute23, join as join33, resolve as resolve52 } from "path";
|
|
251653
251809
|
import { homedir as homedir4 } from "os";
|
|
251654
251810
|
import { existsSync as existsSync53, promises as fs2 } from "fs";
|
|
251655
251811
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
251656
251812
|
import { parse as parseYaml3 } from "yaml";
|
|
251657
251813
|
import { z as z53 } from "zod";
|
|
251658
|
-
import { dirname as dirname42, join as
|
|
251814
|
+
import { dirname as dirname42, join as join42 } from "path";
|
|
251659
251815
|
import { parse as parseYaml22 } from "yaml";
|
|
251660
251816
|
import { z as z63 } from "zod";
|
|
251661
251817
|
import { existsSync as existsSync62, lstatSync as lstatSync3, promises as fs22 } from "fs";
|
|
251662
|
-
import { dirname as dirname6, isAbsolute as isAbsolute32, join as join52, win32 as
|
|
251818
|
+
import { dirname as dirname6, isAbsolute as isAbsolute32, join as join52, win32 as win323 } from "path";
|
|
251663
251819
|
import { parse as parseYaml32 } from "yaml";
|
|
251664
251820
|
var ProjectIndexer = class {
|
|
251665
251821
|
constructor(cwd) {
|
|
@@ -251735,7 +251891,7 @@ var ReferencesRetriever = class {
|
|
|
251735
251891
|
*/
|
|
251736
251892
|
async getReferencesContext(symbols, maxReferencesPerSymbol = 3, maxTotalReferences = 10) {
|
|
251737
251893
|
const indexPath = getOrbitCachePath(this.cwd, "symbols.json");
|
|
251738
|
-
if (!
|
|
251894
|
+
if (!existsSync9(indexPath)) {
|
|
251739
251895
|
return "";
|
|
251740
251896
|
}
|
|
251741
251897
|
let index;
|
|
@@ -251981,7 +252137,7 @@ var JSVectorStore = class {
|
|
|
251981
252137
|
constructor(cwd, modelName) {
|
|
251982
252138
|
this.cwd = cwd;
|
|
251983
252139
|
this.modelName = modelName;
|
|
251984
|
-
this.dbPath =
|
|
252140
|
+
this.dbPath = resolve5(cwd, ".orbit", "vector_store.json");
|
|
251985
252141
|
}
|
|
251986
252142
|
cwd;
|
|
251987
252143
|
modelName;
|
|
@@ -252273,7 +252429,7 @@ function createRecord() {
|
|
|
252273
252429
|
var BM25Store = class {
|
|
252274
252430
|
constructor(cwd) {
|
|
252275
252431
|
this.cwd = cwd;
|
|
252276
|
-
this.dbPath =
|
|
252432
|
+
this.dbPath = resolve24(cwd, ".orbit", "bm25_store.json");
|
|
252277
252433
|
}
|
|
252278
252434
|
cwd;
|
|
252279
252435
|
docs = createRecord();
|
|
@@ -252887,7 +253043,7 @@ function embeddingBatches(texts) {
|
|
|
252887
253043
|
return batches;
|
|
252888
253044
|
}
|
|
252889
253045
|
function workspaceIndexKey(cwd) {
|
|
252890
|
-
const absolute =
|
|
253046
|
+
const absolute = resolve33(cwd).replace(/\\/g, "/");
|
|
252891
253047
|
return process.platform === "win32" ? absolute.toLowerCase() : absolute;
|
|
252892
253048
|
}
|
|
252893
253049
|
function resolveConfiguredApiKey(provider) {
|
|
@@ -253092,7 +253248,7 @@ function getEmbeddingProvider(config) {
|
|
|
253092
253248
|
var SymbolIndexer = class {
|
|
253093
253249
|
constructor(cwd) {
|
|
253094
253250
|
this.cwd = cwd;
|
|
253095
|
-
this.indexPath =
|
|
253251
|
+
this.indexPath = resolve33(cwd, ".orbit", "symbols.json");
|
|
253096
253252
|
}
|
|
253097
253253
|
cwd;
|
|
253098
253254
|
indexPath;
|
|
@@ -253114,9 +253270,9 @@ var SymbolIndexer = class {
|
|
|
253114
253270
|
async performIndex() {
|
|
253115
253271
|
try {
|
|
253116
253272
|
this.initializeIndexPath();
|
|
253117
|
-
const normCwd =
|
|
253273
|
+
const normCwd = resolve33(this.cwd).toLowerCase().replace(/\\/g, "/");
|
|
253118
253274
|
const { homedir: homedir22 } = await import("os");
|
|
253119
|
-
const normHome =
|
|
253275
|
+
const normHome = resolve33(homedir22()).toLowerCase().replace(/\\/g, "/");
|
|
253120
253276
|
if (normCwd === normHome || normCwd === "/" || /^[a-zA-Z]:\/$/.test(normCwd) || dirname32(normCwd) === normCwd) {
|
|
253121
253277
|
return;
|
|
253122
253278
|
}
|
|
@@ -253646,7 +253802,7 @@ var SymbolIndexer = class {
|
|
|
253646
253802
|
if (!parsed.success) return null;
|
|
253647
253803
|
const files = {};
|
|
253648
253804
|
for (const [filePath, fileIndex] of Object.entries(parsed.data.files)) {
|
|
253649
|
-
if (
|
|
253805
|
+
if (isAbsolute4(filePath)) continue;
|
|
253650
253806
|
try {
|
|
253651
253807
|
resolveSafePath(this.cwd, filePath);
|
|
253652
253808
|
files[filePath] = fileIndex;
|
|
@@ -253906,9 +254062,9 @@ function resolveSkillDirectory(cwd, directory) {
|
|
|
253906
254062
|
}
|
|
253907
254063
|
if (directory === "~") return homedir4();
|
|
253908
254064
|
if (directory.startsWith("~/") || directory.startsWith("~\\")) {
|
|
253909
|
-
return
|
|
254065
|
+
return resolve52(homedir4(), directory.slice(2));
|
|
253910
254066
|
}
|
|
253911
|
-
return
|
|
254067
|
+
return isAbsolute23(directory) ? resolve52(directory) : resolve52(cwd, directory);
|
|
253912
254068
|
}
|
|
253913
254069
|
function resolveBundledSkillsDirectory() {
|
|
253914
254070
|
const candidates = [
|
|
@@ -254099,7 +254255,7 @@ var SkillPresentationSchema = z63.object({
|
|
|
254099
254255
|
}).passthrough().optional()
|
|
254100
254256
|
}).passthrough();
|
|
254101
254257
|
async function loadSkillPresentation(skillFilePath) {
|
|
254102
|
-
const metadataPath =
|
|
254258
|
+
const metadataPath = join42(
|
|
254103
254259
|
dirname42(skillFilePath),
|
|
254104
254260
|
...PRESENTATION_SIDECAR_SEGMENTS
|
|
254105
254261
|
);
|
|
@@ -254457,7 +254613,7 @@ function validateReference(skill, reference, diagnostics) {
|
|
|
254457
254613
|
return;
|
|
254458
254614
|
}
|
|
254459
254615
|
if (!relativePath) return;
|
|
254460
|
-
if (isAbsolute32(relativePath) ||
|
|
254616
|
+
if (isAbsolute32(relativePath) || win323.isAbsolute(relativePath)) {
|
|
254461
254617
|
diagnostics.push(
|
|
254462
254618
|
diagnostic(
|
|
254463
254619
|
skill.path,
|
|
@@ -255591,7 +255747,7 @@ var MCPClient = class {
|
|
|
255591
255747
|
modernVersion,
|
|
255592
255748
|
this.effectiveClientVersion
|
|
255593
255749
|
) : params;
|
|
255594
|
-
const request = new Promise((
|
|
255750
|
+
const request = new Promise((resolve26, reject) => {
|
|
255595
255751
|
if (abortSignal?.aborted) {
|
|
255596
255752
|
reject(createAbortError(`MCP request "${method}" was cancelled.`));
|
|
255597
255753
|
return;
|
|
@@ -255638,7 +255794,7 @@ var MCPClient = class {
|
|
|
255638
255794
|
const removeAbortListener = abortSignal ? () => abortSignal.removeEventListener("abort", onAbort) : void 0;
|
|
255639
255795
|
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
255640
255796
|
this.pendingRequests.set(id, {
|
|
255641
|
-
resolve:
|
|
255797
|
+
resolve: resolve26,
|
|
255642
255798
|
reject,
|
|
255643
255799
|
timeout,
|
|
255644
255800
|
removeAbortListener
|
|
@@ -255728,14 +255884,14 @@ function waitForChildExit(child, timeoutMs) {
|
|
|
255728
255884
|
if (child.exitCode !== null || child.signalCode !== null) {
|
|
255729
255885
|
return Promise.resolve(true);
|
|
255730
255886
|
}
|
|
255731
|
-
return new Promise((
|
|
255887
|
+
return new Promise((resolve26) => {
|
|
255732
255888
|
let settled = false;
|
|
255733
255889
|
const finish = (exited) => {
|
|
255734
255890
|
if (settled) return;
|
|
255735
255891
|
settled = true;
|
|
255736
255892
|
clearTimeout(timeout);
|
|
255737
255893
|
child.removeListener("exit", onExit2);
|
|
255738
|
-
|
|
255894
|
+
resolve26(exited);
|
|
255739
255895
|
};
|
|
255740
255896
|
const onExit2 = () => finish(true);
|
|
255741
255897
|
const timeout = setTimeout(() => finish(false), timeoutMs);
|
|
@@ -256585,12 +256741,12 @@ function assertSecureMcpUrl(value, label) {
|
|
|
256585
256741
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
256586
256742
|
async function closeLoopbackServer(server2) {
|
|
256587
256743
|
if (!server2.listening) return;
|
|
256588
|
-
await new Promise((
|
|
256744
|
+
await new Promise((resolve26) => {
|
|
256589
256745
|
const forceClose = setTimeout(() => server2.closeAllConnections(), 250);
|
|
256590
256746
|
forceClose.unref();
|
|
256591
256747
|
server2.close(() => {
|
|
256592
256748
|
clearTimeout(forceClose);
|
|
256593
|
-
|
|
256749
|
+
resolve26();
|
|
256594
256750
|
});
|
|
256595
256751
|
server2.closeIdleConnections();
|
|
256596
256752
|
});
|
|
@@ -256613,10 +256769,10 @@ async function runMcpPkceLogin(options) {
|
|
|
256613
256769
|
const state = randomBytes(16).toString("base64url");
|
|
256614
256770
|
const server2 = http.createServer();
|
|
256615
256771
|
try {
|
|
256616
|
-
const port = await new Promise((
|
|
256772
|
+
const port = await new Promise((resolve26, reject) => {
|
|
256617
256773
|
server2.once("error", reject);
|
|
256618
256774
|
server2.listen(options.redirectPort ?? 0, "127.0.0.1", () => {
|
|
256619
|
-
|
|
256775
|
+
resolve26(server2.address().port);
|
|
256620
256776
|
});
|
|
256621
256777
|
});
|
|
256622
256778
|
const redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
@@ -256631,7 +256787,7 @@ async function runMcpPkceLogin(options) {
|
|
|
256631
256787
|
if (oauth.audience) {
|
|
256632
256788
|
authorizationUrl.searchParams.set("audience", oauth.audience);
|
|
256633
256789
|
}
|
|
256634
|
-
const code = await new Promise((
|
|
256790
|
+
const code = await new Promise((resolve26, reject) => {
|
|
256635
256791
|
let settled = false;
|
|
256636
256792
|
const cleanup = () => {
|
|
256637
256793
|
if (settled) return false;
|
|
@@ -256641,7 +256797,7 @@ async function runMcpPkceLogin(options) {
|
|
|
256641
256797
|
return true;
|
|
256642
256798
|
};
|
|
256643
256799
|
const succeed = (value) => {
|
|
256644
|
-
if (cleanup())
|
|
256800
|
+
if (cleanup()) resolve26(value);
|
|
256645
256801
|
};
|
|
256646
256802
|
const fail = (error) => {
|
|
256647
256803
|
if (cleanup()) reject(error);
|
|
@@ -257095,6 +257251,13 @@ var PermissionEngine = class {
|
|
|
257095
257251
|
} else if (toolName === "git_restore") {
|
|
257096
257252
|
risk = "dangerous";
|
|
257097
257253
|
}
|
|
257254
|
+
if (isFullAccessEnabled(this.config)) {
|
|
257255
|
+
return {
|
|
257256
|
+
action: "allow",
|
|
257257
|
+
reason: "Allowed by Full Access.",
|
|
257258
|
+
risk
|
|
257259
|
+
};
|
|
257260
|
+
}
|
|
257098
257261
|
if (this.config.permissions.protectSecrets && targetPath && RiskClassifier.isProtectedPath(targetPath, protectedPaths)) {
|
|
257099
257262
|
if (mode === "strict") {
|
|
257100
257263
|
return {
|
|
@@ -257139,7 +257302,7 @@ var PermissionEngine = class {
|
|
|
257139
257302
|
if (mode === "auto") {
|
|
257140
257303
|
return {
|
|
257141
257304
|
action: "ask",
|
|
257142
|
-
reason: `Full Access
|
|
257305
|
+
reason: `Auto mode is not configured as complete Full Access, so confirmation is required because ${indirection.reason}. Inline interpreters can bypass workspace and secret path inspection.`,
|
|
257143
257306
|
risk
|
|
257144
257307
|
};
|
|
257145
257308
|
}
|
|
@@ -257329,7 +257492,7 @@ function firstString(...values) {
|
|
|
257329
257492
|
|
|
257330
257493
|
// ../sandbox/dist/index.js
|
|
257331
257494
|
import {
|
|
257332
|
-
existsSync as
|
|
257495
|
+
existsSync as existsSync10,
|
|
257333
257496
|
lstatSync as lstatSync4,
|
|
257334
257497
|
mkdirSync as mkdirSync4,
|
|
257335
257498
|
readdirSync as readdirSync2,
|
|
@@ -257445,7 +257608,7 @@ var CheckpointManager = class {
|
|
|
257445
257608
|
}
|
|
257446
257609
|
loadPersistedCheckpoints() {
|
|
257447
257610
|
const sessionDir = this.getSessionCheckpointDir();
|
|
257448
|
-
if (!
|
|
257611
|
+
if (!existsSync10(sessionDir)) return;
|
|
257449
257612
|
const loaded = [];
|
|
257450
257613
|
for (const entry of readdirSync2(sessionDir, { withFileTypes: true })) {
|
|
257451
257614
|
if (!entry.isDirectory() || !CheckpointIdSchema.safeParse(entry.name).success) {
|
|
@@ -257453,7 +257616,7 @@ var CheckpointManager = class {
|
|
|
257453
257616
|
}
|
|
257454
257617
|
const checkpointDir = resolveSafePath(sessionDir, entry.name);
|
|
257455
257618
|
const metaPath = resolveSafePath(checkpointDir, "meta.json");
|
|
257456
|
-
if (!
|
|
257619
|
+
if (!existsSync10(metaPath)) continue;
|
|
257457
257620
|
try {
|
|
257458
257621
|
const parsed = PersistedCheckpointMetadataSchema.safeParse(
|
|
257459
257622
|
JSON.parse(
|
|
@@ -257492,7 +257655,7 @@ var CheckpointManager = class {
|
|
|
257492
257655
|
*/
|
|
257493
257656
|
readPersistedBackup(checkpointDir) {
|
|
257494
257657
|
const encryptedPath = resolveSafePath(checkpointDir, "backup_content.enc");
|
|
257495
|
-
if (
|
|
257658
|
+
if (existsSync10(encryptedPath)) {
|
|
257496
257659
|
const key = this.resolveEncryptionKey();
|
|
257497
257660
|
if (!key) return null;
|
|
257498
257661
|
try {
|
|
@@ -257506,7 +257669,7 @@ var CheckpointManager = class {
|
|
|
257506
257669
|
}
|
|
257507
257670
|
}
|
|
257508
257671
|
const plaintextPath = resolveSafePath(checkpointDir, "backup_content.txt");
|
|
257509
|
-
if (!
|
|
257672
|
+
if (!existsSync10(plaintextPath)) return null;
|
|
257510
257673
|
return readBoundedRegularFile(plaintextPath, CHECKPOINT_CONTENT_MAX_BYTES) ?? null;
|
|
257511
257674
|
}
|
|
257512
257675
|
async captureBeforeState(toolCallId, filePath) {
|
|
@@ -257514,7 +257677,7 @@ var CheckpointManager = class {
|
|
|
257514
257677
|
const validFilePath = z29.string().min(1).max(4096).parse(filePath);
|
|
257515
257678
|
const safePath = resolveSafePath(this.cwd, validFilePath);
|
|
257516
257679
|
let originalContent = null;
|
|
257517
|
-
if (
|
|
257680
|
+
if (existsSync10(safePath)) {
|
|
257518
257681
|
const stats = lstatSync4(safePath);
|
|
257519
257682
|
if (!stats.isFile() && !stats.isSymbolicLink()) {
|
|
257520
257683
|
throw new Error(`Checkpoint target must be a file: ${validFilePath}`);
|
|
@@ -257591,7 +257754,7 @@ var CheckpointManager = class {
|
|
|
257591
257754
|
this.getSessionCheckpointDir(),
|
|
257592
257755
|
checkpointId
|
|
257593
257756
|
);
|
|
257594
|
-
if (
|
|
257757
|
+
if (existsSync10(checkpointDir)) {
|
|
257595
257758
|
rmSync3(checkpointDir, { recursive: true, force: true });
|
|
257596
257759
|
}
|
|
257597
257760
|
}
|
|
@@ -258035,10 +258198,10 @@ function toErrorMessage2(error) {
|
|
|
258035
258198
|
// ../session/dist/index.js
|
|
258036
258199
|
import { z as z30 } from "zod";
|
|
258037
258200
|
import { createHash as createHash6, randomUUID as randomUUID6 } from "crypto";
|
|
258038
|
-
import { dirname as dirname8, isAbsolute as
|
|
258201
|
+
import { dirname as dirname8, isAbsolute as isAbsolute5, join as join9, relative as relative5, resolve as resolve7, sep } from "path";
|
|
258039
258202
|
import {
|
|
258040
258203
|
closeSync as closeSync5,
|
|
258041
|
-
existsSync as
|
|
258204
|
+
existsSync as existsSync11,
|
|
258042
258205
|
fsyncSync as fsyncSync4,
|
|
258043
258206
|
lstatSync as lstatSync5,
|
|
258044
258207
|
mkdirSync as mkdirSync5,
|
|
@@ -258060,7 +258223,7 @@ import {
|
|
|
258060
258223
|
unlinkSync as unlinkSync4
|
|
258061
258224
|
} from "fs";
|
|
258062
258225
|
import { homedir as homedir5 } from "os";
|
|
258063
|
-
import { basename as basename2, dirname as dirname23, isAbsolute as
|
|
258226
|
+
import { basename as basename2, dirname as dirname23, isAbsolute as isAbsolute24, join as join25, parse as parse2, resolve as resolve25 } from "path";
|
|
258064
258227
|
import { z as z37 } from "zod";
|
|
258065
258228
|
import {
|
|
258066
258229
|
closeSync as closeSync32,
|
|
@@ -258071,7 +258234,7 @@ import {
|
|
|
258071
258234
|
readdirSync as readdirSync22,
|
|
258072
258235
|
unlinkSync as unlinkSync22
|
|
258073
258236
|
} from "fs";
|
|
258074
|
-
import { basename as basename22, join as join34, resolve as
|
|
258237
|
+
import { basename as basename22, join as join34, resolve as resolve34 } from "path";
|
|
258075
258238
|
import { z as z45 } from "zod";
|
|
258076
258239
|
var SafeObjectKeySchema = z30.string().refine(
|
|
258077
258240
|
(key) => !["__proto__", "constructor", "prototype"].includes(key),
|
|
@@ -258490,7 +258653,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258490
258653
|
const backupPath = `${destinationPath}.${process.pid}.${randomUUID6()}.bak`;
|
|
258491
258654
|
let previousMoved = false;
|
|
258492
258655
|
try {
|
|
258493
|
-
if (
|
|
258656
|
+
if (existsSync11(destinationPath)) {
|
|
258494
258657
|
renameSync5(destinationPath, backupPath);
|
|
258495
258658
|
previousMoved = true;
|
|
258496
258659
|
}
|
|
@@ -258502,7 +258665,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258502
258665
|
}
|
|
258503
258666
|
}
|
|
258504
258667
|
} catch (error) {
|
|
258505
|
-
if (previousMoved &&
|
|
258668
|
+
if (previousMoved && existsSync11(backupPath) && !existsSync11(destinationPath)) {
|
|
258506
258669
|
try {
|
|
258507
258670
|
renameSync5(backupPath, destinationPath);
|
|
258508
258671
|
} catch {
|
|
@@ -258510,7 +258673,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258510
258673
|
}
|
|
258511
258674
|
throw error;
|
|
258512
258675
|
} finally {
|
|
258513
|
-
if (
|
|
258676
|
+
if (existsSync11(destinationPath)) {
|
|
258514
258677
|
try {
|
|
258515
258678
|
rmSync4(backupPath, { force: true });
|
|
258516
258679
|
} catch {
|
|
@@ -258561,7 +258724,7 @@ function sanitizeTraceJsonText(text2, cwd) {
|
|
|
258561
258724
|
function normalizeTracePath(filePath, cwd) {
|
|
258562
258725
|
const absolute = resolve7(cwd, filePath);
|
|
258563
258726
|
const relativePath = relative5(cwd, absolute);
|
|
258564
|
-
if (relativePath && !relativePath.startsWith("..") && !
|
|
258727
|
+
if (relativePath && !relativePath.startsWith("..") && !isAbsolute5(relativePath)) {
|
|
258565
258728
|
return relativePath.split(sep).join("/");
|
|
258566
258729
|
}
|
|
258567
258730
|
return replaceWorkspacePath(filePath, cwd);
|
|
@@ -258615,9 +258778,9 @@ var SessionStore = class {
|
|
|
258615
258778
|
} catch {
|
|
258616
258779
|
return void 0;
|
|
258617
258780
|
}
|
|
258618
|
-
if (!
|
|
258781
|
+
if (!existsSync11(sessionFile)) return void 0;
|
|
258619
258782
|
for (const candidate of [sessionFile, `${sessionFile}.bak`]) {
|
|
258620
|
-
if (!
|
|
258783
|
+
if (!existsSync11(candidate)) continue;
|
|
258621
258784
|
const parsed = readValidatedSnapshot(candidate, SessionSchema);
|
|
258622
258785
|
if (parsed?.id === id) return parsed;
|
|
258623
258786
|
}
|
|
@@ -258640,7 +258803,7 @@ var SessionStore = class {
|
|
|
258640
258803
|
let dirs;
|
|
258641
258804
|
try {
|
|
258642
258805
|
sessionRoot = this.resolveSessionRoot();
|
|
258643
|
-
if (!
|
|
258806
|
+
if (!existsSync11(sessionRoot)) return [];
|
|
258644
258807
|
dirs = readdirSync3(sessionRoot);
|
|
258645
258808
|
} catch {
|
|
258646
258809
|
return [];
|
|
@@ -258673,7 +258836,7 @@ var SessionStore = class {
|
|
|
258673
258836
|
} catch {
|
|
258674
258837
|
return [];
|
|
258675
258838
|
}
|
|
258676
|
-
if (!
|
|
258839
|
+
if (!existsSync11(file)) return [];
|
|
258677
258840
|
let content;
|
|
258678
258841
|
try {
|
|
258679
258842
|
content = readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "";
|
|
@@ -258757,7 +258920,7 @@ var SessionStore = class {
|
|
|
258757
258920
|
return void 0;
|
|
258758
258921
|
}
|
|
258759
258922
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258760
|
-
if (!
|
|
258923
|
+
if (!existsSync11(candidate)) continue;
|
|
258761
258924
|
const parsed = readValidatedSnapshot(candidate, RunJournalSchema);
|
|
258762
258925
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258763
258926
|
}
|
|
@@ -258841,7 +259004,7 @@ var SessionStore = class {
|
|
|
258841
259004
|
return void 0;
|
|
258842
259005
|
}
|
|
258843
259006
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258844
|
-
if (!
|
|
259007
|
+
if (!existsSync11(candidate)) continue;
|
|
258845
259008
|
const parsed = readValidatedSnapshot(candidate, TaskPlanSchema);
|
|
258846
259009
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258847
259010
|
}
|
|
@@ -258868,7 +259031,7 @@ var SessionStore = class {
|
|
|
258868
259031
|
return void 0;
|
|
258869
259032
|
}
|
|
258870
259033
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258871
|
-
if (!
|
|
259034
|
+
if (!existsSync11(candidate)) continue;
|
|
258872
259035
|
const parsed = readValidatedSnapshot(candidate, AgentInputQueueSchema);
|
|
258873
259036
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258874
259037
|
}
|
|
@@ -258926,7 +259089,7 @@ var SessionStore = class {
|
|
|
258926
259089
|
} catch {
|
|
258927
259090
|
return [];
|
|
258928
259091
|
}
|
|
258929
|
-
if (!
|
|
259092
|
+
if (!existsSync11(file)) return [];
|
|
258930
259093
|
try {
|
|
258931
259094
|
return (readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "").split("\n").filter((line) => line.trim()).flatMap((line) => {
|
|
258932
259095
|
try {
|
|
@@ -258953,7 +259116,7 @@ var SessionStore = class {
|
|
|
258953
259116
|
if (startIndex === previous.length && startIndex === validated.length)
|
|
258954
259117
|
return;
|
|
258955
259118
|
const priorWrites = this.historyJournalWrites.get(sessionId) ?? 0;
|
|
258956
|
-
if (!
|
|
259119
|
+
if (!existsSync11(historyPath) || priorWrites < 2) {
|
|
258957
259120
|
writeJsonAtomically(historyPath, validated, StoredHistorySchema);
|
|
258958
259121
|
rmSync4(journalPath, { force: true });
|
|
258959
259122
|
this.historyJournalWrites.set(sessionId, priorWrites + 1);
|
|
@@ -258987,14 +259150,14 @@ var SessionStore = class {
|
|
|
258987
259150
|
readHistoryFiles(snapshotPath, journalPath) {
|
|
258988
259151
|
let history = [];
|
|
258989
259152
|
for (const candidate of [snapshotPath, `${snapshotPath}.bak`]) {
|
|
258990
|
-
if (!
|
|
259153
|
+
if (!existsSync11(candidate)) continue;
|
|
258991
259154
|
const parsed = readValidatedSnapshot(candidate, StoredHistorySchema);
|
|
258992
259155
|
if (parsed) {
|
|
258993
259156
|
history = parsed;
|
|
258994
259157
|
break;
|
|
258995
259158
|
}
|
|
258996
259159
|
}
|
|
258997
|
-
if (!
|
|
259160
|
+
if (!existsSync11(journalPath)) return history;
|
|
258998
259161
|
try {
|
|
258999
259162
|
const journal = readBoundedRegularFile(
|
|
259000
259163
|
journalPath,
|
|
@@ -259017,7 +259180,7 @@ var SessionStore = class {
|
|
|
259017
259180
|
deleteSession(id) {
|
|
259018
259181
|
SessionIdSchema.parse(id);
|
|
259019
259182
|
const dir = this.resolveSessionDirectory(id);
|
|
259020
|
-
if (
|
|
259183
|
+
if (existsSync11(dir)) {
|
|
259021
259184
|
rmSync4(dir, { recursive: true, force: true });
|
|
259022
259185
|
}
|
|
259023
259186
|
}
|
|
@@ -259040,7 +259203,7 @@ var SessionStore = class {
|
|
|
259040
259203
|
if (sessionRoot === this.cwd) {
|
|
259041
259204
|
throw new Error("Orbit session root cannot be the workspace root.");
|
|
259042
259205
|
}
|
|
259043
|
-
if (
|
|
259206
|
+
if (existsSync11(sessionRoot)) {
|
|
259044
259207
|
const rootStats = lstatSync5(sessionRoot);
|
|
259045
259208
|
if (rootStats.isSymbolicLink() || !rootStats.isDirectory()) {
|
|
259046
259209
|
throw new Error("Orbit session root must be a real directory.");
|
|
@@ -259053,10 +259216,10 @@ var SessionStore = class {
|
|
|
259053
259216
|
const sessionRoot = this.resolveSessionRoot();
|
|
259054
259217
|
const resolved = resolveSafePath(this.cwd, join9(sessionRoot, validId));
|
|
259055
259218
|
const relativePath = relative5(sessionRoot, resolved);
|
|
259056
|
-
if (relativePath !== validId || relativePath.includes(sep) ||
|
|
259219
|
+
if (relativePath !== validId || relativePath.includes(sep) || isAbsolute5(relativePath)) {
|
|
259057
259220
|
throw new Error(`Invalid session directory: ${id}`);
|
|
259058
259221
|
}
|
|
259059
|
-
if (
|
|
259222
|
+
if (existsSync11(resolved)) {
|
|
259060
259223
|
const stats = lstatSync5(resolved);
|
|
259061
259224
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
259062
259225
|
throw new Error(`Invalid session directory: ${id}`);
|
|
@@ -259498,7 +259661,7 @@ function parseProjectRegistrySnapshot(value) {
|
|
|
259498
259661
|
var ProjectRegistry = class {
|
|
259499
259662
|
filePath;
|
|
259500
259663
|
constructor(rootPath = join25(homedir5(), ".orbit")) {
|
|
259501
|
-
const root =
|
|
259664
|
+
const root = resolve25(rootPath);
|
|
259502
259665
|
this.filePath = join25(root, "projects.json");
|
|
259503
259666
|
}
|
|
259504
259667
|
register(projectPath, sessionId) {
|
|
@@ -259657,9 +259820,9 @@ var ProjectRegistry = class {
|
|
|
259657
259820
|
}
|
|
259658
259821
|
};
|
|
259659
259822
|
function canonicalizeProjectPath(projectPath) {
|
|
259660
|
-
if (!
|
|
259823
|
+
if (!isAbsolute24(projectPath))
|
|
259661
259824
|
throw new Error("Project path must be absolute.");
|
|
259662
|
-
const requested =
|
|
259825
|
+
const requested = resolve25(projectPath);
|
|
259663
259826
|
if (requested === parse2(requested).root) {
|
|
259664
259827
|
throw new Error(
|
|
259665
259828
|
"A filesystem root cannot be registered as an Orbit project."
|
|
@@ -259762,7 +259925,7 @@ var AgentRunSchema = z45.object({
|
|
|
259762
259925
|
var AgentRunStore = class {
|
|
259763
259926
|
constructor(cwd, options = {}) {
|
|
259764
259927
|
this.cwd = cwd;
|
|
259765
|
-
this.directory =
|
|
259928
|
+
this.directory = resolve34(cwd, ".orbit", "agent-runs");
|
|
259766
259929
|
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
259767
259930
|
this.ownerPid = options.ownerPid ?? process.pid;
|
|
259768
259931
|
this.ownerInstanceId = options.ownerInstanceId ?? generateId("orbit");
|
|
@@ -260093,7 +260256,7 @@ var AgentRunStore = class {
|
|
|
260093
260256
|
this.cwd,
|
|
260094
260257
|
join34(".orbit", "agent-runs")
|
|
260095
260258
|
);
|
|
260096
|
-
if (
|
|
260259
|
+
if (resolve34(safeDirectory) !== this.directory) {
|
|
260097
260260
|
throw new Error("Orbit agent-run directory escaped the workspace.");
|
|
260098
260261
|
}
|
|
260099
260262
|
}
|
|
@@ -260453,7 +260616,7 @@ var PromptCacheSlabBuilder = class {
|
|
|
260453
260616
|
}
|
|
260454
260617
|
static buildDiagnostics(cwd) {
|
|
260455
260618
|
const dir = join10(cwd, ".orbit", "cache-slabs");
|
|
260456
|
-
if (!
|
|
260619
|
+
if (!existsSync12(dir)) {
|
|
260457
260620
|
return [
|
|
260458
260621
|
"Cache diagnostics:",
|
|
260459
260622
|
"- No cache slab metadata found yet.",
|
|
@@ -261059,14 +261222,14 @@ var StepRunner = class {
|
|
|
261059
261222
|
let cancellationCause;
|
|
261060
261223
|
let cancelExecution;
|
|
261061
261224
|
const cancellation = new Promise(
|
|
261062
|
-
(
|
|
261225
|
+
(resolve26) => {
|
|
261063
261226
|
cancelExecution = (cause) => {
|
|
261064
261227
|
if (cancellationCause) return;
|
|
261065
261228
|
cancellationCause = cause;
|
|
261066
261229
|
if (!executionController.signal.aborted) {
|
|
261067
261230
|
executionController.abort(cause);
|
|
261068
261231
|
}
|
|
261069
|
-
|
|
261232
|
+
resolve26({ kind: cause });
|
|
261070
261233
|
};
|
|
261071
261234
|
}
|
|
261072
261235
|
);
|
|
@@ -261124,7 +261287,7 @@ function getErrorMessage(error) {
|
|
|
261124
261287
|
return error instanceof Error ? error.message : String(error);
|
|
261125
261288
|
}
|
|
261126
261289
|
var Planner = class {
|
|
261127
|
-
static makeSystemPrompt(modelName = "DeepSeek", language = "en", providerId, sessionGoal, projectMemory, taskPlan, supportsThinking = false) {
|
|
261290
|
+
static makeSystemPrompt(modelName = "DeepSeek", language = "en", providerId, sessionGoal, projectMemory, taskPlan, supportsThinking = false, platform = process.platform) {
|
|
261128
261291
|
const cleanModel = cleanRuntimeLabel(modelName, "unknown-model");
|
|
261129
261292
|
const cleanProviderId = cleanRuntimeLabel(providerId || "", "");
|
|
261130
261293
|
const normalizedProvider = cleanProviderId.toLowerCase();
|
|
@@ -261169,6 +261332,7 @@ Active Task Plan:
|
|
|
261169
261332
|
${planItems.map((item) => `- ${item}`).join("\n")}
|
|
261170
261333
|
- Continue from the current in-progress item and keep plan status accurate.
|
|
261171
261334
|
` : "";
|
|
261335
|
+
const shellSection = runtimeShellGuidance(platform);
|
|
261172
261336
|
const prompt = `You are Orbit, a local AI coding agent running inside the user's terminal, powered by ${providerName} (model: ${cleanModel}).
|
|
261173
261337
|
Your job is to help the user modify, debug, test, document, and understand software projects.
|
|
261174
261338
|
You have tools for reading files, searching code, editing files, running commands, inspecting git status, and managing diffs.
|
|
@@ -261183,6 +261347,14 @@ Self-Identity Rules:
|
|
|
261183
261347
|
Language Rules:
|
|
261184
261348
|
${language !== "en" ? "- Reply in Simplified Chinese by default unless the user explicitly asks for another language. Keep commands, file paths, code identifiers, API names, and quoted source text in their original language." : "- Reply in the user's language when it is clear from their message. If the language is ambiguous, use concise English. Keep commands, file paths, code identifiers, API names, and quoted source text in their original language."}
|
|
261185
261349
|
|
|
261350
|
+
Runtime and tool rules:
|
|
261351
|
+
${shellSection}
|
|
261352
|
+
- Shell commands already start in the workspace root. Do not prepend cd/chdir or repeat the absolute workspace path.
|
|
261353
|
+
- Prefer read_file, grep, glob, and edit_file over shell commands that merely read, search, or rewrite text. Use the shell for actual project executables, builds, tests, and operating-system tasks.
|
|
261354
|
+
- Keep each command single-purpose and directly executable in the declared shell. Avoid nested command strings, inline script heredocs, output-suppression pipelines, and byte-level probes when a structured file tool can answer the question.
|
|
261355
|
+
- For background work, poll with get_background_task_output using waitMs at most 30000. Read and obey tool validation ranges instead of retrying invalid inputs.
|
|
261356
|
+
- After a command failure, use its first actionable diagnostic to change the command or repair the cause. Do not repeat near-identical probes that return the same evidence.
|
|
261357
|
+
|
|
261186
261358
|
Core rules:
|
|
261187
261359
|
1. Understand the project before editing.
|
|
261188
261360
|
2. Prefer minimal, precise changes.
|
|
@@ -261205,6 +261377,21 @@ Core rules:
|
|
|
261205
261377
|
return prompt;
|
|
261206
261378
|
}
|
|
261207
261379
|
};
|
|
261380
|
+
function runtimeShellGuidance(platform) {
|
|
261381
|
+
if (platform === "win32") {
|
|
261382
|
+
return [
|
|
261383
|
+
"- Runtime OS: Windows. The tool named bash executes native non-interactive PowerShell for compatibility with the existing tool protocol.",
|
|
261384
|
+
"- Write PowerShell commands: Get-Content, Get-ChildItem, Select-String, Where-Object, Set-Location only when truly needed, and $LASTEXITCODE for native-process exit status.",
|
|
261385
|
+
"- Do not use POSIX-only grep/sed/head/tail, heredoc (<<), /dev/null, export, or Bash $? syntax. Do not join steps with &&; use one command per tool call or explicit PowerShell control flow.",
|
|
261386
|
+
"- Quote Windows paths with single quotes and use -LiteralPath for paths containing spaces, brackets, or non-ASCII characters."
|
|
261387
|
+
].join("\n");
|
|
261388
|
+
}
|
|
261389
|
+
const os3 = platform === "darwin" ? "macOS" : "Linux/Unix";
|
|
261390
|
+
return [
|
|
261391
|
+
`- Runtime OS: ${os3}. The bash tool executes non-interactive Bash, falling back to POSIX sh when Bash is unavailable.`,
|
|
261392
|
+
"- Write portable POSIX commands and quote paths. Do not use PowerShell cmdlets, -LiteralPath, or $LASTEXITCODE."
|
|
261393
|
+
].join("\n");
|
|
261394
|
+
}
|
|
261208
261395
|
function cleanRuntimeGoal(value) {
|
|
261209
261396
|
return (value || "").replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim().slice(0, 4e3);
|
|
261210
261397
|
}
|
|
@@ -261693,13 +261880,38 @@ var AgentInputQueueController = class {
|
|
|
261693
261880
|
var IDENTICAL_CALL_THRESHOLD = 3;
|
|
261694
261881
|
var REPEATED_FAILURE_THRESHOLD = 2;
|
|
261695
261882
|
var RENUDGE_INCREMENT = 2;
|
|
261696
|
-
function canonicalizeArguments(rawArguments) {
|
|
261883
|
+
function canonicalizeArguments(toolName, rawArguments) {
|
|
261697
261884
|
try {
|
|
261698
|
-
|
|
261885
|
+
const parsed = JSON.parse(rawArguments);
|
|
261886
|
+
if (toolName === "bash") {
|
|
261887
|
+
const probe = canonicalizeShellProbe(parsed);
|
|
261888
|
+
if (probe) return probe;
|
|
261889
|
+
}
|
|
261890
|
+
return JSON.stringify(sortValue(parsed));
|
|
261699
261891
|
} catch {
|
|
261700
261892
|
return rawArguments.trim();
|
|
261701
261893
|
}
|
|
261702
261894
|
}
|
|
261895
|
+
function canonicalizeShellProbe(value) {
|
|
261896
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
261897
|
+
const command = value.command;
|
|
261898
|
+
if (typeof command !== "string") return void 0;
|
|
261899
|
+
const looksLikeProbe = /(?:\b(?:Get-Content|Select-String|grep|sed|head|tail|cat)\b|\bpython(?:\.exe)?\b[\s\S]*\b(?:open|read_text|read_bytes)\s*\()/i.test(
|
|
261900
|
+
command
|
|
261901
|
+
);
|
|
261902
|
+
const looksMutatingOrExecutable = /(?:\b(?:Set-Content|Add-Content|Remove-Item|Move-Item|Copy-Item|xelatex|pdflatex|npm|pnpm|yarn|pytest|vitest)\b|(?:^|\s)(?:>|>>)(?:\s|$)|\.write\s*\()/i.test(
|
|
261903
|
+
command
|
|
261904
|
+
);
|
|
261905
|
+
if (!looksLikeProbe || looksMutatingOrExecutable) return void 0;
|
|
261906
|
+
const files = command.match(
|
|
261907
|
+
/[\p{L}\p{N}_./\\:@+~-]+\.(?:[cm]?[jt]sx?|py|json|ya?ml|toml|md|tex|log|txt|csv|xml|html|css|scss|sql|rs|go|java|kt|swift)/giu
|
|
261908
|
+
);
|
|
261909
|
+
if (!files?.length) return void 0;
|
|
261910
|
+
const normalized = [
|
|
261911
|
+
...new Set(files.map((file) => file.replace(/\\/g, "/")))
|
|
261912
|
+
].sort();
|
|
261913
|
+
return `shell-probe:${normalized.join("|")}`;
|
|
261914
|
+
}
|
|
261703
261915
|
function sortValue(value) {
|
|
261704
261916
|
if (Array.isArray(value)) return value.map(sortValue);
|
|
261705
261917
|
if (value !== null && typeof value === "object") {
|
|
@@ -261727,7 +261939,11 @@ var LoopProgressGuard = class {
|
|
|
261727
261939
|
* no-progress streak past a threshold, or null when the loop looks healthy.
|
|
261728
261940
|
*/
|
|
261729
261941
|
record(observation) {
|
|
261730
|
-
const
|
|
261942
|
+
const canonicalArguments = canonicalizeArguments(
|
|
261943
|
+
observation.name,
|
|
261944
|
+
observation.arguments
|
|
261945
|
+
);
|
|
261946
|
+
const signature = JSON.stringify([observation.name, canonicalArguments]);
|
|
261731
261947
|
if (signature !== this.lastSignature) {
|
|
261732
261948
|
this.lastSignature = signature;
|
|
261733
261949
|
this.streakLength = 1;
|
|
@@ -261748,10 +261964,11 @@ var LoopProgressGuard = class {
|
|
|
261748
261964
|
}
|
|
261749
261965
|
if (this.streakLength >= IDENTICAL_CALL_THRESHOLD) {
|
|
261750
261966
|
this.nextNudgeAt = this.streakLength + RENUDGE_INCREMENT;
|
|
261967
|
+
const repeatedProbe = canonicalArguments.startsWith("shell-probe:");
|
|
261751
261968
|
return {
|
|
261752
|
-
reason: "repeated_identical_call",
|
|
261969
|
+
reason: repeatedProbe ? "repeated_probe" : "repeated_identical_call",
|
|
261753
261970
|
repeatCount: this.streakLength,
|
|
261754
|
-
message: `[Loop guard] You have now made the exact same "${observation.name}" call ${this.streakLength} times in a row. The result will not change. Use the information you already have, take a different action, or report what is blocking you.`
|
|
261971
|
+
message: repeatedProbe ? `[Loop guard] You have made ${this.streakLength} consecutive read-only shell probes against the same file(s). Stop varying grep/sed/Python snippets. Use the evidence already collected, use read_file once with a focused range, or repair the reported line directly.` : `[Loop guard] You have now made the exact same "${observation.name}" call ${this.streakLength} times in a row. The result will not change. Use the information you already have, take a different action, or report what is blocking you.`
|
|
261755
261972
|
};
|
|
261756
261973
|
}
|
|
261757
261974
|
return null;
|
|
@@ -262102,7 +262319,7 @@ async function hashCompleteTrackedDiff(cwd) {
|
|
|
262102
262319
|
return createHash33("sha256").update(unstaged).update("\0").update(staged).digest("hex");
|
|
262103
262320
|
}
|
|
262104
262321
|
function readGitOutput(cwd, args) {
|
|
262105
|
-
return new Promise((
|
|
262322
|
+
return new Promise((resolve26) => {
|
|
262106
262323
|
const child = spawn3("git", args, {
|
|
262107
262324
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262108
262325
|
cwd,
|
|
@@ -262121,14 +262338,14 @@ function readGitOutput(cwd, args) {
|
|
|
262121
262338
|
}
|
|
262122
262339
|
chunks.push(chunk);
|
|
262123
262340
|
});
|
|
262124
|
-
child.once("error", () =>
|
|
262341
|
+
child.once("error", () => resolve26(void 0));
|
|
262125
262342
|
child.once("close", (code) => {
|
|
262126
|
-
|
|
262343
|
+
resolve26(code === 0 && !exceededLimit ? Buffer.concat(chunks) : void 0);
|
|
262127
262344
|
});
|
|
262128
262345
|
});
|
|
262129
262346
|
}
|
|
262130
262347
|
function hashGitOutput(cwd, args) {
|
|
262131
|
-
return new Promise((
|
|
262348
|
+
return new Promise((resolve26) => {
|
|
262132
262349
|
const hash2 = createHash33("sha256");
|
|
262133
262350
|
const child = spawn3("git", args, {
|
|
262134
262351
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
@@ -262137,10 +262354,10 @@ function hashGitOutput(cwd, args) {
|
|
|
262137
262354
|
stdio: ["ignore", "pipe", "ignore"]
|
|
262138
262355
|
});
|
|
262139
262356
|
child.stdout.on("data", (chunk) => hash2.update(chunk));
|
|
262140
|
-
child.once("error", () =>
|
|
262357
|
+
child.once("error", () => resolve26(void 0));
|
|
262141
262358
|
child.once(
|
|
262142
262359
|
"close",
|
|
262143
|
-
(code) =>
|
|
262360
|
+
(code) => resolve26(code === 0 ? hash2.digest("hex") : void 0)
|
|
262144
262361
|
);
|
|
262145
262362
|
});
|
|
262146
262363
|
}
|
|
@@ -262166,16 +262383,16 @@ async function hashPathState(hash2, absolutePath) {
|
|
|
262166
262383
|
return;
|
|
262167
262384
|
}
|
|
262168
262385
|
hash2.update(`file:${stats.mode}:${stats.size}\0`);
|
|
262169
|
-
await new Promise((
|
|
262386
|
+
await new Promise((resolve26) => {
|
|
262170
262387
|
const stream = createReadStream2(absolutePath);
|
|
262171
262388
|
stream.on("data", (chunk) => hash2.update(chunk));
|
|
262172
262389
|
stream.once("error", (error) => {
|
|
262173
262390
|
hash2.update(
|
|
262174
262391
|
`[unreadable:${error instanceof Error ? error.name : "unknown"}]`
|
|
262175
262392
|
);
|
|
262176
|
-
|
|
262393
|
+
resolve26();
|
|
262177
262394
|
});
|
|
262178
|
-
stream.once("end",
|
|
262395
|
+
stream.once("end", resolve26);
|
|
262179
262396
|
});
|
|
262180
262397
|
} catch (error) {
|
|
262181
262398
|
hash2.update(`[missing:${error instanceof Error ? error.name : "unknown"}]`);
|
|
@@ -262184,7 +262401,11 @@ async function hashPathState(hash2, absolutePath) {
|
|
|
262184
262401
|
function stableFingerprintMap(values) {
|
|
262185
262402
|
return Object.entries(values).sort(([left], [right]) => left.localeCompare(right)).map(([filePath, fingerprint]) => `${filePath}\0${fingerprint}`).join("\0");
|
|
262186
262403
|
}
|
|
262187
|
-
function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
262404
|
+
function prepareIsolatedGitCommit(cwd, requestedPaths, environment) {
|
|
262405
|
+
const childEnvironment = {
|
|
262406
|
+
...environment ?? buildSanitizedChildEnvironment()
|
|
262407
|
+
};
|
|
262408
|
+
delete childEnvironment.GIT_INDEX_FILE;
|
|
262188
262409
|
const paths = Array.from(
|
|
262189
262410
|
new Set(
|
|
262190
262411
|
requestedPaths.map(
|
|
@@ -262194,12 +262415,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262194
262415
|
).filter(Boolean);
|
|
262195
262416
|
if (paths.length === 0) throw new Error("No files were selected for commit.");
|
|
262196
262417
|
const literalPathspecs = paths.map((filePath) => `:(literal)${filePath}`);
|
|
262197
|
-
const stagedPaths = readNullSeparatedGitPaths(
|
|
262198
|
-
|
|
262199
|
-
"--cached",
|
|
262200
|
-
|
|
262201
|
-
|
|
262202
|
-
]);
|
|
262418
|
+
const stagedPaths = readNullSeparatedGitPaths(
|
|
262419
|
+
cwd,
|
|
262420
|
+
["diff", "--cached", "--name-only", "-z"],
|
|
262421
|
+
childEnvironment
|
|
262422
|
+
);
|
|
262203
262423
|
const stagedSet = new Set(stagedPaths.map(normalizePath4));
|
|
262204
262424
|
const overlaps = paths.filter((filePath) => stagedSet.has(filePath));
|
|
262205
262425
|
if (overlaps.length > 0) {
|
|
@@ -262213,6 +262433,7 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262213
262433
|
{
|
|
262214
262434
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262215
262435
|
cwd,
|
|
262436
|
+
env: childEnvironment,
|
|
262216
262437
|
encoding: "utf8"
|
|
262217
262438
|
}
|
|
262218
262439
|
).trim();
|
|
@@ -262220,9 +262441,10 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262220
262441
|
path32.dirname(gitIndexPath),
|
|
262221
262442
|
`orbit-index-${randomUUID24()}`
|
|
262222
262443
|
);
|
|
262223
|
-
const isolatedEnvironment =
|
|
262224
|
-
|
|
262225
|
-
|
|
262444
|
+
const isolatedEnvironment = {
|
|
262445
|
+
...childEnvironment,
|
|
262446
|
+
GIT_INDEX_FILE: temporaryIndexPath
|
|
262447
|
+
};
|
|
262226
262448
|
let disposed = false;
|
|
262227
262449
|
try {
|
|
262228
262450
|
try {
|
|
@@ -262268,7 +262490,8 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262268
262490
|
["reset", "-q", "HEAD", "--", ...literalPathspecs],
|
|
262269
262491
|
{
|
|
262270
262492
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262271
|
-
cwd
|
|
262493
|
+
cwd,
|
|
262494
|
+
env: childEnvironment
|
|
262272
262495
|
}
|
|
262273
262496
|
);
|
|
262274
262497
|
},
|
|
@@ -262279,10 +262502,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262279
262502
|
throw error;
|
|
262280
262503
|
}
|
|
262281
262504
|
}
|
|
262282
|
-
function readNullSeparatedGitPaths(cwd, args) {
|
|
262505
|
+
function readNullSeparatedGitPaths(cwd, args, environment) {
|
|
262283
262506
|
return execFileSync5("git", args, {
|
|
262284
262507
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262285
|
-
cwd
|
|
262508
|
+
cwd,
|
|
262509
|
+
env: environment
|
|
262286
262510
|
}).toString("utf8").split("\0").filter(Boolean);
|
|
262287
262511
|
}
|
|
262288
262512
|
function normalizePath4(filePath) {
|
|
@@ -262515,7 +262739,7 @@ var PackageManifestSchema2 = z64.object({
|
|
|
262515
262739
|
name: z64.string(),
|
|
262516
262740
|
bin: z64.union([z64.string(), z64.record(z64.string())]).optional()
|
|
262517
262741
|
});
|
|
262518
|
-
async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
262742
|
+
async function executeLocalPackageBinary(cwd, packageName, binaryName, args, environment) {
|
|
262519
262743
|
const binaryPath = resolveLocalPackageBinary(cwd, packageName, binaryName);
|
|
262520
262744
|
const isJavaScript = /\.(?:cjs|mjs|js)$/i.test(binaryPath);
|
|
262521
262745
|
const executable = isJavaScript ? process.execPath : binaryPath;
|
|
@@ -262523,6 +262747,7 @@ async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
|
262523
262747
|
return execFilePromise2(executable, executableArgs, {
|
|
262524
262748
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262525
262749
|
cwd,
|
|
262750
|
+
...environment ? { env: { ...environment } } : {},
|
|
262526
262751
|
encoding: "utf8",
|
|
262527
262752
|
timeout: 12e4
|
|
262528
262753
|
});
|
|
@@ -263143,12 +263368,20 @@ function safeAgentLoopErrorMessage(error) {
|
|
|
263143
263368
|
if (message2.length <= AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS) return message2;
|
|
263144
263369
|
return `${message2.slice(0, AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS - 1)}\u2026`;
|
|
263145
263370
|
}
|
|
263371
|
+
function formatToolInputValidationError(error) {
|
|
263372
|
+
const issues = error.issues.slice(0, 3).map((issue) => {
|
|
263373
|
+
const field = issue.path.length > 0 ? issue.path.join(".") : "input";
|
|
263374
|
+
return `${field}: ${issue.message}`;
|
|
263375
|
+
});
|
|
263376
|
+
const remaining = Math.max(0, error.issues.length - issues.length);
|
|
263377
|
+
return `Invalid tool input \u2014 ${issues.join("; ")}${remaining ? `; +${remaining} more` : ""}.`;
|
|
263378
|
+
}
|
|
263146
263379
|
function waitForAgentRetry(delayMs, signal) {
|
|
263147
|
-
return new Promise((
|
|
263380
|
+
return new Promise((resolve26, reject) => {
|
|
263148
263381
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
263149
263382
|
const timeout = setTimeout(() => {
|
|
263150
263383
|
cleanup();
|
|
263151
|
-
|
|
263384
|
+
resolve26();
|
|
263152
263385
|
}, delayMs);
|
|
263153
263386
|
timeout.unref?.();
|
|
263154
263387
|
const onAbort = () => {
|
|
@@ -263188,12 +263421,24 @@ function hookErrorOutput(error) {
|
|
|
263188
263421
|
if (output.trim()) return output;
|
|
263189
263422
|
return typeof record.message === "string" ? record.message : String(error);
|
|
263190
263423
|
}
|
|
263191
|
-
function
|
|
263424
|
+
function hasSuccessfulWorkspaceFileMutations(history, cwd) {
|
|
263192
263425
|
const mutationCallIds = /* @__PURE__ */ new Set();
|
|
263193
263426
|
for (const message2 of history) {
|
|
263194
263427
|
for (const block2 of message2.content) {
|
|
263195
263428
|
if (block2.type === "tool_call" && isFileMutationTool(block2.toolCall.name)) {
|
|
263196
|
-
|
|
263429
|
+
try {
|
|
263430
|
+
const args = toUnknownRecord(JSON.parse(block2.toolCall.arguments));
|
|
263431
|
+
const targetPath = firstStringValue(
|
|
263432
|
+
args.path,
|
|
263433
|
+
args.TargetFile,
|
|
263434
|
+
args.filePath,
|
|
263435
|
+
args.file
|
|
263436
|
+
);
|
|
263437
|
+
if (!targetPath) continue;
|
|
263438
|
+
resolveSafePath(cwd, targetPath);
|
|
263439
|
+
mutationCallIds.add(block2.toolCall.id);
|
|
263440
|
+
} catch {
|
|
263441
|
+
}
|
|
263197
263442
|
}
|
|
263198
263443
|
}
|
|
263199
263444
|
}
|
|
@@ -263355,6 +263600,7 @@ var AgentLoop = class _AgentLoop {
|
|
|
263355
263600
|
outputLimitRetriesForRun = 0;
|
|
263356
263601
|
providerRetriesForRun = 0;
|
|
263357
263602
|
completionVerificationNudgedForRun = false;
|
|
263603
|
+
finalResponseOnlyReason = null;
|
|
263358
263604
|
approvedToolScopes = /* @__PURE__ */ new Set();
|
|
263359
263605
|
terminalFailure = null;
|
|
263360
263606
|
verificationStatus = "not_run";
|
|
@@ -263589,6 +263835,7 @@ var AgentLoop = class _AgentLoop {
|
|
|
263589
263835
|
this.completionVerificationNudgedForRun = false;
|
|
263590
263836
|
this.approvedToolScopes.clear();
|
|
263591
263837
|
this.terminalFailure = null;
|
|
263838
|
+
this.finalResponseOnlyReason = this.pendingTerminalCompletionReason();
|
|
263592
263839
|
this.verificationStatus = "not_run";
|
|
263593
263840
|
this.workspaceMutationRevision = 0;
|
|
263594
263841
|
this.verifiedMutationRevision = -1;
|
|
@@ -263677,10 +263924,19 @@ var AgentLoop = class _AgentLoop {
|
|
|
263677
263924
|
});
|
|
263678
263925
|
if (this.state.attemptCount > 1 && Number.isFinite(this.getRunawayPromptInterval()) && (this.state.attemptCount - 1) % this.getRunawayPromptInterval() === 0) {
|
|
263679
263926
|
const completedIterations = this.state.attemptCount - 1;
|
|
263680
|
-
const
|
|
263927
|
+
const fullAccess = isFullAccessEnabled(this.config);
|
|
263928
|
+
const autoContinue = fullAccess || this.options.autoContinueRunaway === true;
|
|
263929
|
+
const continueExec = autoContinue ? true : await this.interaction.askApproval(
|
|
263681
263930
|
`Agent loop has run for ${completedIterations} iterations. Continue executing to prevent runaway costs?`
|
|
263682
263931
|
);
|
|
263683
|
-
if (
|
|
263932
|
+
if (autoContinue) {
|
|
263933
|
+
this.sessionManager.logEvent("runaway_checkpoint", {
|
|
263934
|
+
completedIterations,
|
|
263935
|
+
continuedAutomatically: true,
|
|
263936
|
+
reason: fullAccess ? "full_access" : "bounded_automation"
|
|
263937
|
+
});
|
|
263938
|
+
}
|
|
263939
|
+
if (this.options.autoContinueRunaway && !fullAccess) {
|
|
263684
263940
|
this.interaction.showText(
|
|
263685
263941
|
picocolors3.gray(
|
|
263686
263942
|
`\u25CF Automated evaluation checkpoint: continuing after ${completedIterations} iterations within configured limits.`
|
|
@@ -263829,6 +264085,9 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
|
|
|
263829
264085
|
(t2) => this.options.allowedTools.includes(t2.name)
|
|
263830
264086
|
);
|
|
263831
264087
|
}
|
|
264088
|
+
if (this.finalResponseOnlyReason) {
|
|
264089
|
+
toolDefs = [];
|
|
264090
|
+
}
|
|
263832
264091
|
toolDefs.sort((a2, b) => a2.name.localeCompare(b.name));
|
|
263833
264092
|
const capabilities = resolveModelCapabilities(
|
|
263834
264093
|
this.provider,
|
|
@@ -264135,7 +264394,7 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
|
|
|
264135
264394
|
this.contextOverflowRetriesForRun = 0;
|
|
264136
264395
|
this.outputLimitRetriesForRun = 0;
|
|
264137
264396
|
this.providerRetriesForRun = 0;
|
|
264138
|
-
if (toolCallsToExecute.length === 0 && responseText && !capabilities.toolCalls) {
|
|
264397
|
+
if (toolCallsToExecute.length === 0 && responseText && !capabilities.toolCalls && !this.finalResponseOnlyReason) {
|
|
264139
264398
|
const xmlToolCalls = parseXMLToolCalls(responseText);
|
|
264140
264399
|
const textToolCalls = xmlToolCalls.length > 0 ? [] : parseTextToolCalls(
|
|
264141
264400
|
responseText,
|
|
@@ -264302,7 +264561,7 @@ Orbit: ${this.interaction.formatMarkdown?.(responseText) || responseText}`
|
|
|
264302
264561
|
if (steeringApplied || backgroundReconciled) continue;
|
|
264303
264562
|
}
|
|
264304
264563
|
if (toolCallsToExecute.length === 0) {
|
|
264305
|
-
const hasEdits = this.workspaceMutationRevision > 0 ||
|
|
264564
|
+
const hasEdits = this.workspaceMutationRevision > 0 || hasSuccessfulWorkspaceFileMutations(this.state.history, this.cwd);
|
|
264306
264565
|
if (hasEdits) {
|
|
264307
264566
|
if (this.verificationManager.hasContract()) {
|
|
264308
264567
|
this.sessionManager.setRunState("verifying", "verification", {
|
|
@@ -264387,7 +264646,9 @@ Please analyze this failure, fix the codebase, and ensure it passes the verifica
|
|
|
264387
264646
|
{
|
|
264388
264647
|
cwd: this.cwd,
|
|
264389
264648
|
sessionId: this.state.sessionId,
|
|
264390
|
-
|
|
264649
|
+
config: this.config,
|
|
264650
|
+
abortSignal: this.abortController?.signal,
|
|
264651
|
+
services: this.toolRuntimeServices
|
|
264391
264652
|
}
|
|
264392
264653
|
);
|
|
264393
264654
|
const verificationWorkspaceAfter = await captureWorkspaceMutationSnapshot(this.cwd);
|
|
@@ -264563,8 +264824,18 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264563
264824
|
{ startedAt }
|
|
264564
264825
|
);
|
|
264565
264826
|
};
|
|
264827
|
+
let terminalSuccessReachedThisBatch;
|
|
264566
264828
|
for (const tc of toolCallsToExecute) {
|
|
264567
264829
|
const toolStartedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
264830
|
+
if (this.finalResponseOnlyReason) {
|
|
264831
|
+
rejectInvalidToolCall(
|
|
264832
|
+
tc,
|
|
264833
|
+
"A trusted finalizer already completed the delivery. Tool execution is locked; return the final delivery report now.",
|
|
264834
|
+
"read",
|
|
264835
|
+
toolStartedAt
|
|
264836
|
+
);
|
|
264837
|
+
continue;
|
|
264838
|
+
}
|
|
264568
264839
|
let argSummary = "";
|
|
264569
264840
|
try {
|
|
264570
264841
|
const parsed = JSON.parse(tc.arguments);
|
|
@@ -264634,7 +264905,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264634
264905
|
if (!validation.success) {
|
|
264635
264906
|
rejectInvalidToolCall(
|
|
264636
264907
|
tc,
|
|
264637
|
-
|
|
264908
|
+
formatToolInputValidationError(validation.error),
|
|
264638
264909
|
declaredRisk,
|
|
264639
264910
|
toolStartedAt
|
|
264640
264911
|
);
|
|
@@ -264659,7 +264930,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264659
264930
|
evalArgsRecord.filePath,
|
|
264660
264931
|
evalArgsRecord.file
|
|
264661
264932
|
);
|
|
264662
|
-
if (targetPath2) {
|
|
264933
|
+
if (targetPath2 && !isFullAccessEnabled(this.config)) {
|
|
264663
264934
|
const relPath = path7.relative(this.cwd, path7.resolve(this.cwd, targetPath2)).replace(/\\/g, "/");
|
|
264664
264935
|
const foundFile = this.state.relevantFiles.find(
|
|
264665
264936
|
(f) => f.path === relPath
|
|
@@ -264881,6 +265152,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264881
265152
|
});
|
|
264882
265153
|
let beforeContent = null;
|
|
264883
265154
|
let targetPath;
|
|
265155
|
+
const fullAccess = isFullAccessEnabled(this.config);
|
|
264884
265156
|
let parsedArgs = {};
|
|
264885
265157
|
try {
|
|
264886
265158
|
parsedArgs = toUnknownRecord(JSON.parse(tc.arguments));
|
|
@@ -264893,11 +265165,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264893
265165
|
} catch {
|
|
264894
265166
|
}
|
|
264895
265167
|
let absoluteTargetPath;
|
|
265168
|
+
let workspaceTargetPath;
|
|
264896
265169
|
if (targetPath) {
|
|
264897
265170
|
try {
|
|
264898
|
-
|
|
265171
|
+
workspaceTargetPath = resolveSafePath(this.cwd, targetPath);
|
|
265172
|
+
absoluteTargetPath = workspaceTargetPath;
|
|
264899
265173
|
} catch {
|
|
264900
|
-
absoluteTargetPath = void 0;
|
|
265174
|
+
absoluteTargetPath = fullAccess ? path7.resolve(this.cwd, targetPath) : void 0;
|
|
264901
265175
|
}
|
|
264902
265176
|
}
|
|
264903
265177
|
let skipToolExecution = false;
|
|
@@ -264911,7 +265185,8 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264911
265185
|
try {
|
|
264912
265186
|
await execPromise2(testCmd, {
|
|
264913
265187
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
264914
|
-
cwd: this.cwd
|
|
265188
|
+
cwd: this.cwd,
|
|
265189
|
+
env: this.buildChildProcessEnvironment()
|
|
264915
265190
|
});
|
|
264916
265191
|
this.interaction.showText(`\u2714 Pre-commit checks passed.`);
|
|
264917
265192
|
} catch (error) {
|
|
@@ -264921,7 +265196,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264921
265196
|
`\u2716 Pre-commit checks failed. Verification tests failed.`
|
|
264922
265197
|
)
|
|
264923
265198
|
);
|
|
264924
|
-
const choice = this.options?.nonInteractive ? "no" : await this.askSelect(
|
|
265199
|
+
const choice = fullAccess ? "yes" : this.options?.nonInteractive ? "no" : await this.askSelect(
|
|
264925
265200
|
`Pre-commit verification tests failed. How would you like to proceed?`,
|
|
264926
265201
|
[
|
|
264927
265202
|
{
|
|
@@ -264935,6 +265210,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264935
265210
|
{ value: "no", label: "Abort the commit entirely" }
|
|
264936
265211
|
]
|
|
264937
265212
|
);
|
|
265213
|
+
if (fullAccess) {
|
|
265214
|
+
this.interaction.showText(
|
|
265215
|
+
picocolors3.yellow(
|
|
265216
|
+
"\u26A0 Full Access: proceeding with the approved commit despite failed pre-commit verification."
|
|
265217
|
+
)
|
|
265218
|
+
);
|
|
265219
|
+
}
|
|
264938
265220
|
if (choice === "diagnose") {
|
|
264939
265221
|
eventBus.emitEvent("tool_result", {
|
|
264940
265222
|
toolCallId: tc.id,
|
|
@@ -264979,7 +265261,8 @@ ${commandError}`,
|
|
|
264979
265261
|
try {
|
|
264980
265262
|
const { stdout: stdout2 } = await execPromise2("git diff --cached", {
|
|
264981
265263
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
264982
|
-
cwd: this.cwd
|
|
265264
|
+
cwd: this.cwd,
|
|
265265
|
+
env: this.buildChildProcessEnvironment()
|
|
264983
265266
|
});
|
|
264984
265267
|
if (!stdout2.trim()) {
|
|
264985
265268
|
this.interaction.showText(
|
|
@@ -265028,17 +265311,26 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265028
265311
|
}
|
|
265029
265312
|
}
|
|
265030
265313
|
}
|
|
265031
|
-
if ((tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content") && targetPath) {
|
|
265032
|
-
|
|
265033
|
-
|
|
265034
|
-
|
|
265035
|
-
|
|
265036
|
-
|
|
265037
|
-
|
|
265038
|
-
|
|
265039
|
-
|
|
265040
|
-
|
|
265041
|
-
|
|
265314
|
+
if ((tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content") && targetPath && workspaceTargetPath) {
|
|
265315
|
+
try {
|
|
265316
|
+
const checkpoint = await this.checkpointManager.captureBeforeState(
|
|
265317
|
+
tc.id,
|
|
265318
|
+
targetPath
|
|
265319
|
+
);
|
|
265320
|
+
beforeContent = checkpoint.backups[0].originalContent;
|
|
265321
|
+
eventBus.emitEvent("checkpoint_created", {
|
|
265322
|
+
checkpointId: checkpoint.id,
|
|
265323
|
+
timestamp: checkpoint.timestamp,
|
|
265324
|
+
message: `Before executing ${tc.name} on ${targetPath}`
|
|
265325
|
+
});
|
|
265326
|
+
} catch (error) {
|
|
265327
|
+
if (!fullAccess) throw error;
|
|
265328
|
+
this.interaction.showText(
|
|
265329
|
+
picocolors3.yellow(
|
|
265330
|
+
`\u26A0 Full Access: checkpoint unavailable for ${targetPath}; proceeding without Orbit rollback coverage. ${safeAgentLoopErrorMessage(error)}`
|
|
265331
|
+
)
|
|
265332
|
+
);
|
|
265333
|
+
}
|
|
265042
265334
|
if (this.config.hooks?.preEdit) {
|
|
265043
265335
|
this.interaction.showText(`\u25CF Running pre-edit hook...`);
|
|
265044
265336
|
const hookRes = await this.runHook(
|
|
@@ -265133,7 +265425,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265133
265425
|
this.cwd,
|
|
265134
265426
|
"@biomejs/biome",
|
|
265135
265427
|
"biome",
|
|
265136
|
-
["format", "--write", absoluteTargetPath]
|
|
265428
|
+
["format", "--write", absoluteTargetPath],
|
|
265429
|
+
this.buildChildProcessEnvironment()
|
|
265137
265430
|
);
|
|
265138
265431
|
} else {
|
|
265139
265432
|
const prettierCandidates = [
|
|
@@ -265159,7 +265452,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265159
265452
|
this.cwd,
|
|
265160
265453
|
"prettier",
|
|
265161
265454
|
"prettier",
|
|
265162
|
-
["--write", absoluteTargetPath]
|
|
265455
|
+
["--write", absoluteTargetPath],
|
|
265456
|
+
this.buildChildProcessEnvironment()
|
|
265163
265457
|
);
|
|
265164
265458
|
}
|
|
265165
265459
|
}
|
|
@@ -265177,10 +265471,13 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265177
265471
|
}
|
|
265178
265472
|
}
|
|
265179
265473
|
if (hasEslintConfig) {
|
|
265180
|
-
await executeLocalPackageBinary(
|
|
265181
|
-
|
|
265182
|
-
|
|
265183
|
-
|
|
265474
|
+
await executeLocalPackageBinary(
|
|
265475
|
+
this.cwd,
|
|
265476
|
+
"eslint",
|
|
265477
|
+
"eslint",
|
|
265478
|
+
["--fix", absoluteTargetPath],
|
|
265479
|
+
this.buildChildProcessEnvironment()
|
|
265480
|
+
);
|
|
265184
265481
|
}
|
|
265185
265482
|
} catch {
|
|
265186
265483
|
}
|
|
@@ -265201,7 +265498,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265201
265498
|
this.cwd,
|
|
265202
265499
|
lintPackage,
|
|
265203
265500
|
lintBinary,
|
|
265204
|
-
lintArgs
|
|
265501
|
+
lintArgs,
|
|
265502
|
+
this.buildChildProcessEnvironment()
|
|
265205
265503
|
);
|
|
265206
265504
|
this.interaction.showText(`\u2714 Syntax verification passed.`);
|
|
265207
265505
|
} catch (error) {
|
|
@@ -265242,7 +265540,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265242
265540
|
const uniqueModules = Array.from(new Set(missingModules));
|
|
265243
265541
|
let dependenciesInstalled = false;
|
|
265244
265542
|
for (const pkg of uniqueModules) {
|
|
265245
|
-
const installPkg = await this.interaction.askApproval(
|
|
265543
|
+
const installPkg = fullAccess || await this.interaction.askApproval(
|
|
265246
265544
|
`Missing dependency "${pkg}" detected. Install it automatically?`
|
|
265247
265545
|
);
|
|
265248
265546
|
if (installPkg) {
|
|
@@ -265263,7 +265561,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265263
265561
|
const args = isPnpm || isYarn ? ["add", "-D", pkg] : ["install", "--save-dev", pkg];
|
|
265264
265562
|
await execFilePromise3(executable, args, {
|
|
265265
265563
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
265266
|
-
cwd: this.cwd
|
|
265564
|
+
cwd: this.cwd,
|
|
265565
|
+
env: this.buildChildProcessEnvironment()
|
|
265267
265566
|
});
|
|
265268
265567
|
this.interaction.showText(
|
|
265269
265568
|
`\u2714 Installed "${pkg}" successfully.`
|
|
@@ -265287,7 +265586,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265287
265586
|
this.cwd,
|
|
265288
265587
|
"eslint",
|
|
265289
265588
|
"eslint",
|
|
265290
|
-
["--quiet", absoluteTargetPath]
|
|
265589
|
+
["--quiet", absoluteTargetPath],
|
|
265590
|
+
this.buildChildProcessEnvironment()
|
|
265291
265591
|
);
|
|
265292
265592
|
this.interaction.showText(
|
|
265293
265593
|
`\u2714 Syntax verification passed after dependency installation.`
|
|
@@ -265371,7 +265671,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265371
265671
|
this.cwd,
|
|
265372
265672
|
"eslint",
|
|
265373
265673
|
"eslint",
|
|
265374
|
-
["--quiet", absoluteTargetPath]
|
|
265674
|
+
["--quiet", absoluteTargetPath],
|
|
265675
|
+
this.buildChildProcessEnvironment()
|
|
265375
265676
|
);
|
|
265376
265677
|
this.interaction.showText(
|
|
265377
265678
|
`\u2714 Syntax verification passed after auto-imports injection.`
|
|
@@ -265389,7 +265690,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265389
265690
|
}
|
|
265390
265691
|
}
|
|
265391
265692
|
if (!checkPassedAfterAutofix) {
|
|
265392
|
-
const autoFix = await this.interaction.askApproval(
|
|
265693
|
+
const autoFix = fullAccess || await this.interaction.askApproval(
|
|
265393
265694
|
`Lint/Syntax verification failed. Let Agent auto-repair the file?`
|
|
265394
265695
|
);
|
|
265395
265696
|
if (autoFix) {
|
|
@@ -265425,7 +265726,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265425
265726
|
} catch {
|
|
265426
265727
|
}
|
|
265427
265728
|
let accepted = false;
|
|
265428
|
-
const choice = this.options?.nonInteractive ? "yes" : this.interaction.reviewFileChange ? await this.interaction.reviewFileChange({
|
|
265729
|
+
const choice = fullAccess ? "yes" : this.options?.nonInteractive ? "yes" : this.interaction.reviewFileChange ? await this.interaction.reviewFileChange({
|
|
265429
265730
|
filePath: targetPath,
|
|
265430
265731
|
before: beforeContent,
|
|
265431
265732
|
after: afterContent,
|
|
@@ -265602,8 +265903,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265602
265903
|
};
|
|
265603
265904
|
}
|
|
265604
265905
|
}
|
|
265605
|
-
if (finalResult.ok && targetPath && absoluteTargetPath && isFileMutationTool(tc.name)) {
|
|
265606
|
-
const auditedTargetPath = path7.relative(this.cwd,
|
|
265906
|
+
if (finalResult.ok && targetPath && absoluteTargetPath && workspaceTargetPath && isFileMutationTool(tc.name)) {
|
|
265907
|
+
const auditedTargetPath = path7.relative(this.cwd, workspaceTargetPath).replace(/\\/g, "/");
|
|
265607
265908
|
this.registerWorkspaceMutation([auditedTargetPath], tc.name);
|
|
265608
265909
|
try {
|
|
265609
265910
|
const afterContent = readBoundedRegularFile(
|
|
@@ -265662,6 +265963,15 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265662
265963
|
);
|
|
265663
265964
|
}
|
|
265664
265965
|
}
|
|
265966
|
+
const terminalSuccess = finalResult.ok && tc.name === "run_tests" && finalResult.metadata?.terminalSuccess === "cumcm-finalizer" ? "cumcm-finalizer" : void 0;
|
|
265967
|
+
if (terminalSuccess) {
|
|
265968
|
+
terminalSuccessReachedThisBatch = terminalSuccess;
|
|
265969
|
+
this.finalResponseOnlyReason = terminalSuccess;
|
|
265970
|
+
this.sessionManager.logEvent("terminal_completion_latched", {
|
|
265971
|
+
toolName: tc.name,
|
|
265972
|
+
kind: terminalSuccess
|
|
265973
|
+
});
|
|
265974
|
+
}
|
|
265665
265975
|
if (finalResult.ok) {
|
|
265666
265976
|
const statusText = truncateToolText(
|
|
265667
265977
|
redactSecrets(finalResult.display || "Done"),
|
|
@@ -265670,7 +265980,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265670
265980
|
this.interaction.showText(
|
|
265671
265981
|
` ${picocolors3.green("\u2714")} Success: ${picocolors3.gray(statusText)}`
|
|
265672
265982
|
);
|
|
265673
|
-
if (targetPath) {
|
|
265983
|
+
if (targetPath && workspaceTargetPath) {
|
|
265674
265984
|
this.addRelevantFile(targetPath, `Modified by ${tc.name}`);
|
|
265675
265985
|
}
|
|
265676
265986
|
if (tc.name === "write_file" || tc.name === "edit_file") {
|
|
@@ -265729,6 +266039,27 @@ ${guardNudge.message}` : ""),
|
|
|
265729
266039
|
content: toolResultBlocks
|
|
265730
266040
|
};
|
|
265731
266041
|
this.state.history.push(toolMsg);
|
|
266042
|
+
if (terminalSuccessReachedThisBatch) {
|
|
266043
|
+
this.state.history.push({
|
|
266044
|
+
id: `msg_terminal_completion_${Date.now()}`,
|
|
266045
|
+
role: "user",
|
|
266046
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
266047
|
+
content: [
|
|
266048
|
+
{
|
|
266049
|
+
type: "text",
|
|
266050
|
+
text: [
|
|
266051
|
+
"Orbit terminal completion contract: the trusted project finalizer succeeded.",
|
|
266052
|
+
"Do not call or describe any further tools, edits, probes, builds, or verification.",
|
|
266053
|
+
"Return only the concise final delivery report required by the active Skill, using the verified artifacts already present."
|
|
266054
|
+
].join(" ")
|
|
266055
|
+
}
|
|
266056
|
+
],
|
|
266057
|
+
metadata: {
|
|
266058
|
+
kind: "terminal_completion",
|
|
266059
|
+
terminalSuccess: terminalSuccessReachedThisBatch
|
|
266060
|
+
}
|
|
266061
|
+
});
|
|
266062
|
+
}
|
|
265732
266063
|
this.abortController = null;
|
|
265733
266064
|
this.sessionManager.saveHistory(this.state.history);
|
|
265734
266065
|
}
|
|
@@ -265763,7 +266094,8 @@ ${guardNudge.message}` : ""),
|
|
|
265763
266094
|
try {
|
|
265764
266095
|
const preparedCommit = prepareIsolatedGitCommit(
|
|
265765
266096
|
this.cwd,
|
|
265766
|
-
modifiedFiles
|
|
266097
|
+
modifiedFiles,
|
|
266098
|
+
this.buildChildProcessEnvironment()
|
|
265767
266099
|
);
|
|
265768
266100
|
try {
|
|
265769
266101
|
const diff = preparedCommit.diff;
|
|
@@ -266024,10 +266356,10 @@ ${diff.substring(0, 2e4)}`
|
|
|
266024
266356
|
const { stdout: stdout2, stderr } = await execPromise2(hookCommand, {
|
|
266025
266357
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
266026
266358
|
cwd: this.cwd,
|
|
266027
|
-
env:
|
|
266028
|
-
|
|
266029
|
-
|
|
266030
|
-
|
|
266359
|
+
env: this.buildChildProcessEnvironment(
|
|
266360
|
+
{ ORBIT_FILE: relativePath },
|
|
266361
|
+
true
|
|
266362
|
+
),
|
|
266031
266363
|
timeout: this.config.tools.bash.timeoutMs,
|
|
266032
266364
|
signal: this.abortController?.signal
|
|
266033
266365
|
});
|
|
@@ -266196,6 +266528,8 @@ ${diff.substring(0, 2e4)}`
|
|
|
266196
266528
|
this.state.task = task;
|
|
266197
266529
|
this.state.done = false;
|
|
266198
266530
|
this.state.attemptCount = 0;
|
|
266531
|
+
this.state.maxAttempts = resolveAgentMaxLoopAttempts(this.config);
|
|
266532
|
+
this.finalResponseOnlyReason = null;
|
|
266199
266533
|
this.progressGuard.reset();
|
|
266200
266534
|
this.state.history.push({
|
|
266201
266535
|
id: `msg_user_${Date.now()}`,
|
|
@@ -266205,10 +266539,15 @@ ${diff.substring(0, 2e4)}`
|
|
|
266205
266539
|
});
|
|
266206
266540
|
this.sessionManager.saveHistory(this.state.history);
|
|
266207
266541
|
}
|
|
266542
|
+
pendingTerminalCompletionReason() {
|
|
266543
|
+
const lastMessage = this.state.history.at(-1);
|
|
266544
|
+
return lastMessage?.role === "user" && lastMessage.metadata?.kind === "terminal_completion" && lastMessage.metadata?.terminalSuccess === "cumcm-finalizer" ? "cumcm-finalizer" : null;
|
|
266545
|
+
}
|
|
266208
266546
|
/** Apply all pending steering inputs at a provider-safe conversation boundary. */
|
|
266209
266547
|
applyPendingSteeringInputs() {
|
|
266210
266548
|
const inputs = this.inputQueue.drainSteering();
|
|
266211
266549
|
if (inputs.length === 0) return false;
|
|
266550
|
+
this.finalResponseOnlyReason = null;
|
|
266212
266551
|
for (const input of inputs) {
|
|
266213
266552
|
this.state.history.push({
|
|
266214
266553
|
id: `msg_user_steer_${randomUUID52().replace(/-/g, "")}`,
|
|
@@ -266748,13 +267087,21 @@ ${diff.substring(0, 2e4)}`
|
|
|
266748
267087
|
try {
|
|
266749
267088
|
await execPromise2("git rev-parse --is-inside-work-tree", {
|
|
266750
267089
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
266751
|
-
cwd: this.cwd
|
|
267090
|
+
cwd: this.cwd,
|
|
267091
|
+
env: this.buildChildProcessEnvironment()
|
|
266752
267092
|
});
|
|
266753
267093
|
return true;
|
|
266754
267094
|
} catch {
|
|
266755
267095
|
return false;
|
|
266756
267096
|
}
|
|
266757
267097
|
}
|
|
267098
|
+
/** Keep every Agent-owned child process aligned with the active permission mode. */
|
|
267099
|
+
buildChildProcessEnvironment(extra, minimal = false) {
|
|
267100
|
+
return isFullAccessEnabled(this.config) ? buildInheritedChildEnvironment({ extra }) : buildSanitizedChildEnvironment({
|
|
267101
|
+
...minimal ? { mode: "minimal" } : {},
|
|
267102
|
+
extra
|
|
267103
|
+
});
|
|
267104
|
+
}
|
|
266758
267105
|
shouldShowDeepSeekCacheStatus(inputTokens = 0, hitRate = 1) {
|
|
266759
267106
|
const verbose = process.env[DEEPSEEK_VERBOSE_CACHE_ENV];
|
|
266760
267107
|
if (verbose === "1" || verbose?.toLowerCase() === "true") {
|
|
@@ -267006,21 +267353,21 @@ var AgentTaskScheduler = class {
|
|
|
267006
267353
|
Math.min(36e5, Math.floor(task.timeoutMs ?? 6e5))
|
|
267007
267354
|
);
|
|
267008
267355
|
let timeout;
|
|
267009
|
-
const timeoutResult = new Promise((
|
|
267356
|
+
const timeoutResult = new Promise((resolve26) => {
|
|
267010
267357
|
timeout = setTimeout(() => {
|
|
267011
267358
|
const error = new Error(`Agent task timed out after ${timeoutMs}ms.`);
|
|
267012
267359
|
taskController.abort(error);
|
|
267013
|
-
|
|
267360
|
+
resolve26({ id: task.id, status: "failed", error });
|
|
267014
267361
|
this.abort(
|
|
267015
267362
|
`Agent task ${task.id} timed out; the remaining task graph was cancelled.`
|
|
267016
267363
|
);
|
|
267017
267364
|
}, timeoutMs);
|
|
267018
267365
|
});
|
|
267019
267366
|
let removeSchedulerAbortListener = () => void 0;
|
|
267020
|
-
const schedulerAbortResult = new Promise((
|
|
267367
|
+
const schedulerAbortResult = new Promise((resolve26) => {
|
|
267021
267368
|
const onAbort = () => {
|
|
267022
267369
|
if (taskController.signal.aborted) return;
|
|
267023
|
-
|
|
267370
|
+
resolve26({
|
|
267024
267371
|
id: task.id,
|
|
267025
267372
|
status: "aborted",
|
|
267026
267373
|
error: abortError2(this.controller.signal)
|
|
@@ -267057,8 +267404,8 @@ var AgentTaskScheduler = class {
|
|
|
267057
267404
|
try {
|
|
267058
267405
|
await Promise.race([
|
|
267059
267406
|
runResult.then(() => void 0),
|
|
267060
|
-
new Promise((
|
|
267061
|
-
graceTimer = setTimeout(
|
|
267407
|
+
new Promise((resolve26) => {
|
|
267408
|
+
graceTimer = setTimeout(resolve26, this.abortGraceMs);
|
|
267062
267409
|
graceTimer.unref?.();
|
|
267063
267410
|
})
|
|
267064
267411
|
]);
|
|
@@ -268085,15 +268432,15 @@ var AutocompleteEngine = class {
|
|
|
268085
268432
|
this.activeRequests.set(windowId, controller);
|
|
268086
268433
|
const signal = controller.signal;
|
|
268087
268434
|
const debounceMs = config.autocomplete?.debounceMs !== void 0 ? config.autocomplete.debounceMs : 150;
|
|
268088
|
-
return new Promise((
|
|
268089
|
-
this.debounceResolvers.set(windowId,
|
|
268435
|
+
return new Promise((resolve26) => {
|
|
268436
|
+
this.debounceResolvers.set(windowId, resolve26);
|
|
268090
268437
|
const timer = setTimeout(async () => {
|
|
268091
268438
|
if (this.debounceTimers.get(windowId) === timer) {
|
|
268092
268439
|
this.debounceTimers.delete(windowId);
|
|
268093
268440
|
}
|
|
268094
268441
|
this.debounceResolvers.delete(windowId);
|
|
268095
268442
|
if (signal.aborted) {
|
|
268096
|
-
|
|
268443
|
+
resolve26("");
|
|
268097
268444
|
return;
|
|
268098
268445
|
}
|
|
268099
268446
|
const providerId = config.autocomplete.provider || "ollama";
|
|
@@ -268101,7 +268448,7 @@ var AutocompleteEngine = class {
|
|
|
268101
268448
|
try {
|
|
268102
268449
|
const provider = this.getCachedProvider(providerId, config);
|
|
268103
268450
|
if (typeof provider.complete !== "function") {
|
|
268104
|
-
|
|
268451
|
+
resolve26("");
|
|
268105
268452
|
return;
|
|
268106
268453
|
}
|
|
268107
268454
|
const header = getPathCommentHeader(windowId, this.cwd);
|
|
@@ -268213,21 +268560,21 @@ var AutocompleteEngine = class {
|
|
|
268213
268560
|
if (speculativeTimer) clearTimeout(speculativeTimer);
|
|
268214
268561
|
}
|
|
268215
268562
|
if (winner !== "__TIMEOUT__" && winner.trim() !== "") {
|
|
268216
|
-
|
|
268563
|
+
resolve26(winner);
|
|
268217
268564
|
} else {
|
|
268218
268565
|
const localResult = await localPromise;
|
|
268219
268566
|
if (localResult.trim() !== "") {
|
|
268220
|
-
|
|
268567
|
+
resolve26(localResult);
|
|
268221
268568
|
} else {
|
|
268222
|
-
|
|
268569
|
+
resolve26(await cloudPromise.catch(() => ""));
|
|
268223
268570
|
}
|
|
268224
268571
|
}
|
|
268225
268572
|
} else {
|
|
268226
268573
|
const completed = await cloudPromise;
|
|
268227
|
-
|
|
268574
|
+
resolve26(completed);
|
|
268228
268575
|
}
|
|
268229
268576
|
} catch {
|
|
268230
|
-
|
|
268577
|
+
resolve26("");
|
|
268231
268578
|
} finally {
|
|
268232
268579
|
if (this.activeRequests.get(windowId) === controller) {
|
|
268233
268580
|
this.activeRequests.delete(windowId);
|
|
@@ -268240,7 +268587,7 @@ var AutocompleteEngine = class {
|
|
|
268240
268587
|
/** Cancel outstanding completions and release timers held by the engine. */
|
|
268241
268588
|
dispose() {
|
|
268242
268589
|
for (const timer of this.debounceTimers.values()) clearTimeout(timer);
|
|
268243
|
-
for (const
|
|
268590
|
+
for (const resolve26 of this.debounceResolvers.values()) resolve26("");
|
|
268244
268591
|
for (const controller of this.activeRequests.values()) controller.abort();
|
|
268245
268592
|
this.debounceTimers.clear();
|
|
268246
268593
|
this.debounceResolvers.clear();
|
|
@@ -268256,7 +268603,7 @@ function latestObservation(metadata) {
|
|
|
268256
268603
|
}
|
|
268257
268604
|
function buildCacheDiagnostics(cwd) {
|
|
268258
268605
|
const dir = join11(cwd, ".orbit", "cache-slabs");
|
|
268259
|
-
if (!
|
|
268606
|
+
if (!existsSync13(dir)) {
|
|
268260
268607
|
return picocolors4.gray(
|
|
268261
268608
|
"\u25CF No cache telemetry yet. It will appear after a completed DeepSeek request."
|
|
268262
268609
|
);
|
|
@@ -268962,11 +269309,11 @@ function statusLine(ok, text2, warn = false) {
|
|
|
268962
269309
|
return warn ? picocolors6.yellow(`\u26A0\uFE0F ${text2}`) : picocolors6.red(`\u2716 ${text2}`);
|
|
268963
269310
|
}
|
|
268964
269311
|
function packageManager(cwd) {
|
|
268965
|
-
if (
|
|
268966
|
-
if (
|
|
268967
|
-
if (
|
|
268968
|
-
if (
|
|
268969
|
-
if (
|
|
269312
|
+
if (existsSync14(join12(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
269313
|
+
if (existsSync14(join12(cwd, "yarn.lock"))) return "yarn";
|
|
269314
|
+
if (existsSync14(join12(cwd, "bun.lockb"))) return "bun";
|
|
269315
|
+
if (existsSync14(join12(cwd, "package-lock.json"))) return "npm";
|
|
269316
|
+
if (existsSync14(join12(cwd, "package.json"))) return "npm";
|
|
268970
269317
|
return "unknown";
|
|
268971
269318
|
}
|
|
268972
269319
|
function boolText(value) {
|
|
@@ -270729,7 +271076,7 @@ var n2 = class extends V {
|
|
|
270729
271076
|
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
270730
271077
|
import process$1 from "process";
|
|
270731
271078
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
270732
|
-
import { existsSync as
|
|
271079
|
+
import { existsSync as existsSync15, lstatSync as lstatSync6, readdirSync as readdirSync6 } from "fs";
|
|
270733
271080
|
import { dirname as dirname9, join as join13 } from "path";
|
|
270734
271081
|
function isUnicodeSupported() {
|
|
270735
271082
|
if (process$1.platform !== "win32") {
|
|
@@ -271563,7 +271910,7 @@ var Prompt = class {
|
|
|
271563
271910
|
});
|
|
271564
271911
|
}
|
|
271565
271912
|
static async askTextWithAutocomplete(message2, completerFn, promptPrefix) {
|
|
271566
|
-
return new Promise((
|
|
271913
|
+
return new Promise((resolve26) => {
|
|
271567
271914
|
const promptStr = promptPrefix !== void 0 ? promptPrefix : `${picocolors22.cyan("?")} ${message2} \u203A `;
|
|
271568
271915
|
const rl = readline.createInterface({
|
|
271569
271916
|
input: process.stdin,
|
|
@@ -271631,7 +271978,7 @@ var Prompt = class {
|
|
|
271631
271978
|
clearSuggestions();
|
|
271632
271979
|
rl.close();
|
|
271633
271980
|
process.stdout.write("\n");
|
|
271634
|
-
|
|
271981
|
+
resolve26(null);
|
|
271635
271982
|
return;
|
|
271636
271983
|
}
|
|
271637
271984
|
if (currentSuggestion && key && (key.name === "tab" || key.name === "right")) {
|
|
@@ -271659,12 +272006,12 @@ var Prompt = class {
|
|
|
271659
272006
|
clearSuggestions();
|
|
271660
272007
|
rl.close();
|
|
271661
272008
|
process.stdout.write("\n");
|
|
271662
|
-
|
|
272009
|
+
resolve26(null);
|
|
271663
272010
|
});
|
|
271664
272011
|
rl.on("line", (line) => {
|
|
271665
272012
|
clearSuggestions();
|
|
271666
272013
|
rl.close();
|
|
271667
|
-
|
|
272014
|
+
resolve26(line);
|
|
271668
272015
|
});
|
|
271669
272016
|
});
|
|
271670
272017
|
}
|
|
@@ -272005,7 +272352,7 @@ import picocolors20 from "picocolors";
|
|
|
272005
272352
|
// src/tui/FullscreenTui.ts
|
|
272006
272353
|
import { join as join15 } from "path";
|
|
272007
272354
|
import { homedir as homedir7 } from "os";
|
|
272008
|
-
import { existsSync as
|
|
272355
|
+
import { existsSync as existsSync16 } from "fs";
|
|
272009
272356
|
import { exec as exec4 } from "child_process";
|
|
272010
272357
|
import readline3 from "readline";
|
|
272011
272358
|
|
|
@@ -272590,9 +272937,9 @@ var SLASH_COMMAND_DEFINITIONS = [
|
|
|
272590
272937
|
{
|
|
272591
272938
|
value: "auto",
|
|
272592
272939
|
description: {
|
|
272593
|
-
en: "
|
|
272594
|
-
zh: "\
|
|
272595
|
-
"zh-TW": "\
|
|
272940
|
+
en: "Approve every enabled tool action with the current host account's permissions",
|
|
272941
|
+
zh: "\u4EE5\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u6743\u9650\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C",
|
|
272942
|
+
"zh-TW": "\u4EE5\u76EE\u524D\u7CFB\u7D71\u5E33\u6236\u6B0A\u9650\u81EA\u52D5\u6279\u51C6\u6240\u6709\u5DF2\u555F\u7528\u5DE5\u5177\u64CD\u4F5C"
|
|
272596
272943
|
}
|
|
272597
272944
|
},
|
|
272598
272945
|
{
|
|
@@ -273402,7 +273749,7 @@ var TuiPromptSession = class {
|
|
|
273402
273749
|
this.requestRender();
|
|
273403
273750
|
const wasRaw = !!this.stdin.isRaw;
|
|
273404
273751
|
if (this.stdin.setRawMode) this.stdin.setRawMode(true);
|
|
273405
|
-
return new Promise((
|
|
273752
|
+
return new Promise((resolve26) => {
|
|
273406
273753
|
const listener = (str, key = {}) => {
|
|
273407
273754
|
const state = this.promptState;
|
|
273408
273755
|
if (!state) {
|
|
@@ -273420,7 +273767,7 @@ var TuiPromptSession = class {
|
|
|
273420
273767
|
this.requestRender();
|
|
273421
273768
|
}
|
|
273422
273769
|
};
|
|
273423
|
-
this.active = { resolve:
|
|
273770
|
+
this.active = { resolve: resolve26, wasRaw, listener };
|
|
273424
273771
|
this.stdin.on("keypress", listener);
|
|
273425
273772
|
this.stdin.resume();
|
|
273426
273773
|
});
|
|
@@ -273780,7 +274127,7 @@ function runNpmCommand(executable, args, options) {
|
|
|
273780
274127
|
});
|
|
273781
274128
|
}
|
|
273782
274129
|
function runNpmCommandAsync(executable, args, timeoutMs) {
|
|
273783
|
-
return new Promise((
|
|
274130
|
+
return new Promise((resolve26, reject) => {
|
|
273784
274131
|
execFile5(
|
|
273785
274132
|
executable,
|
|
273786
274133
|
args,
|
|
@@ -273795,7 +274142,7 @@ function runNpmCommandAsync(executable, args, timeoutMs) {
|
|
|
273795
274142
|
reject(error);
|
|
273796
274143
|
return;
|
|
273797
274144
|
}
|
|
273798
|
-
|
|
274145
|
+
resolve26(stdout2);
|
|
273799
274146
|
}
|
|
273800
274147
|
);
|
|
273801
274148
|
});
|
|
@@ -273886,11 +274233,11 @@ async function pageText(text2) {
|
|
|
273886
274233
|
process.stdin.setRawMode(true);
|
|
273887
274234
|
process.stdin.resume();
|
|
273888
274235
|
readline2.emitKeypressEvents(process.stdin);
|
|
273889
|
-
const waitForKeypress = () => new Promise((
|
|
274236
|
+
const waitForKeypress = () => new Promise((resolve26) => {
|
|
273890
274237
|
const onKeypress = (str, key) => {
|
|
273891
274238
|
process.stdin.removeListener("keypress", onKeypress);
|
|
273892
|
-
if (key?.ctrl && key.name === "c") return
|
|
273893
|
-
|
|
274239
|
+
if (key?.ctrl && key.name === "c") return resolve26("interrupt");
|
|
274240
|
+
resolve26(key?.name || str);
|
|
273894
274241
|
};
|
|
273895
274242
|
process.stdin.on("keypress", onKeypress);
|
|
273896
274243
|
});
|
|
@@ -274025,9 +274372,9 @@ var FullscreenTui = class {
|
|
|
274025
274372
|
const planPath2 = join15(this.cwd, ".orbit", "task.md");
|
|
274026
274373
|
const planPath1 = join15(this.cwd, "task.md");
|
|
274027
274374
|
let planPath = "";
|
|
274028
|
-
if (
|
|
274375
|
+
if (existsSync16(planPath2)) {
|
|
274029
274376
|
planPath = planPath2;
|
|
274030
|
-
} else if (
|
|
274377
|
+
} else if (existsSync16(planPath1)) {
|
|
274031
274378
|
planPath = planPath1;
|
|
274032
274379
|
}
|
|
274033
274380
|
if (!planPath) {
|
|
@@ -274419,23 +274766,23 @@ var FullscreenTui = class {
|
|
|
274419
274766
|
modified: 0,
|
|
274420
274767
|
deleted: 0
|
|
274421
274768
|
};
|
|
274422
|
-
const branchPromise = new Promise((
|
|
274769
|
+
const branchPromise = new Promise((resolve26) => {
|
|
274423
274770
|
exec4(
|
|
274424
274771
|
"git rev-parse --abbrev-ref HEAD",
|
|
274425
274772
|
{ ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
|
|
274426
274773
|
(err, stdout2) => {
|
|
274427
|
-
if (err)
|
|
274428
|
-
else
|
|
274774
|
+
if (err) resolve26("no-git");
|
|
274775
|
+
else resolve26(stdout2.trim());
|
|
274429
274776
|
}
|
|
274430
274777
|
);
|
|
274431
274778
|
});
|
|
274432
|
-
const statusPromise = new Promise((
|
|
274779
|
+
const statusPromise = new Promise((resolve26) => {
|
|
274433
274780
|
exec4(
|
|
274434
274781
|
"git status --porcelain",
|
|
274435
274782
|
{ ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
|
|
274436
274783
|
(err, stdout2) => {
|
|
274437
|
-
if (err)
|
|
274438
|
-
else
|
|
274784
|
+
if (err) resolve26("");
|
|
274785
|
+
else resolve26(stdout2);
|
|
274439
274786
|
}
|
|
274440
274787
|
);
|
|
274441
274788
|
});
|
|
@@ -274959,8 +275306,8 @@ var FullscreenTui = class {
|
|
|
274959
275306
|
this.start(this.budgetLimit);
|
|
274960
275307
|
}
|
|
274961
275308
|
process.stdout.write("\x1B[?25h");
|
|
274962
|
-
return new Promise((
|
|
274963
|
-
this.resolveInput =
|
|
275309
|
+
return new Promise((resolve26) => {
|
|
275310
|
+
this.resolveInput = resolve26;
|
|
274964
275311
|
this.inputBuffer = "";
|
|
274965
275312
|
this.cursorPosition = 0;
|
|
274966
275313
|
this.hideAutocomplete = false;
|
|
@@ -274995,7 +275342,7 @@ var FullscreenTui = class {
|
|
|
274995
275342
|
cleanup();
|
|
274996
275343
|
process.stdout.write("\x1B[?25l");
|
|
274997
275344
|
this.resolveInput = null;
|
|
274998
|
-
|
|
275345
|
+
resolve26(null);
|
|
274999
275346
|
} else {
|
|
275000
275347
|
this.ctrlCPressedOnce = true;
|
|
275001
275348
|
if (this.ctrlCTimeout) clearTimeout(this.ctrlCTimeout);
|
|
@@ -275049,7 +275396,7 @@ var FullscreenTui = class {
|
|
|
275049
275396
|
this.inputBuffer = "";
|
|
275050
275397
|
this.cursorPosition = 0;
|
|
275051
275398
|
this.render();
|
|
275052
|
-
|
|
275399
|
+
resolve26(submitted);
|
|
275053
275400
|
return;
|
|
275054
275401
|
}
|
|
275055
275402
|
if (key && key.ctrl && key.name === "j") {
|
|
@@ -276028,7 +276375,7 @@ import { z as z69 } from "zod";
|
|
|
276028
276375
|
import picocolors18 from "picocolors";
|
|
276029
276376
|
|
|
276030
276377
|
// src/commands/customCommands.ts
|
|
276031
|
-
import { existsSync as
|
|
276378
|
+
import { existsSync as existsSync17, readdirSync as readdirSync7 } from "fs";
|
|
276032
276379
|
import { basename as basename4, extname as extname3, join as join16 } from "path";
|
|
276033
276380
|
import { homedir as homedir8 } from "os";
|
|
276034
276381
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -276085,7 +276432,7 @@ function parseCommandFile(filePath, source) {
|
|
|
276085
276432
|
};
|
|
276086
276433
|
}
|
|
276087
276434
|
function loadDirectory(directory, source) {
|
|
276088
|
-
if (!
|
|
276435
|
+
if (!existsSync17(directory)) return [];
|
|
276089
276436
|
const commands = [];
|
|
276090
276437
|
const queue = [directory];
|
|
276091
276438
|
while (queue.length > 0 && commands.length < 200) {
|
|
@@ -276155,7 +276502,7 @@ function resolveBundledCommandsDirectory() {
|
|
|
276155
276502
|
new URL("../../commands/", import.meta.url),
|
|
276156
276503
|
new URL("../commands/", import.meta.url)
|
|
276157
276504
|
].map((candidate) => fileURLToPath3(candidate));
|
|
276158
|
-
return candidates.find((candidate) =>
|
|
276505
|
+
return candidates.find((candidate) => existsSync17(candidate)) ?? candidates[0];
|
|
276159
276506
|
}
|
|
276160
276507
|
function expandCustomCommand(command, rawArguments) {
|
|
276161
276508
|
const args = rawArguments.trim();
|
|
@@ -276240,12 +276587,12 @@ import { createRequire as createRequire2 } from "module";
|
|
|
276240
276587
|
// src/runtime/webui/WebUiRuntime.ts
|
|
276241
276588
|
import http2 from "http";
|
|
276242
276589
|
import { randomBytes as randomBytes3, randomUUID as randomUUID10 } from "crypto";
|
|
276243
|
-
import { isAbsolute as
|
|
276590
|
+
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve11 } from "path";
|
|
276244
276591
|
import { z as z58 } from "zod";
|
|
276245
276592
|
|
|
276246
276593
|
// src/runtime/AutocompleteCandidates.ts
|
|
276247
276594
|
import glob4 from "fast-glob";
|
|
276248
|
-
import { existsSync as
|
|
276595
|
+
import { existsSync as existsSync18, readdirSync as readdirSync8 } from "fs";
|
|
276249
276596
|
import { homedir as homedir9 } from "os";
|
|
276250
276597
|
import { dirname as dirname10, join as join17, resolve as resolve9 } from "path";
|
|
276251
276598
|
import { z as z55 } from "zod";
|
|
@@ -276308,7 +276655,7 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
276308
276655
|
}
|
|
276309
276656
|
try {
|
|
276310
276657
|
const indexPath = join17(cwd, ".orbit", "symbols.json");
|
|
276311
|
-
if (
|
|
276658
|
+
if (existsSync18(indexPath)) {
|
|
276312
276659
|
const raw = await readBoundedRegularFileAsync(
|
|
276313
276660
|
indexPath,
|
|
276314
276661
|
AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES
|
|
@@ -276330,9 +276677,9 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
276330
276677
|
cwd,
|
|
276331
276678
|
config.session?.path ?? ".orbit/sessions"
|
|
276332
276679
|
);
|
|
276333
|
-
if (
|
|
276680
|
+
if (existsSync18(sessionDir)) {
|
|
276334
276681
|
for (const dir of readdirSync8(sessionDir)) {
|
|
276335
|
-
if (
|
|
276682
|
+
if (existsSync18(join17(sessionDir, dir, "session.json"))) {
|
|
276336
276683
|
sessions.push(dir);
|
|
276337
276684
|
}
|
|
276338
276685
|
}
|
|
@@ -277070,6 +277417,77 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277070
277417
|
first.focus();
|
|
277071
277418
|
}
|
|
277072
277419
|
});
|
|
277420
|
+
const closeFullAccessDialog = (restoreFocus = true, approved = false) => {
|
|
277421
|
+
if (elements.fullAccessDialog.hidden) return;
|
|
277422
|
+
const request = state.fullAccessRequest;
|
|
277423
|
+
if (request && request.submitting) return;
|
|
277424
|
+
elements.fullAccessDialog.hidden = true;
|
|
277425
|
+
elements.fullAccessDialog.setAttribute('aria-hidden', 'true');
|
|
277426
|
+
elements.fullAccessDialog.removeAttribute('aria-busy');
|
|
277427
|
+
elements.fullAccessBackdrop.disabled = false;
|
|
277428
|
+
elements.fullAccessCancel.disabled = false;
|
|
277429
|
+
elements.fullAccessConfirm.disabled = false;
|
|
277430
|
+
elements.appShell.inert = false;
|
|
277431
|
+
state.fullAccessRequest = null;
|
|
277432
|
+
if (restoreFocus && state.fullAccessReturnFocus) state.fullAccessReturnFocus.focus();
|
|
277433
|
+
state.fullAccessReturnFocus = null;
|
|
277434
|
+
if (request) request.resolve(approved);
|
|
277435
|
+
if (!approved) void loadStatus().catch(() => {});
|
|
277436
|
+
};
|
|
277437
|
+
const requestPermissionMode = (mode, quiet = false) => {
|
|
277438
|
+
if (mode === 'auto' && state.status && state.status.permissions && state.status.permissions.fullAccess) {
|
|
277439
|
+
return Promise.resolve(true);
|
|
277440
|
+
}
|
|
277441
|
+
if (mode !== 'auto') {
|
|
277442
|
+
return applySettings({ permissionMode: mode }, quiet);
|
|
277443
|
+
}
|
|
277444
|
+
if (state.fullAccessRequest) return state.fullAccessRequest.promise;
|
|
277445
|
+
let resolveRequest;
|
|
277446
|
+
const promise = new Promise((resolve) => { resolveRequest = resolve; });
|
|
277447
|
+
state.fullAccessReturnFocus = document.activeElement;
|
|
277448
|
+
state.fullAccessRequest = {
|
|
277449
|
+
quiet,
|
|
277450
|
+
promise,
|
|
277451
|
+
resolve: resolveRequest,
|
|
277452
|
+
submitting: false,
|
|
277453
|
+
};
|
|
277454
|
+
elements.fullAccessDialog.hidden = false;
|
|
277455
|
+
elements.fullAccessDialog.setAttribute('aria-hidden', 'false');
|
|
277456
|
+
elements.appShell.inert = true;
|
|
277457
|
+
elements.fullAccessConfirm.focus();
|
|
277458
|
+
return promise;
|
|
277459
|
+
};
|
|
277460
|
+
elements.fullAccessBackdrop.addEventListener('click', () => closeFullAccessDialog());
|
|
277461
|
+
elements.fullAccessCancel.addEventListener('click', () => closeFullAccessDialog());
|
|
277462
|
+
elements.fullAccessConfirm.addEventListener('click', async () => {
|
|
277463
|
+
const request = state.fullAccessRequest;
|
|
277464
|
+
if (!request || request.submitting) return;
|
|
277465
|
+
request.submitting = true;
|
|
277466
|
+
elements.fullAccessDialog.setAttribute('aria-busy', 'true');
|
|
277467
|
+
elements.fullAccessBackdrop.disabled = true;
|
|
277468
|
+
elements.fullAccessCancel.disabled = true;
|
|
277469
|
+
elements.fullAccessConfirm.disabled = true;
|
|
277470
|
+
try {
|
|
277471
|
+
await applySettings({ permissionMode: 'auto', fullAccessConfirmed: true }, request.quiet);
|
|
277472
|
+
request.submitting = false;
|
|
277473
|
+
closeFullAccessDialog(true, true);
|
|
277474
|
+
} catch {
|
|
277475
|
+
request.submitting = false;
|
|
277476
|
+
closeFullAccessDialog();
|
|
277477
|
+
}
|
|
277478
|
+
});
|
|
277479
|
+
elements.fullAccessDialog.addEventListener('keydown', (event) => {
|
|
277480
|
+
if (event.key !== 'Tab') return;
|
|
277481
|
+
const first = elements.fullAccessCancel;
|
|
277482
|
+
const last = elements.fullAccessConfirm;
|
|
277483
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
277484
|
+
event.preventDefault();
|
|
277485
|
+
last.focus();
|
|
277486
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
277487
|
+
event.preventDefault();
|
|
277488
|
+
first.focus();
|
|
277489
|
+
}
|
|
277490
|
+
});
|
|
277073
277491
|
elements.commandsButton.addEventListener('click', openCommandPalette);
|
|
277074
277492
|
elements.commandTrigger.addEventListener('click', openCommandPalette);
|
|
277075
277493
|
elements.commandPaletteBackdrop.addEventListener('click', closeCommandPalette);
|
|
@@ -277145,7 +277563,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277145
277563
|
});
|
|
277146
277564
|
|
|
277147
277565
|
elements.permissionSelect.addEventListener('change', () => {
|
|
277148
|
-
|
|
277566
|
+
requestPermissionMode(elements.permissionSelect.value, true).catch(() => {});
|
|
277149
277567
|
});
|
|
277150
277568
|
|
|
277151
277569
|
elements.languageOptions.querySelectorAll('[data-language-value]').forEach((button) => {
|
|
@@ -277160,7 +277578,11 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277160
277578
|
});
|
|
277161
277579
|
|
|
277162
277580
|
elements.permissionSegments.querySelectorAll('[data-mode]').forEach((button) => {
|
|
277163
|
-
button.addEventListener('click', () =>
|
|
277581
|
+
button.addEventListener('click', () => requestPermissionMode(button.dataset.mode).catch(() => {}));
|
|
277582
|
+
});
|
|
277583
|
+
|
|
277584
|
+
elements.agentMaxIterations.addEventListener('change', () => {
|
|
277585
|
+
applySettings({ agentMaxIterations: Number(elements.agentMaxIterations.value) }, true).catch(() => {});
|
|
277164
277586
|
});
|
|
277165
277587
|
|
|
277166
277588
|
elements.searchToggle.addEventListener('click', () => {
|
|
@@ -277432,6 +277854,10 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277432
277854
|
|
|
277433
277855
|
document.addEventListener('keydown', (event) => {
|
|
277434
277856
|
if (event.key === 'Escape') {
|
|
277857
|
+
if (!elements.fullAccessDialog.hidden) {
|
|
277858
|
+
closeFullAccessDialog();
|
|
277859
|
+
return;
|
|
277860
|
+
}
|
|
277435
277861
|
if (!elements.projectDialog.hidden) {
|
|
277436
277862
|
closeProjectDialog();
|
|
277437
277863
|
return;
|
|
@@ -278186,6 +278612,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278186
278612
|
table: '数据表格',
|
|
278187
278613
|
reasoning: '思考过程',
|
|
278188
278614
|
tool: '工具',
|
|
278615
|
+
toolBatch: '工具步骤',
|
|
278189
278616
|
running: '运行中',
|
|
278190
278617
|
done: '完成',
|
|
278191
278618
|
error: '失败',
|
|
@@ -278306,13 +278733,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278306
278733
|
modeNormal: '标准',
|
|
278307
278734
|
modeAuto: '全自动',
|
|
278308
278735
|
modePlan: '规划',
|
|
278309
|
-
permissionFullAccess: chinese('
|
|
278736
|
+
permissionFullAccess: chinese('完整权限已开启:所有已启用工具操作均自动批准。', '完整權限已開啟:所有已啟用工具操作均自動批准。'),
|
|
278310
278737
|
permissionAutoLimited: chinese('全自动尚未完全生效,部分操作仍需确认。', '全自動尚未完全生效,部分操作仍需確認。'),
|
|
278311
278738
|
permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
|
|
278312
278739
|
permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
|
|
278313
278740
|
permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
|
|
278314
|
-
permissionGuards: chinese('
|
|
278741
|
+
permissionGuards: chinese('危险操作会被阻止,显式文件路径会受保护;本机命令、预算与长任务上限仍然有效。', '危險操作會被阻止,顯式檔案路徑會受保護;本機命令、預算與長任務上限仍然有效。'),
|
|
278315
278742
|
permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
|
|
278743
|
+
permissionNoGuards: chinese('权限策略不再拦截或复核危险、密钥、不透明、本地网络及工作区外操作。命令拥有当前系统账户权限并继承 Orbit 进程环境;已运行的子进程会保留这些权限直至停止。中间迭代检查点会自动继续且不再询问。输出脱敏、项目钩子、验证契约、预算、停滞循环检测和配置的最终迭代上限仍有效;工作区外改动无法由 Orbit 回滚。', '權限策略不再攔截或複核危險、密鑰、不透明、本機網路及工作區外操作。命令擁有目前系統帳戶權限並繼承 Orbit 程序環境;已執行的子程序會保留這些權限直至停止。中間迭代檢查點會自動繼續且不再詢問。輸出脫敏、專案掛鉤、驗證契約、預算、停滯迴圈偵測和設定的最終迭代上限仍有效;工作區外變更無法由 Orbit 回滾。'),
|
|
278316
278744
|
}
|
|
278317
278745
|
: {
|
|
278318
278746
|
connected: 'Connected',
|
|
@@ -278338,6 +278766,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278338
278766
|
table: 'Data table',
|
|
278339
278767
|
reasoning: 'Reasoning',
|
|
278340
278768
|
tool: 'Tool',
|
|
278769
|
+
toolBatch: 'Tool steps',
|
|
278341
278770
|
running: 'Running',
|
|
278342
278771
|
done: 'Done',
|
|
278343
278772
|
error: 'Failed',
|
|
@@ -278458,13 +278887,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278458
278887
|
modeNormal: 'Normal',
|
|
278459
278888
|
modeAuto: 'Full access',
|
|
278460
278889
|
modePlan: 'Plan',
|
|
278461
|
-
permissionFullAccess: 'Full
|
|
278890
|
+
permissionFullAccess: 'Unrestricted Full Access is on: every enabled tool action is approved automatically.',
|
|
278462
278891
|
permissionAutoLimited: 'Full access is not fully active; some actions still require approval.',
|
|
278463
278892
|
permissionStrict: 'Strict mode asks before consequential operations.',
|
|
278464
278893
|
permissionNormal: 'Normal mode asks before writes and command execution.',
|
|
278465
278894
|
permissionPlan: 'Plan mode analyzes and reads without changing files.',
|
|
278466
|
-
permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded;
|
|
278895
|
+
permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; commands remain host processes and budget/long-task limits stay active.',
|
|
278467
278896
|
permissionGuardsReduced: 'Warning: some hard safety guards are disabled in configuration.',
|
|
278897
|
+
permissionNoGuards: "The permission policy no longer blocks or reviews dangerous, protected, opaque, local-network, or outside-workspace actions. Commands use host-account permissions and inherit Orbit's process environment; running children retain that authority until stopped. Intermediate iteration checkpoints continue automatically without asking. Output redaction, project hooks, verification contracts, budget, stalled-loop detection, and the configured final iteration ceiling remain; outside-workspace changes have no Orbit rollback.",
|
|
278468
278898
|
};
|
|
278469
278899
|
|
|
278470
278900
|
if (language === 'zh-TW') {
|
|
@@ -278645,6 +279075,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278645
279075
|
sessionDeleteDialog: byId('sessionDeleteDialog'),
|
|
278646
279076
|
sessionDeleteBackdrop: byId('sessionDeleteBackdrop'),
|
|
278647
279077
|
sessionDeleteName: byId('sessionDeleteName'),
|
|
279078
|
+
fullAccessDialog: byId('fullAccessDialog'),
|
|
279079
|
+
fullAccessBackdrop: byId('fullAccessBackdrop'),
|
|
279080
|
+
fullAccessCancel: byId('fullAccessCancel'),
|
|
279081
|
+
fullAccessConfirm: byId('fullAccessConfirm'),
|
|
278648
279082
|
sessionDeleteCancel: byId('sessionDeleteCancel'),
|
|
278649
279083
|
sessionDeleteConfirm: byId('sessionDeleteConfirm'),
|
|
278650
279084
|
newTaskButton: byId('newTaskButton'),
|
|
@@ -278705,6 +279139,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278705
279139
|
permissionSelect: byId('permissionSelect'),
|
|
278706
279140
|
permissionSegments: byId('permissionSegments'),
|
|
278707
279141
|
permissionSummary: byId('permissionSummary'),
|
|
279142
|
+
agentMaxIterations: byId('agentMaxIterations'),
|
|
278708
279143
|
searchToggle: byId('searchToggle'),
|
|
278709
279144
|
searchEnabled: byId('searchEnabled'),
|
|
278710
279145
|
searchDependencies: byId('searchDependencies'),
|
|
@@ -278817,6 +279252,8 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278817
279252
|
sessionQuery: '',
|
|
278818
279253
|
sessionLimit: 24,
|
|
278819
279254
|
sessionDeleteReturnFocus: null,
|
|
279255
|
+
fullAccessReturnFocus: null,
|
|
279256
|
+
fullAccessRequest: null,
|
|
278820
279257
|
projectDialogReturnFocus: null,
|
|
278821
279258
|
projectPickerPending: false,
|
|
278822
279259
|
projectLaunchPending: false,
|
|
@@ -279851,6 +280288,54 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
|
|
|
279851
280288
|
return { root: details, body };
|
|
279852
280289
|
}
|
|
279853
280290
|
|
|
280291
|
+
function displayToolName(name) {
|
|
280292
|
+
const normalized = String(name || copy.tool).trim();
|
|
280293
|
+
if (normalized === 'bash') return 'Shell';
|
|
280294
|
+
if (normalized === 'run_tests') return language === 'en' ? 'Verification' : '验证';
|
|
280295
|
+
return normalized.replace(/_/g, ' ');
|
|
280296
|
+
}
|
|
280297
|
+
|
|
280298
|
+
function isBatchableTool(block) {
|
|
280299
|
+
return block
|
|
280300
|
+
&& block.type === 'tool'
|
|
280301
|
+
&& block.status === 'success'
|
|
280302
|
+
&& !block.isError
|
|
280303
|
+
&& ['read_file', 'grep', 'glob', 'bash', 'get_background_task_output'].includes(block.name);
|
|
280304
|
+
}
|
|
280305
|
+
|
|
280306
|
+
function createToolBatch(blocks) {
|
|
280307
|
+
const root = document.createElement('details');
|
|
280308
|
+
root.className = 'tool-batch is-success';
|
|
280309
|
+
const summary = document.createElement('summary');
|
|
280310
|
+
summary.className = 'tool-batch-summary';
|
|
280311
|
+
const status = document.createElement('span');
|
|
280312
|
+
status.className = 'tool-status';
|
|
280313
|
+
const label = document.createElement('strong');
|
|
280314
|
+
label.textContent = copy.toolBatch;
|
|
280315
|
+
const names = [...new Set(blocks.map((block) => displayToolName(block.name)))];
|
|
280316
|
+
const context = document.createElement('span');
|
|
280317
|
+
context.className = 'tool-context';
|
|
280318
|
+
context.textContent = names.slice(0, 3).join(' · ');
|
|
280319
|
+
const count = document.createElement('span');
|
|
280320
|
+
count.className = 'tool-batch-count';
|
|
280321
|
+
count.textContent = '×' + blocks.length;
|
|
280322
|
+
const chevron = document.createElement('span');
|
|
280323
|
+
chevron.className = 'tool-chevron';
|
|
280324
|
+
chevron.setAttribute('aria-hidden', 'true');
|
|
280325
|
+
chevron.textContent = '›';
|
|
280326
|
+
summary.append(status, label, context, count, chevron);
|
|
280327
|
+
const body = document.createElement('div');
|
|
280328
|
+
body.className = 'tool-batch-body';
|
|
280329
|
+
blocks.forEach((block) => body.append(createToolCard(block)));
|
|
280330
|
+
root.append(summary, body);
|
|
280331
|
+
summary.setAttribute('aria-label', copy.toolBatch + ' · ' + blocks.length);
|
|
280332
|
+
summary.setAttribute('aria-expanded', 'false');
|
|
280333
|
+
root.addEventListener('toggle', () => {
|
|
280334
|
+
summary.setAttribute('aria-expanded', String(root.open));
|
|
280335
|
+
});
|
|
280336
|
+
return root;
|
|
280337
|
+
}
|
|
280338
|
+
|
|
279854
280339
|
function createToolCard(block) {
|
|
279855
280340
|
const root = document.createElement('details');
|
|
279856
280341
|
const summary = document.createElement('summary');
|
|
@@ -279891,7 +280376,7 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
|
|
|
279891
280376
|
const context = root.querySelector('.tool-context');
|
|
279892
280377
|
const outcome = root.querySelector('.tool-outcome');
|
|
279893
280378
|
const detail = root.querySelector('.tool-detail');
|
|
279894
|
-
label.textContent = block.name
|
|
280379
|
+
label.textContent = displayToolName(block.name);
|
|
279895
280380
|
const summaryText = String(block.summary || '').trim();
|
|
279896
280381
|
const detailText = String(block.detail || '').trim();
|
|
279897
280382
|
context.textContent = summaryText || detailText.split('\n', 1)[0] || '';
|
|
@@ -280009,7 +280494,21 @@ var WEB_UI_CLIENT_MESSAGES_SCRIPT = String.raw` function appendInline(parent, t
|
|
|
280009
280494
|
const blocks = Array.isArray(message.blocks) && message.blocks.length
|
|
280010
280495
|
? message.blocks
|
|
280011
280496
|
: [{ type: 'text', text: message.text || '' }];
|
|
280012
|
-
for (
|
|
280497
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
280498
|
+
const block = blocks[blockIndex];
|
|
280499
|
+
if (!streaming && isBatchableTool(block)) {
|
|
280500
|
+
const sequence = [block];
|
|
280501
|
+
while (blockIndex + 1 < blocks.length && isBatchableTool(blocks[blockIndex + 1])) {
|
|
280502
|
+
sequence.push(blocks[blockIndex + 1]);
|
|
280503
|
+
blockIndex += 1;
|
|
280504
|
+
}
|
|
280505
|
+
if (sequence.length >= 3) {
|
|
280506
|
+
content.append(createToolBatch(sequence));
|
|
280507
|
+
continue;
|
|
280508
|
+
}
|
|
280509
|
+
sequence.forEach((item) => content.append(createToolCard(item)));
|
|
280510
|
+
continue;
|
|
280511
|
+
}
|
|
280013
280512
|
if (block.type === 'text' && block.text) {
|
|
280014
280513
|
const body = document.createElement('div');
|
|
280015
280514
|
body.className = 'rich-text' + (streaming ? ' stream-caret' : '');
|
|
@@ -280516,7 +281015,7 @@ var WEB_UI_CLIENT_PALETTE_SCRIPT = String.raw` let paletteActions = [];
|
|
|
280516
281015
|
detail: copy.switchMode,
|
|
280517
281016
|
keywords: 'permission mode security ' + mode,
|
|
280518
281017
|
idle: true,
|
|
280519
|
-
run: () =>
|
|
281018
|
+
run: () => requestPermissionMode(mode, false),
|
|
280520
281019
|
});
|
|
280521
281020
|
}
|
|
280522
281021
|
return actions;
|
|
@@ -281470,12 +281969,17 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
281470
281969
|
const hardGuardsEnabled = permissions.dangerousCommandsBlocked !== false
|
|
281471
281970
|
&& permissions.secretsProtected !== false
|
|
281472
281971
|
&& permissions.workspaceBoundary !== false;
|
|
281473
|
-
const permissionSummary = modeSummary + ' ' + (
|
|
281972
|
+
const permissionSummary = modeSummary + ' ' + (permissions.fullAccess
|
|
281973
|
+
? copy.permissionNoGuards
|
|
281974
|
+
: hardGuardsEnabled
|
|
281975
|
+
? copy.permissionGuards
|
|
281976
|
+
: copy.permissionGuardsReduced);
|
|
281474
281977
|
if (elements.permissionSummary.textContent !== permissionSummary) {
|
|
281475
281978
|
elements.permissionSummary.textContent = permissionSummary;
|
|
281476
281979
|
}
|
|
281477
281980
|
elements.permissionSummary.classList.toggle('is-full-access', Boolean(permissions.fullAccess));
|
|
281478
281981
|
elements.permissionSummary.classList.toggle('is-warning', !hardGuardsEnabled || (mode === 'auto' && !permissions.fullAccess));
|
|
281982
|
+
elements.agentMaxIterations.value = String(data.agent && data.agent.maxIterations || 200);
|
|
281479
281983
|
const webSearch = data.tools && data.tools.webSearch || {};
|
|
281480
281984
|
elements.searchProvider.value = webSearch.provider || 'auto';
|
|
281481
281985
|
syncSelectControl(elements.searchProvider);
|
|
@@ -282736,7 +283240,8 @@ function summarizeWebToolValue(value, options = {}) {
|
|
|
282736
283240
|
"symbol",
|
|
282737
283241
|
"url",
|
|
282738
283242
|
"language",
|
|
282739
|
-
"description"
|
|
283243
|
+
"description",
|
|
283244
|
+
"command"
|
|
282740
283245
|
];
|
|
282741
283246
|
const entries = [];
|
|
282742
283247
|
for (const field of safeFields) {
|
|
@@ -282842,6 +283347,9 @@ function safeWebText(value, maxLength) {
|
|
|
282842
283347
|
}
|
|
282843
283348
|
function safeWebToolText(value, maxLength) {
|
|
282844
283349
|
return safeWebText(value, maxLength).replace(
|
|
283350
|
+
/(--(?:api-?key|token|password|secret)(?:=|\s+))(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi,
|
|
283351
|
+
"$1***REDACTED***"
|
|
283352
|
+
).replace(
|
|
282845
283353
|
/((?:api[_-]?key|token|password|secret)\s*[=:]\s*)[^\s,;]+/gi,
|
|
282846
283354
|
"$1***REDACTED***"
|
|
282847
283355
|
).trim();
|
|
@@ -282981,6 +283489,7 @@ function completionFileScore(file, query) {
|
|
|
282981
283489
|
}
|
|
282982
283490
|
function collectWebUiStatus(options, activeTurn) {
|
|
282983
283491
|
const { cwd, config, loop } = options;
|
|
283492
|
+
const fullAccess = isFullAccessEnabled(config);
|
|
282984
283493
|
const sessions = safeCall(() => loop?.getSessions?.()) || [];
|
|
282985
283494
|
const relevantFiles = safeCall(() => loop?.getRelevantFiles?.()) || [];
|
|
282986
283495
|
const history = safeCall(() => loop?.getHistory?.()) || [];
|
|
@@ -283032,6 +283541,9 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
283032
283541
|
maxReviewAttempts: config.agent.maxReviewAttempts,
|
|
283033
283542
|
maxReviewConcurrency: config.agent.maxReviewConcurrency
|
|
283034
283543
|
},
|
|
283544
|
+
agent: {
|
|
283545
|
+
maxIterations: config.agent.maxIterations
|
|
283546
|
+
},
|
|
283035
283547
|
backgroundTasks,
|
|
283036
283548
|
inputQueue,
|
|
283037
283549
|
provider: {
|
|
@@ -283052,12 +283564,12 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
283052
283564
|
modelOptions: buildModelOptions(options, activeModel2),
|
|
283053
283565
|
permissions: {
|
|
283054
283566
|
mode: config.permissions.mode,
|
|
283055
|
-
fullAccess
|
|
283567
|
+
fullAccess,
|
|
283056
283568
|
writeApproval: config.permissions.requireApprovalForWrite,
|
|
283057
283569
|
commandApproval: config.permissions.requireApprovalForBash,
|
|
283058
283570
|
dangerousCommandsBlocked: config.permissions.blockDangerousCommands,
|
|
283059
283571
|
secretsProtected: config.permissions.protectSecrets,
|
|
283060
|
-
workspaceBoundary:
|
|
283572
|
+
workspaceBoundary: !fullAccess
|
|
283061
283573
|
},
|
|
283062
283574
|
tools: {
|
|
283063
283575
|
webSearch: {
|
|
@@ -283346,6 +283858,7 @@ function collectWebUiSettings(options) {
|
|
|
283346
283858
|
model: activeModel2,
|
|
283347
283859
|
modelOptions: buildModelOptions(options, activeModel2),
|
|
283348
283860
|
permissionMode: config.permissions.mode,
|
|
283861
|
+
agentMaxIterations: config.agent.maxIterations,
|
|
283349
283862
|
webSearchEnabled: config.tools.webSearch.enabled,
|
|
283350
283863
|
webSearchProvider: config.tools.webSearch.provider,
|
|
283351
283864
|
webSearchMaxResults: config.tools.webSearch.maxResults,
|
|
@@ -283957,7 +284470,15 @@ var BASE_COPY = {
|
|
|
283957
284470
|
apply: "Apply",
|
|
283958
284471
|
permission: "Permission mode",
|
|
283959
284472
|
permissionDescription: "Choose how much Orbit may do without interrupting you.",
|
|
283960
|
-
permissionGuardLabel: "
|
|
284473
|
+
permissionGuardLabel: "The active permission scope and remaining safeguards appear here.",
|
|
284474
|
+
agentMaxIterations: "Long-task iteration limit",
|
|
284475
|
+
agentMaxIterationsDescription: "Maximum model/tool rounds in one task. Full Access continues intermediate checkpoints without asking; this final ceiling, cancellation, budget, and stalled-loop detection remain active.",
|
|
284476
|
+
fullAccessConfirmTitle: "Grant unrestricted Full Access?",
|
|
284477
|
+
fullAccessConfirmBody: "Orbit's permission policy will approve every enabled tool action without asking or requesting post-write review.",
|
|
284478
|
+
fullAccessConfirmScope: "Reads, writes, local/private network calls, dangerous operations, protected paths, and outside-workspace commands run automatically.",
|
|
284479
|
+
fullAccessConfirmGuards: "No permission guard remains. Opaque interpreters and commands that can delete or overwrite host data are also approved.",
|
|
284480
|
+
fullAccessConfirmHost: "Actions receive your operating-system account's permissions, and child commands inherit the Orbit process environment, including credential variables; already-running children keep that authority until stopped. Credential values remain redacted from logs and model-visible output. Outside-workspace changes are not covered by Orbit rollback. Intermediate iteration checkpoints continue automatically without asking; the configured final iteration ceiling, cancellation, budget, stalled-loop detection, project hooks, and verification contracts remain active.",
|
|
284481
|
+
fullAccessConfirmAction: "Grant Full Access",
|
|
283961
284482
|
modeStrict: "Strict",
|
|
283962
284483
|
modeNormal: "Normal",
|
|
283963
284484
|
modeAuto: "Full access",
|
|
@@ -284137,7 +284658,15 @@ var BASE_COPY = {
|
|
|
284137
284658
|
apply: "\u5E94\u7528",
|
|
284138
284659
|
permission: "\u6743\u9650\u6A21\u5F0F",
|
|
284139
284660
|
permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
284140
|
-
permissionGuardLabel: "\
|
|
284661
|
+
permissionGuardLabel: "\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u6743\u9650\u8303\u56F4\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u62A4\u673A\u5236\u3002",
|
|
284662
|
+
agentMaxIterations: "\u957F\u4EFB\u52A1\u8FED\u4EE3\u4E0A\u9650",
|
|
284663
|
+
agentMaxIterationsDescription: "\u5355\u6B21\u4EFB\u52A1\u5141\u8BB8\u7684\u6700\u5927\u6A21\u578B/\u5DE5\u5177\u8F6E\u6570\u3002Full Access \u4F1A\u65E0\u8BE2\u95EE\u8D8A\u8FC7\u4E2D\u95F4\u68C0\u67E5\u70B9\uFF1B\u6700\u7EC8\u4E0A\u9650\u3001\u53D6\u6D88\u3001\u9884\u7B97\u548C\u505C\u6EDE\u5FAA\u73AF\u68C0\u6D4B\u4ECD\u7136\u6709\u6548\u3002",
|
|
284664
|
+
fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
|
|
284665
|
+
fullAccessConfirmBody: "Orbit \u7684\u6743\u9650\u7B56\u7565\u5C06\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8BE2\u95EE\u6216\u8981\u6C42\u5199\u5165\u540E\u590D\u6838\u3002",
|
|
284666
|
+
fullAccessConfirmScope: "\u8BFB\u53D6\u3001\u5199\u5165\u3001\u672C\u5730\u6216\u79C1\u6709\u7F51\u7EDC\u8BBF\u95EE\u3001\u5371\u9669\u64CD\u4F5C\u3001\u5BC6\u94A5\u8DEF\u5F84\u53CA\u5DE5\u4F5C\u533A\u5916\u547D\u4EE4\u5747\u4F1A\u81EA\u52A8\u6267\u884C\u3002",
|
|
284667
|
+
fullAccessConfirmGuards: "\u6743\u9650\u4FDD\u62A4\u5C06\u5168\u90E8\u5173\u95ED\uFF1B\u4E0D\u900F\u660E\u89E3\u91CA\u5668\u4EE5\u53CA\u53EF\u80FD\u5220\u9664\u6216\u8986\u76D6\u4E3B\u673A\u6570\u636E\u7684\u547D\u4EE4\u4E5F\u4F1A\u83B7\u51C6\u6267\u884C\u3002",
|
|
284668
|
+
fullAccessConfirmHost: "\u64CD\u4F5C\u62E5\u6709\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u7684\u6743\u9650\uFF0C\u5B50\u547D\u4EE4\u4F1A\u7EE7\u627F Orbit \u8FDB\u7A0B\u73AF\u5883\uFF0C\u5305\u62EC\u51ED\u636E\u53D8\u91CF\uFF1B\u5DF2\u8FD0\u884C\u7684\u5B50\u8FDB\u7A0B\u4F1A\u4FDD\u7559\u8FD9\u4E9B\u6743\u9650\u76F4\u81F3\u505C\u6B62\u3002\u51ED\u636E\u503C\u4ECD\u4F1A\u4ECE\u65E5\u5FD7\u548C\u6A21\u578B\u53EF\u89C1\u8F93\u51FA\u4E2D\u8131\u654F\uFF0C\u5DE5\u4F5C\u533A\u5916\u6539\u52A8\u4E0D\u53D7 Orbit \u56DE\u6EDA\u4FDD\u62A4\u3002\u4E2D\u95F4\u8FED\u4EE3\u68C0\u67E5\u70B9\u4F1A\u65E0\u8BE2\u95EE\u81EA\u52A8\u7EE7\u7EED\uFF1B\u914D\u7F6E\u7684\u6700\u7EC8\u8FED\u4EE3\u4E0A\u9650\u3001\u53D6\u6D88\u80FD\u529B\u3001\u9884\u7B97\u3001\u505C\u6EDE\u5FAA\u73AF\u68C0\u6D4B\u3001\u9879\u76EE\u94A9\u5B50\u53CA\u9A8C\u8BC1\u5951\u7EA6\u4ECD\u7136\u6709\u6548\u3002",
|
|
284669
|
+
fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6743\u9650",
|
|
284141
284670
|
modeStrict: "\u4E25\u683C",
|
|
284142
284671
|
modeNormal: "\u6807\u51C6",
|
|
284143
284672
|
modeAuto: "\u5168\u81EA\u52A8",
|
|
@@ -284289,7 +284818,15 @@ var COPY = {
|
|
|
284289
284818
|
apply: "\u5957\u7528",
|
|
284290
284819
|
permission: "\u6B0A\u9650\u6A21\u5F0F",
|
|
284291
284820
|
permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
284292
|
-
permissionGuardLabel: "\
|
|
284821
|
+
permissionGuardLabel: "\u9019\u88E1\u6703\u986F\u793A\u76EE\u524D\u6B0A\u9650\u7BC4\u570D\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u8B77\u6A5F\u5236\u3002",
|
|
284822
|
+
agentMaxIterations: "\u9577\u4EFB\u52D9\u8FED\u4EE3\u4E0A\u9650",
|
|
284823
|
+
agentMaxIterationsDescription: "\u55AE\u6B21\u4EFB\u52D9\u5141\u8A31\u7684\u6700\u5927\u6A21\u578B/\u5DE5\u5177\u8F2A\u6578\u3002Full Access \u6703\u4E0D\u7D93\u8A62\u554F\u8D8A\u904E\u4E2D\u9593\u6AA2\u67E5\u9EDE\uFF1B\u6700\u7D42\u4E0A\u9650\u3001\u53D6\u6D88\u3001\u9810\u7B97\u548C\u505C\u6EEF\u8FF4\u5708\u5075\u6E2C\u4ECD\u7136\u6709\u6548\u3002",
|
|
284824
|
+
fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
|
|
284825
|
+
fullAccessConfirmBody: "Orbit \u7684\u6B0A\u9650\u7B56\u7565\u5C07\u81EA\u52D5\u6279\u51C6\u6240\u6709\u5DF2\u555F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8A62\u554F\u6216\u8981\u6C42\u5BEB\u5165\u5F8C\u8907\u6838\u3002",
|
|
284826
|
+
fullAccessConfirmScope: "\u8B80\u53D6\u3001\u5BEB\u5165\u3001\u672C\u6A5F\u6216\u79C1\u6709\u7DB2\u8DEF\u5B58\u53D6\u3001\u5371\u96AA\u64CD\u4F5C\u3001\u5BC6\u9470\u8DEF\u5F91\u53CA\u5DE5\u4F5C\u5340\u5916\u547D\u4EE4\u5747\u6703\u81EA\u52D5\u57F7\u884C\u3002",
|
|
284827
|
+
fullAccessConfirmGuards: "\u6B0A\u9650\u4FDD\u8B77\u5C07\u5168\u90E8\u95DC\u9589\uFF1B\u4E0D\u900F\u660E\u89E3\u8B6F\u5668\u4EE5\u53CA\u53EF\u80FD\u522A\u9664\u6216\u8986\u5BEB\u4E3B\u6A5F\u8CC7\u6599\u7684\u547D\u4EE4\u4E5F\u6703\u7372\u51C6\u57F7\u884C\u3002",
|
|
284828
|
+
fullAccessConfirmHost: "\u64CD\u4F5C\u64C1\u6709\u76EE\u524D\u7CFB\u7D71\u5E33\u6236\u7684\u6B0A\u9650\uFF0C\u5B50\u547D\u4EE4\u6703\u7E7C\u627F Orbit \u7A0B\u5E8F\u74B0\u5883\uFF0C\u5305\u62EC\u6191\u64DA\u8B8A\u6578\uFF1B\u5DF2\u57F7\u884C\u7684\u5B50\u7A0B\u5E8F\u6703\u4FDD\u7559\u9019\u4E9B\u6B0A\u9650\u76F4\u81F3\u505C\u6B62\u3002\u6191\u64DA\u503C\u4ECD\u6703\u5F9E\u65E5\u8A8C\u548C\u6A21\u578B\u53EF\u898B\u8F38\u51FA\u4E2D\u812B\u654F\uFF0C\u5DE5\u4F5C\u5340\u5916\u8B8A\u66F4\u4E0D\u53D7 Orbit \u56DE\u6EFE\u4FDD\u8B77\u3002\u4E2D\u9593\u8FED\u4EE3\u6AA2\u67E5\u9EDE\u6703\u4E0D\u7D93\u8A62\u554F\u81EA\u52D5\u7E7C\u7E8C\uFF1B\u8A2D\u5B9A\u7684\u6700\u7D42\u8FED\u4EE3\u4E0A\u9650\u3001\u53D6\u6D88\u80FD\u529B\u3001\u9810\u7B97\u3001\u505C\u6EEF\u8FF4\u5708\u5075\u6E2C\u3001\u5C08\u6848\u639B\u9264\u53CA\u9A57\u8B49\u5951\u7D04\u4ECD\u7136\u6709\u6548\u3002",
|
|
284829
|
+
fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6B0A\u9650",
|
|
284293
284830
|
modeStrict: "\u56B4\u683C",
|
|
284294
284831
|
modeNormal: "\u6A19\u6E96",
|
|
284295
284832
|
modeAuto: "\u5168\u81EA\u52D5",
|
|
@@ -284780,6 +285317,10 @@ function renderWebUiPage(language) {
|
|
|
284780
285317
|
<button type="button" data-mode="plan" aria-pressed="false">${copy.modePlan}</button>
|
|
284781
285318
|
</div>
|
|
284782
285319
|
<p class="permission-summary" id="permissionSummary" role="status" aria-live="polite">${copy.permissionGuardLabel}</p>
|
|
285320
|
+
<div class="setting-row setting-row-stacked long-task-setting">
|
|
285321
|
+
<div><label for="agentMaxIterations"><h3>${copy.agentMaxIterations}</h3></label><p id="agentMaxIterationsDescription">${copy.agentMaxIterationsDescription}</p></div>
|
|
285322
|
+
<input class="field-control" id="agentMaxIterations" type="number" min="1" max="1000" step="20" value="200" inputmode="numeric" aria-describedby="agentMaxIterationsDescription" />
|
|
285323
|
+
</div>
|
|
284783
285324
|
</section>
|
|
284784
285325
|
<section class="settings-group">
|
|
284785
285326
|
<div class="setting-row">
|
|
@@ -284917,6 +285458,25 @@ function renderWebUiPage(language) {
|
|
|
284917
285458
|
</div>
|
|
284918
285459
|
</section>
|
|
284919
285460
|
</div>
|
|
285461
|
+
<div class="full-access-dialog" id="fullAccessDialog" aria-hidden="true" hidden>
|
|
285462
|
+
<button class="full-access-backdrop" id="fullAccessBackdrop" type="button" aria-label="${copy.cancel}" tabindex="-1"></button>
|
|
285463
|
+
<section class="full-access-card" role="alertdialog" aria-modal="true" aria-labelledby="fullAccessTitle" aria-describedby="fullAccessBody fullAccessDetails">
|
|
285464
|
+
<span class="full-access-mark" aria-hidden="true">\u25C6</span>
|
|
285465
|
+
<div class="full-access-copy">
|
|
285466
|
+
<h2 id="fullAccessTitle">${copy.fullAccessConfirmTitle}</h2>
|
|
285467
|
+
<p id="fullAccessBody">${copy.fullAccessConfirmBody}</p>
|
|
285468
|
+
<ul id="fullAccessDetails">
|
|
285469
|
+
<li>${copy.fullAccessConfirmScope}</li>
|
|
285470
|
+
<li>${copy.fullAccessConfirmGuards}</li>
|
|
285471
|
+
<li>${copy.fullAccessConfirmHost}</li>
|
|
285472
|
+
</ul>
|
|
285473
|
+
</div>
|
|
285474
|
+
<div class="full-access-actions">
|
|
285475
|
+
<button class="full-access-cancel" id="fullAccessCancel" type="button">${copy.cancel}</button>
|
|
285476
|
+
<button class="full-access-confirm" id="fullAccessConfirm" type="button">${copy.fullAccessConfirmAction}</button>
|
|
285477
|
+
</div>
|
|
285478
|
+
</section>
|
|
285479
|
+
</div>
|
|
284920
285480
|
<div class="project-dialog" id="projectDialog" aria-hidden="true" hidden>
|
|
284921
285481
|
<button class="project-dialog-backdrop" id="projectDialogBackdrop" type="button" aria-label="${copy.cancel}" tabindex="-1"></button>
|
|
284922
285482
|
<section class="project-dialog-card" role="dialog" aria-modal="true" aria-labelledby="projectDialogTitle" aria-describedby="projectDialogBody">
|
|
@@ -286886,6 +287446,64 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
286886
287446
|
color: var(--danger);
|
|
286887
287447
|
}
|
|
286888
287448
|
|
|
287449
|
+
.tool-batch {
|
|
287450
|
+
margin: 11px 0;
|
|
287451
|
+
overflow: hidden;
|
|
287452
|
+
color: var(--muted);
|
|
287453
|
+
background: color-mix(in srgb, var(--surface-subtle) 72%, transparent);
|
|
287454
|
+
border: 1px solid var(--border);
|
|
287455
|
+
border-radius: 11px;
|
|
287456
|
+
}
|
|
287457
|
+
|
|
287458
|
+
.tool-batch-summary {
|
|
287459
|
+
min-height: 40px;
|
|
287460
|
+
display: grid;
|
|
287461
|
+
grid-template-columns: auto auto minmax(0, 1fr) auto auto;
|
|
287462
|
+
align-items: center;
|
|
287463
|
+
gap: 9px;
|
|
287464
|
+
padding: 8px 11px;
|
|
287465
|
+
cursor: pointer;
|
|
287466
|
+
list-style: none;
|
|
287467
|
+
}
|
|
287468
|
+
|
|
287469
|
+
.tool-batch-summary::-webkit-details-marker {
|
|
287470
|
+
display: none;
|
|
287471
|
+
}
|
|
287472
|
+
|
|
287473
|
+
.tool-batch-summary strong {
|
|
287474
|
+
color: var(--ink-strong);
|
|
287475
|
+
font-size: 11.5px;
|
|
287476
|
+
}
|
|
287477
|
+
|
|
287478
|
+
.tool-batch-count {
|
|
287479
|
+
min-width: 30px;
|
|
287480
|
+
padding: 2px 7px;
|
|
287481
|
+
color: var(--accent-strong);
|
|
287482
|
+
background: var(--accent-soft);
|
|
287483
|
+
border-radius: 999px;
|
|
287484
|
+
font: 600 10.5px/1.4 var(--font-mono);
|
|
287485
|
+
text-align: center;
|
|
287486
|
+
}
|
|
287487
|
+
|
|
287488
|
+
.tool-batch-body {
|
|
287489
|
+
padding: 1px 9px 9px;
|
|
287490
|
+
border-top: 1px solid var(--border);
|
|
287491
|
+
}
|
|
287492
|
+
|
|
287493
|
+
.tool-batch-body .tool-card {
|
|
287494
|
+
margin: 8px 0 0;
|
|
287495
|
+
background: var(--surface-raised);
|
|
287496
|
+
}
|
|
287497
|
+
|
|
287498
|
+
.tool-batch.is-success > .tool-batch-summary .tool-status {
|
|
287499
|
+
background: var(--success);
|
|
287500
|
+
box-shadow: 0 0 0 3px var(--success-soft);
|
|
287501
|
+
}
|
|
287502
|
+
|
|
287503
|
+
.tool-batch[open] > .tool-batch-summary .tool-chevron {
|
|
287504
|
+
transform: rotate(90deg);
|
|
287505
|
+
}
|
|
287506
|
+
|
|
286889
287507
|
.stream-caret > p:last-child::after,
|
|
286890
287508
|
.stream-caret > h1:last-child::after,
|
|
286891
287509
|
.stream-caret > h2:last-child::after,
|
|
@@ -287454,6 +288072,136 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
|
|
|
287454
288072
|
outline-offset: 2px;
|
|
287455
288073
|
}
|
|
287456
288074
|
|
|
288075
|
+
.full-access-dialog {
|
|
288076
|
+
position: fixed;
|
|
288077
|
+
inset: 0;
|
|
288078
|
+
z-index: 215;
|
|
288079
|
+
display: grid;
|
|
288080
|
+
place-items: center;
|
|
288081
|
+
padding: 20px;
|
|
288082
|
+
}
|
|
288083
|
+
|
|
288084
|
+
.full-access-dialog[hidden] {
|
|
288085
|
+
display: none;
|
|
288086
|
+
}
|
|
288087
|
+
|
|
288088
|
+
.full-access-backdrop {
|
|
288089
|
+
position: absolute;
|
|
288090
|
+
inset: 0;
|
|
288091
|
+
width: 100%;
|
|
288092
|
+
height: 100%;
|
|
288093
|
+
padding: 0;
|
|
288094
|
+
background: var(--scrim);
|
|
288095
|
+
border: 0;
|
|
288096
|
+
backdrop-filter: blur(3px);
|
|
288097
|
+
}
|
|
288098
|
+
|
|
288099
|
+
.full-access-card {
|
|
288100
|
+
position: relative;
|
|
288101
|
+
width: min(520px, calc(100vw - 32px));
|
|
288102
|
+
max-height: calc(100dvh - 40px);
|
|
288103
|
+
overflow-y: auto;
|
|
288104
|
+
overscroll-behavior: contain;
|
|
288105
|
+
scrollbar-gutter: stable;
|
|
288106
|
+
display: grid;
|
|
288107
|
+
grid-template-columns: 36px minmax(0, 1fr);
|
|
288108
|
+
gap: 13px;
|
|
288109
|
+
padding: 19px;
|
|
288110
|
+
color: var(--ink);
|
|
288111
|
+
background: var(--surface-raised);
|
|
288112
|
+
border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--border-strong));
|
|
288113
|
+
border-radius: 17px;
|
|
288114
|
+
box-shadow: var(--shadow-lg);
|
|
288115
|
+
}
|
|
288116
|
+
|
|
288117
|
+
.full-access-mark {
|
|
288118
|
+
width: 34px;
|
|
288119
|
+
height: 34px;
|
|
288120
|
+
display: grid;
|
|
288121
|
+
place-items: center;
|
|
288122
|
+
color: color-mix(in srgb, var(--warning) 75%, var(--ink));
|
|
288123
|
+
background: var(--warning-soft);
|
|
288124
|
+
border-radius: 11px;
|
|
288125
|
+
font: 700 13px/1 var(--font-mono);
|
|
288126
|
+
}
|
|
288127
|
+
|
|
288128
|
+
.full-access-copy {
|
|
288129
|
+
min-width: 0;
|
|
288130
|
+
}
|
|
288131
|
+
|
|
288132
|
+
.full-access-copy h2,
|
|
288133
|
+
.full-access-copy p {
|
|
288134
|
+
margin: 0;
|
|
288135
|
+
}
|
|
288136
|
+
|
|
288137
|
+
.full-access-copy h2 {
|
|
288138
|
+
color: var(--ink-strong);
|
|
288139
|
+
font-size: 16px;
|
|
288140
|
+
}
|
|
288141
|
+
|
|
288142
|
+
.full-access-copy p,
|
|
288143
|
+
.full-access-copy li {
|
|
288144
|
+
color: var(--muted);
|
|
288145
|
+
font-size: 12px;
|
|
288146
|
+
line-height: 1.55;
|
|
288147
|
+
}
|
|
288148
|
+
|
|
288149
|
+
.full-access-copy p {
|
|
288150
|
+
margin-top: 5px;
|
|
288151
|
+
}
|
|
288152
|
+
|
|
288153
|
+
.full-access-copy ul {
|
|
288154
|
+
display: grid;
|
|
288155
|
+
gap: 6px;
|
|
288156
|
+
margin: 12px 0 0;
|
|
288157
|
+
padding-left: 18px;
|
|
288158
|
+
}
|
|
288159
|
+
|
|
288160
|
+
.full-access-actions {
|
|
288161
|
+
grid-column: 1 / -1;
|
|
288162
|
+
display: flex;
|
|
288163
|
+
justify-content: flex-end;
|
|
288164
|
+
gap: 8px;
|
|
288165
|
+
margin-top: 4px;
|
|
288166
|
+
}
|
|
288167
|
+
|
|
288168
|
+
.full-access-actions button {
|
|
288169
|
+
min-height: 35px;
|
|
288170
|
+
padding: 0 13px;
|
|
288171
|
+
border-radius: 9px;
|
|
288172
|
+
font-size: 12px;
|
|
288173
|
+
font-weight: 650;
|
|
288174
|
+
}
|
|
288175
|
+
|
|
288176
|
+
.full-access-cancel {
|
|
288177
|
+
color: var(--muted);
|
|
288178
|
+
background: var(--surface-subtle);
|
|
288179
|
+
border: 1px solid var(--border);
|
|
288180
|
+
}
|
|
288181
|
+
|
|
288182
|
+
.full-access-confirm {
|
|
288183
|
+
color: var(--surface-raised);
|
|
288184
|
+
background: var(--accent-strong);
|
|
288185
|
+
border: 1px solid var(--accent-strong);
|
|
288186
|
+
}
|
|
288187
|
+
|
|
288188
|
+
.full-access-actions button:focus-visible {
|
|
288189
|
+
outline: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
|
|
288190
|
+
outline-offset: 2px;
|
|
288191
|
+
}
|
|
288192
|
+
|
|
288193
|
+
.full-access-actions button:disabled {
|
|
288194
|
+
cursor: wait;
|
|
288195
|
+
opacity: 0.55;
|
|
288196
|
+
}
|
|
288197
|
+
|
|
288198
|
+
@media (max-width: 560px) {
|
|
288199
|
+
.full-access-dialog { padding: 14px; }
|
|
288200
|
+
.full-access-card { width: min(100%, 520px); max-height: calc(100dvh - 28px); padding: 16px; }
|
|
288201
|
+
.full-access-actions { display: grid; grid-template-columns: 1fr 1fr; }
|
|
288202
|
+
.full-access-actions button { width: 100%; }
|
|
288203
|
+
}
|
|
288204
|
+
|
|
287457
288205
|
.toast-region {
|
|
287458
288206
|
position: fixed;
|
|
287459
288207
|
z-index: 100;
|
|
@@ -289946,6 +290694,7 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
289946
290694
|
textarea,
|
|
289947
290695
|
.message.user .message-content,
|
|
289948
290696
|
.tool-card,
|
|
290697
|
+
.tool-batch,
|
|
289949
290698
|
.code-block,
|
|
289950
290699
|
.composer-shell,
|
|
289951
290700
|
.inspector,
|
|
@@ -291580,6 +292329,8 @@ var SettingsPatchSchema = z58.object({
|
|
|
291580
292329
|
provider: z58.string().trim().min(1).max(256).optional(),
|
|
291581
292330
|
model: z58.string().trim().min(1).max(200).optional(),
|
|
291582
292331
|
permissionMode: z58.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
292332
|
+
fullAccessConfirmed: z58.literal(true).optional(),
|
|
292333
|
+
agentMaxIterations: z58.number().int().min(1).max(MAX_AGENT_MAX_ITERATIONS).optional(),
|
|
291583
292334
|
webSearchEnabled: z58.boolean().optional(),
|
|
291584
292335
|
webSearchProvider: z58.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
|
|
291585
292336
|
webSearchMaxResults: z58.number().int().min(1).max(20).optional(),
|
|
@@ -291587,7 +292338,15 @@ var SettingsPatchSchema = z58.object({
|
|
|
291587
292338
|
skillsActivation: z58.enum(["auto", "explicit"]).optional(),
|
|
291588
292339
|
skillsMaxActive: z58.number().int().min(0).max(8).optional(),
|
|
291589
292340
|
skillsDisabled: z58.array(z58.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).max(200).optional()
|
|
291590
|
-
}).strict()
|
|
292341
|
+
}).strict().superRefine((patch, context) => {
|
|
292342
|
+
if (patch.permissionMode === "auto" && patch.fullAccessConfirmed !== true) {
|
|
292343
|
+
context.addIssue({
|
|
292344
|
+
code: z58.ZodIssueCode.custom,
|
|
292345
|
+
path: ["fullAccessConfirmed"],
|
|
292346
|
+
message: "Full Access requires explicit confirmation."
|
|
292347
|
+
});
|
|
292348
|
+
}
|
|
292349
|
+
});
|
|
291591
292350
|
var CapabilityNameSchema2 = z58.string().trim().min(1).max(48).regex(/^[a-z0-9][a-z0-9-]*$/);
|
|
291592
292351
|
var CapabilityCreateSchema = z58.discriminatedUnion("kind", [
|
|
291593
292352
|
z58.object({
|
|
@@ -292361,6 +293120,7 @@ var OrbitWebUiRuntime = class {
|
|
|
292361
293120
|
}
|
|
292362
293121
|
try {
|
|
292363
293122
|
const patch = SettingsPatchSchema.parse(await readJsonBody(req));
|
|
293123
|
+
delete patch.fullAccessConfirmed;
|
|
292364
293124
|
const result = await options.updateSettings(patch);
|
|
292365
293125
|
sendJson(res, result.ok ? 200 : 400, sanitizeActionResult(result));
|
|
292366
293126
|
} catch (error) {
|
|
@@ -292496,7 +293256,7 @@ function isSkillScopeDiscoverable(cwd, configuredDirectories, scope) {
|
|
|
292496
293256
|
);
|
|
292497
293257
|
return resolveSkillDirectories(cwd, configuredDirectories).some((root) => {
|
|
292498
293258
|
const pathFromRoot = relative8(root, target);
|
|
292499
|
-
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !
|
|
293259
|
+
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute6(pathFromRoot);
|
|
292500
293260
|
});
|
|
292501
293261
|
}
|
|
292502
293262
|
function matchesImageSignature(mediaType, body) {
|
|
@@ -292582,8 +293342,8 @@ var WebUiApprovalBroker = class {
|
|
|
292582
293342
|
throw new Error("Web UI approval queue capacity was reached.");
|
|
292583
293343
|
}
|
|
292584
293344
|
const snapshot = sanitizeApprovalRequest(request);
|
|
292585
|
-
return new Promise((
|
|
292586
|
-
const approval = { snapshot, resolve:
|
|
293345
|
+
return new Promise((resolve26) => {
|
|
293346
|
+
const approval = { snapshot, resolve: resolve26 };
|
|
292587
293347
|
if (this.pending) this.queued.push(approval);
|
|
292588
293348
|
else this.activate(approval);
|
|
292589
293349
|
});
|
|
@@ -293062,8 +293822,8 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
293062
293822
|
|
|
293063
293823
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
293064
293824
|
import glob5 from "fast-glob";
|
|
293065
|
-
import { existsSync as
|
|
293066
|
-
import { isAbsolute as
|
|
293825
|
+
import { existsSync as existsSync19, statSync as statSync4 } from "fs";
|
|
293826
|
+
import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve12 } from "path";
|
|
293067
293827
|
import picocolors12 from "picocolors";
|
|
293068
293828
|
function parseAddArgument(argument) {
|
|
293069
293829
|
const match = argument.match(/^(--read-only|--readonly|-r)(?:\s+|$)/);
|
|
@@ -293086,7 +293846,7 @@ function containsWildcard(value) {
|
|
|
293086
293846
|
return value.includes("*") || value.includes("?");
|
|
293087
293847
|
}
|
|
293088
293848
|
function isUnsafePattern(value) {
|
|
293089
|
-
return
|
|
293849
|
+
return isAbsolute7(value) || value.replace(/\\/g, "/").split("/").some((segment) => segment === "..");
|
|
293090
293850
|
}
|
|
293091
293851
|
function wildcardExpression(pattern) {
|
|
293092
293852
|
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__\/?/g, "(?:|.*/)");
|
|
@@ -293212,7 +293972,7 @@ async function handleAdd(argument, dependencies) {
|
|
|
293212
293972
|
);
|
|
293213
293973
|
return HANDLED_COMMAND;
|
|
293214
293974
|
}
|
|
293215
|
-
if (!
|
|
293975
|
+
if (!existsSync19(absolutePath)) {
|
|
293216
293976
|
const normalizedArgument = fileArgument.toLowerCase();
|
|
293217
293977
|
const matched = candidates.filter(
|
|
293218
293978
|
(file) => file.toLowerCase().includes(normalizedArgument) || file.toLowerCase().endsWith(`/${normalizedArgument}`)
|
|
@@ -293415,7 +294175,7 @@ async function handleContextCommand(command, argument, dependencies) {
|
|
|
293415
294175
|
|
|
293416
294176
|
// src/runtime/commands/RollbackCommandHandler.ts
|
|
293417
294177
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
293418
|
-
import { existsSync as
|
|
294178
|
+
import { existsSync as existsSync20, lstatSync as lstatSync7, mkdirSync as mkdirSync6, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
293419
294179
|
import { dirname as dirname12 } from "path";
|
|
293420
294180
|
import picocolors13 from "picocolors";
|
|
293421
294181
|
import { z as z59 } from "zod";
|
|
@@ -293769,7 +294529,7 @@ function restoreWorkspaceSnapshot(cwd, snapshots) {
|
|
|
293769
294529
|
rmSync5(absolutePath, { recursive: true, force: true });
|
|
293770
294530
|
continue;
|
|
293771
294531
|
}
|
|
293772
|
-
if (
|
|
294532
|
+
if (existsSync20(absolutePath)) {
|
|
293773
294533
|
const stats = lstatSync7(absolutePath);
|
|
293774
294534
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
293775
294535
|
throw new Error(
|
|
@@ -293797,7 +294557,7 @@ function restoreGitStatusEntry(entry, dependencies, git) {
|
|
|
293797
294557
|
const removePath = dependencies.removePath ?? removeWorkspacePath;
|
|
293798
294558
|
const removeDestination = () => {
|
|
293799
294559
|
const absolutePath = resolveSafePath(dependencies.cwd, entry.path);
|
|
293800
|
-
if (
|
|
294560
|
+
if (existsSync20(absolutePath)) removePath(absolutePath);
|
|
293801
294561
|
};
|
|
293802
294562
|
if (entry.status === "??" || entry.status.includes("A")) {
|
|
293803
294563
|
removeDestination();
|
|
@@ -294522,8 +295282,8 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
294522
295282
|
|
|
294523
295283
|
// src/runtime/ProjectLauncher.ts
|
|
294524
295284
|
import { spawn as spawn4 } from "child_process";
|
|
294525
|
-
import { existsSync as
|
|
294526
|
-
import { dirname as dirname13, isAbsolute as
|
|
295285
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
295286
|
+
import { dirname as dirname13, isAbsolute as isAbsolute8, parse as parse4, resolve as resolve13 } from "path";
|
|
294527
295287
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
294528
295288
|
var ProjectLaunchError = class extends Error {
|
|
294529
295289
|
constructor(code, message2, options) {
|
|
@@ -294534,7 +295294,7 @@ var ProjectLaunchError = class extends Error {
|
|
|
294534
295294
|
name = "ProjectLaunchError";
|
|
294535
295295
|
};
|
|
294536
295296
|
async function launchOrbitProject(request, options = {}) {
|
|
294537
|
-
if (!
|
|
295297
|
+
if (!isAbsolute8(request.path)) {
|
|
294538
295298
|
throw new ProjectLaunchError(
|
|
294539
295299
|
"absolute_path_required",
|
|
294540
295300
|
"Enter an absolute project folder path."
|
|
@@ -294645,12 +295405,12 @@ function parseReadyUrl(message2) {
|
|
|
294645
295405
|
return sanitizeLocalWebUiUrl(message2.url);
|
|
294646
295406
|
}
|
|
294647
295407
|
function ensureProjectDirectory(projectPath) {
|
|
294648
|
-
if (
|
|
295408
|
+
if (existsSync21(projectPath)) {
|
|
294649
295409
|
requireProjectDirectory(projectPath);
|
|
294650
295410
|
return;
|
|
294651
295411
|
}
|
|
294652
295412
|
const parentPath = dirname13(projectPath);
|
|
294653
|
-
if (!
|
|
295413
|
+
if (!existsSync21(parentPath)) {
|
|
294654
295414
|
throw new ProjectLaunchError(
|
|
294655
295415
|
"parent_missing",
|
|
294656
295416
|
"The parent folder does not exist. Choose an existing location first."
|
|
@@ -294677,7 +295437,7 @@ function ensureProjectDirectory(projectPath) {
|
|
|
294677
295437
|
}
|
|
294678
295438
|
}
|
|
294679
295439
|
function requireProjectDirectory(projectPath) {
|
|
294680
|
-
if (!
|
|
295440
|
+
if (!existsSync21(projectPath)) {
|
|
294681
295441
|
throw new ProjectLaunchError(
|
|
294682
295442
|
"project_missing",
|
|
294683
295443
|
"Project folder does not exist."
|
|
@@ -295397,7 +296157,7 @@ async function confirmUpdate(prompt) {
|
|
|
295397
296157
|
});
|
|
295398
296158
|
try {
|
|
295399
296159
|
const answer = await new Promise(
|
|
295400
|
-
(
|
|
296160
|
+
(resolve26) => interfaceInstance.question(prompt, resolve26)
|
|
295401
296161
|
);
|
|
295402
296162
|
return /^(?:y|yes)$/i.test(answer.trim());
|
|
295403
296163
|
} finally {
|
|
@@ -296295,17 +297055,18 @@ var CommandRouter = class {
|
|
|
296295
297055
|
const commitMsg = parts.slice(1).join(" ").trim();
|
|
296296
297056
|
const isZh = config.language !== "en";
|
|
296297
297057
|
const { execFileSync: execFileSync9, execSync: execSync3 } = await import("child_process");
|
|
297058
|
+
const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
|
|
296298
297059
|
try {
|
|
296299
297060
|
let diff = execSync3("git diff --cached", {
|
|
296300
297061
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296301
297062
|
cwd,
|
|
296302
|
-
env:
|
|
297063
|
+
env: childEnvironment
|
|
296303
297064
|
}).toString().trim();
|
|
296304
297065
|
if (!diff) {
|
|
296305
297066
|
const unstaged = execSync3("git status --porcelain", {
|
|
296306
297067
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296307
297068
|
cwd,
|
|
296308
|
-
env:
|
|
297069
|
+
env: childEnvironment
|
|
296309
297070
|
}).toString().trim();
|
|
296310
297071
|
if (!unstaged) {
|
|
296311
297072
|
this.printOutput(
|
|
@@ -296315,7 +297076,7 @@ var CommandRouter = class {
|
|
|
296315
297076
|
);
|
|
296316
297077
|
return { shouldExit: false, processed: true };
|
|
296317
297078
|
}
|
|
296318
|
-
const autoStage = await Prompt.askApproval(
|
|
297079
|
+
const autoStage = isFullAccessEnabled(config) || await Prompt.askApproval(
|
|
296319
297080
|
isZh ? "\u672A\u68C0\u6D4B\u5230\u5DF2\u6682\u5B58\u7684\u4FEE\u6539\uFF0C\u662F\u5426\u81EA\u52A8\u6682\u5B58\u5DE5\u4F5C\u533A\u4E2D\u7684\u6240\u6709\u53D8\u66F4\u5E76\u751F\u6210\u63D0\u4EA4\uFF1F" : "No staged changes found. Automatically stage all local changes and create a commit?"
|
|
296320
297081
|
);
|
|
296321
297082
|
if (!autoStage) {
|
|
@@ -296332,12 +297093,12 @@ var CommandRouter = class {
|
|
|
296332
297093
|
execSync3("git add -A", {
|
|
296333
297094
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296334
297095
|
cwd,
|
|
296335
|
-
env:
|
|
297096
|
+
env: childEnvironment
|
|
296336
297097
|
});
|
|
296337
297098
|
diff = execSync3("git diff --cached", {
|
|
296338
297099
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296339
297100
|
cwd,
|
|
296340
|
-
env:
|
|
297101
|
+
env: childEnvironment
|
|
296341
297102
|
}).toString().trim();
|
|
296342
297103
|
if (!diff) {
|
|
296343
297104
|
this.printOutput(
|
|
@@ -296386,7 +297147,7 @@ ${buildCommitDiffForModel(diff)}`
|
|
|
296386
297147
|
execFileSync9("git", ["commit", "-m", finalMsg], {
|
|
296387
297148
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296388
297149
|
cwd,
|
|
296389
|
-
env:
|
|
297150
|
+
env: childEnvironment
|
|
296390
297151
|
});
|
|
296391
297152
|
this.printOutput(
|
|
296392
297153
|
picocolors18.green("\u2714 Git commit created successfully.")
|
|
@@ -296422,12 +297183,12 @@ ${buildCommitDiffForModel(diff)}`
|
|
|
296422
297183
|
const modeDescriptions = isZh ? {
|
|
296423
297184
|
strict: "Strict \u2014 \u6240\u6709\u5DE5\u5177\u8C03\u7528\u5FC5\u987B\u9010\u4E00\u786E\u8BA4",
|
|
296424
297185
|
normal: "Normal \u2014 \u5199\u5165/\u6267\u884C\u64CD\u4F5C\u9700\u8981\u786E\u8BA4",
|
|
296425
|
-
auto: "Full Access \u2014 \u81EA\u52A8\
|
|
297186
|
+
auto: "Full Access \u2014 \u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u5305\u62EC\u5371\u9669\u3001\u5185\u7F51\u4E0E\u5DE5\u4F5C\u533A\u5916\u64CD\u4F5C",
|
|
296426
297187
|
plan: "Plan \u2014 \u89C4\u5212\u6A21\u5F0F\uFF0C\u65E0\u5B9E\u9645\u6587\u4EF6\u4FEE\u6539"
|
|
296427
297188
|
} : {
|
|
296428
297189
|
strict: "Strict \u2014 Confirm every tool call before execution",
|
|
296429
297190
|
normal: "Normal \u2014 Confirm write/exec operations only",
|
|
296430
|
-
auto: "Full Access \u2014
|
|
297191
|
+
auto: "Full Access \u2014 Approve every enabled tool action, including dangerous, local-network, and outside-workspace actions",
|
|
296431
297192
|
plan: "Plan \u2014 Planning mode, no actual file changes"
|
|
296432
297193
|
};
|
|
296433
297194
|
if (!targetMode) {
|
|
@@ -297069,6 +297830,9 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
297069
297830
|
const preset = applyPermissionModePreset(draft, patch.permissionMode);
|
|
297070
297831
|
if (!preset.ok) return preset;
|
|
297071
297832
|
}
|
|
297833
|
+
if (typeof patch.agentMaxIterations === "number") {
|
|
297834
|
+
draft.agent.maxIterations = patch.agentMaxIterations;
|
|
297835
|
+
}
|
|
297072
297836
|
if (typeof patch.webSearchEnabled === "boolean") {
|
|
297073
297837
|
draft.tools.webSearch.enabled = patch.webSearchEnabled;
|
|
297074
297838
|
}
|
|
@@ -297127,6 +297891,10 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
297127
297891
|
this.tui.setPermissionsMode(patch.permissionMode);
|
|
297128
297892
|
this.saveLocalState({ permissionMode: patch.permissionMode });
|
|
297129
297893
|
}
|
|
297894
|
+
if (typeof patch.agentMaxIterations === "number") {
|
|
297895
|
+
this.config.agent.maxIterations = patch.agentMaxIterations;
|
|
297896
|
+
this.saveLocalState({ agentMaxIterations: patch.agentMaxIterations });
|
|
297897
|
+
}
|
|
297130
297898
|
if (typeof patch.webSearchEnabled === "boolean") {
|
|
297131
297899
|
this.config.tools.webSearch.enabled = patch.webSearchEnabled;
|
|
297132
297900
|
}
|
|
@@ -297398,6 +298166,7 @@ var LocalRuntimeStateSchema = z68.object({
|
|
|
297398
298166
|
lastModel: z68.string().max(512).optional(),
|
|
297399
298167
|
language: OrbitLanguageSchema.optional(),
|
|
297400
298168
|
permissionMode: z68.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
298169
|
+
agentMaxIterations: z68.number().int().min(1).max(MAX_AGENT_MAX_ITERATIONS).optional(),
|
|
297401
298170
|
skills: LocalSkillsStateSchema.optional()
|
|
297402
298171
|
});
|
|
297403
298172
|
function readLocalRuntimeState(cwd) {
|
|
@@ -297688,6 +298457,8 @@ Risk Warning: ${reason}`);
|
|
|
297688
298457
|
{
|
|
297689
298458
|
disableStatusBar: useFullscreenTui,
|
|
297690
298459
|
sessionId: resumeSessionId,
|
|
298460
|
+
// Full Access is an explicit request for uninterrupted autonomous work.
|
|
298461
|
+
// Budget, cancellation, progress, and the configured hard ceiling remain.
|
|
297691
298462
|
autoContinueRunaway: isFullAccessEnabled(this.config)
|
|
297692
298463
|
}
|
|
297693
298464
|
);
|
|
@@ -298172,6 +298943,13 @@ function shouldUseStoredPermissionMode(cliOverrides) {
|
|
|
298172
298943
|
const permissions = cliOverrides.permissions;
|
|
298173
298944
|
return !(typeof permissions === "object" && permissions !== null && !Array.isArray(permissions) && typeof permissions.mode === "string");
|
|
298174
298945
|
}
|
|
298946
|
+
function shouldUseStoredAgentMaxIterations(cliOverrides) {
|
|
298947
|
+
if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
|
|
298948
|
+
return true;
|
|
298949
|
+
}
|
|
298950
|
+
const agent = cliOverrides.agent;
|
|
298951
|
+
return !(typeof agent === "object" && agent !== null && !Array.isArray(agent) && typeof agent.maxIterations === "number");
|
|
298952
|
+
}
|
|
298175
298953
|
function getExplicitModelOverride(cliOverrides) {
|
|
298176
298954
|
if (typeof cliOverrides !== "object" || cliOverrides === null || Array.isArray(cliOverrides)) {
|
|
298177
298955
|
return void 0;
|
|
@@ -298209,6 +298987,15 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
|
|
|
298209
298987
|
if (shouldUseStoredPermissionMode(cliOverrides) && localState.permissionMode) {
|
|
298210
298988
|
applyPermissionModePreset(config, localState.permissionMode);
|
|
298211
298989
|
}
|
|
298990
|
+
if (shouldUseStoredAgentMaxIterations(cliOverrides) && localState.agentMaxIterations) {
|
|
298991
|
+
config.agent.maxIterations = Math.min(
|
|
298992
|
+
localState.agentMaxIterations,
|
|
298993
|
+
config.managedPolicy?.maxIterations ?? MAX_AGENT_MAX_ITERATIONS
|
|
298994
|
+
);
|
|
298995
|
+
}
|
|
298996
|
+
}
|
|
298997
|
+
function shouldAutoContinueRunaway(config, options) {
|
|
298998
|
+
return isFullAccessEnabled(config) || options?.autoContinueRunaway === true;
|
|
298212
298999
|
}
|
|
298213
299000
|
async function runAgent(cwd, task, cliOverrides, multi, options) {
|
|
298214
299001
|
const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
|
|
@@ -298344,7 +299131,7 @@ Risk Warning: ${reason}`);
|
|
|
298344
299131
|
requireSession: Boolean(options?.resumeSessionId),
|
|
298345
299132
|
disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
|
|
298346
299133
|
nonInteractive: !!options?.nonInteractive,
|
|
298347
|
-
autoContinueRunaway:
|
|
299134
|
+
autoContinueRunaway: shouldAutoContinueRunaway(config, options)
|
|
298348
299135
|
}
|
|
298349
299136
|
);
|
|
298350
299137
|
return await loop.run();
|
|
@@ -298622,7 +299409,7 @@ async function runLSPServer(cwd) {
|
|
|
298622
299409
|
const autocompleteEngine = new AutocompleteEngine(cwd);
|
|
298623
299410
|
const documentCache = /* @__PURE__ */ new Map();
|
|
298624
299411
|
let shutdownRequested = false;
|
|
298625
|
-
await new Promise((
|
|
299412
|
+
await new Promise((resolve26) => {
|
|
298626
299413
|
let settled = false;
|
|
298627
299414
|
const finish = () => {
|
|
298628
299415
|
if (settled) return;
|
|
@@ -298631,7 +299418,7 @@ async function runLSPServer(cwd) {
|
|
|
298631
299418
|
process.stdin.off("end", onEnd);
|
|
298632
299419
|
autocompleteEngine.dispose();
|
|
298633
299420
|
documentCache.clear();
|
|
298634
|
-
|
|
299421
|
+
resolve26();
|
|
298635
299422
|
};
|
|
298636
299423
|
const handleMessage = async (message2) => {
|
|
298637
299424
|
try {
|
|
@@ -298808,15 +299595,15 @@ function askQuestion(query, defaultValue = "") {
|
|
|
298808
299595
|
input: process.stdin,
|
|
298809
299596
|
output: process.stdout
|
|
298810
299597
|
});
|
|
298811
|
-
return new Promise((
|
|
299598
|
+
return new Promise((resolve26) => {
|
|
298812
299599
|
rl.question(query, (answer) => {
|
|
298813
299600
|
rl.close();
|
|
298814
|
-
|
|
299601
|
+
resolve26(answer.trim() || defaultValue);
|
|
298815
299602
|
});
|
|
298816
299603
|
});
|
|
298817
299604
|
}
|
|
298818
299605
|
function askSecret(query) {
|
|
298819
|
-
return new Promise((
|
|
299606
|
+
return new Promise((resolve26, reject) => {
|
|
298820
299607
|
const stdin2 = process.stdin;
|
|
298821
299608
|
const stdout2 = process.stdout;
|
|
298822
299609
|
if (!stdin2.isTTY || !stdout2.isTTY || typeof stdin2.setRawMode !== "function") {
|
|
@@ -298850,13 +299637,13 @@ function askSecret(query) {
|
|
|
298850
299637
|
case "":
|
|
298851
299638
|
cleanup();
|
|
298852
299639
|
stdout2.write("\n");
|
|
298853
|
-
|
|
299640
|
+
resolve26(input.trim());
|
|
298854
299641
|
break;
|
|
298855
299642
|
case "":
|
|
298856
299643
|
cleanup();
|
|
298857
299644
|
stdout2.write("\n");
|
|
298858
299645
|
process.exitCode = 130;
|
|
298859
|
-
|
|
299646
|
+
resolve26("");
|
|
298860
299647
|
break;
|
|
298861
299648
|
case "\b":
|
|
298862
299649
|
case "\x7F":
|
|
@@ -299156,10 +299943,36 @@ async function runMcpLogin(serverName, options = {}) {
|
|
|
299156
299943
|
|
|
299157
299944
|
// src/commands/skills.ts
|
|
299158
299945
|
import picocolors24 from "picocolors";
|
|
299946
|
+
import { z as z71 } from "zod";
|
|
299947
|
+
var SkillDirectoryOverrideSchema = z71.array(z71.string().trim().min(1).max(4096)).min(1).max(50);
|
|
299159
299948
|
async function runSkillsCommand(action, options = {}) {
|
|
299160
299949
|
const cwd = options.cwd ?? process.cwd();
|
|
299161
299950
|
const config = ConfigLoader.loadSync(cwd);
|
|
299162
|
-
|
|
299951
|
+
const directoryOverride = options.directories ? SkillDirectoryOverrideSchema.safeParse(options.directories) : void 0;
|
|
299952
|
+
if (directoryOverride && !directoryOverride.success) {
|
|
299953
|
+
const message2 = directoryOverride.error.issues.map((issue) => issue.message).join("; ");
|
|
299954
|
+
if (options.json) {
|
|
299955
|
+
console.log(
|
|
299956
|
+
JSON.stringify({
|
|
299957
|
+
enabled: true,
|
|
299958
|
+
skills: [],
|
|
299959
|
+
diagnostics: [
|
|
299960
|
+
{
|
|
299961
|
+
path: cwd,
|
|
299962
|
+
severity: "error",
|
|
299963
|
+
code: "invalid-directory-override",
|
|
299964
|
+
message: message2
|
|
299965
|
+
}
|
|
299966
|
+
]
|
|
299967
|
+
})
|
|
299968
|
+
);
|
|
299969
|
+
} else {
|
|
299970
|
+
console.error(picocolors24.red(`\u2716 Invalid Skill directory: ${message2}`));
|
|
299971
|
+
}
|
|
299972
|
+
return 1;
|
|
299973
|
+
}
|
|
299974
|
+
const targeted = Boolean(directoryOverride?.success);
|
|
299975
|
+
if (config.skills.enabled === false && !targeted) {
|
|
299163
299976
|
if (options.json) {
|
|
299164
299977
|
console.log(
|
|
299165
299978
|
JSON.stringify({ enabled: false, skills: [], diagnostics: [] })
|
|
@@ -299169,7 +299982,12 @@ async function runSkillsCommand(action, options = {}) {
|
|
|
299169
299982
|
}
|
|
299170
299983
|
return 0;
|
|
299171
299984
|
}
|
|
299172
|
-
const
|
|
299985
|
+
const skillConfig = targeted ? {
|
|
299986
|
+
...config.skills,
|
|
299987
|
+
enabled: true,
|
|
299988
|
+
directories: directoryOverride.data
|
|
299989
|
+
} : config.skills;
|
|
299990
|
+
const catalog = await discoverSkills(cwd, skillConfig);
|
|
299173
299991
|
if (options.deep) {
|
|
299174
299992
|
catalog.diagnostics.push(
|
|
299175
299993
|
...await validateSkillCatalogBundles(catalog.skills)
|
|
@@ -299184,6 +300002,7 @@ async function runSkillsCommand(action, options = {}) {
|
|
|
299184
300002
|
{
|
|
299185
300003
|
enabled: true,
|
|
299186
300004
|
deep: options.deep === true,
|
|
300005
|
+
targeted,
|
|
299187
300006
|
directories: catalog.directories,
|
|
299188
300007
|
skills: catalog.skills.map((skill) => ({
|
|
299189
300008
|
name: skill.name,
|
|
@@ -299243,7 +300062,7 @@ async function runSkillsCommand(action, options = {}) {
|
|
|
299243
300062
|
|
|
299244
300063
|
// src/commands/trace.ts
|
|
299245
300064
|
import {
|
|
299246
|
-
existsSync as
|
|
300065
|
+
existsSync as existsSync28,
|
|
299247
300066
|
lstatSync as lstatSync8,
|
|
299248
300067
|
mkdirSync as mkdirSync8,
|
|
299249
300068
|
renameSync as renameSync6,
|
|
@@ -299252,10 +300071,10 @@ import {
|
|
|
299252
300071
|
} from "fs";
|
|
299253
300072
|
import { dirname as dirname15, resolve as resolve15 } from "path";
|
|
299254
300073
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
299255
|
-
import { z as
|
|
299256
|
-
var TraceOptionsSchema =
|
|
299257
|
-
full:
|
|
299258
|
-
out:
|
|
300074
|
+
import { z as z74 } from "zod";
|
|
300075
|
+
var TraceOptionsSchema = z74.object({
|
|
300076
|
+
full: z74.boolean().default(false),
|
|
300077
|
+
out: z74.string().trim().min(1).max(4096).optional()
|
|
299259
300078
|
});
|
|
299260
300079
|
function runTraceExport(cwd, sessionId, options = {}) {
|
|
299261
300080
|
const value = TraceOptionsSchema.parse(options);
|
|
@@ -299271,7 +300090,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299271
300090
|
}
|
|
299272
300091
|
const outputPath = resolveSafePath(cwd, value.out);
|
|
299273
300092
|
const directory = dirname15(outputPath);
|
|
299274
|
-
if (
|
|
300093
|
+
if (existsSync28(directory)) {
|
|
299275
300094
|
const stats = lstatSync8(directory);
|
|
299276
300095
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
299277
300096
|
throw new Error("Trace output directory must be a real directory.");
|
|
@@ -299286,7 +300105,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299286
300105
|
flag: "wx",
|
|
299287
300106
|
mode: 384
|
|
299288
300107
|
});
|
|
299289
|
-
if (
|
|
300108
|
+
if (existsSync28(outputPath)) rmSync7(outputPath, { force: true });
|
|
299290
300109
|
renameSync6(temporaryPath, outputPath);
|
|
299291
300110
|
} finally {
|
|
299292
300111
|
rmSync7(temporaryPath, { force: true });
|
|
@@ -299298,7 +300117,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299298
300117
|
import { exec as execCallback, execFileSync as execFileSync8 } from "child_process";
|
|
299299
300118
|
import {
|
|
299300
300119
|
copyFileSync,
|
|
299301
|
-
existsSync as
|
|
300120
|
+
existsSync as existsSync29,
|
|
299302
300121
|
lstatSync as lstatSync9,
|
|
299303
300122
|
mkdirSync as mkdirSync9,
|
|
299304
300123
|
renameSync as renameSync7,
|
|
@@ -299310,16 +300129,16 @@ import { randomUUID as randomUUID15 } from "crypto";
|
|
|
299310
300129
|
import { promisify as promisify5 } from "util";
|
|
299311
300130
|
import picocolors25 from "picocolors";
|
|
299312
300131
|
import { parse as parseYaml4 } from "yaml";
|
|
299313
|
-
import { z as
|
|
300132
|
+
import { z as z75 } from "zod";
|
|
299314
300133
|
var exec5 = promisify5(execCallback);
|
|
299315
300134
|
var MAX_SUITE_BYTES = 1024 * 1024;
|
|
299316
300135
|
var MAX_VERIFICATION_OUTPUT = 4e3;
|
|
299317
|
-
var EvalOptionsSchema =
|
|
299318
|
-
provider:
|
|
299319
|
-
model:
|
|
299320
|
-
task:
|
|
299321
|
-
allowCommands:
|
|
299322
|
-
json:
|
|
300136
|
+
var EvalOptionsSchema = z75.object({
|
|
300137
|
+
provider: z75.string().trim().min(1).optional(),
|
|
300138
|
+
model: z75.string().trim().min(1).optional(),
|
|
300139
|
+
task: z75.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
|
|
300140
|
+
allowCommands: z75.boolean().default(false),
|
|
300141
|
+
json: z75.boolean().default(false)
|
|
299323
300142
|
});
|
|
299324
300143
|
async function runEval(cwd, suiteFile, options = {}) {
|
|
299325
300144
|
const value = EvalOptionsSchema.parse(options);
|
|
@@ -299637,7 +300456,7 @@ function writeEvaluationReport(cwd, runId, report) {
|
|
|
299637
300456
|
}
|
|
299638
300457
|
function writeJsonAtomically2(filePath, value) {
|
|
299639
300458
|
const directory = dirname16(filePath);
|
|
299640
|
-
if (
|
|
300459
|
+
if (existsSync29(directory)) {
|
|
299641
300460
|
const stats = lstatSync9(directory);
|
|
299642
300461
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
299643
300462
|
throw new Error("Evaluation output directory must be a real directory.");
|
|
@@ -299652,7 +300471,7 @@ function writeJsonAtomically2(filePath, value) {
|
|
|
299652
300471
|
flag: "wx",
|
|
299653
300472
|
mode: 384
|
|
299654
300473
|
});
|
|
299655
|
-
if (
|
|
300474
|
+
if (existsSync29(filePath)) rmSync8(filePath, { force: true });
|
|
299656
300475
|
renameSync7(temporaryPath, filePath);
|
|
299657
300476
|
} finally {
|
|
299658
300477
|
rmSync8(temporaryPath, { force: true });
|
|
@@ -299667,7 +300486,7 @@ function safeSummary(value) {
|
|
|
299667
300486
|
import readline6 from "readline";
|
|
299668
300487
|
import picocolors26 from "picocolors";
|
|
299669
300488
|
import { resolve as resolve17 } from "path";
|
|
299670
|
-
import { z as
|
|
300489
|
+
import { z as z77 } from "zod";
|
|
299671
300490
|
|
|
299672
300491
|
// src/runtime/CleanupManager.ts
|
|
299673
300492
|
import {
|
|
@@ -299679,10 +300498,10 @@ import {
|
|
|
299679
300498
|
} from "fs";
|
|
299680
300499
|
import { homedir as homedir11 } from "os";
|
|
299681
300500
|
import { basename as basename6, join as join20, parse as parse5, resolve as resolve16 } from "path";
|
|
299682
|
-
import { z as
|
|
299683
|
-
var CleanupScopeSchema =
|
|
300501
|
+
import { z as z76 } from "zod";
|
|
300502
|
+
var CleanupScopeSchema = z76.enum(["user", "project"]);
|
|
299684
300503
|
function buildCleanupPlan(options) {
|
|
299685
|
-
const scopes =
|
|
300504
|
+
const scopes = z76.array(CleanupScopeSchema).min(1).parse(options.scopes);
|
|
299686
300505
|
const homeDirectory = resolve16(options.homeDirectory ?? homedir11());
|
|
299687
300506
|
const projectDirectory = resolve16(options.projectDirectory ?? options.cwd);
|
|
299688
300507
|
const candidates = scopes.map((scope) => ({
|
|
@@ -299840,12 +300659,12 @@ function safeInventoryWarning(targetPath, error) {
|
|
|
299840
300659
|
}
|
|
299841
300660
|
|
|
299842
300661
|
// src/commands/clean.ts
|
|
299843
|
-
var CleanCommandOptionsSchema =
|
|
299844
|
-
user:
|
|
299845
|
-
project:
|
|
299846
|
-
all:
|
|
299847
|
-
yes:
|
|
299848
|
-
json:
|
|
300662
|
+
var CleanCommandOptionsSchema = z77.object({
|
|
300663
|
+
user: z77.boolean().default(false),
|
|
300664
|
+
project: z77.union([z77.boolean(), z77.string().min(1).max(4096)]).optional(),
|
|
300665
|
+
all: z77.boolean().default(false),
|
|
300666
|
+
yes: z77.boolean().default(false),
|
|
300667
|
+
json: z77.boolean().default(false)
|
|
299849
300668
|
}).strict();
|
|
299850
300669
|
async function runClean(cwd, rawOptions, dependencies = {}) {
|
|
299851
300670
|
const options = CleanCommandOptionsSchema.parse(rawOptions);
|
|
@@ -299949,7 +300768,7 @@ async function confirmDeletion(prompt) {
|
|
|
299949
300768
|
});
|
|
299950
300769
|
try {
|
|
299951
300770
|
const answer = await new Promise(
|
|
299952
|
-
(
|
|
300771
|
+
(resolve26) => interfaceInstance.question(prompt, resolve26)
|
|
299953
300772
|
);
|
|
299954
300773
|
return answer.trim() === "DELETE";
|
|
299955
300774
|
} finally {
|
|
@@ -299960,11 +300779,11 @@ async function confirmDeletion(prompt) {
|
|
|
299960
300779
|
// src/commands/backup.ts
|
|
299961
300780
|
import { basename as basename7, resolve as resolve19 } from "path";
|
|
299962
300781
|
import picocolors27 from "picocolors";
|
|
299963
|
-
import { z as
|
|
300782
|
+
import { z as z79 } from "zod";
|
|
299964
300783
|
|
|
299965
300784
|
// src/runtime/ProjectBackup.ts
|
|
299966
300785
|
import {
|
|
299967
|
-
existsSync as
|
|
300786
|
+
existsSync as existsSync30,
|
|
299968
300787
|
lstatSync as lstatSync11,
|
|
299969
300788
|
mkdirSync as mkdirSync10,
|
|
299970
300789
|
readdirSync as readdirSync10,
|
|
@@ -299973,26 +300792,26 @@ import {
|
|
|
299973
300792
|
writeFileSync as writeFileSync10
|
|
299974
300793
|
} from "fs";
|
|
299975
300794
|
import { createHash as createHash10, randomUUID as randomUUID16 } from "crypto";
|
|
299976
|
-
import { dirname as dirname17, isAbsolute as
|
|
299977
|
-
import { z as
|
|
300795
|
+
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join21, relative as relative10, resolve as resolve18, sep as sep2 } from "path";
|
|
300796
|
+
import { z as z78 } from "zod";
|
|
299978
300797
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
299979
300798
|
var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
|
|
299980
300799
|
var MAX_BACKUP_FILES = 1e4;
|
|
299981
300800
|
var MAX_BACKUP_TREE_ENTRIES = 5e4;
|
|
299982
300801
|
var MAX_BACKUP_TREE_DEPTH = 64;
|
|
299983
300802
|
var SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
299984
|
-
var BackupFileSchema =
|
|
299985
|
-
path:
|
|
299986
|
-
size:
|
|
299987
|
-
sha256:
|
|
299988
|
-
content:
|
|
300803
|
+
var BackupFileSchema = z78.object({
|
|
300804
|
+
path: z78.string().min(1).max(4096),
|
|
300805
|
+
size: z78.number().int().min(0).max(MAX_BACKUP_BYTES),
|
|
300806
|
+
sha256: z78.string().regex(SHA256_PATTERN),
|
|
300807
|
+
content: z78.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
|
|
299989
300808
|
});
|
|
299990
|
-
var ProjectBackupBundleSchema =
|
|
299991
|
-
schemaVersion:
|
|
299992
|
-
kind:
|
|
299993
|
-
createdAt:
|
|
299994
|
-
sourceName:
|
|
299995
|
-
files:
|
|
300809
|
+
var ProjectBackupBundleSchema = z78.object({
|
|
300810
|
+
schemaVersion: z78.literal(1),
|
|
300811
|
+
kind: z78.literal("orbit-project-backup"),
|
|
300812
|
+
createdAt: z78.string().datetime(),
|
|
300813
|
+
sourceName: z78.string().min(1).max(512),
|
|
300814
|
+
files: z78.array(BackupFileSchema).max(MAX_BACKUP_FILES)
|
|
299996
300815
|
}).superRefine((bundle, context) => {
|
|
299997
300816
|
let totalBytes = 0;
|
|
299998
300817
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -300000,7 +300819,7 @@ var ProjectBackupBundleSchema = z77.object({
|
|
|
300000
300819
|
totalBytes += file.size;
|
|
300001
300820
|
if (totalBytes > MAX_BACKUP_BYTES) {
|
|
300002
300821
|
context.addIssue({
|
|
300003
|
-
code:
|
|
300822
|
+
code: z78.ZodIssueCode.custom,
|
|
300004
300823
|
message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
|
|
300005
300824
|
});
|
|
300006
300825
|
break;
|
|
@@ -300008,14 +300827,14 @@ var ProjectBackupBundleSchema = z77.object({
|
|
|
300008
300827
|
const normalized = normalizeBundlePath(file.path);
|
|
300009
300828
|
if (!normalized || normalized !== file.path) {
|
|
300010
300829
|
context.addIssue({
|
|
300011
|
-
code:
|
|
300830
|
+
code: z78.ZodIssueCode.custom,
|
|
300012
300831
|
message: `Unsafe backup path: ${file.path}`
|
|
300013
300832
|
});
|
|
300014
300833
|
continue;
|
|
300015
300834
|
}
|
|
300016
300835
|
if (seen.has(normalized.toLowerCase())) {
|
|
300017
300836
|
context.addIssue({
|
|
300018
|
-
code:
|
|
300837
|
+
code: z78.ZodIssueCode.custom,
|
|
300019
300838
|
message: `Duplicate backup path: ${file.path}`
|
|
300020
300839
|
});
|
|
300021
300840
|
}
|
|
@@ -300040,7 +300859,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
300040
300859
|
const orbitRoot = join21(projectRoot, ".orbit");
|
|
300041
300860
|
const files = [];
|
|
300042
300861
|
let totalBytes = 0;
|
|
300043
|
-
if (
|
|
300862
|
+
if (existsSync30(orbitRoot)) {
|
|
300044
300863
|
for (const absolutePath of listBackupFiles(orbitRoot)) {
|
|
300045
300864
|
if (files.length >= MAX_BACKUP_FILES) {
|
|
300046
300865
|
throw new Error(`Project backup exceeds ${MAX_BACKUP_FILES} files.`);
|
|
@@ -300119,7 +300938,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
300119
300938
|
file,
|
|
300120
300939
|
destination: resolveBackupDestination(orbitRoot, file.path)
|
|
300121
300940
|
}));
|
|
300122
|
-
const conflicts2 = planned.filter(({ destination }) =>
|
|
300941
|
+
const conflicts2 = planned.filter(({ destination }) => existsSync30(destination)).map(({ file }) => file.path);
|
|
300123
300942
|
if (conflicts2.length > 0 && !options.force) {
|
|
300124
300943
|
throw new Error(
|
|
300125
300944
|
`Restore would overwrite ${conflicts2.length} file(s). Re-run with --force after reviewing the backup.`
|
|
@@ -300202,22 +301021,22 @@ function assertDirectoryChainHasNoSymlink(root, target) {
|
|
|
300202
301021
|
const absoluteRoot = resolve18(root);
|
|
300203
301022
|
const absoluteTarget = resolve18(target);
|
|
300204
301023
|
const relativeTarget = relative10(absoluteRoot, absoluteTarget);
|
|
300205
|
-
if (relativeTarget.startsWith("..") ||
|
|
301024
|
+
if (relativeTarget.startsWith("..") || isAbsolute9(relativeTarget)) {
|
|
300206
301025
|
throw new Error("Backup restore directory escapes the project.");
|
|
300207
301026
|
}
|
|
300208
301027
|
let current = absoluteRoot;
|
|
300209
|
-
if (
|
|
301028
|
+
if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
|
|
300210
301029
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
300211
301030
|
}
|
|
300212
301031
|
for (const part of relativeTarget.split(sep2).filter(Boolean)) {
|
|
300213
301032
|
current = join21(current, part);
|
|
300214
|
-
if (
|
|
301033
|
+
if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
|
|
300215
301034
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
300216
301035
|
}
|
|
300217
301036
|
}
|
|
300218
301037
|
}
|
|
300219
301038
|
function replaceFileAtomically2(temporaryPath, destination) {
|
|
300220
|
-
if (!
|
|
301039
|
+
if (!existsSync30(destination)) {
|
|
300221
301040
|
renameSync8(temporaryPath, destination);
|
|
300222
301041
|
return;
|
|
300223
301042
|
}
|
|
@@ -300227,7 +301046,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
300227
301046
|
renameSync8(temporaryPath, destination);
|
|
300228
301047
|
rmSync10(previousPath, { force: true });
|
|
300229
301048
|
} catch (error) {
|
|
300230
|
-
if (!
|
|
301049
|
+
if (!existsSync30(destination) && existsSync30(previousPath)) {
|
|
300231
301050
|
renameSync8(previousPath, destination);
|
|
300232
301051
|
}
|
|
300233
301052
|
throw error;
|
|
@@ -300235,7 +301054,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
300235
301054
|
}
|
|
300236
301055
|
function normalizeBundlePath(filePath) {
|
|
300237
301056
|
const normalized = filePath.replaceAll("\\", "/");
|
|
300238
|
-
if (!normalized || normalized.startsWith("/") ||
|
|
301057
|
+
if (!normalized || normalized.startsWith("/") || isAbsolute9(normalized) || normalized.split("/").some((part) => !part || part === "." || part === "..")) {
|
|
300239
301058
|
return void 0;
|
|
300240
301059
|
}
|
|
300241
301060
|
return normalized;
|
|
@@ -300248,9 +301067,9 @@ function formatBytes2(bytes) {
|
|
|
300248
301067
|
}
|
|
300249
301068
|
|
|
300250
301069
|
// src/commands/backup.ts
|
|
300251
|
-
var BackupOptionsSchema =
|
|
300252
|
-
output:
|
|
300253
|
-
json:
|
|
301070
|
+
var BackupOptionsSchema = z79.object({
|
|
301071
|
+
output: z79.string().min(1).max(4096).optional(),
|
|
301072
|
+
json: z79.boolean().default(false)
|
|
300254
301073
|
}).strict();
|
|
300255
301074
|
function runBackupCreate(cwd, rawOptions = {}) {
|
|
300256
301075
|
const options = BackupOptionsSchema.parse(rawOptions);
|
|
@@ -300339,7 +301158,7 @@ import picocolors28 from "picocolors";
|
|
|
300339
301158
|
|
|
300340
301159
|
// src/runtime/ExtensionManager.ts
|
|
300341
301160
|
import {
|
|
300342
|
-
existsSync as
|
|
301161
|
+
existsSync as existsSync31,
|
|
300343
301162
|
lstatSync as lstatSync12,
|
|
300344
301163
|
mkdirSync as mkdirSync11,
|
|
300345
301164
|
readdirSync as readdirSync11,
|
|
@@ -300348,23 +301167,23 @@ import {
|
|
|
300348
301167
|
writeFileSync as writeFileSync11
|
|
300349
301168
|
} from "fs";
|
|
300350
301169
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
300351
|
-
import { dirname as dirname18, isAbsolute as
|
|
301170
|
+
import { dirname as dirname18, isAbsolute as isAbsolute10, join as join26, relative as relative11, resolve as resolve20, sep as sep3 } from "path";
|
|
300352
301171
|
import { homedir as homedir12 } from "os";
|
|
300353
|
-
import { z as
|
|
300354
|
-
var InstalledExtensionSchema2 =
|
|
301172
|
+
import { z as z80 } from "zod";
|
|
301173
|
+
var InstalledExtensionSchema2 = z80.object({
|
|
300355
301174
|
id: InstalledExtensionIdSchema,
|
|
300356
|
-
displayName:
|
|
300357
|
-
version:
|
|
300358
|
-
digest:
|
|
301175
|
+
displayName: z80.string().min(1).max(256),
|
|
301176
|
+
version: z80.string().min(1).max(128),
|
|
301177
|
+
digest: z80.string().regex(/^[a-f0-9]{64}$/),
|
|
300359
301178
|
digestAlgorithm: ExtensionDigestAlgorithmSchema.default("sha256-v1"),
|
|
300360
|
-
installedAt:
|
|
300361
|
-
trusted:
|
|
300362
|
-
path:
|
|
300363
|
-
manifestFile:
|
|
301179
|
+
installedAt: z80.string().datetime(),
|
|
301180
|
+
trusted: z80.boolean(),
|
|
301181
|
+
path: z80.string().min(1).max(4096),
|
|
301182
|
+
manifestFile: z80.string().min(1).max(4096).default("extension.yaml")
|
|
300364
301183
|
});
|
|
300365
|
-
var ExtensionRegistrySchema2 =
|
|
300366
|
-
schemaVersion:
|
|
300367
|
-
extensions:
|
|
301184
|
+
var ExtensionRegistrySchema2 = z80.object({
|
|
301185
|
+
schemaVersion: z80.literal(1),
|
|
301186
|
+
extensions: z80.array(InstalledExtensionSchema2).max(500).default([])
|
|
300368
301187
|
});
|
|
300369
301188
|
var ExtensionManager = class {
|
|
300370
301189
|
orbitDir;
|
|
@@ -300378,7 +301197,7 @@ var ExtensionManager = class {
|
|
|
300378
301197
|
list() {
|
|
300379
301198
|
try {
|
|
300380
301199
|
return this.readRegistry().filter(
|
|
300381
|
-
(extension) => this.isManagedExtensionPath(extension) &&
|
|
301200
|
+
(extension) => this.isManagedExtensionPath(extension) && existsSync31(extension.path) && !lstatSync12(extension.path).isSymbolicLink()
|
|
300382
301201
|
);
|
|
300383
301202
|
} catch {
|
|
300384
301203
|
return [];
|
|
@@ -300431,12 +301250,12 @@ var ExtensionManager = class {
|
|
|
300431
301250
|
try {
|
|
300432
301251
|
copyDirectorySafely(sourceRoot, staging);
|
|
300433
301252
|
const digest = hashExtensionDirectory(staging);
|
|
300434
|
-
if (
|
|
301253
|
+
if (existsSync31(target)) {
|
|
300435
301254
|
renameSync9(target, targetBackup);
|
|
300436
301255
|
targetBackedUp = true;
|
|
300437
301256
|
}
|
|
300438
301257
|
for (const prompt of promptTargets) {
|
|
300439
|
-
if (!
|
|
301258
|
+
if (!existsSync31(prompt.target)) continue;
|
|
300440
301259
|
mkdirSync11(dirname18(prompt.backup), { recursive: true });
|
|
300441
301260
|
renameSync9(prompt.target, prompt.backup);
|
|
300442
301261
|
prompt.backedUp = true;
|
|
@@ -300472,14 +301291,14 @@ var ExtensionManager = class {
|
|
|
300472
301291
|
if (targetInstalled) {
|
|
300473
301292
|
rmSync11(target, { recursive: true, force: true });
|
|
300474
301293
|
}
|
|
300475
|
-
if (targetBackedUp &&
|
|
301294
|
+
if (targetBackedUp && existsSync31(targetBackup)) {
|
|
300476
301295
|
renameSync9(targetBackup, target);
|
|
300477
301296
|
}
|
|
300478
301297
|
for (const prompt of promptTargets) {
|
|
300479
301298
|
if (promptMutationStarted) {
|
|
300480
301299
|
rmSync11(prompt.target, { recursive: true, force: true });
|
|
300481
301300
|
}
|
|
300482
|
-
if (prompt.backedUp &&
|
|
301301
|
+
if (prompt.backedUp && existsSync31(prompt.backup)) {
|
|
300483
301302
|
mkdirSync11(dirname18(prompt.target), { recursive: true });
|
|
300484
301303
|
renameSync9(prompt.backup, prompt.target);
|
|
300485
301304
|
}
|
|
@@ -300507,7 +301326,7 @@ var ExtensionManager = class {
|
|
|
300507
301326
|
);
|
|
300508
301327
|
}
|
|
300509
301328
|
const installed = registry.find(
|
|
300510
|
-
(entry) => entry.id === id &&
|
|
301329
|
+
(entry) => entry.id === id && existsSync31(entry.path) && !lstatSync12(entry.path).isSymbolicLink()
|
|
300511
301330
|
);
|
|
300512
301331
|
if (!installed) return false;
|
|
300513
301332
|
const rollbackRoot = join26(
|
|
@@ -300527,7 +301346,7 @@ var ExtensionManager = class {
|
|
|
300527
301346
|
].map((entry) => ({ ...entry, backedUp: false }));
|
|
300528
301347
|
try {
|
|
300529
301348
|
for (const entry of targets) {
|
|
300530
|
-
if (!
|
|
301349
|
+
if (!existsSync31(entry.target)) continue;
|
|
300531
301350
|
mkdirSync11(dirname18(entry.backup), { recursive: true });
|
|
300532
301351
|
renameSync9(entry.target, entry.backup);
|
|
300533
301352
|
entry.backedUp = true;
|
|
@@ -300538,7 +301357,7 @@ var ExtensionManager = class {
|
|
|
300538
301357
|
} catch (error) {
|
|
300539
301358
|
try {
|
|
300540
301359
|
for (const entry of targets) {
|
|
300541
|
-
if (!entry.backedUp || !
|
|
301360
|
+
if (!entry.backedUp || !existsSync31(entry.backup)) continue;
|
|
300542
301361
|
mkdirSync11(dirname18(entry.target), { recursive: true });
|
|
300543
301362
|
renameSync9(entry.backup, entry.target);
|
|
300544
301363
|
}
|
|
@@ -300566,7 +301385,7 @@ var ExtensionManager = class {
|
|
|
300566
301385
|
isManagedExtensionPath(extension) {
|
|
300567
301386
|
const expected = resolve20(this.extensionsDir, extension.id);
|
|
300568
301387
|
const slot = relative11(this.extensionsDir, expected);
|
|
300569
|
-
const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !
|
|
301388
|
+
const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !isAbsolute10(slot);
|
|
300570
301389
|
return remainsInsideManagedRoot && resolve20(extension.path) === expected;
|
|
300571
301390
|
}
|
|
300572
301391
|
readRegistry() {
|
|
@@ -300667,7 +301486,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
300667
301486
|
`Invalid extension contribution path: ${contribution.path}`
|
|
300668
301487
|
);
|
|
300669
301488
|
}
|
|
300670
|
-
if (!
|
|
301489
|
+
if (!existsSync31(target) || lstatSync12(target).isSymbolicLink()) {
|
|
300671
301490
|
throw new Error(
|
|
300672
301491
|
`Extension contribution is missing or unsafe: ${contribution.path}`
|
|
300673
301492
|
);
|
|
@@ -300818,7 +301637,7 @@ function removeExtension(id) {
|
|
|
300818
301637
|
}
|
|
300819
301638
|
|
|
300820
301639
|
// src/index.ts
|
|
300821
|
-
import { existsSync as
|
|
301640
|
+
import { existsSync as existsSync35, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
|
|
300822
301641
|
import { resolve as resolve21 } from "path";
|
|
300823
301642
|
|
|
300824
301643
|
// src/runtime/CliRunOverrides.ts
|
|
@@ -300847,7 +301666,7 @@ function applyOutcomeExitCode(outcome) {
|
|
|
300847
301666
|
}
|
|
300848
301667
|
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(
|
|
300849
301668
|
"--yes",
|
|
300850
|
-
"enable Full Access
|
|
301669
|
+
"enable unrestricted Full Access and approve every enabled tool action"
|
|
300851
301670
|
).option("--multi", "run in multi-agent planning/coding/review mode").option("--direct", "run interactive REPL in direct console streaming mode").action(async (task, options) => {
|
|
300852
301671
|
const cwd = process.cwd();
|
|
300853
301672
|
const overrides = createCliRunOverrides({
|
|
@@ -300922,14 +301741,20 @@ skillsCommand.command("list").description("list discovered skills with their dia
|
|
|
300922
301741
|
process.exitCode = await runSkillsCommand("list", { json: !!options.json });
|
|
300923
301742
|
});
|
|
300924
301743
|
skillsCommand.command("validate").description("validate SKILL.md files; non-zero exit on errors (CI-friendly)").option("--json", "print a machine-readable report").option(
|
|
301744
|
+
"-d, --directory <paths...>",
|
|
301745
|
+
"validate only the specified Skill source directories"
|
|
301746
|
+
).option(
|
|
300925
301747
|
"--deep",
|
|
300926
301748
|
"validate bundled references, assets, and filesystem safety"
|
|
300927
|
-
).action(
|
|
300928
|
-
|
|
300929
|
-
|
|
300930
|
-
|
|
300931
|
-
|
|
300932
|
-
|
|
301749
|
+
).action(
|
|
301750
|
+
async (options) => {
|
|
301751
|
+
process.exitCode = await runSkillsCommand("validate", {
|
|
301752
|
+
json: !!options.json,
|
|
301753
|
+
deep: !!options.deep,
|
|
301754
|
+
directories: options.directory
|
|
301755
|
+
});
|
|
301756
|
+
}
|
|
301757
|
+
);
|
|
300933
301758
|
var mcpCommand = program.command("mcp").description("manage Model Context Protocol servers");
|
|
300934
301759
|
mcpCommand.command("login <server>").description("authorize an MCP server via OAuth (PKCE) and save the login").option("--port <port>", "fixed loopback port for the OAuth redirect").action(async (server2, options) => {
|
|
300935
301760
|
const port = options.port ? Number.parseInt(options.port, 10) : void 0;
|
|
@@ -301051,7 +301876,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
301051
301876
|
fullAccess: !!options.yes
|
|
301052
301877
|
});
|
|
301053
301878
|
const requestedCwd = resolve21(localOptions.cwd || process.cwd());
|
|
301054
|
-
if (!
|
|
301879
|
+
if (!existsSync35(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
|
|
301055
301880
|
throw new Error(
|
|
301056
301881
|
`Web UI project directory does not exist: ${requestedCwd}`
|
|
301057
301882
|
);
|