@orbit-build/cli 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +882 -464
- package/package.json +1 -1
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
|
}
|
|
@@ -240571,6 +240578,10 @@ function applyManagedPolicy(source, policy) {
|
|
|
240571
240578
|
if (policy.requireBashApproval) {
|
|
240572
240579
|
config.permissions.requireApprovalForBash = true;
|
|
240573
240580
|
}
|
|
240581
|
+
if (config.permissions.mode !== "auto" || policy.requireWriteApproval || policy.requireBashApproval) {
|
|
240582
|
+
config.permissions.blockDangerousCommands = true;
|
|
240583
|
+
config.permissions.protectSecrets = true;
|
|
240584
|
+
}
|
|
240574
240585
|
config.permissions.protectedPaths = Array.from(
|
|
240575
240586
|
/* @__PURE__ */ new Set([...config.permissions.protectedPaths, ...policy.protectedPaths])
|
|
240576
240587
|
);
|
|
@@ -240832,6 +240843,38 @@ function validateExtensionFileSize(fileBytes, previousTotalBytes) {
|
|
|
240832
240843
|
throw new Error("Extension tree exceeds the 256 MiB limit.");
|
|
240833
240844
|
}
|
|
240834
240845
|
}
|
|
240846
|
+
function applyPermissionModePreset(config, mode) {
|
|
240847
|
+
const fullAccess = mode === "auto";
|
|
240848
|
+
const violation = validateManagedRuntimeChange(config, {
|
|
240849
|
+
permissionMode: mode,
|
|
240850
|
+
requireWriteApproval: !fullAccess,
|
|
240851
|
+
requireBashApproval: !fullAccess
|
|
240852
|
+
});
|
|
240853
|
+
if (violation) return { ok: false, message: violation };
|
|
240854
|
+
config.permissions.mode = mode;
|
|
240855
|
+
config.permissions.allowRead = true;
|
|
240856
|
+
config.permissions.requireApprovalForWrite = !fullAccess;
|
|
240857
|
+
config.permissions.requireApprovalForBash = !fullAccess;
|
|
240858
|
+
config.permissions.blockDangerousCommands = !fullAccess;
|
|
240859
|
+
config.permissions.protectSecrets = !fullAccess;
|
|
240860
|
+
return { ok: true };
|
|
240861
|
+
}
|
|
240862
|
+
function isFullAccessEnabled(config) {
|
|
240863
|
+
return config.permissions.mode === "auto" && config.permissions.allowRead && !config.permissions.requireApprovalForWrite && !config.permissions.requireApprovalForBash && !config.permissions.blockDangerousCommands && !config.permissions.protectSecrets;
|
|
240864
|
+
}
|
|
240865
|
+
function createPermissionModeOverride(mode) {
|
|
240866
|
+
const fullAccess = mode === "auto";
|
|
240867
|
+
return {
|
|
240868
|
+
permissions: {
|
|
240869
|
+
mode,
|
|
240870
|
+
allowRead: true,
|
|
240871
|
+
requireApprovalForWrite: !fullAccess,
|
|
240872
|
+
requireApprovalForBash: !fullAccess,
|
|
240873
|
+
blockDangerousCommands: !fullAccess,
|
|
240874
|
+
protectSecrets: !fullAccess
|
|
240875
|
+
}
|
|
240876
|
+
};
|
|
240877
|
+
}
|
|
240835
240878
|
var MAX_CONFIG_FILE_BYTES = 2 * 1024 * 1024;
|
|
240836
240879
|
var MAX_PRICING_FILE_BYTES = 1024 * 1024;
|
|
240837
240880
|
function isRecord(value) {
|
|
@@ -241137,6 +241180,14 @@ var ConfigLoader = class {
|
|
|
241137
241180
|
ConfigSchema.parse(config),
|
|
241138
241181
|
homeDirectory
|
|
241139
241182
|
);
|
|
241183
|
+
if (config.permissions.mode === "auto") {
|
|
241184
|
+
const fullAccess = applyPermissionModePreset(config, "auto");
|
|
241185
|
+
if (!fullAccess.ok) {
|
|
241186
|
+
throw new Error(
|
|
241187
|
+
`Full Access configuration failed: ${fullAccess.message || "unknown policy conflict"}`
|
|
241188
|
+
);
|
|
241189
|
+
}
|
|
241190
|
+
}
|
|
241140
241191
|
const managedPolicyPath = env.ORBIT_MANAGED_POLICY ? resolve22(env.ORBIT_MANAGED_POLICY) : join4(homeDirectory, ".orbit", "policy.yaml");
|
|
241141
241192
|
if (existsSync22(managedPolicyPath)) {
|
|
241142
241193
|
try {
|
|
@@ -241353,36 +241404,6 @@ function redactValue(value, seen) {
|
|
|
241353
241404
|
}
|
|
241354
241405
|
return output;
|
|
241355
241406
|
}
|
|
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
241407
|
|
|
241387
241408
|
// src/commands/config.ts
|
|
241388
241409
|
import picocolors2 from "picocolors";
|
|
@@ -241394,7 +241415,7 @@ function runConfig(cwd) {
|
|
|
241394
241415
|
|
|
241395
241416
|
// src/commands/doctor.ts
|
|
241396
241417
|
import { execSync as execSync2 } from "child_process";
|
|
241397
|
-
import { existsSync as
|
|
241418
|
+
import { existsSync as existsSync14 } from "fs";
|
|
241398
241419
|
import { basename as basename3, join as join12 } from "path";
|
|
241399
241420
|
import picocolors6 from "picocolors";
|
|
241400
241421
|
import { z as z47 } from "zod";
|
|
@@ -243050,11 +243071,11 @@ function modelFinishReasonError(reason) {
|
|
|
243050
243071
|
return new Error(`Model generation stopped unexpectedly (${reason}).`);
|
|
243051
243072
|
}
|
|
243052
243073
|
function abortableDelay(delayMs, signal) {
|
|
243053
|
-
return new Promise((
|
|
243074
|
+
return new Promise((resolve26, reject) => {
|
|
243054
243075
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
243055
243076
|
const timeoutId = setTimeout(() => {
|
|
243056
243077
|
cleanup();
|
|
243057
|
-
|
|
243078
|
+
resolve26();
|
|
243058
243079
|
}, delayMs);
|
|
243059
243080
|
timeoutId.unref?.();
|
|
243060
243081
|
function onAbort() {
|
|
@@ -246136,12 +246157,12 @@ function normalizeOllamaOpenAiBaseUrl(baseUrl) {
|
|
|
246136
246157
|
}
|
|
246137
246158
|
|
|
246138
246159
|
// src/runtime/CacheDiagnostics.ts
|
|
246139
|
-
import { existsSync as
|
|
246160
|
+
import { existsSync as existsSync13, readdirSync as readdirSync5 } from "fs";
|
|
246140
246161
|
import { join as join11 } from "path";
|
|
246141
246162
|
import picocolors4 from "picocolors";
|
|
246142
246163
|
|
|
246143
246164
|
// ../core/dist/index.js
|
|
246144
|
-
import { existsSync as
|
|
246165
|
+
import { existsSync as existsSync12, readdirSync as readdirSync4 } from "fs";
|
|
246145
246166
|
import { createHash as createHash7 } from "crypto";
|
|
246146
246167
|
import { join as join10 } from "path";
|
|
246147
246168
|
import { z as z31 } from "zod";
|
|
@@ -246161,9 +246182,10 @@ import {
|
|
|
246161
246182
|
unlinkSync as unlinkSync2,
|
|
246162
246183
|
writeFileSync as writeFileSync3
|
|
246163
246184
|
} from "fs";
|
|
246164
|
-
import { dirname as dirname4, join as join5 } from "path";
|
|
246185
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join5, resolve as resolve4 } from "path";
|
|
246186
|
+
import { isAbsolute as isAbsolute22, resolve as resolve23 } from "path";
|
|
246165
246187
|
import { z as z34 } from "zod";
|
|
246166
|
-
import { isAbsolute as
|
|
246188
|
+
import { isAbsolute as isAbsolute3, relative as relative4, win32 } from "path";
|
|
246167
246189
|
import glob from "fast-glob";
|
|
246168
246190
|
import { existsSync as existsSync23 } from "fs";
|
|
246169
246191
|
import { z as z42 } from "zod";
|
|
@@ -247084,7 +247106,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
|
|
|
247084
247106
|
return spawnedPromise;
|
|
247085
247107
|
}
|
|
247086
247108
|
let timeoutId;
|
|
247087
|
-
const timeoutPromise = new Promise((
|
|
247109
|
+
const timeoutPromise = new Promise((resolve26, reject) => {
|
|
247088
247110
|
timeoutId = setTimeout(() => {
|
|
247089
247111
|
timeoutKill(spawned, killSignal, reject);
|
|
247090
247112
|
}, timeout);
|
|
@@ -247450,9 +247472,9 @@ var mergePromise = (spawned, promise) => {
|
|
|
247450
247472
|
Reflect.defineProperty(spawned, property, { ...descriptor, value });
|
|
247451
247473
|
}
|
|
247452
247474
|
};
|
|
247453
|
-
var getSpawnedPromise = (spawned) => new Promise((
|
|
247475
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve26, reject) => {
|
|
247454
247476
|
spawned.on("exit", (exitCode, signal) => {
|
|
247455
|
-
|
|
247477
|
+
resolve26({ exitCode, signal });
|
|
247456
247478
|
});
|
|
247457
247479
|
spawned.on("error", (error) => {
|
|
247458
247480
|
reject(error);
|
|
@@ -247761,26 +247783,27 @@ import { z as z52 } from "zod";
|
|
|
247761
247783
|
import { z as z62 } from "zod";
|
|
247762
247784
|
import { z as z72 } from "zod";
|
|
247763
247785
|
import { createHash as createHash3 } from "crypto";
|
|
247786
|
+
import { existsSync as existsSync32 } from "fs";
|
|
247764
247787
|
import { z as z82 } from "zod";
|
|
247765
247788
|
import { z as z92 } from "zod";
|
|
247766
247789
|
import { z as z102 } from "zod";
|
|
247767
247790
|
import { relative as relative22 } from "path";
|
|
247768
247791
|
import { z as z11 } from "zod";
|
|
247769
247792
|
import { z as z12 } from "zod";
|
|
247770
|
-
import { existsSync as
|
|
247793
|
+
import { existsSync as existsSync42 } from "fs";
|
|
247771
247794
|
import { join as join23 } from "path";
|
|
247772
247795
|
import { z as z14 } from "zod";
|
|
247773
|
-
import { existsSync as
|
|
247796
|
+
import { existsSync as existsSync6 } from "fs";
|
|
247774
247797
|
import { z as z13 } from "zod";
|
|
247775
|
-
import { existsSync as
|
|
247798
|
+
import { existsSync as existsSync52 } from "fs";
|
|
247776
247799
|
import { z as z15 } from "zod";
|
|
247777
247800
|
import glob2 from "fast-glob";
|
|
247778
247801
|
import { z as z16 } from "zod";
|
|
247779
247802
|
import { z as z17 } from "zod";
|
|
247780
|
-
import { existsSync as
|
|
247803
|
+
import { existsSync as existsSync7 } from "fs";
|
|
247781
247804
|
import { join as join32 } from "path";
|
|
247782
247805
|
import { z as z18 } from "zod";
|
|
247783
|
-
import { existsSync as
|
|
247806
|
+
import { existsSync as existsSync8 } from "fs";
|
|
247784
247807
|
import { join as join42 } from "path";
|
|
247785
247808
|
import { z as z20 } from "zod";
|
|
247786
247809
|
var import_ipaddr = __toESM(require_ipaddr(), 1);
|
|
@@ -247829,11 +247852,14 @@ var ToolRegistry = class {
|
|
|
247829
247852
|
var toolRegistry = new ToolRegistry();
|
|
247830
247853
|
var MAX_TOOL_FILE_BYTES = 16 * 1024 * 1024;
|
|
247831
247854
|
var MAX_GREP_FALLBACK_FILE_BYTES = 2 * 1024 * 1024;
|
|
247832
|
-
function
|
|
247833
|
-
|
|
247855
|
+
function atomicWriteToolFile(cwd, requestedPath, content, expectedCurrentContent, options = {}) {
|
|
247856
|
+
const resolveRequestedPath = () => options.allowOutsideWorkspace ? normalizePath(
|
|
247857
|
+
isAbsolute2(requestedPath) ? resolve4(requestedPath) : resolve4(cwd, requestedPath)
|
|
247858
|
+
) : resolveSafePath(cwd, requestedPath);
|
|
247859
|
+
let safePath = resolveRequestedPath();
|
|
247834
247860
|
const parent = dirname4(safePath);
|
|
247835
247861
|
mkdirSync2(parent, { recursive: true });
|
|
247836
|
-
safePath =
|
|
247862
|
+
safePath = resolveRequestedPath();
|
|
247837
247863
|
assertExpectedContent(safePath, expectedCurrentContent);
|
|
247838
247864
|
const temporaryPath = join5(parent, `.orbit-write-${randomUUID3()}.tmp`);
|
|
247839
247865
|
let descriptor;
|
|
@@ -247843,7 +247869,7 @@ function atomicWriteWorkspaceFile(cwd, requestedPath, content, expectedCurrentCo
|
|
|
247843
247869
|
fsyncSync2(descriptor);
|
|
247844
247870
|
closeSync3(descriptor);
|
|
247845
247871
|
descriptor = void 0;
|
|
247846
|
-
const revalidatedPath =
|
|
247872
|
+
const revalidatedPath = resolveRequestedPath();
|
|
247847
247873
|
if (revalidatedPath !== safePath) {
|
|
247848
247874
|
throw new Error("File path changed while preparing the atomic write.");
|
|
247849
247875
|
}
|
|
@@ -247871,6 +247897,18 @@ function assertExpectedContent(safePath, expected) {
|
|
|
247871
247897
|
);
|
|
247872
247898
|
}
|
|
247873
247899
|
}
|
|
247900
|
+
function hasFullHostAccess(ctx) {
|
|
247901
|
+
return Boolean(ctx.config && isFullAccessEnabled(ctx.config));
|
|
247902
|
+
}
|
|
247903
|
+
function resolveToolPath(ctx, requestedPath) {
|
|
247904
|
+
if (!hasFullHostAccess(ctx)) return resolveSafePath(ctx.cwd, requestedPath);
|
|
247905
|
+
return normalizePath(
|
|
247906
|
+
isAbsolute22(requestedPath) ? resolve23(requestedPath) : resolve23(ctx.cwd, requestedPath)
|
|
247907
|
+
);
|
|
247908
|
+
}
|
|
247909
|
+
function buildToolChildEnvironment(ctx) {
|
|
247910
|
+
return ctx.config && isFullAccessEnabled(ctx.config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
|
|
247911
|
+
}
|
|
247874
247912
|
var EditFileInputSchema = z24.object({
|
|
247875
247913
|
path: z24.string().trim().min(1).max(4096),
|
|
247876
247914
|
oldText: z24.string().max(5e6),
|
|
@@ -247879,12 +247917,12 @@ var EditFileInputSchema = z24.object({
|
|
|
247879
247917
|
});
|
|
247880
247918
|
var EditFileTool = class {
|
|
247881
247919
|
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.";
|
|
247920
|
+
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
247921
|
inputSchema = EditFileInputSchema;
|
|
247884
247922
|
risk = "write";
|
|
247885
247923
|
async execute(input, ctx) {
|
|
247886
247924
|
try {
|
|
247887
|
-
const safePath =
|
|
247925
|
+
const safePath = resolveToolPath(ctx, input.path);
|
|
247888
247926
|
const originalContent = readBoundedRegularFile(
|
|
247889
247927
|
safePath,
|
|
247890
247928
|
MAX_TOOL_FILE_BYTES
|
|
@@ -247905,7 +247943,7 @@ var EditFileTool = class {
|
|
|
247905
247943
|
}
|
|
247906
247944
|
const updated = fileContent.split(oldTextNorm).join(newTextNorm);
|
|
247907
247945
|
const writeError = await this.checkAndWrite(
|
|
247908
|
-
ctx
|
|
247946
|
+
ctx,
|
|
247909
247947
|
input.path,
|
|
247910
247948
|
safePath,
|
|
247911
247949
|
updated,
|
|
@@ -247956,7 +247994,7 @@ var EditFileTool = class {
|
|
|
247956
247994
|
fileLines.splice(matchedIndex, M, ...adjustedNewLines);
|
|
247957
247995
|
const updated = fileLines.join("\n");
|
|
247958
247996
|
const writeError = await this.checkAndWrite(
|
|
247959
|
-
ctx
|
|
247997
|
+
ctx,
|
|
247960
247998
|
input.path,
|
|
247961
247999
|
safePath,
|
|
247962
248000
|
updated,
|
|
@@ -247985,7 +248023,7 @@ var EditFileTool = class {
|
|
|
247985
248023
|
fileLines.splice(index, M, ...adjustedNewLines);
|
|
247986
248024
|
}
|
|
247987
248025
|
const writeError = await this.checkAndWrite(
|
|
247988
|
-
ctx
|
|
248026
|
+
ctx,
|
|
247989
248027
|
input.path,
|
|
247990
248028
|
safePath,
|
|
247991
248029
|
fileLines.join("\n"),
|
|
@@ -248041,7 +248079,7 @@ var EditFileTool = class {
|
|
|
248041
248079
|
fileLines.splice(bestIndex, M, ...adjustedNewLines);
|
|
248042
248080
|
const updated = fileLines.join("\n");
|
|
248043
248081
|
const writeError = await this.checkAndWrite(
|
|
248044
|
-
ctx
|
|
248082
|
+
ctx,
|
|
248045
248083
|
input.path,
|
|
248046
248084
|
safePath,
|
|
248047
248085
|
updated,
|
|
@@ -248063,11 +248101,12 @@ var EditFileTool = class {
|
|
|
248063
248101
|
input.path,
|
|
248064
248102
|
fileContent,
|
|
248065
248103
|
oldTextNorm,
|
|
248066
|
-
newTextNorm
|
|
248104
|
+
newTextNorm,
|
|
248105
|
+
buildToolChildEnvironment(ctx)
|
|
248067
248106
|
);
|
|
248068
248107
|
if (astUpdated) {
|
|
248069
248108
|
const writeError = await this.checkAndWrite(
|
|
248070
|
-
ctx
|
|
248109
|
+
ctx,
|
|
248071
248110
|
input.path,
|
|
248072
248111
|
safePath,
|
|
248073
248112
|
astUpdated,
|
|
@@ -248098,8 +248137,12 @@ var EditFileTool = class {
|
|
|
248098
248137
|
};
|
|
248099
248138
|
}
|
|
248100
248139
|
}
|
|
248101
|
-
async checkAndWrite(
|
|
248102
|
-
const syntaxError = await verifySyntax(
|
|
248140
|
+
async checkAndWrite(ctx, filePath, safePath, updated, originalContent) {
|
|
248141
|
+
const syntaxError = await verifySyntax(
|
|
248142
|
+
filePath,
|
|
248143
|
+
updated,
|
|
248144
|
+
buildToolChildEnvironment(ctx)
|
|
248145
|
+
);
|
|
248103
248146
|
if (syntaxError) {
|
|
248104
248147
|
return {
|
|
248105
248148
|
ok: false,
|
|
@@ -248108,16 +248151,13 @@ ${syntaxError}`
|
|
|
248108
248151
|
};
|
|
248109
248152
|
}
|
|
248110
248153
|
const finalContent = originalContent.includes("\r\n") ? updated.replace(/\n/g, "\r\n") : updated;
|
|
248111
|
-
|
|
248112
|
-
|
|
248113
|
-
|
|
248114
|
-
finalContent,
|
|
248115
|
-
originalContent
|
|
248116
|
-
);
|
|
248154
|
+
atomicWriteToolFile(ctx.cwd, safePath, finalContent, originalContent, {
|
|
248155
|
+
allowOutsideWorkspace: hasFullHostAccess(ctx)
|
|
248156
|
+
});
|
|
248117
248157
|
return null;
|
|
248118
248158
|
}
|
|
248119
248159
|
};
|
|
248120
|
-
async function verifySyntax(filePath, content) {
|
|
248160
|
+
async function verifySyntax(filePath, content, environment) {
|
|
248121
248161
|
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
248122
248162
|
if (ext === "json") {
|
|
248123
248163
|
try {
|
|
@@ -248167,6 +248207,7 @@ ${errors.join("\n")}`;
|
|
|
248167
248207
|
["-c", "import sys; compile(sys.stdin.read(), 'file.py', 'exec')"],
|
|
248168
248208
|
{
|
|
248169
248209
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248210
|
+
env: environment,
|
|
248170
248211
|
input: content,
|
|
248171
248212
|
encoding: "utf8"
|
|
248172
248213
|
}
|
|
@@ -248292,7 +248333,7 @@ function describeReplacedRegion(original, updated) {
|
|
|
248292
248333
|
startLine: original.slice(0, prefix).split("\n").length
|
|
248293
248334
|
};
|
|
248294
248335
|
}
|
|
248295
|
-
async function astMatchAndReplace(filePath, fileContent, oldText, newText) {
|
|
248336
|
+
async function astMatchAndReplace(filePath, fileContent, oldText, newText, environment) {
|
|
248296
248337
|
const ext = filePath.split(".").pop()?.toLowerCase();
|
|
248297
248338
|
if (ext !== "ts" && ext !== "tsx" && ext !== "js" && ext !== "jsx" && ext !== "py") {
|
|
248298
248339
|
return null;
|
|
@@ -248365,6 +248406,7 @@ if __name__ == "__main__":
|
|
|
248365
248406
|
["-c", pythonScript, fileContent, oldText, newText],
|
|
248366
248407
|
{
|
|
248367
248408
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248409
|
+
env: environment,
|
|
248368
248410
|
encoding: "utf8"
|
|
248369
248411
|
}
|
|
248370
248412
|
);
|
|
@@ -248492,7 +248534,7 @@ var IGNORED_DIRECTORIES = [
|
|
|
248492
248534
|
function isWorkspaceRelativeGlob(pattern) {
|
|
248493
248535
|
const candidate = pattern.startsWith("!") ? pattern.slice(1) : pattern;
|
|
248494
248536
|
const normalized = candidate.replace(/\\/g, "/");
|
|
248495
|
-
return candidate.length > 0 && !
|
|
248537
|
+
return candidate.length > 0 && !isAbsolute3(candidate) && !win32.isAbsolute(candidate) && !normalized.includes("..");
|
|
248496
248538
|
}
|
|
248497
248539
|
async function findWorkspaceFiles(root, pattern, options = {}) {
|
|
248498
248540
|
if (!isWorkspaceRelativeGlob(pattern)) {
|
|
@@ -248560,7 +248602,7 @@ function resolveReadableFile(ctx, inputPath) {
|
|
|
248560
248602
|
return void 0;
|
|
248561
248603
|
};
|
|
248562
248604
|
try {
|
|
248563
|
-
const workspacePath =
|
|
248605
|
+
const workspacePath = resolveToolPath(ctx, inputPath);
|
|
248564
248606
|
if (existsSync23(workspacePath)) return workspacePath;
|
|
248565
248607
|
return fromRoots() ?? workspacePath;
|
|
248566
248608
|
} catch (workspaceError) {
|
|
@@ -248583,20 +248625,21 @@ function normalizedReadRoots(ctx) {
|
|
|
248583
248625
|
}
|
|
248584
248626
|
var GlobInputSchema = z34.object({
|
|
248585
248627
|
pattern: z34.string().min(1).max(4096).refine(isReadableGlob, {
|
|
248586
|
-
message: "Glob pattern must stay relative to the
|
|
248628
|
+
message: "Glob pattern must stay relative to the selected root or use skill://<skill-name>/<pattern>."
|
|
248587
248629
|
}),
|
|
248630
|
+
path: z34.string().trim().min(1).max(4096).optional(),
|
|
248588
248631
|
maxResults: z34.number().int().min(1).max(5e3).optional()
|
|
248589
248632
|
});
|
|
248590
248633
|
var GlobTool = class {
|
|
248591
248634
|
name = "glob";
|
|
248592
|
-
description = "Find files matching a
|
|
248635
|
+
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
248636
|
inputSchema = GlobInputSchema;
|
|
248594
248637
|
risk = "read";
|
|
248595
248638
|
async execute(input, ctx) {
|
|
248596
248639
|
try {
|
|
248597
248640
|
const skillUri = parseSkillUri(input.pattern);
|
|
248598
248641
|
const skillRoot = skillUri ? resolveSkillRoot(ctx, skillUri.name) : void 0;
|
|
248599
|
-
const root = skillRoot?.path ?? ctx.cwd;
|
|
248642
|
+
const root = skillRoot?.path ?? (input.path ? resolveToolPath(ctx, input.path) : ctx.cwd);
|
|
248600
248643
|
const pattern = skillUri?.relativePath ?? input.pattern;
|
|
248601
248644
|
const files = await findWorkspaceFiles(root, pattern, {
|
|
248602
248645
|
dot: true
|
|
@@ -248662,7 +248705,7 @@ function buildLineMatcher(pattern) {
|
|
|
248662
248705
|
}
|
|
248663
248706
|
var GrepTool = class {
|
|
248664
248707
|
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.";
|
|
248708
|
+
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
248709
|
inputSchema = GrepInputSchema;
|
|
248667
248710
|
risk = "read";
|
|
248668
248711
|
async execute(input, ctx) {
|
|
@@ -248678,7 +248721,10 @@ var GrepTool = class {
|
|
|
248678
248721
|
resultRoot = resource.root.path;
|
|
248679
248722
|
searchDir = resource.path;
|
|
248680
248723
|
} else {
|
|
248681
|
-
searchDir = input.path ?
|
|
248724
|
+
searchDir = input.path ? resolveToolPath(ctx, input.path) : ctx.cwd;
|
|
248725
|
+
if (!checkWorkspaceBoundary(ctx.cwd, searchDir)) {
|
|
248726
|
+
resultRoot = searchDir;
|
|
248727
|
+
}
|
|
248682
248728
|
}
|
|
248683
248729
|
} catch (error) {
|
|
248684
248730
|
return {
|
|
@@ -248708,6 +248754,8 @@ var GrepTool = class {
|
|
|
248708
248754
|
args.push(searchDir);
|
|
248709
248755
|
const result = await execa("rg", args, {
|
|
248710
248756
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248757
|
+
env: buildToolChildEnvironment(ctx),
|
|
248758
|
+
extendEnv: false,
|
|
248711
248759
|
reject: false,
|
|
248712
248760
|
signal: ctx.abortSignal,
|
|
248713
248761
|
maxBuffer: 2 * 1024 * 1024
|
|
@@ -248818,14 +248866,14 @@ var ListFilesInputSchema = z52.object({
|
|
|
248818
248866
|
});
|
|
248819
248867
|
var ListFilesTool = class {
|
|
248820
248868
|
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.";
|
|
248869
|
+
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
248870
|
inputSchema = ListFilesInputSchema;
|
|
248823
248871
|
risk = "read";
|
|
248824
248872
|
async execute(input, ctx) {
|
|
248825
248873
|
try {
|
|
248826
248874
|
const skillUri = input.path ? parseSkillUri(input.path) : void 0;
|
|
248827
248875
|
const skillResource = skillUri ? resolveSkillResource(ctx, skillUri) : void 0;
|
|
248828
|
-
const targetDir = skillResource ? skillResource.path : input.path ?
|
|
248876
|
+
const targetDir = skillResource ? skillResource.path : input.path ? resolveToolPath(ctx, input.path) : ctx.cwd;
|
|
248829
248877
|
const files = await findWorkspaceFiles(targetDir, "**/*", {
|
|
248830
248878
|
deep: input.depth || 3,
|
|
248831
248879
|
dot: true
|
|
@@ -248859,13 +248907,15 @@ var ReadFileInputSchema = z62.object({
|
|
|
248859
248907
|
});
|
|
248860
248908
|
var ReadFileTool = class {
|
|
248861
248909
|
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.";
|
|
248910
|
+
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
248911
|
inputSchema = ReadFileInputSchema;
|
|
248864
248912
|
risk = "read";
|
|
248865
248913
|
async execute(input, ctx) {
|
|
248866
248914
|
try {
|
|
248867
248915
|
const safePath = resolveReadableFile(ctx, input.path);
|
|
248868
|
-
const content = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES
|
|
248916
|
+
const content = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES, {
|
|
248917
|
+
allowSymbolicLink: hasFullHostAccess(ctx)
|
|
248918
|
+
});
|
|
248869
248919
|
if (content === void 0) {
|
|
248870
248920
|
throw new Error(`File not found: ${input.path}`);
|
|
248871
248921
|
}
|
|
@@ -248897,20 +248947,35 @@ var WriteFileInputSchema = z72.object({
|
|
|
248897
248947
|
});
|
|
248898
248948
|
var WriteFileTool = class {
|
|
248899
248949
|
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.";
|
|
248950
|
+
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
248951
|
inputSchema = WriteFileInputSchema;
|
|
248902
248952
|
risk = "write";
|
|
248903
248953
|
async execute(input, ctx) {
|
|
248904
248954
|
try {
|
|
248905
|
-
const safePath =
|
|
248906
|
-
const
|
|
248907
|
-
|
|
248955
|
+
const safePath = resolveToolPath(ctx, input.path);
|
|
248956
|
+
const fullHostAccess = hasFullHostAccess(ctx);
|
|
248957
|
+
let current;
|
|
248958
|
+
let currentContentKnown = true;
|
|
248959
|
+
try {
|
|
248960
|
+
current = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES);
|
|
248961
|
+
} catch (error) {
|
|
248962
|
+
if (!fullHostAccess) throw error;
|
|
248963
|
+
currentContentKnown = false;
|
|
248964
|
+
}
|
|
248965
|
+
const fileExists = currentContentKnown ? current !== void 0 : existsSync32(safePath);
|
|
248966
|
+
if (input.intent === "create" && fileExists) {
|
|
248908
248967
|
return { ok: false, error: `File already exists: ${input.path}` };
|
|
248909
248968
|
}
|
|
248910
|
-
if (input.intent === "overwrite" &&
|
|
248969
|
+
if (input.intent === "overwrite" && !fileExists) {
|
|
248911
248970
|
return { ok: false, error: `File does not exist: ${input.path}` };
|
|
248912
248971
|
}
|
|
248913
248972
|
if (input.expectedHash) {
|
|
248973
|
+
if (!currentContentKnown) {
|
|
248974
|
+
return {
|
|
248975
|
+
ok: false,
|
|
248976
|
+
error: `Cannot verify expectedHash because the existing file could not be read within tool bounds: ${input.path}`
|
|
248977
|
+
};
|
|
248978
|
+
}
|
|
248914
248979
|
if (current === void 0) {
|
|
248915
248980
|
return {
|
|
248916
248981
|
ok: false,
|
|
@@ -248925,11 +248990,14 @@ var WriteFileTool = class {
|
|
|
248925
248990
|
};
|
|
248926
248991
|
}
|
|
248927
248992
|
}
|
|
248928
|
-
|
|
248993
|
+
atomicWriteToolFile(
|
|
248929
248994
|
ctx.cwd,
|
|
248930
248995
|
input.path,
|
|
248931
248996
|
input.content,
|
|
248932
|
-
current ?? null
|
|
248997
|
+
currentContentKnown ? current ?? null : void 0,
|
|
248998
|
+
{
|
|
248999
|
+
allowOutsideWorkspace: fullHostAccess
|
|
249000
|
+
}
|
|
248933
249001
|
);
|
|
248934
249002
|
return {
|
|
248935
249003
|
ok: true,
|
|
@@ -248957,7 +249025,8 @@ var GitCommitTool = class {
|
|
|
248957
249025
|
const { stdout: stdout2 } = await execa("git", ["commit", "-m", commitMessage], {
|
|
248958
249026
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248959
249027
|
cwd: ctx.cwd,
|
|
248960
|
-
env:
|
|
249028
|
+
env: buildToolChildEnvironment(ctx),
|
|
249029
|
+
extendEnv: false,
|
|
248961
249030
|
signal: ctx.abortSignal
|
|
248962
249031
|
});
|
|
248963
249032
|
return {
|
|
@@ -248991,7 +249060,8 @@ var GitDiffTool = class {
|
|
|
248991
249060
|
const { stdout: stdout2 } = await execa("git", args, {
|
|
248992
249061
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248993
249062
|
cwd: ctx.cwd,
|
|
248994
|
-
env:
|
|
249063
|
+
env: buildToolChildEnvironment(ctx),
|
|
249064
|
+
extendEnv: false,
|
|
248995
249065
|
signal: ctx.abortSignal
|
|
248996
249066
|
});
|
|
248997
249067
|
const bounded = redactSecrets(LogTruncator.truncate(stdout2, 300, 4e4));
|
|
@@ -249031,7 +249101,8 @@ var GitRestoreTool = class {
|
|
|
249031
249101
|
{
|
|
249032
249102
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249033
249103
|
cwd: ctx.cwd,
|
|
249034
|
-
env:
|
|
249104
|
+
env: buildToolChildEnvironment(ctx),
|
|
249105
|
+
extendEnv: false,
|
|
249035
249106
|
signal: ctx.abortSignal
|
|
249036
249107
|
}
|
|
249037
249108
|
);
|
|
@@ -249059,7 +249130,8 @@ var GitStatusTool = class {
|
|
|
249059
249130
|
const { stdout: stdout2 } = await execa("git", ["status", "--short"], {
|
|
249060
249131
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249061
249132
|
cwd: ctx.cwd,
|
|
249062
|
-
env:
|
|
249133
|
+
env: buildToolChildEnvironment(ctx),
|
|
249134
|
+
extendEnv: false,
|
|
249063
249135
|
signal: ctx.abortSignal
|
|
249064
249136
|
});
|
|
249065
249137
|
return {
|
|
@@ -249094,11 +249166,11 @@ var DetectProjectTool = class {
|
|
|
249094
249166
|
const entrypoints = [];
|
|
249095
249167
|
const importantFiles = [];
|
|
249096
249168
|
const ignoredFiles = ["node_modules", ".git", "dist", "build"];
|
|
249097
|
-
if (
|
|
249169
|
+
if (existsSync42(join23(root, "package.json"))) {
|
|
249098
249170
|
languages.push("javascript", "typescript");
|
|
249099
|
-
if (
|
|
249100
|
-
else if (
|
|
249101
|
-
else if (
|
|
249171
|
+
if (existsSync42(join23(root, "pnpm-lock.yaml"))) packageManager2 = "pnpm";
|
|
249172
|
+
else if (existsSync42(join23(root, "yarn.lock"))) packageManager2 = "yarn";
|
|
249173
|
+
else if (existsSync42(join23(root, "bun.lockb"))) packageManager2 = "bun";
|
|
249102
249174
|
else packageManager2 = "npm";
|
|
249103
249175
|
try {
|
|
249104
249176
|
const raw = readBoundedRegularFile(
|
|
@@ -249126,35 +249198,35 @@ var DetectProjectTool = class {
|
|
|
249126
249198
|
} catch {
|
|
249127
249199
|
}
|
|
249128
249200
|
}
|
|
249129
|
-
if (
|
|
249201
|
+
if (existsSync42(join23(root, "requirements.txt")) || existsSync42(join23(root, "pyproject.toml")) || existsSync42(join23(root, "poetry.lock"))) {
|
|
249130
249202
|
languages.push("python");
|
|
249131
|
-
if (
|
|
249203
|
+
if (existsSync42(join23(root, "poetry.lock"))) packageManager2 = "poetry";
|
|
249132
249204
|
else packageManager2 = "pip";
|
|
249133
|
-
if (
|
|
249134
|
-
if (
|
|
249205
|
+
if (existsSync42(join23(root, "manage.py"))) frameworks.push("Django");
|
|
249206
|
+
if (existsSync42(join23(root, "main.py"))) entrypoints.push("main.py");
|
|
249135
249207
|
testCommands.push("pytest");
|
|
249136
249208
|
importantFiles.push("pyproject.toml");
|
|
249137
249209
|
}
|
|
249138
|
-
if (
|
|
249210
|
+
if (existsSync42(join23(root, "Cargo.toml"))) {
|
|
249139
249211
|
languages.push("rust");
|
|
249140
249212
|
packageManager2 = "cargo";
|
|
249141
249213
|
testCommands.push("cargo test");
|
|
249142
249214
|
buildCommands.push("cargo build");
|
|
249143
249215
|
importantFiles.push("Cargo.toml");
|
|
249144
|
-
if (
|
|
249216
|
+
if (existsSync42(join23(root, "src/main.rs")))
|
|
249145
249217
|
entrypoints.push("src/main.rs");
|
|
249146
|
-
if (
|
|
249218
|
+
if (existsSync42(join23(root, "src/lib.rs")))
|
|
249147
249219
|
entrypoints.push("src/lib.rs");
|
|
249148
249220
|
}
|
|
249149
|
-
if (
|
|
249221
|
+
if (existsSync42(join23(root, "go.mod"))) {
|
|
249150
249222
|
languages.push("go");
|
|
249151
249223
|
packageManager2 = "go";
|
|
249152
249224
|
testCommands.push("go test ./...");
|
|
249153
249225
|
buildCommands.push("go build ./...");
|
|
249154
249226
|
importantFiles.push("go.mod");
|
|
249155
|
-
if (
|
|
249227
|
+
if (existsSync42(join23(root, "main.go"))) entrypoints.push("main.go");
|
|
249156
249228
|
}
|
|
249157
|
-
if (
|
|
249229
|
+
if (existsSync42(join23(root, "pom.xml"))) {
|
|
249158
249230
|
languages.push("java");
|
|
249159
249231
|
packageManager2 = "maven";
|
|
249160
249232
|
testCommands.push("mvn test");
|
|
@@ -249224,7 +249296,7 @@ var SearchSymbolsTool = class {
|
|
|
249224
249296
|
async execute(input, ctx) {
|
|
249225
249297
|
try {
|
|
249226
249298
|
const indexPath = resolveSafePath(ctx.cwd, ".orbit/symbols.json");
|
|
249227
|
-
if (!
|
|
249299
|
+
if (!existsSync52(indexPath)) {
|
|
249228
249300
|
return {
|
|
249229
249301
|
ok: true,
|
|
249230
249302
|
data: [],
|
|
@@ -249295,7 +249367,7 @@ var FindSymbolReferencesTool = class {
|
|
|
249295
249367
|
async execute(input, ctx) {
|
|
249296
249368
|
try {
|
|
249297
249369
|
const indexPath = resolveSafePath(ctx.cwd, ".orbit/symbols.json");
|
|
249298
|
-
if (!
|
|
249370
|
+
if (!existsSync6(indexPath)) {
|
|
249299
249371
|
return {
|
|
249300
249372
|
ok: true,
|
|
249301
249373
|
data: [],
|
|
@@ -249328,7 +249400,7 @@ var FindSymbolReferencesTool = class {
|
|
|
249328
249400
|
} catch {
|
|
249329
249401
|
continue;
|
|
249330
249402
|
}
|
|
249331
|
-
if (
|
|
249403
|
+
if (existsSync6(absPath)) {
|
|
249332
249404
|
let lines;
|
|
249333
249405
|
try {
|
|
249334
249406
|
const content = await readBoundedRegularFileAsync(
|
|
@@ -249485,7 +249557,7 @@ function readProcessFailureMessage(result) {
|
|
|
249485
249557
|
const message2 = typeof record.shortMessage === "string" ? record.shortMessage : typeof record.message === "string" ? record.message : "The child process failed.";
|
|
249486
249558
|
return safeProcessFailureMessage(message2);
|
|
249487
249559
|
}
|
|
249488
|
-
function firstExistingPath(candidates, pathExists =
|
|
249560
|
+
function firstExistingPath(candidates, pathExists = existsSync7) {
|
|
249489
249561
|
for (const candidate of candidates) {
|
|
249490
249562
|
if (candidate && pathExists(candidate)) return candidate;
|
|
249491
249563
|
}
|
|
@@ -249494,7 +249566,7 @@ function firstExistingPath(candidates, pathExists = existsSync6) {
|
|
|
249494
249566
|
function resolveCommandShellInvocation(command, options = {}) {
|
|
249495
249567
|
const platform = options.platform ?? process.platform;
|
|
249496
249568
|
const environment = options.environment ?? process.env;
|
|
249497
|
-
const pathExists = options.pathExists ??
|
|
249569
|
+
const pathExists = options.pathExists ?? existsSync7;
|
|
249498
249570
|
if (platform !== "win32") {
|
|
249499
249571
|
const bash2 = firstExistingPath(
|
|
249500
249572
|
[environment.ORBIT_BASH_PATH, "/bin/bash", "/usr/bin/bash"],
|
|
@@ -249559,6 +249631,7 @@ var BashTool = class {
|
|
|
249559
249631
|
command: input.command,
|
|
249560
249632
|
cwd: ctx.cwd,
|
|
249561
249633
|
sessionId: ctx.sessionId,
|
|
249634
|
+
environment: buildToolChildEnvironment(ctx),
|
|
249562
249635
|
...input.timeoutMs !== void 0 ? { timeoutMs: timeout } : {}
|
|
249563
249636
|
});
|
|
249564
249637
|
return {
|
|
@@ -249588,7 +249661,8 @@ var BashTool = class {
|
|
|
249588
249661
|
const result = await execa(invocation.file, invocation.args, {
|
|
249589
249662
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249590
249663
|
cwd: ctx.cwd,
|
|
249591
|
-
env:
|
|
249664
|
+
env: buildToolChildEnvironment(ctx),
|
|
249665
|
+
extendEnv: false,
|
|
249592
249666
|
timeout,
|
|
249593
249667
|
reject: false,
|
|
249594
249668
|
signal: ctx.abortSignal,
|
|
@@ -249718,7 +249792,8 @@ var RunTestsTool = class {
|
|
|
249718
249792
|
const result = await execa(invocation.file, invocation.args, {
|
|
249719
249793
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
249720
249794
|
cwd: ctx.cwd,
|
|
249721
|
-
env:
|
|
249795
|
+
env: buildToolChildEnvironment(ctx),
|
|
249796
|
+
extendEnv: false,
|
|
249722
249797
|
reject: false,
|
|
249723
249798
|
signal: ctx.abortSignal,
|
|
249724
249799
|
timeout,
|
|
@@ -249778,19 +249853,19 @@ Exit code: ${exitCode}`,
|
|
|
249778
249853
|
}
|
|
249779
249854
|
}
|
|
249780
249855
|
inferTestCommand(cwd) {
|
|
249781
|
-
if (
|
|
249856
|
+
if (existsSync8(join42(cwd, "Cargo.toml"))) {
|
|
249782
249857
|
return "cargo test";
|
|
249783
249858
|
}
|
|
249784
|
-
if (
|
|
249859
|
+
if (existsSync8(join42(cwd, "go.mod"))) {
|
|
249785
249860
|
return "go test ./...";
|
|
249786
249861
|
}
|
|
249787
|
-
if (
|
|
249862
|
+
if (existsSync8(join42(cwd, "pom.xml"))) {
|
|
249788
249863
|
return "mvn test";
|
|
249789
249864
|
}
|
|
249790
|
-
if (
|
|
249865
|
+
if (existsSync8(join42(cwd, "build.gradle"))) {
|
|
249791
249866
|
return "./gradlew test";
|
|
249792
249867
|
}
|
|
249793
|
-
if (
|
|
249868
|
+
if (existsSync8(join42(cwd, "package.json"))) {
|
|
249794
249869
|
try {
|
|
249795
249870
|
const raw = readBoundedRegularFile(
|
|
249796
249871
|
join42(cwd, "package.json"),
|
|
@@ -249799,15 +249874,15 @@ Exit code: ${exitCode}`,
|
|
|
249799
249874
|
if (raw === void 0) return "npm test";
|
|
249800
249875
|
const pkg = JSON.parse(raw);
|
|
249801
249876
|
if (pkg.scripts?.test) {
|
|
249802
|
-
if (
|
|
249803
|
-
if (
|
|
249877
|
+
if (existsSync8(join42(cwd, "pnpm-lock.yaml"))) return "pnpm test";
|
|
249878
|
+
if (existsSync8(join42(cwd, "yarn.lock"))) return "yarn test";
|
|
249804
249879
|
return "npm test";
|
|
249805
249880
|
}
|
|
249806
249881
|
} catch {
|
|
249807
249882
|
}
|
|
249808
249883
|
return "npm test";
|
|
249809
249884
|
}
|
|
249810
|
-
if (
|
|
249885
|
+
if (existsSync8(join42(cwd, "pytest.ini")) || existsSync8(join42(cwd, "pyproject.toml"))) {
|
|
249811
249886
|
return "pytest";
|
|
249812
249887
|
}
|
|
249813
249888
|
return "npm test";
|
|
@@ -249829,10 +249904,10 @@ var PUBLIC_DNS_ENDPOINTS = [
|
|
|
249829
249904
|
];
|
|
249830
249905
|
async function resolveSystemAddresses(hostname, signal, lookupImplementation = lookup) {
|
|
249831
249906
|
if (signal?.aborted) throw abortError("System DNS lookup was cancelled.");
|
|
249832
|
-
return new Promise((
|
|
249907
|
+
return new Promise((resolve34, reject) => {
|
|
249833
249908
|
const onAbort = () => reject(abortError("System DNS lookup was cancelled."));
|
|
249834
249909
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
249835
|
-
lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) =>
|
|
249910
|
+
lookupImplementation(hostname, { all: true, verbatim: true }).then((entries) => resolve34(entries.map((entry) => entry.address))).catch(reject).finally(() => signal?.removeEventListener("abort", onAbort));
|
|
249836
249911
|
});
|
|
249837
249912
|
}
|
|
249838
249913
|
function createPublicDnsResolver(fetchImplementation = globalThis.fetch) {
|
|
@@ -249857,7 +249932,7 @@ function createPublicDnsResolver(fetchImplementation = globalThis.fetch) {
|
|
|
249857
249932
|
throw new Error(`Public DNS verification failed (${failures.join("; ")}).`);
|
|
249858
249933
|
};
|
|
249859
249934
|
}
|
|
249860
|
-
async function
|
|
249935
|
+
async function resolveHttpTarget(rawUrl, resolveAddresses = resolveSystemAddresses, resolvePublicAddresses = createPublicDnsResolver(), signal, options = {}) {
|
|
249861
249936
|
const url = new URL(rawUrl);
|
|
249862
249937
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
249863
249938
|
throw new Error("Only http:// and https:// URLs are supported.");
|
|
@@ -249866,10 +249941,10 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249866
249941
|
throw new Error("URLs containing credentials are not allowed.");
|
|
249867
249942
|
}
|
|
249868
249943
|
const hostname = url.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
249869
|
-
if (hostname === "localhost" || hostname.endsWith(".localhost") || hostname.endsWith(".local") || hostname.endsWith(".internal") || hostname.endsWith(".home.arpa")) {
|
|
249944
|
+
if (!options.allowPrivateNetwork && (hostname === "localhost" || hostname.endsWith(".localhost") || hostname.endsWith(".local") || hostname.endsWith(".internal") || hostname.endsWith(".home.arpa"))) {
|
|
249870
249945
|
throw new Error("Local and private network URLs are blocked.");
|
|
249871
249946
|
}
|
|
249872
|
-
if (isIP(hostname) > 0 && isPrivateOrReservedAddress(hostname)) {
|
|
249947
|
+
if (!options.allowPrivateNetwork && isIP(hostname) > 0 && isPrivateOrReservedAddress(hostname)) {
|
|
249873
249948
|
throw new Error(
|
|
249874
249949
|
"Local, private, or reserved network addresses are blocked."
|
|
249875
249950
|
);
|
|
@@ -249882,7 +249957,7 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249882
249957
|
throw new Error("The URL hostname did not resolve to an address.");
|
|
249883
249958
|
}
|
|
249884
249959
|
const syntheticAddresses = addresses.filter(isSyntheticProxyAddress);
|
|
249885
|
-
if (syntheticAddresses.length > 0) {
|
|
249960
|
+
if (!options.allowPrivateNetwork && syntheticAddresses.length > 0) {
|
|
249886
249961
|
if (syntheticAddresses.length !== addresses.length) {
|
|
249887
249962
|
throw new Error(
|
|
249888
249963
|
"The URL hostname resolved to a mixture of public and reserved addresses."
|
|
@@ -249897,7 +249972,7 @@ async function resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemA
|
|
|
249897
249972
|
"The proxy-mapped hostname could not be verified as a public destination."
|
|
249898
249973
|
);
|
|
249899
249974
|
}
|
|
249900
|
-
} else if (addresses.some(isPrivateOrReservedAddress)) {
|
|
249975
|
+
} else if (!options.allowPrivateNetwork && addresses.some(isPrivateOrReservedAddress)) {
|
|
249901
249976
|
throw new Error(
|
|
249902
249977
|
"Local, private, or reserved network addresses are blocked."
|
|
249903
249978
|
);
|
|
@@ -250026,7 +250101,7 @@ var WEB_FETCH_MAX_BYTES = 1024 * 1024;
|
|
|
250026
250101
|
var WEB_FETCH_MAX_REDIRECTS = 5;
|
|
250027
250102
|
var WebFetchInputSchema = z20.object({
|
|
250028
250103
|
url: z20.string().url().max(8192).describe(
|
|
250029
|
-
"
|
|
250104
|
+
"HTTP(S) URL to read. Local and private targets require unrestricted Full Access."
|
|
250030
250105
|
),
|
|
250031
250106
|
maxChars: z20.number().int().min(1e3).max(5e4).describe("Maximum readable characters to return.").optional()
|
|
250032
250107
|
});
|
|
@@ -250044,7 +250119,7 @@ var WebFetchTool = class {
|
|
|
250044
250119
|
resolvePublicAddresses;
|
|
250045
250120
|
createDispatcher;
|
|
250046
250121
|
name = "web_fetch";
|
|
250047
|
-
description = "Read
|
|
250122
|
+
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
250123
|
inputSchema = WebFetchInputSchema;
|
|
250049
250124
|
risk = "network";
|
|
250050
250125
|
async execute(input, context) {
|
|
@@ -250060,11 +250135,15 @@ var WebFetchTool = class {
|
|
|
250060
250135
|
);
|
|
250061
250136
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
250062
250137
|
try {
|
|
250063
|
-
|
|
250138
|
+
const allowPrivateNetwork = Boolean(
|
|
250139
|
+
context.config && isFullAccessEnabled(context.config)
|
|
250140
|
+
);
|
|
250141
|
+
let currentTarget = await resolveHttpTarget(
|
|
250064
250142
|
input.url,
|
|
250065
250143
|
this.resolveAddresses,
|
|
250066
250144
|
this.resolvePublicAddresses,
|
|
250067
|
-
controller.signal
|
|
250145
|
+
controller.signal,
|
|
250146
|
+
{ allowPrivateNetwork }
|
|
250068
250147
|
);
|
|
250069
250148
|
for (let redirect = 0; redirect <= WEB_FETCH_MAX_REDIRECTS; redirect += 1) {
|
|
250070
250149
|
const lease = this.createDispatcher(
|
|
@@ -250101,11 +250180,12 @@ var WebFetchTool = class {
|
|
|
250101
250180
|
error: "Web fetch exceeded the redirect limit."
|
|
250102
250181
|
};
|
|
250103
250182
|
}
|
|
250104
|
-
currentTarget = await
|
|
250183
|
+
currentTarget = await resolveHttpTarget(
|
|
250105
250184
|
new URL(location, currentTarget.url).toString(),
|
|
250106
250185
|
this.resolveAddresses,
|
|
250107
250186
|
this.resolvePublicAddresses,
|
|
250108
|
-
controller.signal
|
|
250187
|
+
controller.signal,
|
|
250188
|
+
{ allowPrivateNetwork }
|
|
250109
250189
|
);
|
|
250110
250190
|
continue;
|
|
250111
250191
|
}
|
|
@@ -251306,7 +251386,7 @@ var BackgroundTaskRuntime = class {
|
|
|
251306
251386
|
child = spawn(invocation.file, invocation.args, {
|
|
251307
251387
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
251308
251388
|
cwd: safeCwd,
|
|
251309
|
-
env: buildSanitizedChildEnvironment(),
|
|
251389
|
+
env: request.environment ? { ...request.environment } : buildSanitizedChildEnvironment(),
|
|
251310
251390
|
detached: process.platform !== "win32",
|
|
251311
251391
|
stdio: ["ignore", "pipe", "pipe"]
|
|
251312
251392
|
});
|
|
@@ -251316,8 +251396,8 @@ var BackgroundTaskRuntime = class {
|
|
|
251316
251396
|
);
|
|
251317
251397
|
}
|
|
251318
251398
|
let resolveCompletion = () => void 0;
|
|
251319
|
-
const completion = new Promise((
|
|
251320
|
-
resolveCompletion =
|
|
251399
|
+
const completion = new Promise((resolve34) => {
|
|
251400
|
+
resolveCompletion = resolve34;
|
|
251321
251401
|
});
|
|
251322
251402
|
const task = {
|
|
251323
251403
|
id,
|
|
@@ -251562,12 +251642,12 @@ async function signalProcessTree(child, force) {
|
|
|
251562
251642
|
const pid = child.pid;
|
|
251563
251643
|
if (!pid) return false;
|
|
251564
251644
|
if (process.platform === "win32") {
|
|
251565
|
-
return new Promise((
|
|
251645
|
+
return new Promise((resolve34) => {
|
|
251566
251646
|
execFile(
|
|
251567
251647
|
"taskkill.exe",
|
|
251568
251648
|
["/pid", String(pid), "/t", ...force ? ["/f"] : []],
|
|
251569
251649
|
HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
251570
|
-
(error) =>
|
|
251650
|
+
(error) => resolve34(error === null)
|
|
251571
251651
|
);
|
|
251572
251652
|
});
|
|
251573
251653
|
}
|
|
@@ -251588,17 +251668,17 @@ async function waitWithTimeout(promise, timeoutMs, abortSignal) {
|
|
|
251588
251668
|
try {
|
|
251589
251669
|
return await Promise.race([
|
|
251590
251670
|
promise.then(() => true),
|
|
251591
|
-
new Promise((
|
|
251592
|
-
timeout = setTimeout(() =>
|
|
251671
|
+
new Promise((resolve34) => {
|
|
251672
|
+
timeout = setTimeout(() => resolve34(false), timeoutMs);
|
|
251593
251673
|
timeout.unref?.();
|
|
251594
251674
|
}),
|
|
251595
|
-
new Promise((
|
|
251675
|
+
new Promise((resolve34) => {
|
|
251596
251676
|
if (!abortSignal) return;
|
|
251597
251677
|
if (abortSignal.aborted) {
|
|
251598
|
-
|
|
251678
|
+
resolve34(false);
|
|
251599
251679
|
return;
|
|
251600
251680
|
}
|
|
251601
|
-
abortListener = () =>
|
|
251681
|
+
abortListener = () => resolve34(false);
|
|
251602
251682
|
abortSignal.addEventListener("abort", abortListener, { once: true });
|
|
251603
251683
|
})
|
|
251604
251684
|
]);
|
|
@@ -251625,31 +251705,31 @@ function errorMessage(error) {
|
|
|
251625
251705
|
|
|
251626
251706
|
// ../context-engine/dist/index.js
|
|
251627
251707
|
import { join as join6 } from "path";
|
|
251628
|
-
import { existsSync as
|
|
251708
|
+
import { existsSync as existsSync9 } from "fs";
|
|
251629
251709
|
import { pathToFileURL } from "url";
|
|
251630
251710
|
import { z as z25 } from "zod";
|
|
251631
251711
|
import { basename, join as join7 } from "path";
|
|
251632
251712
|
import { existsSync as existsSync43, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, renameSync as renameSync3, rmSync as rmSync2 } from "fs";
|
|
251633
251713
|
import { promises as fsPromises3 } from "fs";
|
|
251634
|
-
import { join as join24, dirname as dirname32, isAbsolute as
|
|
251714
|
+
import { join as join24, dirname as dirname32, isAbsolute as isAbsolute4, resolve as resolve32 } from "path";
|
|
251635
251715
|
import { createHash as createHash4, randomUUID as randomUUID32 } from "crypto";
|
|
251636
251716
|
import { execFile as execFile2 } from "child_process";
|
|
251637
251717
|
import glob3 from "fast-glob";
|
|
251638
251718
|
import { z as z43 } from "zod";
|
|
251639
251719
|
import { extname as extname2 } from "path";
|
|
251640
251720
|
import { existsSync as existsSync24, promises as fsPromises2 } from "fs";
|
|
251641
|
-
import { dirname as dirname5, resolve as
|
|
251721
|
+
import { dirname as dirname5, resolve as resolve5 } from "path";
|
|
251642
251722
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
251643
251723
|
import { z as z26 } from "zod";
|
|
251644
251724
|
import { existsSync as existsSync33, promises as fsPromises22 } from "fs";
|
|
251645
|
-
import { dirname as dirname22, resolve as
|
|
251725
|
+
import { dirname as dirname22, resolve as resolve24 } from "path";
|
|
251646
251726
|
import { randomUUID as randomUUID23 } from "crypto";
|
|
251647
251727
|
import { z as z35 } from "zod";
|
|
251648
251728
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
251649
251729
|
import { extname as extname22 } from "path";
|
|
251650
251730
|
import { resolve as resolve42 } from "path";
|
|
251651
251731
|
import { dirname as dirname52 } from "path";
|
|
251652
|
-
import { isAbsolute as
|
|
251732
|
+
import { isAbsolute as isAbsolute23, join as join33, resolve as resolve52 } from "path";
|
|
251653
251733
|
import { homedir as homedir4 } from "os";
|
|
251654
251734
|
import { existsSync as existsSync53, promises as fs2 } from "fs";
|
|
251655
251735
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -251735,7 +251815,7 @@ var ReferencesRetriever = class {
|
|
|
251735
251815
|
*/
|
|
251736
251816
|
async getReferencesContext(symbols, maxReferencesPerSymbol = 3, maxTotalReferences = 10) {
|
|
251737
251817
|
const indexPath = getOrbitCachePath(this.cwd, "symbols.json");
|
|
251738
|
-
if (!
|
|
251818
|
+
if (!existsSync9(indexPath)) {
|
|
251739
251819
|
return "";
|
|
251740
251820
|
}
|
|
251741
251821
|
let index;
|
|
@@ -251981,7 +252061,7 @@ var JSVectorStore = class {
|
|
|
251981
252061
|
constructor(cwd, modelName) {
|
|
251982
252062
|
this.cwd = cwd;
|
|
251983
252063
|
this.modelName = modelName;
|
|
251984
|
-
this.dbPath =
|
|
252064
|
+
this.dbPath = resolve5(cwd, ".orbit", "vector_store.json");
|
|
251985
252065
|
}
|
|
251986
252066
|
cwd;
|
|
251987
252067
|
modelName;
|
|
@@ -252273,7 +252353,7 @@ function createRecord() {
|
|
|
252273
252353
|
var BM25Store = class {
|
|
252274
252354
|
constructor(cwd) {
|
|
252275
252355
|
this.cwd = cwd;
|
|
252276
|
-
this.dbPath =
|
|
252356
|
+
this.dbPath = resolve24(cwd, ".orbit", "bm25_store.json");
|
|
252277
252357
|
}
|
|
252278
252358
|
cwd;
|
|
252279
252359
|
docs = createRecord();
|
|
@@ -253646,7 +253726,7 @@ var SymbolIndexer = class {
|
|
|
253646
253726
|
if (!parsed.success) return null;
|
|
253647
253727
|
const files = {};
|
|
253648
253728
|
for (const [filePath, fileIndex] of Object.entries(parsed.data.files)) {
|
|
253649
|
-
if (
|
|
253729
|
+
if (isAbsolute4(filePath)) continue;
|
|
253650
253730
|
try {
|
|
253651
253731
|
resolveSafePath(this.cwd, filePath);
|
|
253652
253732
|
files[filePath] = fileIndex;
|
|
@@ -253906,9 +253986,9 @@ function resolveSkillDirectory(cwd, directory) {
|
|
|
253906
253986
|
}
|
|
253907
253987
|
if (directory === "~") return homedir4();
|
|
253908
253988
|
if (directory.startsWith("~/") || directory.startsWith("~\\")) {
|
|
253909
|
-
return
|
|
253989
|
+
return resolve52(homedir4(), directory.slice(2));
|
|
253910
253990
|
}
|
|
253911
|
-
return
|
|
253991
|
+
return isAbsolute23(directory) ? resolve52(directory) : resolve52(cwd, directory);
|
|
253912
253992
|
}
|
|
253913
253993
|
function resolveBundledSkillsDirectory() {
|
|
253914
253994
|
const candidates = [
|
|
@@ -255591,7 +255671,7 @@ var MCPClient = class {
|
|
|
255591
255671
|
modernVersion,
|
|
255592
255672
|
this.effectiveClientVersion
|
|
255593
255673
|
) : params;
|
|
255594
|
-
const request = new Promise((
|
|
255674
|
+
const request = new Promise((resolve26, reject) => {
|
|
255595
255675
|
if (abortSignal?.aborted) {
|
|
255596
255676
|
reject(createAbortError(`MCP request "${method}" was cancelled.`));
|
|
255597
255677
|
return;
|
|
@@ -255638,7 +255718,7 @@ var MCPClient = class {
|
|
|
255638
255718
|
const removeAbortListener = abortSignal ? () => abortSignal.removeEventListener("abort", onAbort) : void 0;
|
|
255639
255719
|
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
255640
255720
|
this.pendingRequests.set(id, {
|
|
255641
|
-
resolve:
|
|
255721
|
+
resolve: resolve26,
|
|
255642
255722
|
reject,
|
|
255643
255723
|
timeout,
|
|
255644
255724
|
removeAbortListener
|
|
@@ -255728,14 +255808,14 @@ function waitForChildExit(child, timeoutMs) {
|
|
|
255728
255808
|
if (child.exitCode !== null || child.signalCode !== null) {
|
|
255729
255809
|
return Promise.resolve(true);
|
|
255730
255810
|
}
|
|
255731
|
-
return new Promise((
|
|
255811
|
+
return new Promise((resolve26) => {
|
|
255732
255812
|
let settled = false;
|
|
255733
255813
|
const finish = (exited) => {
|
|
255734
255814
|
if (settled) return;
|
|
255735
255815
|
settled = true;
|
|
255736
255816
|
clearTimeout(timeout);
|
|
255737
255817
|
child.removeListener("exit", onExit2);
|
|
255738
|
-
|
|
255818
|
+
resolve26(exited);
|
|
255739
255819
|
};
|
|
255740
255820
|
const onExit2 = () => finish(true);
|
|
255741
255821
|
const timeout = setTimeout(() => finish(false), timeoutMs);
|
|
@@ -256585,12 +256665,12 @@ function assertSecureMcpUrl(value, label) {
|
|
|
256585
256665
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
256586
256666
|
async function closeLoopbackServer(server2) {
|
|
256587
256667
|
if (!server2.listening) return;
|
|
256588
|
-
await new Promise((
|
|
256668
|
+
await new Promise((resolve26) => {
|
|
256589
256669
|
const forceClose = setTimeout(() => server2.closeAllConnections(), 250);
|
|
256590
256670
|
forceClose.unref();
|
|
256591
256671
|
server2.close(() => {
|
|
256592
256672
|
clearTimeout(forceClose);
|
|
256593
|
-
|
|
256673
|
+
resolve26();
|
|
256594
256674
|
});
|
|
256595
256675
|
server2.closeIdleConnections();
|
|
256596
256676
|
});
|
|
@@ -256613,10 +256693,10 @@ async function runMcpPkceLogin(options) {
|
|
|
256613
256693
|
const state = randomBytes(16).toString("base64url");
|
|
256614
256694
|
const server2 = http.createServer();
|
|
256615
256695
|
try {
|
|
256616
|
-
const port = await new Promise((
|
|
256696
|
+
const port = await new Promise((resolve26, reject) => {
|
|
256617
256697
|
server2.once("error", reject);
|
|
256618
256698
|
server2.listen(options.redirectPort ?? 0, "127.0.0.1", () => {
|
|
256619
|
-
|
|
256699
|
+
resolve26(server2.address().port);
|
|
256620
256700
|
});
|
|
256621
256701
|
});
|
|
256622
256702
|
const redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
@@ -256631,7 +256711,7 @@ async function runMcpPkceLogin(options) {
|
|
|
256631
256711
|
if (oauth.audience) {
|
|
256632
256712
|
authorizationUrl.searchParams.set("audience", oauth.audience);
|
|
256633
256713
|
}
|
|
256634
|
-
const code = await new Promise((
|
|
256714
|
+
const code = await new Promise((resolve26, reject) => {
|
|
256635
256715
|
let settled = false;
|
|
256636
256716
|
const cleanup = () => {
|
|
256637
256717
|
if (settled) return false;
|
|
@@ -256641,7 +256721,7 @@ async function runMcpPkceLogin(options) {
|
|
|
256641
256721
|
return true;
|
|
256642
256722
|
};
|
|
256643
256723
|
const succeed = (value) => {
|
|
256644
|
-
if (cleanup())
|
|
256724
|
+
if (cleanup()) resolve26(value);
|
|
256645
256725
|
};
|
|
256646
256726
|
const fail = (error) => {
|
|
256647
256727
|
if (cleanup()) reject(error);
|
|
@@ -257095,6 +257175,13 @@ var PermissionEngine = class {
|
|
|
257095
257175
|
} else if (toolName === "git_restore") {
|
|
257096
257176
|
risk = "dangerous";
|
|
257097
257177
|
}
|
|
257178
|
+
if (isFullAccessEnabled(this.config)) {
|
|
257179
|
+
return {
|
|
257180
|
+
action: "allow",
|
|
257181
|
+
reason: "Allowed by Full Access.",
|
|
257182
|
+
risk
|
|
257183
|
+
};
|
|
257184
|
+
}
|
|
257098
257185
|
if (this.config.permissions.protectSecrets && targetPath && RiskClassifier.isProtectedPath(targetPath, protectedPaths)) {
|
|
257099
257186
|
if (mode === "strict") {
|
|
257100
257187
|
return {
|
|
@@ -257139,7 +257226,7 @@ var PermissionEngine = class {
|
|
|
257139
257226
|
if (mode === "auto") {
|
|
257140
257227
|
return {
|
|
257141
257228
|
action: "ask",
|
|
257142
|
-
reason: `Full Access
|
|
257229
|
+
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
257230
|
risk
|
|
257144
257231
|
};
|
|
257145
257232
|
}
|
|
@@ -257329,7 +257416,7 @@ function firstString(...values) {
|
|
|
257329
257416
|
|
|
257330
257417
|
// ../sandbox/dist/index.js
|
|
257331
257418
|
import {
|
|
257332
|
-
existsSync as
|
|
257419
|
+
existsSync as existsSync10,
|
|
257333
257420
|
lstatSync as lstatSync4,
|
|
257334
257421
|
mkdirSync as mkdirSync4,
|
|
257335
257422
|
readdirSync as readdirSync2,
|
|
@@ -257445,7 +257532,7 @@ var CheckpointManager = class {
|
|
|
257445
257532
|
}
|
|
257446
257533
|
loadPersistedCheckpoints() {
|
|
257447
257534
|
const sessionDir = this.getSessionCheckpointDir();
|
|
257448
|
-
if (!
|
|
257535
|
+
if (!existsSync10(sessionDir)) return;
|
|
257449
257536
|
const loaded = [];
|
|
257450
257537
|
for (const entry of readdirSync2(sessionDir, { withFileTypes: true })) {
|
|
257451
257538
|
if (!entry.isDirectory() || !CheckpointIdSchema.safeParse(entry.name).success) {
|
|
@@ -257453,7 +257540,7 @@ var CheckpointManager = class {
|
|
|
257453
257540
|
}
|
|
257454
257541
|
const checkpointDir = resolveSafePath(sessionDir, entry.name);
|
|
257455
257542
|
const metaPath = resolveSafePath(checkpointDir, "meta.json");
|
|
257456
|
-
if (!
|
|
257543
|
+
if (!existsSync10(metaPath)) continue;
|
|
257457
257544
|
try {
|
|
257458
257545
|
const parsed = PersistedCheckpointMetadataSchema.safeParse(
|
|
257459
257546
|
JSON.parse(
|
|
@@ -257492,7 +257579,7 @@ var CheckpointManager = class {
|
|
|
257492
257579
|
*/
|
|
257493
257580
|
readPersistedBackup(checkpointDir) {
|
|
257494
257581
|
const encryptedPath = resolveSafePath(checkpointDir, "backup_content.enc");
|
|
257495
|
-
if (
|
|
257582
|
+
if (existsSync10(encryptedPath)) {
|
|
257496
257583
|
const key = this.resolveEncryptionKey();
|
|
257497
257584
|
if (!key) return null;
|
|
257498
257585
|
try {
|
|
@@ -257506,7 +257593,7 @@ var CheckpointManager = class {
|
|
|
257506
257593
|
}
|
|
257507
257594
|
}
|
|
257508
257595
|
const plaintextPath = resolveSafePath(checkpointDir, "backup_content.txt");
|
|
257509
|
-
if (!
|
|
257596
|
+
if (!existsSync10(plaintextPath)) return null;
|
|
257510
257597
|
return readBoundedRegularFile(plaintextPath, CHECKPOINT_CONTENT_MAX_BYTES) ?? null;
|
|
257511
257598
|
}
|
|
257512
257599
|
async captureBeforeState(toolCallId, filePath) {
|
|
@@ -257514,7 +257601,7 @@ var CheckpointManager = class {
|
|
|
257514
257601
|
const validFilePath = z29.string().min(1).max(4096).parse(filePath);
|
|
257515
257602
|
const safePath = resolveSafePath(this.cwd, validFilePath);
|
|
257516
257603
|
let originalContent = null;
|
|
257517
|
-
if (
|
|
257604
|
+
if (existsSync10(safePath)) {
|
|
257518
257605
|
const stats = lstatSync4(safePath);
|
|
257519
257606
|
if (!stats.isFile() && !stats.isSymbolicLink()) {
|
|
257520
257607
|
throw new Error(`Checkpoint target must be a file: ${validFilePath}`);
|
|
@@ -257591,7 +257678,7 @@ var CheckpointManager = class {
|
|
|
257591
257678
|
this.getSessionCheckpointDir(),
|
|
257592
257679
|
checkpointId
|
|
257593
257680
|
);
|
|
257594
|
-
if (
|
|
257681
|
+
if (existsSync10(checkpointDir)) {
|
|
257595
257682
|
rmSync3(checkpointDir, { recursive: true, force: true });
|
|
257596
257683
|
}
|
|
257597
257684
|
}
|
|
@@ -258035,10 +258122,10 @@ function toErrorMessage2(error) {
|
|
|
258035
258122
|
// ../session/dist/index.js
|
|
258036
258123
|
import { z as z30 } from "zod";
|
|
258037
258124
|
import { createHash as createHash6, randomUUID as randomUUID6 } from "crypto";
|
|
258038
|
-
import { dirname as dirname8, isAbsolute as
|
|
258125
|
+
import { dirname as dirname8, isAbsolute as isAbsolute5, join as join9, relative as relative5, resolve as resolve7, sep } from "path";
|
|
258039
258126
|
import {
|
|
258040
258127
|
closeSync as closeSync5,
|
|
258041
|
-
existsSync as
|
|
258128
|
+
existsSync as existsSync11,
|
|
258042
258129
|
fsyncSync as fsyncSync4,
|
|
258043
258130
|
lstatSync as lstatSync5,
|
|
258044
258131
|
mkdirSync as mkdirSync5,
|
|
@@ -258060,7 +258147,7 @@ import {
|
|
|
258060
258147
|
unlinkSync as unlinkSync4
|
|
258061
258148
|
} from "fs";
|
|
258062
258149
|
import { homedir as homedir5 } from "os";
|
|
258063
|
-
import { basename as basename2, dirname as dirname23, isAbsolute as
|
|
258150
|
+
import { basename as basename2, dirname as dirname23, isAbsolute as isAbsolute24, join as join25, parse as parse2, resolve as resolve25 } from "path";
|
|
258064
258151
|
import { z as z37 } from "zod";
|
|
258065
258152
|
import {
|
|
258066
258153
|
closeSync as closeSync32,
|
|
@@ -258490,7 +258577,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258490
258577
|
const backupPath = `${destinationPath}.${process.pid}.${randomUUID6()}.bak`;
|
|
258491
258578
|
let previousMoved = false;
|
|
258492
258579
|
try {
|
|
258493
|
-
if (
|
|
258580
|
+
if (existsSync11(destinationPath)) {
|
|
258494
258581
|
renameSync5(destinationPath, backupPath);
|
|
258495
258582
|
previousMoved = true;
|
|
258496
258583
|
}
|
|
@@ -258502,7 +258589,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258502
258589
|
}
|
|
258503
258590
|
}
|
|
258504
258591
|
} catch (error) {
|
|
258505
|
-
if (previousMoved &&
|
|
258592
|
+
if (previousMoved && existsSync11(backupPath) && !existsSync11(destinationPath)) {
|
|
258506
258593
|
try {
|
|
258507
258594
|
renameSync5(backupPath, destinationPath);
|
|
258508
258595
|
} catch {
|
|
@@ -258510,7 +258597,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
258510
258597
|
}
|
|
258511
258598
|
throw error;
|
|
258512
258599
|
} finally {
|
|
258513
|
-
if (
|
|
258600
|
+
if (existsSync11(destinationPath)) {
|
|
258514
258601
|
try {
|
|
258515
258602
|
rmSync4(backupPath, { force: true });
|
|
258516
258603
|
} catch {
|
|
@@ -258561,7 +258648,7 @@ function sanitizeTraceJsonText(text2, cwd) {
|
|
|
258561
258648
|
function normalizeTracePath(filePath, cwd) {
|
|
258562
258649
|
const absolute = resolve7(cwd, filePath);
|
|
258563
258650
|
const relativePath = relative5(cwd, absolute);
|
|
258564
|
-
if (relativePath && !relativePath.startsWith("..") && !
|
|
258651
|
+
if (relativePath && !relativePath.startsWith("..") && !isAbsolute5(relativePath)) {
|
|
258565
258652
|
return relativePath.split(sep).join("/");
|
|
258566
258653
|
}
|
|
258567
258654
|
return replaceWorkspacePath(filePath, cwd);
|
|
@@ -258615,9 +258702,9 @@ var SessionStore = class {
|
|
|
258615
258702
|
} catch {
|
|
258616
258703
|
return void 0;
|
|
258617
258704
|
}
|
|
258618
|
-
if (!
|
|
258705
|
+
if (!existsSync11(sessionFile)) return void 0;
|
|
258619
258706
|
for (const candidate of [sessionFile, `${sessionFile}.bak`]) {
|
|
258620
|
-
if (!
|
|
258707
|
+
if (!existsSync11(candidate)) continue;
|
|
258621
258708
|
const parsed = readValidatedSnapshot(candidate, SessionSchema);
|
|
258622
258709
|
if (parsed?.id === id) return parsed;
|
|
258623
258710
|
}
|
|
@@ -258640,7 +258727,7 @@ var SessionStore = class {
|
|
|
258640
258727
|
let dirs;
|
|
258641
258728
|
try {
|
|
258642
258729
|
sessionRoot = this.resolveSessionRoot();
|
|
258643
|
-
if (!
|
|
258730
|
+
if (!existsSync11(sessionRoot)) return [];
|
|
258644
258731
|
dirs = readdirSync3(sessionRoot);
|
|
258645
258732
|
} catch {
|
|
258646
258733
|
return [];
|
|
@@ -258673,7 +258760,7 @@ var SessionStore = class {
|
|
|
258673
258760
|
} catch {
|
|
258674
258761
|
return [];
|
|
258675
258762
|
}
|
|
258676
|
-
if (!
|
|
258763
|
+
if (!existsSync11(file)) return [];
|
|
258677
258764
|
let content;
|
|
258678
258765
|
try {
|
|
258679
258766
|
content = readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "";
|
|
@@ -258757,7 +258844,7 @@ var SessionStore = class {
|
|
|
258757
258844
|
return void 0;
|
|
258758
258845
|
}
|
|
258759
258846
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258760
|
-
if (!
|
|
258847
|
+
if (!existsSync11(candidate)) continue;
|
|
258761
258848
|
const parsed = readValidatedSnapshot(candidate, RunJournalSchema);
|
|
258762
258849
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258763
258850
|
}
|
|
@@ -258841,7 +258928,7 @@ var SessionStore = class {
|
|
|
258841
258928
|
return void 0;
|
|
258842
258929
|
}
|
|
258843
258930
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258844
|
-
if (!
|
|
258931
|
+
if (!existsSync11(candidate)) continue;
|
|
258845
258932
|
const parsed = readValidatedSnapshot(candidate, TaskPlanSchema);
|
|
258846
258933
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258847
258934
|
}
|
|
@@ -258868,7 +258955,7 @@ var SessionStore = class {
|
|
|
258868
258955
|
return void 0;
|
|
258869
258956
|
}
|
|
258870
258957
|
for (const candidate of [file, `${file}.bak`]) {
|
|
258871
|
-
if (!
|
|
258958
|
+
if (!existsSync11(candidate)) continue;
|
|
258872
258959
|
const parsed = readValidatedSnapshot(candidate, AgentInputQueueSchema);
|
|
258873
258960
|
if (parsed?.sessionId === sessionId) return parsed;
|
|
258874
258961
|
}
|
|
@@ -258926,7 +259013,7 @@ var SessionStore = class {
|
|
|
258926
259013
|
} catch {
|
|
258927
259014
|
return [];
|
|
258928
259015
|
}
|
|
258929
|
-
if (!
|
|
259016
|
+
if (!existsSync11(file)) return [];
|
|
258930
259017
|
try {
|
|
258931
259018
|
return (readBoundedRegularFile(file, SESSION_LOG_MAX_BYTES) ?? "").split("\n").filter((line) => line.trim()).flatMap((line) => {
|
|
258932
259019
|
try {
|
|
@@ -258953,7 +259040,7 @@ var SessionStore = class {
|
|
|
258953
259040
|
if (startIndex === previous.length && startIndex === validated.length)
|
|
258954
259041
|
return;
|
|
258955
259042
|
const priorWrites = this.historyJournalWrites.get(sessionId) ?? 0;
|
|
258956
|
-
if (!
|
|
259043
|
+
if (!existsSync11(historyPath) || priorWrites < 2) {
|
|
258957
259044
|
writeJsonAtomically(historyPath, validated, StoredHistorySchema);
|
|
258958
259045
|
rmSync4(journalPath, { force: true });
|
|
258959
259046
|
this.historyJournalWrites.set(sessionId, priorWrites + 1);
|
|
@@ -258987,14 +259074,14 @@ var SessionStore = class {
|
|
|
258987
259074
|
readHistoryFiles(snapshotPath, journalPath) {
|
|
258988
259075
|
let history = [];
|
|
258989
259076
|
for (const candidate of [snapshotPath, `${snapshotPath}.bak`]) {
|
|
258990
|
-
if (!
|
|
259077
|
+
if (!existsSync11(candidate)) continue;
|
|
258991
259078
|
const parsed = readValidatedSnapshot(candidate, StoredHistorySchema);
|
|
258992
259079
|
if (parsed) {
|
|
258993
259080
|
history = parsed;
|
|
258994
259081
|
break;
|
|
258995
259082
|
}
|
|
258996
259083
|
}
|
|
258997
|
-
if (!
|
|
259084
|
+
if (!existsSync11(journalPath)) return history;
|
|
258998
259085
|
try {
|
|
258999
259086
|
const journal = readBoundedRegularFile(
|
|
259000
259087
|
journalPath,
|
|
@@ -259017,7 +259104,7 @@ var SessionStore = class {
|
|
|
259017
259104
|
deleteSession(id) {
|
|
259018
259105
|
SessionIdSchema.parse(id);
|
|
259019
259106
|
const dir = this.resolveSessionDirectory(id);
|
|
259020
|
-
if (
|
|
259107
|
+
if (existsSync11(dir)) {
|
|
259021
259108
|
rmSync4(dir, { recursive: true, force: true });
|
|
259022
259109
|
}
|
|
259023
259110
|
}
|
|
@@ -259040,7 +259127,7 @@ var SessionStore = class {
|
|
|
259040
259127
|
if (sessionRoot === this.cwd) {
|
|
259041
259128
|
throw new Error("Orbit session root cannot be the workspace root.");
|
|
259042
259129
|
}
|
|
259043
|
-
if (
|
|
259130
|
+
if (existsSync11(sessionRoot)) {
|
|
259044
259131
|
const rootStats = lstatSync5(sessionRoot);
|
|
259045
259132
|
if (rootStats.isSymbolicLink() || !rootStats.isDirectory()) {
|
|
259046
259133
|
throw new Error("Orbit session root must be a real directory.");
|
|
@@ -259053,10 +259140,10 @@ var SessionStore = class {
|
|
|
259053
259140
|
const sessionRoot = this.resolveSessionRoot();
|
|
259054
259141
|
const resolved = resolveSafePath(this.cwd, join9(sessionRoot, validId));
|
|
259055
259142
|
const relativePath = relative5(sessionRoot, resolved);
|
|
259056
|
-
if (relativePath !== validId || relativePath.includes(sep) ||
|
|
259143
|
+
if (relativePath !== validId || relativePath.includes(sep) || isAbsolute5(relativePath)) {
|
|
259057
259144
|
throw new Error(`Invalid session directory: ${id}`);
|
|
259058
259145
|
}
|
|
259059
|
-
if (
|
|
259146
|
+
if (existsSync11(resolved)) {
|
|
259060
259147
|
const stats = lstatSync5(resolved);
|
|
259061
259148
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
259062
259149
|
throw new Error(`Invalid session directory: ${id}`);
|
|
@@ -259498,7 +259585,7 @@ function parseProjectRegistrySnapshot(value) {
|
|
|
259498
259585
|
var ProjectRegistry = class {
|
|
259499
259586
|
filePath;
|
|
259500
259587
|
constructor(rootPath = join25(homedir5(), ".orbit")) {
|
|
259501
|
-
const root =
|
|
259588
|
+
const root = resolve25(rootPath);
|
|
259502
259589
|
this.filePath = join25(root, "projects.json");
|
|
259503
259590
|
}
|
|
259504
259591
|
register(projectPath, sessionId) {
|
|
@@ -259657,9 +259744,9 @@ var ProjectRegistry = class {
|
|
|
259657
259744
|
}
|
|
259658
259745
|
};
|
|
259659
259746
|
function canonicalizeProjectPath(projectPath) {
|
|
259660
|
-
if (!
|
|
259747
|
+
if (!isAbsolute24(projectPath))
|
|
259661
259748
|
throw new Error("Project path must be absolute.");
|
|
259662
|
-
const requested =
|
|
259749
|
+
const requested = resolve25(projectPath);
|
|
259663
259750
|
if (requested === parse2(requested).root) {
|
|
259664
259751
|
throw new Error(
|
|
259665
259752
|
"A filesystem root cannot be registered as an Orbit project."
|
|
@@ -260453,7 +260540,7 @@ var PromptCacheSlabBuilder = class {
|
|
|
260453
260540
|
}
|
|
260454
260541
|
static buildDiagnostics(cwd) {
|
|
260455
260542
|
const dir = join10(cwd, ".orbit", "cache-slabs");
|
|
260456
|
-
if (!
|
|
260543
|
+
if (!existsSync12(dir)) {
|
|
260457
260544
|
return [
|
|
260458
260545
|
"Cache diagnostics:",
|
|
260459
260546
|
"- No cache slab metadata found yet.",
|
|
@@ -261059,14 +261146,14 @@ var StepRunner = class {
|
|
|
261059
261146
|
let cancellationCause;
|
|
261060
261147
|
let cancelExecution;
|
|
261061
261148
|
const cancellation = new Promise(
|
|
261062
|
-
(
|
|
261149
|
+
(resolve26) => {
|
|
261063
261150
|
cancelExecution = (cause) => {
|
|
261064
261151
|
if (cancellationCause) return;
|
|
261065
261152
|
cancellationCause = cause;
|
|
261066
261153
|
if (!executionController.signal.aborted) {
|
|
261067
261154
|
executionController.abort(cause);
|
|
261068
261155
|
}
|
|
261069
|
-
|
|
261156
|
+
resolve26({ kind: cause });
|
|
261070
261157
|
};
|
|
261071
261158
|
}
|
|
261072
261159
|
);
|
|
@@ -262102,7 +262189,7 @@ async function hashCompleteTrackedDiff(cwd) {
|
|
|
262102
262189
|
return createHash33("sha256").update(unstaged).update("\0").update(staged).digest("hex");
|
|
262103
262190
|
}
|
|
262104
262191
|
function readGitOutput(cwd, args) {
|
|
262105
|
-
return new Promise((
|
|
262192
|
+
return new Promise((resolve26) => {
|
|
262106
262193
|
const child = spawn3("git", args, {
|
|
262107
262194
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262108
262195
|
cwd,
|
|
@@ -262121,14 +262208,14 @@ function readGitOutput(cwd, args) {
|
|
|
262121
262208
|
}
|
|
262122
262209
|
chunks.push(chunk);
|
|
262123
262210
|
});
|
|
262124
|
-
child.once("error", () =>
|
|
262211
|
+
child.once("error", () => resolve26(void 0));
|
|
262125
262212
|
child.once("close", (code) => {
|
|
262126
|
-
|
|
262213
|
+
resolve26(code === 0 && !exceededLimit ? Buffer.concat(chunks) : void 0);
|
|
262127
262214
|
});
|
|
262128
262215
|
});
|
|
262129
262216
|
}
|
|
262130
262217
|
function hashGitOutput(cwd, args) {
|
|
262131
|
-
return new Promise((
|
|
262218
|
+
return new Promise((resolve26) => {
|
|
262132
262219
|
const hash2 = createHash33("sha256");
|
|
262133
262220
|
const child = spawn3("git", args, {
|
|
262134
262221
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
@@ -262137,10 +262224,10 @@ function hashGitOutput(cwd, args) {
|
|
|
262137
262224
|
stdio: ["ignore", "pipe", "ignore"]
|
|
262138
262225
|
});
|
|
262139
262226
|
child.stdout.on("data", (chunk) => hash2.update(chunk));
|
|
262140
|
-
child.once("error", () =>
|
|
262227
|
+
child.once("error", () => resolve26(void 0));
|
|
262141
262228
|
child.once(
|
|
262142
262229
|
"close",
|
|
262143
|
-
(code) =>
|
|
262230
|
+
(code) => resolve26(code === 0 ? hash2.digest("hex") : void 0)
|
|
262144
262231
|
);
|
|
262145
262232
|
});
|
|
262146
262233
|
}
|
|
@@ -262166,16 +262253,16 @@ async function hashPathState(hash2, absolutePath) {
|
|
|
262166
262253
|
return;
|
|
262167
262254
|
}
|
|
262168
262255
|
hash2.update(`file:${stats.mode}:${stats.size}\0`);
|
|
262169
|
-
await new Promise((
|
|
262256
|
+
await new Promise((resolve26) => {
|
|
262170
262257
|
const stream = createReadStream2(absolutePath);
|
|
262171
262258
|
stream.on("data", (chunk) => hash2.update(chunk));
|
|
262172
262259
|
stream.once("error", (error) => {
|
|
262173
262260
|
hash2.update(
|
|
262174
262261
|
`[unreadable:${error instanceof Error ? error.name : "unknown"}]`
|
|
262175
262262
|
);
|
|
262176
|
-
|
|
262263
|
+
resolve26();
|
|
262177
262264
|
});
|
|
262178
|
-
stream.once("end",
|
|
262265
|
+
stream.once("end", resolve26);
|
|
262179
262266
|
});
|
|
262180
262267
|
} catch (error) {
|
|
262181
262268
|
hash2.update(`[missing:${error instanceof Error ? error.name : "unknown"}]`);
|
|
@@ -262184,7 +262271,11 @@ async function hashPathState(hash2, absolutePath) {
|
|
|
262184
262271
|
function stableFingerprintMap(values) {
|
|
262185
262272
|
return Object.entries(values).sort(([left], [right]) => left.localeCompare(right)).map(([filePath, fingerprint]) => `${filePath}\0${fingerprint}`).join("\0");
|
|
262186
262273
|
}
|
|
262187
|
-
function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
262274
|
+
function prepareIsolatedGitCommit(cwd, requestedPaths, environment) {
|
|
262275
|
+
const childEnvironment = {
|
|
262276
|
+
...environment ?? buildSanitizedChildEnvironment()
|
|
262277
|
+
};
|
|
262278
|
+
delete childEnvironment.GIT_INDEX_FILE;
|
|
262188
262279
|
const paths = Array.from(
|
|
262189
262280
|
new Set(
|
|
262190
262281
|
requestedPaths.map(
|
|
@@ -262194,12 +262285,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262194
262285
|
).filter(Boolean);
|
|
262195
262286
|
if (paths.length === 0) throw new Error("No files were selected for commit.");
|
|
262196
262287
|
const literalPathspecs = paths.map((filePath) => `:(literal)${filePath}`);
|
|
262197
|
-
const stagedPaths = readNullSeparatedGitPaths(
|
|
262198
|
-
|
|
262199
|
-
"--cached",
|
|
262200
|
-
|
|
262201
|
-
|
|
262202
|
-
]);
|
|
262288
|
+
const stagedPaths = readNullSeparatedGitPaths(
|
|
262289
|
+
cwd,
|
|
262290
|
+
["diff", "--cached", "--name-only", "-z"],
|
|
262291
|
+
childEnvironment
|
|
262292
|
+
);
|
|
262203
262293
|
const stagedSet = new Set(stagedPaths.map(normalizePath4));
|
|
262204
262294
|
const overlaps = paths.filter((filePath) => stagedSet.has(filePath));
|
|
262205
262295
|
if (overlaps.length > 0) {
|
|
@@ -262213,6 +262303,7 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262213
262303
|
{
|
|
262214
262304
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262215
262305
|
cwd,
|
|
262306
|
+
env: childEnvironment,
|
|
262216
262307
|
encoding: "utf8"
|
|
262217
262308
|
}
|
|
262218
262309
|
).trim();
|
|
@@ -262220,9 +262311,10 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262220
262311
|
path32.dirname(gitIndexPath),
|
|
262221
262312
|
`orbit-index-${randomUUID24()}`
|
|
262222
262313
|
);
|
|
262223
|
-
const isolatedEnvironment =
|
|
262224
|
-
|
|
262225
|
-
|
|
262314
|
+
const isolatedEnvironment = {
|
|
262315
|
+
...childEnvironment,
|
|
262316
|
+
GIT_INDEX_FILE: temporaryIndexPath
|
|
262317
|
+
};
|
|
262226
262318
|
let disposed = false;
|
|
262227
262319
|
try {
|
|
262228
262320
|
try {
|
|
@@ -262268,7 +262360,8 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262268
262360
|
["reset", "-q", "HEAD", "--", ...literalPathspecs],
|
|
262269
262361
|
{
|
|
262270
262362
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262271
|
-
cwd
|
|
262363
|
+
cwd,
|
|
262364
|
+
env: childEnvironment
|
|
262272
262365
|
}
|
|
262273
262366
|
);
|
|
262274
262367
|
},
|
|
@@ -262279,10 +262372,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
262279
262372
|
throw error;
|
|
262280
262373
|
}
|
|
262281
262374
|
}
|
|
262282
|
-
function readNullSeparatedGitPaths(cwd, args) {
|
|
262375
|
+
function readNullSeparatedGitPaths(cwd, args, environment) {
|
|
262283
262376
|
return execFileSync5("git", args, {
|
|
262284
262377
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262285
|
-
cwd
|
|
262378
|
+
cwd,
|
|
262379
|
+
env: environment
|
|
262286
262380
|
}).toString("utf8").split("\0").filter(Boolean);
|
|
262287
262381
|
}
|
|
262288
262382
|
function normalizePath4(filePath) {
|
|
@@ -262515,7 +262609,7 @@ var PackageManifestSchema2 = z64.object({
|
|
|
262515
262609
|
name: z64.string(),
|
|
262516
262610
|
bin: z64.union([z64.string(), z64.record(z64.string())]).optional()
|
|
262517
262611
|
});
|
|
262518
|
-
async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
262612
|
+
async function executeLocalPackageBinary(cwd, packageName, binaryName, args, environment) {
|
|
262519
262613
|
const binaryPath = resolveLocalPackageBinary(cwd, packageName, binaryName);
|
|
262520
262614
|
const isJavaScript = /\.(?:cjs|mjs|js)$/i.test(binaryPath);
|
|
262521
262615
|
const executable = isJavaScript ? process.execPath : binaryPath;
|
|
@@ -262523,6 +262617,7 @@ async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
|
262523
262617
|
return execFilePromise2(executable, executableArgs, {
|
|
262524
262618
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
262525
262619
|
cwd,
|
|
262620
|
+
...environment ? { env: { ...environment } } : {},
|
|
262526
262621
|
encoding: "utf8",
|
|
262527
262622
|
timeout: 12e4
|
|
262528
262623
|
});
|
|
@@ -263144,11 +263239,11 @@ function safeAgentLoopErrorMessage(error) {
|
|
|
263144
263239
|
return `${message2.slice(0, AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS - 1)}\u2026`;
|
|
263145
263240
|
}
|
|
263146
263241
|
function waitForAgentRetry(delayMs, signal) {
|
|
263147
|
-
return new Promise((
|
|
263242
|
+
return new Promise((resolve26, reject) => {
|
|
263148
263243
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
263149
263244
|
const timeout = setTimeout(() => {
|
|
263150
263245
|
cleanup();
|
|
263151
|
-
|
|
263246
|
+
resolve26();
|
|
263152
263247
|
}, delayMs);
|
|
263153
263248
|
timeout.unref?.();
|
|
263154
263249
|
const onAbort = () => {
|
|
@@ -263188,12 +263283,24 @@ function hookErrorOutput(error) {
|
|
|
263188
263283
|
if (output.trim()) return output;
|
|
263189
263284
|
return typeof record.message === "string" ? record.message : String(error);
|
|
263190
263285
|
}
|
|
263191
|
-
function
|
|
263286
|
+
function hasSuccessfulWorkspaceFileMutations(history, cwd) {
|
|
263192
263287
|
const mutationCallIds = /* @__PURE__ */ new Set();
|
|
263193
263288
|
for (const message2 of history) {
|
|
263194
263289
|
for (const block2 of message2.content) {
|
|
263195
263290
|
if (block2.type === "tool_call" && isFileMutationTool(block2.toolCall.name)) {
|
|
263196
|
-
|
|
263291
|
+
try {
|
|
263292
|
+
const args = toUnknownRecord(JSON.parse(block2.toolCall.arguments));
|
|
263293
|
+
const targetPath = firstStringValue(
|
|
263294
|
+
args.path,
|
|
263295
|
+
args.TargetFile,
|
|
263296
|
+
args.filePath,
|
|
263297
|
+
args.file
|
|
263298
|
+
);
|
|
263299
|
+
if (!targetPath) continue;
|
|
263300
|
+
resolveSafePath(cwd, targetPath);
|
|
263301
|
+
mutationCallIds.add(block2.toolCall.id);
|
|
263302
|
+
} catch {
|
|
263303
|
+
}
|
|
263197
263304
|
}
|
|
263198
263305
|
}
|
|
263199
263306
|
}
|
|
@@ -264302,7 +264409,7 @@ Orbit: ${this.interaction.formatMarkdown?.(responseText) || responseText}`
|
|
|
264302
264409
|
if (steeringApplied || backgroundReconciled) continue;
|
|
264303
264410
|
}
|
|
264304
264411
|
if (toolCallsToExecute.length === 0) {
|
|
264305
|
-
const hasEdits = this.workspaceMutationRevision > 0 ||
|
|
264412
|
+
const hasEdits = this.workspaceMutationRevision > 0 || hasSuccessfulWorkspaceFileMutations(this.state.history, this.cwd);
|
|
264306
264413
|
if (hasEdits) {
|
|
264307
264414
|
if (this.verificationManager.hasContract()) {
|
|
264308
264415
|
this.sessionManager.setRunState("verifying", "verification", {
|
|
@@ -264387,7 +264494,9 @@ Please analyze this failure, fix the codebase, and ensure it passes the verifica
|
|
|
264387
264494
|
{
|
|
264388
264495
|
cwd: this.cwd,
|
|
264389
264496
|
sessionId: this.state.sessionId,
|
|
264390
|
-
|
|
264497
|
+
config: this.config,
|
|
264498
|
+
abortSignal: this.abortController?.signal,
|
|
264499
|
+
services: this.toolRuntimeServices
|
|
264391
264500
|
}
|
|
264392
264501
|
);
|
|
264393
264502
|
const verificationWorkspaceAfter = await captureWorkspaceMutationSnapshot(this.cwd);
|
|
@@ -264659,7 +264768,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264659
264768
|
evalArgsRecord.filePath,
|
|
264660
264769
|
evalArgsRecord.file
|
|
264661
264770
|
);
|
|
264662
|
-
if (targetPath2) {
|
|
264771
|
+
if (targetPath2 && !isFullAccessEnabled(this.config)) {
|
|
264663
264772
|
const relPath = path7.relative(this.cwd, path7.resolve(this.cwd, targetPath2)).replace(/\\/g, "/");
|
|
264664
264773
|
const foundFile = this.state.relevantFiles.find(
|
|
264665
264774
|
(f) => f.path === relPath
|
|
@@ -264881,6 +264990,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264881
264990
|
});
|
|
264882
264991
|
let beforeContent = null;
|
|
264883
264992
|
let targetPath;
|
|
264993
|
+
const fullAccess = isFullAccessEnabled(this.config);
|
|
264884
264994
|
let parsedArgs = {};
|
|
264885
264995
|
try {
|
|
264886
264996
|
parsedArgs = toUnknownRecord(JSON.parse(tc.arguments));
|
|
@@ -264893,11 +265003,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264893
265003
|
} catch {
|
|
264894
265004
|
}
|
|
264895
265005
|
let absoluteTargetPath;
|
|
265006
|
+
let workspaceTargetPath;
|
|
264896
265007
|
if (targetPath) {
|
|
264897
265008
|
try {
|
|
264898
|
-
|
|
265009
|
+
workspaceTargetPath = resolveSafePath(this.cwd, targetPath);
|
|
265010
|
+
absoluteTargetPath = workspaceTargetPath;
|
|
264899
265011
|
} catch {
|
|
264900
|
-
absoluteTargetPath = void 0;
|
|
265012
|
+
absoluteTargetPath = fullAccess ? path7.resolve(this.cwd, targetPath) : void 0;
|
|
264901
265013
|
}
|
|
264902
265014
|
}
|
|
264903
265015
|
let skipToolExecution = false;
|
|
@@ -264911,7 +265023,8 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264911
265023
|
try {
|
|
264912
265024
|
await execPromise2(testCmd, {
|
|
264913
265025
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
264914
|
-
cwd: this.cwd
|
|
265026
|
+
cwd: this.cwd,
|
|
265027
|
+
env: this.buildChildProcessEnvironment()
|
|
264915
265028
|
});
|
|
264916
265029
|
this.interaction.showText(`\u2714 Pre-commit checks passed.`);
|
|
264917
265030
|
} catch (error) {
|
|
@@ -264921,7 +265034,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264921
265034
|
`\u2716 Pre-commit checks failed. Verification tests failed.`
|
|
264922
265035
|
)
|
|
264923
265036
|
);
|
|
264924
|
-
const choice = this.options?.nonInteractive ? "no" : await this.askSelect(
|
|
265037
|
+
const choice = fullAccess ? "yes" : this.options?.nonInteractive ? "no" : await this.askSelect(
|
|
264925
265038
|
`Pre-commit verification tests failed. How would you like to proceed?`,
|
|
264926
265039
|
[
|
|
264927
265040
|
{
|
|
@@ -264935,6 +265048,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
264935
265048
|
{ value: "no", label: "Abort the commit entirely" }
|
|
264936
265049
|
]
|
|
264937
265050
|
);
|
|
265051
|
+
if (fullAccess) {
|
|
265052
|
+
this.interaction.showText(
|
|
265053
|
+
picocolors3.yellow(
|
|
265054
|
+
"\u26A0 Full Access: proceeding with the approved commit despite failed pre-commit verification."
|
|
265055
|
+
)
|
|
265056
|
+
);
|
|
265057
|
+
}
|
|
264938
265058
|
if (choice === "diagnose") {
|
|
264939
265059
|
eventBus.emitEvent("tool_result", {
|
|
264940
265060
|
toolCallId: tc.id,
|
|
@@ -264979,7 +265099,8 @@ ${commandError}`,
|
|
|
264979
265099
|
try {
|
|
264980
265100
|
const { stdout: stdout2 } = await execPromise2("git diff --cached", {
|
|
264981
265101
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
264982
|
-
cwd: this.cwd
|
|
265102
|
+
cwd: this.cwd,
|
|
265103
|
+
env: this.buildChildProcessEnvironment()
|
|
264983
265104
|
});
|
|
264984
265105
|
if (!stdout2.trim()) {
|
|
264985
265106
|
this.interaction.showText(
|
|
@@ -265028,17 +265149,26 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265028
265149
|
}
|
|
265029
265150
|
}
|
|
265030
265151
|
}
|
|
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
|
-
|
|
265152
|
+
if ((tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content") && targetPath && workspaceTargetPath) {
|
|
265153
|
+
try {
|
|
265154
|
+
const checkpoint = await this.checkpointManager.captureBeforeState(
|
|
265155
|
+
tc.id,
|
|
265156
|
+
targetPath
|
|
265157
|
+
);
|
|
265158
|
+
beforeContent = checkpoint.backups[0].originalContent;
|
|
265159
|
+
eventBus.emitEvent("checkpoint_created", {
|
|
265160
|
+
checkpointId: checkpoint.id,
|
|
265161
|
+
timestamp: checkpoint.timestamp,
|
|
265162
|
+
message: `Before executing ${tc.name} on ${targetPath}`
|
|
265163
|
+
});
|
|
265164
|
+
} catch (error) {
|
|
265165
|
+
if (!fullAccess) throw error;
|
|
265166
|
+
this.interaction.showText(
|
|
265167
|
+
picocolors3.yellow(
|
|
265168
|
+
`\u26A0 Full Access: checkpoint unavailable for ${targetPath}; proceeding without Orbit rollback coverage. ${safeAgentLoopErrorMessage(error)}`
|
|
265169
|
+
)
|
|
265170
|
+
);
|
|
265171
|
+
}
|
|
265042
265172
|
if (this.config.hooks?.preEdit) {
|
|
265043
265173
|
this.interaction.showText(`\u25CF Running pre-edit hook...`);
|
|
265044
265174
|
const hookRes = await this.runHook(
|
|
@@ -265133,7 +265263,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265133
265263
|
this.cwd,
|
|
265134
265264
|
"@biomejs/biome",
|
|
265135
265265
|
"biome",
|
|
265136
|
-
["format", "--write", absoluteTargetPath]
|
|
265266
|
+
["format", "--write", absoluteTargetPath],
|
|
265267
|
+
this.buildChildProcessEnvironment()
|
|
265137
265268
|
);
|
|
265138
265269
|
} else {
|
|
265139
265270
|
const prettierCandidates = [
|
|
@@ -265159,7 +265290,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265159
265290
|
this.cwd,
|
|
265160
265291
|
"prettier",
|
|
265161
265292
|
"prettier",
|
|
265162
|
-
["--write", absoluteTargetPath]
|
|
265293
|
+
["--write", absoluteTargetPath],
|
|
265294
|
+
this.buildChildProcessEnvironment()
|
|
265163
265295
|
);
|
|
265164
265296
|
}
|
|
265165
265297
|
}
|
|
@@ -265177,10 +265309,13 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265177
265309
|
}
|
|
265178
265310
|
}
|
|
265179
265311
|
if (hasEslintConfig) {
|
|
265180
|
-
await executeLocalPackageBinary(
|
|
265181
|
-
|
|
265182
|
-
|
|
265183
|
-
|
|
265312
|
+
await executeLocalPackageBinary(
|
|
265313
|
+
this.cwd,
|
|
265314
|
+
"eslint",
|
|
265315
|
+
"eslint",
|
|
265316
|
+
["--fix", absoluteTargetPath],
|
|
265317
|
+
this.buildChildProcessEnvironment()
|
|
265318
|
+
);
|
|
265184
265319
|
}
|
|
265185
265320
|
} catch {
|
|
265186
265321
|
}
|
|
@@ -265201,7 +265336,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265201
265336
|
this.cwd,
|
|
265202
265337
|
lintPackage,
|
|
265203
265338
|
lintBinary,
|
|
265204
|
-
lintArgs
|
|
265339
|
+
lintArgs,
|
|
265340
|
+
this.buildChildProcessEnvironment()
|
|
265205
265341
|
);
|
|
265206
265342
|
this.interaction.showText(`\u2714 Syntax verification passed.`);
|
|
265207
265343
|
} catch (error) {
|
|
@@ -265242,7 +265378,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265242
265378
|
const uniqueModules = Array.from(new Set(missingModules));
|
|
265243
265379
|
let dependenciesInstalled = false;
|
|
265244
265380
|
for (const pkg of uniqueModules) {
|
|
265245
|
-
const installPkg = await this.interaction.askApproval(
|
|
265381
|
+
const installPkg = fullAccess || await this.interaction.askApproval(
|
|
265246
265382
|
`Missing dependency "${pkg}" detected. Install it automatically?`
|
|
265247
265383
|
);
|
|
265248
265384
|
if (installPkg) {
|
|
@@ -265263,7 +265399,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265263
265399
|
const args = isPnpm || isYarn ? ["add", "-D", pkg] : ["install", "--save-dev", pkg];
|
|
265264
265400
|
await execFilePromise3(executable, args, {
|
|
265265
265401
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
265266
|
-
cwd: this.cwd
|
|
265402
|
+
cwd: this.cwd,
|
|
265403
|
+
env: this.buildChildProcessEnvironment()
|
|
265267
265404
|
});
|
|
265268
265405
|
this.interaction.showText(
|
|
265269
265406
|
`\u2714 Installed "${pkg}" successfully.`
|
|
@@ -265287,7 +265424,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265287
265424
|
this.cwd,
|
|
265288
265425
|
"eslint",
|
|
265289
265426
|
"eslint",
|
|
265290
|
-
["--quiet", absoluteTargetPath]
|
|
265427
|
+
["--quiet", absoluteTargetPath],
|
|
265428
|
+
this.buildChildProcessEnvironment()
|
|
265291
265429
|
);
|
|
265292
265430
|
this.interaction.showText(
|
|
265293
265431
|
`\u2714 Syntax verification passed after dependency installation.`
|
|
@@ -265371,7 +265509,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265371
265509
|
this.cwd,
|
|
265372
265510
|
"eslint",
|
|
265373
265511
|
"eslint",
|
|
265374
|
-
["--quiet", absoluteTargetPath]
|
|
265512
|
+
["--quiet", absoluteTargetPath],
|
|
265513
|
+
this.buildChildProcessEnvironment()
|
|
265375
265514
|
);
|
|
265376
265515
|
this.interaction.showText(
|
|
265377
265516
|
`\u2714 Syntax verification passed after auto-imports injection.`
|
|
@@ -265389,7 +265528,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265389
265528
|
}
|
|
265390
265529
|
}
|
|
265391
265530
|
if (!checkPassedAfterAutofix) {
|
|
265392
|
-
const autoFix = await this.interaction.askApproval(
|
|
265531
|
+
const autoFix = fullAccess || await this.interaction.askApproval(
|
|
265393
265532
|
`Lint/Syntax verification failed. Let Agent auto-repair the file?`
|
|
265394
265533
|
);
|
|
265395
265534
|
if (autoFix) {
|
|
@@ -265425,7 +265564,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265425
265564
|
} catch {
|
|
265426
265565
|
}
|
|
265427
265566
|
let accepted = false;
|
|
265428
|
-
const choice = this.options?.nonInteractive ? "yes" : this.interaction.reviewFileChange ? await this.interaction.reviewFileChange({
|
|
265567
|
+
const choice = fullAccess ? "yes" : this.options?.nonInteractive ? "yes" : this.interaction.reviewFileChange ? await this.interaction.reviewFileChange({
|
|
265429
265568
|
filePath: targetPath,
|
|
265430
265569
|
before: beforeContent,
|
|
265431
265570
|
after: afterContent,
|
|
@@ -265602,8 +265741,8 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265602
265741
|
};
|
|
265603
265742
|
}
|
|
265604
265743
|
}
|
|
265605
|
-
if (finalResult.ok && targetPath && absoluteTargetPath && isFileMutationTool(tc.name)) {
|
|
265606
|
-
const auditedTargetPath = path7.relative(this.cwd,
|
|
265744
|
+
if (finalResult.ok && targetPath && absoluteTargetPath && workspaceTargetPath && isFileMutationTool(tc.name)) {
|
|
265745
|
+
const auditedTargetPath = path7.relative(this.cwd, workspaceTargetPath).replace(/\\/g, "/");
|
|
265607
265746
|
this.registerWorkspaceMutation([auditedTargetPath], tc.name);
|
|
265608
265747
|
try {
|
|
265609
265748
|
const afterContent = readBoundedRegularFile(
|
|
@@ -265670,7 +265809,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
265670
265809
|
this.interaction.showText(
|
|
265671
265810
|
` ${picocolors3.green("\u2714")} Success: ${picocolors3.gray(statusText)}`
|
|
265672
265811
|
);
|
|
265673
|
-
if (targetPath) {
|
|
265812
|
+
if (targetPath && workspaceTargetPath) {
|
|
265674
265813
|
this.addRelevantFile(targetPath, `Modified by ${tc.name}`);
|
|
265675
265814
|
}
|
|
265676
265815
|
if (tc.name === "write_file" || tc.name === "edit_file") {
|
|
@@ -265763,7 +265902,8 @@ ${guardNudge.message}` : ""),
|
|
|
265763
265902
|
try {
|
|
265764
265903
|
const preparedCommit = prepareIsolatedGitCommit(
|
|
265765
265904
|
this.cwd,
|
|
265766
|
-
modifiedFiles
|
|
265905
|
+
modifiedFiles,
|
|
265906
|
+
this.buildChildProcessEnvironment()
|
|
265767
265907
|
);
|
|
265768
265908
|
try {
|
|
265769
265909
|
const diff = preparedCommit.diff;
|
|
@@ -266024,10 +266164,10 @@ ${diff.substring(0, 2e4)}`
|
|
|
266024
266164
|
const { stdout: stdout2, stderr } = await execPromise2(hookCommand, {
|
|
266025
266165
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
266026
266166
|
cwd: this.cwd,
|
|
266027
|
-
env:
|
|
266028
|
-
|
|
266029
|
-
|
|
266030
|
-
|
|
266167
|
+
env: this.buildChildProcessEnvironment(
|
|
266168
|
+
{ ORBIT_FILE: relativePath },
|
|
266169
|
+
true
|
|
266170
|
+
),
|
|
266031
266171
|
timeout: this.config.tools.bash.timeoutMs,
|
|
266032
266172
|
signal: this.abortController?.signal
|
|
266033
266173
|
});
|
|
@@ -266748,13 +266888,21 @@ ${diff.substring(0, 2e4)}`
|
|
|
266748
266888
|
try {
|
|
266749
266889
|
await execPromise2("git rev-parse --is-inside-work-tree", {
|
|
266750
266890
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
266751
|
-
cwd: this.cwd
|
|
266891
|
+
cwd: this.cwd,
|
|
266892
|
+
env: this.buildChildProcessEnvironment()
|
|
266752
266893
|
});
|
|
266753
266894
|
return true;
|
|
266754
266895
|
} catch {
|
|
266755
266896
|
return false;
|
|
266756
266897
|
}
|
|
266757
266898
|
}
|
|
266899
|
+
/** Keep every Agent-owned child process aligned with the active permission mode. */
|
|
266900
|
+
buildChildProcessEnvironment(extra, minimal = false) {
|
|
266901
|
+
return isFullAccessEnabled(this.config) ? buildInheritedChildEnvironment({ extra }) : buildSanitizedChildEnvironment({
|
|
266902
|
+
...minimal ? { mode: "minimal" } : {},
|
|
266903
|
+
extra
|
|
266904
|
+
});
|
|
266905
|
+
}
|
|
266758
266906
|
shouldShowDeepSeekCacheStatus(inputTokens = 0, hitRate = 1) {
|
|
266759
266907
|
const verbose = process.env[DEEPSEEK_VERBOSE_CACHE_ENV];
|
|
266760
266908
|
if (verbose === "1" || verbose?.toLowerCase() === "true") {
|
|
@@ -267006,21 +267154,21 @@ var AgentTaskScheduler = class {
|
|
|
267006
267154
|
Math.min(36e5, Math.floor(task.timeoutMs ?? 6e5))
|
|
267007
267155
|
);
|
|
267008
267156
|
let timeout;
|
|
267009
|
-
const timeoutResult = new Promise((
|
|
267157
|
+
const timeoutResult = new Promise((resolve26) => {
|
|
267010
267158
|
timeout = setTimeout(() => {
|
|
267011
267159
|
const error = new Error(`Agent task timed out after ${timeoutMs}ms.`);
|
|
267012
267160
|
taskController.abort(error);
|
|
267013
|
-
|
|
267161
|
+
resolve26({ id: task.id, status: "failed", error });
|
|
267014
267162
|
this.abort(
|
|
267015
267163
|
`Agent task ${task.id} timed out; the remaining task graph was cancelled.`
|
|
267016
267164
|
);
|
|
267017
267165
|
}, timeoutMs);
|
|
267018
267166
|
});
|
|
267019
267167
|
let removeSchedulerAbortListener = () => void 0;
|
|
267020
|
-
const schedulerAbortResult = new Promise((
|
|
267168
|
+
const schedulerAbortResult = new Promise((resolve26) => {
|
|
267021
267169
|
const onAbort = () => {
|
|
267022
267170
|
if (taskController.signal.aborted) return;
|
|
267023
|
-
|
|
267171
|
+
resolve26({
|
|
267024
267172
|
id: task.id,
|
|
267025
267173
|
status: "aborted",
|
|
267026
267174
|
error: abortError2(this.controller.signal)
|
|
@@ -267057,8 +267205,8 @@ var AgentTaskScheduler = class {
|
|
|
267057
267205
|
try {
|
|
267058
267206
|
await Promise.race([
|
|
267059
267207
|
runResult.then(() => void 0),
|
|
267060
|
-
new Promise((
|
|
267061
|
-
graceTimer = setTimeout(
|
|
267208
|
+
new Promise((resolve26) => {
|
|
267209
|
+
graceTimer = setTimeout(resolve26, this.abortGraceMs);
|
|
267062
267210
|
graceTimer.unref?.();
|
|
267063
267211
|
})
|
|
267064
267212
|
]);
|
|
@@ -268085,15 +268233,15 @@ var AutocompleteEngine = class {
|
|
|
268085
268233
|
this.activeRequests.set(windowId, controller);
|
|
268086
268234
|
const signal = controller.signal;
|
|
268087
268235
|
const debounceMs = config.autocomplete?.debounceMs !== void 0 ? config.autocomplete.debounceMs : 150;
|
|
268088
|
-
return new Promise((
|
|
268089
|
-
this.debounceResolvers.set(windowId,
|
|
268236
|
+
return new Promise((resolve26) => {
|
|
268237
|
+
this.debounceResolvers.set(windowId, resolve26);
|
|
268090
268238
|
const timer = setTimeout(async () => {
|
|
268091
268239
|
if (this.debounceTimers.get(windowId) === timer) {
|
|
268092
268240
|
this.debounceTimers.delete(windowId);
|
|
268093
268241
|
}
|
|
268094
268242
|
this.debounceResolvers.delete(windowId);
|
|
268095
268243
|
if (signal.aborted) {
|
|
268096
|
-
|
|
268244
|
+
resolve26("");
|
|
268097
268245
|
return;
|
|
268098
268246
|
}
|
|
268099
268247
|
const providerId = config.autocomplete.provider || "ollama";
|
|
@@ -268101,7 +268249,7 @@ var AutocompleteEngine = class {
|
|
|
268101
268249
|
try {
|
|
268102
268250
|
const provider = this.getCachedProvider(providerId, config);
|
|
268103
268251
|
if (typeof provider.complete !== "function") {
|
|
268104
|
-
|
|
268252
|
+
resolve26("");
|
|
268105
268253
|
return;
|
|
268106
268254
|
}
|
|
268107
268255
|
const header = getPathCommentHeader(windowId, this.cwd);
|
|
@@ -268213,21 +268361,21 @@ var AutocompleteEngine = class {
|
|
|
268213
268361
|
if (speculativeTimer) clearTimeout(speculativeTimer);
|
|
268214
268362
|
}
|
|
268215
268363
|
if (winner !== "__TIMEOUT__" && winner.trim() !== "") {
|
|
268216
|
-
|
|
268364
|
+
resolve26(winner);
|
|
268217
268365
|
} else {
|
|
268218
268366
|
const localResult = await localPromise;
|
|
268219
268367
|
if (localResult.trim() !== "") {
|
|
268220
|
-
|
|
268368
|
+
resolve26(localResult);
|
|
268221
268369
|
} else {
|
|
268222
|
-
|
|
268370
|
+
resolve26(await cloudPromise.catch(() => ""));
|
|
268223
268371
|
}
|
|
268224
268372
|
}
|
|
268225
268373
|
} else {
|
|
268226
268374
|
const completed = await cloudPromise;
|
|
268227
|
-
|
|
268375
|
+
resolve26(completed);
|
|
268228
268376
|
}
|
|
268229
268377
|
} catch {
|
|
268230
|
-
|
|
268378
|
+
resolve26("");
|
|
268231
268379
|
} finally {
|
|
268232
268380
|
if (this.activeRequests.get(windowId) === controller) {
|
|
268233
268381
|
this.activeRequests.delete(windowId);
|
|
@@ -268240,7 +268388,7 @@ var AutocompleteEngine = class {
|
|
|
268240
268388
|
/** Cancel outstanding completions and release timers held by the engine. */
|
|
268241
268389
|
dispose() {
|
|
268242
268390
|
for (const timer of this.debounceTimers.values()) clearTimeout(timer);
|
|
268243
|
-
for (const
|
|
268391
|
+
for (const resolve26 of this.debounceResolvers.values()) resolve26("");
|
|
268244
268392
|
for (const controller of this.activeRequests.values()) controller.abort();
|
|
268245
268393
|
this.debounceTimers.clear();
|
|
268246
268394
|
this.debounceResolvers.clear();
|
|
@@ -268256,7 +268404,7 @@ function latestObservation(metadata) {
|
|
|
268256
268404
|
}
|
|
268257
268405
|
function buildCacheDiagnostics(cwd) {
|
|
268258
268406
|
const dir = join11(cwd, ".orbit", "cache-slabs");
|
|
268259
|
-
if (!
|
|
268407
|
+
if (!existsSync13(dir)) {
|
|
268260
268408
|
return picocolors4.gray(
|
|
268261
268409
|
"\u25CF No cache telemetry yet. It will appear after a completed DeepSeek request."
|
|
268262
268410
|
);
|
|
@@ -268962,11 +269110,11 @@ function statusLine(ok, text2, warn = false) {
|
|
|
268962
269110
|
return warn ? picocolors6.yellow(`\u26A0\uFE0F ${text2}`) : picocolors6.red(`\u2716 ${text2}`);
|
|
268963
269111
|
}
|
|
268964
269112
|
function packageManager(cwd) {
|
|
268965
|
-
if (
|
|
268966
|
-
if (
|
|
268967
|
-
if (
|
|
268968
|
-
if (
|
|
268969
|
-
if (
|
|
269113
|
+
if (existsSync14(join12(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
269114
|
+
if (existsSync14(join12(cwd, "yarn.lock"))) return "yarn";
|
|
269115
|
+
if (existsSync14(join12(cwd, "bun.lockb"))) return "bun";
|
|
269116
|
+
if (existsSync14(join12(cwd, "package-lock.json"))) return "npm";
|
|
269117
|
+
if (existsSync14(join12(cwd, "package.json"))) return "npm";
|
|
268970
269118
|
return "unknown";
|
|
268971
269119
|
}
|
|
268972
269120
|
function boolText(value) {
|
|
@@ -270729,7 +270877,7 @@ var n2 = class extends V {
|
|
|
270729
270877
|
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
270730
270878
|
import process$1 from "process";
|
|
270731
270879
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
270732
|
-
import { existsSync as
|
|
270880
|
+
import { existsSync as existsSync15, lstatSync as lstatSync6, readdirSync as readdirSync6 } from "fs";
|
|
270733
270881
|
import { dirname as dirname9, join as join13 } from "path";
|
|
270734
270882
|
function isUnicodeSupported() {
|
|
270735
270883
|
if (process$1.platform !== "win32") {
|
|
@@ -271563,7 +271711,7 @@ var Prompt = class {
|
|
|
271563
271711
|
});
|
|
271564
271712
|
}
|
|
271565
271713
|
static async askTextWithAutocomplete(message2, completerFn, promptPrefix) {
|
|
271566
|
-
return new Promise((
|
|
271714
|
+
return new Promise((resolve26) => {
|
|
271567
271715
|
const promptStr = promptPrefix !== void 0 ? promptPrefix : `${picocolors22.cyan("?")} ${message2} \u203A `;
|
|
271568
271716
|
const rl = readline.createInterface({
|
|
271569
271717
|
input: process.stdin,
|
|
@@ -271631,7 +271779,7 @@ var Prompt = class {
|
|
|
271631
271779
|
clearSuggestions();
|
|
271632
271780
|
rl.close();
|
|
271633
271781
|
process.stdout.write("\n");
|
|
271634
|
-
|
|
271782
|
+
resolve26(null);
|
|
271635
271783
|
return;
|
|
271636
271784
|
}
|
|
271637
271785
|
if (currentSuggestion && key && (key.name === "tab" || key.name === "right")) {
|
|
@@ -271659,12 +271807,12 @@ var Prompt = class {
|
|
|
271659
271807
|
clearSuggestions();
|
|
271660
271808
|
rl.close();
|
|
271661
271809
|
process.stdout.write("\n");
|
|
271662
|
-
|
|
271810
|
+
resolve26(null);
|
|
271663
271811
|
});
|
|
271664
271812
|
rl.on("line", (line) => {
|
|
271665
271813
|
clearSuggestions();
|
|
271666
271814
|
rl.close();
|
|
271667
|
-
|
|
271815
|
+
resolve26(line);
|
|
271668
271816
|
});
|
|
271669
271817
|
});
|
|
271670
271818
|
}
|
|
@@ -272005,7 +272153,7 @@ import picocolors20 from "picocolors";
|
|
|
272005
272153
|
// src/tui/FullscreenTui.ts
|
|
272006
272154
|
import { join as join15 } from "path";
|
|
272007
272155
|
import { homedir as homedir7 } from "os";
|
|
272008
|
-
import { existsSync as
|
|
272156
|
+
import { existsSync as existsSync16 } from "fs";
|
|
272009
272157
|
import { exec as exec4 } from "child_process";
|
|
272010
272158
|
import readline3 from "readline";
|
|
272011
272159
|
|
|
@@ -272590,9 +272738,9 @@ var SLASH_COMMAND_DEFINITIONS = [
|
|
|
272590
272738
|
{
|
|
272591
272739
|
value: "auto",
|
|
272592
272740
|
description: {
|
|
272593
|
-
en: "
|
|
272594
|
-
zh: "\
|
|
272595
|
-
"zh-TW": "\
|
|
272741
|
+
en: "Approve every enabled tool action with the current host account's permissions",
|
|
272742
|
+
zh: "\u4EE5\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u6743\u9650\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C",
|
|
272743
|
+
"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
272744
|
}
|
|
272597
272745
|
},
|
|
272598
272746
|
{
|
|
@@ -273402,7 +273550,7 @@ var TuiPromptSession = class {
|
|
|
273402
273550
|
this.requestRender();
|
|
273403
273551
|
const wasRaw = !!this.stdin.isRaw;
|
|
273404
273552
|
if (this.stdin.setRawMode) this.stdin.setRawMode(true);
|
|
273405
|
-
return new Promise((
|
|
273553
|
+
return new Promise((resolve26) => {
|
|
273406
273554
|
const listener = (str, key = {}) => {
|
|
273407
273555
|
const state = this.promptState;
|
|
273408
273556
|
if (!state) {
|
|
@@ -273420,7 +273568,7 @@ var TuiPromptSession = class {
|
|
|
273420
273568
|
this.requestRender();
|
|
273421
273569
|
}
|
|
273422
273570
|
};
|
|
273423
|
-
this.active = { resolve:
|
|
273571
|
+
this.active = { resolve: resolve26, wasRaw, listener };
|
|
273424
273572
|
this.stdin.on("keypress", listener);
|
|
273425
273573
|
this.stdin.resume();
|
|
273426
273574
|
});
|
|
@@ -273780,7 +273928,7 @@ function runNpmCommand(executable, args, options) {
|
|
|
273780
273928
|
});
|
|
273781
273929
|
}
|
|
273782
273930
|
function runNpmCommandAsync(executable, args, timeoutMs) {
|
|
273783
|
-
return new Promise((
|
|
273931
|
+
return new Promise((resolve26, reject) => {
|
|
273784
273932
|
execFile5(
|
|
273785
273933
|
executable,
|
|
273786
273934
|
args,
|
|
@@ -273795,7 +273943,7 @@ function runNpmCommandAsync(executable, args, timeoutMs) {
|
|
|
273795
273943
|
reject(error);
|
|
273796
273944
|
return;
|
|
273797
273945
|
}
|
|
273798
|
-
|
|
273946
|
+
resolve26(stdout2);
|
|
273799
273947
|
}
|
|
273800
273948
|
);
|
|
273801
273949
|
});
|
|
@@ -273886,11 +274034,11 @@ async function pageText(text2) {
|
|
|
273886
274034
|
process.stdin.setRawMode(true);
|
|
273887
274035
|
process.stdin.resume();
|
|
273888
274036
|
readline2.emitKeypressEvents(process.stdin);
|
|
273889
|
-
const waitForKeypress = () => new Promise((
|
|
274037
|
+
const waitForKeypress = () => new Promise((resolve26) => {
|
|
273890
274038
|
const onKeypress = (str, key) => {
|
|
273891
274039
|
process.stdin.removeListener("keypress", onKeypress);
|
|
273892
|
-
if (key?.ctrl && key.name === "c") return
|
|
273893
|
-
|
|
274040
|
+
if (key?.ctrl && key.name === "c") return resolve26("interrupt");
|
|
274041
|
+
resolve26(key?.name || str);
|
|
273894
274042
|
};
|
|
273895
274043
|
process.stdin.on("keypress", onKeypress);
|
|
273896
274044
|
});
|
|
@@ -274025,9 +274173,9 @@ var FullscreenTui = class {
|
|
|
274025
274173
|
const planPath2 = join15(this.cwd, ".orbit", "task.md");
|
|
274026
274174
|
const planPath1 = join15(this.cwd, "task.md");
|
|
274027
274175
|
let planPath = "";
|
|
274028
|
-
if (
|
|
274176
|
+
if (existsSync16(planPath2)) {
|
|
274029
274177
|
planPath = planPath2;
|
|
274030
|
-
} else if (
|
|
274178
|
+
} else if (existsSync16(planPath1)) {
|
|
274031
274179
|
planPath = planPath1;
|
|
274032
274180
|
}
|
|
274033
274181
|
if (!planPath) {
|
|
@@ -274419,23 +274567,23 @@ var FullscreenTui = class {
|
|
|
274419
274567
|
modified: 0,
|
|
274420
274568
|
deleted: 0
|
|
274421
274569
|
};
|
|
274422
|
-
const branchPromise = new Promise((
|
|
274570
|
+
const branchPromise = new Promise((resolve26) => {
|
|
274423
274571
|
exec4(
|
|
274424
274572
|
"git rev-parse --abbrev-ref HEAD",
|
|
274425
274573
|
{ ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
|
|
274426
274574
|
(err, stdout2) => {
|
|
274427
|
-
if (err)
|
|
274428
|
-
else
|
|
274575
|
+
if (err) resolve26("no-git");
|
|
274576
|
+
else resolve26(stdout2.trim());
|
|
274429
274577
|
}
|
|
274430
274578
|
);
|
|
274431
274579
|
});
|
|
274432
|
-
const statusPromise = new Promise((
|
|
274580
|
+
const statusPromise = new Promise((resolve26) => {
|
|
274433
274581
|
exec4(
|
|
274434
274582
|
"git status --porcelain",
|
|
274435
274583
|
{ ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
|
|
274436
274584
|
(err, stdout2) => {
|
|
274437
|
-
if (err)
|
|
274438
|
-
else
|
|
274585
|
+
if (err) resolve26("");
|
|
274586
|
+
else resolve26(stdout2);
|
|
274439
274587
|
}
|
|
274440
274588
|
);
|
|
274441
274589
|
});
|
|
@@ -274959,8 +275107,8 @@ var FullscreenTui = class {
|
|
|
274959
275107
|
this.start(this.budgetLimit);
|
|
274960
275108
|
}
|
|
274961
275109
|
process.stdout.write("\x1B[?25h");
|
|
274962
|
-
return new Promise((
|
|
274963
|
-
this.resolveInput =
|
|
275110
|
+
return new Promise((resolve26) => {
|
|
275111
|
+
this.resolveInput = resolve26;
|
|
274964
275112
|
this.inputBuffer = "";
|
|
274965
275113
|
this.cursorPosition = 0;
|
|
274966
275114
|
this.hideAutocomplete = false;
|
|
@@ -274995,7 +275143,7 @@ var FullscreenTui = class {
|
|
|
274995
275143
|
cleanup();
|
|
274996
275144
|
process.stdout.write("\x1B[?25l");
|
|
274997
275145
|
this.resolveInput = null;
|
|
274998
|
-
|
|
275146
|
+
resolve26(null);
|
|
274999
275147
|
} else {
|
|
275000
275148
|
this.ctrlCPressedOnce = true;
|
|
275001
275149
|
if (this.ctrlCTimeout) clearTimeout(this.ctrlCTimeout);
|
|
@@ -275049,7 +275197,7 @@ var FullscreenTui = class {
|
|
|
275049
275197
|
this.inputBuffer = "";
|
|
275050
275198
|
this.cursorPosition = 0;
|
|
275051
275199
|
this.render();
|
|
275052
|
-
|
|
275200
|
+
resolve26(submitted);
|
|
275053
275201
|
return;
|
|
275054
275202
|
}
|
|
275055
275203
|
if (key && key.ctrl && key.name === "j") {
|
|
@@ -276028,7 +276176,7 @@ import { z as z69 } from "zod";
|
|
|
276028
276176
|
import picocolors18 from "picocolors";
|
|
276029
276177
|
|
|
276030
276178
|
// src/commands/customCommands.ts
|
|
276031
|
-
import { existsSync as
|
|
276179
|
+
import { existsSync as existsSync17, readdirSync as readdirSync7 } from "fs";
|
|
276032
276180
|
import { basename as basename4, extname as extname3, join as join16 } from "path";
|
|
276033
276181
|
import { homedir as homedir8 } from "os";
|
|
276034
276182
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -276085,7 +276233,7 @@ function parseCommandFile(filePath, source) {
|
|
|
276085
276233
|
};
|
|
276086
276234
|
}
|
|
276087
276235
|
function loadDirectory(directory, source) {
|
|
276088
|
-
if (!
|
|
276236
|
+
if (!existsSync17(directory)) return [];
|
|
276089
276237
|
const commands = [];
|
|
276090
276238
|
const queue = [directory];
|
|
276091
276239
|
while (queue.length > 0 && commands.length < 200) {
|
|
@@ -276155,7 +276303,7 @@ function resolveBundledCommandsDirectory() {
|
|
|
276155
276303
|
new URL("../../commands/", import.meta.url),
|
|
276156
276304
|
new URL("../commands/", import.meta.url)
|
|
276157
276305
|
].map((candidate) => fileURLToPath3(candidate));
|
|
276158
|
-
return candidates.find((candidate) =>
|
|
276306
|
+
return candidates.find((candidate) => existsSync17(candidate)) ?? candidates[0];
|
|
276159
276307
|
}
|
|
276160
276308
|
function expandCustomCommand(command, rawArguments) {
|
|
276161
276309
|
const args = rawArguments.trim();
|
|
@@ -276240,12 +276388,12 @@ import { createRequire as createRequire2 } from "module";
|
|
|
276240
276388
|
// src/runtime/webui/WebUiRuntime.ts
|
|
276241
276389
|
import http2 from "http";
|
|
276242
276390
|
import { randomBytes as randomBytes3, randomUUID as randomUUID10 } from "crypto";
|
|
276243
|
-
import { isAbsolute as
|
|
276391
|
+
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve11 } from "path";
|
|
276244
276392
|
import { z as z58 } from "zod";
|
|
276245
276393
|
|
|
276246
276394
|
// src/runtime/AutocompleteCandidates.ts
|
|
276247
276395
|
import glob4 from "fast-glob";
|
|
276248
|
-
import { existsSync as
|
|
276396
|
+
import { existsSync as existsSync18, readdirSync as readdirSync8 } from "fs";
|
|
276249
276397
|
import { homedir as homedir9 } from "os";
|
|
276250
276398
|
import { dirname as dirname10, join as join17, resolve as resolve9 } from "path";
|
|
276251
276399
|
import { z as z55 } from "zod";
|
|
@@ -276308,7 +276456,7 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
276308
276456
|
}
|
|
276309
276457
|
try {
|
|
276310
276458
|
const indexPath = join17(cwd, ".orbit", "symbols.json");
|
|
276311
|
-
if (
|
|
276459
|
+
if (existsSync18(indexPath)) {
|
|
276312
276460
|
const raw = await readBoundedRegularFileAsync(
|
|
276313
276461
|
indexPath,
|
|
276314
276462
|
AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES
|
|
@@ -276330,9 +276478,9 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
|
|
|
276330
276478
|
cwd,
|
|
276331
276479
|
config.session?.path ?? ".orbit/sessions"
|
|
276332
276480
|
);
|
|
276333
|
-
if (
|
|
276481
|
+
if (existsSync18(sessionDir)) {
|
|
276334
276482
|
for (const dir of readdirSync8(sessionDir)) {
|
|
276335
|
-
if (
|
|
276483
|
+
if (existsSync18(join17(sessionDir, dir, "session.json"))) {
|
|
276336
276484
|
sessions.push(dir);
|
|
276337
276485
|
}
|
|
276338
276486
|
}
|
|
@@ -277070,6 +277218,77 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277070
277218
|
first.focus();
|
|
277071
277219
|
}
|
|
277072
277220
|
});
|
|
277221
|
+
const closeFullAccessDialog = (restoreFocus = true, approved = false) => {
|
|
277222
|
+
if (elements.fullAccessDialog.hidden) return;
|
|
277223
|
+
const request = state.fullAccessRequest;
|
|
277224
|
+
if (request && request.submitting) return;
|
|
277225
|
+
elements.fullAccessDialog.hidden = true;
|
|
277226
|
+
elements.fullAccessDialog.setAttribute('aria-hidden', 'true');
|
|
277227
|
+
elements.fullAccessDialog.removeAttribute('aria-busy');
|
|
277228
|
+
elements.fullAccessBackdrop.disabled = false;
|
|
277229
|
+
elements.fullAccessCancel.disabled = false;
|
|
277230
|
+
elements.fullAccessConfirm.disabled = false;
|
|
277231
|
+
elements.appShell.inert = false;
|
|
277232
|
+
state.fullAccessRequest = null;
|
|
277233
|
+
if (restoreFocus && state.fullAccessReturnFocus) state.fullAccessReturnFocus.focus();
|
|
277234
|
+
state.fullAccessReturnFocus = null;
|
|
277235
|
+
if (request) request.resolve(approved);
|
|
277236
|
+
if (!approved) void loadStatus().catch(() => {});
|
|
277237
|
+
};
|
|
277238
|
+
const requestPermissionMode = (mode, quiet = false) => {
|
|
277239
|
+
if (mode === 'auto' && state.status && state.status.permissions && state.status.permissions.fullAccess) {
|
|
277240
|
+
return Promise.resolve(true);
|
|
277241
|
+
}
|
|
277242
|
+
if (mode !== 'auto') {
|
|
277243
|
+
return applySettings({ permissionMode: mode }, quiet);
|
|
277244
|
+
}
|
|
277245
|
+
if (state.fullAccessRequest) return state.fullAccessRequest.promise;
|
|
277246
|
+
let resolveRequest;
|
|
277247
|
+
const promise = new Promise((resolve) => { resolveRequest = resolve; });
|
|
277248
|
+
state.fullAccessReturnFocus = document.activeElement;
|
|
277249
|
+
state.fullAccessRequest = {
|
|
277250
|
+
quiet,
|
|
277251
|
+
promise,
|
|
277252
|
+
resolve: resolveRequest,
|
|
277253
|
+
submitting: false,
|
|
277254
|
+
};
|
|
277255
|
+
elements.fullAccessDialog.hidden = false;
|
|
277256
|
+
elements.fullAccessDialog.setAttribute('aria-hidden', 'false');
|
|
277257
|
+
elements.appShell.inert = true;
|
|
277258
|
+
elements.fullAccessConfirm.focus();
|
|
277259
|
+
return promise;
|
|
277260
|
+
};
|
|
277261
|
+
elements.fullAccessBackdrop.addEventListener('click', () => closeFullAccessDialog());
|
|
277262
|
+
elements.fullAccessCancel.addEventListener('click', () => closeFullAccessDialog());
|
|
277263
|
+
elements.fullAccessConfirm.addEventListener('click', async () => {
|
|
277264
|
+
const request = state.fullAccessRequest;
|
|
277265
|
+
if (!request || request.submitting) return;
|
|
277266
|
+
request.submitting = true;
|
|
277267
|
+
elements.fullAccessDialog.setAttribute('aria-busy', 'true');
|
|
277268
|
+
elements.fullAccessBackdrop.disabled = true;
|
|
277269
|
+
elements.fullAccessCancel.disabled = true;
|
|
277270
|
+
elements.fullAccessConfirm.disabled = true;
|
|
277271
|
+
try {
|
|
277272
|
+
await applySettings({ permissionMode: 'auto', fullAccessConfirmed: true }, request.quiet);
|
|
277273
|
+
request.submitting = false;
|
|
277274
|
+
closeFullAccessDialog(true, true);
|
|
277275
|
+
} catch {
|
|
277276
|
+
request.submitting = false;
|
|
277277
|
+
closeFullAccessDialog();
|
|
277278
|
+
}
|
|
277279
|
+
});
|
|
277280
|
+
elements.fullAccessDialog.addEventListener('keydown', (event) => {
|
|
277281
|
+
if (event.key !== 'Tab') return;
|
|
277282
|
+
const first = elements.fullAccessCancel;
|
|
277283
|
+
const last = elements.fullAccessConfirm;
|
|
277284
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
277285
|
+
event.preventDefault();
|
|
277286
|
+
last.focus();
|
|
277287
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
277288
|
+
event.preventDefault();
|
|
277289
|
+
first.focus();
|
|
277290
|
+
}
|
|
277291
|
+
});
|
|
277073
277292
|
elements.commandsButton.addEventListener('click', openCommandPalette);
|
|
277074
277293
|
elements.commandTrigger.addEventListener('click', openCommandPalette);
|
|
277075
277294
|
elements.commandPaletteBackdrop.addEventListener('click', closeCommandPalette);
|
|
@@ -277145,7 +277364,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277145
277364
|
});
|
|
277146
277365
|
|
|
277147
277366
|
elements.permissionSelect.addEventListener('change', () => {
|
|
277148
|
-
|
|
277367
|
+
requestPermissionMode(elements.permissionSelect.value, true).catch(() => {});
|
|
277149
277368
|
});
|
|
277150
277369
|
|
|
277151
277370
|
elements.languageOptions.querySelectorAll('[data-language-value]').forEach((button) => {
|
|
@@ -277160,7 +277379,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277160
277379
|
});
|
|
277161
277380
|
|
|
277162
277381
|
elements.permissionSegments.querySelectorAll('[data-mode]').forEach((button) => {
|
|
277163
|
-
button.addEventListener('click', () =>
|
|
277382
|
+
button.addEventListener('click', () => requestPermissionMode(button.dataset.mode).catch(() => {}));
|
|
277164
277383
|
});
|
|
277165
277384
|
|
|
277166
277385
|
elements.searchToggle.addEventListener('click', () => {
|
|
@@ -277432,6 +277651,10 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
277432
277651
|
|
|
277433
277652
|
document.addEventListener('keydown', (event) => {
|
|
277434
277653
|
if (event.key === 'Escape') {
|
|
277654
|
+
if (!elements.fullAccessDialog.hidden) {
|
|
277655
|
+
closeFullAccessDialog();
|
|
277656
|
+
return;
|
|
277657
|
+
}
|
|
277435
277658
|
if (!elements.projectDialog.hidden) {
|
|
277436
277659
|
closeProjectDialog();
|
|
277437
277660
|
return;
|
|
@@ -278306,13 +278529,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278306
278529
|
modeNormal: '标准',
|
|
278307
278530
|
modeAuto: '全自动',
|
|
278308
278531
|
modePlan: '规划',
|
|
278309
|
-
permissionFullAccess: chinese('
|
|
278532
|
+
permissionFullAccess: chinese('完整权限已开启:所有已启用工具操作均自动批准。', '完整權限已開啟:所有已啟用工具操作均自動批准。'),
|
|
278310
278533
|
permissionAutoLimited: chinese('全自动尚未完全生效,部分操作仍需确认。', '全自動尚未完全生效,部分操作仍需確認。'),
|
|
278311
278534
|
permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
|
|
278312
278535
|
permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
|
|
278313
278536
|
permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
|
|
278314
|
-
permissionGuards: chinese('
|
|
278537
|
+
permissionGuards: chinese('危险操作会被阻止,显式文件路径会受保护;本机命令、成本与失控检查仍然有效。', '危險操作會被阻止,顯式檔案路徑會受保護;本機命令、成本與失控檢查仍然有效。'),
|
|
278315
278538
|
permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
|
|
278539
|
+
permissionNoGuards: chinese('权限策略不再拦截或复核危险、密钥、不透明、本地网络及工作区外操作。命令拥有当前系统账户权限并继承 Orbit 进程环境;已运行的子进程会保留这些权限直至停止。输出脱敏、项目钩子、验证契约、工具限制及成本与失控检查仍有效;工作区外改动无法由 Orbit 回滚。', '權限策略不再攔截或複核危險、密鑰、不透明、本機網路及工作區外操作。命令擁有目前系統帳戶權限並繼承 Orbit 程序環境;已執行的子程序會保留這些權限直至停止。輸出脫敏、專案掛鉤、驗證契約、工具限制及成本與失控檢查仍有效;工作區外變更無法由 Orbit 回滾。'),
|
|
278316
278540
|
}
|
|
278317
278541
|
: {
|
|
278318
278542
|
connected: 'Connected',
|
|
@@ -278458,13 +278682,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278458
278682
|
modeNormal: 'Normal',
|
|
278459
278683
|
modeAuto: 'Full access',
|
|
278460
278684
|
modePlan: 'Plan',
|
|
278461
|
-
permissionFullAccess: 'Full
|
|
278685
|
+
permissionFullAccess: 'Unrestricted Full Access is on: every enabled tool action is approved automatically.',
|
|
278462
278686
|
permissionAutoLimited: 'Full access is not fully active; some actions still require approval.',
|
|
278463
278687
|
permissionStrict: 'Strict mode asks before consequential operations.',
|
|
278464
278688
|
permissionNormal: 'Normal mode asks before writes and command execution.',
|
|
278465
278689
|
permissionPlan: 'Plan mode analyzes and reads without changing files.',
|
|
278466
|
-
permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded;
|
|
278690
|
+
permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; commands remain host processes and periodic cost/runaway checks stay active.',
|
|
278467
278691
|
permissionGuardsReduced: 'Warning: some hard safety guards are disabled in configuration.',
|
|
278692
|
+
permissionNoGuards: "The permission policy no longer blocks or reviews dangerous, protected, opaque, local-network, or outside-workspace actions. Commands use host-account permissions and inherit Orbit's process environment; running children retain that authority until stopped. Output redaction, project hooks, verification contracts, tool limits, and cost/runaway checks remain; outside-workspace changes have no Orbit rollback.",
|
|
278468
278693
|
};
|
|
278469
278694
|
|
|
278470
278695
|
if (language === 'zh-TW') {
|
|
@@ -278645,6 +278870,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278645
278870
|
sessionDeleteDialog: byId('sessionDeleteDialog'),
|
|
278646
278871
|
sessionDeleteBackdrop: byId('sessionDeleteBackdrop'),
|
|
278647
278872
|
sessionDeleteName: byId('sessionDeleteName'),
|
|
278873
|
+
fullAccessDialog: byId('fullAccessDialog'),
|
|
278874
|
+
fullAccessBackdrop: byId('fullAccessBackdrop'),
|
|
278875
|
+
fullAccessCancel: byId('fullAccessCancel'),
|
|
278876
|
+
fullAccessConfirm: byId('fullAccessConfirm'),
|
|
278648
278877
|
sessionDeleteCancel: byId('sessionDeleteCancel'),
|
|
278649
278878
|
sessionDeleteConfirm: byId('sessionDeleteConfirm'),
|
|
278650
278879
|
newTaskButton: byId('newTaskButton'),
|
|
@@ -278817,6 +279046,8 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
278817
279046
|
sessionQuery: '',
|
|
278818
279047
|
sessionLimit: 24,
|
|
278819
279048
|
sessionDeleteReturnFocus: null,
|
|
279049
|
+
fullAccessReturnFocus: null,
|
|
279050
|
+
fullAccessRequest: null,
|
|
278820
279051
|
projectDialogReturnFocus: null,
|
|
278821
279052
|
projectPickerPending: false,
|
|
278822
279053
|
projectLaunchPending: false,
|
|
@@ -280516,7 +280747,7 @@ var WEB_UI_CLIENT_PALETTE_SCRIPT = String.raw` let paletteActions = [];
|
|
|
280516
280747
|
detail: copy.switchMode,
|
|
280517
280748
|
keywords: 'permission mode security ' + mode,
|
|
280518
280749
|
idle: true,
|
|
280519
|
-
run: () =>
|
|
280750
|
+
run: () => requestPermissionMode(mode, false),
|
|
280520
280751
|
});
|
|
280521
280752
|
}
|
|
280522
280753
|
return actions;
|
|
@@ -281470,7 +281701,11 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
281470
281701
|
const hardGuardsEnabled = permissions.dangerousCommandsBlocked !== false
|
|
281471
281702
|
&& permissions.secretsProtected !== false
|
|
281472
281703
|
&& permissions.workspaceBoundary !== false;
|
|
281473
|
-
const permissionSummary = modeSummary + ' ' + (
|
|
281704
|
+
const permissionSummary = modeSummary + ' ' + (permissions.fullAccess
|
|
281705
|
+
? copy.permissionNoGuards
|
|
281706
|
+
: hardGuardsEnabled
|
|
281707
|
+
? copy.permissionGuards
|
|
281708
|
+
: copy.permissionGuardsReduced);
|
|
281474
281709
|
if (elements.permissionSummary.textContent !== permissionSummary) {
|
|
281475
281710
|
elements.permissionSummary.textContent = permissionSummary;
|
|
281476
281711
|
}
|
|
@@ -282981,6 +283216,7 @@ function completionFileScore(file, query) {
|
|
|
282981
283216
|
}
|
|
282982
283217
|
function collectWebUiStatus(options, activeTurn) {
|
|
282983
283218
|
const { cwd, config, loop } = options;
|
|
283219
|
+
const fullAccess = isFullAccessEnabled(config);
|
|
282984
283220
|
const sessions = safeCall(() => loop?.getSessions?.()) || [];
|
|
282985
283221
|
const relevantFiles = safeCall(() => loop?.getRelevantFiles?.()) || [];
|
|
282986
283222
|
const history = safeCall(() => loop?.getHistory?.()) || [];
|
|
@@ -283052,12 +283288,12 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
283052
283288
|
modelOptions: buildModelOptions(options, activeModel2),
|
|
283053
283289
|
permissions: {
|
|
283054
283290
|
mode: config.permissions.mode,
|
|
283055
|
-
fullAccess
|
|
283291
|
+
fullAccess,
|
|
283056
283292
|
writeApproval: config.permissions.requireApprovalForWrite,
|
|
283057
283293
|
commandApproval: config.permissions.requireApprovalForBash,
|
|
283058
283294
|
dangerousCommandsBlocked: config.permissions.blockDangerousCommands,
|
|
283059
283295
|
secretsProtected: config.permissions.protectSecrets,
|
|
283060
|
-
workspaceBoundary:
|
|
283296
|
+
workspaceBoundary: !fullAccess
|
|
283061
283297
|
},
|
|
283062
283298
|
tools: {
|
|
283063
283299
|
webSearch: {
|
|
@@ -283957,7 +284193,13 @@ var BASE_COPY = {
|
|
|
283957
284193
|
apply: "Apply",
|
|
283958
284194
|
permission: "Permission mode",
|
|
283959
284195
|
permissionDescription: "Choose how much Orbit may do without interrupting you.",
|
|
283960
|
-
permissionGuardLabel: "
|
|
284196
|
+
permissionGuardLabel: "The active permission scope and remaining safeguards appear here.",
|
|
284197
|
+
fullAccessConfirmTitle: "Grant unrestricted Full Access?",
|
|
284198
|
+
fullAccessConfirmBody: "Orbit's permission policy will approve every enabled tool action without asking or requesting post-write review.",
|
|
284199
|
+
fullAccessConfirmScope: "Reads, writes, local/private network calls, dangerous operations, protected paths, and outside-workspace commands run automatically.",
|
|
284200
|
+
fullAccessConfirmGuards: "No permission guard remains. Opaque interpreters and commands that can delete or overwrite host data are also approved.",
|
|
284201
|
+
fullAccessConfirmHost: "Actions receive your operating-system account's permissions, and child commands inherit the Orbit process environment, including credential variables; already-running children keep that authority until stopped. Credential values remain redacted from logs and model-visible output. Outside-workspace changes are not covered by Orbit rollback. Project hooks, verification contracts, tool limits, cancellation, and cost/runaway checks remain active.",
|
|
284202
|
+
fullAccessConfirmAction: "Grant Full Access",
|
|
283961
284203
|
modeStrict: "Strict",
|
|
283962
284204
|
modeNormal: "Normal",
|
|
283963
284205
|
modeAuto: "Full access",
|
|
@@ -284137,7 +284379,13 @@ var BASE_COPY = {
|
|
|
284137
284379
|
apply: "\u5E94\u7528",
|
|
284138
284380
|
permission: "\u6743\u9650\u6A21\u5F0F",
|
|
284139
284381
|
permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
284140
|
-
permissionGuardLabel: "\
|
|
284382
|
+
permissionGuardLabel: "\u8FD9\u91CC\u4F1A\u663E\u793A\u5F53\u524D\u6743\u9650\u8303\u56F4\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u62A4\u673A\u5236\u3002",
|
|
284383
|
+
fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
|
|
284384
|
+
fullAccessConfirmBody: "Orbit \u7684\u6743\u9650\u7B56\u7565\u5C06\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DF2\u542F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8BE2\u95EE\u6216\u8981\u6C42\u5199\u5165\u540E\u590D\u6838\u3002",
|
|
284385
|
+
fullAccessConfirmScope: "\u8BFB\u53D6\u3001\u5199\u5165\u3001\u672C\u5730\u6216\u79C1\u6709\u7F51\u7EDC\u8BBF\u95EE\u3001\u5371\u9669\u64CD\u4F5C\u3001\u5BC6\u94A5\u8DEF\u5F84\u53CA\u5DE5\u4F5C\u533A\u5916\u547D\u4EE4\u5747\u4F1A\u81EA\u52A8\u6267\u884C\u3002",
|
|
284386
|
+
fullAccessConfirmGuards: "\u6743\u9650\u4FDD\u62A4\u5C06\u5168\u90E8\u5173\u95ED\uFF1B\u4E0D\u900F\u660E\u89E3\u91CA\u5668\u4EE5\u53CA\u53EF\u80FD\u5220\u9664\u6216\u8986\u76D6\u4E3B\u673A\u6570\u636E\u7684\u547D\u4EE4\u4E5F\u4F1A\u83B7\u51C6\u6267\u884C\u3002",
|
|
284387
|
+
fullAccessConfirmHost: "\u64CD\u4F5C\u62E5\u6709\u5F53\u524D\u7CFB\u7EDF\u8D26\u6237\u7684\u6743\u9650\uFF0C\u5B50\u547D\u4EE4\u4F1A\u7EE7\u627F Orbit \u8FDB\u7A0B\u73AF\u5883\uFF0C\u5305\u62EC\u51ED\u636E\u53D8\u91CF\uFF1B\u5DF2\u8FD0\u884C\u7684\u5B50\u8FDB\u7A0B\u4F1A\u4FDD\u7559\u8FD9\u4E9B\u6743\u9650\u76F4\u81F3\u505C\u6B62\u3002\u51ED\u636E\u503C\u4ECD\u4F1A\u4ECE\u65E5\u5FD7\u548C\u6A21\u578B\u53EF\u89C1\u8F93\u51FA\u4E2D\u8131\u654F\uFF0C\u5DE5\u4F5C\u533A\u5916\u6539\u52A8\u4E0D\u53D7 Orbit \u56DE\u6EDA\u4FDD\u62A4\u3002\u9879\u76EE\u94A9\u5B50\u3001\u9A8C\u8BC1\u5951\u7EA6\u3001\u5DE5\u5177\u9650\u5236\u3001\u53D6\u6D88\u80FD\u529B\u4EE5\u53CA\u6210\u672C\u4E0E\u5931\u63A7\u68C0\u67E5\u4ECD\u7136\u6709\u6548\u3002",
|
|
284388
|
+
fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6743\u9650",
|
|
284141
284389
|
modeStrict: "\u4E25\u683C",
|
|
284142
284390
|
modeNormal: "\u6807\u51C6",
|
|
284143
284391
|
modeAuto: "\u5168\u81EA\u52A8",
|
|
@@ -284289,7 +284537,13 @@ var COPY = {
|
|
|
284289
284537
|
apply: "\u5957\u7528",
|
|
284290
284538
|
permission: "\u6B0A\u9650\u6A21\u5F0F",
|
|
284291
284539
|
permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
|
|
284292
|
-
permissionGuardLabel: "\
|
|
284540
|
+
permissionGuardLabel: "\u9019\u88E1\u6703\u986F\u793A\u76EE\u524D\u6B0A\u9650\u7BC4\u570D\u4EE5\u53CA\u4ECD\u7136\u751F\u6548\u7684\u4FDD\u8B77\u6A5F\u5236\u3002",
|
|
284541
|
+
fullAccessConfirmTitle: "\u6388\u4E88\u5B8C\u6574 Full Access\uFF1F",
|
|
284542
|
+
fullAccessConfirmBody: "Orbit \u7684\u6B0A\u9650\u7B56\u7565\u5C07\u81EA\u52D5\u6279\u51C6\u6240\u6709\u5DF2\u555F\u7528\u5DE5\u5177\u64CD\u4F5C\uFF0C\u4E0D\u518D\u8A62\u554F\u6216\u8981\u6C42\u5BEB\u5165\u5F8C\u8907\u6838\u3002",
|
|
284543
|
+
fullAccessConfirmScope: "\u8B80\u53D6\u3001\u5BEB\u5165\u3001\u672C\u6A5F\u6216\u79C1\u6709\u7DB2\u8DEF\u5B58\u53D6\u3001\u5371\u96AA\u64CD\u4F5C\u3001\u5BC6\u9470\u8DEF\u5F91\u53CA\u5DE5\u4F5C\u5340\u5916\u547D\u4EE4\u5747\u6703\u81EA\u52D5\u57F7\u884C\u3002",
|
|
284544
|
+
fullAccessConfirmGuards: "\u6B0A\u9650\u4FDD\u8B77\u5C07\u5168\u90E8\u95DC\u9589\uFF1B\u4E0D\u900F\u660E\u89E3\u8B6F\u5668\u4EE5\u53CA\u53EF\u80FD\u522A\u9664\u6216\u8986\u5BEB\u4E3B\u6A5F\u8CC7\u6599\u7684\u547D\u4EE4\u4E5F\u6703\u7372\u51C6\u57F7\u884C\u3002",
|
|
284545
|
+
fullAccessConfirmHost: "\u64CD\u4F5C\u64C1\u6709\u76EE\u524D\u7CFB\u7D71\u5E33\u6236\u7684\u6B0A\u9650\uFF0C\u5B50\u547D\u4EE4\u6703\u7E7C\u627F Orbit \u7A0B\u5E8F\u74B0\u5883\uFF0C\u5305\u62EC\u6191\u64DA\u8B8A\u6578\uFF1B\u5DF2\u57F7\u884C\u7684\u5B50\u7A0B\u5E8F\u6703\u4FDD\u7559\u9019\u4E9B\u6B0A\u9650\u76F4\u81F3\u505C\u6B62\u3002\u6191\u64DA\u503C\u4ECD\u6703\u5F9E\u65E5\u8A8C\u548C\u6A21\u578B\u53EF\u898B\u8F38\u51FA\u4E2D\u812B\u654F\uFF0C\u5DE5\u4F5C\u5340\u5916\u8B8A\u66F4\u4E0D\u53D7 Orbit \u56DE\u6EFE\u4FDD\u8B77\u3002\u5C08\u6848\u639B\u9264\u3001\u9A57\u8B49\u5951\u7D04\u3001\u5DE5\u5177\u9650\u5236\u3001\u53D6\u6D88\u80FD\u529B\u4EE5\u53CA\u6210\u672C\u8207\u5931\u63A7\u6AA2\u67E5\u4ECD\u7136\u6709\u6548\u3002",
|
|
284546
|
+
fullAccessConfirmAction: "\u6388\u4E88\u5B8C\u6574\u6B0A\u9650",
|
|
284293
284547
|
modeStrict: "\u56B4\u683C",
|
|
284294
284548
|
modeNormal: "\u6A19\u6E96",
|
|
284295
284549
|
modeAuto: "\u5168\u81EA\u52D5",
|
|
@@ -284917,6 +285171,25 @@ function renderWebUiPage(language) {
|
|
|
284917
285171
|
</div>
|
|
284918
285172
|
</section>
|
|
284919
285173
|
</div>
|
|
285174
|
+
<div class="full-access-dialog" id="fullAccessDialog" aria-hidden="true" hidden>
|
|
285175
|
+
<button class="full-access-backdrop" id="fullAccessBackdrop" type="button" aria-label="${copy.cancel}" tabindex="-1"></button>
|
|
285176
|
+
<section class="full-access-card" role="alertdialog" aria-modal="true" aria-labelledby="fullAccessTitle" aria-describedby="fullAccessBody fullAccessDetails">
|
|
285177
|
+
<span class="full-access-mark" aria-hidden="true">\u25C6</span>
|
|
285178
|
+
<div class="full-access-copy">
|
|
285179
|
+
<h2 id="fullAccessTitle">${copy.fullAccessConfirmTitle}</h2>
|
|
285180
|
+
<p id="fullAccessBody">${copy.fullAccessConfirmBody}</p>
|
|
285181
|
+
<ul id="fullAccessDetails">
|
|
285182
|
+
<li>${copy.fullAccessConfirmScope}</li>
|
|
285183
|
+
<li>${copy.fullAccessConfirmGuards}</li>
|
|
285184
|
+
<li>${copy.fullAccessConfirmHost}</li>
|
|
285185
|
+
</ul>
|
|
285186
|
+
</div>
|
|
285187
|
+
<div class="full-access-actions">
|
|
285188
|
+
<button class="full-access-cancel" id="fullAccessCancel" type="button">${copy.cancel}</button>
|
|
285189
|
+
<button class="full-access-confirm" id="fullAccessConfirm" type="button">${copy.fullAccessConfirmAction}</button>
|
|
285190
|
+
</div>
|
|
285191
|
+
</section>
|
|
285192
|
+
</div>
|
|
284920
285193
|
<div class="project-dialog" id="projectDialog" aria-hidden="true" hidden>
|
|
284921
285194
|
<button class="project-dialog-backdrop" id="projectDialogBackdrop" type="button" aria-label="${copy.cancel}" tabindex="-1"></button>
|
|
284922
285195
|
<section class="project-dialog-card" role="dialog" aria-modal="true" aria-labelledby="projectDialogTitle" aria-describedby="projectDialogBody">
|
|
@@ -287454,6 +287727,136 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
|
|
|
287454
287727
|
outline-offset: 2px;
|
|
287455
287728
|
}
|
|
287456
287729
|
|
|
287730
|
+
.full-access-dialog {
|
|
287731
|
+
position: fixed;
|
|
287732
|
+
inset: 0;
|
|
287733
|
+
z-index: 215;
|
|
287734
|
+
display: grid;
|
|
287735
|
+
place-items: center;
|
|
287736
|
+
padding: 20px;
|
|
287737
|
+
}
|
|
287738
|
+
|
|
287739
|
+
.full-access-dialog[hidden] {
|
|
287740
|
+
display: none;
|
|
287741
|
+
}
|
|
287742
|
+
|
|
287743
|
+
.full-access-backdrop {
|
|
287744
|
+
position: absolute;
|
|
287745
|
+
inset: 0;
|
|
287746
|
+
width: 100%;
|
|
287747
|
+
height: 100%;
|
|
287748
|
+
padding: 0;
|
|
287749
|
+
background: var(--scrim);
|
|
287750
|
+
border: 0;
|
|
287751
|
+
backdrop-filter: blur(3px);
|
|
287752
|
+
}
|
|
287753
|
+
|
|
287754
|
+
.full-access-card {
|
|
287755
|
+
position: relative;
|
|
287756
|
+
width: min(520px, calc(100vw - 32px));
|
|
287757
|
+
max-height: calc(100dvh - 40px);
|
|
287758
|
+
overflow-y: auto;
|
|
287759
|
+
overscroll-behavior: contain;
|
|
287760
|
+
scrollbar-gutter: stable;
|
|
287761
|
+
display: grid;
|
|
287762
|
+
grid-template-columns: 36px minmax(0, 1fr);
|
|
287763
|
+
gap: 13px;
|
|
287764
|
+
padding: 19px;
|
|
287765
|
+
color: var(--ink);
|
|
287766
|
+
background: var(--surface-raised);
|
|
287767
|
+
border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--border-strong));
|
|
287768
|
+
border-radius: 17px;
|
|
287769
|
+
box-shadow: var(--shadow-lg);
|
|
287770
|
+
}
|
|
287771
|
+
|
|
287772
|
+
.full-access-mark {
|
|
287773
|
+
width: 34px;
|
|
287774
|
+
height: 34px;
|
|
287775
|
+
display: grid;
|
|
287776
|
+
place-items: center;
|
|
287777
|
+
color: color-mix(in srgb, var(--warning) 75%, var(--ink));
|
|
287778
|
+
background: var(--warning-soft);
|
|
287779
|
+
border-radius: 11px;
|
|
287780
|
+
font: 700 13px/1 var(--font-mono);
|
|
287781
|
+
}
|
|
287782
|
+
|
|
287783
|
+
.full-access-copy {
|
|
287784
|
+
min-width: 0;
|
|
287785
|
+
}
|
|
287786
|
+
|
|
287787
|
+
.full-access-copy h2,
|
|
287788
|
+
.full-access-copy p {
|
|
287789
|
+
margin: 0;
|
|
287790
|
+
}
|
|
287791
|
+
|
|
287792
|
+
.full-access-copy h2 {
|
|
287793
|
+
color: var(--ink-strong);
|
|
287794
|
+
font-size: 16px;
|
|
287795
|
+
}
|
|
287796
|
+
|
|
287797
|
+
.full-access-copy p,
|
|
287798
|
+
.full-access-copy li {
|
|
287799
|
+
color: var(--muted);
|
|
287800
|
+
font-size: 12px;
|
|
287801
|
+
line-height: 1.55;
|
|
287802
|
+
}
|
|
287803
|
+
|
|
287804
|
+
.full-access-copy p {
|
|
287805
|
+
margin-top: 5px;
|
|
287806
|
+
}
|
|
287807
|
+
|
|
287808
|
+
.full-access-copy ul {
|
|
287809
|
+
display: grid;
|
|
287810
|
+
gap: 6px;
|
|
287811
|
+
margin: 12px 0 0;
|
|
287812
|
+
padding-left: 18px;
|
|
287813
|
+
}
|
|
287814
|
+
|
|
287815
|
+
.full-access-actions {
|
|
287816
|
+
grid-column: 1 / -1;
|
|
287817
|
+
display: flex;
|
|
287818
|
+
justify-content: flex-end;
|
|
287819
|
+
gap: 8px;
|
|
287820
|
+
margin-top: 4px;
|
|
287821
|
+
}
|
|
287822
|
+
|
|
287823
|
+
.full-access-actions button {
|
|
287824
|
+
min-height: 35px;
|
|
287825
|
+
padding: 0 13px;
|
|
287826
|
+
border-radius: 9px;
|
|
287827
|
+
font-size: 12px;
|
|
287828
|
+
font-weight: 650;
|
|
287829
|
+
}
|
|
287830
|
+
|
|
287831
|
+
.full-access-cancel {
|
|
287832
|
+
color: var(--muted);
|
|
287833
|
+
background: var(--surface-subtle);
|
|
287834
|
+
border: 1px solid var(--border);
|
|
287835
|
+
}
|
|
287836
|
+
|
|
287837
|
+
.full-access-confirm {
|
|
287838
|
+
color: var(--surface-raised);
|
|
287839
|
+
background: var(--accent-strong);
|
|
287840
|
+
border: 1px solid var(--accent-strong);
|
|
287841
|
+
}
|
|
287842
|
+
|
|
287843
|
+
.full-access-actions button:focus-visible {
|
|
287844
|
+
outline: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
|
|
287845
|
+
outline-offset: 2px;
|
|
287846
|
+
}
|
|
287847
|
+
|
|
287848
|
+
.full-access-actions button:disabled {
|
|
287849
|
+
cursor: wait;
|
|
287850
|
+
opacity: 0.55;
|
|
287851
|
+
}
|
|
287852
|
+
|
|
287853
|
+
@media (max-width: 560px) {
|
|
287854
|
+
.full-access-dialog { padding: 14px; }
|
|
287855
|
+
.full-access-card { width: min(100%, 520px); max-height: calc(100dvh - 28px); padding: 16px; }
|
|
287856
|
+
.full-access-actions { display: grid; grid-template-columns: 1fr 1fr; }
|
|
287857
|
+
.full-access-actions button { width: 100%; }
|
|
287858
|
+
}
|
|
287859
|
+
|
|
287457
287860
|
.toast-region {
|
|
287458
287861
|
position: fixed;
|
|
287459
287862
|
z-index: 100;
|
|
@@ -291580,6 +291983,7 @@ var SettingsPatchSchema = z58.object({
|
|
|
291580
291983
|
provider: z58.string().trim().min(1).max(256).optional(),
|
|
291581
291984
|
model: z58.string().trim().min(1).max(200).optional(),
|
|
291582
291985
|
permissionMode: z58.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
291986
|
+
fullAccessConfirmed: z58.literal(true).optional(),
|
|
291583
291987
|
webSearchEnabled: z58.boolean().optional(),
|
|
291584
291988
|
webSearchProvider: z58.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
|
|
291585
291989
|
webSearchMaxResults: z58.number().int().min(1).max(20).optional(),
|
|
@@ -291587,7 +291991,15 @@ var SettingsPatchSchema = z58.object({
|
|
|
291587
291991
|
skillsActivation: z58.enum(["auto", "explicit"]).optional(),
|
|
291588
291992
|
skillsMaxActive: z58.number().int().min(0).max(8).optional(),
|
|
291589
291993
|
skillsDisabled: z58.array(z58.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).max(200).optional()
|
|
291590
|
-
}).strict()
|
|
291994
|
+
}).strict().superRefine((patch, context) => {
|
|
291995
|
+
if (patch.permissionMode === "auto" && patch.fullAccessConfirmed !== true) {
|
|
291996
|
+
context.addIssue({
|
|
291997
|
+
code: z58.ZodIssueCode.custom,
|
|
291998
|
+
path: ["fullAccessConfirmed"],
|
|
291999
|
+
message: "Full Access requires explicit confirmation."
|
|
292000
|
+
});
|
|
292001
|
+
}
|
|
292002
|
+
});
|
|
291591
292003
|
var CapabilityNameSchema2 = z58.string().trim().min(1).max(48).regex(/^[a-z0-9][a-z0-9-]*$/);
|
|
291592
292004
|
var CapabilityCreateSchema = z58.discriminatedUnion("kind", [
|
|
291593
292005
|
z58.object({
|
|
@@ -292361,6 +292773,7 @@ var OrbitWebUiRuntime = class {
|
|
|
292361
292773
|
}
|
|
292362
292774
|
try {
|
|
292363
292775
|
const patch = SettingsPatchSchema.parse(await readJsonBody(req));
|
|
292776
|
+
delete patch.fullAccessConfirmed;
|
|
292364
292777
|
const result = await options.updateSettings(patch);
|
|
292365
292778
|
sendJson(res, result.ok ? 200 : 400, sanitizeActionResult(result));
|
|
292366
292779
|
} catch (error) {
|
|
@@ -292496,7 +292909,7 @@ function isSkillScopeDiscoverable(cwd, configuredDirectories, scope) {
|
|
|
292496
292909
|
);
|
|
292497
292910
|
return resolveSkillDirectories(cwd, configuredDirectories).some((root) => {
|
|
292498
292911
|
const pathFromRoot = relative8(root, target);
|
|
292499
|
-
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !
|
|
292912
|
+
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute6(pathFromRoot);
|
|
292500
292913
|
});
|
|
292501
292914
|
}
|
|
292502
292915
|
function matchesImageSignature(mediaType, body) {
|
|
@@ -292582,8 +292995,8 @@ var WebUiApprovalBroker = class {
|
|
|
292582
292995
|
throw new Error("Web UI approval queue capacity was reached.");
|
|
292583
292996
|
}
|
|
292584
292997
|
const snapshot = sanitizeApprovalRequest(request);
|
|
292585
|
-
return new Promise((
|
|
292586
|
-
const approval = { snapshot, resolve:
|
|
292998
|
+
return new Promise((resolve26) => {
|
|
292999
|
+
const approval = { snapshot, resolve: resolve26 };
|
|
292587
293000
|
if (this.pending) this.queued.push(approval);
|
|
292588
293001
|
else this.activate(approval);
|
|
292589
293002
|
});
|
|
@@ -293062,8 +293475,8 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
293062
293475
|
|
|
293063
293476
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
293064
293477
|
import glob5 from "fast-glob";
|
|
293065
|
-
import { existsSync as
|
|
293066
|
-
import { isAbsolute as
|
|
293478
|
+
import { existsSync as existsSync19, statSync as statSync4 } from "fs";
|
|
293479
|
+
import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve12 } from "path";
|
|
293067
293480
|
import picocolors12 from "picocolors";
|
|
293068
293481
|
function parseAddArgument(argument) {
|
|
293069
293482
|
const match = argument.match(/^(--read-only|--readonly|-r)(?:\s+|$)/);
|
|
@@ -293086,7 +293499,7 @@ function containsWildcard(value) {
|
|
|
293086
293499
|
return value.includes("*") || value.includes("?");
|
|
293087
293500
|
}
|
|
293088
293501
|
function isUnsafePattern(value) {
|
|
293089
|
-
return
|
|
293502
|
+
return isAbsolute7(value) || value.replace(/\\/g, "/").split("/").some((segment) => segment === "..");
|
|
293090
293503
|
}
|
|
293091
293504
|
function wildcardExpression(pattern) {
|
|
293092
293505
|
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__\/?/g, "(?:|.*/)");
|
|
@@ -293212,7 +293625,7 @@ async function handleAdd(argument, dependencies) {
|
|
|
293212
293625
|
);
|
|
293213
293626
|
return HANDLED_COMMAND;
|
|
293214
293627
|
}
|
|
293215
|
-
if (!
|
|
293628
|
+
if (!existsSync19(absolutePath)) {
|
|
293216
293629
|
const normalizedArgument = fileArgument.toLowerCase();
|
|
293217
293630
|
const matched = candidates.filter(
|
|
293218
293631
|
(file) => file.toLowerCase().includes(normalizedArgument) || file.toLowerCase().endsWith(`/${normalizedArgument}`)
|
|
@@ -293415,7 +293828,7 @@ async function handleContextCommand(command, argument, dependencies) {
|
|
|
293415
293828
|
|
|
293416
293829
|
// src/runtime/commands/RollbackCommandHandler.ts
|
|
293417
293830
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
293418
|
-
import { existsSync as
|
|
293831
|
+
import { existsSync as existsSync20, lstatSync as lstatSync7, mkdirSync as mkdirSync6, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
293419
293832
|
import { dirname as dirname12 } from "path";
|
|
293420
293833
|
import picocolors13 from "picocolors";
|
|
293421
293834
|
import { z as z59 } from "zod";
|
|
@@ -293769,7 +294182,7 @@ function restoreWorkspaceSnapshot(cwd, snapshots) {
|
|
|
293769
294182
|
rmSync5(absolutePath, { recursive: true, force: true });
|
|
293770
294183
|
continue;
|
|
293771
294184
|
}
|
|
293772
|
-
if (
|
|
294185
|
+
if (existsSync20(absolutePath)) {
|
|
293773
294186
|
const stats = lstatSync7(absolutePath);
|
|
293774
294187
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
293775
294188
|
throw new Error(
|
|
@@ -293797,7 +294210,7 @@ function restoreGitStatusEntry(entry, dependencies, git) {
|
|
|
293797
294210
|
const removePath = dependencies.removePath ?? removeWorkspacePath;
|
|
293798
294211
|
const removeDestination = () => {
|
|
293799
294212
|
const absolutePath = resolveSafePath(dependencies.cwd, entry.path);
|
|
293800
|
-
if (
|
|
294213
|
+
if (existsSync20(absolutePath)) removePath(absolutePath);
|
|
293801
294214
|
};
|
|
293802
294215
|
if (entry.status === "??" || entry.status.includes("A")) {
|
|
293803
294216
|
removeDestination();
|
|
@@ -294522,8 +294935,8 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
294522
294935
|
|
|
294523
294936
|
// src/runtime/ProjectLauncher.ts
|
|
294524
294937
|
import { spawn as spawn4 } from "child_process";
|
|
294525
|
-
import { existsSync as
|
|
294526
|
-
import { dirname as dirname13, isAbsolute as
|
|
294938
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
294939
|
+
import { dirname as dirname13, isAbsolute as isAbsolute8, parse as parse4, resolve as resolve13 } from "path";
|
|
294527
294940
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
294528
294941
|
var ProjectLaunchError = class extends Error {
|
|
294529
294942
|
constructor(code, message2, options) {
|
|
@@ -294534,7 +294947,7 @@ var ProjectLaunchError = class extends Error {
|
|
|
294534
294947
|
name = "ProjectLaunchError";
|
|
294535
294948
|
};
|
|
294536
294949
|
async function launchOrbitProject(request, options = {}) {
|
|
294537
|
-
if (!
|
|
294950
|
+
if (!isAbsolute8(request.path)) {
|
|
294538
294951
|
throw new ProjectLaunchError(
|
|
294539
294952
|
"absolute_path_required",
|
|
294540
294953
|
"Enter an absolute project folder path."
|
|
@@ -294645,12 +295058,12 @@ function parseReadyUrl(message2) {
|
|
|
294645
295058
|
return sanitizeLocalWebUiUrl(message2.url);
|
|
294646
295059
|
}
|
|
294647
295060
|
function ensureProjectDirectory(projectPath) {
|
|
294648
|
-
if (
|
|
295061
|
+
if (existsSync21(projectPath)) {
|
|
294649
295062
|
requireProjectDirectory(projectPath);
|
|
294650
295063
|
return;
|
|
294651
295064
|
}
|
|
294652
295065
|
const parentPath = dirname13(projectPath);
|
|
294653
|
-
if (!
|
|
295066
|
+
if (!existsSync21(parentPath)) {
|
|
294654
295067
|
throw new ProjectLaunchError(
|
|
294655
295068
|
"parent_missing",
|
|
294656
295069
|
"The parent folder does not exist. Choose an existing location first."
|
|
@@ -294677,7 +295090,7 @@ function ensureProjectDirectory(projectPath) {
|
|
|
294677
295090
|
}
|
|
294678
295091
|
}
|
|
294679
295092
|
function requireProjectDirectory(projectPath) {
|
|
294680
|
-
if (!
|
|
295093
|
+
if (!existsSync21(projectPath)) {
|
|
294681
295094
|
throw new ProjectLaunchError(
|
|
294682
295095
|
"project_missing",
|
|
294683
295096
|
"Project folder does not exist."
|
|
@@ -295397,7 +295810,7 @@ async function confirmUpdate(prompt) {
|
|
|
295397
295810
|
});
|
|
295398
295811
|
try {
|
|
295399
295812
|
const answer = await new Promise(
|
|
295400
|
-
(
|
|
295813
|
+
(resolve26) => interfaceInstance.question(prompt, resolve26)
|
|
295401
295814
|
);
|
|
295402
295815
|
return /^(?:y|yes)$/i.test(answer.trim());
|
|
295403
295816
|
} finally {
|
|
@@ -296295,17 +296708,18 @@ var CommandRouter = class {
|
|
|
296295
296708
|
const commitMsg = parts.slice(1).join(" ").trim();
|
|
296296
296709
|
const isZh = config.language !== "en";
|
|
296297
296710
|
const { execFileSync: execFileSync9, execSync: execSync3 } = await import("child_process");
|
|
296711
|
+
const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
|
|
296298
296712
|
try {
|
|
296299
296713
|
let diff = execSync3("git diff --cached", {
|
|
296300
296714
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296301
296715
|
cwd,
|
|
296302
|
-
env:
|
|
296716
|
+
env: childEnvironment
|
|
296303
296717
|
}).toString().trim();
|
|
296304
296718
|
if (!diff) {
|
|
296305
296719
|
const unstaged = execSync3("git status --porcelain", {
|
|
296306
296720
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296307
296721
|
cwd,
|
|
296308
|
-
env:
|
|
296722
|
+
env: childEnvironment
|
|
296309
296723
|
}).toString().trim();
|
|
296310
296724
|
if (!unstaged) {
|
|
296311
296725
|
this.printOutput(
|
|
@@ -296315,7 +296729,7 @@ var CommandRouter = class {
|
|
|
296315
296729
|
);
|
|
296316
296730
|
return { shouldExit: false, processed: true };
|
|
296317
296731
|
}
|
|
296318
|
-
const autoStage = await Prompt.askApproval(
|
|
296732
|
+
const autoStage = isFullAccessEnabled(config) || await Prompt.askApproval(
|
|
296319
296733
|
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
296734
|
);
|
|
296321
296735
|
if (!autoStage) {
|
|
@@ -296332,12 +296746,12 @@ var CommandRouter = class {
|
|
|
296332
296746
|
execSync3("git add -A", {
|
|
296333
296747
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296334
296748
|
cwd,
|
|
296335
|
-
env:
|
|
296749
|
+
env: childEnvironment
|
|
296336
296750
|
});
|
|
296337
296751
|
diff = execSync3("git diff --cached", {
|
|
296338
296752
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296339
296753
|
cwd,
|
|
296340
|
-
env:
|
|
296754
|
+
env: childEnvironment
|
|
296341
296755
|
}).toString().trim();
|
|
296342
296756
|
if (!diff) {
|
|
296343
296757
|
this.printOutput(
|
|
@@ -296386,7 +296800,7 @@ ${buildCommitDiffForModel(diff)}`
|
|
|
296386
296800
|
execFileSync9("git", ["commit", "-m", finalMsg], {
|
|
296387
296801
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
296388
296802
|
cwd,
|
|
296389
|
-
env:
|
|
296803
|
+
env: childEnvironment
|
|
296390
296804
|
});
|
|
296391
296805
|
this.printOutput(
|
|
296392
296806
|
picocolors18.green("\u2714 Git commit created successfully.")
|
|
@@ -296422,12 +296836,12 @@ ${buildCommitDiffForModel(diff)}`
|
|
|
296422
296836
|
const modeDescriptions = isZh ? {
|
|
296423
296837
|
strict: "Strict \u2014 \u6240\u6709\u5DE5\u5177\u8C03\u7528\u5FC5\u987B\u9010\u4E00\u786E\u8BA4",
|
|
296424
296838
|
normal: "Normal \u2014 \u5199\u5165/\u6267\u884C\u64CD\u4F5C\u9700\u8981\u786E\u8BA4",
|
|
296425
|
-
auto: "Full Access \u2014 \u81EA\u52A8\
|
|
296839
|
+
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
296840
|
plan: "Plan \u2014 \u89C4\u5212\u6A21\u5F0F\uFF0C\u65E0\u5B9E\u9645\u6587\u4EF6\u4FEE\u6539"
|
|
296427
296841
|
} : {
|
|
296428
296842
|
strict: "Strict \u2014 Confirm every tool call before execution",
|
|
296429
296843
|
normal: "Normal \u2014 Confirm write/exec operations only",
|
|
296430
|
-
auto: "Full Access \u2014
|
|
296844
|
+
auto: "Full Access \u2014 Approve every enabled tool action, including dangerous, local-network, and outside-workspace actions",
|
|
296431
296845
|
plan: "Plan \u2014 Planning mode, no actual file changes"
|
|
296432
296846
|
};
|
|
296433
296847
|
if (!targetMode) {
|
|
@@ -297688,7 +298102,8 @@ Risk Warning: ${reason}`);
|
|
|
297688
298102
|
{
|
|
297689
298103
|
disableStatusBar: useFullscreenTui,
|
|
297690
298104
|
sessionId: resumeSessionId,
|
|
297691
|
-
|
|
298105
|
+
// Permission elevation never opts the user out of periodic cost guards.
|
|
298106
|
+
autoContinueRunaway: false
|
|
297692
298107
|
}
|
|
297693
298108
|
);
|
|
297694
298109
|
tui.setActiveInputHandler((submitted) => {
|
|
@@ -298210,6 +298625,9 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
|
|
|
298210
298625
|
applyPermissionModePreset(config, localState.permissionMode);
|
|
298211
298626
|
}
|
|
298212
298627
|
}
|
|
298628
|
+
function shouldAutoContinueRunaway(options) {
|
|
298629
|
+
return options?.autoContinueRunaway === true;
|
|
298630
|
+
}
|
|
298213
298631
|
async function runAgent(cwd, task, cliOverrides, multi, options) {
|
|
298214
298632
|
const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
|
|
298215
298633
|
};
|
|
@@ -298344,7 +298762,7 @@ Risk Warning: ${reason}`);
|
|
|
298344
298762
|
requireSession: Boolean(options?.resumeSessionId),
|
|
298345
298763
|
disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
|
|
298346
298764
|
nonInteractive: !!options?.nonInteractive,
|
|
298347
|
-
autoContinueRunaway:
|
|
298765
|
+
autoContinueRunaway: shouldAutoContinueRunaway(options)
|
|
298348
298766
|
}
|
|
298349
298767
|
);
|
|
298350
298768
|
return await loop.run();
|
|
@@ -298622,7 +299040,7 @@ async function runLSPServer(cwd) {
|
|
|
298622
299040
|
const autocompleteEngine = new AutocompleteEngine(cwd);
|
|
298623
299041
|
const documentCache = /* @__PURE__ */ new Map();
|
|
298624
299042
|
let shutdownRequested = false;
|
|
298625
|
-
await new Promise((
|
|
299043
|
+
await new Promise((resolve26) => {
|
|
298626
299044
|
let settled = false;
|
|
298627
299045
|
const finish = () => {
|
|
298628
299046
|
if (settled) return;
|
|
@@ -298631,7 +299049,7 @@ async function runLSPServer(cwd) {
|
|
|
298631
299049
|
process.stdin.off("end", onEnd);
|
|
298632
299050
|
autocompleteEngine.dispose();
|
|
298633
299051
|
documentCache.clear();
|
|
298634
|
-
|
|
299052
|
+
resolve26();
|
|
298635
299053
|
};
|
|
298636
299054
|
const handleMessage = async (message2) => {
|
|
298637
299055
|
try {
|
|
@@ -298808,15 +299226,15 @@ function askQuestion(query, defaultValue = "") {
|
|
|
298808
299226
|
input: process.stdin,
|
|
298809
299227
|
output: process.stdout
|
|
298810
299228
|
});
|
|
298811
|
-
return new Promise((
|
|
299229
|
+
return new Promise((resolve26) => {
|
|
298812
299230
|
rl.question(query, (answer) => {
|
|
298813
299231
|
rl.close();
|
|
298814
|
-
|
|
299232
|
+
resolve26(answer.trim() || defaultValue);
|
|
298815
299233
|
});
|
|
298816
299234
|
});
|
|
298817
299235
|
}
|
|
298818
299236
|
function askSecret(query) {
|
|
298819
|
-
return new Promise((
|
|
299237
|
+
return new Promise((resolve26, reject) => {
|
|
298820
299238
|
const stdin2 = process.stdin;
|
|
298821
299239
|
const stdout2 = process.stdout;
|
|
298822
299240
|
if (!stdin2.isTTY || !stdout2.isTTY || typeof stdin2.setRawMode !== "function") {
|
|
@@ -298850,13 +299268,13 @@ function askSecret(query) {
|
|
|
298850
299268
|
case "":
|
|
298851
299269
|
cleanup();
|
|
298852
299270
|
stdout2.write("\n");
|
|
298853
|
-
|
|
299271
|
+
resolve26(input.trim());
|
|
298854
299272
|
break;
|
|
298855
299273
|
case "":
|
|
298856
299274
|
cleanup();
|
|
298857
299275
|
stdout2.write("\n");
|
|
298858
299276
|
process.exitCode = 130;
|
|
298859
|
-
|
|
299277
|
+
resolve26("");
|
|
298860
299278
|
break;
|
|
298861
299279
|
case "\b":
|
|
298862
299280
|
case "\x7F":
|
|
@@ -299243,7 +299661,7 @@ async function runSkillsCommand(action, options = {}) {
|
|
|
299243
299661
|
|
|
299244
299662
|
// src/commands/trace.ts
|
|
299245
299663
|
import {
|
|
299246
|
-
existsSync as
|
|
299664
|
+
existsSync as existsSync28,
|
|
299247
299665
|
lstatSync as lstatSync8,
|
|
299248
299666
|
mkdirSync as mkdirSync8,
|
|
299249
299667
|
renameSync as renameSync6,
|
|
@@ -299271,7 +299689,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299271
299689
|
}
|
|
299272
299690
|
const outputPath = resolveSafePath(cwd, value.out);
|
|
299273
299691
|
const directory = dirname15(outputPath);
|
|
299274
|
-
if (
|
|
299692
|
+
if (existsSync28(directory)) {
|
|
299275
299693
|
const stats = lstatSync8(directory);
|
|
299276
299694
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
299277
299695
|
throw new Error("Trace output directory must be a real directory.");
|
|
@@ -299286,7 +299704,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299286
299704
|
flag: "wx",
|
|
299287
299705
|
mode: 384
|
|
299288
299706
|
});
|
|
299289
|
-
if (
|
|
299707
|
+
if (existsSync28(outputPath)) rmSync7(outputPath, { force: true });
|
|
299290
299708
|
renameSync6(temporaryPath, outputPath);
|
|
299291
299709
|
} finally {
|
|
299292
299710
|
rmSync7(temporaryPath, { force: true });
|
|
@@ -299298,7 +299716,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
299298
299716
|
import { exec as execCallback, execFileSync as execFileSync8 } from "child_process";
|
|
299299
299717
|
import {
|
|
299300
299718
|
copyFileSync,
|
|
299301
|
-
existsSync as
|
|
299719
|
+
existsSync as existsSync29,
|
|
299302
299720
|
lstatSync as lstatSync9,
|
|
299303
299721
|
mkdirSync as mkdirSync9,
|
|
299304
299722
|
renameSync as renameSync7,
|
|
@@ -299637,7 +300055,7 @@ function writeEvaluationReport(cwd, runId, report) {
|
|
|
299637
300055
|
}
|
|
299638
300056
|
function writeJsonAtomically2(filePath, value) {
|
|
299639
300057
|
const directory = dirname16(filePath);
|
|
299640
|
-
if (
|
|
300058
|
+
if (existsSync29(directory)) {
|
|
299641
300059
|
const stats = lstatSync9(directory);
|
|
299642
300060
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
299643
300061
|
throw new Error("Evaluation output directory must be a real directory.");
|
|
@@ -299652,7 +300070,7 @@ function writeJsonAtomically2(filePath, value) {
|
|
|
299652
300070
|
flag: "wx",
|
|
299653
300071
|
mode: 384
|
|
299654
300072
|
});
|
|
299655
|
-
if (
|
|
300073
|
+
if (existsSync29(filePath)) rmSync8(filePath, { force: true });
|
|
299656
300074
|
renameSync7(temporaryPath, filePath);
|
|
299657
300075
|
} finally {
|
|
299658
300076
|
rmSync8(temporaryPath, { force: true });
|
|
@@ -299949,7 +300367,7 @@ async function confirmDeletion(prompt) {
|
|
|
299949
300367
|
});
|
|
299950
300368
|
try {
|
|
299951
300369
|
const answer = await new Promise(
|
|
299952
|
-
(
|
|
300370
|
+
(resolve26) => interfaceInstance.question(prompt, resolve26)
|
|
299953
300371
|
);
|
|
299954
300372
|
return answer.trim() === "DELETE";
|
|
299955
300373
|
} finally {
|
|
@@ -299964,7 +300382,7 @@ import { z as z78 } from "zod";
|
|
|
299964
300382
|
|
|
299965
300383
|
// src/runtime/ProjectBackup.ts
|
|
299966
300384
|
import {
|
|
299967
|
-
existsSync as
|
|
300385
|
+
existsSync as existsSync30,
|
|
299968
300386
|
lstatSync as lstatSync11,
|
|
299969
300387
|
mkdirSync as mkdirSync10,
|
|
299970
300388
|
readdirSync as readdirSync10,
|
|
@@ -299973,7 +300391,7 @@ import {
|
|
|
299973
300391
|
writeFileSync as writeFileSync10
|
|
299974
300392
|
} from "fs";
|
|
299975
300393
|
import { createHash as createHash10, randomUUID as randomUUID16 } from "crypto";
|
|
299976
|
-
import { dirname as dirname17, isAbsolute as
|
|
300394
|
+
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join21, relative as relative10, resolve as resolve18, sep as sep2 } from "path";
|
|
299977
300395
|
import { z as z77 } from "zod";
|
|
299978
300396
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
299979
300397
|
var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
|
|
@@ -300040,7 +300458,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
300040
300458
|
const orbitRoot = join21(projectRoot, ".orbit");
|
|
300041
300459
|
const files = [];
|
|
300042
300460
|
let totalBytes = 0;
|
|
300043
|
-
if (
|
|
300461
|
+
if (existsSync30(orbitRoot)) {
|
|
300044
300462
|
for (const absolutePath of listBackupFiles(orbitRoot)) {
|
|
300045
300463
|
if (files.length >= MAX_BACKUP_FILES) {
|
|
300046
300464
|
throw new Error(`Project backup exceeds ${MAX_BACKUP_FILES} files.`);
|
|
@@ -300119,7 +300537,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
300119
300537
|
file,
|
|
300120
300538
|
destination: resolveBackupDestination(orbitRoot, file.path)
|
|
300121
300539
|
}));
|
|
300122
|
-
const conflicts2 = planned.filter(({ destination }) =>
|
|
300540
|
+
const conflicts2 = planned.filter(({ destination }) => existsSync30(destination)).map(({ file }) => file.path);
|
|
300123
300541
|
if (conflicts2.length > 0 && !options.force) {
|
|
300124
300542
|
throw new Error(
|
|
300125
300543
|
`Restore would overwrite ${conflicts2.length} file(s). Re-run with --force after reviewing the backup.`
|
|
@@ -300202,22 +300620,22 @@ function assertDirectoryChainHasNoSymlink(root, target) {
|
|
|
300202
300620
|
const absoluteRoot = resolve18(root);
|
|
300203
300621
|
const absoluteTarget = resolve18(target);
|
|
300204
300622
|
const relativeTarget = relative10(absoluteRoot, absoluteTarget);
|
|
300205
|
-
if (relativeTarget.startsWith("..") ||
|
|
300623
|
+
if (relativeTarget.startsWith("..") || isAbsolute9(relativeTarget)) {
|
|
300206
300624
|
throw new Error("Backup restore directory escapes the project.");
|
|
300207
300625
|
}
|
|
300208
300626
|
let current = absoluteRoot;
|
|
300209
|
-
if (
|
|
300627
|
+
if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
|
|
300210
300628
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
300211
300629
|
}
|
|
300212
300630
|
for (const part of relativeTarget.split(sep2).filter(Boolean)) {
|
|
300213
300631
|
current = join21(current, part);
|
|
300214
|
-
if (
|
|
300632
|
+
if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
|
|
300215
300633
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
300216
300634
|
}
|
|
300217
300635
|
}
|
|
300218
300636
|
}
|
|
300219
300637
|
function replaceFileAtomically2(temporaryPath, destination) {
|
|
300220
|
-
if (!
|
|
300638
|
+
if (!existsSync30(destination)) {
|
|
300221
300639
|
renameSync8(temporaryPath, destination);
|
|
300222
300640
|
return;
|
|
300223
300641
|
}
|
|
@@ -300227,7 +300645,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
300227
300645
|
renameSync8(temporaryPath, destination);
|
|
300228
300646
|
rmSync10(previousPath, { force: true });
|
|
300229
300647
|
} catch (error) {
|
|
300230
|
-
if (!
|
|
300648
|
+
if (!existsSync30(destination) && existsSync30(previousPath)) {
|
|
300231
300649
|
renameSync8(previousPath, destination);
|
|
300232
300650
|
}
|
|
300233
300651
|
throw error;
|
|
@@ -300235,7 +300653,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
300235
300653
|
}
|
|
300236
300654
|
function normalizeBundlePath(filePath) {
|
|
300237
300655
|
const normalized = filePath.replaceAll("\\", "/");
|
|
300238
|
-
if (!normalized || normalized.startsWith("/") ||
|
|
300656
|
+
if (!normalized || normalized.startsWith("/") || isAbsolute9(normalized) || normalized.split("/").some((part) => !part || part === "." || part === "..")) {
|
|
300239
300657
|
return void 0;
|
|
300240
300658
|
}
|
|
300241
300659
|
return normalized;
|
|
@@ -300339,7 +300757,7 @@ import picocolors28 from "picocolors";
|
|
|
300339
300757
|
|
|
300340
300758
|
// src/runtime/ExtensionManager.ts
|
|
300341
300759
|
import {
|
|
300342
|
-
existsSync as
|
|
300760
|
+
existsSync as existsSync31,
|
|
300343
300761
|
lstatSync as lstatSync12,
|
|
300344
300762
|
mkdirSync as mkdirSync11,
|
|
300345
300763
|
readdirSync as readdirSync11,
|
|
@@ -300348,7 +300766,7 @@ import {
|
|
|
300348
300766
|
writeFileSync as writeFileSync11
|
|
300349
300767
|
} from "fs";
|
|
300350
300768
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
300351
|
-
import { dirname as dirname18, isAbsolute as
|
|
300769
|
+
import { dirname as dirname18, isAbsolute as isAbsolute10, join as join26, relative as relative11, resolve as resolve20, sep as sep3 } from "path";
|
|
300352
300770
|
import { homedir as homedir12 } from "os";
|
|
300353
300771
|
import { z as z79 } from "zod";
|
|
300354
300772
|
var InstalledExtensionSchema2 = z79.object({
|
|
@@ -300378,7 +300796,7 @@ var ExtensionManager = class {
|
|
|
300378
300796
|
list() {
|
|
300379
300797
|
try {
|
|
300380
300798
|
return this.readRegistry().filter(
|
|
300381
|
-
(extension) => this.isManagedExtensionPath(extension) &&
|
|
300799
|
+
(extension) => this.isManagedExtensionPath(extension) && existsSync31(extension.path) && !lstatSync12(extension.path).isSymbolicLink()
|
|
300382
300800
|
);
|
|
300383
300801
|
} catch {
|
|
300384
300802
|
return [];
|
|
@@ -300431,12 +300849,12 @@ var ExtensionManager = class {
|
|
|
300431
300849
|
try {
|
|
300432
300850
|
copyDirectorySafely(sourceRoot, staging);
|
|
300433
300851
|
const digest = hashExtensionDirectory(staging);
|
|
300434
|
-
if (
|
|
300852
|
+
if (existsSync31(target)) {
|
|
300435
300853
|
renameSync9(target, targetBackup);
|
|
300436
300854
|
targetBackedUp = true;
|
|
300437
300855
|
}
|
|
300438
300856
|
for (const prompt of promptTargets) {
|
|
300439
|
-
if (!
|
|
300857
|
+
if (!existsSync31(prompt.target)) continue;
|
|
300440
300858
|
mkdirSync11(dirname18(prompt.backup), { recursive: true });
|
|
300441
300859
|
renameSync9(prompt.target, prompt.backup);
|
|
300442
300860
|
prompt.backedUp = true;
|
|
@@ -300472,14 +300890,14 @@ var ExtensionManager = class {
|
|
|
300472
300890
|
if (targetInstalled) {
|
|
300473
300891
|
rmSync11(target, { recursive: true, force: true });
|
|
300474
300892
|
}
|
|
300475
|
-
if (targetBackedUp &&
|
|
300893
|
+
if (targetBackedUp && existsSync31(targetBackup)) {
|
|
300476
300894
|
renameSync9(targetBackup, target);
|
|
300477
300895
|
}
|
|
300478
300896
|
for (const prompt of promptTargets) {
|
|
300479
300897
|
if (promptMutationStarted) {
|
|
300480
300898
|
rmSync11(prompt.target, { recursive: true, force: true });
|
|
300481
300899
|
}
|
|
300482
|
-
if (prompt.backedUp &&
|
|
300900
|
+
if (prompt.backedUp && existsSync31(prompt.backup)) {
|
|
300483
300901
|
mkdirSync11(dirname18(prompt.target), { recursive: true });
|
|
300484
300902
|
renameSync9(prompt.backup, prompt.target);
|
|
300485
300903
|
}
|
|
@@ -300507,7 +300925,7 @@ var ExtensionManager = class {
|
|
|
300507
300925
|
);
|
|
300508
300926
|
}
|
|
300509
300927
|
const installed = registry.find(
|
|
300510
|
-
(entry) => entry.id === id &&
|
|
300928
|
+
(entry) => entry.id === id && existsSync31(entry.path) && !lstatSync12(entry.path).isSymbolicLink()
|
|
300511
300929
|
);
|
|
300512
300930
|
if (!installed) return false;
|
|
300513
300931
|
const rollbackRoot = join26(
|
|
@@ -300527,7 +300945,7 @@ var ExtensionManager = class {
|
|
|
300527
300945
|
].map((entry) => ({ ...entry, backedUp: false }));
|
|
300528
300946
|
try {
|
|
300529
300947
|
for (const entry of targets) {
|
|
300530
|
-
if (!
|
|
300948
|
+
if (!existsSync31(entry.target)) continue;
|
|
300531
300949
|
mkdirSync11(dirname18(entry.backup), { recursive: true });
|
|
300532
300950
|
renameSync9(entry.target, entry.backup);
|
|
300533
300951
|
entry.backedUp = true;
|
|
@@ -300538,7 +300956,7 @@ var ExtensionManager = class {
|
|
|
300538
300956
|
} catch (error) {
|
|
300539
300957
|
try {
|
|
300540
300958
|
for (const entry of targets) {
|
|
300541
|
-
if (!entry.backedUp || !
|
|
300959
|
+
if (!entry.backedUp || !existsSync31(entry.backup)) continue;
|
|
300542
300960
|
mkdirSync11(dirname18(entry.target), { recursive: true });
|
|
300543
300961
|
renameSync9(entry.backup, entry.target);
|
|
300544
300962
|
}
|
|
@@ -300566,7 +300984,7 @@ var ExtensionManager = class {
|
|
|
300566
300984
|
isManagedExtensionPath(extension) {
|
|
300567
300985
|
const expected = resolve20(this.extensionsDir, extension.id);
|
|
300568
300986
|
const slot = relative11(this.extensionsDir, expected);
|
|
300569
|
-
const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !
|
|
300987
|
+
const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !isAbsolute10(slot);
|
|
300570
300988
|
return remainsInsideManagedRoot && resolve20(extension.path) === expected;
|
|
300571
300989
|
}
|
|
300572
300990
|
readRegistry() {
|
|
@@ -300667,7 +301085,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
300667
301085
|
`Invalid extension contribution path: ${contribution.path}`
|
|
300668
301086
|
);
|
|
300669
301087
|
}
|
|
300670
|
-
if (!
|
|
301088
|
+
if (!existsSync31(target) || lstatSync12(target).isSymbolicLink()) {
|
|
300671
301089
|
throw new Error(
|
|
300672
301090
|
`Extension contribution is missing or unsafe: ${contribution.path}`
|
|
300673
301091
|
);
|
|
@@ -300818,7 +301236,7 @@ function removeExtension(id) {
|
|
|
300818
301236
|
}
|
|
300819
301237
|
|
|
300820
301238
|
// src/index.ts
|
|
300821
|
-
import { existsSync as
|
|
301239
|
+
import { existsSync as existsSync35, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
|
|
300822
301240
|
import { resolve as resolve21 } from "path";
|
|
300823
301241
|
|
|
300824
301242
|
// src/runtime/CliRunOverrides.ts
|
|
@@ -300847,7 +301265,7 @@ function applyOutcomeExitCode(outcome) {
|
|
|
300847
301265
|
}
|
|
300848
301266
|
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
301267
|
"--yes",
|
|
300850
|
-
"enable Full Access
|
|
301268
|
+
"enable unrestricted Full Access and approve every enabled tool action"
|
|
300851
301269
|
).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
301270
|
const cwd = process.cwd();
|
|
300853
301271
|
const overrides = createCliRunOverrides({
|
|
@@ -301051,7 +301469,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
301051
301469
|
fullAccess: !!options.yes
|
|
301052
301470
|
});
|
|
301053
301471
|
const requestedCwd = resolve21(localOptions.cwd || process.cwd());
|
|
301054
|
-
if (!
|
|
301472
|
+
if (!existsSync35(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
|
|
301055
301473
|
throw new Error(
|
|
301056
301474
|
`Web UI project directory does not exist: ${requestedCwd}`
|
|
301057
301475
|
);
|