@get-bb/plugin-sdk 0.6.9 → 0.6.14

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/host.js CHANGED
@@ -780,24 +780,15 @@ async function experimental_resolveClaudePluginRoots(args) {
780
780
  return { claudeDir: dirs.claudeDir, ...roots };
781
781
  }
782
782
 
783
- // ../process-utils/src/index.ts
784
- import { access, lstat, readdir, readlink, realpath } from "node:fs/promises";
785
- import {
786
- basename,
787
- dirname,
788
- isAbsolute,
789
- join,
790
- relative,
791
- resolve,
792
- sep
793
- } from "node:path";
783
+ // ../process-utils/src/spawn.ts
794
784
  import crossSpawn from "cross-spawn";
795
785
  function spawnPortableProcess(request) {
796
786
  return crossSpawn(request.command, request.args, {
797
787
  cwd: request.cwd,
798
788
  detached: request.detached,
799
789
  env: request.env,
800
- stdio: request.stdio
790
+ stdio: request.stdio,
791
+ windowsHide: true
801
792
  });
802
793
  }
803
794
  function assertPortableOutputProcess(child) {
@@ -813,6 +804,10 @@ function spawnPortableOutputProcess(request) {
813
804
  assertPortableOutputProcess(child);
814
805
  return child;
815
806
  }
807
+
808
+ // ../process-utils/src/cwd-processes.ts
809
+ import { lstat, readdir, readlink, realpath } from "node:fs/promises";
810
+ import { basename, dirname, join, resolve, sep } from "node:path";
816
811
  function isPathUnderDirectory(candidate, directory) {
817
812
  const normalized = candidate.endsWith(" (deleted)") ? candidate.slice(0, -" (deleted)".length) : candidate;
818
813
  return normalized === directory || normalized.startsWith(`${directory}${sep}`);
@@ -933,22 +928,30 @@ async function killProcessesWithCwdUnder(args) {
933
928
  }
934
929
  return Array.from(signalled.values());
935
930
  }
931
+
932
+ // ../process-utils/src/environment.ts
936
933
  function sanitizeInheritedChildProcessEnv(args) {
937
934
  const sanitizedEnv = {};
938
935
  for (const [key, value] of Object.entries(args.env)) {
939
936
  if (value === void 0) {
940
937
  continue;
941
938
  }
942
- if (key === "NODE_ENV" || key.startsWith("BB_")) {
939
+ const normalizedKey = process.platform === "win32" ? key.toUpperCase() : key;
940
+ if (normalizedKey === "NODE_ENV" || normalizedKey.startsWith("BB_")) {
943
941
  continue;
944
942
  }
945
- sanitizedEnv[key] = value;
943
+ sanitizedEnv[normalizedKey === "PATH" ? "PATH" : key] = value;
946
944
  }
947
945
  if (args.shellPath !== void 0) {
948
946
  sanitizedEnv.PATH = args.shellPath;
949
947
  }
950
948
  return sanitizedEnv;
951
949
  }
950
+
951
+ // ../process-utils/src/process-info.ts
952
+ import { execFile } from "node:child_process";
953
+ import { promisify } from "node:util";
954
+ var execFileAsync = promisify(execFile);
952
955
  export {
953
956
  experimental_defineHostEntry,
954
957
  experimental_filterResolvedNativeRoots,
@@ -103,13 +103,12 @@ function requireUniqueId(kind, seen, id) {
103
103
  }
104
104
  seen.add(id);
105
105
  }
106
- function parseContributionArray(kind, value, onRejected, parse) {
106
+ function parseContributionArray(kind, value, onRejected, parse, seenIds = /* @__PURE__ */ new Set()) {
107
107
  if (value === void 0) return void 0;
108
108
  if (!Array.isArray(value)) {
109
109
  onRejected(`${kind}: must be an array when set`);
110
110
  return void 0;
111
111
  }
112
- const seenIds = /* @__PURE__ */ new Set();
113
112
  const parsed = [];
114
113
  for (const [index, entry] of value.entries()) {
115
114
  const entryKind = `${kind}[${index}]`;
@@ -147,7 +146,7 @@ function parseMenuItem(entryKind, value) {
147
146
  run: requireFunction(entryKind, "run", entry?.run)
148
147
  };
149
148
  }
150
- function parseRegions(kind, registration, onRejected) {
149
+ function parseRegions(kind, registration, onRejected, seenPopupIds) {
151
150
  const actions = parseContributionArray(`${kind}.actions`, registration.actions, onRejected, (entryKind, value) => {
152
151
  const entry = value;
153
152
  return {
@@ -182,6 +181,20 @@ function parseRegions(kind, registration, onRejected) {
182
181
  onRejected,
183
182
  parseMenuItem
184
183
  );
184
+ const popups = parseContributionArray(
185
+ `${kind}.experimental_popups`,
186
+ registration.experimental_popups,
187
+ onRejected,
188
+ (entryKind, value) => {
189
+ const entry = value;
190
+ return {
191
+ id: requireSlotId(entryKind, entry?.id),
192
+ label: requireNonEmptyString(entryKind, "label", entry?.label),
193
+ component: requireComponent(entryKind, entry?.component)
194
+ };
195
+ },
196
+ seenPopupIds
197
+ );
185
198
  let richText;
186
199
  if (registration.richText !== void 0) {
187
200
  const raw = registration.richText;
@@ -224,10 +237,11 @@ function parseRegions(kind, registration, onRejected) {
224
237
  ...banners !== void 0 ? { banners } : {},
225
238
  ...plusMenu !== void 0 ? { plusMenu } : {},
226
239
  ...sendMenu !== void 0 ? { sendMenu } : {},
227
- ...richText !== void 0 ? { richText } : {}
240
+ ...richText !== void 0 ? { richText } : {},
241
+ ...popups !== void 0 ? { experimental_popups: popups } : {}
228
242
  };
229
243
  }
230
- function collectComposerCustomization(registration, seenIds, onRejected) {
244
+ function collectComposerCustomization(registration, seenIds, onRejected, seenPopupIds = /* @__PURE__ */ new Set()) {
231
245
  const kind = "composer.customize";
232
246
  try {
233
247
  const raw = registration;
@@ -253,7 +267,7 @@ function collectComposerCustomization(registration, seenIds, onRejected) {
253
267
  (scope) => scope !== "side-chat"
254
268
  )
255
269
  } : {},
256
- ...parseRegions(`${kind}(${id})`, raw ?? {}, onRejected)
270
+ ...parseRegions(`${kind}(${id})`, raw ?? {}, onRejected, seenPopupIds)
257
271
  };
258
272
  } catch (error) {
259
273
  onRejected(error instanceof Error ? error.message : String(error));
@@ -482,6 +482,8 @@ function createComposerHandleBinding(key, initial) {
482
482
  removeMention,
483
483
  onSubmitted,
484
484
  focus: () => target().focus(),
485
+ experimental_openPopup: (id) => target().openPopup?.(controller.pluginId, id) ?? false,
486
+ experimental_closePopup: () => target().closePopup?.(controller.pluginId) ?? false,
485
487
  submit,
486
488
  setSelection,
487
489
  experimental_removeMention: (mention) => {
@@ -34,6 +34,7 @@ var RESERVED_BB_CLI_COMMANDS = [
34
34
  "marketplace",
35
35
  "plugin",
36
36
  "project",
37
+ "prompt-history",
37
38
  "provider",
38
39
  "server",
39
40
  "settings",
@@ -75,13 +75,12 @@ function requireUniqueId(kind, seen, id) {
75
75
  }
76
76
  seen.add(id);
77
77
  }
78
- function parseContributionArray(kind, value, onRejected, parse) {
78
+ function parseContributionArray(kind, value, onRejected, parse, seenIds = /* @__PURE__ */ new Set()) {
79
79
  if (value === void 0) return void 0;
80
80
  if (!Array.isArray(value)) {
81
81
  onRejected(`${kind}: must be an array when set`);
82
82
  return void 0;
83
83
  }
84
- const seenIds = /* @__PURE__ */ new Set();
85
84
  const parsed = [];
86
85
  for (const [index, entry] of value.entries()) {
87
86
  const entryKind = `${kind}[${index}]`;
@@ -119,7 +118,7 @@ function parseMenuItem(entryKind, value) {
119
118
  run: requireFunction(entryKind, "run", entry?.run)
120
119
  };
121
120
  }
122
- function parseRegions(kind, registration, onRejected) {
121
+ function parseRegions(kind, registration, onRejected, seenPopupIds) {
123
122
  const actions = parseContributionArray(`${kind}.actions`, registration.actions, onRejected, (entryKind, value) => {
124
123
  const entry = value;
125
124
  return {
@@ -154,6 +153,20 @@ function parseRegions(kind, registration, onRejected) {
154
153
  onRejected,
155
154
  parseMenuItem
156
155
  );
156
+ const popups = parseContributionArray(
157
+ `${kind}.experimental_popups`,
158
+ registration.experimental_popups,
159
+ onRejected,
160
+ (entryKind, value) => {
161
+ const entry = value;
162
+ return {
163
+ id: requireSlotId(entryKind, entry?.id),
164
+ label: requireNonEmptyString(entryKind, "label", entry?.label),
165
+ component: requireComponent(entryKind, entry?.component)
166
+ };
167
+ },
168
+ seenPopupIds
169
+ );
157
170
  let richText;
158
171
  if (registration.richText !== void 0) {
159
172
  const raw = registration.richText;
@@ -196,10 +209,11 @@ function parseRegions(kind, registration, onRejected) {
196
209
  ...banners !== void 0 ? { banners } : {},
197
210
  ...plusMenu !== void 0 ? { plusMenu } : {},
198
211
  ...sendMenu !== void 0 ? { sendMenu } : {},
199
- ...richText !== void 0 ? { richText } : {}
212
+ ...richText !== void 0 ? { richText } : {},
213
+ ...popups !== void 0 ? { experimental_popups: popups } : {}
200
214
  };
201
215
  }
202
- function collectComposerCustomization(registration, seenIds, onRejected) {
216
+ function collectComposerCustomization(registration, seenIds, onRejected, seenPopupIds = /* @__PURE__ */ new Set()) {
203
217
  const kind = "composer.customize";
204
218
  try {
205
219
  const raw = registration;
@@ -225,7 +239,7 @@ function collectComposerCustomization(registration, seenIds, onRejected) {
225
239
  (scope) => scope !== "side-chat"
226
240
  )
227
241
  } : {},
228
- ...parseRegions(`${kind}(${id})`, raw ?? {}, onRejected)
242
+ ...parseRegions(`${kind}(${id})`, raw ?? {}, onRejected, seenPopupIds)
229
243
  };
230
244
  } catch (error) {
231
245
  onRejected(error instanceof Error ? error.message : String(error));
@@ -482,6 +496,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
482
496
  threadPanelAction: /* @__PURE__ */ new Set(),
483
497
  newThreadPanelAction: /* @__PURE__ */ new Set(),
484
498
  composerCustomization: /* @__PURE__ */ new Set(),
499
+ composerPopup: /* @__PURE__ */ new Set(),
485
500
  pendingInteraction: /* @__PURE__ */ new Set(),
486
501
  sidebarFooterItem: /* @__PURE__ */ new Set(),
487
502
  sidebarNavigation: /* @__PURE__ */ new Set(),
@@ -876,7 +891,8 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
876
891
  const customization = collectComposerCustomization(
877
892
  registration,
878
893
  seenIds.composerCustomization,
879
- onComposerCustomizationRejected
894
+ onComposerCustomizationRejected,
895
+ seenIds.composerPopup
880
896
  );
881
897
  if (customization !== null) {
882
898
  collected.composerCustomizations.push(customization);