@get-bb/plugin-sdk 0.6.169 → 0.6.179

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -340,6 +340,9 @@ var experimental_useTabVisible = runtimeFunction(
340
340
  var experimental_useServers = runtimeFunction(
341
341
  "experimental_useServers"
342
342
  );
343
+ var experimental_hasServers = runtimeFunction(
344
+ "experimental_hasServers"
345
+ );
343
346
  var experimental_useAppPanel = runtimeFunction(
344
347
  "experimental_useAppPanel"
345
348
  );
@@ -348,6 +351,9 @@ var experimental_useFixedTabTarget = runtimeFunction(
348
351
  );
349
352
  var useComposer = runtimeFunction("useComposer");
350
353
  var useComposers = runtimeFunction("useComposers");
354
+ var experimental_useActiveComposer = runtimeFunction(
355
+ "experimental_useActiveComposer"
356
+ );
351
357
  var experimental_useComposerRenderer = runtimeFunction(
352
358
  "experimental_useComposerRenderer"
353
359
  );
@@ -415,6 +421,9 @@ var experimental_useSidebarThreadActions = runtimeFunction(
415
421
  var experimental_useThreadActions = runtimeFunction(
416
422
  "experimental_useThreadActions"
417
423
  );
424
+ var experimental_useThreadRequests = runtimeFunction(
425
+ "experimental_useThreadRequests"
426
+ );
418
427
  var experimental_useArchiveEnvironmentThreads = runtimeFunction(
419
428
  "experimental_useArchiveEnvironmentThreads"
420
429
  );
@@ -538,6 +547,7 @@ export {
538
547
  experimental_copyToClipboard,
539
548
  experimental_describePromptMention,
540
549
  experimental_getApplicationLinkApprovals,
550
+ experimental_hasServers,
541
551
  experimental_matchesShortcutKey,
542
552
  experimental_promptMentionClipboardAttributes,
543
553
  experimental_readPromptMentionClipboard,
@@ -545,6 +555,7 @@ export {
545
555
  experimental_revokeApplicationLinkApproval,
546
556
  experimental_saveFile,
547
557
  experimental_sliceUtf16Head,
558
+ experimental_useActiveComposer,
548
559
  experimental_useAppPanel,
549
560
  experimental_useArchiveEnvironmentThreads,
550
561
  experimental_useBranches,
@@ -576,6 +587,7 @@ export {
576
587
  experimental_useThreadActions,
577
588
  experimental_useThreadContextKind,
578
589
  experimental_useThreadExtensionState,
590
+ experimental_useThreadRequests,
579
591
  experimental_useThreadTitleDisplayText,
580
592
  useBbContext,
581
593
  useBbNavigate,
package/dist/index.js CHANGED
@@ -919,6 +919,25 @@ var experimental_THREAD_INFO_SECTION_GROUPS = {
919
919
  storage: "3_storage"
920
920
  };
921
921
 
922
+ // ../sdk/src/http-error.ts
923
+ var httpErrorBrand = /* @__PURE__ */ Symbol.for("@bb/sdk/http-error");
924
+ var BbHttpError = class extends Error {
925
+ static [Symbol.hasInstance](value) {
926
+ return typeof value === "object" && value !== null && Reflect.get(value, httpErrorBrand) === true;
927
+ }
928
+ body;
929
+ code;
930
+ status;
931
+ constructor(args) {
932
+ super(`HTTP ${args.status}: ${args.message}`);
933
+ Object.defineProperty(this, httpErrorBrand, { value: true });
934
+ this.name = "BbHttpError";
935
+ this.body = args.body;
936
+ this.code = args.code;
937
+ this.status = args.status;
938
+ }
939
+ };
940
+
922
941
  // ../text-utils/src/utf16.ts
923
942
  function isHighSurrogateAt(value, index) {
924
943
  const code = value.charCodeAt(index);
@@ -1093,6 +1112,7 @@ export {
1093
1112
  cliCommand,
1094
1113
  defineCli,
1095
1114
  defineRpcContract,
1115
+ BbHttpError as experimental_BbHttpError,
1096
1116
  experimental_PluginRpcCallError,
1097
1117
  experimental_PluginRpcRefusal,
1098
1118
  experimental_THREAD_ACTION_GROUPS,
@@ -1819,11 +1819,22 @@ function enforcePluginCliOutputLimit(result, jsonOutput) {
1819
1819
  };
1820
1820
  return jsonOutput ? {
1821
1821
  exitCode: 1,
1822
- stdout: JSON.stringify({ error }),
1822
+ stdout: JSON.stringify({ ok: false, error }),
1823
1823
  stderr: "",
1824
1824
  error
1825
1825
  } : { exitCode: 1, stdout: "", stderr: error.message, error };
1826
1826
  }
1827
+ function pluginCliFailureResult(failure, jsonOutput) {
1828
+ return enforcePluginCliOutputLimit(
1829
+ {
1830
+ exitCode: 1,
1831
+ stdout: jsonOutput ? `${JSON.stringify({ ok: false, error: failure }, null, 2)}
1832
+ ` : "",
1833
+ stderr: failure.message
1834
+ },
1835
+ jsonOutput
1836
+ );
1837
+ }
1827
1838
  function adoptHttpRouteResponse(value) {
1828
1839
  if (value instanceof Response) return value;
1829
1840
  if (!isResponseLike(value)) {
@@ -2027,19 +2038,22 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
2027
2038
  declaration.availability,
2028
2039
  "availability"
2029
2040
  );
2041
+ const existingPath = declaration.apiVersion === 2 ? void 0 : declaration.experimental_existingPath;
2042
+ const locate = declaration.locate;
2030
2043
  assertOptionalFunction(
2031
2044
  "environment provider",
2032
2045
  id,
2033
- declaration.experimental_existingPath,
2046
+ existingPath,
2034
2047
  "experimental_existingPath"
2035
2048
  );
2049
+ assertOptionalFunction("environment provider", id, locate, "a locate");
2036
2050
  assertOptionalFunction(
2037
2051
  "environment provider",
2038
2052
  id,
2039
2053
  declaration.restore,
2040
2054
  "a restore"
2041
2055
  );
2042
- return {
2056
+ const common = {
2043
2057
  id,
2044
2058
  displayName,
2045
2059
  description,
@@ -2048,11 +2062,33 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
2048
2062
  inputs: inputs === null ? null : inputs.schema,
2049
2063
  inputsJsonSchema: inputs === null ? null : inputs.jsonSchema,
2050
2064
  availability: declaration.availability ?? null,
2065
+ locate: locate ?? (existingPath === void 0 ? null : ({ inputs: inputs2 }) => {
2066
+ const path = existingPath(inputs2);
2067
+ return path === null ? null : { path, reuse: true };
2068
+ }),
2069
+ remove: declaration.remove
2070
+ };
2071
+ if (declaration.apiVersion === 2) {
2072
+ return {
2073
+ ...common,
2074
+ apiVersion: 2,
2075
+ validate: declaration.validate ?? null,
2076
+ create: declaration.create,
2077
+ restore: declaration.restore ?? null,
2078
+ policy: environmentProviderV2PolicySchema.parse(declaration.policy ?? {})
2079
+ };
2080
+ }
2081
+ if (declaration.apiVersion !== void 0 && declaration.apiVersion !== 1) {
2082
+ throw new Error(
2083
+ `environment provider "${id}" declares apiVersion ${JSON.stringify(declaration.apiVersion)}; this bb supports 1 and 2`
2084
+ );
2085
+ }
2086
+ return {
2087
+ ...common,
2088
+ apiVersion: 1,
2051
2089
  validate: declaration.validate ?? null,
2052
- experimental_existingPath: declaration.experimental_existingPath ?? null,
2053
2090
  create: declaration.create,
2054
2091
  restore: declaration.restore ?? null,
2055
- remove: declaration.remove,
2056
2092
  policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
2057
2093
  };
2058
2094
  }
@@ -2087,6 +2123,10 @@ var environmentProviderPolicySchema = z5.object({
2087
2123
  retireGraceMs: z5.number().int().nonnegative().nullable().default(3e5),
2088
2124
  pathKeys: z5.enum(["per-thread", "per-attempt"]).default("per-thread")
2089
2125
  }).strict();
2126
+ var environmentProviderV2PolicySchema = z5.object({
2127
+ retireGraceMs: z5.number().int().nonnegative().nullable().default(3e5),
2128
+ pathKeys: z5.enum(["per-environment", "per-attempt"]).default("per-environment")
2129
+ }).strict();
2090
2130
  var MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS = 200;
2091
2131
  function validatePluginMachineProviderDeclaration(declaration) {
2092
2132
  const { id, displayName } = requireProviderIdAndDisplayName(
@@ -2892,6 +2932,7 @@ export {
2892
2932
  normalizeWebSocketRouteRegistration,
2893
2933
  parsePluginRowPresentation,
2894
2934
  pluginCliCollisionWarning,
2935
+ pluginCliFailureResult,
2895
2936
  pluginHookAlreadyRegisteredMessage,
2896
2937
  providerAlreadyRegisteredMessage,
2897
2938
  providerDeclarationIconRefusal,
@@ -1531,6 +1531,15 @@ var projectExecutionDefaultsSchema = z2.object({
1531
1531
  // ../domain/src/plugin-id.ts
1532
1532
  import { z as z3 } from "zod";
1533
1533
  var pluginIdSchema = z3.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1534
+ var CORE_PLUGIN_DIRECTORIES = {
1535
+ npmPackages: "npm",
1536
+ cache: "cache",
1537
+ runtime: "runtime",
1538
+ stateSnapshots: "snapshots"
1539
+ };
1540
+ var coreOwnedPluginDirectoryNames = new Set(
1541
+ Object.values(CORE_PLUGIN_DIRECTORIES)
1542
+ );
1534
1543
 
1535
1544
  // ../domain/src/change-kinds.ts
1536
1545
  import { z as z17 } from "zod";
@@ -1610,6 +1619,7 @@ var threadCreateOriginSchema = z5.enum(threadCreateOriginValues);
1610
1619
 
1611
1620
  // ../domain/src/environment.ts
1612
1621
  import { z as z6 } from "zod";
1622
+ var environmentHolderSchema = z6.literal("user");
1613
1623
  var environmentMachineSelectionSchema = z6.discriminatedUnion("type", [
1614
1624
  z6.object({ type: z6.literal("existing"), hostId: z6.string().min(1) }),
1615
1625
  z6.object({
@@ -1683,12 +1693,14 @@ var environmentSchema = z6.object({
1683
1693
  defaultBranch: z6.string().nullable(),
1684
1694
  mergeBaseBranch: z6.string().nullable(),
1685
1695
  status: environmentStatusSchema,
1696
+ statusMessage: z6.string().nullable(),
1686
1697
  environmentProviderId: z6.string().nullable(),
1687
1698
  lifecycle: environmentLifecycleSchema,
1688
1699
  hostLifecycle: environmentHostLifecycleSchema,
1689
1700
  environmentProviderSelection: environmentProviderSelectionSchema.nullable(),
1690
1701
  environmentProviderInstanceKey: z6.string().nullable(),
1691
1702
  managed: z6.boolean(),
1703
+ heldBy: environmentHolderSchema.nullable(),
1692
1704
  workspaceProvisionType: workspaceProvisionTypeSchema.nullable(),
1693
1705
  createdAt: z6.number(),
1694
1706
  updatedAt: z6.number()
@@ -1232,6 +1232,15 @@ var completedTurnDisplaySchema = z6.enum(COMPLETED_TURN_DISPLAY_VALUES);
1232
1232
  // ../domain/src/plugin-id.ts
1233
1233
  import { z as z7 } from "zod";
1234
1234
  var pluginIdSchema = z7.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1235
+ var CORE_PLUGIN_DIRECTORIES = {
1236
+ npmPackages: "npm",
1237
+ cache: "cache",
1238
+ runtime: "runtime",
1239
+ stateSnapshots: "snapshots"
1240
+ };
1241
+ var coreOwnedPluginDirectoryNames = new Set(
1242
+ Object.values(CORE_PLUGIN_DIRECTORIES)
1243
+ );
1235
1244
 
1236
1245
  // ../domain/src/background-task.ts
1237
1246
  import { z as z8 } from "zod";
@@ -14443,7 +14452,8 @@ function presentProviderPrefixedModel(model) {
14443
14452
  var OMP_ACP_DIALECT = {
14444
14453
  id: "omp",
14445
14454
  commandResult: ompCommandResult,
14446
- presentModel: presentProviderPrefixedModel
14455
+ presentModel: presentProviderPrefixedModel,
14456
+ elicitationDescriptionIsHeading: true
14447
14457
  };
14448
14458
  var openCodeCommandRawOutputSchema = z45.object({
14449
14459
  output: z45.unknown().optional(),
@@ -16033,9 +16043,11 @@ function readChoices(schema) {
16033
16043
  if (!isJsonObject(entry) || typeof entry["const"] !== "string") {
16034
16044
  return null;
16035
16045
  }
16046
+ const description = readString(entry, "description")?.trim();
16036
16047
  choices2.push({
16037
16048
  value: entry["const"],
16038
- label: readString(entry, "title") ?? entry["const"]
16049
+ label: readString(entry, "title") ?? entry["const"],
16050
+ ...description ? { description } : {}
16039
16051
  });
16040
16052
  }
16041
16053
  return choices2.length > 0 ? choices2 : null;
@@ -16118,20 +16130,23 @@ function shownField(field, other) {
16118
16130
  }
16119
16131
  return field.kind === "choice" ? { kind: "typedChoice", choices } : null;
16120
16132
  }
16121
- function questionFor(name, schema, field, required, other, message) {
16133
+ function questionFor(name, schema, field, required, other, message, presentation) {
16122
16134
  const label = readString(schema, "title")?.trim() || name;
16123
- const description = readString(schema, "description")?.trim();
16135
+ const description = readString(schema, "description")?.trim() || void 0;
16136
+ const heading = presentation.descriptionIsHeading ? description : void 0;
16137
+ const detail = presentation.descriptionIsHeading ? void 0 : description;
16138
+ const lead = message !== void 0 && message !== label ? message : void 0;
16124
16139
  const lines = [
16125
- ...message ? [message, ""] : [],
16140
+ ...lead ? [lead, ""] : [],
16126
16141
  label,
16127
- ...description ? [description] : [],
16142
+ ...detail ? [detail] : [],
16128
16143
  ...field.kind === "typedChoice" ? [`One of: ${field.choices.map((choice) => choice.label).join(", ")}`] : [],
16129
16144
  ...field.kind === "number" ? [field.integer ? "Enter a whole number." : "Enter a number."] : []
16130
16145
  ];
16131
16146
  const base = {
16132
16147
  id: name,
16133
16148
  prompt: lines.join("\n"),
16134
- shortLabel: label,
16149
+ shortLabel: heading ?? label,
16135
16150
  required
16136
16151
  };
16137
16152
  switch (field.kind) {
@@ -16270,7 +16285,7 @@ function planConfirmation(message) {
16270
16285
  }
16271
16286
  };
16272
16287
  }
16273
- function planAcpElicitation(params) {
16288
+ function planAcpElicitation(params, presentation) {
16274
16289
  if (!isJsonObject(params)) {
16275
16290
  return { kind: "unsupported", reason: "the request was malformed" };
16276
16291
  }
@@ -16346,7 +16361,8 @@ function planAcpElicitation(params) {
16346
16361
  field,
16347
16362
  entry.required,
16348
16363
  other,
16349
- planned.length === 0 ? message : void 0
16364
+ planned.length === 0 ? message : void 0,
16365
+ presentation
16350
16366
  )
16351
16367
  });
16352
16368
  }
@@ -23516,7 +23532,9 @@ function handleElicitationRequest(session, params, responder) {
23516
23532
  answerWithoutUser(session, responder, COMPACTION_QUESTION_CAUSE);
23517
23533
  return;
23518
23534
  }
23519
- const plan = planAcpElicitation(params);
23535
+ const plan = planAcpElicitation(params, {
23536
+ descriptionIsHeading: session.dialect.elicitationDescriptionIsHeading === true
23537
+ });
23520
23538
  if (plan.kind === "unsupported") {
23521
23539
  answerWithoutUser(session, responder, {
23522
23540
  kind: "unshowable-request",
@@ -1232,6 +1232,15 @@ var completedTurnDisplaySchema = z6.enum(COMPLETED_TURN_DISPLAY_VALUES);
1232
1232
  // ../domain/src/plugin-id.ts
1233
1233
  import { z as z7 } from "zod";
1234
1234
  var pluginIdSchema = z7.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1235
+ var CORE_PLUGIN_DIRECTORIES = {
1236
+ npmPackages: "npm",
1237
+ cache: "cache",
1238
+ runtime: "runtime",
1239
+ stateSnapshots: "snapshots"
1240
+ };
1241
+ var coreOwnedPluginDirectoryNames = new Set(
1242
+ Object.values(CORE_PLUGIN_DIRECTORIES)
1243
+ );
1235
1244
 
1236
1245
  // ../domain/src/background-task.ts
1237
1246
  import { z as z8 } from "zod";
@@ -14443,7 +14452,8 @@ function presentProviderPrefixedModel(model) {
14443
14452
  var OMP_ACP_DIALECT = {
14444
14453
  id: "omp",
14445
14454
  commandResult: ompCommandResult,
14446
- presentModel: presentProviderPrefixedModel
14455
+ presentModel: presentProviderPrefixedModel,
14456
+ elicitationDescriptionIsHeading: true
14447
14457
  };
14448
14458
  var openCodeCommandRawOutputSchema = z45.object({
14449
14459
  output: z45.unknown().optional(),
@@ -16033,9 +16043,11 @@ function readChoices(schema) {
16033
16043
  if (!isJsonObject(entry) || typeof entry["const"] !== "string") {
16034
16044
  return null;
16035
16045
  }
16046
+ const description = readString(entry, "description")?.trim();
16036
16047
  choices2.push({
16037
16048
  value: entry["const"],
16038
- label: readString(entry, "title") ?? entry["const"]
16049
+ label: readString(entry, "title") ?? entry["const"],
16050
+ ...description ? { description } : {}
16039
16051
  });
16040
16052
  }
16041
16053
  return choices2.length > 0 ? choices2 : null;
@@ -16118,20 +16130,23 @@ function shownField(field, other) {
16118
16130
  }
16119
16131
  return field.kind === "choice" ? { kind: "typedChoice", choices } : null;
16120
16132
  }
16121
- function questionFor(name, schema, field, required, other, message) {
16133
+ function questionFor(name, schema, field, required, other, message, presentation) {
16122
16134
  const label = readString(schema, "title")?.trim() || name;
16123
- const description = readString(schema, "description")?.trim();
16135
+ const description = readString(schema, "description")?.trim() || void 0;
16136
+ const heading = presentation.descriptionIsHeading ? description : void 0;
16137
+ const detail = presentation.descriptionIsHeading ? void 0 : description;
16138
+ const lead = message !== void 0 && message !== label ? message : void 0;
16124
16139
  const lines = [
16125
- ...message ? [message, ""] : [],
16140
+ ...lead ? [lead, ""] : [],
16126
16141
  label,
16127
- ...description ? [description] : [],
16142
+ ...detail ? [detail] : [],
16128
16143
  ...field.kind === "typedChoice" ? [`One of: ${field.choices.map((choice) => choice.label).join(", ")}`] : [],
16129
16144
  ...field.kind === "number" ? [field.integer ? "Enter a whole number." : "Enter a number."] : []
16130
16145
  ];
16131
16146
  const base = {
16132
16147
  id: name,
16133
16148
  prompt: lines.join("\n"),
16134
- shortLabel: label,
16149
+ shortLabel: heading ?? label,
16135
16150
  required
16136
16151
  };
16137
16152
  switch (field.kind) {
@@ -16270,7 +16285,7 @@ function planConfirmation(message) {
16270
16285
  }
16271
16286
  };
16272
16287
  }
16273
- function planAcpElicitation(params) {
16288
+ function planAcpElicitation(params, presentation) {
16274
16289
  if (!isJsonObject(params)) {
16275
16290
  return { kind: "unsupported", reason: "the request was malformed" };
16276
16291
  }
@@ -16346,7 +16361,8 @@ function planAcpElicitation(params) {
16346
16361
  field,
16347
16362
  entry.required,
16348
16363
  other,
16349
- planned.length === 0 ? message : void 0
16364
+ planned.length === 0 ? message : void 0,
16365
+ presentation
16350
16366
  )
16351
16367
  });
16352
16368
  }
@@ -23516,7 +23532,9 @@ function handleElicitationRequest(session, params, responder) {
23516
23532
  answerWithoutUser(session, responder, COMPACTION_QUESTION_CAUSE);
23517
23533
  return;
23518
23534
  }
23519
- const plan = planAcpElicitation(params);
23535
+ const plan = planAcpElicitation(params, {
23536
+ descriptionIsHeading: session.dialect.elicitationDescriptionIsHeading === true
23537
+ });
23520
23538
  if (plan.kind === "unsupported") {
23521
23539
  answerWithoutUser(session, responder, {
23522
23540
  kind: "unshowable-request",
@@ -274,6 +274,15 @@ var completedTurnDisplaySchema = z4.enum(COMPLETED_TURN_DISPLAY_VALUES);
274
274
  // ../domain/src/plugin-id.ts
275
275
  import { z as z5 } from "zod";
276
276
  var pluginIdSchema = z5.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
277
+ var CORE_PLUGIN_DIRECTORIES = {
278
+ npmPackages: "npm",
279
+ cache: "cache",
280
+ runtime: "runtime",
281
+ stateSnapshots: "snapshots"
282
+ };
283
+ var coreOwnedPluginDirectoryNames = new Set(
284
+ Object.values(CORE_PLUGIN_DIRECTORIES)
285
+ );
277
286
 
278
287
  // ../domain/src/background-task.ts
279
288
  import { z as z6 } from "zod";
@@ -1732,6 +1732,15 @@ var completedTurnDisplaySchema = z8.enum(COMPLETED_TURN_DISPLAY_VALUES);
1732
1732
  // ../domain/src/plugin-id.ts
1733
1733
  import { z as z9 } from "zod";
1734
1734
  var pluginIdSchema = z9.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1735
+ var CORE_PLUGIN_DIRECTORIES = {
1736
+ npmPackages: "npm",
1737
+ cache: "cache",
1738
+ runtime: "runtime",
1739
+ stateSnapshots: "snapshots"
1740
+ };
1741
+ var coreOwnedPluginDirectoryNames = new Set(
1742
+ Object.values(CORE_PLUGIN_DIRECTORIES)
1743
+ );
1735
1744
 
1736
1745
  // ../domain/src/background-task.ts
1737
1746
  import { z as z10 } from "zod";
@@ -1534,6 +1534,15 @@ var projectExecutionDefaultsSchema = z2.object({
1534
1534
  // ../domain/src/plugin-id.ts
1535
1535
  import { z as z3 } from "zod";
1536
1536
  var pluginIdSchema = z3.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1537
+ var CORE_PLUGIN_DIRECTORIES = {
1538
+ npmPackages: "npm",
1539
+ cache: "cache",
1540
+ runtime: "runtime",
1541
+ stateSnapshots: "snapshots"
1542
+ };
1543
+ var coreOwnedPluginDirectoryNames = new Set(
1544
+ Object.values(CORE_PLUGIN_DIRECTORIES)
1545
+ );
1537
1546
 
1538
1547
  // ../domain/src/app-keybindings.ts
1539
1548
  import { z as z4 } from "zod";
@@ -1603,6 +1612,7 @@ var APP_COMMAND_IDS = [
1603
1612
  "window.new",
1604
1613
  "window.find",
1605
1614
  "window.reload",
1615
+ "window.forceReload",
1606
1616
  "app.back",
1607
1617
  "settings.open",
1608
1618
  "settings.openServers",
@@ -1728,6 +1738,7 @@ function layoutAppShortcutKey(input) {
1728
1738
  return input.shiftKey ? SHIFTED_KEY_BASES[input.key] ?? input.key : input.key;
1729
1739
  }
1730
1740
  function normalizeAppShortcutInputKey(input) {
1741
+ if (/^Digit[0-9]$/u.test(input.code)) return input.code.slice(5);
1731
1742
  const usePhysicalKey = input.altKey ? !isAsciiAlphanumeric(input.key) : isNonLatinCharacter(input.key);
1732
1743
  if (usePhysicalKey) {
1733
1744
  const fromCode = baseKeyFromCode(input.code);
@@ -1853,6 +1864,7 @@ var threadCreateOriginSchema = z6.enum(threadCreateOriginValues);
1853
1864
 
1854
1865
  // ../domain/src/environment.ts
1855
1866
  import { z as z7 } from "zod";
1867
+ var environmentHolderSchema = z7.literal("user");
1856
1868
  var environmentMachineSelectionSchema = z7.discriminatedUnion("type", [
1857
1869
  z7.object({ type: z7.literal("existing"), hostId: z7.string().min(1) }),
1858
1870
  z7.object({
@@ -1926,12 +1938,14 @@ var environmentSchema = z7.object({
1926
1938
  defaultBranch: z7.string().nullable(),
1927
1939
  mergeBaseBranch: z7.string().nullable(),
1928
1940
  status: environmentStatusSchema,
1941
+ statusMessage: z7.string().nullable(),
1929
1942
  environmentProviderId: z7.string().nullable(),
1930
1943
  lifecycle: environmentLifecycleSchema,
1931
1944
  hostLifecycle: environmentHostLifecycleSchema,
1932
1945
  environmentProviderSelection: environmentProviderSelectionSchema.nullable(),
1933
1946
  environmentProviderInstanceKey: z7.string().nullable(),
1934
1947
  managed: z7.boolean(),
1948
+ heldBy: environmentHolderSchema.nullable(),
1935
1949
  workspaceProvisionType: workspaceProvisionTypeSchema.nullable(),
1936
1950
  createdAt: z7.number(),
1937
1951
  updatedAt: z7.number()
@@ -6055,6 +6069,7 @@ function TestInfoListRow({
6055
6069
  ] });
6056
6070
  }
6057
6071
  var activeClipboard = null;
6072
+ var loadingWithServers = false;
6058
6073
  function captureClipboardWrites(result) {
6059
6074
  const writes = [];
6060
6075
  activeClipboard = (content) => {
@@ -6169,6 +6184,15 @@ var testPluginSdkApp = {
6169
6184
  );
6170
6185
  return composer.apiList;
6171
6186
  },
6187
+ experimental_useActiveComposer() {
6188
+ const composer = useSlotEnv("experimental_useActiveComposer").composer;
6189
+ useSyncExternalStore2(
6190
+ composer.subscribe,
6191
+ composer.getVersionSnapshot,
6192
+ composer.getVersionSnapshot
6193
+ );
6194
+ return composer.api;
6195
+ },
6172
6196
  ThreadChat: TestThreadChat,
6173
6197
  Markdown: TestMarkdown,
6174
6198
  experimental_FileLink: TestFileLink,
@@ -6255,6 +6279,9 @@ var testPluginSdkApp = {
6255
6279
  experimental_useServers() {
6256
6280
  return useSlotEnv("experimental_useServers").servers;
6257
6281
  },
6282
+ experimental_hasServers() {
6283
+ return loadingWithServers;
6284
+ },
6258
6285
  experimental_copyToClipboard(content) {
6259
6286
  return activeClipboard?.(content) ?? Promise.resolve(true);
6260
6287
  },
@@ -6271,6 +6298,22 @@ var testPluginSdkApp = {
6271
6298
  options
6272
6299
  );
6273
6300
  },
6301
+ experimental_useThreadRequests() {
6302
+ const calls = useSlotEnv(
6303
+ "experimental_useThreadRequests"
6304
+ ).threadRequestCalls;
6305
+ return useMemo3(
6306
+ () => ({
6307
+ async requestArchive(threadIds) {
6308
+ calls.push({ method: "requestArchive", threadIds: [...threadIds] });
6309
+ },
6310
+ async requestDelete(threadIds) {
6311
+ calls.push({ method: "requestDelete", threadIds: [...threadIds] });
6312
+ }
6313
+ }),
6314
+ [calls]
6315
+ );
6316
+ },
6274
6317
  experimental_useArchiveEnvironmentThreads() {
6275
6318
  const calls = useSlotEnv(
6276
6319
  "experimental_useArchiveEnvironmentThreads"
@@ -6426,7 +6469,7 @@ function installTestPluginRuntime() {
6426
6469
  pluginSdkApp: testPluginSdkApp
6427
6470
  };
6428
6471
  }
6429
- async function loadPluginApp(source) {
6472
+ async function loadPluginApp(source, options = {}) {
6430
6473
  installTestPluginRuntime();
6431
6474
  const resolved = typeof source === "function" ? await source() : source;
6432
6475
  const definition = isPluginAppDefinition(resolved) ? resolved : resolved.default;
@@ -6435,7 +6478,12 @@ async function loadPluginApp(source) {
6435
6478
  "the bundle's default export is not definePluginApp(...) from @get-bb/plugin-sdk/app"
6436
6479
  );
6437
6480
  }
6438
- return collectPluginAppRegistrations(definition);
6481
+ loadingWithServers = options.hasServers ?? false;
6482
+ try {
6483
+ return collectPluginAppRegistrations(definition);
6484
+ } finally {
6485
+ loadingWithServers = false;
6486
+ }
6439
6487
  }
6440
6488
  async function mountPluginContentScripts(app, options) {
6441
6489
  const controller = new AbortController();
@@ -6827,6 +6875,7 @@ function renderSlot(registration, props, options = {}) {
6827
6875
  }
6828
6876
  };
6829
6877
  const environmentArchiveCalls = [];
6878
+ const threadRequestCalls = [];
6830
6879
  const sidebarDraftThreadIds = new Set(
6831
6880
  options.sidebarDraftThreadIds ?? []
6832
6881
  );
@@ -7236,6 +7285,7 @@ ${block}
7236
7285
  sidebarNavigation,
7237
7286
  sidebarNavigationCalls,
7238
7287
  environmentArchiveCalls,
7288
+ threadRequestCalls,
7239
7289
  threadActions: options.threadActions ?? NO_THREAD_ACTIONS,
7240
7290
  threadBulkActions: options.threadBulkActions ?? NO_THREAD_BULK_ACTIONS,
7241
7291
  threadActionRegistrations: options.threadActionRegistrations ?? NO_THREAD_ACTION_REGISTRATIONS,
@@ -7355,6 +7405,7 @@ ${block}
7355
7405
  sidebarActionCalls,
7356
7406
  sidebarNavigationCalls,
7357
7407
  experimental_environmentArchiveCalls: environmentArchiveCalls,
7408
+ experimental_threadRequestCalls: threadRequestCalls,
7358
7409
  sdkCalls,
7359
7410
  experimental_clipboardWrites,
7360
7411
  composer: composerLog,
@@ -7376,6 +7427,7 @@ ${block}
7376
7427
  sidebarActionCalls,
7377
7428
  sidebarNavigationCalls,
7378
7429
  experimental_environmentArchiveCalls: environmentArchiveCalls,
7430
+ experimental_threadRequestCalls: threadRequestCalls,
7379
7431
  sdkCalls,
7380
7432
  experimental_clipboardWrites,
7381
7433
  composer: composerLog