@get-bb/plugin-sdk 0.6.144 → 0.6.150

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael Yong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -611,6 +611,7 @@ declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
611
611
  agentCpuPriority: "agentCpuPriority";
612
612
  compactExpiredCache: "compactExpiredCache";
613
613
  dismissReadNotifications: "dismissReadNotifications";
614
+ keyedPluginCss: "keyedPluginCss";
614
615
  performanceDiagnostics: "performanceDiagnostics";
615
616
  pluginUpdates: "pluginUpdates";
616
617
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -626,6 +627,7 @@ declare const experimentUpdatesSchema: z$1.ZodRecord<z$1.ZodEnum<{
626
627
  agentCpuPriority: "agentCpuPriority";
627
628
  compactExpiredCache: "compactExpiredCache";
628
629
  dismissReadNotifications: "dismissReadNotifications";
630
+ keyedPluginCss: "keyedPluginCss";
629
631
  performanceDiagnostics: "performanceDiagnostics";
630
632
  pluginUpdates: "pluginUpdates";
631
633
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -6710,6 +6712,10 @@ declare const hostDaemonCommandRegistry: {
6710
6712
  }, z$1.core.$strict>;
6711
6713
  }, z$1.core.$strip>, "settled", false>;
6712
6714
  "thread.stop": HostDaemonCommandDescriptor<"thread.stop", z$1.ZodObject<{
6715
+ aimedAt: z$1.ZodNullable<z$1.ZodObject<{
6716
+ requestIds: z$1.ZodArray<z$1.ZodString>;
6717
+ turnId: z$1.ZodNullable<z$1.ZodString>;
6718
+ }, z$1.core.$strict>>;
6713
6719
  environmentId: z$1.ZodString;
6714
6720
  intent: z$1.ZodEnum<{
6715
6721
  interrupt: "interrupt";
@@ -10716,6 +10722,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10716
10722
  agentCpuPriority: "agentCpuPriority";
10717
10723
  compactExpiredCache: "compactExpiredCache";
10718
10724
  dismissReadNotifications: "dismissReadNotifications";
10725
+ keyedPluginCss: "keyedPluginCss";
10719
10726
  performanceDiagnostics: "performanceDiagnostics";
10720
10727
  pluginUpdates: "pluginUpdates";
10721
10728
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -16680,6 +16687,10 @@ declare const threadTimelineReadResponseSchema: z$1.ZodUnion<readonly [z$1.ZodOb
16680
16687
  returnedSegmentCount: z$1.ZodOptional<z$1.ZodNumber>;
16681
16688
  }, z$1.core.$strict>>;
16682
16689
  }, z$1.core.$strip>;
16690
+ patchRows: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
16691
+ id: z$1.ZodString;
16692
+ ops: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodTuple<[z$1.ZodLiteral<"append">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>, z$1.ZodString], null>, z$1.ZodTuple<[z$1.ZodLiteral<"set">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>, z$1.ZodUnknown], null>, z$1.ZodTuple<[z$1.ZodLiteral<"delete">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>], null>]>>;
16693
+ }, z$1.core.$strip>>>;
16683
16694
  rowOrder: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodTuple<[z$1.ZodNumber, z$1.ZodNumber], null>]>>>;
16684
16695
  upsertRows: z$1.ZodArray<z$1.ZodType<TimelineRow, unknown, z$1.core.$ZodTypeInternals<TimelineRow, unknown>>>;
16685
16696
  }, z$1.core.$strip>;
@@ -1220,6 +1220,7 @@ interface ExperimentalFakeHostRpcCall {
1220
1220
  input: unknown;
1221
1221
  hostId: string;
1222
1222
  signal?: AbortSignal;
1223
+ timeoutMs?: number;
1223
1224
  }
1224
1225
  /** Everything the plugin registered, exposed raw for assertions. */
