@get-bb/plugin-sdk 0.6.80 → 0.6.89

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.
@@ -94,71 +94,6 @@ function rpcResponseTags(declarations, input, output) {
94
94
  return { tags, keyTags, invalidated };
95
95
  }
96
96
 
97
- // src/internal/host-policy.ts
98
- import { createHash } from "node:crypto";
99
- import { z as z6 } from "zod";
100
-
101
- // ../domain/src/plugin-icon.ts
102
- function isPluginOwnedIconPath(icon) {
103
- return icon.startsWith("./");
104
- }
105
- var PLUGIN_ICON_MAX_BYTES = 32 * 1024;
106
- var NAMESPACED_GLYPH_PATTERN = /^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u;
107
- function isNamespacedGlyph(glyph) {
108
- return NAMESPACED_GLYPH_PATTERN.test(glyph);
109
- }
110
- function parseNamespacedGlyph(glyph) {
111
- if (!isNamespacedGlyph(glyph)) {
112
- return null;
113
- }
114
- const separator = glyph.indexOf("/");
115
- return {
116
- pluginId: glyph.slice(0, separator),
117
- name: glyph.slice(separator + 1)
118
- };
119
- }
120
-
121
- // ../domain/src/plugin-cli.ts
122
- var RESERVED_BB_CLI_COMMANDS = [
123
- "browser",
124
- "diagnostics",
125
- "environment",
126
- "file",
127
- "guide",
128
- "help",
129
- "machine",
130
- "marketplace",
131
- "plugin",
132
- "project",
133
- "prompt-history",
134
- "provider",
135
- "server",
136
- "settings",
137
- "skill",
138
- "status",
139
- "terminal",
140
- "theme",
141
- "thread",
142
- "updates",
143
- "voice"
144
- ];
145
-
146
- // ../domain/src/plugin-interaction-limits.ts
147
- var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
148
- var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
149
- var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
150
-
151
- // ../domain/src/provider-fork.ts
152
- import { z as z2 } from "zod";
153
- var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
154
- var providerForkSchema = z2.enum(PROVIDER_FORK_VALUES);
155
-
156
- // ../domain/src/completed-turn-display.ts
157
- import { z as z3 } from "zod";
158
- var COMPLETED_TURN_DISPLAY_VALUES = ["collapse", "flat"];
159
- var completedTurnDisplaySchema = z3.enum(COMPLETED_TURN_DISPLAY_VALUES);
160
- var DEFAULT_COMPLETED_TURN_DISPLAY = "collapse";
161
-
162
97
  // ../domain/src/provider-skill-roots.ts
