@liberseek/boft-cli-win32-arm64 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44742,11 +44742,8 @@ function targetedSubagentId(argumentsValue) {
44742
44742
  return void 0;
44743
44743
  return boundedString(argumentsValue.to ?? argumentsValue.recipient ?? argumentsValue.agentId, SUBAGENT_DESCRIPTION_LIMIT);
44744
44744
  }
44745
- function includesAuthenticationFailure(message, errors) {
44746
- if (errors.some((error52) => AUTHENTICATION_ERRORS.has(error52)))
44747
- return true;
44748
- const text = [message.result, ...Array.isArray(message.errors) ? message.errors : []].filter((value) => typeof value === "string").join(" ").toLowerCase();
44749
- return text.includes("not logged in") || text.includes("invalid api key") || text.includes("oauth");
44745
+ function includesAuthenticationFailure(errors) {
44746
+ return errors.some((error52) => AUTHENTICATION_ERRORS.has(error52));
44750
44747
  }
44751
44748
  function failure(kind) {
44752
44749
  return { status: "failed", kind };
@@ -45007,7 +45004,7 @@ var ClaudeNativeTurnAccumulator = class {
45007
45004
  terminal = failure("protocol");
45008
45005
  } else if (this.#textConflict) {
45009
45006
  terminal = failure("textConflict");
45010
- } else if (includesAuthenticationFailure(message, this.#assistantErrors)) {
45007
+ } else if (includesAuthenticationFailure(this.#assistantErrors)) {
45011
45008
  terminal = failure("authentication");
45012
45009
  } else if (this.#cancelRequested && ABORTED_TERMINALS.has(terminalReason)) {
45013
45010
  terminal = { status: "cancelled", reason: terminalReason };
@@ -44625,7 +44625,7 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
44625
44625
  }
44626
44626
 
44627
44627
  // dist/command.js
44628
- function cursorInvocation(environment, command, args = ["acp"]) {
44628
+ function cursorInvocation(environment, command, args) {
44629
44629
  const resolution = resolveHarnessExecutable({
44630
44630
  id: "cursor-cli",
44631
44631
  command: "cursor-agent",
@@ -44706,7 +44706,7 @@ var CursorTransport = class {
44706
44706
  return this.#preparation ??= this.#prepare();
44707
44707
  }
44708
44708
  async #prepare() {
44709
- const invocation = cursorInvocation(this.options.environment, this.options.command);
44709
+ const invocation = cursorInvocation(this.options.environment, this.options.command, this.options.executionPolicy === "unattended-full-access" ? ["--force", "acp"] : ["acp"]);
44710
44710
  const child = spawn(invocation.command, invocation.arguments, {
44711
44711
  cwd: this.options.cwd,
44712
44712
  env: this.options.environment,
@@ -45852,9 +45852,11 @@ function cursorSnapshot(sessionId, native, replay, nativeSubagentId) {
45852
45852
  import { randomUUID } from "node:crypto";
45853
45853
  var CursorInteractions = class {
45854
45854
  emit;
45855
+ refuseUnattendedApproval;
45855
45856
  #pending = /* @__PURE__ */ new Map();
45856
- constructor(emit) {
45857
+ constructor(emit, refuseUnattendedApproval) {
45857
45858
  this.emit = emit;
45859
+ this.refuseUnattendedApproval = refuseUnattendedApproval;
45858
45860
  }
45859
45861
  #ask(interaction) {
45860
45862
  return new Promise((resolve) => {
@@ -45863,6 +45865,10 @@ var CursorInteractions = class {
45863
45865
  });
45864
45866
  }
45865
45867
  async permission(turnId, request) {
45868
+ if (this.refuseUnattendedApproval) {
45869
+ await this.refuseUnattendedApproval();
45870
+ return { outcome: { outcome: "cancelled" } };
45871
+ }
45866
45872
  const response = await this.#ask({
45867
45873
  type: "approval",
45868
45874
  interactionId: hostInteractionIdSchema.parse(randomUUID()),
@@ -45880,6 +45886,10 @@ var CursorInteractions = class {
45880
45886
  async extension(turnId, method, params) {
45881
45887
  const interactionId = hostInteractionIdSchema.parse(randomUUID());
45882
45888
  if (method === "cursor/create_plan" && typeof params.plan === "string") {
45889
+ if (this.refuseUnattendedApproval) {
45890
+ await this.refuseUnattendedApproval();
45891
+ return { outcome: { outcome: "cancelled" } };
45892
+ }
45883
45893
  const response = await this.#ask({
45884
45894
  type: "approval",
45885
45895
  interactionId,
@@ -45983,6 +45993,30 @@ var CursorInteractions = class {
45983
45993
  }
45984
45994
  };
45985
45995
 
45996
+ // dist/session-ref.js
45997
+ var cursorHarnessId = harnessIdSchema.parse("cursor-cli");
45998
+ var cursorSessionLocatorSchema = external_exports.strictObject({
45999
+ executionPolicy: external_exports.enum(["default", "unattended-full-access"])
46000
+ });
46001
+ function cursorNativeSessionRef(nativeSessionId, executionPolicy) {
46002
+ return nativeSessionRefSchema.parse({
46003
+ harnessId: cursorHarnessId,
46004
+ nativeSessionId,
46005
+ locator: { executionPolicy },
46006
+ formatVersion: 1
46007
+ });
46008
+ }
46009
+ function cursorExecutionPolicy(ref) {
46010
+ if (ref.harnessId !== cursorHarnessId || ref.formatVersion !== 1)
46011
+ throw new Error("Invalid Cursor Native Session Ref");
46012
+ if (ref.locator === void 0)
46013
+ return "default";
46014
+ const locator = cursorSessionLocatorSchema.safeParse(ref.locator);
46015
+ if (!locator.success)
46016
+ throw new Error("Invalid Cursor Native Session locator");
46017
+ return locator.data.executionPolicy;
46018
+ }
46019
+
45986
46020
  // dist/fork.js
45987
46021
  import { createHash as createHash2 } from "node:crypto";
45988
46022
  import { copyFile, mkdir, mkdtemp, readdir, readFile, realpath, rm, writeFile } from "node:fs/promises";
@@ -46268,7 +46302,12 @@ var CursorAdapter = class {
46268
46302
  return { ok: true, value: active };
46269
46303
  const options = session?.transport.options ?? this.transportOptions(cwd);
46270
46304
  const before = readCursorNativeTurns(parent.nativeSessionId, cwd, options.environment);
46271
- replay = new CursorTransport({ ...options, delegation: false, loadModelCatalog: false });
46305
+ replay = new CursorTransport({
46306
+ ...options,
46307
+ delegation: false,
46308
+ executionPolicy: "default",
46309
+ loadModelCatalog: false
46310
+ });
46272
46311
  await replay.open(parent.nativeSessionId);
46273
46312
  const after = readCursorNativeTurns(parent.nativeSessionId, cwd, options.environment);
46274
46313
  if (JSON.stringify(before) !== JSON.stringify(after))
@@ -46353,11 +46392,19 @@ var CursorAdapter = class {
46353
46392
  return this.#openSession(input);
46354
46393
  }
46355
46394
  async #openSession(input, prepared) {
46356
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access")
46357
- return rejected("unsupported", "Cursor ACP cannot confirm unattended full access under native team policy");
46358
46395
  if (input.kind === "resume" && input.nativeRef.harnessId !== this.harnessId)
46359
46396
  return rejected("invalidRequest", "Session belongs to another Harness");
46360
- const options = { ...this.transportOptions(input.cwd, input.environment), delegation: true };
46397
+ let executionPolicy;
46398
+ try {
46399
+ executionPolicy = input.kind === "create" ? input.executionPolicy ?? "default" : cursorExecutionPolicy(input.nativeRef);
46400
+ } catch {
46401
+ return rejected("invalidRequest", "Invalid Cursor Native Session locator");
46402
+ }
46403
+ const options = {
46404
+ ...this.transportOptions(input.cwd, input.environment),
46405
+ delegation: true,
46406
+ executionPolicy
46407
+ };
46361
46408
  const transport = prepared ?? new CursorTransport(options);
46362
46409
  try {
46363
46410
  const before = input.kind === "resume" ? readCursorNativeHistory(input.nativeRef.nativeSessionId, options.cwd, options.environment) : void 0;
@@ -46410,11 +46457,13 @@ var CursorAdapter = class {
46410
46457
  const signal = controller.signal;
46411
46458
  if (!cursorForkAvailable())
46412
46459
  return rejected("unsupported", "Cursor Fork requires macOS/Linux with /usr/bin/script");
46460
+ let executionPolicy;
46413
46461
  try {
46414
46462
  if (input.kind === "fork")
46415
46463
  validateCursorFork(input.sourceRef, input.checkpoint);
46416
46464
  else if (input.sourceRef.harnessId !== this.harnessId || input.sourceRef.formatVersion !== 1)
46417
46465
  return rejected("invalidRequest", "Invalid Cursor rollback source");
46466
+ executionPolicy = cursorExecutionPolicy(input.sourceRef);
46418
46467
  } catch {
46419
46468
  return rejected("invalidRequest", "Invalid Cursor fork checkpoint");
46420
46469
  }
@@ -46447,7 +46496,7 @@ var CursorAdapter = class {
46447
46496
  const sameEnvironment = sourceEnvironment && [
46448
46497
  .../* @__PURE__ */ new Set([...Object.keys(sourceEnvironment), ...Object.keys(options.environment)])
46449
46498
  ].every((key) => sourceEnvironment[key] === options.environment[key]);
46450
- transport = new CursorTransport({ ...options, delegation: true }, sameEnvironment ? source?.info.nativeModels : void 0);
46499
+ transport = new CursorTransport({ ...options, delegation: true, executionPolicy }, sameEnvironment ? source?.info.nativeModels : void 0);
46451
46500
  const abort = (error51) => {
46452
46501
  controller.abort(error51);
46453
46502
  throw error51;
@@ -46472,11 +46521,7 @@ var CursorAdapter = class {
46472
46521
  kind: "resume",
46473
46522
  cwd: input.cwd,
46474
46523
  environment: options.environment,
46475
- nativeRef: nativeSessionRefSchema.parse({
46476
- harnessId: this.harnessId,
46477
- nativeSessionId: derived.sessionId,
46478
- formatVersion: 1
46479
- }),
46524
+ nativeRef: cursorNativeSessionRef(derived.sessionId, executionPolicy),
46480
46525
  ...model ? { model } : {},
46481
46526
  ...thinking ? { thinkingOptionId: thinking } : {},
46482
46527
  ...mode ? { permissionModeId: mode } : {}
@@ -46536,9 +46581,11 @@ var CursorSession = class {
46536
46581
  initialState;
46537
46582
  #channel = new HarnessOutputChannel();
46538
46583
  outputs = this.#channel.outputs;
46539
- #interactions = new CursorInteractions((output) => this.#channel.emit(output));
46584
+ #interactions;
46585
+ #executionPolicy;
46540
46586
  #submitted = /* @__PURE__ */ new Set();
46541
46587
  #active;
46588
+ #unattendedApproval = false;
46542
46589
  #configuring = false;
46543
46590
  #closed = false;
46544
46591
  #fresh;
@@ -46566,12 +46613,10 @@ var CursorSession = class {
46566
46613
  this.info = structuredClone(info);
46567
46614
  this.#fresh = created;
46568
46615
  this.#snapshot = loadedSnapshot;
46616
+ this.#executionPolicy = transport.options.executionPolicy ?? "default";
46617
+ this.#interactions = new CursorInteractions((output) => this.#channel.emit(output), this.#executionPolicy === "unattended-full-access" ? () => this.#refuseUnattendedApproval() : void 0);
46569
46618
  this.initialState = {
46570
- nativeRef: nativeSessionRefSchema.parse({
46571
- harnessId: "cursor-cli",
46572
- nativeSessionId: transport.sessionId,
46573
- formatVersion: 1
46574
- }),
46619
+ nativeRef: cursorNativeSessionRef(transport.sessionId, this.#executionPolicy),
46575
46620
  effectiveModel: cursorConfiguredModelRef(cursorModels(info).current, info.configOptions),
46576
46621
  ...cursorThinkingState(info),
46577
46622
  effectivePermissionModeId: harnessPermissionModeIdSchema.parse(info.configOptions?.find((option) => option.id === "mode")?.currentValue ?? info.modes?.currentModeId ?? "agent")
@@ -46580,6 +46625,11 @@ var CursorSession = class {
46580
46625
  #native(allowMissing = false) {
46581
46626
  return readCursorNativeTurns(this.transport.sessionId, this.transport.options.cwd, this.transport.options.environment, allowMissing);
46582
46627
  }
46628
+ /** Bound to unattended full access only; Cursor itself keeps enforcing its team policy. */
46629
+ #refuseUnattendedApproval() {
46630
+ this.#unattendedApproval = true;
46631
+ return this.transport.cancel();
46632
+ }
46583
46633
  async readSnapshot() {
46584
46634
  if (this.#closed)
46585
46635
  return rejected("invalidState", "Cursor session is closed");
@@ -46596,6 +46646,7 @@ var CursorSession = class {
46596
46646
  replay = new CursorTransport({
46597
46647
  ...this.transport.options,
46598
46648
  delegation: false,
46649
+ executionPolicy: "default",
46599
46650
  loadModelCatalog: false
46600
46651
  });
46601
46652
  await replay.open(this.transport.sessionId);
@@ -46711,6 +46762,7 @@ var CursorSession = class {
46711
46762
  let fault;
46712
46763
  const output = new CursorTurnOutput(command.turnId, (event) => this.#channel.emit({ kind: "event", event }), before.length);
46713
46764
  this.#subagentOutput = output.subagents;
46765
+ this.#unattendedApproval = false;
46714
46766
  this.#channel.emit({ kind: "event", event: { type: "turn.started", turnId: command.turnId } });
46715
46767
  let outcome = {
46716
46768
  status: "failed",
@@ -46738,6 +46790,15 @@ var CursorSession = class {
46738
46790
  fault = cursorError(error51);
46739
46791
  outcome = this.#active?.cancelled ? { status: "cancelled" } : { status: "failed", error: cursorError(error51) };
46740
46792
  }
46793
+ if (!this.#active?.cancelled && this.#unattendedApproval)
46794
+ outcome = {
46795
+ status: "failed",
46796
+ error: {
46797
+ code: "nativeFailure",
46798
+ message: "Cursor requested approval during unattended full access",
46799
+ retryable: false
46800
+ }
46801
+ };
46741
46802
  try {
46742
46803
  const after = this.#native(this.#fresh);
46743
46804
  const added = after.filter((turn) => !before.some((old) => old.id === turn.id));