1225
1226
  interface FakePluginRegistrations {
@@ -702,6 +702,7 @@ declare const experimentsSchema: z$1.ZodRecord<z$1.ZodEnum<{
702
702
  agentCpuPriority: "agentCpuPriority";
703
703
  compactExpiredCache: "compactExpiredCache";
704
704
  dismissReadNotifications: "dismissReadNotifications";
705
+ keyedPluginCss: "keyedPluginCss";
705
706
  performanceDiagnostics: "performanceDiagnostics";
706
707
  pluginUpdates: "pluginUpdates";
707
708
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -717,6 +718,7 @@ declare const experimentUpdatesSchema: z$1.ZodRecord<z$1.ZodEnum<{
717
718
  agentCpuPriority: "agentCpuPriority";
718
719
  compactExpiredCache: "compactExpiredCache";
719
720
  dismissReadNotifications: "dismissReadNotifications";
721
+ keyedPluginCss: "keyedPluginCss";
720
722
  performanceDiagnostics: "performanceDiagnostics";
721
723
  pluginUpdates: "pluginUpdates";
722
724
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -6925,6 +6927,10 @@ declare const hostDaemonCommandRegistry: {
6925
6927
  }, z$1.core.$strict>;
6926
6928
  }, z$1.core.$strip>, "settled", false>;
6927
6929
  "thread.stop": HostDaemonCommandDescriptor<"thread.stop", z$1.ZodObject<{
6930
+ aimedAt: z$1.ZodNullable<z$1.ZodObject<{
6931
+ requestIds: z$1.ZodArray<z$1.ZodString>;
6932
+ turnId: z$1.ZodNullable<z$1.ZodString>;
6933
+ }, z$1.core.$strict>>;
6928
6934
  environmentId: z$1.ZodString;
6929
6935
  intent: z$1.ZodEnum<{
6930
6936
  interrupt: "interrupt";
@@ -10931,6 +10937,7 @@ declare const systemConfigResponseSchema: z$1.ZodObject<{
10931
10937
  agentCpuPriority: "agentCpuPriority";
10932
10938
  compactExpiredCache: "compactExpiredCache";
10933
10939
  dismissReadNotifications: "dismissReadNotifications";
10940
+ keyedPluginCss: "keyedPluginCss";
10934
10941
  performanceDiagnostics: "performanceDiagnostics";
10935
10942
  pluginUpdates: "pluginUpdates";
10936
10943
  resumeThreadsAfterRestart: "resumeThreadsAfterRestart";
@@ -16896,6 +16903,10 @@ declare const threadTimelineReadResponseSchema: z$1.ZodUnion<readonly [z$1.ZodOb
16896
16903
  returnedSegmentCount: z$1.ZodOptional<z$1.ZodNumber>;
16897
16904
  }, z$1.core.$strict>>;
16898
16905
  }, z$1.core.$strip>;
16906
+ patchRows: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
16907
+ id: z$1.ZodString;
16908
+ ops: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodTuple<[z$1.ZodLiteral<"append">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>, z$1.ZodString], null>, z$1.ZodTuple<[z$1.ZodLiteral<"set">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>, z$1.ZodUnknown], null>, z$1.ZodTuple<[z$1.ZodLiteral<"delete">, z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber]>>], null>]>>;
16909
+ }, z$1.core.$strip>>>;
16899
16910
  rowOrder: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodTuple<[z$1.ZodNumber, z$1.ZodNumber], null>]>>>;
16900
16911
  upsertRows: z$1.ZodArray<z$1.ZodType<TimelineRow, unknown, z$1.core.$ZodTypeInternals<TimelineRow, unknown>>>;
16901
16912
  }, z$1.core.$strip>;
package/dist/host.js CHANGED
@@ -1378,7 +1378,7 @@ function spawnHostProcess(command, args = [], options = {}) {
1378
1378
  env: launch.env,
1379
1379
  windowsHide: options.windowsHide ?? true
1380
1380
  };