163
98
  function isAbsoluteProviderSkillRootPath(value) {
164
99
  if (value.length === 0) {
@@ -181,53 +116,53 @@ function isRelativeProviderSkillRootPath(value) {
181
116
  }
182
117
 
183
118
  // ../domain/src/json-value.ts
184
- import { z as z4 } from "zod";
185
- var jsonValueSchema = z4.lazy(
186
- () => z4.union([
187
- z4.string(),
188
- z4.number(),
189
- z4.boolean(),
190
- z4.null(),
191
- z4.array(jsonValueSchema),
192
- z4.record(z4.string(), jsonValueSchema)
119
+ import { z as z2 } from "zod";
120
+ var jsonValueSchema = z2.lazy(
121
+ () => z2.union([
122
+ z2.string(),
123
+ z2.number(),
124
+ z2.boolean(),
125
+ z2.null(),
126
+ z2.array(jsonValueSchema),
127
+ z2.record(z2.string(), jsonValueSchema)
193
128
  ])
194
129
  );
195
- var jsonObjectSchema = z4.record(
196
- z4.string(),
130
+ var jsonObjectSchema = z2.record(
131
+ z2.string(),
197
132
  jsonValueSchema
198
133
  );
199
134
 
200
135
  // ../domain/src/native-roots.ts
201
- import { z as z5 } from "zod";
136
+ import { z as z3 } from "zod";
202
137
  var PROVIDER_NATIVE_ROOTS_MAX = 32;
203
138
  var PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u;
204
- var nativeRootNamePrefixSchema = z5.string().refine(
139
+ var nativeRootNamePrefixSchema = z3.string().refine(
205
140
  (value) => value === "" || PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN.test(value),
206
141
  "A root name prefix is a plugin-name-like token ending in ':'"
207
142
  );
208
- var nativeRootManifestPathSchema = z5.string().min(1).refine(
143
+ var nativeRootManifestPathSchema = z3.string().min(1).refine(
209
144
  isRelativeProviderSkillRootPath,
210
145
  "A manifest marker is a relative path without dot segments"
211
146
  );
212
- var relativeNativeRootPathSchema = z5.string().min(1).refine(
147
+ var relativeNativeRootPathSchema = z3.string().min(1).refine(
213
148
  isRelativeProviderSkillRootPath,
214
149
  "Roots must be relative paths without dot segments"
215
150
  );
216
- var absoluteNativeRootPathSchema = z5.string().min(1).refine(
151
+ var absoluteNativeRootPathSchema = z3.string().min(1).refine(
217
152
  isAbsoluteProviderSkillRootPath,
218
153
  "Absolute roots must be absolute paths without dot segments"
219
154
  );
220
- var providerNativeRootInputSchema = z5.union([
221
- z5.string().min(1),
222
- z5.object({
223
- path: z5.string().min(1),
155
+ var providerNativeRootInputSchema = z3.union([
156
+ z3.string().min(1),
157
+ z3.object({
158
+ path: z3.string().min(1),
224
159
  /** Skills nest in subdirectories (the agent scans recursively). */
225
- recursive: z5.boolean().optional(),
160
+ recursive: z3.boolean().optional(),
226
161
  /**
227
162
  * Scan the same relative directory in every ancestor of the workspace
228
163
  * up to the repository root (`project` roots only).
229
164
  */
230
- ancestors: z5.boolean().optional(),
165
+ ancestors: z3.boolean().optional(),
231
166
  /**
232
167
  * Prepended to every name under the root, a vendor plugin's
233
168
  * `plugin-name:`; a prefixed root is listed as a plugin root.
@@ -242,14 +177,14 @@ var providerNativeRootInputSchema = z5.union([
242
177
  skipIfManifest: nativeRootManifestPathSchema.optional()
243
178
  }).strict()
244
179
  ]);
245
- var providerNativeRootsInputSchema = z5.object({
246
- user: z5.array(providerNativeRootInputSchema).optional(),
247
- project: z5.array(providerNativeRootInputSchema).optional()
180
+ var providerNativeRootsInputSchema = z3.object({
181
+ user: z3.array(providerNativeRootInputSchema).optional(),
182
+ project: z3.array(providerNativeRootInputSchema).optional()
248
183
  }).strict();
249
- var providerNativeRootSchema = z5.object({
250
- path: z5.string().min(1),
251
- recursive: z5.boolean(),
252
- ancestors: z5.boolean(),
184
+ var providerNativeRootSchema = z3.object({
185
+ path: z3.string().min(1),
186
+ recursive: z3.boolean(),
187
+ ancestors: z3.boolean(),
253
188
  namePrefix: nativeRootNamePrefixSchema,
254
189
  /** Absent: every skill-shaped directory under the root is a skill. */
255
190
  skipIfManifest: nativeRootManifestPathSchema.optional()
@@ -258,7 +193,7 @@ function uniqueByPath(roots) {
258
193
  return new Set(roots.map((root) => root.path)).size === roots.length;
259
194
  }
260
195
  function nativeRootSideSchema(side) {
261
- return z5.array(
196
+ return z3.array(
262
197
  providerNativeRootSchema.extend({ path: relativeNativeRootPathSchema }).superRefine((root, context) => {
263
198
  if (root.ancestors && side !== "project") {
264
199
  context.addIssue({
@@ -269,7 +204,7 @@ function nativeRootSideSchema(side) {
269
204
  })
270
205
  ).max(PROVIDER_NATIVE_ROOTS_MAX).refine(uniqueByPath, "Roots must not repeat a path");
271
206
  }
272
- var providerNativeRootsSchema = z5.object({
207
+ var providerNativeRootsSchema = z3.object({
273
208
  user: nativeRootSideSchema("user"),
274
209
  project: nativeRootSideSchema("project")
275
210
  }).strict();
@@ -295,19 +230,19 @@ function normalizeProviderNativeRoots(roots) {
295
230
  project: (roots?.project ?? []).map(normalizeProviderNativeRoot)
296
231
  };
297
232
  }
298
- var providerResolvedNativeRootShapeSchema = z5.enum([
233
+ var providerResolvedNativeRootShapeSchema = z3.enum([
299
234
  "skills",
300
235
  "skill",
301
236
  "skill-file",
302
237
  "commands",
303
238
  "command-file"
304
239
  ]);
305
- var resolvedNativeRootFieldsSchema = z5.object({
240
+ var resolvedNativeRootFieldsSchema = z3.object({
306
241
  path: absoluteNativeRootPathSchema,
307
- origin: z5.enum(["user", "project"]),
308
- recursive: z5.boolean(),
242
+ origin: z3.enum(["user", "project"]),
243
+ recursive: z3.boolean(),
309
244
  /** Only with origin `project`, for a path inside the workspace. */
310
- ancestors: z5.boolean(),
245
+ ancestors: z3.boolean(),
311
246
  namePrefix: nativeRootNamePrefixSchema,
312
247
  shape: providerResolvedNativeRootShapeSchema,
313
248
  /**
@@ -315,7 +250,7 @@ var resolvedNativeRootFieldsSchema = z5.object({
315
250
  * none. A vendor plugin's root SKILL.md takes the plugin's name; absent
316
251
  * means the parent directory's name.
317
252
  */
318
- fallbackName: z5.string().min(1).optional(),
253
+ fallbackName: z3.string().min(1).optional(),
319
254
  /**
320
255
  * `skills` only: a file, relative to a skill directory under this root,
321
256
  * that marks the directory as a vendor plugin rather than a skill; the
@@ -359,14 +294,14 @@ var resolvedCommandShapes = /* @__PURE__ */ new Set([
359
294
  "command-file"
360
295
  ]);
361
296
  var PROVIDER_RESOLVED_NATIVE_ROOTS_MAX = 256;
362
- var providerResolvedNativeRootsSchema = z5.object({
363
- skills: z5.array(
297
+ var providerResolvedNativeRootsSchema = z3.object({
298
+ skills: z3.array(
364
299
  providerResolvedNativeRootSchema.refine(
365
300
  (root) => resolvedSkillShapes.has(root.shape),
366
301
  "A skills root needs a skill shape"
367
302
  )
368
303
  ).max(PROVIDER_RESOLVED_NATIVE_ROOTS_MAX),
369
- commands: z5.array(
304
+ commands: z3.array(
370
305
  providerResolvedNativeRootSchema.refine(
371
306
  (root) => resolvedCommandShapes.has(root.shape),
372
307
  "A commands root needs a command shape"
@@ -377,12 +312,43 @@ var EMPTY_PROVIDER_RESOLVED_NATIVE_ROOTS = Object.freeze({
377
312
  skills: Object.freeze([]),
378
313
  commands: Object.freeze([])
379
314
  });
380
- var providerNativeRootSetSchema = z5.object({
315
+ var providerNativeRootSetSchema = z3.object({
381
316
  skills: providerNativeRootsSchema,
382
317
  commands: providerNativeRootsSchema,
383
318
  resolved: providerResolvedNativeRootsSchema
384
319
  }).strict();
385
320
 
321
+ // ../domain/src/completed-turn-display.ts
322
+ import { z as z4 } from "zod";
323
+ var COMPLETED_TURN_DISPLAY_VALUES = ["collapse", "flat"];
324
+ var completedTurnDisplaySchema = z4.enum(COMPLETED_TURN_DISPLAY_VALUES);
325
+ var DEFAULT_COMPLETED_TURN_DISPLAY = "collapse";
326
+
327
+ // ../domain/src/plugin-interaction-limits.ts
328
+ var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
329
+ var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
330
+ var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
331
+
332
+ // ../domain/src/plugin-icon.ts
333
+ function isPluginOwnedIconPath(icon) {
334
+ return icon.startsWith("./");
335
+ }
336
+ var PLUGIN_ICON_MAX_BYTES = 32 * 1024;
337
+ var NAMESPACED_GLYPH_PATTERN = /^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u;
338
+ function isNamespacedGlyph(glyph) {
339
+ return NAMESPACED_GLYPH_PATTERN.test(glyph);
340
+ }
341
+ function parseNamespacedGlyph(glyph) {
342
+ if (!isNamespacedGlyph(glyph)) {
343
+ return null;
344
+ }
345
+ const separator = glyph.indexOf("/");
346
+ return {
347
+ pluginId: glyph.slice(0, separator),
348
+ name: glyph.slice(separator + 1)
349
+ };
350
+ }
351
+
386
352
  // ../domain/src/plugin-metadata.ts
387
353
  var PLUGIN_METADATA_MAX_BYTES = 256 * 1024;
388
354
  function exceedsPluginMetadataLimit(metadataJson) {
@@ -428,8 +394,42 @@ function deepFreezePluginMetadata(metadata) {
428
394
  return metadata;
429
395
  }
430
396
 
397
+ // ../domain/src/provider-fork.ts
398
+ import { z as z5 } from "zod";
399
+ var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
400
+ var providerForkSchema = z5.enum(PROVIDER_FORK_VALUES);
401
+
402
+ // src/internal/host-policy.ts
403
+ import { createHash } from "node:crypto";
404
+ import { z as z6 } from "zod";
405
+
406
+ // ../domain/src/plugin-cli.ts
407
+ var RESERVED_BB_CLI_COMMANDS = [
408
+ "browser",
409
+ "diagnostics",
410
+ "environment",
411
+ "file",
412
+ "guide",
413
+ "help",
414
+ "machine",
415
+ "marketplace",
416
+ "plugin",
417
+ "project",
418
+ "prompt-history",
419
+ "provider",
420
+ "server",
421
+ "settings",
422
+ "skill",
423
+ "status",
424
+ "terminal",
425
+ "theme",
426
+ "thread",
427
+ "updates",
428
+ "voice"
429
+ ];
430
+
431
431
  // src/backend-contract.ts
432
- var PLUGIN_CLI_OUTPUT_MAX_BYTES = 1024 * 1024;
432
+ var PLUGIN_CLI_OUTPUT_MAX_BYTES = 32 * 1024 * 1024;
433
433
 
434
434
  // src/internal/host-policy.ts
435
435
  function pluginCliCollisionWarning(pluginId, commandName) {
@@ -3277,11 +3277,14 @@ function createFakePluginHostInternal(options, sharedState) {
3277
3277
  const rpcHandlers = /* @__PURE__ */ new Map();
3278
3278
  const rpcInvalidations = [];
3279
3279
  const invalidationListeners = /* @__PURE__ */ new Set();
3280
+ const watchProducers = /* @__PURE__ */ new Map();
3281
+ const activeWatches = /* @__PURE__ */ new Set();
3280
3282
  const rpc = {
3281
- experimental_whileWatched(method) {
3283
+ experimental_whileWatched(method, handler) {
3282
3284
  assertLive();
3283
3285
  if (!rpcHandlers.has(method))
3284
3286
  throw new Error(`Unknown RPC method: ${method}`);
3287
+ watchProducers.set(method, handler);
3285
3288
  },
3286
3289
  experimental_invalidate(tags) {
3287
3290
  assertLive();
@@ -3914,6 +3917,8 @@ function createFakePluginHostInternal(options, sharedState) {
3914
3917
  await session.closeForReload();
3915
3918
  }
3916
3919
  for (const controller of serviceControllers) controller.abort();
3920
+ for (const controller of activeWatches) controller.abort();
3921
+ activeWatches.clear();
3917
3922
  for (const hook of [...disposeHooks].reverse()) {
3918
3923
  try {
3919
3924
  await hook();
@@ -4132,6 +4137,19 @@ function createFakePluginHostInternal(options, sharedState) {
4132
4137
  async setSettings(values) {
4133
4138
  await setSettingsValues(values);
4134
4139
  },
4140
+ experimental_watchRpc(method, read) {
4141
+ const producer = watchProducers.get(method);
4142
+ if (producer === void 0) {
4143
+ throw new Error(`rpc method "${method}" has no watch producer`);
4144
+ }
4145
+ const controller = new AbortController();
4146
+ activeWatches.add(controller);
4147
+ void producer(read, controller.signal);
4148
+ return () => {
4149
+ activeWatches.delete(controller);
4150
+ controller.abort();
4151
+ };
4152
+ },
4135
4153
  async callRpc(method, input, options2 = {}) {
4136
4154
  const record = rpcHandlers.get(method);
4137
4155
  if (!record) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.80",
3
+ "version": "0.6.89",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"
@@ -139,6 +139,12 @@
139
139
  "types": "./bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts",
140
140
  "import": "./dist/internal/rpc-query-host.js",
141
141
  "default": "./dist/internal/rpc-query-host.js"
142
+ },
143
+ "./process": {
144
+ "source": "./src/process.ts",
145
+ "types": "./bundled-types/bb-plugin-sdk-process.d.ts",
146
+ "import": "./dist/process.js",
147
+ "default": "./dist/process.js"
142
148
  }
143
149
  },
144
150
  "types": "./bundled-types/bb-plugin-sdk.d.ts",