@orbit-build/cli 0.8.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +1155 -557
  2. 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(resolve25, reject) {
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
- resolve25(is);
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((resolve25, reject) => {
209
+ const step = (i2) => new Promise((resolve26, reject) => {
210
210
  if (i2 === pathEnv.length)
211
- return opt.all && found.length ? resolve25(found) : reject(getNotFoundError(cmd));
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
- resolve25(subStep(p, i2, 0));
216
+ resolve26(subStep(p, i2, 0));
217
217
  });
218
- const subStep = (p, i2, ii) => new Promise((resolve25, reject) => {
218
+ const subStep = (p, i2, ii) => new Promise((resolve26, reject) => {
219
219
  if (ii === pathExt.length)
220
- return resolve25(step(i2 + 1));
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 resolve25(p + ext);
227
+ return resolve26(p + ext);
228
228
  }
229
- return resolve25(subStep(p, i2, ii + 1));
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((resolve25, reject) => {
3210
+ return new Promise((resolve26, reject) => {
3211
3211
  this.close((err, data) => {
3212
- return err ? reject(err) : resolve25(data);
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((resolve25, reject) => {
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
- ) : resolve25(data);
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((resolve25, reject) => {
5523
- res = resolve25;
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((resolve25, reject) => {
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 = resolve25;
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((resolve25, reject) => {
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 = resolve25;
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((resolve25) => {
8894
+ return new Promise((resolve26) => {
8895
8895
  if (this[kSize]) {
8896
- this[kClosedResolve] = resolve25;
8896
+ this[kClosedResolve] = resolve26;
8897
8897
  } else {
8898
- resolve25(null);
8898
+ resolve26(null);
8899
8899
  }
8900
8900
  });
8901
8901
  }
8902
8902
  async [kDestroy](err) {
8903
- return new Promise((resolve25) => {
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
- resolve25(null);
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((resolve25, reject) => {
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
- resolve25(socket2);
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((resolve25) => {
9315
- this[kClosedResolve] = resolve25;
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((resolve25, reject) => {
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
- resolve25(null);
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((resolve25, reject) => {
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: resolve25,
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: resolve25, stream, length } = consume2;
10677
+ const { type, body, resolve: resolve26, stream, length } = consume2;
10678
10678
  try {
10679
10679
  if (type === "text") {
10680
- resolve25(chunksDecode(body, length));
10680
+ resolve26(chunksDecode(body, length));
10681
10681
  } else if (type === "json") {
10682
- resolve25(JSON.parse(chunksDecode(body, length)));
10682
+ resolve26(JSON.parse(chunksDecode(body, length)));
10683
10683
  } else if (type === "arrayBuffer") {
10684
- resolve25(chunksConcat(body, length).buffer);
10684
+ resolve26(chunksConcat(body, length).buffer);
10685
10685
  } else if (type === "blob") {
10686
- resolve25(new Blob(body, { type: stream[kContentType] }));
10686
+ resolve26(new Blob(body, { type: stream[kContentType] }));
10687
10687
  } else if (type === "bytes") {
10688
- resolve25(chunksConcat(body, length));
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((resolve25, reject) => {
10946
+ return new Promise((resolve26, reject) => {
10947
10947
  request.call(this, opts, (err, data) => {
10948
- return err ? reject(err) : resolve25(data);
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((resolve25, reject) => {
11172
+ return new Promise((resolve26, reject) => {
11173
11173
  stream.call(this, opts, factory, (err, data) => {
11174
- return err ? reject(err) : resolve25(data);
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((resolve25, reject) => {
11459
+ return new Promise((resolve26, reject) => {
11460
11460
  upgrade.call(this, opts, (err, data) => {
11461
- return err ? reject(err) : resolve25(data);
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((resolve25, reject) => {
11553
+ return new Promise((resolve26, reject) => {
11554
11554
  connect.call(this, opts, (err, data) => {
11555
- return err ? reject(err) : resolve25(data);
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((resolve25, reject) => agent.dispatch(
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
- resolve25({
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
- resolve25({
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((resolve25) => {
19270
- setTimeout(resolve25, ms).unref();
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 resolve25 = factory2.createUniqueName("resolve");
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
- resolve25
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()]), resolve25, reject]
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((resolve25, reject) => {
231201
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve25, reject });
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 = resolve25.call(this, root, ref);
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 resolve25(root, ref) {
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 resolve25(baseURI, relativeURI, options) {
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: resolve25,
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 existsSync13 } from "fs";
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((resolve25, reject) => {
243074
+ return new Promise((resolve26, reject) => {
243054
243075
  const cleanup = () => signal?.removeEventListener("abort", onAbort);
243055
243076
  const timeoutId = setTimeout(() => {
243056
243077
  cleanup();
243057
- resolve25();
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 existsSync12, readdirSync as readdirSync5 } from "fs";
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 existsSync11, readdirSync as readdirSync4 } from "fs";
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 isAbsolute2, relative as relative4, win32 } from "path";
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((resolve25, reject) => {
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((resolve25, reject) => {
247475
+ var getSpawnedPromise = (spawned) => new Promise((resolve26, reject) => {
247454
247476
  spawned.on("exit", (exitCode, signal) => {
247455
- resolve25({ exitCode, signal });
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 existsSync32 } from "fs";
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 existsSync52 } from "fs";
247796
+ import { existsSync as existsSync6 } from "fs";
247774
247797
  import { z as z13 } from "zod";
247775
- import { existsSync as existsSync42 } from "fs";
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 existsSync6 } from "fs";
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 existsSync7 } from "fs";
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 atomicWriteWorkspaceFile(cwd, requestedPath, content, expectedCurrentContent) {
247833
- let safePath = resolveSafePath(cwd, requestedPath);
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 = resolveSafePath(cwd, requestedPath);
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 = resolveSafePath(cwd, requestedPath);
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 = resolveSafePath(ctx.cwd, input.path);
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.cwd,
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.cwd,
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.cwd,
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.cwd,
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.cwd,
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(workspaceRoot, filePath, safePath, updated, originalContent) {
248102
- const syntaxError = await verifySyntax(filePath, updated);
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
- atomicWriteWorkspaceFile(
248112
- workspaceRoot,
248113
- safePath,
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 && !isAbsolute2(candidate) && !win32.isAbsolute(candidate) && !normalized.includes("..");
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 = resolveSafePath(ctx.cwd, inputPath);
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 workspace or use skill://<skill-name>/<pattern>."
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 project-relative or active skill:// glob pattern, with a configurable bounded result count.";
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 ? resolveSafePath(ctx.cwd, input.path) : ctx.cwd;
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 ? resolveSafePath(ctx.cwd, input.path) : ctx.cwd;
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 = resolveSafePath(ctx.cwd, input.path);
248906
- const current = readBoundedRegularFile(safePath, MAX_TOOL_FILE_BYTES);
248907
- if (input.intent === "create" && current !== void 0) {
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" && current === void 0) {
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
- atomicWriteWorkspaceFile(
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: buildSanitizedChildEnvironment(),
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: buildSanitizedChildEnvironment(),
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: buildSanitizedChildEnvironment(),
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: buildSanitizedChildEnvironment(),
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 (existsSync32(join23(root, "package.json"))) {
249169
+ if (existsSync42(join23(root, "package.json"))) {
249098
249170
  languages.push("javascript", "typescript");
249099
- if (existsSync32(join23(root, "pnpm-lock.yaml"))) packageManager2 = "pnpm";
249100
- else if (existsSync32(join23(root, "yarn.lock"))) packageManager2 = "yarn";
249101
- else if (existsSync32(join23(root, "bun.lockb"))) packageManager2 = "bun";
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 (existsSync32(join23(root, "requirements.txt")) || existsSync32(join23(root, "pyproject.toml")) || existsSync32(join23(root, "poetry.lock"))) {
249201
+ if (existsSync42(join23(root, "requirements.txt")) || existsSync42(join23(root, "pyproject.toml")) || existsSync42(join23(root, "poetry.lock"))) {
249130
249202
  languages.push("python");
249131
- if (existsSync32(join23(root, "poetry.lock"))) packageManager2 = "poetry";
249203
+ if (existsSync42(join23(root, "poetry.lock"))) packageManager2 = "poetry";
249132
249204
  else packageManager2 = "pip";
249133
- if (existsSync32(join23(root, "manage.py"))) frameworks.push("Django");
249134
- if (existsSync32(join23(root, "main.py"))) entrypoints.push("main.py");
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 (existsSync32(join23(root, "Cargo.toml"))) {
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 (existsSync32(join23(root, "src/main.rs")))
249216
+ if (existsSync42(join23(root, "src/main.rs")))
249145
249217
  entrypoints.push("src/main.rs");
249146
- if (existsSync32(join23(root, "src/lib.rs")))
249218
+ if (existsSync42(join23(root, "src/lib.rs")))
249147
249219
  entrypoints.push("src/lib.rs");
249148
249220
  }
249149
- if (existsSync32(join23(root, "go.mod"))) {
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 (existsSync32(join23(root, "main.go"))) entrypoints.push("main.go");
249227
+ if (existsSync42(join23(root, "main.go"))) entrypoints.push("main.go");
249156
249228
  }
249157
- if (existsSync32(join23(root, "pom.xml"))) {
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 (!existsSync42(indexPath)) {
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 (!existsSync52(indexPath)) {
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 (existsSync52(absPath)) {
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 = existsSync6) {
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 ?? existsSync6;
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: buildSanitizedChildEnvironment(),
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: buildSanitizedChildEnvironment(),
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 (existsSync7(join42(cwd, "Cargo.toml"))) {
249856
+ if (existsSync8(join42(cwd, "Cargo.toml"))) {
249782
249857
  return "cargo test";
249783
249858
  }
249784
- if (existsSync7(join42(cwd, "go.mod"))) {
249859
+ if (existsSync8(join42(cwd, "go.mod"))) {
249785
249860
  return "go test ./...";
249786
249861
  }
249787
- if (existsSync7(join42(cwd, "pom.xml"))) {
249862
+ if (existsSync8(join42(cwd, "pom.xml"))) {
249788
249863
  return "mvn test";
249789
249864
  }
249790
- if (existsSync7(join42(cwd, "build.gradle"))) {
249865
+ if (existsSync8(join42(cwd, "build.gradle"))) {
249791
249866
  return "./gradlew test";
249792
249867
  }
249793
- if (existsSync7(join42(cwd, "package.json"))) {
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 (existsSync7(join42(cwd, "pnpm-lock.yaml"))) return "pnpm test";
249803
- if (existsSync7(join42(cwd, "yarn.lock"))) return "yarn test";
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 (existsSync7(join42(cwd, "pytest.ini")) || existsSync7(join42(cwd, "pyproject.toml"))) {
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((resolve25, reject) => {
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) => resolve25(entries.map((entry) => entry.address))).catch(reject).finally(() => signal?.removeEventListener("abort", onAbort));
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 resolvePublicHttpTarget(rawUrl, resolveAddresses = resolveSystemAddresses, resolvePublicAddresses = createPublicDnsResolver(), signal) {
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
- "Public HTTP(S) URL to read. Local and private network targets are blocked."
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 the bounded text content of a public HTTP(S) page after web_search identifies a useful source. Blocks credentials, localhost/private networks, binary responses, and unsafe redirects.";
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
- let currentTarget = await resolvePublicHttpTarget(
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 resolvePublicHttpTarget(
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((resolve25) => {
251320
- resolveCompletion = resolve25;
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((resolve25) => {
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) => resolve25(error === null)
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((resolve25) => {
251592
- timeout = setTimeout(() => resolve25(false), timeoutMs);
251671
+ new Promise((resolve34) => {
251672
+ timeout = setTimeout(() => resolve34(false), timeoutMs);
251593
251673
  timeout.unref?.();
251594
251674
  }),
251595
- new Promise((resolve25) => {
251675
+ new Promise((resolve34) => {
251596
251676
  if (!abortSignal) return;
251597
251677
  if (abortSignal.aborted) {
251598
- resolve25(false);
251678
+ resolve34(false);
251599
251679
  return;
251600
251680
  }
251601
- abortListener = () => resolve25(false);
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 existsSync8 } from "fs";
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 isAbsolute3, resolve as resolve32 } from "path";
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 resolve4 } from "path";
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 resolve23 } from "path";
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 isAbsolute22, join as join33, resolve as resolve5 } from "path";
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 (!existsSync8(indexPath)) {
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 = resolve4(cwd, ".orbit", "vector_store.json");
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 = resolve23(cwd, ".orbit", "bm25_store.json");
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 (isAbsolute3(filePath)) continue;
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 resolve5(homedir4(), directory.slice(2));
253989
+ return resolve52(homedir4(), directory.slice(2));
253910
253990
  }
253911
- return isAbsolute22(directory) ? resolve5(directory) : resolve5(cwd, directory);
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((resolve25, reject) => {
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: resolve25,
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((resolve25) => {
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
- resolve25(exited);
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((resolve25) => {
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
- resolve25();
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((resolve25, reject) => {
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
- resolve25(server2.address().port);
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((resolve25, reject) => {
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()) resolve25(value);
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 requires confirmation because ${indirection.reason}. Inline interpreters can bypass workspace and secret path inspection.`,
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 existsSync9,
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 (!existsSync9(sessionDir)) return;
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 (!existsSync9(metaPath)) continue;
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 (existsSync9(encryptedPath)) {
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 (!existsSync9(plaintextPath)) return null;
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 (existsSync9(safePath)) {
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 (existsSync9(checkpointDir)) {
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 isAbsolute4, join as join9, relative as relative5, resolve as resolve7, sep } from "path";
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 existsSync10,
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 isAbsolute23, join as join25, parse as parse2, resolve as resolve24 } from "path";
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 (existsSync10(destinationPath)) {
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 && existsSync10(backupPath) && !existsSync10(destinationPath)) {
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 (existsSync10(destinationPath)) {
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("..") && !isAbsolute4(relativePath)) {
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 (!existsSync10(sessionFile)) return void 0;
258705
+ if (!existsSync11(sessionFile)) return void 0;
258619
258706
  for (const candidate of [sessionFile, `${sessionFile}.bak`]) {
258620
- if (!existsSync10(candidate)) continue;
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 (!existsSync10(sessionRoot)) return [];
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 (!existsSync10(file)) return [];
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 (!existsSync10(candidate)) continue;
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 (!existsSync10(candidate)) continue;
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 (!existsSync10(candidate)) continue;
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 (!existsSync10(file)) return [];
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 (!existsSync10(historyPath) || priorWrites < 2) {
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 (!existsSync10(candidate)) continue;
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 (!existsSync10(journalPath)) return history;
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 (existsSync10(dir)) {
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 (existsSync10(sessionRoot)) {
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) || isAbsolute4(relativePath)) {
259143
+ if (relativePath !== validId || relativePath.includes(sep) || isAbsolute5(relativePath)) {
259057
259144
  throw new Error(`Invalid session directory: ${id}`);
259058
259145
  }
259059
- if (existsSync10(resolved)) {
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 = resolve24(rootPath);
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 (!isAbsolute23(projectPath))
259747
+ if (!isAbsolute24(projectPath))
259661
259748
  throw new Error("Project path must be absolute.");
259662
- const requested = resolve24(projectPath);
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."
@@ -259667,7 +259754,13 @@ function canonicalizeProjectPath(projectPath) {
259667
259754
  }
259668
259755
  if (!isDirectory(requested))
259669
259756
  throw new Error("Project path must be an existing directory.");
259670
- return realpathSync2.native(requested);
259757
+ const canonical = realpathSync2.native(requested);
259758
+ if (canonical === parse2(canonical).root) {
259759
+ throw new Error(
259760
+ "A filesystem root cannot be registered as an Orbit project."
259761
+ );
259762
+ }
259763
+ return canonical;
259671
259764
  }
259672
259765
  function projectIdentity(projectPath) {
259673
259766
  const normalized = projectPath.replace(/\\/g, "/");
@@ -260447,7 +260540,7 @@ var PromptCacheSlabBuilder = class {
260447
260540
  }
260448
260541
  static buildDiagnostics(cwd) {
260449
260542
  const dir = join10(cwd, ".orbit", "cache-slabs");
260450
- if (!existsSync11(dir)) {
260543
+ if (!existsSync12(dir)) {
260451
260544
  return [
260452
260545
  "Cache diagnostics:",
260453
260546
  "- No cache slab metadata found yet.",
@@ -261053,14 +261146,14 @@ var StepRunner = class {
261053
261146
  let cancellationCause;
261054
261147
  let cancelExecution;
261055
261148
  const cancellation = new Promise(
261056
- (resolve25) => {
261149
+ (resolve26) => {
261057
261150
  cancelExecution = (cause) => {
261058
261151
  if (cancellationCause) return;
261059
261152
  cancellationCause = cause;
261060
261153
  if (!executionController.signal.aborted) {
261061
261154
  executionController.abort(cause);
261062
261155
  }
261063
- resolve25({ kind: cause });
261156
+ resolve26({ kind: cause });
261064
261157
  };
261065
261158
  }
261066
261159
  );
@@ -262096,7 +262189,7 @@ async function hashCompleteTrackedDiff(cwd) {
262096
262189
  return createHash33("sha256").update(unstaged).update("\0").update(staged).digest("hex");
262097
262190
  }
262098
262191
  function readGitOutput(cwd, args) {
262099
- return new Promise((resolve25) => {
262192
+ return new Promise((resolve26) => {
262100
262193
  const child = spawn3("git", args, {
262101
262194
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
262102
262195
  cwd,
@@ -262115,14 +262208,14 @@ function readGitOutput(cwd, args) {
262115
262208
  }
262116
262209
  chunks.push(chunk);
262117
262210
  });
262118
- child.once("error", () => resolve25(void 0));
262211
+ child.once("error", () => resolve26(void 0));
262119
262212
  child.once("close", (code) => {
262120
- resolve25(code === 0 && !exceededLimit ? Buffer.concat(chunks) : void 0);
262213
+ resolve26(code === 0 && !exceededLimit ? Buffer.concat(chunks) : void 0);
262121
262214
  });
262122
262215
  });
262123
262216
  }
262124
262217
  function hashGitOutput(cwd, args) {
262125
- return new Promise((resolve25) => {
262218
+ return new Promise((resolve26) => {
262126
262219
  const hash2 = createHash33("sha256");
262127
262220
  const child = spawn3("git", args, {
262128
262221
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
@@ -262131,10 +262224,10 @@ function hashGitOutput(cwd, args) {
262131
262224
  stdio: ["ignore", "pipe", "ignore"]
262132
262225
  });
262133
262226
  child.stdout.on("data", (chunk) => hash2.update(chunk));
262134
- child.once("error", () => resolve25(void 0));
262227
+ child.once("error", () => resolve26(void 0));
262135
262228
  child.once(
262136
262229
  "close",
262137
- (code) => resolve25(code === 0 ? hash2.digest("hex") : void 0)
262230
+ (code) => resolve26(code === 0 ? hash2.digest("hex") : void 0)
262138
262231
  );
262139
262232
  });
262140
262233
  }
@@ -262160,16 +262253,16 @@ async function hashPathState(hash2, absolutePath) {
262160
262253
  return;
262161
262254
  }
262162
262255
  hash2.update(`file:${stats.mode}:${stats.size}\0`);
262163
- await new Promise((resolve25) => {
262256
+ await new Promise((resolve26) => {
262164
262257
  const stream = createReadStream2(absolutePath);
262165
262258
  stream.on("data", (chunk) => hash2.update(chunk));
262166
262259
  stream.once("error", (error) => {
262167
262260
  hash2.update(
262168
262261
  `[unreadable:${error instanceof Error ? error.name : "unknown"}]`
262169
262262
  );
262170
- resolve25();
262263
+ resolve26();
262171
262264
  });
262172
- stream.once("end", resolve25);
262265
+ stream.once("end", resolve26);
262173
262266
  });
262174
262267
  } catch (error) {
262175
262268
  hash2.update(`[missing:${error instanceof Error ? error.name : "unknown"}]`);
@@ -262178,7 +262271,11 @@ async function hashPathState(hash2, absolutePath) {
262178
262271
  function stableFingerprintMap(values) {
262179
262272
  return Object.entries(values).sort(([left], [right]) => left.localeCompare(right)).map(([filePath, fingerprint]) => `${filePath}\0${fingerprint}`).join("\0");
262180
262273
  }
262181
- function prepareIsolatedGitCommit(cwd, requestedPaths) {
262274
+ function prepareIsolatedGitCommit(cwd, requestedPaths, environment) {
262275
+ const childEnvironment = {
262276
+ ...environment ?? buildSanitizedChildEnvironment()
262277
+ };
262278
+ delete childEnvironment.GIT_INDEX_FILE;
262182
262279
  const paths = Array.from(
262183
262280
  new Set(
262184
262281
  requestedPaths.map(
@@ -262188,12 +262285,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
262188
262285
  ).filter(Boolean);
262189
262286
  if (paths.length === 0) throw new Error("No files were selected for commit.");
262190
262287
  const literalPathspecs = paths.map((filePath) => `:(literal)${filePath}`);
262191
- const stagedPaths = readNullSeparatedGitPaths(cwd, [
262192
- "diff",
262193
- "--cached",
262194
- "--name-only",
262195
- "-z"
262196
- ]);
262288
+ const stagedPaths = readNullSeparatedGitPaths(
262289
+ cwd,
262290
+ ["diff", "--cached", "--name-only", "-z"],
262291
+ childEnvironment
262292
+ );
262197
262293
  const stagedSet = new Set(stagedPaths.map(normalizePath4));
262198
262294
  const overlaps = paths.filter((filePath) => stagedSet.has(filePath));
262199
262295
  if (overlaps.length > 0) {
@@ -262207,6 +262303,7 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
262207
262303
  {
262208
262304
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
262209
262305
  cwd,
262306
+ env: childEnvironment,
262210
262307
  encoding: "utf8"
262211
262308
  }
262212
262309
  ).trim();
@@ -262214,9 +262311,10 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
262214
262311
  path32.dirname(gitIndexPath),
262215
262312
  `orbit-index-${randomUUID24()}`
262216
262313
  );
262217
- const isolatedEnvironment = buildSanitizedChildEnvironment({
262218
- extra: { GIT_INDEX_FILE: temporaryIndexPath }
262219
- });
262314
+ const isolatedEnvironment = {
262315
+ ...childEnvironment,
262316
+ GIT_INDEX_FILE: temporaryIndexPath
262317
+ };
262220
262318
  let disposed = false;
262221
262319
  try {
262222
262320
  try {
@@ -262262,7 +262360,8 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
262262
262360
  ["reset", "-q", "HEAD", "--", ...literalPathspecs],
262263
262361
  {
262264
262362
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
262265
- cwd
262363
+ cwd,
262364
+ env: childEnvironment
262266
262365
  }
262267
262366
  );
262268
262367
  },
@@ -262273,10 +262372,11 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
262273
262372
  throw error;
262274
262373
  }
262275
262374
  }
262276
- function readNullSeparatedGitPaths(cwd, args) {
262375
+ function readNullSeparatedGitPaths(cwd, args, environment) {
262277
262376
  return execFileSync5("git", args, {
262278
262377
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
262279
- cwd
262378
+ cwd,
262379
+ env: environment
262280
262380
  }).toString("utf8").split("\0").filter(Boolean);
262281
262381
  }
262282
262382
  function normalizePath4(filePath) {
@@ -262509,7 +262609,7 @@ var PackageManifestSchema2 = z64.object({
262509
262609
  name: z64.string(),
262510
262610
  bin: z64.union([z64.string(), z64.record(z64.string())]).optional()
262511
262611
  });
262512
- async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
262612
+ async function executeLocalPackageBinary(cwd, packageName, binaryName, args, environment) {
262513
262613
  const binaryPath = resolveLocalPackageBinary(cwd, packageName, binaryName);
262514
262614
  const isJavaScript = /\.(?:cjs|mjs|js)$/i.test(binaryPath);
262515
262615
  const executable = isJavaScript ? process.execPath : binaryPath;
@@ -262517,6 +262617,7 @@ async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
262517
262617
  return execFilePromise2(executable, executableArgs, {
262518
262618
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
262519
262619
  cwd,
262620
+ ...environment ? { env: { ...environment } } : {},
262520
262621
  encoding: "utf8",
262521
262622
  timeout: 12e4
262522
262623
  });
@@ -263138,11 +263239,11 @@ function safeAgentLoopErrorMessage(error) {
263138
263239
  return `${message2.slice(0, AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS - 1)}\u2026`;
263139
263240
  }
263140
263241
  function waitForAgentRetry(delayMs, signal) {
263141
- return new Promise((resolve25, reject) => {
263242
+ return new Promise((resolve26, reject) => {
263142
263243
  const cleanup = () => signal?.removeEventListener("abort", onAbort);
263143
263244
  const timeout = setTimeout(() => {
263144
263245
  cleanup();
263145
- resolve25();
263246
+ resolve26();
263146
263247
  }, delayMs);
263147
263248
  timeout.unref?.();
263148
263249
  const onAbort = () => {
@@ -263182,12 +263283,24 @@ function hookErrorOutput(error) {
263182
263283
  if (output.trim()) return output;
263183
263284
  return typeof record.message === "string" ? record.message : String(error);
263184
263285
  }
263185
- function hasSuccessfulFileMutations(history) {
263286
+ function hasSuccessfulWorkspaceFileMutations(history, cwd) {
263186
263287
  const mutationCallIds = /* @__PURE__ */ new Set();
263187
263288
  for (const message2 of history) {
263188
263289
  for (const block2 of message2.content) {
263189
263290
  if (block2.type === "tool_call" && isFileMutationTool(block2.toolCall.name)) {
263190
- mutationCallIds.add(block2.toolCall.id);
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
+ }
263191
263304
  }
263192
263305
  }
263193
263306
  }
@@ -264296,7 +264409,7 @@ Orbit: ${this.interaction.formatMarkdown?.(responseText) || responseText}`
264296
264409
  if (steeringApplied || backgroundReconciled) continue;
264297
264410
  }
264298
264411
  if (toolCallsToExecute.length === 0) {
264299
- const hasEdits = this.workspaceMutationRevision > 0 || hasSuccessfulFileMutations(this.state.history);
264412
+ const hasEdits = this.workspaceMutationRevision > 0 || hasSuccessfulWorkspaceFileMutations(this.state.history, this.cwd);
264300
264413
  if (hasEdits) {
264301
264414
  if (this.verificationManager.hasContract()) {
264302
264415
  this.sessionManager.setRunState("verifying", "verification", {
@@ -264381,7 +264494,9 @@ Please analyze this failure, fix the codebase, and ensure it passes the verifica
264381
264494
  {
264382
264495
  cwd: this.cwd,
264383
264496
  sessionId: this.state.sessionId,
264384
- abortSignal: this.abortController?.signal
264497
+ config: this.config,
264498
+ abortSignal: this.abortController?.signal,
264499
+ services: this.toolRuntimeServices
264385
264500
  }
264386
264501
  );
264387
264502
  const verificationWorkspaceAfter = await captureWorkspaceMutationSnapshot(this.cwd);
@@ -264653,7 +264768,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
264653
264768
  evalArgsRecord.filePath,
264654
264769
  evalArgsRecord.file
264655
264770
  );
264656
- if (targetPath2) {
264771
+ if (targetPath2 && !isFullAccessEnabled(this.config)) {
264657
264772
  const relPath = path7.relative(this.cwd, path7.resolve(this.cwd, targetPath2)).replace(/\\/g, "/");
264658
264773
  const foundFile = this.state.relevantFiles.find(
264659
264774
  (f) => f.path === relPath
@@ -264875,6 +264990,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
264875
264990
  });
264876
264991
  let beforeContent = null;
264877
264992
  let targetPath;
264993
+ const fullAccess = isFullAccessEnabled(this.config);
264878
264994
  let parsedArgs = {};
264879
264995
  try {
264880
264996
  parsedArgs = toUnknownRecord(JSON.parse(tc.arguments));
@@ -264887,11 +265003,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
264887
265003
  } catch {
264888
265004
  }
264889
265005
  let absoluteTargetPath;
265006
+ let workspaceTargetPath;
264890
265007
  if (targetPath) {
264891
265008
  try {
264892
- absoluteTargetPath = resolveSafePath(this.cwd, targetPath);
265009
+ workspaceTargetPath = resolveSafePath(this.cwd, targetPath);
265010
+ absoluteTargetPath = workspaceTargetPath;
264893
265011
  } catch {
264894
- absoluteTargetPath = void 0;
265012
+ absoluteTargetPath = fullAccess ? path7.resolve(this.cwd, targetPath) : void 0;
264895
265013
  }
264896
265014
  }
264897
265015
  let skipToolExecution = false;
@@ -264905,7 +265023,8 @@ Please analyze this failure log, locate the files causing assertion or compile e
264905
265023
  try {
264906
265024
  await execPromise2(testCmd, {
264907
265025
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
264908
- cwd: this.cwd
265026
+ cwd: this.cwd,
265027
+ env: this.buildChildProcessEnvironment()
264909
265028
  });
264910
265029
  this.interaction.showText(`\u2714 Pre-commit checks passed.`);
264911
265030
  } catch (error) {
@@ -264915,7 +265034,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
264915
265034
  `\u2716 Pre-commit checks failed. Verification tests failed.`
264916
265035
  )
264917
265036
  );
264918
- const choice = this.options?.nonInteractive ? "no" : await this.askSelect(
265037
+ const choice = fullAccess ? "yes" : this.options?.nonInteractive ? "no" : await this.askSelect(
264919
265038
  `Pre-commit verification tests failed. How would you like to proceed?`,
264920
265039
  [
264921
265040
  {
@@ -264929,6 +265048,13 @@ Please analyze this failure log, locate the files causing assertion or compile e
264929
265048
  { value: "no", label: "Abort the commit entirely" }
264930
265049
  ]
264931
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
+ }
264932
265058
  if (choice === "diagnose") {
264933
265059
  eventBus.emitEvent("tool_result", {
264934
265060
  toolCallId: tc.id,
@@ -264973,7 +265099,8 @@ ${commandError}`,
264973
265099
  try {
264974
265100
  const { stdout: stdout2 } = await execPromise2("git diff --cached", {
264975
265101
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
264976
- cwd: this.cwd
265102
+ cwd: this.cwd,
265103
+ env: this.buildChildProcessEnvironment()
264977
265104
  });
264978
265105
  if (!stdout2.trim()) {
264979
265106
  this.interaction.showText(
@@ -265022,17 +265149,26 @@ ${stdout2.substring(0, 2e4)}`
265022
265149
  }
265023
265150
  }
265024
265151
  }
265025
- if ((tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content") && targetPath) {
265026
- const checkpoint = await this.checkpointManager.captureBeforeState(
265027
- tc.id,
265028
- targetPath
265029
- );
265030
- beforeContent = checkpoint.backups[0].originalContent;
265031
- eventBus.emitEvent("checkpoint_created", {
265032
- checkpointId: checkpoint.id,
265033
- timestamp: checkpoint.timestamp,
265034
- message: `Before executing ${tc.name} on ${targetPath}`
265035
- });
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
+ }
265036
265172
  if (this.config.hooks?.preEdit) {
265037
265173
  this.interaction.showText(`\u25CF Running pre-edit hook...`);
265038
265174
  const hookRes = await this.runHook(
@@ -265127,7 +265263,8 @@ ${stdout2.substring(0, 2e4)}`
265127
265263
  this.cwd,
265128
265264
  "@biomejs/biome",
265129
265265
  "biome",
265130
- ["format", "--write", absoluteTargetPath]
265266
+ ["format", "--write", absoluteTargetPath],
265267
+ this.buildChildProcessEnvironment()
265131
265268
  );
265132
265269
  } else {
265133
265270
  const prettierCandidates = [
@@ -265153,7 +265290,8 @@ ${stdout2.substring(0, 2e4)}`
265153
265290
  this.cwd,
265154
265291
  "prettier",
265155
265292
  "prettier",
265156
- ["--write", absoluteTargetPath]
265293
+ ["--write", absoluteTargetPath],
265294
+ this.buildChildProcessEnvironment()
265157
265295
  );
265158
265296
  }
265159
265297
  }
@@ -265171,10 +265309,13 @@ ${stdout2.substring(0, 2e4)}`
265171
265309
  }
265172
265310
  }
265173
265311
  if (hasEslintConfig) {
265174
- await executeLocalPackageBinary(this.cwd, "eslint", "eslint", [
265175
- "--fix",
265176
- absoluteTargetPath
265177
- ]);
265312
+ await executeLocalPackageBinary(
265313
+ this.cwd,
265314
+ "eslint",
265315
+ "eslint",
265316
+ ["--fix", absoluteTargetPath],
265317
+ this.buildChildProcessEnvironment()
265318
+ );
265178
265319
  }
265179
265320
  } catch {
265180
265321
  }
@@ -265195,7 +265336,8 @@ ${stdout2.substring(0, 2e4)}`
265195
265336
  this.cwd,
265196
265337
  lintPackage,
265197
265338
  lintBinary,
265198
- lintArgs
265339
+ lintArgs,
265340
+ this.buildChildProcessEnvironment()
265199
265341
  );
265200
265342
  this.interaction.showText(`\u2714 Syntax verification passed.`);
265201
265343
  } catch (error) {
@@ -265236,7 +265378,7 @@ ${stdout2.substring(0, 2e4)}`
265236
265378
  const uniqueModules = Array.from(new Set(missingModules));
265237
265379
  let dependenciesInstalled = false;
265238
265380
  for (const pkg of uniqueModules) {
265239
- const installPkg = await this.interaction.askApproval(
265381
+ const installPkg = fullAccess || await this.interaction.askApproval(
265240
265382
  `Missing dependency "${pkg}" detected. Install it automatically?`
265241
265383
  );
265242
265384
  if (installPkg) {
@@ -265257,7 +265399,8 @@ ${stdout2.substring(0, 2e4)}`
265257
265399
  const args = isPnpm || isYarn ? ["add", "-D", pkg] : ["install", "--save-dev", pkg];
265258
265400
  await execFilePromise3(executable, args, {
265259
265401
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
265260
- cwd: this.cwd
265402
+ cwd: this.cwd,
265403
+ env: this.buildChildProcessEnvironment()
265261
265404
  });
265262
265405
  this.interaction.showText(
265263
265406
  `\u2714 Installed "${pkg}" successfully.`
@@ -265281,7 +265424,8 @@ ${stdout2.substring(0, 2e4)}`
265281
265424
  this.cwd,
265282
265425
  "eslint",
265283
265426
  "eslint",
265284
- ["--quiet", absoluteTargetPath]
265427
+ ["--quiet", absoluteTargetPath],
265428
+ this.buildChildProcessEnvironment()
265285
265429
  );
265286
265430
  this.interaction.showText(
265287
265431
  `\u2714 Syntax verification passed after dependency installation.`
@@ -265365,7 +265509,8 @@ ${stdout2.substring(0, 2e4)}`
265365
265509
  this.cwd,
265366
265510
  "eslint",
265367
265511
  "eslint",
265368
- ["--quiet", absoluteTargetPath]
265512
+ ["--quiet", absoluteTargetPath],
265513
+ this.buildChildProcessEnvironment()
265369
265514
  );
265370
265515
  this.interaction.showText(
265371
265516
  `\u2714 Syntax verification passed after auto-imports injection.`
@@ -265383,7 +265528,7 @@ ${stdout2.substring(0, 2e4)}`
265383
265528
  }
265384
265529
  }
265385
265530
  if (!checkPassedAfterAutofix) {
265386
- const autoFix = await this.interaction.askApproval(
265531
+ const autoFix = fullAccess || await this.interaction.askApproval(
265387
265532
  `Lint/Syntax verification failed. Let Agent auto-repair the file?`
265388
265533
  );
265389
265534
  if (autoFix) {
@@ -265419,7 +265564,7 @@ ${stdout2.substring(0, 2e4)}`
265419
265564
  } catch {
265420
265565
  }
265421
265566
  let accepted = false;
265422
- 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({
265423
265568
  filePath: targetPath,
265424
265569
  before: beforeContent,
265425
265570
  after: afterContent,
@@ -265596,8 +265741,8 @@ ${stdout2.substring(0, 2e4)}`
265596
265741
  };
265597
265742
  }
265598
265743
  }
265599
- if (finalResult.ok && targetPath && absoluteTargetPath && isFileMutationTool(tc.name)) {
265600
- const auditedTargetPath = path7.relative(this.cwd, absoluteTargetPath).replace(/\\/g, "/");
265744
+ if (finalResult.ok && targetPath && absoluteTargetPath && workspaceTargetPath && isFileMutationTool(tc.name)) {
265745
+ const auditedTargetPath = path7.relative(this.cwd, workspaceTargetPath).replace(/\\/g, "/");
265601
265746
  this.registerWorkspaceMutation([auditedTargetPath], tc.name);
265602
265747
  try {
265603
265748
  const afterContent = readBoundedRegularFile(
@@ -265664,7 +265809,7 @@ ${stdout2.substring(0, 2e4)}`
265664
265809
  this.interaction.showText(
265665
265810
  ` ${picocolors3.green("\u2714")} Success: ${picocolors3.gray(statusText)}`
265666
265811
  );
265667
- if (targetPath) {
265812
+ if (targetPath && workspaceTargetPath) {
265668
265813
  this.addRelevantFile(targetPath, `Modified by ${tc.name}`);
265669
265814
  }
265670
265815
  if (tc.name === "write_file" || tc.name === "edit_file") {
@@ -265757,7 +265902,8 @@ ${guardNudge.message}` : ""),
265757
265902
  try {
265758
265903
  const preparedCommit = prepareIsolatedGitCommit(
265759
265904
  this.cwd,
265760
- modifiedFiles
265905
+ modifiedFiles,
265906
+ this.buildChildProcessEnvironment()
265761
265907
  );
265762
265908
  try {
265763
265909
  const diff = preparedCommit.diff;
@@ -266018,10 +266164,10 @@ ${diff.substring(0, 2e4)}`
266018
266164
  const { stdout: stdout2, stderr } = await execPromise2(hookCommand, {
266019
266165
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
266020
266166
  cwd: this.cwd,
266021
- env: buildSanitizedChildEnvironment({
266022
- mode: "minimal",
266023
- extra: { ORBIT_FILE: relativePath }
266024
- }),
266167
+ env: this.buildChildProcessEnvironment(
266168
+ { ORBIT_FILE: relativePath },
266169
+ true
266170
+ ),
266025
266171
  timeout: this.config.tools.bash.timeoutMs,
266026
266172
  signal: this.abortController?.signal
266027
266173
  });
@@ -266742,13 +266888,21 @@ ${diff.substring(0, 2e4)}`
266742
266888
  try {
266743
266889
  await execPromise2("git rev-parse --is-inside-work-tree", {
266744
266890
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
266745
- cwd: this.cwd
266891
+ cwd: this.cwd,
266892
+ env: this.buildChildProcessEnvironment()
266746
266893
  });
266747
266894
  return true;
266748
266895
  } catch {
266749
266896
  return false;
266750
266897
  }
266751
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
+ }
266752
266906
  shouldShowDeepSeekCacheStatus(inputTokens = 0, hitRate = 1) {
266753
266907
  const verbose = process.env[DEEPSEEK_VERBOSE_CACHE_ENV];
266754
266908
  if (verbose === "1" || verbose?.toLowerCase() === "true") {
@@ -267000,21 +267154,21 @@ var AgentTaskScheduler = class {
267000
267154
  Math.min(36e5, Math.floor(task.timeoutMs ?? 6e5))
267001
267155
  );
267002
267156
  let timeout;
267003
- const timeoutResult = new Promise((resolve25) => {
267157
+ const timeoutResult = new Promise((resolve26) => {
267004
267158
  timeout = setTimeout(() => {
267005
267159
  const error = new Error(`Agent task timed out after ${timeoutMs}ms.`);
267006
267160
  taskController.abort(error);
267007
- resolve25({ id: task.id, status: "failed", error });
267161
+ resolve26({ id: task.id, status: "failed", error });
267008
267162
  this.abort(
267009
267163
  `Agent task ${task.id} timed out; the remaining task graph was cancelled.`
267010
267164
  );
267011
267165
  }, timeoutMs);
267012
267166
  });
267013
267167
  let removeSchedulerAbortListener = () => void 0;
267014
- const schedulerAbortResult = new Promise((resolve25) => {
267168
+ const schedulerAbortResult = new Promise((resolve26) => {
267015
267169
  const onAbort = () => {
267016
267170
  if (taskController.signal.aborted) return;
267017
- resolve25({
267171
+ resolve26({
267018
267172
  id: task.id,
267019
267173
  status: "aborted",
267020
267174
  error: abortError2(this.controller.signal)
@@ -267051,8 +267205,8 @@ var AgentTaskScheduler = class {
267051
267205
  try {
267052
267206
  await Promise.race([
267053
267207
  runResult.then(() => void 0),
267054
- new Promise((resolve25) => {
267055
- graceTimer = setTimeout(resolve25, this.abortGraceMs);
267208
+ new Promise((resolve26) => {
267209
+ graceTimer = setTimeout(resolve26, this.abortGraceMs);
267056
267210
  graceTimer.unref?.();
267057
267211
  })
267058
267212
  ]);
@@ -268079,15 +268233,15 @@ var AutocompleteEngine = class {
268079
268233
  this.activeRequests.set(windowId, controller);
268080
268234
  const signal = controller.signal;
268081
268235
  const debounceMs = config.autocomplete?.debounceMs !== void 0 ? config.autocomplete.debounceMs : 150;
268082
- return new Promise((resolve25) => {
268083
- this.debounceResolvers.set(windowId, resolve25);
268236
+ return new Promise((resolve26) => {
268237
+ this.debounceResolvers.set(windowId, resolve26);
268084
268238
  const timer = setTimeout(async () => {
268085
268239
  if (this.debounceTimers.get(windowId) === timer) {
268086
268240
  this.debounceTimers.delete(windowId);
268087
268241
  }
268088
268242
  this.debounceResolvers.delete(windowId);
268089
268243
  if (signal.aborted) {
268090
- resolve25("");
268244
+ resolve26("");
268091
268245
  return;
268092
268246
  }
268093
268247
  const providerId = config.autocomplete.provider || "ollama";
@@ -268095,7 +268249,7 @@ var AutocompleteEngine = class {
268095
268249
  try {
268096
268250
  const provider = this.getCachedProvider(providerId, config);
268097
268251
  if (typeof provider.complete !== "function") {
268098
- resolve25("");
268252
+ resolve26("");
268099
268253
  return;
268100
268254
  }
268101
268255
  const header = getPathCommentHeader(windowId, this.cwd);
@@ -268207,21 +268361,21 @@ var AutocompleteEngine = class {
268207
268361
  if (speculativeTimer) clearTimeout(speculativeTimer);
268208
268362
  }
268209
268363
  if (winner !== "__TIMEOUT__" && winner.trim() !== "") {
268210
- resolve25(winner);
268364
+ resolve26(winner);
268211
268365
  } else {
268212
268366
  const localResult = await localPromise;
268213
268367
  if (localResult.trim() !== "") {
268214
- resolve25(localResult);
268368
+ resolve26(localResult);
268215
268369
  } else {
268216
- resolve25(await cloudPromise.catch(() => ""));
268370
+ resolve26(await cloudPromise.catch(() => ""));
268217
268371
  }
268218
268372
  }
268219
268373
  } else {
268220
268374
  const completed = await cloudPromise;
268221
- resolve25(completed);
268375
+ resolve26(completed);
268222
268376
  }
268223
268377
  } catch {
268224
- resolve25("");
268378
+ resolve26("");
268225
268379
  } finally {
268226
268380
  if (this.activeRequests.get(windowId) === controller) {
268227
268381
  this.activeRequests.delete(windowId);
@@ -268234,7 +268388,7 @@ var AutocompleteEngine = class {
268234
268388
  /** Cancel outstanding completions and release timers held by the engine. */
268235
268389
  dispose() {
268236
268390
  for (const timer of this.debounceTimers.values()) clearTimeout(timer);
268237
- for (const resolve25 of this.debounceResolvers.values()) resolve25("");
268391
+ for (const resolve26 of this.debounceResolvers.values()) resolve26("");
268238
268392
  for (const controller of this.activeRequests.values()) controller.abort();
268239
268393
  this.debounceTimers.clear();
268240
268394
  this.debounceResolvers.clear();
@@ -268250,7 +268404,7 @@ function latestObservation(metadata) {
268250
268404
  }
268251
268405
  function buildCacheDiagnostics(cwd) {
268252
268406
  const dir = join11(cwd, ".orbit", "cache-slabs");
268253
- if (!existsSync12(dir)) {
268407
+ if (!existsSync13(dir)) {
268254
268408
  return picocolors4.gray(
268255
268409
  "\u25CF No cache telemetry yet. It will appear after a completed DeepSeek request."
268256
268410
  );
@@ -268956,11 +269110,11 @@ function statusLine(ok, text2, warn = false) {
268956
269110
  return warn ? picocolors6.yellow(`\u26A0\uFE0F ${text2}`) : picocolors6.red(`\u2716 ${text2}`);
268957
269111
  }
268958
269112
  function packageManager(cwd) {
268959
- if (existsSync13(join12(cwd, "pnpm-lock.yaml"))) return "pnpm";
268960
- if (existsSync13(join12(cwd, "yarn.lock"))) return "yarn";
268961
- if (existsSync13(join12(cwd, "bun.lockb"))) return "bun";
268962
- if (existsSync13(join12(cwd, "package-lock.json"))) return "npm";
268963
- if (existsSync13(join12(cwd, "package.json"))) return "npm";
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";
268964
269118
  return "unknown";
268965
269119
  }
268966
269120
  function boolText(value) {
@@ -270723,7 +270877,7 @@ var n2 = class extends V {
270723
270877
  import { styleText as styleText2, stripVTControlCharacters } from "util";
270724
270878
  import process$1 from "process";
270725
270879
  var import_sisteransi2 = __toESM(require_src(), 1);
270726
- import { existsSync as existsSync14, lstatSync as lstatSync6, readdirSync as readdirSync6 } from "fs";
270880
+ import { existsSync as existsSync15, lstatSync as lstatSync6, readdirSync as readdirSync6 } from "fs";
270727
270881
  import { dirname as dirname9, join as join13 } from "path";
270728
270882
  function isUnicodeSupported() {
270729
270883
  if (process$1.platform !== "win32") {
@@ -271557,7 +271711,7 @@ var Prompt = class {
271557
271711
  });
271558
271712
  }
271559
271713
  static async askTextWithAutocomplete(message2, completerFn, promptPrefix) {
271560
- return new Promise((resolve25) => {
271714
+ return new Promise((resolve26) => {
271561
271715
  const promptStr = promptPrefix !== void 0 ? promptPrefix : `${picocolors22.cyan("?")} ${message2} \u203A `;
271562
271716
  const rl = readline.createInterface({
271563
271717
  input: process.stdin,
@@ -271625,7 +271779,7 @@ var Prompt = class {
271625
271779
  clearSuggestions();
271626
271780
  rl.close();
271627
271781
  process.stdout.write("\n");
271628
- resolve25(null);
271782
+ resolve26(null);
271629
271783
  return;
271630
271784
  }
271631
271785
  if (currentSuggestion && key && (key.name === "tab" || key.name === "right")) {
@@ -271653,12 +271807,12 @@ var Prompt = class {
271653
271807
  clearSuggestions();
271654
271808
  rl.close();
271655
271809
  process.stdout.write("\n");
271656
- resolve25(null);
271810
+ resolve26(null);
271657
271811
  });
271658
271812
  rl.on("line", (line) => {
271659
271813
  clearSuggestions();
271660
271814
  rl.close();
271661
- resolve25(line);
271815
+ resolve26(line);
271662
271816
  });
271663
271817
  });
271664
271818
  }
@@ -271999,7 +272153,7 @@ import picocolors20 from "picocolors";
271999
272153
  // src/tui/FullscreenTui.ts
272000
272154
  import { join as join15 } from "path";
272001
272155
  import { homedir as homedir7 } from "os";
272002
- import { existsSync as existsSync15 } from "fs";
272156
+ import { existsSync as existsSync16 } from "fs";
272003
272157
  import { exec as exec4 } from "child_process";
272004
272158
  import readline3 from "readline";
272005
272159
 
@@ -272584,9 +272738,9 @@ var SLASH_COMMAND_DEFINITIONS = [
272584
272738
  {
272585
272739
  value: "auto",
272586
272740
  description: {
272587
- en: "Routine actions run automatically; dangerous patterns block and opaque commands ask",
272588
- zh: "\u666E\u901A\u64CD\u4F5C\u5168\u81EA\u52A8\uFF1B\u5371\u9669\u6A21\u5F0F\u963B\u6B62\uFF0C\u4E0D\u900F\u660E\u547D\u4EE4\u4ECD\u786E\u8BA4",
272589
- "zh-TW": "\u4E00\u822C\u64CD\u4F5C\u5168\u81EA\u52D5\uFF1B\u5371\u96AA\u6A21\u5F0F\u5C01\u9396\uFF0C\u4E0D\u900F\u660E\u547D\u4EE4\u4ECD\u9700\u78BA\u8A8D"
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"
272590
272744
  }
272591
272745
  },
272592
272746
  {
@@ -273396,7 +273550,7 @@ var TuiPromptSession = class {
273396
273550
  this.requestRender();
273397
273551
  const wasRaw = !!this.stdin.isRaw;
273398
273552
  if (this.stdin.setRawMode) this.stdin.setRawMode(true);
273399
- return new Promise((resolve25) => {
273553
+ return new Promise((resolve26) => {
273400
273554
  const listener = (str, key = {}) => {
273401
273555
  const state = this.promptState;
273402
273556
  if (!state) {
@@ -273414,7 +273568,7 @@ var TuiPromptSession = class {
273414
273568
  this.requestRender();
273415
273569
  }
273416
273570
  };
273417
- this.active = { resolve: resolve25, wasRaw, listener };
273571
+ this.active = { resolve: resolve26, wasRaw, listener };
273418
273572
  this.stdin.on("keypress", listener);
273419
273573
  this.stdin.resume();
273420
273574
  });
@@ -273774,7 +273928,7 @@ function runNpmCommand(executable, args, options) {
273774
273928
  });
273775
273929
  }
273776
273930
  function runNpmCommandAsync(executable, args, timeoutMs) {
273777
- return new Promise((resolve25, reject) => {
273931
+ return new Promise((resolve26, reject) => {
273778
273932
  execFile5(
273779
273933
  executable,
273780
273934
  args,
@@ -273789,7 +273943,7 @@ function runNpmCommandAsync(executable, args, timeoutMs) {
273789
273943
  reject(error);
273790
273944
  return;
273791
273945
  }
273792
- resolve25(stdout2);
273946
+ resolve26(stdout2);
273793
273947
  }
273794
273948
  );
273795
273949
  });
@@ -273880,11 +274034,11 @@ async function pageText(text2) {
273880
274034
  process.stdin.setRawMode(true);
273881
274035
  process.stdin.resume();
273882
274036
  readline2.emitKeypressEvents(process.stdin);
273883
- const waitForKeypress = () => new Promise((resolve25) => {
274037
+ const waitForKeypress = () => new Promise((resolve26) => {
273884
274038
  const onKeypress = (str, key) => {
273885
274039
  process.stdin.removeListener("keypress", onKeypress);
273886
- if (key?.ctrl && key.name === "c") return resolve25("interrupt");
273887
- resolve25(key?.name || str);
274040
+ if (key?.ctrl && key.name === "c") return resolve26("interrupt");
274041
+ resolve26(key?.name || str);
273888
274042
  };
273889
274043
  process.stdin.on("keypress", onKeypress);
273890
274044
  });
@@ -274019,9 +274173,9 @@ var FullscreenTui = class {
274019
274173
  const planPath2 = join15(this.cwd, ".orbit", "task.md");
274020
274174
  const planPath1 = join15(this.cwd, "task.md");
274021
274175
  let planPath = "";
274022
- if (existsSync15(planPath2)) {
274176
+ if (existsSync16(planPath2)) {
274023
274177
  planPath = planPath2;
274024
- } else if (existsSync15(planPath1)) {
274178
+ } else if (existsSync16(planPath1)) {
274025
274179
  planPath = planPath1;
274026
274180
  }
274027
274181
  if (!planPath) {
@@ -274413,23 +274567,23 @@ var FullscreenTui = class {
274413
274567
  modified: 0,
274414
274568
  deleted: 0
274415
274569
  };
274416
- const branchPromise = new Promise((resolve25) => {
274570
+ const branchPromise = new Promise((resolve26) => {
274417
274571
  exec4(
274418
274572
  "git rev-parse --abbrev-ref HEAD",
274419
274573
  { ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
274420
274574
  (err, stdout2) => {
274421
- if (err) resolve25("no-git");
274422
- else resolve25(stdout2.trim());
274575
+ if (err) resolve26("no-git");
274576
+ else resolve26(stdout2.trim());
274423
274577
  }
274424
274578
  );
274425
274579
  });
274426
- const statusPromise = new Promise((resolve25) => {
274580
+ const statusPromise = new Promise((resolve26) => {
274427
274581
  exec4(
274428
274582
  "git status --porcelain",
274429
274583
  { ...HIDDEN_CHILD_PROCESS_OPTIONS, cwd: this.cwd },
274430
274584
  (err, stdout2) => {
274431
- if (err) resolve25("");
274432
- else resolve25(stdout2);
274585
+ if (err) resolve26("");
274586
+ else resolve26(stdout2);
274433
274587
  }
274434
274588
  );
274435
274589
  });
@@ -274953,8 +275107,8 @@ var FullscreenTui = class {
274953
275107
  this.start(this.budgetLimit);
274954
275108
  }
274955
275109
  process.stdout.write("\x1B[?25h");
274956
- return new Promise((resolve25) => {
274957
- this.resolveInput = resolve25;
275110
+ return new Promise((resolve26) => {
275111
+ this.resolveInput = resolve26;
274958
275112
  this.inputBuffer = "";
274959
275113
  this.cursorPosition = 0;
274960
275114
  this.hideAutocomplete = false;
@@ -274989,7 +275143,7 @@ var FullscreenTui = class {
274989
275143
  cleanup();
274990
275144
  process.stdout.write("\x1B[?25l");
274991
275145
  this.resolveInput = null;
274992
- resolve25(null);
275146
+ resolve26(null);
274993
275147
  } else {
274994
275148
  this.ctrlCPressedOnce = true;
274995
275149
  if (this.ctrlCTimeout) clearTimeout(this.ctrlCTimeout);
@@ -275043,7 +275197,7 @@ var FullscreenTui = class {
275043
275197
  this.inputBuffer = "";
275044
275198
  this.cursorPosition = 0;
275045
275199
  this.render();
275046
- resolve25(submitted);
275200
+ resolve26(submitted);
275047
275201
  return;
275048
275202
  }
275049
275203
  if (key && key.ctrl && key.name === "j") {
@@ -276022,7 +276176,7 @@ import { z as z69 } from "zod";
276022
276176
  import picocolors18 from "picocolors";
276023
276177
 
276024
276178
  // src/commands/customCommands.ts
276025
- import { existsSync as existsSync16, readdirSync as readdirSync7 } from "fs";
276179
+ import { existsSync as existsSync17, readdirSync as readdirSync7 } from "fs";
276026
276180
  import { basename as basename4, extname as extname3, join as join16 } from "path";
276027
276181
  import { homedir as homedir8 } from "os";
276028
276182
  import { fileURLToPath as fileURLToPath3 } from "url";
@@ -276079,7 +276233,7 @@ function parseCommandFile(filePath, source) {
276079
276233
  };
276080
276234
  }
276081
276235
  function loadDirectory(directory, source) {
276082
- if (!existsSync16(directory)) return [];
276236
+ if (!existsSync17(directory)) return [];
276083
276237
  const commands = [];
276084
276238
  const queue = [directory];
276085
276239
  while (queue.length > 0 && commands.length < 200) {
@@ -276149,7 +276303,7 @@ function resolveBundledCommandsDirectory() {
276149
276303
  new URL("../../commands/", import.meta.url),
276150
276304
  new URL("../commands/", import.meta.url)
276151
276305
  ].map((candidate) => fileURLToPath3(candidate));
276152
- return candidates.find((candidate) => existsSync16(candidate)) ?? candidates[0];
276306
+ return candidates.find((candidate) => existsSync17(candidate)) ?? candidates[0];
276153
276307
  }
276154
276308
  function expandCustomCommand(command, rawArguments) {
276155
276309
  const args = rawArguments.trim();
@@ -276234,12 +276388,12 @@ import { createRequire as createRequire2 } from "module";
276234
276388
  // src/runtime/webui/WebUiRuntime.ts
276235
276389
  import http2 from "http";
276236
276390
  import { randomBytes as randomBytes3, randomUUID as randomUUID10 } from "crypto";
276237
- import { isAbsolute as isAbsolute5, relative as relative8, resolve as resolve11 } from "path";
276391
+ import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve11 } from "path";
276238
276392
  import { z as z58 } from "zod";
276239
276393
 
276240
276394
  // src/runtime/AutocompleteCandidates.ts
276241
276395
  import glob4 from "fast-glob";
276242
- import { existsSync as existsSync17, readdirSync as readdirSync8 } from "fs";
276396
+ import { existsSync as existsSync18, readdirSync as readdirSync8 } from "fs";
276243
276397
  import { homedir as homedir9 } from "os";
276244
276398
  import { dirname as dirname10, join as join17, resolve as resolve9 } from "path";
276245
276399
  import { z as z55 } from "zod";
@@ -276302,7 +276456,7 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
276302
276456
  }
276303
276457
  try {
276304
276458
  const indexPath = join17(cwd, ".orbit", "symbols.json");
276305
- if (existsSync17(indexPath)) {
276459
+ if (existsSync18(indexPath)) {
276306
276460
  const raw = await readBoundedRegularFileAsync(
276307
276461
  indexPath,
276308
276462
  AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES
@@ -276324,9 +276478,9 @@ async function getAutocompleteCandidates(cwd, config, mcpPromptCommands = []) {
276324
276478
  cwd,
276325
276479
  config.session?.path ?? ".orbit/sessions"
276326
276480
  );
276327
- if (existsSync17(sessionDir)) {
276481
+ if (existsSync18(sessionDir)) {
276328
276482
  for (const dir of readdirSync8(sessionDir)) {
276329
- if (existsSync17(join17(sessionDir, dir, "session.json"))) {
276483
+ if (existsSync18(join17(sessionDir, dir, "session.json"))) {
276330
276484
  sessions.push(dir);
276331
276485
  }
276332
276486
  }
@@ -276723,28 +276877,93 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276723
276877
  closeContextPicker({ skipRestore: true });
276724
276878
  void updateSession({ action: 'new' });
276725
276879
  });
276726
- const closeProjectDialog = (restoreFocus = true) => {
276880
+ const closeProjectDialog = (restoreFocus = true, force = false) => {
276727
276881
  if (elements.projectDialog.hidden) return;
276882
+ if (state.projectLaunchPending && !force) return;
276728
276883
  elements.projectDialog.hidden = true;
276729
276884
  elements.projectDialog.setAttribute('aria-hidden', 'true');
276730
276885
  if (restoreFocus && state.projectDialogReturnFocus) state.projectDialogReturnFocus.focus();
276731
276886
  state.projectDialogReturnFocus = null;
276732
276887
  };
276733
276888
  const openProjectDialog = () => {
276734
- if (state.busy) return;
276889
+ if (state.busy || state.projectLaunchPending) return;
276735
276890
  state.projectDialogReturnFocus = document.activeElement;
276736
276891
  elements.projectDialog.hidden = false;
276737
276892
  elements.projectDialog.setAttribute('aria-hidden', 'false');
276738
276893
  elements.projectPathInput.focus();
276739
276894
  elements.projectPathInput.select();
276740
276895
  };
276741
- const reserveProjectTab = () => {
276896
+ const showReservedProjectStatus = (projectTab, label, failed = false) => {
276897
+ if (!projectTab || projectTab.closed) return;
276898
+ try {
276899
+ const projectDocument = projectTab.document;
276900
+ const sourceStyle = getComputedStyle(document.documentElement);
276901
+ const themeValue = (name, fallback) =>
276902
+ sourceStyle.getPropertyValue(name).trim() || fallback;
276903
+ projectDocument.title = 'Orbit · ' + label;
276904
+ projectDocument.documentElement.lang = document.documentElement.lang;
276905
+ projectDocument.documentElement.style.colorScheme = sourceStyle.colorScheme;
276906
+ projectDocument.body.replaceChildren();
276907
+ Object.assign(projectDocument.body.style, {
276908
+ minHeight: '100vh',
276909
+ margin: '0',
276910
+ display: 'grid',
276911
+ placeItems: 'center',
276912
+ color: themeValue('--ink', '#2c3834'),
276913
+ background: themeValue('--canvas', '#f4f6f3'),
276914
+ fontFamily: themeValue('--font-sans', 'Inter, ui-sans-serif, system-ui, sans-serif'),
276915
+ });
276916
+ const status = projectDocument.createElement('main');
276917
+ status.setAttribute('role', 'status');
276918
+ status.dataset.orbitProjectHandoff = failed ? 'failed' : 'pending';
276919
+ Object.assign(status.style, {
276920
+ display: 'grid',
276921
+ gap: '10px',
276922
+ justifyItems: 'center',
276923
+ minWidth: 'min(360px, calc(100vw - 40px))',
276924
+ padding: '28px',
276925
+ textAlign: 'center',
276926
+ background: themeValue('--surface-raised', '#ffffff'),
276927
+ border: '1px solid ' + themeValue('--border', 'rgba(28, 49, 42, 0.105)'),
276928
+ borderRadius: themeValue('--radius-lg', '18px'),
276929
+ boxShadow: themeValue('--shadow-md', '0 18px 48px rgba(10, 24, 20, 0.14)'),
276930
+ });
276931
+ const brand = projectDocument.createElement('strong');
276932
+ brand.textContent = 'Orbit';
276933
+ Object.assign(brand.style, {
276934
+ color: themeValue('--accent-strong', '#276a5f'),
276935
+ fontSize: '24px',
276936
+ letterSpacing: '-0.02em',
276937
+ });
276938
+ const message = projectDocument.createElement('span');
276939
+ message.textContent = label;
276940
+ Object.assign(message.style, {
276941
+ maxWidth: '42ch',
276942
+ color: failed
276943
+ ? themeValue('--danger', '#bb5755')
276944
+ : themeValue('--muted', '#596761'),
276945
+ fontSize: '14px',
276946
+ lineHeight: '1.55',
276947
+ });
276948
+ status.append(brand, message);
276949
+ projectDocument.body.append(status);
276950
+ } catch {
276951
+ // A browser may isolate the placeholder before Orbit can decorate it.
276952
+ }
276953
+ };
276954
+ const reserveProjectTab = (label) => {
276742
276955
  const projectTab = window.open('about:blank', '_blank');
276743
- if (projectTab) projectTab.opener = null;
276956
+ showReservedProjectStatus(projectTab, label);
276744
276957
  return projectTab;
276745
276958
  };
276746
- const closeReservedProjectTab = (projectTab) => {
276747
- if (projectTab && !projectTab.closed) projectTab.close();
276959
+ const closeReservedProjectTab = (projectTab, message = copy.projectSwitchFailed) => {
276960
+ if (!projectTab || projectTab.closed) return;
276961
+ showReservedProjectStatus(projectTab, message, true);
276962
+ try {
276963
+ projectTab.close();
276964
+ } catch {
276965
+ // The visible failure state remains if the browser refuses window.close().
276966
+ }
276748
276967
  };
276749
276968
  const switchToProject = (result, projectTab) => {
276750
276969
  if (!result || typeof result.url !== 'string') {
@@ -276765,6 +276984,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276765
276984
  throw new Error(copy.projectSwitchFailed);
276766
276985
  }
276767
276986
  if (projectTab && !projectTab.closed) {
276987
+ projectTab.opener = null;
276768
276988
  projectTab.location.replace(projectUrl.href);
276769
276989
  projectTab.focus();
276770
276990
  showToast(copy.projectOpened, 'success');
@@ -276772,41 +276992,48 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276772
276992
  }
276773
276993
  window.location.assign(projectUrl.href);
276774
276994
  };
276775
- const launchProject = async (action, selectedPath) => {
276995
+ const launchProject = async (selectedPath) => {
276776
276996
  const path = String(selectedPath || elements.projectPathInput.value).trim();
276777
276997
  if (!path) {
276778
276998
  showToast(copy.projectPathRequired, 'error');
276779
276999
  elements.projectPathInput.focus();
276780
277000
  return;
276781
277001
  }
276782
- if (elements.projectDialogOpen.disabled) return;
276783
- const projectTab = reserveProjectTab();
276784
- const pendingButton = action === 'create' ? elements.projectDialogCreate : elements.projectDialogOpen;
276785
- const pendingLabel = action === 'create' ? copy.projectCreating : copy.projectOpening;
277002
+ if (elements.projectDialogCreate.disabled) return;
277003
+ const pendingButton = elements.projectDialogCreate;
277004
+ const pendingLabel = copy.projectCreating;
277005
+ const projectTab = reserveProjectTab(pendingLabel);
276786
277006
  const originalLabel = pendingButton.textContent;
277007
+ state.projectLaunchPending = true;
277008
+ elements.projectDialog.setAttribute('aria-busy', 'true');
277009
+ elements.projectDialogBackdrop.disabled = true;
277010
+ elements.projectDialogCancel.disabled = true;
276787
277011
  elements.projectDialogBrowse.disabled = true;
276788
- elements.projectDialogOpen.disabled = true;
276789
277012
  elements.projectDialogCreate.disabled = true;
276790
277013
  pendingButton.textContent = pendingLabel;
276791
277014
  pendingButton.setAttribute('aria-busy', 'true');
276792
- showToast(pendingLabel);
276793
277015
  try {
276794
277016
  const result = await api('/api/project', {
276795
277017
  method: 'POST',
276796
277018
  headers: { 'Content-Type': 'application/json' },
276797
- body: JSON.stringify({ action, path }),
277019
+ body: JSON.stringify({ action: 'create', path }),
276798
277020
  });
276799
- closeProjectDialog(false);
277021
+ await loadStatus().catch(() => {});
277022
+ closeProjectDialog(false, true);
276800
277023
  elements.projectPathInput.value = '';
276801
277024
  switchToProject(result, projectTab);
276802
277025
  } catch (error) {
276803
- closeReservedProjectTab(projectTab);
276804
- showToast(error.message || String(error), 'error');
277026
+ const message = projectErrorMessage(error);
277027
+ closeReservedProjectTab(projectTab, message);
277028
+ showToast(message, 'error');
276805
277029
  } finally {
277030
+ state.projectLaunchPending = false;
277031
+ elements.projectDialog.removeAttribute('aria-busy');
277032
+ elements.projectDialogBackdrop.disabled = false;
277033
+ elements.projectDialogCancel.disabled = false;
276806
277034
  pendingButton.textContent = originalLabel;
276807
277035
  pendingButton.removeAttribute('aria-busy');
276808
277036
  elements.projectDialogBrowse.disabled = false;
276809
- elements.projectDialogOpen.disabled = false;
276810
277037
  elements.projectDialogCreate.disabled = false;
276811
277038
  }
276812
277039
  };
@@ -276815,7 +277042,6 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276815
277042
  state.projectPickerPending = true;
276816
277043
  elements.projectDialogBrowse.disabled = true;
276817
277044
  elements.projectDialogBrowse.setAttribute('aria-busy', 'true');
276818
- elements.projectDialogOpen.disabled = true;
276819
277045
  elements.projectDialogCreate.disabled = true;
276820
277046
  elements.newProjectButton.disabled = true;
276821
277047
  try {
@@ -276834,7 +277060,6 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276834
277060
  state.projectPickerPending = false;
276835
277061
  elements.projectDialogBrowse.disabled = false;
276836
277062
  elements.projectDialogBrowse.removeAttribute('aria-busy');
276837
- elements.projectDialogOpen.disabled = false;
276838
277063
  elements.projectDialogCreate.disabled = false;
276839
277064
  elements.newProjectButton.disabled = false;
276840
277065
  }
@@ -276843,8 +277068,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276843
277068
  elements.projectDialogBackdrop.addEventListener('click', () => closeProjectDialog());
276844
277069
  elements.projectDialogCancel.addEventListener('click', () => closeProjectDialog());
276845
277070
  elements.projectDialogBrowse.addEventListener('click', () => void pickProjectFolder());
276846
- elements.projectDialogOpen.addEventListener('click', () => void launchProject('open'));
276847
- elements.projectDialogCreate.addEventListener('click', () => void launchProject('create'));
277071
+ elements.projectDialogCreate.addEventListener('click', () => void launchProject());
276848
277072
  elements.projectList.addEventListener('click', (event) => {
276849
277073
  const remove = event.target.closest('[data-project-action="remove"]');
276850
277074
  if (remove && !state.busy) {
@@ -276874,7 +277098,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276874
277098
  const button = event.target.closest('[data-project-path]');
276875
277099
  if (!button || button.disabled || state.busy) return;
276876
277100
  state.busy = true;
276877
- const projectTab = reserveProjectTab();
277101
+ const projectTab = reserveProjectTab(copy.projectOpening);
276878
277102
  button.classList.add('is-switching');
276879
277103
  button.setAttribute('aria-busy', 'true');
276880
277104
  showToast(copy.projectOpening);
@@ -276884,7 +277108,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276884
277108
  body: JSON.stringify({ action: 'open', path: button.dataset.projectPath || '' }),
276885
277109
  }).then((result) => switchToProject(result, projectTab))
276886
277110
  .catch((error) => {
276887
- closeReservedProjectTab(projectTab);
277111
+ closeReservedProjectTab(projectTab, error.message || String(error));
276888
277112
  showToast(error.message || String(error), 'error');
276889
277113
  })
276890
277114
  .finally(() => {
@@ -276896,12 +277120,14 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276896
277120
  elements.projectPathInput.addEventListener('keydown', (event) => {
276897
277121
  if (event.key === 'Enter') {
276898
277122
  event.preventDefault();
276899
- void launchProject('open');
277123
+ void launchProject();
276900
277124
  }
276901
277125
  });
276902
277126
  elements.projectDialog.addEventListener('keydown', (event) => {
276903
277127
  if (event.key !== 'Tab') return;
276904
- const focusable = [elements.projectPathInput, elements.projectDialogBrowse, elements.projectDialogCancel, elements.projectDialogOpen, elements.projectDialogCreate];
277128
+ const focusable = [elements.projectPathInput, elements.projectDialogBrowse, elements.projectDialogCancel, elements.projectDialogCreate]
277129
+ .filter((control) => !control.disabled);
277130
+ if (!focusable.length) return;
276905
277131
  const first = focusable[0];
276906
277132
  const last = focusable[focusable.length - 1];
276907
277133
  if (event.shiftKey && document.activeElement === first) {
@@ -276992,6 +277218,77 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
276992
277218
  first.focus();
276993
277219
  }
276994
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
+ });
276995
277292
  elements.commandsButton.addEventListener('click', openCommandPalette);
276996
277293
  elements.commandTrigger.addEventListener('click', openCommandPalette);
276997
277294
  elements.commandPaletteBackdrop.addEventListener('click', closeCommandPalette);
@@ -277067,7 +277364,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
277067
277364
  });
277068
277365
 
277069
277366
  elements.permissionSelect.addEventListener('change', () => {
277070
- applySettings({ permissionMode: elements.permissionSelect.value }, true).catch(() => {});
277367
+ requestPermissionMode(elements.permissionSelect.value, true).catch(() => {});
277071
277368
  });
277072
277369
 
277073
277370
  elements.languageOptions.querySelectorAll('[data-language-value]').forEach((button) => {
@@ -277082,7 +277379,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
277082
277379
  });
277083
277380
 
277084
277381
  elements.permissionSegments.querySelectorAll('[data-mode]').forEach((button) => {
277085
- button.addEventListener('click', () => applySettings({ permissionMode: button.dataset.mode }).catch(() => {}));
277382
+ button.addEventListener('click', () => requestPermissionMode(button.dataset.mode).catch(() => {}));
277086
277383
  });
277087
277384
 
277088
277385
  elements.searchToggle.addEventListener('click', () => {
@@ -277354,6 +277651,10 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
277354
277651
 
277355
277652
  document.addEventListener('keydown', (event) => {
277356
277653
  if (event.key === 'Escape') {
277654
+ if (!elements.fullAccessDialog.hidden) {
277655
+ closeFullAccessDialog();
277656
+ return;
277657
+ }
277357
277658
  if (!elements.projectDialog.hidden) {
277358
277659
  closeProjectDialog();
277359
277660
  return;
@@ -278148,13 +278449,13 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278148
278449
  sessionRestored: '对话已恢复',
278149
278450
  sessionDeleted: '对话已删除',
278150
278451
  projectOpening: '正在新标签页打开项目…',
278151
- projectCreating: '正在创建项目并打开新标签页…',
278452
+ projectCreating: '正在准备项目并打开新标签页…',
278152
278453
  projectOpened: '项目已在新标签页中打开',
278153
278454
  projectSwitchFailed: '项目已启动,但无法安全打开页面',
278154
278455
  projectRemoved: '项目已从 Orbit 移除,磁盘文件未删除',
278155
278456
  removeProject: '从 Orbit 移除项目',
278156
278457
  confirmRemoveProject: '再次点击确认移除',
278157
- projectPathRequired: '请输入完整的项目文件夹路径',
278458
+ projectPathRequired: '请输入项目文件夹的绝对路径',
278158
278459
  archiveSession: '归档',
278159
278460
  restoreSession: '恢复',
278160
278461
  deleteSession: '删除',
@@ -278228,13 +278529,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278228
278529
  modeNormal: '标准',
278229
278530
  modeAuto: '全自动',
278230
278531
  modePlan: '规划',
278231
- permissionFullAccess: chinese('全自动已开启:普通写入、命令和联网工具无需逐次确认;不透明命令仍会询问。', '全自動已開啟:普通寫入、命令和聯網工具無需逐次確認;不透明命令仍會詢問。'),
278532
+ permissionFullAccess: chinese('完整权限已开启:所有已启用工具操作均自动批准。', '完整權限已開啟:所有已啟用工具操作均自動批准。'),
278232
278533
  permissionAutoLimited: chinese('全自动尚未完全生效,部分操作仍需确认。', '全自動尚未完全生效,部分操作仍需確認。'),
278233
278534
  permissionStrict: chinese('严格模式会在重要操作前请求确认。', '嚴格模式會在重要操作前請求確認。'),
278234
278535
  permissionNormal: chinese('标准模式会在写入和执行命令前请求确认。', '標準模式會在寫入和執行命令前請求確認。'),
278235
278536
  permissionPlan: chinese('规划模式只分析和读取,不修改文件。', '規劃模式只分析和讀取,不修改檔案。'),
278236
- permissionGuards: chinese('危险模式会被阻止,显式文件路径会受保护;执行的命令仍是本机进程。', '危險模式會被阻止,顯式檔案路徑會受保護;執行的命令仍是本機程序。'),
278537
+ permissionGuards: chinese('危险操作会被阻止,显式文件路径会受保护;本机命令、成本与失控检查仍然有效。', '危險操作會被阻止,顯式檔案路徑會受保護;本機命令、成本與失控檢查仍然有效。'),
278237
278538
  permissionGuardsReduced: chinese('警告:部分硬安全保护已在配置中关闭。', '警告:部分硬安全保護已在設定中關閉。'),
278539
+ permissionNoGuards: chinese('权限策略不再拦截或复核危险、密钥、不透明、本地网络及工作区外操作。命令拥有当前系统账户权限并继承 Orbit 进程环境;已运行的子进程会保留这些权限直至停止。输出脱敏、项目钩子、验证契约、工具限制及成本与失控检查仍有效;工作区外改动无法由 Orbit 回滚。', '權限策略不再攔截或複核危險、密鑰、不透明、本機網路及工作區外操作。命令擁有目前系統帳戶權限並繼承 Orbit 程序環境;已執行的子程序會保留這些權限直至停止。輸出脫敏、專案掛鉤、驗證契約、工具限制及成本與失控檢查仍有效;工作區外變更無法由 Orbit 回滾。'),
278238
278540
  }
278239
278541
  : {
278240
278542
  connected: 'Connected',
@@ -278300,13 +278602,13 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278300
278602
  sessionRestored: 'Chat restored',
278301
278603
  sessionDeleted: 'Chat deleted',
278302
278604
  projectOpening: 'Opening project in a new tab…',
278303
- projectCreating: 'Creating project and opening a new tab…',
278605
+ projectCreating: 'Preparing project in a new tab…',
278304
278606
  projectOpened: 'Project opened in a new tab',
278305
278607
  projectSwitchFailed: 'The project started, but Orbit could not open it safely',
278306
278608
  projectRemoved: 'Project removed from Orbit; files were not deleted',
278307
278609
  removeProject: 'Remove project from Orbit',
278308
278610
  confirmRemoveProject: 'Click again to confirm removal',
278309
- projectPathRequired: 'Enter the full project folder path',
278611
+ projectPathRequired: 'Enter an absolute project folder path',
278310
278612
  archiveSession: 'Archive',
278311
278613
  restoreSession: 'Restore',
278312
278614
  deleteSession: 'Delete',
@@ -278380,13 +278682,14 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278380
278682
  modeNormal: 'Normal',
278381
278683
  modeAuto: 'Full access',
278382
278684
  modePlan: 'Plan',
278383
- permissionFullAccess: 'Full access is on: ordinary writes, commands, and network tools run without per-action approval; opaque commands still ask.',
278685
+ permissionFullAccess: 'Unrestricted Full Access is on: every enabled tool action is approved automatically.',
278384
278686
  permissionAutoLimited: 'Full access is not fully active; some actions still require approval.',
278385
278687
  permissionStrict: 'Strict mode asks before consequential operations.',
278386
278688
  permissionNormal: 'Normal mode asks before writes and command execution.',
278387
278689
  permissionPlan: 'Plan mode analyzes and reads without changing files.',
278388
- permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; executed commands still run as host processes.',
278690
+ permissionGuards: 'Dangerous patterns are blocked and explicit file paths are guarded; commands remain host processes and periodic cost/runaway checks stay active.',
278389
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.",
278390
278693
  };
278391
278694
 
278392
278695
  if (language === 'zh-TW') {
@@ -278416,11 +278719,12 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278416
278719
  sessionRestored: '對話已復原',
278417
278720
  sessionDeleted: '對話已刪除',
278418
278721
  projectOpening: '正在新分頁開啟專案…',
278419
- projectCreating: '正在建立專案並開啟新分頁…',
278722
+ projectCreating: '正在準備專案並開啟新分頁…',
278420
278723
  projectOpened: '專案已在新分頁中開啟',
278421
278724
  projectSwitchFailed: '專案已啟動,但無法安全開啟頁面',
278422
278725
  projectRemoved: '專案已從 Orbit 移除,磁碟檔案未刪除',
278423
278726
  removeProject: '從 Orbit 移除專案',
278727
+ projectPathRequired: '請輸入專案資料夾的絕對路徑',
278424
278728
  archiveSession: '封存',
278425
278729
  restoreSession: '復原',
278426
278730
  deleteSession: '刪除',
@@ -278468,6 +278772,38 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278468
278772
  });
278469
278773
  }
278470
278774
 
278775
+ const projectErrorMessages = isChinese
278776
+ ? {
278777
+ absolute_path_required: chinese('请输入项目文件夹的绝对路径。', '請輸入專案資料夾的絕對路徑。'),
278778
+ filesystem_root: chinese('为保护系统,不能把磁盘根目录作为 Orbit 项目。', '為保護系統,不能把磁碟根目錄作為 Orbit 專案。'),
278779
+ entrypoint_unavailable: chinese('Orbit CLI 启动入口不可用,请重启 Orbit 后再试。', 'Orbit CLI 啟動入口無法使用,請重新啟動 Orbit 後再試。'),
278780
+ project_missing: chinese('项目文件夹不存在。', '專案資料夾不存在。'),
278781
+ project_not_directory: chinese('选择的路径不是文件夹。', '選擇的路徑不是資料夾。'),
278782
+ parent_missing: chinese('上级文件夹不存在,请先选择一个已有位置。', '上層資料夾不存在,請先選擇一個現有位置。'),
278783
+ parent_not_directory: chinese('项目的上级路径不是文件夹。', '專案的上層路徑不是資料夾。'),
278784
+ create_failed: chinese('无法创建项目文件夹,请检查路径和权限。', '無法建立專案資料夾,請檢查路徑與權限。'),
278785
+ launch_failed: chinese('无法启动此项目的 Orbit 实例。', '無法啟動此專案的 Orbit 執行個體。'),
278786
+ startup_failed: chinese('项目实例在 WebUI 就绪前退出。', '專案執行個體在 WebUI 就緒前結束。'),
278787
+ startup_timeout: chinese('启动项目超时,请重试或检查运行诊断。', '啟動專案逾時,請重試或檢查執行診斷。'),
278788
+ }
278789
+ : {
278790
+ absolute_path_required: 'Enter an absolute project folder path.',
278791
+ filesystem_root: 'A filesystem root cannot be used as an Orbit project.',
278792
+ entrypoint_unavailable: 'The Orbit CLI entry point is unavailable. Restart Orbit and try again.',
278793
+ project_missing: 'The project folder does not exist.',
278794
+ project_not_directory: 'The selected path is not a folder.',
278795
+ parent_missing: 'The parent folder does not exist. Choose an existing location first.',
278796
+ parent_not_directory: 'The project parent path is not a folder.',
278797
+ create_failed: 'Orbit could not create the project folder. Check the path and permissions.',
278798
+ launch_failed: 'Orbit could not start this project.',
278799
+ startup_failed: 'The project exited before its Web UI was ready.',
278800
+ startup_timeout: 'The project took too long to start. Retry or open Diagnostics.',
278801
+ };
278802
+ const projectErrorMessage = (error) =>
278803
+ projectErrorMessages[error && error.projectErrorCode] ||
278804
+ error && error.message ||
278805
+ String(error);
278806
+
278471
278807
  const suggestionPrompts = isChinese
278472
278808
  ? [
278473
278809
  '全面审查这个项目,找出影响最大的问题并直接修复,最后运行完整验证。',
@@ -278517,7 +278853,6 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278517
278853
  projectDialog: byId('projectDialog'),
278518
278854
  projectDialogBackdrop: byId('projectDialogBackdrop'),
278519
278855
  projectDialogCancel: byId('projectDialogCancel'),
278520
- projectDialogOpen: byId('projectDialogOpen'),
278521
278856
  projectDialogCreate: byId('projectDialogCreate'),
278522
278857
  projectDialogBrowse: byId('projectDialogBrowse'),
278523
278858
  projectPathInput: byId('projectPathInput'),
@@ -278535,6 +278870,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278535
278870
  sessionDeleteDialog: byId('sessionDeleteDialog'),
278536
278871
  sessionDeleteBackdrop: byId('sessionDeleteBackdrop'),
278537
278872
  sessionDeleteName: byId('sessionDeleteName'),
278873
+ fullAccessDialog: byId('fullAccessDialog'),
278874
+ fullAccessBackdrop: byId('fullAccessBackdrop'),
278875
+ fullAccessCancel: byId('fullAccessCancel'),
278876
+ fullAccessConfirm: byId('fullAccessConfirm'),
278538
278877
  sessionDeleteCancel: byId('sessionDeleteCancel'),
278539
278878
  sessionDeleteConfirm: byId('sessionDeleteConfirm'),
278540
278879
  newTaskButton: byId('newTaskButton'),
@@ -278707,8 +279046,11 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278707
279046
  sessionQuery: '',
278708
279047
  sessionLimit: 24,
278709
279048
  sessionDeleteReturnFocus: null,
279049
+ fullAccessReturnFocus: null,
279050
+ fullAccessRequest: null,
278710
279051
  projectDialogReturnFocus: null,
278711
279052
  projectPickerPending: false,
279053
+ projectLaunchPending: false,
278712
279054
  promptQueue: [],
278713
279055
  queueEditingId: null,
278714
279056
  queueEditDraft: '',
@@ -278859,6 +279201,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
278859
279201
  : data.message || data.error || response.statusText || 'Request failed';
278860
279202
  const error = new Error(message);
278861
279203
  error.status = response.status;
279204
+ error.projectErrorCode = typeof data.errorCode === 'string' ? data.errorCode : '';
278862
279205
  throw error;
278863
279206
  }
278864
279207
  return data;
@@ -280355,7 +280698,7 @@ var WEB_UI_CLIENT_PALETTE_SCRIPT = String.raw` let paletteActions = [];
280355
280698
  function buildPaletteActions() {
280356
280699
  const actions = [
280357
280700
  { icon: '+', label: language !== 'en' ? chinese('新建任务', '新增任務') : 'New task', detail: 'Ctrl N', keywords: 'new session task', idle: true, run: () => updateSession({ action: 'new' }) },
280358
- { icon: '▣', label: language !== 'en' ? chinese('新建或打开项目', '新增或開啟專案') : 'New or open project', detail: language !== 'en' ? chinese('选择项目文件夹', '選擇專案資料夾') : 'Choose a project folder', keywords: 'new open create project workspace folder', idle: true, run: openProjectDialog },
280701
+ { icon: '▣', label: language !== 'en' ? chinese('添加或创建项目', '加入或建立專案') : 'Add or create project', detail: language !== 'en' ? chinese('选择项目文件夹', '選擇專案資料夾') : 'Choose a project folder', keywords: 'add new open create project workspace folder', idle: true, run: openProjectDialog },
280359
280702
  { icon: '›', label: copy.focusComposer, detail: language !== 'en' ? chinese('发送消息', '傳送訊息') : 'Message Orbit', keywords: 'focus prompt message composer', run: () => elements.prompt.focus() },
280360
280703
  { icon: '◫', label: copy.openActivity, detail: language !== 'en' ? chinese('运行状态与工具', '執行狀態與工具') : 'Runtime and tools', keywords: 'activity details runtime tools', run: () => setInspector(true, 'activity') },
280361
280704
  { icon: '⚙', label: copy.openSettings, detail: 'Ctrl ,', keywords: 'settings preferences configuration', run: () => setInspector(true, 'settings') },
@@ -280404,7 +280747,7 @@ var WEB_UI_CLIENT_PALETTE_SCRIPT = String.raw` let paletteActions = [];
280404
280747
  detail: copy.switchMode,
280405
280748
  keywords: 'permission mode security ' + mode,
280406
280749
  idle: true,
280407
- run: () => applySettings({ permissionMode: mode }, false),
280750
+ run: () => requestPermissionMode(mode, false),
280408
280751
  });
280409
280752
  }
280410
280753
  return actions;
@@ -281358,7 +281701,11 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
281358
281701
  const hardGuardsEnabled = permissions.dangerousCommandsBlocked !== false
281359
281702
  && permissions.secretsProtected !== false
281360
281703
  && permissions.workspaceBoundary !== false;
281361
- const permissionSummary = modeSummary + ' ' + (hardGuardsEnabled ? copy.permissionGuards : copy.permissionGuardsReduced);
281704
+ const permissionSummary = modeSummary + ' ' + (permissions.fullAccess
281705
+ ? copy.permissionNoGuards
281706
+ : hardGuardsEnabled
281707
+ ? copy.permissionGuards
281708
+ : copy.permissionGuardsReduced);
281362
281709
  if (elements.permissionSummary.textContent !== permissionSummary) {
281363
281710
  elements.permissionSummary.textContent = permissionSummary;
281364
281711
  }
@@ -282356,7 +282703,25 @@ var WebUiRequestError = class extends Error {
282356
282703
  name = "WebUiRequestError";
282357
282704
  };
282358
282705
 
282706
+ // src/runtime/webui/WebUiContracts.ts
282707
+ var WEB_UI_PROJECT_ERROR_CODES = [
282708
+ "absolute_path_required",
282709
+ "filesystem_root",
282710
+ "entrypoint_unavailable",
282711
+ "project_missing",
282712
+ "project_not_directory",
282713
+ "parent_missing",
282714
+ "parent_not_directory",
282715
+ "create_failed",
282716
+ "launch_failed",
282717
+ "startup_failed",
282718
+ "startup_timeout"
282719
+ ];
282720
+
282359
282721
  // src/runtime/webui/WebUiSecurity.ts
282722
+ var WEB_UI_PROJECT_ERROR_CODE_SET = new Set(
282723
+ WEB_UI_PROJECT_ERROR_CODES
282724
+ );
282360
282725
  function sanitizeWebEventPayload(type, payload) {
282361
282726
  if (!isRecord4(payload)) return void 0;
282362
282727
  switch (type) {
@@ -282624,13 +282989,15 @@ function sanitizeActionResult(result) {
282624
282989
  return result.message ? { ok: result.ok, message: safeWebMessage(result.message) } : { ok: result.ok };
282625
282990
  }
282626
282991
  function sanitizeProjectActionResult(result) {
282627
- const url = sanitizeLocalWebUiUrl(result.url);
282992
+ const url = result.ok ? sanitizeLocalWebUiUrl(result.url) : void 0;
282993
+ const errorCode = !result.ok && WEB_UI_PROJECT_ERROR_CODE_SET.has(result.errorCode) ? result.errorCode : void 0;
282628
282994
  return {
282629
282995
  ok: result.ok,
282630
282996
  ...result.message ? { message: safeWebMessage(result.message) } : {},
282631
- ...result.path ? { path: safeWebText(result.path, 4096) } : {},
282997
+ ...errorCode ? { errorCode } : {},
282998
+ ...result.ok && result.path ? { path: safeWebText(result.path, 4096) } : {},
282632
282999
  ...url ? { url } : {},
282633
- ...result.cancelled ? { cancelled: true } : {}
283000
+ ...result.ok && result.cancelled ? { cancelled: true } : {}
282634
283001
  };
282635
283002
  }
282636
283003
  function sanitizeLocalWebUiUrl(value) {
@@ -282849,6 +283216,7 @@ function completionFileScore(file, query) {
282849
283216
  }
282850
283217
  function collectWebUiStatus(options, activeTurn) {
282851
283218
  const { cwd, config, loop } = options;
283219
+ const fullAccess = isFullAccessEnabled(config);
282852
283220
  const sessions = safeCall(() => loop?.getSessions?.()) || [];
282853
283221
  const relevantFiles = safeCall(() => loop?.getRelevantFiles?.()) || [];
282854
283222
  const history = safeCall(() => loop?.getHistory?.()) || [];
@@ -282920,12 +283288,12 @@ function collectWebUiStatus(options, activeTurn) {
282920
283288
  modelOptions: buildModelOptions(options, activeModel2),
282921
283289
  permissions: {
282922
283290
  mode: config.permissions.mode,
282923
- fullAccess: isFullAccessEnabled(config),
283291
+ fullAccess,
282924
283292
  writeApproval: config.permissions.requireApprovalForWrite,
282925
283293
  commandApproval: config.permissions.requireApprovalForBash,
282926
283294
  dangerousCommandsBlocked: config.permissions.blockDangerousCommands,
282927
283295
  secretsProtected: config.permissions.protectSecrets,
282928
- workspaceBoundary: true
283296
+ workspaceBoundary: !fullAccess
282929
283297
  },
282930
283298
  tools: {
282931
283299
  webSearch: {
@@ -283709,14 +284077,13 @@ var BASE_COPY = {
283709
284077
  navigation: "Tools",
283710
284078
  projects: "Projects",
283711
284079
  recentProjects: "Recent projects",
283712
- newProject: "New project",
284080
+ newProject: "Add project",
283713
284081
  projectDialogTitle: "Open or create a project",
283714
- projectDialogBody: "Choose an existing folder, or enter the absolute path of a new folder whose parent already exists. Orbit opens it in a separate local browser tab with its own chats and context.",
284082
+ projectDialogBody: "Choose an existing folder to add it to Orbit, or enter the absolute path of a new folder whose parent already exists. Orbit opens it in a separate local browser tab with its own chats and context.",
283715
284083
  projectPath: "Project folder path",
283716
284084
  projectPathPlaceholder: "C:\\path\\to\\project",
283717
284085
  browseProject: "Browse folders",
283718
- openProject: "Open folder",
283719
- createProject: "Create & open",
284086
+ createProject: "Open or create",
283720
284087
  recentTasks: "Chats",
283721
284088
  searchChats: "Search chats",
283722
284089
  showMoreChats: "Show more",
@@ -283826,7 +284193,13 @@ var BASE_COPY = {
283826
284193
  apply: "Apply",
283827
284194
  permission: "Permission mode",
283828
284195
  permissionDescription: "Choose how much Orbit may do without interrupting you.",
283829
- permissionGuardLabel: "Dangerous patterns are blocked and explicit file paths are guarded; executed commands still run as host processes.",
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",
283830
284203
  modeStrict: "Strict",
283831
284204
  modeNormal: "Normal",
283832
284205
  modeAuto: "Full access",
@@ -283890,14 +284263,13 @@ var BASE_COPY = {
283890
284263
  navigation: "\u5DE5\u5177",
283891
284264
  projects: "\u9879\u76EE",
283892
284265
  recentProjects: "\u6700\u8FD1\u9879\u76EE",
283893
- newProject: "\u65B0\u5EFA\u9879\u76EE",
284266
+ newProject: "\u6DFB\u52A0\u9879\u76EE",
283894
284267
  projectDialogTitle: "\u6253\u5F00\u6216\u521B\u5EFA\u9879\u76EE",
283895
- projectDialogBody: "\u6D4F\u89C8\u9009\u62E9\u5DF2\u6709\u6587\u4EF6\u5939\uFF0C\u6216\u8F93\u5165\u7236\u76EE\u5F55\u5DF2\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u5939\u7EDD\u5BF9\u8DEF\u5F84\u3002Orbit \u4F1A\u5728\u72EC\u7ACB\u7684\u672C\u5730\u6D4F\u89C8\u5668\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\uFF0C\u5E76\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
284268
+ projectDialogBody: "\u9009\u62E9\u5DF2\u6709\u6587\u4EF6\u5939\u53EF\u76F4\u63A5\u52A0\u5165 Orbit\uFF1B\u4E5F\u53EF\u4EE5\u8F93\u5165\u7236\u76EE\u5F55\u5DF2\u5B58\u5728\u7684\u65B0\u6587\u4EF6\u5939\u7EDD\u5BF9\u8DEF\u5F84\u3002Orbit \u4F1A\u5728\u72EC\u7ACB\u7684\u672C\u5730\u6D4F\u89C8\u5668\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\uFF0C\u5E76\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
283896
284269
  projectPath: "\u9879\u76EE\u6587\u4EF6\u5939\u8DEF\u5F84",
283897
284270
  projectPathPlaceholder: "C:\\\u8DEF\u5F84\\\u9879\u76EE\u540D\u79F0",
283898
284271
  browseProject: "\u6D4F\u89C8\u6587\u4EF6\u5939",
283899
- openProject: "\u6253\u5F00\u6587\u4EF6\u5939",
283900
- createProject: "\u521B\u5EFA\u5E76\u6253\u5F00",
284272
+ createProject: "\u6253\u5F00\u6216\u521B\u5EFA",
283901
284273
  recentTasks: "\u5BF9\u8BDD",
283902
284274
  searchChats: "\u641C\u7D22\u5BF9\u8BDD",
283903
284275
  showMoreChats: "\u663E\u793A\u66F4\u591A",
@@ -284007,7 +284379,13 @@ var BASE_COPY = {
284007
284379
  apply: "\u5E94\u7528",
284008
284380
  permission: "\u6743\u9650\u6A21\u5F0F",
284009
284381
  permissionDescription: "\u9009\u62E9 Orbit \u53EF\u4EE5\u5728\u4E0D\u6253\u65AD\u4F60\u7684\u60C5\u51B5\u4E0B\u6267\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
284010
- permissionGuardLabel: "\u5371\u9669\u6A21\u5F0F\u4F1A\u88AB\u963B\u6B62\uFF0C\u663E\u5F0F\u6587\u4EF6\u8DEF\u5F84\u4F1A\u53D7\u4FDD\u62A4\uFF1B\u6267\u884C\u7684\u547D\u4EE4\u4ECD\u662F\u672C\u673A\u8FDB\u7A0B\u3002",
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",
284011
284389
  modeStrict: "\u4E25\u683C",
284012
284390
  modeNormal: "\u6807\u51C6",
284013
284391
  modeAuto: "\u5168\u81EA\u52A8",
@@ -284075,13 +284453,12 @@ var COPY = {
284075
284453
  navigation: "\u5DE5\u5177",
284076
284454
  projects: "\u5C08\u6848",
284077
284455
  recentProjects: "\u6700\u8FD1\u5C08\u6848",
284078
- newProject: "\u65B0\u589E\u5C08\u6848",
284456
+ newProject: "\u52A0\u5165\u5C08\u6848",
284079
284457
  projectDialogTitle: "\u958B\u555F\u6216\u5EFA\u7ACB\u5C08\u6848",
284080
- projectDialogBody: "\u700F\u89BD\u9078\u64C7\u73FE\u6709\u8CC7\u6599\u593E\uFF0C\u6216\u8F38\u5165\u7236\u8CC7\u6599\u593E\u5DF2\u5B58\u5728\u7684\u65B0\u8CC7\u6599\u593E\u7D55\u5C0D\u8DEF\u5F91\u3002Orbit \u6703\u5728\u7368\u7ACB\u7684\u672C\u6A5F\u700F\u89BD\u5668\u5206\u9801\u958B\u555F\uFF0C\u4E26\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
284458
+ projectDialogBody: "\u9078\u64C7\u73FE\u6709\u8CC7\u6599\u593E\u53EF\u76F4\u63A5\u52A0\u5165 Orbit\uFF1B\u4E5F\u53EF\u4EE5\u8F38\u5165\u7236\u8CC7\u6599\u593E\u5DF2\u5B58\u5728\u7684\u65B0\u8CC7\u6599\u593E\u7D55\u5C0D\u8DEF\u5F91\u3002Orbit \u6703\u5728\u7368\u7ACB\u7684\u672C\u6A5F\u700F\u89BD\u5668\u5206\u9801\u958B\u555F\uFF0C\u4E26\u4FDD\u7559\u81EA\u5DF1\u7684\u804A\u5929\u548C\u4E0A\u4E0B\u6587\u3002",
284081
284459
  projectPath: "\u5C08\u6848\u8CC7\u6599\u593E\u8DEF\u5F91",
284082
284460
  browseProject: "\u700F\u89BD\u8CC7\u6599\u593E",
284083
- openProject: "\u958B\u555F\u8CC7\u6599\u593E",
284084
- createProject: "\u5EFA\u7ACB\u4E26\u958B\u555F",
284461
+ createProject: "\u958B\u555F\u6216\u5EFA\u7ACB",
284085
284462
  recentTasks: "\u5C0D\u8A71",
284086
284463
  searchChats: "\u641C\u5C0B\u5C0D\u8A71",
284087
284464
  showMoreChats: "\u986F\u793A\u66F4\u591A",
@@ -284160,7 +284537,13 @@ var COPY = {
284160
284537
  apply: "\u5957\u7528",
284161
284538
  permission: "\u6B0A\u9650\u6A21\u5F0F",
284162
284539
  permissionDescription: "\u9078\u64C7 Orbit \u53EF\u4EE5\u5728\u4E0D\u4E2D\u65B7\u4F60\u7684\u60C5\u6CC1\u4E0B\u57F7\u884C\u54EA\u4E9B\u64CD\u4F5C\u3002",
284163
- permissionGuardLabel: "\u5371\u96AA\u547D\u4EE4\u3001\u5BC6\u9470\u548C\u5DE5\u4F5C\u5340\u908A\u754C\u59CB\u7D42\u53D7\u5230\u4FDD\u8B77\u3002",
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",
284164
284547
  modeStrict: "\u56B4\u683C",
284165
284548
  modeNormal: "\u6A19\u6E96",
284166
284549
  modeAuto: "\u5168\u81EA\u52D5",
@@ -284788,6 +285171,25 @@ function renderWebUiPage(language) {
284788
285171
  </div>
284789
285172
  </section>
284790
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>
284791
285193
  <div class="project-dialog" id="projectDialog" aria-hidden="true" hidden>
284792
285194
  <button class="project-dialog-backdrop" id="projectDialogBackdrop" type="button" aria-label="${copy.cancel}" tabindex="-1"></button>
284793
285195
  <section class="project-dialog-card" role="dialog" aria-modal="true" aria-labelledby="projectDialogTitle" aria-describedby="projectDialogBody">
@@ -284807,7 +285209,6 @@ function renderWebUiPage(language) {
284807
285209
  </div>
284808
285210
  <div class="project-dialog-actions">
284809
285211
  <button class="project-dialog-cancel" id="projectDialogCancel" type="button">${copy.cancel}</button>
284810
- <button class="project-dialog-open" id="projectDialogOpen" type="button">${copy.openProject}</button>
284811
285212
  <button class="project-dialog-create" id="projectDialogCreate" type="button">${copy.createProject}</button>
284812
285213
  </div>
284813
285214
  </section>
@@ -287195,8 +287596,7 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
287195
287596
  font-weight: 620;
287196
287597
  }
287197
287598
 
287198
- .project-dialog-cancel,
287199
- .project-dialog-open {
287599
+ .project-dialog-cancel {
287200
287600
  color: var(--muted);
287201
287601
  background: var(--surface-subtle);
287202
287602
  border: 1px solid var(--border);
@@ -287327,6 +287727,136 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
287327
287727
  outline-offset: 2px;
287328
287728
  }
287329
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
+
287330
287860
  .toast-region {
287331
287861
  position: fixed;
287332
287862
  z-index: 100;
@@ -289546,11 +290076,6 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
289546
290076
  width: 100%;
289547
290077
  }
289548
290078
 
289549
- .project-dialog-cancel {
289550
- grid-column: 1 / -1;
289551
- grid-row: 2;
289552
- }
289553
-
289554
290079
  .workspace-view {
289555
290080
  grid-template-rows: 54px auto minmax(0, 1fr);
289556
290081
  }
@@ -291458,6 +291983,7 @@ var SettingsPatchSchema = z58.object({
291458
291983
  provider: z58.string().trim().min(1).max(256).optional(),
291459
291984
  model: z58.string().trim().min(1).max(200).optional(),
291460
291985
  permissionMode: z58.enum(["strict", "normal", "auto", "plan"]).optional(),
291986
+ fullAccessConfirmed: z58.literal(true).optional(),
291461
291987
  webSearchEnabled: z58.boolean().optional(),
291462
291988
  webSearchProvider: z58.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
291463
291989
  webSearchMaxResults: z58.number().int().min(1).max(20).optional(),
@@ -291465,7 +291991,15 @@ var SettingsPatchSchema = z58.object({
291465
291991
  skillsActivation: z58.enum(["auto", "explicit"]).optional(),
291466
291992
  skillsMaxActive: z58.number().int().min(0).max(8).optional(),
291467
291993
  skillsDisabled: z58.array(z58.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).max(200).optional()
291468
- }).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
+ });
291469
292003
  var CapabilityNameSchema2 = z58.string().trim().min(1).max(48).regex(/^[a-z0-9][a-z0-9-]*$/);
291470
292004
  var CapabilityCreateSchema = z58.discriminatedUnion("kind", [
291471
292005
  z58.object({
@@ -291493,11 +292027,14 @@ var SessionActionSchema = z58.discriminatedUnion("action", [
291493
292027
  }).strict()
291494
292028
  )
291495
292029
  ]);
292030
+ var ProjectPathSchema = z58.string().trim().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value), {
292031
+ message: "Project paths cannot contain control characters."
292032
+ });
291496
292033
  var ProjectActionSchema = z58.discriminatedUnion("action", [
291497
292034
  z58.object({ action: z58.literal("pick") }).strict(),
291498
292035
  z58.object({
291499
292036
  action: z58.enum(["open", "create"]),
291500
- path: z58.string().trim().min(1).max(4096)
292037
+ path: ProjectPathSchema
291501
292038
  }).strict(),
291502
292039
  z58.object({
291503
292040
  action: z58.literal("remove"),
@@ -292236,6 +292773,7 @@ var OrbitWebUiRuntime = class {
292236
292773
  }
292237
292774
  try {
292238
292775
  const patch = SettingsPatchSchema.parse(await readJsonBody(req));
292776
+ delete patch.fullAccessConfirmed;
292239
292777
  const result = await options.updateSettings(patch);
292240
292778
  sendJson(res, result.ok ? 200 : 400, sanitizeActionResult(result));
292241
292779
  } catch (error) {
@@ -292371,7 +292909,7 @@ function isSkillScopeDiscoverable(cwd, configuredDirectories, scope) {
292371
292909
  );
292372
292910
  return resolveSkillDirectories(cwd, configuredDirectories).some((root) => {
292373
292911
  const pathFromRoot = relative8(root, target);
292374
- return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute5(pathFromRoot);
292912
+ return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute6(pathFromRoot);
292375
292913
  });
292376
292914
  }
292377
292915
  function matchesImageSignature(mediaType, body) {
@@ -292457,8 +292995,8 @@ var WebUiApprovalBroker = class {
292457
292995
  throw new Error("Web UI approval queue capacity was reached.");
292458
292996
  }
292459
292997
  const snapshot = sanitizeApprovalRequest(request);
292460
- return new Promise((resolve25) => {
292461
- const approval = { snapshot, resolve: resolve25 };
292998
+ return new Promise((resolve26) => {
292999
+ const approval = { snapshot, resolve: resolve26 };
292462
293000
  if (this.pending) this.queued.push(approval);
292463
293001
  else this.activate(approval);
292464
293002
  });
@@ -292937,8 +293475,8 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
292937
293475
 
292938
293476
  // src/runtime/commands/ContextCommandHandler.ts
292939
293477
  import glob5 from "fast-glob";
292940
- import { existsSync as existsSync18, statSync as statSync4 } from "fs";
292941
- import { isAbsolute as isAbsolute6, relative as relative9, resolve as resolve12 } from "path";
293478
+ import { existsSync as existsSync19, statSync as statSync4 } from "fs";
293479
+ import { isAbsolute as isAbsolute7, relative as relative9, resolve as resolve12 } from "path";
292942
293480
  import picocolors12 from "picocolors";
292943
293481
  function parseAddArgument(argument) {
292944
293482
  const match = argument.match(/^(--read-only|--readonly|-r)(?:\s+|$)/);
@@ -292961,7 +293499,7 @@ function containsWildcard(value) {
292961
293499
  return value.includes("*") || value.includes("?");
292962
293500
  }
292963
293501
  function isUnsafePattern(value) {
292964
- return isAbsolute6(value) || value.replace(/\\/g, "/").split("/").some((segment) => segment === "..");
293502
+ return isAbsolute7(value) || value.replace(/\\/g, "/").split("/").some((segment) => segment === "..");
292965
293503
  }
292966
293504
  function wildcardExpression(pattern) {
292967
293505
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__\/?/g, "(?:|.*/)");
@@ -293087,7 +293625,7 @@ async function handleAdd(argument, dependencies) {
293087
293625
  );
293088
293626
  return HANDLED_COMMAND;
293089
293627
  }
293090
- if (!existsSync18(absolutePath)) {
293628
+ if (!existsSync19(absolutePath)) {
293091
293629
  const normalizedArgument = fileArgument.toLowerCase();
293092
293630
  const matched = candidates.filter(
293093
293631
  (file) => file.toLowerCase().includes(normalizedArgument) || file.toLowerCase().endsWith(`/${normalizedArgument}`)
@@ -293290,7 +293828,7 @@ async function handleContextCommand(command, argument, dependencies) {
293290
293828
 
293291
293829
  // src/runtime/commands/RollbackCommandHandler.ts
293292
293830
  import { execFileSync as execFileSync7 } from "child_process";
293293
- import { existsSync as existsSync19, lstatSync as lstatSync7, mkdirSync as mkdirSync6, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "fs";
293831
+ import { existsSync as existsSync20, lstatSync as lstatSync7, mkdirSync as mkdirSync6, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "fs";
293294
293832
  import { dirname as dirname12 } from "path";
293295
293833
  import picocolors13 from "picocolors";
293296
293834
  import { z as z59 } from "zod";
@@ -293644,7 +294182,7 @@ function restoreWorkspaceSnapshot(cwd, snapshots) {
293644
294182
  rmSync5(absolutePath, { recursive: true, force: true });
293645
294183
  continue;
293646
294184
  }
293647
- if (existsSync19(absolutePath)) {
294185
+ if (existsSync20(absolutePath)) {
293648
294186
  const stats = lstatSync7(absolutePath);
293649
294187
  if (stats.isSymbolicLink() || !stats.isFile()) {
293650
294188
  throw new Error(
@@ -293672,7 +294210,7 @@ function restoreGitStatusEntry(entry, dependencies, git) {
293672
294210
  const removePath = dependencies.removePath ?? removeWorkspacePath;
293673
294211
  const removeDestination = () => {
293674
294212
  const absolutePath = resolveSafePath(dependencies.cwd, entry.path);
293675
- if (existsSync19(absolutePath)) removePath(absolutePath);
294213
+ if (existsSync20(absolutePath)) removePath(absolutePath);
293676
294214
  };
293677
294215
  if (entry.status === "??" || entry.status.includes("A")) {
293678
294216
  removeDestination();
@@ -294397,36 +294935,60 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
294397
294935
 
294398
294936
  // src/runtime/ProjectLauncher.ts
294399
294937
  import { spawn as spawn4 } from "child_process";
294400
- import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
294401
- import { dirname as dirname13, isAbsolute as isAbsolute7, parse as parse4, resolve as resolve13 } from "path";
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";
294402
294940
  var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
294941
+ var ProjectLaunchError = class extends Error {
294942
+ constructor(code, message2, options) {
294943
+ super(message2, options);
294944
+ this.code = code;
294945
+ }
294946
+ code;
294947
+ name = "ProjectLaunchError";
294948
+ };
294403
294949
  async function launchOrbitProject(request, options = {}) {
294404
- if (!isAbsolute7(request.path)) {
294405
- throw new Error("Enter an absolute project folder path.");
294950
+ if (!isAbsolute8(request.path)) {
294951
+ throw new ProjectLaunchError(
294952
+ "absolute_path_required",
294953
+ "Enter an absolute project folder path."
294954
+ );
294406
294955
  }
294407
294956
  const requestedPath = resolve13(request.path);
294408
- if (requestedPath === parse4(requestedPath).root) {
294409
- throw new Error("A filesystem root cannot be opened as an Orbit project.");
294410
- }
294957
+ rejectFilesystemRoot(requestedPath);
294411
294958
  const entryPoint = options.entryPoint || process.argv[1];
294412
- if (!entryPoint) throw new Error("Orbit CLI entry point is unavailable.");
294959
+ if (!entryPoint) {
294960
+ throw new ProjectLaunchError(
294961
+ "entrypoint_unavailable",
294962
+ "Orbit CLI entry point is unavailable."
294963
+ );
294964
+ }
294413
294965
  if (request.action === "create") {
294414
- createProjectDirectory(requestedPath);
294966
+ ensureProjectDirectory(requestedPath);
294415
294967
  } else {
294416
294968
  requireProjectDirectory(requestedPath);
294417
294969
  }
294418
- const projectPath = realpathSync3(requestedPath);
294970
+ const projectPath = realpathSync3.native(requestedPath);
294971
+ rejectFilesystemRoot(projectPath);
294419
294972
  const launch = options.launch || spawn4;
294420
- const child = launch(
294421
- options.executable || process.execPath,
294422
- [entryPoint, "webui", "--cwd", projectPath],
294423
- {
294424
- ...HIDDEN_CHILD_PROCESS_OPTIONS,
294425
- cwd: projectPath,
294426
- detached: true,
294427
- stdio: ["ignore", "ignore", "ignore", "ipc"]
294428
- }
294429
- );
294973
+ let child;
294974
+ try {
294975
+ child = launch(
294976
+ options.executable || process.execPath,
294977
+ [entryPoint, "webui", "--cwd", projectPath],
294978
+ {
294979
+ ...HIDDEN_CHILD_PROCESS_OPTIONS,
294980
+ cwd: projectPath,
294981
+ detached: true,
294982
+ stdio: ["ignore", "ignore", "ignore", "ipc"]
294983
+ }
294984
+ );
294985
+ } catch (error) {
294986
+ throw new ProjectLaunchError(
294987
+ "launch_failed",
294988
+ "Orbit project could not be started.",
294989
+ { cause: error }
294990
+ );
294991
+ }
294430
294992
  return await new Promise(
294431
294993
  (resolveLaunch, rejectLaunch) => {
294432
294994
  let settled = false;
@@ -294456,11 +295018,16 @@ async function launchOrbitProject(request, options = {}) {
294456
295018
  };
294457
295019
  const onError = (error) => finish(
294458
295020
  void 0,
294459
- new Error(`Orbit project could not be opened: ${error.message}`)
295021
+ new ProjectLaunchError(
295022
+ "launch_failed",
295023
+ `Orbit project could not be opened: ${error.message}`,
295024
+ { cause: error }
295025
+ )
294460
295026
  );
294461
295027
  const onExit2 = (code) => finish(
294462
295028
  void 0,
294463
- new Error(
295029
+ new ProjectLaunchError(
295030
+ "startup_failed",
294464
295031
  `Orbit project exited before its Web UI was ready${code === null ? "." : ` (code ${code}).`}`
294465
295032
  )
294466
295033
  );
@@ -294469,7 +295036,10 @@ async function launchOrbitProject(request, options = {}) {
294469
295036
  child.kill();
294470
295037
  finish(
294471
295038
  void 0,
294472
- new Error("Timed out while starting the Orbit project.")
295039
+ new ProjectLaunchError(
295040
+ "startup_timeout",
295041
+ "Timed out while starting the Orbit project."
295042
+ )
294473
295043
  );
294474
295044
  },
294475
295045
  Math.max(1e3, options.startupTimeoutMs ?? 15e3)
@@ -294487,38 +295057,59 @@ function parseReadyUrl(message2) {
294487
295057
  }
294488
295058
  return sanitizeLocalWebUiUrl(message2.url);
294489
295059
  }
294490
- function createProjectDirectory(projectPath) {
294491
- if (existsSync20(projectPath)) {
294492
- throw new Error("Project folder already exists. Use Open folder instead.");
295060
+ function ensureProjectDirectory(projectPath) {
295061
+ if (existsSync21(projectPath)) {
295062
+ requireProjectDirectory(projectPath);
295063
+ return;
294493
295064
  }
294494
295065
  const parentPath = dirname13(projectPath);
294495
- if (!existsSync20(parentPath)) {
294496
- throw new Error(
295066
+ if (!existsSync21(parentPath)) {
295067
+ throw new ProjectLaunchError(
295068
+ "parent_missing",
294497
295069
  "The parent folder does not exist. Choose an existing location first."
294498
295070
  );
294499
295071
  }
294500
295072
  if (!statSync5(parentPath).isDirectory()) {
294501
- throw new Error("The project parent path must be a directory.");
295073
+ throw new ProjectLaunchError(
295074
+ "parent_not_directory",
295075
+ "The project parent path must be a directory."
295076
+ );
294502
295077
  }
294503
295078
  try {
294504
295079
  mkdirSync7(projectPath);
294505
295080
  } catch (error) {
294506
295081
  if (isNodeError4(error) && error.code === "EEXIST") {
294507
- throw new Error(
294508
- "Project folder already exists. Use Open folder instead."
294509
- );
295082
+ requireProjectDirectory(projectPath);
295083
+ return;
294510
295084
  }
294511
- throw new Error("Orbit could not create the project folder.", {
294512
- cause: error
294513
- });
295085
+ throw new ProjectLaunchError(
295086
+ "create_failed",
295087
+ "Orbit could not create the project folder.",
295088
+ { cause: error }
295089
+ );
294514
295090
  }
294515
295091
  }
294516
295092
  function requireProjectDirectory(projectPath) {
294517
- if (!existsSync20(projectPath)) {
294518
- throw new Error("Project folder does not exist.");
295093
+ if (!existsSync21(projectPath)) {
295094
+ throw new ProjectLaunchError(
295095
+ "project_missing",
295096
+ "Project folder does not exist."
295097
+ );
294519
295098
  }
294520
295099
  if (!statSync5(projectPath).isDirectory()) {
294521
- throw new Error("Project path must point to a directory.");
295100
+ throw new ProjectLaunchError(
295101
+ "project_not_directory",
295102
+ "Project path must point to a directory."
295103
+ );
295104
+ }
295105
+ }
295106
+ function rejectFilesystemRoot(projectPath) {
295107
+ const normalized = resolve13(projectPath);
295108
+ if (normalized === parse4(normalized).root) {
295109
+ throw new ProjectLaunchError(
295110
+ "filesystem_root",
295111
+ "A filesystem root cannot be opened as an Orbit project."
295112
+ );
294522
295113
  }
294523
295114
  }
294524
295115
  function isNodeError4(error) {
@@ -294693,7 +295284,7 @@ async function selectOrbitProjectFolder(options = {}) {
294693
295284
  const result = await run(command.executable, command.args);
294694
295285
  return result.stdout.trim() || null;
294695
295286
  } catch (error) {
294696
- if (isPickerCancellation(error)) return null;
295287
+ if (isPickerCancellation(error, platform)) return null;
294697
295288
  throw new Error(
294698
295289
  platform === "linux" ? "The system folder picker is unavailable. Install zenity or enter the path manually." : "The system folder picker could not be opened. Enter the path manually.",
294699
295290
  { cause: error }
@@ -294731,10 +295322,11 @@ function projectPickerCommand(platform) {
294731
295322
  ]
294732
295323
  };
294733
295324
  }
294734
- function isPickerCancellation(error) {
295325
+ function isPickerCancellation(error, platform) {
294735
295326
  if (!error || typeof error !== "object") return false;
294736
295327
  const candidate = error;
294737
- return candidate.code === 1 || typeof candidate.stderr === "string" && candidate.stderr.includes("User canceled");
295328
+ const stderr = typeof candidate.stderr === "string" ? candidate.stderr.trim() : "";
295329
+ return stderr.includes("User canceled") || platform === "linux" && candidate.code === 1 && stderr.length === 0;
294738
295330
  }
294739
295331
 
294740
295332
  // src/runtime/commands/SessionMetadataCommandHandler.ts
@@ -295218,7 +295810,7 @@ async function confirmUpdate(prompt) {
295218
295810
  });
295219
295811
  try {
295220
295812
  const answer = await new Promise(
295221
- (resolve25) => interfaceInstance.question(prompt, resolve25)
295813
+ (resolve26) => interfaceInstance.question(prompt, resolve26)
295222
295814
  );
295223
295815
  return /^(?:y|yes)$/i.test(answer.trim());
295224
295816
  } finally {
@@ -295654,6 +296246,7 @@ var CommandRouter = class {
295654
296246
  } catch (error) {
295655
296247
  return {
295656
296248
  ok: false,
296249
+ ...error instanceof ProjectLaunchError ? { errorCode: error.code } : {},
295657
296250
  message: error instanceof Error ? error.message : "Orbit could not open the selected project."
295658
296251
  };
295659
296252
  }
@@ -296115,17 +296708,18 @@ var CommandRouter = class {
296115
296708
  const commitMsg = parts.slice(1).join(" ").trim();
296116
296709
  const isZh = config.language !== "en";
296117
296710
  const { execFileSync: execFileSync9, execSync: execSync3 } = await import("child_process");
296711
+ const childEnvironment = isFullAccessEnabled(config) ? buildInheritedChildEnvironment() : buildSanitizedChildEnvironment();
296118
296712
  try {
296119
296713
  let diff = execSync3("git diff --cached", {
296120
296714
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
296121
296715
  cwd,
296122
- env: buildSanitizedChildEnvironment()
296716
+ env: childEnvironment
296123
296717
  }).toString().trim();
296124
296718
  if (!diff) {
296125
296719
  const unstaged = execSync3("git status --porcelain", {
296126
296720
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
296127
296721
  cwd,
296128
- env: buildSanitizedChildEnvironment()
296722
+ env: childEnvironment
296129
296723
  }).toString().trim();
296130
296724
  if (!unstaged) {
296131
296725
  this.printOutput(
@@ -296135,7 +296729,7 @@ var CommandRouter = class {
296135
296729
  );
296136
296730
  return { shouldExit: false, processed: true };
296137
296731
  }
296138
- const autoStage = await Prompt.askApproval(
296732
+ const autoStage = isFullAccessEnabled(config) || await Prompt.askApproval(
296139
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?"
296140
296734
  );
296141
296735
  if (!autoStage) {
@@ -296152,12 +296746,12 @@ var CommandRouter = class {
296152
296746
  execSync3("git add -A", {
296153
296747
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
296154
296748
  cwd,
296155
- env: buildSanitizedChildEnvironment()
296749
+ env: childEnvironment
296156
296750
  });
296157
296751
  diff = execSync3("git diff --cached", {
296158
296752
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
296159
296753
  cwd,
296160
- env: buildSanitizedChildEnvironment()
296754
+ env: childEnvironment
296161
296755
  }).toString().trim();
296162
296756
  if (!diff) {
296163
296757
  this.printOutput(
@@ -296206,7 +296800,7 @@ ${buildCommitDiffForModel(diff)}`
296206
296800
  execFileSync9("git", ["commit", "-m", finalMsg], {
296207
296801
  ...HIDDEN_CHILD_PROCESS_OPTIONS,
296208
296802
  cwd,
296209
- env: buildSanitizedChildEnvironment()
296803
+ env: childEnvironment
296210
296804
  });
296211
296805
  this.printOutput(
296212
296806
  picocolors18.green("\u2714 Git commit created successfully.")
@@ -296242,12 +296836,12 @@ ${buildCommitDiffForModel(diff)}`
296242
296836
  const modeDescriptions = isZh ? {
296243
296837
  strict: "Strict \u2014 \u6240\u6709\u5DE5\u5177\u8C03\u7528\u5FC5\u987B\u9010\u4E00\u786E\u8BA4",
296244
296838
  normal: "Normal \u2014 \u5199\u5165/\u6267\u884C\u64CD\u4F5C\u9700\u8981\u786E\u8BA4",
296245
- auto: "Full Access \u2014 \u81EA\u52A8\u5199\u5165\u3001\u6267\u884C\u4E0E\u8054\u7F51\uFF1B\u4E0D\u900F\u660E\u547D\u4EE4\u4ECD\u9700\u786E\u8BA4",
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",
296246
296840
  plan: "Plan \u2014 \u89C4\u5212\u6A21\u5F0F\uFF0C\u65E0\u5B9E\u9645\u6587\u4EF6\u4FEE\u6539"
296247
296841
  } : {
296248
296842
  strict: "Strict \u2014 Confirm every tool call before execution",
296249
296843
  normal: "Normal \u2014 Confirm write/exec operations only",
296250
- auto: "Full Access \u2014 Auto write, execute, and network; opaque commands still ask",
296844
+ auto: "Full Access \u2014 Approve every enabled tool action, including dangerous, local-network, and outside-workspace actions",
296251
296845
  plan: "Plan \u2014 Planning mode, no actual file changes"
296252
296846
  };
296253
296847
  if (!targetMode) {
@@ -297508,7 +298102,8 @@ Risk Warning: ${reason}`);
297508
298102
  {
297509
298103
  disableStatusBar: useFullscreenTui,
297510
298104
  sessionId: resumeSessionId,
297511
- autoContinueRunaway: isFullAccessEnabled(this.config)
298105
+ // Permission elevation never opts the user out of periodic cost guards.
298106
+ autoContinueRunaway: false
297512
298107
  }
297513
298108
  );
297514
298109
  tui.setActiveInputHandler((submitted) => {
@@ -298030,6 +298625,9 @@ function applyStoredRuntimeSelection(config, localState, cliOverrides) {
298030
298625
  applyPermissionModePreset(config, localState.permissionMode);
298031
298626
  }
298032
298627
  }
298628
+ function shouldAutoContinueRunaway(options) {
298629
+ return options?.autoContinueRunaway === true;
298630
+ }
298033
298631
  async function runAgent(cwd, task, cliOverrides, multi, options) {
298034
298632
  const cleanupJsonl = options?.jsonl ? configureJsonlOutput() : () => {
298035
298633
  };
@@ -298164,7 +298762,7 @@ Risk Warning: ${reason}`);
298164
298762
  requireSession: Boolean(options?.resumeSessionId),
298165
298763
  disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
298166
298764
  nonInteractive: !!options?.nonInteractive,
298167
- autoContinueRunaway: !!options?.autoContinueRunaway || isFullAccessEnabled(config)
298765
+ autoContinueRunaway: shouldAutoContinueRunaway(options)
298168
298766
  }
298169
298767
  );
298170
298768
  return await loop.run();
@@ -298442,7 +299040,7 @@ async function runLSPServer(cwd) {
298442
299040
  const autocompleteEngine = new AutocompleteEngine(cwd);
298443
299041
  const documentCache = /* @__PURE__ */ new Map();
298444
299042
  let shutdownRequested = false;
298445
- await new Promise((resolve25) => {
299043
+ await new Promise((resolve26) => {
298446
299044
  let settled = false;
298447
299045
  const finish = () => {
298448
299046
  if (settled) return;
@@ -298451,7 +299049,7 @@ async function runLSPServer(cwd) {
298451
299049
  process.stdin.off("end", onEnd);
298452
299050
  autocompleteEngine.dispose();
298453
299051
  documentCache.clear();
298454
- resolve25();
299052
+ resolve26();
298455
299053
  };
298456
299054
  const handleMessage = async (message2) => {
298457
299055
  try {
@@ -298628,15 +299226,15 @@ function askQuestion(query, defaultValue = "") {
298628
299226
  input: process.stdin,
298629
299227
  output: process.stdout
298630
299228
  });
298631
- return new Promise((resolve25) => {
299229
+ return new Promise((resolve26) => {
298632
299230
  rl.question(query, (answer) => {
298633
299231
  rl.close();
298634
- resolve25(answer.trim() || defaultValue);
299232
+ resolve26(answer.trim() || defaultValue);
298635
299233
  });
298636
299234
  });
298637
299235
  }
298638
299236
  function askSecret(query) {
298639
- return new Promise((resolve25, reject) => {
299237
+ return new Promise((resolve26, reject) => {
298640
299238
  const stdin2 = process.stdin;
298641
299239
  const stdout2 = process.stdout;
298642
299240
  if (!stdin2.isTTY || !stdout2.isTTY || typeof stdin2.setRawMode !== "function") {
@@ -298670,13 +299268,13 @@ function askSecret(query) {
298670
299268
  case "":
298671
299269
  cleanup();
298672
299270
  stdout2.write("\n");
298673
- resolve25(input.trim());
299271
+ resolve26(input.trim());
298674
299272
  break;
298675
299273
  case "":
298676
299274
  cleanup();
298677
299275
  stdout2.write("\n");
298678
299276
  process.exitCode = 130;
298679
- resolve25("");
299277
+ resolve26("");
298680
299278
  break;
298681
299279
  case "\b":
298682
299280
  case "\x7F":
@@ -299063,7 +299661,7 @@ async function runSkillsCommand(action, options = {}) {
299063
299661
 
299064
299662
  // src/commands/trace.ts
299065
299663
  import {
299066
- existsSync as existsSync21,
299664
+ existsSync as existsSync28,
299067
299665
  lstatSync as lstatSync8,
299068
299666
  mkdirSync as mkdirSync8,
299069
299667
  renameSync as renameSync6,
@@ -299091,7 +299689,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
299091
299689
  }
299092
299690
  const outputPath = resolveSafePath(cwd, value.out);
299093
299691
  const directory = dirname15(outputPath);
299094
- if (existsSync21(directory)) {
299692
+ if (existsSync28(directory)) {
299095
299693
  const stats = lstatSync8(directory);
299096
299694
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
299097
299695
  throw new Error("Trace output directory must be a real directory.");
@@ -299106,7 +299704,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
299106
299704
  flag: "wx",
299107
299705
  mode: 384
299108
299706
  });
299109
- if (existsSync21(outputPath)) rmSync7(outputPath, { force: true });
299707
+ if (existsSync28(outputPath)) rmSync7(outputPath, { force: true });
299110
299708
  renameSync6(temporaryPath, outputPath);
299111
299709
  } finally {
299112
299710
  rmSync7(temporaryPath, { force: true });
@@ -299118,7 +299716,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
299118
299716
  import { exec as execCallback, execFileSync as execFileSync8 } from "child_process";
299119
299717
  import {
299120
299718
  copyFileSync,
299121
- existsSync as existsSync28,
299719
+ existsSync as existsSync29,
299122
299720
  lstatSync as lstatSync9,
299123
299721
  mkdirSync as mkdirSync9,
299124
299722
  renameSync as renameSync7,
@@ -299457,7 +300055,7 @@ function writeEvaluationReport(cwd, runId, report) {
299457
300055
  }
299458
300056
  function writeJsonAtomically2(filePath, value) {
299459
300057
  const directory = dirname16(filePath);
299460
- if (existsSync28(directory)) {
300058
+ if (existsSync29(directory)) {
299461
300059
  const stats = lstatSync9(directory);
299462
300060
  if (stats.isSymbolicLink() || !stats.isDirectory()) {
299463
300061
  throw new Error("Evaluation output directory must be a real directory.");
@@ -299472,7 +300070,7 @@ function writeJsonAtomically2(filePath, value) {
299472
300070
  flag: "wx",
299473
300071
  mode: 384
299474
300072
  });
299475
- if (existsSync28(filePath)) rmSync8(filePath, { force: true });
300073
+ if (existsSync29(filePath)) rmSync8(filePath, { force: true });
299476
300074
  renameSync7(temporaryPath, filePath);
299477
300075
  } finally {
299478
300076
  rmSync8(temporaryPath, { force: true });
@@ -299769,7 +300367,7 @@ async function confirmDeletion(prompt) {
299769
300367
  });
299770
300368
  try {
299771
300369
  const answer = await new Promise(
299772
- (resolve25) => interfaceInstance.question(prompt, resolve25)
300370
+ (resolve26) => interfaceInstance.question(prompt, resolve26)
299773
300371
  );
299774
300372
  return answer.trim() === "DELETE";
299775
300373
  } finally {
@@ -299784,7 +300382,7 @@ import { z as z78 } from "zod";
299784
300382
 
299785
300383
  // src/runtime/ProjectBackup.ts
299786
300384
  import {
299787
- existsSync as existsSync29,
300385
+ existsSync as existsSync30,
299788
300386
  lstatSync as lstatSync11,
299789
300387
  mkdirSync as mkdirSync10,
299790
300388
  readdirSync as readdirSync10,
@@ -299793,7 +300391,7 @@ import {
299793
300391
  writeFileSync as writeFileSync10
299794
300392
  } from "fs";
299795
300393
  import { createHash as createHash10, randomUUID as randomUUID16 } from "crypto";
299796
- import { dirname as dirname17, isAbsolute as isAbsolute8, join as join21, relative as relative10, resolve as resolve18, sep as sep2 } from "path";
300394
+ import { dirname as dirname17, isAbsolute as isAbsolute9, join as join21, relative as relative10, resolve as resolve18, sep as sep2 } from "path";
299797
300395
  import { z as z77 } from "zod";
299798
300396
  var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
299799
300397
  var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
@@ -299860,7 +300458,7 @@ function createProjectBackup(projectDirectory) {
299860
300458
  const orbitRoot = join21(projectRoot, ".orbit");
299861
300459
  const files = [];
299862
300460
  let totalBytes = 0;
299863
- if (existsSync29(orbitRoot)) {
300461
+ if (existsSync30(orbitRoot)) {
299864
300462
  for (const absolutePath of listBackupFiles(orbitRoot)) {
299865
300463
  if (files.length >= MAX_BACKUP_FILES) {
299866
300464
  throw new Error(`Project backup exceeds ${MAX_BACKUP_FILES} files.`);
@@ -299939,7 +300537,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
299939
300537
  file,
299940
300538
  destination: resolveBackupDestination(orbitRoot, file.path)
299941
300539
  }));
299942
- const conflicts2 = planned.filter(({ destination }) => existsSync29(destination)).map(({ file }) => file.path);
300540
+ const conflicts2 = planned.filter(({ destination }) => existsSync30(destination)).map(({ file }) => file.path);
299943
300541
  if (conflicts2.length > 0 && !options.force) {
299944
300542
  throw new Error(
299945
300543
  `Restore would overwrite ${conflicts2.length} file(s). Re-run with --force after reviewing the backup.`
@@ -300022,22 +300620,22 @@ function assertDirectoryChainHasNoSymlink(root, target) {
300022
300620
  const absoluteRoot = resolve18(root);
300023
300621
  const absoluteTarget = resolve18(target);
300024
300622
  const relativeTarget = relative10(absoluteRoot, absoluteTarget);
300025
- if (relativeTarget.startsWith("..") || isAbsolute8(relativeTarget)) {
300623
+ if (relativeTarget.startsWith("..") || isAbsolute9(relativeTarget)) {
300026
300624
  throw new Error("Backup restore directory escapes the project.");
300027
300625
  }
300028
300626
  let current = absoluteRoot;
300029
- if (existsSync29(current) && lstatSync11(current).isSymbolicLink()) {
300627
+ if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
300030
300628
  throw new Error(`Refusing to restore through symbolic link: ${current}`);
300031
300629
  }
300032
300630
  for (const part of relativeTarget.split(sep2).filter(Boolean)) {
300033
300631
  current = join21(current, part);
300034
- if (existsSync29(current) && lstatSync11(current).isSymbolicLink()) {
300632
+ if (existsSync30(current) && lstatSync11(current).isSymbolicLink()) {
300035
300633
  throw new Error(`Refusing to restore through symbolic link: ${current}`);
300036
300634
  }
300037
300635
  }
300038
300636
  }
300039
300637
  function replaceFileAtomically2(temporaryPath, destination) {
300040
- if (!existsSync29(destination)) {
300638
+ if (!existsSync30(destination)) {
300041
300639
  renameSync8(temporaryPath, destination);
300042
300640
  return;
300043
300641
  }
@@ -300047,7 +300645,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
300047
300645
  renameSync8(temporaryPath, destination);
300048
300646
  rmSync10(previousPath, { force: true });
300049
300647
  } catch (error) {
300050
- if (!existsSync29(destination) && existsSync29(previousPath)) {
300648
+ if (!existsSync30(destination) && existsSync30(previousPath)) {
300051
300649
  renameSync8(previousPath, destination);
300052
300650
  }
300053
300651
  throw error;
@@ -300055,7 +300653,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
300055
300653
  }
300056
300654
  function normalizeBundlePath(filePath) {
300057
300655
  const normalized = filePath.replaceAll("\\", "/");
300058
- if (!normalized || normalized.startsWith("/") || isAbsolute8(normalized) || normalized.split("/").some((part) => !part || part === "." || part === "..")) {
300656
+ if (!normalized || normalized.startsWith("/") || isAbsolute9(normalized) || normalized.split("/").some((part) => !part || part === "." || part === "..")) {
300059
300657
  return void 0;
300060
300658
  }
300061
300659
  return normalized;
@@ -300159,7 +300757,7 @@ import picocolors28 from "picocolors";
300159
300757
 
300160
300758
  // src/runtime/ExtensionManager.ts
300161
300759
  import {
300162
- existsSync as existsSync30,
300760
+ existsSync as existsSync31,
300163
300761
  lstatSync as lstatSync12,
300164
300762
  mkdirSync as mkdirSync11,
300165
300763
  readdirSync as readdirSync11,
@@ -300168,7 +300766,7 @@ import {
300168
300766
  writeFileSync as writeFileSync11
300169
300767
  } from "fs";
300170
300768
  import { randomUUID as randomUUID17 } from "crypto";
300171
- import { dirname as dirname18, isAbsolute as isAbsolute9, join as join26, relative as relative11, resolve as resolve20, sep as sep3 } from "path";
300769
+ import { dirname as dirname18, isAbsolute as isAbsolute10, join as join26, relative as relative11, resolve as resolve20, sep as sep3 } from "path";
300172
300770
  import { homedir as homedir12 } from "os";
300173
300771
  import { z as z79 } from "zod";
300174
300772
  var InstalledExtensionSchema2 = z79.object({
@@ -300198,7 +300796,7 @@ var ExtensionManager = class {
300198
300796
  list() {
300199
300797
  try {
300200
300798
  return this.readRegistry().filter(
300201
- (extension) => this.isManagedExtensionPath(extension) && existsSync30(extension.path) && !lstatSync12(extension.path).isSymbolicLink()
300799
+ (extension) => this.isManagedExtensionPath(extension) && existsSync31(extension.path) && !lstatSync12(extension.path).isSymbolicLink()
300202
300800
  );
300203
300801
  } catch {
300204
300802
  return [];
@@ -300251,12 +300849,12 @@ var ExtensionManager = class {
300251
300849
  try {
300252
300850
  copyDirectorySafely(sourceRoot, staging);
300253
300851
  const digest = hashExtensionDirectory(staging);
300254
- if (existsSync30(target)) {
300852
+ if (existsSync31(target)) {
300255
300853
  renameSync9(target, targetBackup);
300256
300854
  targetBackedUp = true;
300257
300855
  }
300258
300856
  for (const prompt of promptTargets) {
300259
- if (!existsSync30(prompt.target)) continue;
300857
+ if (!existsSync31(prompt.target)) continue;
300260
300858
  mkdirSync11(dirname18(prompt.backup), { recursive: true });
300261
300859
  renameSync9(prompt.target, prompt.backup);
300262
300860
  prompt.backedUp = true;
@@ -300292,14 +300890,14 @@ var ExtensionManager = class {
300292
300890
  if (targetInstalled) {
300293
300891
  rmSync11(target, { recursive: true, force: true });
300294
300892
  }
300295
- if (targetBackedUp && existsSync30(targetBackup)) {
300893
+ if (targetBackedUp && existsSync31(targetBackup)) {
300296
300894
  renameSync9(targetBackup, target);
300297
300895
  }
300298
300896
  for (const prompt of promptTargets) {
300299
300897
  if (promptMutationStarted) {
300300
300898
  rmSync11(prompt.target, { recursive: true, force: true });
300301
300899
  }
300302
- if (prompt.backedUp && existsSync30(prompt.backup)) {
300900
+ if (prompt.backedUp && existsSync31(prompt.backup)) {
300303
300901
  mkdirSync11(dirname18(prompt.target), { recursive: true });
300304
300902
  renameSync9(prompt.backup, prompt.target);
300305
300903
  }
@@ -300327,7 +300925,7 @@ var ExtensionManager = class {
300327
300925
  );
300328
300926
  }
300329
300927
  const installed = registry.find(
300330
- (entry) => entry.id === id && existsSync30(entry.path) && !lstatSync12(entry.path).isSymbolicLink()
300928
+ (entry) => entry.id === id && existsSync31(entry.path) && !lstatSync12(entry.path).isSymbolicLink()
300331
300929
  );
300332
300930
  if (!installed) return false;
300333
300931
  const rollbackRoot = join26(
@@ -300347,7 +300945,7 @@ var ExtensionManager = class {
300347
300945
  ].map((entry) => ({ ...entry, backedUp: false }));
300348
300946
  try {
300349
300947
  for (const entry of targets) {
300350
- if (!existsSync30(entry.target)) continue;
300948
+ if (!existsSync31(entry.target)) continue;
300351
300949
  mkdirSync11(dirname18(entry.backup), { recursive: true });
300352
300950
  renameSync9(entry.target, entry.backup);
300353
300951
  entry.backedUp = true;
@@ -300358,7 +300956,7 @@ var ExtensionManager = class {
300358
300956
  } catch (error) {
300359
300957
  try {
300360
300958
  for (const entry of targets) {
300361
- if (!entry.backedUp || !existsSync30(entry.backup)) continue;
300959
+ if (!entry.backedUp || !existsSync31(entry.backup)) continue;
300362
300960
  mkdirSync11(dirname18(entry.target), { recursive: true });
300363
300961
  renameSync9(entry.backup, entry.target);
300364
300962
  }
@@ -300386,7 +300984,7 @@ var ExtensionManager = class {
300386
300984
  isManagedExtensionPath(extension) {
300387
300985
  const expected = resolve20(this.extensionsDir, extension.id);
300388
300986
  const slot = relative11(this.extensionsDir, expected);
300389
- const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !isAbsolute9(slot);
300987
+ const remainsInsideManagedRoot = slot.length > 0 && slot !== ".." && !slot.startsWith(`..${sep3}`) && !isAbsolute10(slot);
300390
300988
  return remainsInsideManagedRoot && resolve20(extension.path) === expected;
300391
300989
  }
300392
300990
  readRegistry() {
@@ -300487,7 +301085,7 @@ function validateContributionFiles(root, manifest) {
300487
301085
  `Invalid extension contribution path: ${contribution.path}`
300488
301086
  );
300489
301087
  }
300490
- if (!existsSync30(target) || lstatSync12(target).isSymbolicLink()) {
301088
+ if (!existsSync31(target) || lstatSync12(target).isSymbolicLink()) {
300491
301089
  throw new Error(
300492
301090
  `Extension contribution is missing or unsafe: ${contribution.path}`
300493
301091
  );
@@ -300638,7 +301236,7 @@ function removeExtension(id) {
300638
301236
  }
300639
301237
 
300640
301238
  // src/index.ts
300641
- import { existsSync as existsSync31, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
301239
+ import { existsSync as existsSync35, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
300642
301240
  import { resolve as resolve21 } from "path";
300643
301241
 
300644
301242
  // src/runtime/CliRunOverrides.ts
@@ -300667,7 +301265,7 @@ function applyOutcomeExitCode(outcome) {
300667
301265
  }
300668
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(
300669
301267
  "--yes",
300670
- "enable Full Access for ordinary actions (dangerous or opaque commands remain guarded)"
301268
+ "enable unrestricted Full Access and approve every enabled tool action"
300671
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) => {
300672
301270
  const cwd = process.cwd();
300673
301271
  const overrides = createCliRunOverrides({
@@ -300871,7 +301469,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
300871
301469
  fullAccess: !!options.yes
300872
301470
  });
300873
301471
  const requestedCwd = resolve21(localOptions.cwd || process.cwd());
300874
- if (!existsSync31(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
301472
+ if (!existsSync35(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
300875
301473
  throw new Error(
300876
301474
  `Web UI project directory does not exist: ${requestedCwd}`
300877
301475
  );