1381
- if (process.platform === "win32" && !options.shell && /[\\/]/u.test(command)) {
1381
+ if (process.platform === "win32" && !options.shell) {
1382
1382
  const parsed = parse(launch.command, launch.args, spawnOptions);
1383
1383
  return observe(
1384
1384
  parsed.file ? nodeSpawn(parsed.command, parsed.args, parsed.options) : nodeSpawn(launch.command, launch.args, spawnOptions)
@@ -80,7 +80,7 @@ var experimental_PluginRpcRefusal = class extends Error {
80
80
  };
81
81
 
82
82
  // src/internal/rpc-query-host.ts
83
- import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
83
+ import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
84
84
  import { useIsFetching } from "@tanstack/react-query";
85
85
 
86
86
  // ../query-tags/src/index.ts
@@ -1254,27 +1254,36 @@ function createTaggedKeyedQueryOwner(options) {
1254
1254
  }
1255
1255
  };
1256
1256
  }
1257
- function useQuerySelection(subscribe, getSnapshot, select) {
1258
- const committed = useRef(null);
1259
- const getSelection = useMemo(() => {
1260
- let cached;
1261
- return () => {
1262
- const snapshot = getSnapshot();
1263
- if (cached && Object.is(cached.snapshot, snapshot)) return cached.value;
1264
- cached = {
1265
- snapshot,
1266
- value: replaceEqualDeep3(
1267
- cached?.value ?? committed.current?.value,
1268
- select(snapshot)
1269
- )
1270
- };
1271
- return cached.value;
1257
+ function createSelectionGetter(getSnapshot, select, committed) {
1258
+ let cached;
1259
+ return () => {
1260
+ const snapshot = getSnapshot();
1261
+ if (cached && Object.is(cached.snapshot, snapshot)) return cached.value;
1262
+ cached = {
1263
+ snapshot,
1264
+ value: replaceEqualDeep3(
1265
+ cached?.value ?? committed.current,
1266
+ select(snapshot)
1267
+ )
1272
1268
  };
1273
- }, [getSnapshot, select]);
1269
+ return cached.value;
1270
+ };
1271
+ }
1272
+ function commitSelection(committed, value) {
1273
+ committed.current = value;
1274
+ }
1275
+ function useQuerySelection(subscribe, getSnapshot, select) {
1276
+ const [committed] = useState(() => ({
1277
+ current: void 0
1278
+ }));
1279
+ const getSelection = useMemo(
1280
+ () => createSelectionGetter(getSnapshot, select, committed),
1281
+ [committed, getSnapshot, select]
1282
+ );
1274
1283
  const value = useSyncExternalStore(subscribe, getSelection, getSelection);
1275
1284
  useEffect(() => {
1276
- committed.current = { value };
1277
- }, [value]);
1285
+ commitSelection(committed, value);
1286
+ }, [committed, value]);
1278
1287
  return value;
1279
1288
  }
1280
1289
 
@@ -2378,6 +2387,17 @@ var tagsOf = (data) => [
2378
2387
  ...data.tags,
2379
2388
  ...Object.values(data.keyTags).flat()
2380
2389
  ];
2390
+ function useParsedRpcInput(input) {
2391
+ const identity = JSON.stringify(input ?? null);
2392
+ const [parsed, setParsed] = useState2(() => ({
2393
+ identity,
2394
+ value: jsonValueSchema.parse(input ?? null)
2395
+ }));
2396
+ if (parsed.identity === identity) return parsed.value;
2397
+ const next = { identity, value: jsonValueSchema.parse(input ?? null) };
2398
+ setParsed(next);
2399
+ return next.value;
2400
+ }
2381
2401
  var owners = /* @__PURE__ */ new WeakMap();
2382
2402
  function createRpcQueryHooks(useHost) {
2383
2403
  function useSubscription(host, pluginId, enabled) {
@@ -2389,8 +2409,11 @@ function createRpcQueryHooks(useHost) {
2389
2409
  const experimental_useRpcQuery = (options) => {
2390
2410
  const host = useHost();
2391
2411
  const pluginId = resolvePluginId(host, options.pluginId);
2392
- const input = jsonValueSchema.parse(options.input ?? null);
2393
- const queryKey = rpcQueryKey(pluginId, options.method, input);
2412
+ const input = useParsedRpcInput(options.input);
2413
+ const queryKey = useMemo2(
2414
+ () => rpcQueryKey(pluginId, options.method, input),
2415
+ [input, options.method, pluginId]
2416
+ );
2394
2417
  useSubscription(host, pluginId, options.enabled ?? true);
2395
2418
  const watchIdentity = canonicalPluginReadInput(input);
2396
2419
  useEffect2(() => {
@@ -2415,18 +2438,24 @@ function createRpcQueryHooks(useHost) {
2415
2438
  },
2416
2439
  host.queryClient
2417
2440
  );
2418
- return {
2419
- data: query.data?.result,
2420
- error: query.error === null ? null : experimental_PluginRpcCallError.from(
2421
- query.error,
2441
+ const { refetch: refetchQuery, error: queryError } = query;
2442
+ const refetch = useCallback2(async () => {
2443
+ await refetchQuery();
2444
+ }, [refetchQuery]);
2445
+ const error = useMemo2(
2446
+ () => queryError === null ? null : experimental_PluginRpcCallError.from(
2447
+ queryError,
2422
2448
  "invalid_response"
2423
2449
  ),
2424
- isLoading: (options.enabled ?? true) && query.isLoading,
2425
- isFetching: query.isFetching,
2426
- refetch: async () => {
2427
- await query.refetch();
2428
- }
2429
- };
2450
+ [queryError]
2451
+ );
2452
+ const data = query.data?.result;
2453
+ const isLoading = (options.enabled ?? true) && query.isLoading;
2454
+ const isFetching = query.isFetching;
2455
+ return useMemo2(
2456
+ () => ({ data, error, isLoading, isFetching, refetch }),
2457
+ [data, error, isFetching, isLoading, refetch]
2458
+ );
2430
2459
  };
2431
2460
  function experimental_useRpcKeyedQuery(options) {
2432
2461
  const host = useHost();
@@ -2532,11 +2561,14 @@ function createRpcQueryHooks(useHost) {
2532
2561
  },
2533
2562
  [current, keys]
2534
2563
  );
2535
- return {
2536
- ...query,
2537
- refetch,
2538
- refetchKeys
2539
- };
2564
+ return useMemo2(
2565
+ () => ({
2566
+ ...query,
2567
+ refetch,
2568
+ refetchKeys
2569
+ }),
2570
+ [query, refetch, refetchKeys]
2571
+ );
2540
2572
  }
2541
2573
  function experimental_useRpcMutation(options) {
2542
2574
  const host = useHost();
package/dist/process.js CHANGED
@@ -584,7 +584,7 @@ function spawnHostProcess(command, args = [], options = {}) {
584
584
  env: launch.env,
585
585
  windowsHide: options.windowsHide ?? true
586
586
  };
587
- if (process.platform === "win32" && !options.shell && /[\\/]/u.test(command)) {
587
+ if (process.platform === "win32" && !options.shell) {
588
588
  const parsed = parse(launch.command, launch.args, spawnOptions);
589
589
  return observe(
590
590
  parsed.file ? nodeSpawn(parsed.command, parsed.args, parsed.options) : nodeSpawn(launch.command, launch.args, spawnOptions)