@get-bb/plugin-sdk 0.5.8 → 0.5.9

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.
@@ -19349,8 +19349,10 @@ interface PluginSdkApp {
19349
19349
  */
19350
19350
  experimental_BranchPicker: ComponentType<BranchPickerProps>;
19351
19351
  /**
19352
- * Search and refresh the branch list for one project source. Experimental:
19353
- * see docs/api_to_audit.md.
19352
+ * Search and refresh the branch list for one project source. `query` is
19353
+ * debounced before it reaches the host, so a control can pass it on every
19354
+ * keystroke; filtering the returned lists stays the caller's job.
19355
+ * Experimental: see docs/api_to_audit.md.
19354
19356
  */
19355
19357
  experimental_useBranches(args: UseBranchesArgs): BranchesState;
19356
19358
  /**
@@ -19501,8 +19501,10 @@ interface PluginSdkApp {
19501
19501
  */
19502
19502
  experimental_BranchPicker: ComponentType<BranchPickerProps>;
19503
19503
  /**
19504
- * Search and refresh the branch list for one project source. Experimental:
19505
- * see docs/api_to_audit.md.
19504
+ * Search and refresh the branch list for one project source. `query` is
19505
+ * debounced before it reaches the host, so a control can pass it on every
19506
+ * keystroke; filtering the returned lists stays the caller's job.
19507
+ * Experimental: see docs/api_to_audit.md.
19506
19508
  */
19507
19509
  experimental_useBranches(args: UseBranchesArgs): BranchesState;
19508
19510
  /**
@@ -3757,11 +3757,11 @@ function describeResultContentBlock(block) {
3757
3757
  if (!type) {
3758
3758
  return null;
3759
3759
  }
3760
- const path5 = getStringProperty(block, "path");
3760
+ const path6 = getStringProperty(block, "path");
3761
3761
  const toolName = getStringProperty(block, "tool_name");
3762
3762
  const url = getStringProperty(block, "url") ?? getStringProperty(block, "imageUrl");
3763
- if (path5) {
3764
- return `[${type}: ${path5}]`;
3763
+ if (path6) {
3764
+ return `[${type}: ${path6}]`;
3765
3765
  }
3766
3766
  if (toolName) {
3767
3767
  return `[${type}: ${toolName}]`;
@@ -4253,9 +4253,9 @@ function presentationTitle(text) {
4253
4253
  function withTitle(presentation, title) {
4254
4254
  return title === void 0 ? presentation : { ...presentation, title };
4255
4255
  }
4256
- function presentationFileName(path5) {
4257
- const segments = path5.split("/").filter((segment) => segment.length > 0);
4258
- return segments[segments.length - 1] ?? path5;
4256
+ function presentationFileName(path6) {
4257
+ const segments = path6.split("/").filter((segment) => segment.length > 0);
4258
+ return segments[segments.length - 1] ?? path6;
4259
4259
  }
4260
4260
  var COMPACTION_PRESENTATION = {
4261
4261
  label: { pending: "Compacting context", completed: "Compacted context" },
@@ -4265,13 +4265,13 @@ var REASONING_PRESENTATION = {
4265
4265
  label: { pending: "Thinking", completed: "Thought" },
4266
4266
  icon: { glyph: "Brain" }
4267
4267
  };
4268
- function fileReadPresentation(path5) {
4268
+ function fileReadPresentation(path6) {
4269
4269
  return withTitle(
4270
4270
  {
4271
4271
  label: { pending: "Reading file", completed: "Read file" },
4272
4272
  icon: { glyph: "FileText" }
4273
4273
  },
4274
- presentationTitle(presentationFileName(path5))
4274
+ presentationTitle(presentationFileName(path6))
4275
4275
  );
4276
4276
  }
4277
4277
  function searchPresentation(args) {
@@ -4406,12 +4406,12 @@ var ignoredJsonRpcResultSchema = z34.unknown();
4406
4406
  // ../provider-bridge-acp/src/bridge/bridge.ts
4407
4407
  import { execFile as execFile4 } from "node:child_process";
4408
4408
  import { randomBytes as randomBytes2 } from "node:crypto";
4409
- import { promises as fs2, readFileSync } from "node:fs";
4409
+ import { promises as fs3, readFileSync } from "node:fs";
4410
4410
  import { createServer } from "node:net";
4411
4411
  import { dirname as dirname2, isAbsolute, basename as basename3, relative, resolve as resolve3 } from "node:path";
4412
4412
  import { fileURLToPath } from "node:url";
4413
4413
  import { isDeepStrictEqual } from "node:util";
4414
- import { z as z42 } from "zod";
4414
+ import { z as z43 } from "zod";
4415
4415
 
4416
4416
  // ../provider-bridge-acp/src/bridge-protocol.ts
4417
4417
  import { z as z36 } from "zod";
@@ -4833,17 +4833,189 @@ var acpWarningNotificationParamsSchema = z36.object({
4833
4833
 
4834
4834
  // ../provider-bridge-acp/src/dialect.ts
4835
4835
  import { basename } from "node:path";
4836
- import { z as z40 } from "zod";
4836
+ import { z as z41 } from "zod";
4837
4837
 
4838
4838
  // ../provider-bridge-acp/src/bridge/provider-maintenance.ts
4839
4839
  import { execFile as execFile2 } from "node:child_process";
4840
4840
  import { existsSync } from "node:fs";
4841
+ import fs2 from "node:fs/promises";
4842
+ import os2 from "node:os";
4843
+ import path3 from "node:path";
4844
+ import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
4845
+ import { promisify as promisify2 } from "node:util";
4846
+ import { z as z38 } from "zod";
4847
+
4848
+ // ../provider-bridge-acp/src/bridge/opencode-usage.ts
4841
4849
  import fs from "node:fs/promises";
4842
4850
  import os from "node:os";
4843
4851
  import path2 from "node:path";
4844
4852
  import { DatabaseSync } from "node:sqlite";
4845
- import { promisify as promisify2 } from "node:util";
4846
4853
  import { z as z37 } from "zod";
4854
+ var apiCredentialSchema = z37.object({
4855
+ type: z37.literal("api"),
4856
+ key: z37.string().trim().min(1)
4857
+ });
4858
+ var credentialsSchema = z37.record(z37.string(), z37.unknown());
4859
+ var accountSchema = z37.object({
4860
+ id: z37.string().min(1),
4861
+ email: z37.email().nullable().catch(null),
4862
+ url: z37.url(),
4863
+ access_token: z37.string().min(1),
4864
+ token_expiry: z37.number().nullable(),
4865
+ active_org_id: z37.string().min(1).nullable()
4866
+ });
4867
+ var windowSchema = z37.object({
4868
+ status: z37.enum(["ok", "rate-limited"]),
4869
+ percent: z37.number().nonnegative(),
4870
+ resetsAt: z37.iso.datetime({ offset: true })
4871
+ });
4872
+ var usageSchema = z37.object({
4873
+ usage: z37.object({
4874
+ rolling: windowSchema,
4875
+ weekly: windowSchema,
4876
+ monthly: windowSchema
4877
+ })
4878
+ });
4879
+ function dataDirectory(env) {
4880
+ const dataHome = env.XDG_DATA_HOME;
4881
+ return path2.join(
4882
+ dataHome && path2.isAbsolute(dataHome) ? dataHome : path2.join(env.HOME || os.homedir(), ".local", "share"),
4883
+ "opencode"
4884
+ );
4885
+ }
4886
+ async function readAccount(env) {
4887
+ const databasePath = path2.join(dataDirectory(env), "opencode.db");
4888
+ try {
4889
+ await fs.access(databasePath);
4890
+ } catch (error) {
4891
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
4892
+ return null;
4893
+ throw error;
4894
+ }
4895
+ const database = new DatabaseSync(databasePath, { readOnly: true });
4896
+ try {
4897
+ const tables = database.prepare(
4898
+ "SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('account', 'account_state')"
4899
+ ).all();
4900
+ if (tables.length !== 2) return null;
4901
+ const row = database.prepare(
4902
+ "SELECT a.id, a.email, a.url, a.access_token, a.token_expiry, s.active_org_id FROM account a JOIN account_state s ON s.active_account_id = a.id WHERE s.id = 1"
4903
+ ).get();
4904
+ if (!row) return null;
4905
+ const account = accountSchema.parse(row);
4906
+ const issuer = new URL(account.url);
4907
+ if (issuer.origin !== "https://opencode.ai" || !["/", "/console", "/console/"].includes(issuer.pathname) || account.active_org_id === null)
4908
+ return null;
4909
+ return account;
4910
+ } finally {
4911
+ database.close();
4912
+ }
4913
+ }
4914
+ async function readApiKey(env) {
4915
+ if (env.OPENCODE_API_KEY?.trim()) return env.OPENCODE_API_KEY.trim();
4916
+ let content = env.OPENCODE_AUTH_CONTENT;
4917
+ if (content) {
4918
+ try {
4919
+ JSON.parse(content);
4920
+ } catch {
4921
+ content = void 0;
4922
+ }
4923
+ }
4924
+ if (!content) {
4925
+ try {
4926
+ content = await fs.readFile(
4927
+ path2.join(dataDirectory(env), "auth.json"),
4928
+ "utf8"
4929
+ );
4930
+ } catch (error) {
4931
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
4932
+ return null;
4933
+ throw error;
4934
+ }
4935
+ }
4936
+ const credentials = credentialsSchema.parse(JSON.parse(content));
4937
+ for (const provider of ["opencode-go", "opencode"]) {
4938
+ const credential = apiCredentialSchema.safeParse(credentials[provider]);
4939
+ if (credential.success) return credential.data.key;
4940
+ }
4941
+ return null;
4942
+ }
4943
+ async function readOpenCodeGoUsage(env) {
4944
+ const failure = (message) => ({
4945
+ supported: true,
4946
+ usage: {
4947
+ status: "error",
4948
+ message,
4949
+ planLabel: "OpenCode Go",
4950
+ accountEmail: null
4951
+ }
4952
+ });
4953
+ let apiKey;
4954
+ let account;
4955
+ try {
4956
+ account = env.OPENCODE_API_KEY?.trim() ? null : await readAccount(env);
4957
+ apiKey = account?.access_token ?? await readApiKey(env);
4958
+ } catch {
4959
+ return failure("OpenCode credentials could not be read.");
4960
+ }
4961
+ if (apiKey === null)
4962
+ return { supported: true, usage: { status: "unauthenticated" } };
4963
+ if (account?.token_expiry != null && account.token_expiry <= Date.now())
4964
+ return { supported: true, usage: { status: "expired" } };
4965
+ try {
4966
+ const response = await fetch(
4967
+ account ? "https://opencode.ai/inference/go/v1/usage" : "https://opencode.ai/zen/go/v1/usage",
4968
+ {
4969
+ headers: {
4970
+ Authorization: `Bearer ${apiKey}`,
4971
+ Accept: "application/json",
4972
+ "User-Agent": "bb-provider-acp",
4973
+ ...account?.active_org_id ? { "x-opencode-org-id": account.active_org_id } : {}
4974
+ },
4975
+ redirect: "error",
4976
+ signal: AbortSignal.timeout(15e3)
4977
+ }
4978
+ );
4979
+ if (response.status === 401)
4980
+ return { supported: true, usage: { status: "expired" } };
4981
+ if (response.status === 403)
4982
+ return failure(
4983
+ "OpenCode Go usage access was denied. Check that the account has an active Go subscription."
4984
+ );
4985
+ if (!response.ok)
4986
+ return failure(
4987
+ `OpenCode Go usage request failed (HTTP ${response.status}).`
4988
+ );
4989
+ const parsed = usageSchema.safeParse(await response.json());
4990
+ if (!parsed.success)
4991
+ return failure("OpenCode Go returned invalid usage information.");
4992
+ const { rolling, weekly, monthly } = parsed.data.usage;
4993
+ return {
4994
+ supported: true,
4995
+ usage: {
4996
+ status: "ok",
4997
+ accountEmail: account?.email ?? null,
4998
+ accountKey: account ? `opencode:organization:${account.active_org_id}:account:${account.id}` : null,
4999
+ planLabel: "OpenCode Go",
5000
+ windows: [
5001
+ { label: "5 hour", kind: "five-hour", window: rolling },
5002
+ { label: "Weekly", kind: "weekly", window: weekly },
5003
+ { label: "Monthly", kind: "custom", window: monthly }
5004
+ ].map(({ label, kind, window }) => ({
5005
+ label,
5006
+ kind,
5007
+ model: null,
5008
+ usedPercent: Math.min(100, window.percent),
5009
+ resetsAt: window.resetsAt
5010
+ }))
5011
+ }
5012
+ };
5013
+ } catch {
5014
+ return failure("OpenCode Go usage could not be collected. Try again.");
5015
+ }
5016
+ }
5017
+
5018
+ // ../provider-bridge-acp/src/bridge/provider-maintenance.ts
4847
5019
  var execFileAsync2 = promisify2(execFile2);
4848
5020
  var USAGE_FETCH_TIMEOUT_MS = 15e3;
4849
5021
  var CURSOR_DASHBOARD_URL = "https://api2.cursor.sh/aiserver.v1.DashboardService";
@@ -4852,14 +5024,14 @@ var CURSOR_ACCESS_TOKEN_SERVICE = "cursor-access-token";
4852
5024
  var CURSOR_INSTALL_SCRIPT_URL = "https://cursor.com/install";
4853
5025
  function cursorAuthFilePath() {
4854
5026
  if (process.platform === "win32") {
4855
- const appData = process.env.APPDATA ?? path2.join(os.homedir(), "AppData", "Roaming");
4856
- return path2.join(appData, "Cursor", "auth.json");
5027
+ const appData = process.env.APPDATA ?? path3.join(os2.homedir(), "AppData", "Roaming");
5028
+ return path3.join(appData, "Cursor", "auth.json");
4857
5029
  }
4858
5030
  if (process.platform === "darwin") {
4859
- return path2.join(os.homedir(), ".cursor", "auth.json");
5031
+ return path3.join(os2.homedir(), ".cursor", "auth.json");
4860
5032
  }
4861
- const configHome = process.env.XDG_CONFIG_HOME ?? path2.join(os.homedir(), ".config");
4862
- return path2.join(configHome, "cursor", "auth.json");
5033
+ const configHome = process.env.XDG_CONFIG_HOME ?? path3.join(os2.homedir(), ".config");
5034
+ return path3.join(configHome, "cursor", "auth.json");
4863
5035
  }
4864
5036
  async function readKeychainAccessToken() {
4865
5037
  if (process.platform !== "darwin") return null;
@@ -4881,15 +5053,15 @@ async function readKeychainAccessToken() {
4881
5053
  return null;
4882
5054
  }
4883
5055
  }
4884
- var cursorFileCredentialsSchema = z37.object({
4885
- accessToken: z37.string().min(1).nullish()
5056
+ var cursorFileCredentialsSchema = z38.object({
5057
+ accessToken: z38.string().min(1).nullish()
4886
5058
  });
4887
5059
  async function readAccessToken() {
4888
5060
  const keychain = await readKeychainAccessToken();
4889
5061
  if (keychain) return keychain;
4890
5062
  try {
4891
5063
  const parsed = cursorFileCredentialsSchema.safeParse(
4892
- JSON.parse(await fs.readFile(cursorAuthFilePath(), "utf8"))
5064
+ JSON.parse(await fs2.readFile(cursorAuthFilePath(), "utf8"))
4893
5065
  );
4894
5066
  return parsed.success ? parsed.data.accessToken ?? null : null;
4895
5067
  } catch {
@@ -4898,12 +5070,12 @@ async function readAccessToken() {
4898
5070
  }
4899
5071
  function cursorStateDatabasePath() {
4900
5072
  if (process.platform === "win32") {
4901
- const appData = process.env.APPDATA ?? path2.join(os.homedir(), "AppData", "Roaming");
4902
- return path2.join(appData, "Cursor", "User", "globalStorage", "state.vscdb");
5073
+ const appData = process.env.APPDATA ?? path3.join(os2.homedir(), "AppData", "Roaming");
5074
+ return path3.join(appData, "Cursor", "User", "globalStorage", "state.vscdb");
4903
5075
  }
4904
5076
  if (process.platform === "darwin") {
4905
- return path2.join(
4906
- os.homedir(),
5077
+ return path3.join(
5078
+ os2.homedir(),
4907
5079
  "Library",
4908
5080
  "Application Support",
4909
5081
  "Cursor",
@@ -4912,8 +5084,8 @@ function cursorStateDatabasePath() {
4912
5084
  "state.vscdb"
4913
5085
  );
4914
5086
  }
4915
- const configHome = process.env.XDG_CONFIG_HOME ?? path2.join(os.homedir(), ".config");
4916
- return path2.join(
5087
+ const configHome = process.env.XDG_CONFIG_HOME ?? path3.join(os2.homedir(), ".config");
5088
+ return path3.join(
4917
5089
  configHome,
4918
5090
  "Cursor",
4919
5091
  "User",
@@ -4926,10 +5098,10 @@ function readAccountEmail() {
4926
5098
  if (!existsSync(databasePath)) return null;
4927
5099
  let database = null;
4928
5100
  try {
4929
- database = new DatabaseSync(databasePath);
5101
+ database = new DatabaseSync2(databasePath);
4930
5102
  database.exec("PRAGMA query_only = true");
4931
5103
  const row = database.prepare("SELECT value FROM ItemTable WHERE key = ?").get("cursorAuth/cachedEmail");
4932
- const parsed = z37.object({ value: z37.string().email() }).safeParse(row);
5104
+ const parsed = z38.object({ value: z38.string().email() }).safeParse(row);
4933
5105
  return parsed.success ? parsed.data.value : null;
4934
5106
  } catch {
4935
5107
  return null;
@@ -5033,14 +5205,14 @@ function buildAcpProviderInstallationRun(status, args) {
5033
5205
  verification: { kind: "installed" }
5034
5206
  };
5035
5207
  }
5036
- var cursorNonNegativeIntegerSchema = z37.union([
5037
- z37.number().int().nonnegative(),
5038
- z37.string().regex(/^\d+$/u).transform(Number)
5208
+ var cursorNonNegativeIntegerSchema = z38.union([
5209
+ z38.number().int().nonnegative(),
5210
+ z38.string().regex(/^\d+$/u).transform(Number)
5039
5211
  ]).refine(Number.isSafeInteger);
5040
- var cursorUsageResponseSchema = z37.object({
5212
+ var cursorUsageResponseSchema = z38.object({
5041
5213
  billingCycleEnd: cursorNonNegativeIntegerSchema.nullish(),
5042
- planUsage: z37.object({ totalPercentUsed: z37.number().nonnegative().default(0) }).nullish(),
5043
- spendLimitUsage: z37.object({
5214
+ planUsage: z38.object({ totalPercentUsed: z38.number().nonnegative().default(0) }).nullish(),
5215
+ spendLimitUsage: z38.object({
5044
5216
  overallLimit: cursorNonNegativeIntegerSchema.nullish(),
5045
5217
  overallUsed: cursorNonNegativeIntegerSchema.nullish(),
5046
5218
  individualLimit: cursorNonNegativeIntegerSchema.nullish(),
@@ -5049,8 +5221,8 @@ var cursorUsageResponseSchema = z37.object({
5049
5221
  pooledUsed: cursorNonNegativeIntegerSchema.nullish()
5050
5222
  }).nullish()
5051
5223
  }).passthrough();
5052
- var cursorPlanResponseSchema = z37.object({
5053
- planInfo: z37.object({ planName: z37.string().min(1) }).nullish()
5224
+ var cursorPlanResponseSchema = z38.object({
5225
+ planInfo: z38.object({ planName: z38.string().min(1) }).nullish()
5054
5226
  }).passthrough();
5055
5227
  function normalizeUsage(rawUsage, rawPlan, accountEmail = null) {
5056
5228
  const usage = cursorUsageResponseSchema.safeParse(rawUsage);
@@ -5105,11 +5277,12 @@ function fetchDashboard(method, accessToken) {
5105
5277
  });
5106
5278
  }
5107
5279
  async function getAcpProviderUsage(args) {
5108
- if (args.maintenance === void 0) return { supported: false };
5280
+ const readUsage = args.dialectId === "opencode" ? () => readOpenCodeGoUsage(args.env) : args.maintenance?.readUsage;
5281
+ if (readUsage === void 0) return { supported: false };
5109
5282
  if (args.command === null || await resolveExecutablePath(args.command) === null) {
5110
5283
  return { supported: true, usage: { status: "not_installed" } };
5111
5284
  }
5112
- return args.maintenance.readUsage();
5285
+ return readUsage();
5113
5286
  }
5114
5287
  var CURSOR_ACP_MAINTENANCE = {
5115
5288
  loginCommand: "cursor-agent login",
@@ -5262,24 +5435,24 @@ function toolKindPresentation(args) {
5262
5435
  }
5263
5436
 
5264
5437
  // ../provider-bridge-acp/src/tool-classification.ts
5265
- import { z as z39 } from "zod";
5438
+ import { z as z40 } from "zod";
5266
5439
 
5267
5440
  // ../provider-bridge-acp/src/tool-call-operation.ts
5268
- import path3 from "node:path";
5269
- import { z as z38 } from "zod";
5270
- var acpRawInputCommandSchema = z38.object({ command: z38.string() }).passthrough();
5271
- var acpRawInputPathSchema = z38.object({
5272
- path: z38.string().optional(),
5273
- filePath: z38.string().optional(),
5274
- file_path: z38.string().optional(),
5275
- target_file: z38.string().optional()
5441
+ import path4 from "node:path";
5442
+ import { z as z39 } from "zod";
5443
+ var acpRawInputCommandSchema = z39.object({ command: z39.string() }).passthrough();
5444
+ var acpRawInputPathSchema = z39.object({
5445
+ path: z39.string().optional(),
5446
+ filePath: z39.string().optional(),
5447
+ file_path: z39.string().optional(),
5448
+ target_file: z39.string().optional()
5276
5449
  }).passthrough();
5277
5450
  function resolveAcpToolCallPath(value, options) {
5278
5451
  const cwd = options?.cwd;
5279
- if (cwd === void 0 || path3.isAbsolute(value) || value.startsWith("~")) {
5452
+ if (cwd === void 0 || path4.isAbsolute(value) || value.startsWith("~")) {
5280
5453
  return value;
5281
5454
  }
5282
- return path3.resolve(cwd, value);
5455
+ return path4.resolve(cwd, value);
5283
5456
  }
5284
5457
  function extractAcpCommand(event) {
5285
5458
  const parsed = acpRawInputCommandSchema.safeParse(event.rawInput);
@@ -5337,8 +5510,8 @@ function classifyAcpToolCall(event, options) {
5337
5510
  }
5338
5511
  function resolveAcpFileChangeWriteScope(paths) {
5339
5512
  const normalized = paths.filter(isNonBlank).map((entry) => {
5340
- const value = path3.normalize(entry);
5341
- return value.length > 1 && value.endsWith(path3.sep) ? value.slice(0, -1) : value;
5513
+ const value = path4.normalize(entry);
5514
+ return value.length > 1 && value.endsWith(path4.sep) ? value.slice(0, -1) : value;
5342
5515
  });
5343
5516
  const [first, ...rest] = normalized;
5344
5517
  if (first === void 0) {
@@ -5350,7 +5523,7 @@ function resolveAcpFileChangeWriteScope(paths) {
5350
5523
  candidate = entry;
5351
5524
  }
5352
5525
  }
5353
- const prefix = candidate.endsWith(path3.sep) ? candidate : candidate + path3.sep;
5526
+ const prefix = candidate.endsWith(path4.sep) ? candidate : candidate + path4.sep;
5354
5527
  for (const entry of normalized) {
5355
5528
  if (entry !== candidate && !entry.startsWith(prefix)) {
5356
5529
  return null;
@@ -5449,14 +5622,14 @@ function extractAcpToolCallOutputText(event) {
5449
5622
  ).trim();
5450
5623
  return rawOutputText.length > 0 ? rawOutputText : void 0;
5451
5624
  }
5452
- var commandRawOutputSchema = z39.object({
5453
- exitCode: z39.number().int().nullable().optional(),
5454
- exit_code: z39.number().int().nullable().optional(),
5455
- stdout: z39.string().optional(),
5456
- stderr: z39.string().optional(),
5457
- output_for_prompt: z39.string().optional(),
5458
- signal: z39.string().nullable().optional(),
5459
- timed_out: z39.boolean().optional()
5625
+ var commandRawOutputSchema = z40.object({
5626
+ exitCode: z40.number().int().nullable().optional(),
5627
+ exit_code: z40.number().int().nullable().optional(),
5628
+ stdout: z40.string().optional(),
5629
+ stderr: z40.string().optional(),
5630
+ output_for_prompt: z40.string().optional(),
5631
+ signal: z40.string().nullable().optional(),
5632
+ timed_out: z40.boolean().optional()
5460
5633
  }).passthrough();
5461
5634
  function emptyToUndefined(value) {
5462
5635
  return value === void 0 || value.length === 0 ? void 0 : value;
@@ -5525,10 +5698,10 @@ function extractAcpCommandResult(event) {
5525
5698
  ...output === void 0 ? {} : { output: scrubInlineImageDataUrls(output) }
5526
5699
  };
5527
5700
  }
5528
- var optionalNonBlank = z39.string().optional().transform(
5701
+ var optionalNonBlank = z40.string().optional().transform(
5529
5702
  (value) => value !== void 0 && value.trim().length > 0 ? value : void 0
5530
5703
  );
5531
- var searchRawInputSchema = z39.object({
5704
+ var searchRawInputSchema = z40.object({
5532
5705
  pattern: optionalNonBlank,
5533
5706
  query: optionalNonBlank,
5534
5707
  regex: optionalNonBlank,
@@ -5537,8 +5710,8 @@ var searchRawInputSchema = z39.object({
5537
5710
  path: optionalNonBlank,
5538
5711
  directory: optionalNonBlank
5539
5712
  }).passthrough();
5540
- var fetchRawInputSchema = z39.object({ url: optionalNonBlank, uri: optionalNonBlank }).passthrough();
5541
- var thinkRawInputSchema = z39.object({ thought: optionalNonBlank, thinking: optionalNonBlank }).passthrough();
5713
+ var fetchRawInputSchema = z40.object({ url: optionalNonBlank, uri: optionalNonBlank }).passthrough();
5714
+ var thinkRawInputSchema = z40.object({ thought: optionalNonBlank, thinking: optionalNonBlank }).passthrough();
5542
5715
  var SINGLE_TICKED_TOKEN_PATTERN = /^[^`]*`([^`\n]+)`[^`]*$/;
5543
5716
  var URL_PATTERN = /https?:\/\/[^\s`'"<>]+/g;
5544
5717
  function tickedTokenFromTitle(title) {
@@ -5588,8 +5761,8 @@ function buildAcpFileChanges(event, operation, options) {
5588
5761
  if (changes.length > 0) {
5589
5762
  return changes;
5590
5763
  }
5591
- const [path5] = operation.paths;
5592
- return path5 === void 0 ? [] : [{ path: path5, kind: operation.changeKind }];
5764
+ const [path6] = operation.paths;
5765
+ return path6 === void 0 ? [] : [{ path: path6, kind: operation.changeKind }];
5593
5766
  }
5594
5767
  function fileChangeItem(changes, fallbackVerb) {
5595
5768
  return {
@@ -5602,13 +5775,13 @@ function fileChangeItem(changes, fallbackVerb) {
5602
5775
  }
5603
5776
  function fileReadItem(event, title, options) {
5604
5777
  const ticked = tickedTokenFromTitle(title);
5605
- const path5 = extractAcpToolCallPaths(event, options)[0] ?? (ticked !== void 0 && looksLikePath(ticked) ? ticked : void 0);
5606
- if (path5 === void 0) {
5778
+ const path6 = extractAcpToolCallPaths(event, options)[0] ?? (ticked !== void 0 && looksLikePath(ticked) ? ticked : void 0);
5779
+ if (path6 === void 0) {
5607
5780
  return null;
5608
5781
  }
5609
5782
  return {
5610
- item: { type: "fileRead", path: path5 },
5611
- presentation: fileReadPresentation(path5)
5783
+ item: { type: "fileRead", path: path6 },
5784
+ presentation: fileReadPresentation(path6)
5612
5785
  };
5613
5786
  }
5614
5787
  function searchItem(event) {
@@ -5731,10 +5904,10 @@ function classifyAcpToolCall2(event, injected, options) {
5731
5904
 
5732
5905
  // ../provider-bridge-acp/src/dialect.ts
5733
5906
  var GENERIC_ACP_DIALECT = { id: "acp" };
5734
- var grokToolMetaSchema = z40.object({
5735
- "x.ai/tool": z40.object({
5736
- name: z40.string().optional(),
5737
- kind: z40.string().optional()
5907
+ var grokToolMetaSchema = z41.object({
5908
+ "x.ai/tool": z41.object({
5909
+ name: z41.string().optional(),
5910
+ kind: z41.string().optional()
5738
5911
  }).passthrough()
5739
5912
  }).passthrough();
5740
5913
  function grokToolIdentity(event) {
@@ -5750,10 +5923,10 @@ function grokToolIdentity(event) {
5750
5923
  };
5751
5924
  }
5752
5925
  var GROK_SPAWN_SUBAGENT_TOOL = "spawn_subagent";
5753
- var grokSpawnSubagentInputSchema = z40.object({
5754
- description: z40.string().optional(),
5755
- prompt: z40.string().optional(),
5756
- subagent_type: z40.string().optional()
5926
+ var grokSpawnSubagentInputSchema = z41.object({
5927
+ description: z41.string().optional(),
5928
+ prompt: z41.string().optional(),
5929
+ subagent_type: z41.string().optional()
5757
5930
  }).passthrough();
5758
5931
  function grokClassifyToolCall(event) {
5759
5932
  if (grokToolIdentity(event)?.name !== GROK_SPAWN_SUBAGENT_TOOL) {
@@ -5781,27 +5954,27 @@ var GROK_ACP_DIALECT = {
5781
5954
  toolIdentity: grokToolIdentity,
5782
5955
  classifyToolCall: grokClassifyToolCall
5783
5956
  };
5784
- var grokModelMetaSchema = z40.object({
5785
- totalContextTokens: z40.number().int().positive()
5957
+ var grokModelMetaSchema = z41.object({
5958
+ totalContextTokens: z41.number().int().positive()
5786
5959
  }).passthrough();
5787
- var grokPromptMetaSchema = z40.object({
5788
- inputTokens: z40.number().int().nonnegative().optional(),
5789
- totalTokens: z40.number().int().nonnegative().optional(),
5790
- usage: z40.object({
5791
- inputTokens: z40.number().int().nonnegative().optional(),
5792
- totalTokens: z40.number().int().nonnegative().optional()
5960
+ var grokPromptMetaSchema = z41.object({
5961
+ inputTokens: z41.number().int().nonnegative().optional(),
5962
+ totalTokens: z41.number().int().nonnegative().optional(),
5963
+ usage: z41.object({
5964
+ inputTokens: z41.number().int().nonnegative().optional(),
5965
+ totalTokens: z41.number().int().nonnegative().optional()
5793
5966
  }).passthrough().optional()
5794
5967
  }).passthrough();
5795
- var grokPromptResultSchema = z40.object({
5968
+ var grokPromptResultSchema = z41.object({
5796
5969
  _meta: grokPromptMetaSchema.optional()
5797
5970
  }).passthrough();
5798
- var grokSessionModelSchema = z40.object({
5799
- modelId: z40.string(),
5971
+ var grokSessionModelSchema = z41.object({
5972
+ modelId: z41.string(),
5800
5973
  _meta: grokModelMetaSchema.optional()
5801
5974
  }).passthrough();
5802
- var grokSessionModelsSchema = z40.object({
5803
- currentModelId: z40.string().optional(),
5804
- availableModels: z40.array(grokSessionModelSchema).optional()
5975
+ var grokSessionModelsSchema = z41.object({
5976
+ currentModelId: z41.string().optional(),
5977
+ availableModels: z41.array(grokSessionModelSchema).optional()
5805
5978
  }).passthrough();
5806
5979
  function grokContextWindowSizeFromSessionModels(models) {
5807
5980
  const parsed = grokSessionModelsSchema.safeParse(models);
@@ -5831,14 +6004,14 @@ function grokContextUsageFromPromptResult(result) {
5831
6004
  return used === void 0 ? void 0 : { used };
5832
6005
  }
5833
6006
  var CURSOR_TASK_TOOL = "task";
5834
- var cursorTaskRawInputSchema = z40.object({ _toolName: z40.string().optional() }).passthrough();
6007
+ var cursorTaskRawInputSchema = z41.object({ _toolName: z41.string().optional() }).passthrough();
5835
6008
  var CURSOR_TASK_METHOD = "cursor/task";
5836
- var cursorTaskParamsSchema = z40.object({
5837
- toolCallId: z40.string(),
5838
- description: z40.string().optional(),
5839
- prompt: z40.string().optional(),
5840
- agentId: z40.string().optional(),
5841
- model: z40.string().optional()
6009
+ var cursorTaskParamsSchema = z41.object({
6010
+ toolCallId: z41.string(),
6011
+ description: z41.string().optional(),
6012
+ prompt: z41.string().optional(),
6013
+ agentId: z41.string().optional(),
6014
+ model: z41.string().optional()
5842
6015
  }).passthrough();
5843
6016
  function cursorClassifyToolCall(event) {
5844
6017
  const parsed = cursorTaskRawInputSchema.safeParse(event.rawInput);
@@ -5886,23 +6059,23 @@ var CURSOR_ACP_DIALECT = {
5886
6059
  handleClientRequest: cursorHandleClientRequest,
5887
6060
  maintenance: CURSOR_ACP_MAINTENANCE
5888
6061
  };
5889
- var ompBashRawInputSchema = z40.object({
5890
- command: z40.string(),
5891
- async: z40.boolean().optional()
6062
+ var ompBashRawInputSchema = z41.object({
6063
+ command: z41.string(),
6064
+ async: z41.boolean().optional()
5892
6065
  }).passthrough();
5893
6066
  var ompBashRawOutputSchema = commandRawOutputSchema.extend({
5894
- content: z40.array(
5895
- z40.object({
5896
- type: z40.literal("text"),
5897
- text: z40.string()
6067
+ content: z41.array(
6068
+ z41.object({
6069
+ type: z41.literal("text"),
6070
+ text: z41.string()
5898
6071
  }).passthrough()
5899
6072
  ),
5900
- details: z40.object({
5901
- exitCode: z40.number().int().optional(),
5902
- wallTimeMs: z40.number().nonnegative().optional(),
5903
- timedOut: z40.boolean().optional(),
5904
- signal: z40.unknown().optional(),
5905
- async: z40.unknown().optional()
6073
+ details: z41.object({
6074
+ exitCode: z41.number().int().optional(),
6075
+ wallTimeMs: z41.number().nonnegative().optional(),
6076
+ timedOut: z41.boolean().optional(),
6077
+ signal: z41.unknown().optional(),
6078
+ async: z41.unknown().optional()
5906
6079
  }).passthrough()
5907
6080
  });
5908
6081
  function stripOmpTrailingNotice(text, notice) {
@@ -5965,11 +6138,11 @@ var OMP_ACP_DIALECT = {
5965
6138
  id: "omp",
5966
6139
  commandResult: ompCommandResult
5967
6140
  };
5968
- var openCodeCommandRawOutputSchema = z40.object({
5969
- output: z40.unknown().optional(),
5970
- metadata: z40.object({
5971
- exit: z40.number().int().nullable().optional(),
5972
- output: z40.string().optional()
6141
+ var openCodeCommandRawOutputSchema = z41.object({
6142
+ output: z41.unknown().optional(),
6143
+ metadata: z41.object({
6144
+ exit: z41.number().int().nullable().optional(),
6145
+ output: z41.string().optional()
5973
6146
  }).passthrough().optional()
5974
6147
  }).passthrough();
5975
6148
  function normalizeOpenCodeCommandEvent(event) {
@@ -6985,7 +7158,7 @@ function resolveAcpPermissionDecision(args) {
6985
7158
  }
6986
7159
 
6987
7160
  // ../provider-bridge-acp/src/session-params.ts
6988
- import path4 from "node:path";
7161
+ import path5 from "node:path";
6989
7162
 
6990
7163
  // ../provider-bridge-acp/src/bridge/model-catalog.ts
6991
7164
  var ACP_NATIVE_REASONING_EFFORTS = [
@@ -7444,7 +7617,7 @@ function buildAcpSkillsInstructions(skillRoots) {
7444
7617
  }
7445
7618
  const skillLines = skillRoots.flatMap((skillRoot) => {
7446
7619
  return skillRoot.skills.map((skill) => {
7447
- const skillFilePath = path4.join(
7620
+ const skillFilePath = path5.join(
7448
7621
  skillRoot.skillDirectoryRootPath,
7449
7622
  skill.name,
7450
7623
  "SKILL.md"
@@ -7887,7 +8060,7 @@ import { basename as basename2, dirname, join as join2, resolve as resolve2 } fr
7887
8060
  // ../provider-bridge-acp/src/bridge/tool-proxy-mcp.ts
7888
8061
  import { createConnection } from "node:net";
7889
8062
  import { createInterface as createInterface2 } from "node:readline";
7890
- import { z as z41 } from "zod";
8063
+ import { z as z42 } from "zod";
7891
8064
  var ACP_BRIDGE_MCP_SERVER_NAME = "bb-bridge";
7892
8065
  var ENV_HOST = "BB_ACP_DYNAMIC_TOOL_HOST";
7893
8066
  var ENV_PORT = "BB_ACP_DYNAMIC_TOOL_PORT";
@@ -7895,45 +8068,45 @@ var ENV_TOKEN = "BB_ACP_DYNAMIC_TOOL_TOKEN";
7895
8068
  var ENV_THREAD_ID = "BB_ACP_DYNAMIC_TOOL_THREAD_ID";
7896
8069
  var ENV_TOOLS = "BB_ACP_DYNAMIC_TOOLS";
7897
8070
  var ENV_PROGRESS_INTERVAL_MS = "BB_ACP_DYNAMIC_TOOL_PROGRESS_INTERVAL_MS";
7898
- var dynamicToolBridgeRequestSchema = z41.discriminatedUnion("kind", [
7899
- z41.object({
7900
- kind: z41.literal("initialized"),
7901
- threadId: z41.string().min(1),
7902
- token: z41.string().min(1),
7903
- toolCount: z41.number().int().nonnegative()
8071
+ var dynamicToolBridgeRequestSchema = z42.discriminatedUnion("kind", [
8072
+ z42.object({
8073
+ kind: z42.literal("initialized"),
8074
+ threadId: z42.string().min(1),
8075
+ token: z42.string().min(1),
8076
+ toolCount: z42.number().int().nonnegative()
7904
8077
  }),
7905
- z41.object({
7906
- kind: z41.literal("toolCall"),
7907
- arguments: z41.record(z41.string(), z41.unknown()).default({}),
7908
- callId: z41.string().min(1),
7909
- threadId: z41.string().min(1),
7910
- token: z41.string().min(1),
7911
- tool: z41.string().min(1)
8078
+ z42.object({
8079
+ kind: z42.literal("toolCall"),
8080
+ arguments: z42.record(z42.string(), z42.unknown()).default({}),
8081
+ callId: z42.string().min(1),
8082
+ threadId: z42.string().min(1),
8083
+ token: z42.string().min(1),
8084
+ tool: z42.string().min(1)
7912
8085
  })
7913
8086
  ]);
7914
- var bridgeToolCallResponseSchema = z41.union([
7915
- z41.object({
7916
- ok: z41.literal(true),
7917
- content: z41.string(),
7918
- contentBlocks: z41.array(
7919
- z41.discriminatedUnion("type", [
7920
- z41.object({ type: z41.literal("text"), text: z41.string() }),
7921
- z41.object({
7922
- type: z41.literal("image"),
7923
- data: z41.string(),
7924
- mimeType: z41.string()
8087
+ var bridgeToolCallResponseSchema = z42.union([
8088
+ z42.object({
8089
+ ok: z42.literal(true),
8090
+ content: z42.string(),
8091
+ contentBlocks: z42.array(
8092
+ z42.discriminatedUnion("type", [
8093
+ z42.object({ type: z42.literal("text"), text: z42.string() }),
8094
+ z42.object({
8095
+ type: z42.literal("image"),
8096
+ data: z42.string(),
8097
+ mimeType: z42.string()
7925
8098
  })
7926
8099
  ])
7927
8100
  ).optional(),
7928
- images: z41.array(z41.object({ data: z41.string(), mimeType: z41.string() })).default([]),
7929
- isError: z41.boolean().optional()
8101
+ images: z42.array(z42.object({ data: z42.string(), mimeType: z42.string() })).default([]),
8102
+ isError: z42.boolean().optional()
7930
8103
  }),
7931
- z41.object({ ok: z41.literal(false), error: z41.string() })
8104
+ z42.object({ ok: z42.literal(false), error: z42.string() })
7932
8105
  ]);
7933
- var jsonRpcMessageSchema = z41.object({
7934
- id: z41.union([z41.string(), z41.number().int()]).optional(),
7935
- method: z41.string().optional(),
7936
- params: z41.unknown().optional()
8106
+ var jsonRpcMessageSchema = z42.object({
8107
+ id: z42.union([z42.string(), z42.number().int()]).optional(),
8108
+ method: z42.string().optional(),
8109
+ params: z42.unknown().optional()
7937
8110
  });
7938
8111
  var nextMcpToolCallId = 0;
7939
8112
  var TOOL_CALL_PROGRESS_INTERVAL_MS = 15e3;
@@ -8233,10 +8406,10 @@ async function resolveCursorProjectRoot(args) {
8233
8406
  );
8234
8407
  });
8235
8408
  }
8236
- async function readApprovals(path5) {
8409
+ async function readApprovals(path6) {
8237
8410
  let text;
8238
8411
  try {
8239
- text = await readFile(path5, "utf8");
8412
+ text = await readFile(path6, "utf8");
8240
8413
  } catch (error) {
8241
8414
  if (errorCode(error) === "ENOENT") {
8242
8415
  return [];
@@ -8245,29 +8418,29 @@ async function readApprovals(path5) {
8245
8418
  }
8246
8419
  const value = JSON.parse(text);
8247
8420
  if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) {
8248
- throw new Error(`Cursor MCP approval file is not a string array: ${path5}`);
8421
+ throw new Error(`Cursor MCP approval file is not a string array: ${path6}`);
8249
8422
  }
8250
8423
  return value;
8251
8424
  }
8252
- async function writeApprovals(path5, approvals) {
8253
- await mkdir(dirname(path5), { recursive: true });
8254
- const tempPath = `${path5}.bb-${process.pid}-${randomBytes(6).toString("hex")}.tmp`;
8425
+ async function writeApprovals(path6, approvals) {
8426
+ await mkdir(dirname(path6), { recursive: true });
8427
+ const tempPath = `${path6}.bb-${process.pid}-${randomBytes(6).toString("hex")}.tmp`;
8255
8428
  try {
8256
8429
  await writeFile(tempPath, `${JSON.stringify(approvals, null, 2)}
8257
8430
  `, {
8258
8431
  encoding: "utf8",
8259
8432
  mode: 384
8260
8433
  });
8261
- await rename(tempPath, path5);
8434
+ await rename(tempPath, path6);
8262
8435
  } catch (error) {
8263
8436
  await rm(tempPath, { force: true });
8264
8437
  throw error;
8265
8438
  }
8266
8439
  }
8267
- async function acquireApprovalLock(path5) {
8268
- const lockPath = `${path5}.bb-lock`;
8440
+ async function acquireApprovalLock(path6) {
8441
+ const lockPath = `${path6}.bb-lock`;
8269
8442
  const deadline = Date.now() + CURSOR_APPROVAL_LOCK_TIMEOUT_MS;
8270
- await mkdir(dirname(path5), { recursive: true });
8443
+ await mkdir(dirname(path6), { recursive: true });
8271
8444
  for (; ; ) {
8272
8445
  try {
8273
8446
  await mkdir(lockPath, { mode: 448 });
@@ -8290,18 +8463,18 @@ async function acquireApprovalLock(path5) {
8290
8463
  throw error;
8291
8464
  }
8292
8465
  if (Date.now() >= deadline) {
8293
- throw new Error(`Timed out updating Cursor MCP approvals: ${path5}`);
8466
+ throw new Error(`Timed out updating Cursor MCP approvals: ${path6}`);
8294
8467
  }
8295
8468
  await new Promise((resolveDelay) => setTimeout(resolveDelay, 25));
8296
8469
  }
8297
8470
  }
8298
- async function mutateApprovals(path5, mutate) {
8299
- const releaseLock = await acquireApprovalLock(path5);
8471
+ async function mutateApprovals(path6, mutate) {
8472
+ const releaseLock = await acquireApprovalLock(path6);
8300
8473
  try {
8301
- const approvals = await readApprovals(path5);
8474
+ const approvals = await readApprovals(path6);
8302
8475
  const nextApprovals = mutate(approvals);
8303
8476
  if (approvals.length !== nextApprovals.length || approvals.some((approval, index) => approval !== nextApprovals[index])) {
8304
- await writeApprovals(path5, nextApprovals);
8477
+ await writeApprovals(path6, nextApprovals);
8305
8478
  }
8306
8479
  } finally {
8307
8480
  await releaseLock();
@@ -8315,7 +8488,7 @@ async function approveCursorSessionMcpServer(args) {
8315
8488
  cwd: args.cwd,
8316
8489
  env: args.env
8317
8490
  });
8318
- const path5 = join2(
8491
+ const path6 = join2(
8319
8492
  cursorDataDirectory(args.env),
8320
8493
  "projects",
8321
8494
  cursorProjectSlug(projectRoot),
@@ -8326,14 +8499,14 @@ async function approveCursorSessionMcpServer(args) {
8326
8499
  projectRoot
8327
8500
  });
8328
8501
  let installedByBb = false;
8329
- await mutateApprovals(path5, (approvals) => {
8502
+ await mutateApprovals(path6, (approvals) => {
8330
8503
  if (approvals.includes(approval)) {
8331
8504
  return approvals;
8332
8505
  }
8333
8506
  installedByBb = true;
8334
8507
  return [...approvals, approval];
8335
8508
  });
8336
- return { approval, installedByBb, path: path5 };
8509
+ return { approval, installedByBb, path: path6 };
8337
8510
  }
8338
8511
  async function revokeCursorSessionMcpServer(approval) {
8339
8512
  if (!approval.installedByBb) {
@@ -8730,7 +8903,7 @@ async function authenticateAcpAgent(args) {
8730
8903
  await args.connection.request({
8731
8904
  method: "authenticate",
8732
8905
  params: { methodId, _meta: { headless: true } },
8733
- resultSchema: z42.unknown()
8906
+ resultSchema: z43.unknown()
8734
8907
  });
8735
8908
  } catch (error) {
8736
8909
  throw new AcpAuthRequiredError(
@@ -9060,7 +9233,7 @@ async function selectAcpNativeModel(args) {
9060
9233
  configId: modelOption.id,
9061
9234
  value: selection.modelId
9062
9235
  },
9063
- resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
9236
+ resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
9064
9237
  });
9065
9238
  setModel = false;
9066
9239
  } catch {
@@ -9071,7 +9244,7 @@ async function selectAcpNativeModel(args) {
9071
9244
  configState = await args.connection.request({
9072
9245
  method: "session/set_model",
9073
9246
  params: { sessionId: args.sessionId, modelId: selection.modelId },
9074
- resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
9247
+ resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
9075
9248
  });
9076
9249
  }
9077
9250
  configOptions = configState?.configOptions ?? configOptions;
@@ -9326,7 +9499,7 @@ async function handleFsReadTextFile(params, responder) {
9326
9499
  return;
9327
9500
  }
9328
9501
  try {
9329
- const content = await fs2.readFile(parsed.data.path, "utf8");
9502
+ const content = await fs3.readFile(parsed.data.path, "utf8");
9330
9503
  responder.result({
9331
9504
  content: sliceFileContent(content, parsed.data.line, parsed.data.limit)
9332
9505
  });
@@ -9353,12 +9526,12 @@ async function handleFsWriteTextFile(session, params, responder) {
9353
9526
  try {
9354
9527
  let oldText;
9355
9528
  try {
9356
- oldText = await fs2.readFile(parsed.data.path, "utf8");
9529
+ oldText = await fs3.readFile(parsed.data.path, "utf8");
9357
9530
  } catch {
9358
9531
  oldText = void 0;
9359
9532
  }
9360
- await fs2.mkdir(dirname2(parsed.data.path), { recursive: true });
9361
- await fs2.writeFile(parsed.data.path, parsed.data.content, "utf8");
9533
+ await fs3.mkdir(dirname2(parsed.data.path), { recursive: true });
9534
+ await fs3.writeFile(parsed.data.path, parsed.data.content, "utf8");
9362
9535
  emitForSession(session, ACP_FS_WRITE_METHOD, {
9363
9536
  threadId: session.bbThreadId,
9364
9537
  path: parsed.data.path,
@@ -9571,7 +9744,7 @@ async function startAgentSession(request) {
9571
9744
  cwd: params.cwd,
9572
9745
  mcpServers
9573
9746
  },
9574
- resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
9747
+ resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
9575
9748
  });
9576
9749
  loadedConfigOptions = configState?.configOptions;
9577
9750
  loadedModels = configState?.models;
@@ -10031,12 +10204,12 @@ function decodeLaunchSpec(providerOptions) {
10031
10204
  );
10032
10205
  return launchSpec.success ? launchSpec.data : null;
10033
10206
  }
10034
- var acpProviderOptionsSchema = z42.object({
10035
- additionalWorkspaceWriteRoots: z42.array(z42.string()).optional(),
10036
- acpDialect: z42.string().min(1).optional(),
10037
- parameterizedModelPicker: z42.boolean().optional(),
10038
- primaryModels: z42.array(z42.string().min(1)).optional(),
10039
- reasoningProbePriorityModelIds: z42.array(z42.string().min(1)).optional()
10207
+ var acpProviderOptionsSchema = z43.object({
10208
+ additionalWorkspaceWriteRoots: z43.array(z43.string()).optional(),
10209
+ acpDialect: z43.string().min(1).optional(),
10210
+ parameterizedModelPicker: z43.boolean().optional(),
10211
+ primaryModels: z43.array(z43.string().min(1)).optional(),
10212
+ reasoningProbePriorityModelIds: z43.array(z43.string().min(1)).optional()
10040
10213
  }).passthrough();
10041
10214
  function decodeAcpModelPickerOptions(providerOptions) {
10042
10215
  const parsed = acpProviderOptionsSchema.parse(providerOptions ?? {});
@@ -10054,18 +10227,17 @@ function decodeAdditionalWorkspaceWriteRoots(providerOptions) {
10054
10227
  function decodeDialectId(providerOptions) {
10055
10228
  return acpProviderOptionsSchema.parse(providerOptions ?? {}).acpDialect;
10056
10229
  }
10057
- function maintenanceForRequest(providerOptions, launchSpec) {
10058
- const dialectId = decodeDialectId(providerOptions);
10059
- return resolveAcpDialect({
10060
- ...dialectId === void 0 ? {} : { dialectId },
10061
- command: launchSpec?.command ?? ""
10062
- }).maintenance;
10063
- }
10064
10230
  function maintenanceTarget(providerOptions) {
10065
10231
  const launchSpec = decodeLaunchSpec(providerOptions);
10232
+ const dialect = resolveAcpDialect({
10233
+ dialectId: decodeDialectId(providerOptions),
10234
+ command: launchSpec?.command ?? ""
10235
+ });
10066
10236
  return {
10067
- maintenance: maintenanceForRequest(providerOptions, launchSpec),
10068
- command: launchSpec?.command ?? null
10237
+ maintenance: dialect.maintenance,
10238
+ command: launchSpec?.command ?? null,
10239
+ dialectId: dialect.id,
10240
+ env: { ...process.env, ...launchSpec?.env }
10069
10241
  };
10070
10242
  }
10071
10243
  async function handleRequest2(request) {
@@ -10353,7 +10525,7 @@ var experimental_providerBridge = experimental_defineProviderBridge({
10353
10525
  });
10354
10526
 
10355
10527
  // ../provider-bridge-acp/src/probe.ts
10356
- import { z as z43 } from "zod";
10528
+ import { z as z44 } from "zod";
10357
10529
  var PROBE_TIMEOUT_MS = 1e4;
10358
10530
  function describe(error) {
10359
10531
  if (error instanceof AcpAgentExitedError) {
@@ -10411,9 +10583,9 @@ async function probeAcpAgent(request) {
10411
10583
  connected.kill();
10412
10584
  }
10413
10585
  }
10414
- var acpAgentProbeSchema = z43.union([
10415
- z43.object({ reachable: z43.literal(true), fork: z43.boolean() }),
10416
- z43.object({ reachable: z43.literal(false), reason: z43.string() })
10586
+ var acpAgentProbeSchema = z44.union([
10587
+ z44.object({ reachable: z44.literal(true), fork: z44.boolean() }),
10588
+ z44.object({ reachable: z44.literal(false), reason: z44.string() })
10417
10589
  ]);
10418
10590
  export {
10419
10591
  acpAgentProbeSchema as experimental_acpAgentProbeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"