@get-bb/plugin-sdk 0.6.90 → 0.6.99
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/bundled-types/bb-plugin-sdk-app.d.ts +312 -173
- package/bundled-types/bb-plugin-sdk-host.d.ts +64 -64
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +18 -8
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +15 -3
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +7 -7
- package/bundled-types/bb-plugin-sdk-internal-rpc-tags.d.ts +1 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +12 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +20 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +11 -8
- package/bundled-types/bb-plugin-sdk.d.ts +386 -235
- package/dist/app.js +8 -0
- package/dist/host.js +93 -1
- package/dist/internal/host-policy.js +1 -3
- package/dist/internal/plugin-app-collector.js +47 -10
- package/dist/internal/rpc-query-host.js +73 -51
- package/dist/process.js +100 -3
- package/dist/provider-bridge-acp-next.js +2275 -2034
- package/dist/provider-bridge-acp.js +2275 -2034
- package/dist/provider-bridge-testing.js +207 -132
- package/dist/provider-bridge-worker-entry.mjs +93 -1
- package/dist/provider-bridge.js +702 -596
- package/dist/testing/app.js +131 -64
- package/dist/testing/index.js +5 -4
- package/package.json +3 -3
package/dist/testing/app.js
CHANGED
|
@@ -987,13 +987,13 @@ async function invalidateTags(client, scope, tags) {
|
|
|
987
987
|
}
|
|
988
988
|
async function executeTaggedMutation(invalidate, call, prediction) {
|
|
989
989
|
const { result, invalidated } = await call();
|
|
990
|
-
prediction
|
|
990
|
+
prediction.accept(result);
|
|
991
991
|
const refresh = async () => {
|
|
992
992
|
try {
|
|
993
993
|
if (invalidate !== void 0 && invalidated.length > 0)
|
|
994
994
|
await invalidate(invalidated);
|
|
995
995
|
} finally {
|
|
996
|
-
prediction
|
|
996
|
+
prediction.settle();
|
|
997
997
|
}
|
|
998
998
|
};
|
|
999
999
|
void refresh().catch(() => {
|
|
@@ -1085,11 +1085,16 @@ function createTaggedKeyedQueryOwner(options) {
|
|
|
1085
1085
|
registerKeyedView(client, queryKey, keyedRowsView(collection));
|
|
1086
1086
|
const keys = /* @__PURE__ */ new Map();
|
|
1087
1087
|
let readingKeys = /* @__PURE__ */ new Set();
|
|
1088
|
+
let collecting = false;
|
|
1088
1089
|
let missingOnly = false;
|
|
1089
1090
|
let refreshAll = false;
|
|
1090
1091
|
const dirtyKeys = /* @__PURE__ */ new Set();
|
|
1091
|
-
const
|
|
1092
|
-
queueMicrotask(() =>
|
|
1092
|
+
const takeSubscribedKeys = (take) => new Promise((resolve) => {
|
|
1093
|
+
queueMicrotask(() => {
|
|
1094
|
+
readingKeys = new Set(take([...keys.keys()]));
|
|
1095
|
+
collecting = false;
|
|
1096
|
+
resolve([...readingKeys]);
|
|
1097
|
+
});
|
|
1093
1098
|
});
|
|
1094
1099
|
const observer = new QueryObserver(client, {
|
|
1095
1100
|
queryKey,
|
|
@@ -1116,23 +1121,26 @@ function createTaggedKeyedQueryOwner(options) {
|
|
|
1116
1121
|
const refreshedKeys = /* @__PURE__ */ new Set();
|
|
1117
1122
|
let refreshedAll = false;
|
|
1118
1123
|
return runTaggedRead(client, queryKey, async () => {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1124
|
+
collecting = true;
|
|
1125
|
+
let all = false;
|
|
1126
|
+
const requested = await takeSubscribedKeys((subscribed) => {
|
|
1127
|
+
all = refreshAll || refresh;
|
|
1128
|
+
refresh = false;
|
|
1129
|
+
const dirty = new Set(dirtyKeys);
|
|
1130
|
+
refreshedAll ||= all;
|
|
1131
|
+
if (all)
|
|
1132
|
+
for (const key of Object.keys(previous?.result ?? {}))
|
|
1133
|
+
dirtyKeys.add(key);
|
|
1134
|
+
refreshAll = false;
|
|
1135
|
+
const taken = subscribed.filter(
|
|
1136
|
+
(key) => all || dirty.has(key) || !Object.hasOwn(previous?.result ?? {}, key)
|
|
1137
|
+
);
|
|
1138
|
+
for (const key of taken) {
|
|
1139
|
+
refreshedKeys.add(key);
|
|
1140
|
+
dirtyKeys.delete(key);
|
|
1141
|
+
}
|
|
1142
|
+
return taken;
|
|
1143
|
+
});
|
|
1136
1144
|
const started = tick();
|
|
1137
1145
|
try {
|
|
1138
1146
|
const results = await Promise.all(
|
|
@@ -1188,13 +1196,15 @@ function createTaggedKeyedQueryOwner(options) {
|
|
|
1188
1196
|
let stop;
|
|
1189
1197
|
return {
|
|
1190
1198
|
observer,
|
|
1191
|
-
async
|
|
1199
|
+
async refresh(requested) {
|
|
1192
1200
|
const subscribed = requested.filter((key) => keys.has(key));
|
|
1193
1201
|
if (subscribed.length === 0) return;
|
|
1194
|
-
|
|
1195
|
-
|
|
1202
|
+
const fetching = observer.getCurrentQuery().state.fetchStatus === "fetching";
|
|
1203
|
+
const unread = fetching && !collecting ? subscribed.filter((key) => !readingKeys.has(key)) : subscribed;
|
|
1204
|
+
if (unread.length === 0) return;
|
|
1205
|
+
for (const key of unread) dirtyKeys.add(key);
|
|
1206
|
+
if (fetching && !collecting)
|
|
1196
1207
|
restartTaggedRead(observer.getCurrentQuery());
|
|
1197
|
-
}
|
|
1198
1208
|
await observer.refetch({ cancelRefetch: false });
|
|
1199
1209
|
},
|
|
1200
1210
|
subscribe(requested, listener) {
|
|
@@ -1216,7 +1226,7 @@ function createTaggedKeyedQueryOwner(options) {
|
|
|
1216
1226
|
}
|
|
1217
1227
|
if (added && pending.length > 0) {
|
|
1218
1228
|
if (observer.getCurrentResult().isFetching) {
|
|
1219
|
-
if (
|
|
1229
|
+
if (!collecting && pending.some((key) => !readingKeys.has(key)))
|
|
1220
1230
|
restartTaggedRead(observer.getCurrentQuery());
|
|
1221
1231
|
} else {
|
|
1222
1232
|
missingOnly = true;
|
|
@@ -1268,7 +1278,7 @@ function useQuerySelection(subscribe, getSnapshot, select) {
|
|
|
1268
1278
|
import { QueryClient } from "@tanstack/react-query";
|
|
1269
1279
|
|
|
1270
1280
|
// src/internal/rpc-query-host.ts
|
|
1271
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
1281
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
1272
1282
|
import { useIsFetching } from "@tanstack/react-query";
|
|
1273
1283
|
|
|
1274
1284
|
// ../domain/src/shared-types.ts
|
|
@@ -1498,7 +1508,7 @@ var sessionOptionSelectionsSchema = z2.record(
|
|
|
1498
1508
|
var runtimeThreadExecutionBaseOptionsSchema = z2.object({
|
|
1499
1509
|
model: z2.string().min(1),
|
|
1500
1510
|
serviceTier: serviceTierSchema,
|
|
1501
|
-
reasoningLevel: reasoningLevelSchema,
|
|
1511
|
+
reasoningLevel: reasoningLevelSchema.optional(),
|
|
1502
1512
|
promptMode: promptModeSchema.optional(),
|
|
1503
1513
|
sessionOptions: sessionOptionSelectionsSchema.optional(),
|
|
1504
1514
|
providerOptions: jsonObjectSchema
|
|
@@ -2024,6 +2034,7 @@ var SYSTEM_CHANGE_KINDS = [
|
|
|
2024
2034
|
"plugin-install-jobs-changed",
|
|
2025
2035
|
"plugin-update-jobs-changed",
|
|
2026
2036
|
"provider-registrations-changed",
|
|
2037
|
+
"ui-preferences-changed",
|
|
2027
2038
|
"environment-availability-changed",
|
|
2028
2039
|
"server-move-changed",
|
|
2029
2040
|
"app-update-changed"
|
|
@@ -2181,11 +2192,6 @@ var systemChangedMessageSchema = z17.object({
|
|
|
2181
2192
|
entity: z17.literal("system"),
|
|
2182
2193
|
changes: z17.array(systemChangeKindSchema).readonly()
|
|
2183
2194
|
}).strict();
|
|
2184
|
-
var tagsChangedMessageSchema = z17.object({
|
|
2185
|
-
type: z17.literal("changed"),
|
|
2186
|
-
entity: z17.literal("tags"),
|
|
2187
|
-
tags: z17.array(z17.string().min(1)).min(1)
|
|
2188
|
-
}).strict();
|
|
2189
2195
|
var pluginChangedMessageSchema = z17.object({
|
|
2190
2196
|
type: z17.literal("changed"),
|
|
2191
2197
|
entity: z17.literal("plugin"),
|
|
@@ -2198,7 +2204,6 @@ var changedMessageSchema = z17.discriminatedUnion("entity", [
|
|
|
2198
2204
|
environmentChangedMessageSchema,
|
|
2199
2205
|
hostChangedMessageSchema,
|
|
2200
2206
|
systemChangedMessageSchema,
|
|
2201
|
-
tagsChangedMessageSchema,
|
|
2202
2207
|
pluginChangedMessageSchema
|
|
2203
2208
|
]);
|
|
2204
2209
|
function lenientKinds(kinds) {
|
|
@@ -2258,7 +2263,6 @@ var changedMessageLenientSchema = z17.discriminatedUnion("entity", [
|
|
|
2258
2263
|
environmentChangedMessageLenientSchema,
|
|
2259
2264
|
hostChangedMessageLenientSchema,
|
|
2260
2265
|
systemChangedMessageLenientSchema,
|
|
2261
|
-
tagsChangedMessageSchema.strip(),
|
|
2262
2266
|
pluginChangedMessageSchema.strip()
|
|
2263
2267
|
]);
|
|
2264
2268
|
|
|
@@ -2286,6 +2290,8 @@ var rpcQueryKey = (pluginId, method, input) => [
|
|
|
2286
2290
|
input
|
|
2287
2291
|
];
|
|
2288
2292
|
var keyedQueryKey = (pluginId, method) => rpcQueryKey(pluginId, method, { keyed: true });
|
|
2293
|
+
var keyListSchema = z19.array(z19.string());
|
|
2294
|
+
var jsonRecordSchema = z19.record(z19.string(), jsonValueSchema);
|
|
2289
2295
|
var keyedCollections = /* @__PURE__ */ new Map();
|
|
2290
2296
|
function keyedCollection(pluginId, method) {
|
|
2291
2297
|
const name = JSON.stringify([pluginId, method]);
|
|
@@ -2420,7 +2426,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
2420
2426
|
const enabled = options.enabled ?? true;
|
|
2421
2427
|
const identity = JSON.stringify([...new Set(options.keys)].sort());
|
|
2422
2428
|
const keys = useMemo2(
|
|
2423
|
-
() =>
|
|
2429
|
+
() => keyListSchema.parse(JSON.parse(identity)),
|
|
2424
2430
|
[identity]
|
|
2425
2431
|
);
|
|
2426
2432
|
let cache = owners.get(host.queryClient);
|
|
@@ -2446,7 +2452,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
2446
2452
|
);
|
|
2447
2453
|
return {
|
|
2448
2454
|
...response,
|
|
2449
|
-
result:
|
|
2455
|
+
result: jsonRecordSchema.parse(response.result)
|
|
2450
2456
|
};
|
|
2451
2457
|
}
|
|
2452
2458
|
});
|
|
@@ -2455,8 +2461,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
2455
2461
|
const current = owner;
|
|
2456
2462
|
useSubscription(host, pluginId, enabled && keys.length > 0);
|
|
2457
2463
|
const subscribe = useCallback2(
|
|
2458
|
-
(listener) => enabled
|
|
2459
|
-
},
|
|
2464
|
+
(listener) => current.subscribe(enabled ? keys : [], listener),
|
|
2460
2465
|
[current, keys, enabled]
|
|
2461
2466
|
);
|
|
2462
2467
|
const getSnapshot = useCallback2(
|
|
@@ -2483,23 +2488,39 @@ function createRpcQueryHooks(useHost) {
|
|
|
2483
2488
|
[keys, enabled, selectRows]
|
|
2484
2489
|
);
|
|
2485
2490
|
const query = useQuerySelection(subscribe, getSnapshot, select);
|
|
2491
|
+
const watches = useMemo2(
|
|
2492
|
+
() => /* @__PURE__ */ new Map(),
|
|
2493
|
+
[host, pluginId, options.method]
|
|
2494
|
+
);
|
|
2495
|
+
useEffect2(
|
|
2496
|
+
() => () => {
|
|
2497
|
+
for (const release of watches.values()) release?.();
|
|
2498
|
+
watches.clear();
|
|
2499
|
+
},
|
|
2500
|
+
[watches]
|
|
2501
|
+
);
|
|
2486
2502
|
useEffect2(() => {
|
|
2487
|
-
|
|
2488
|
-
const
|
|
2489
|
-
(
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2503
|
+
const wanted = new Set(enabled ? keys : []);
|
|
2504
|
+
for (const [key, release] of watches) {
|
|
2505
|
+
if (wanted.has(key)) continue;
|
|
2506
|
+
release?.();
|
|
2507
|
+
watches.delete(key);
|
|
2508
|
+
}
|
|
2509
|
+
for (const key of wanted) {
|
|
2510
|
+
if (!watches.has(key))
|
|
2511
|
+
watches.set(key, host.watch?.(pluginId, options.method, { key }));
|
|
2512
|
+
}
|
|
2513
|
+
}, [host, pluginId, options.method, keys, enabled, watches]);
|
|
2514
|
+
const heldKeys = useRef2(keys);
|
|
2515
|
+
useEffect2(() => {
|
|
2516
|
+
heldKeys.current = keys;
|
|
2517
|
+
}, [keys]);
|
|
2495
2518
|
const refetch = useCallback2(async () => {
|
|
2496
|
-
await current.
|
|
2519
|
+
await current.refresh(heldKeys.current);
|
|
2497
2520
|
}, [current]);
|
|
2498
2521
|
const refetchKeys = useCallback2(
|
|
2499
2522
|
async (requested) => {
|
|
2500
|
-
await current.
|
|
2501
|
-
requested.filter((key) => keys.includes(key))
|
|
2502
|
-
);
|
|
2523
|
+
await current.refresh(requested.filter((key) => keys.includes(key)));
|
|
2503
2524
|
},
|
|
2504
2525
|
[current, keys]
|
|
2505
2526
|
);
|
|
@@ -2514,6 +2535,7 @@ function createRpcQueryHooks(useHost) {
|
|
|
2514
2535
|
const pluginId = resolvePluginId(host, options.pluginId);
|
|
2515
2536
|
const mutation = useTaggedMutation({
|
|
2516
2537
|
client: host.queryClient,
|
|
2538
|
+
meta: { showErrorToast: false },
|
|
2517
2539
|
invalidate: (tags) => invalidateTags(host.queryClient, pluginTagScope(pluginId), tags),
|
|
2518
2540
|
call: async (input) => {
|
|
2519
2541
|
const response = await callRpc(
|
|
@@ -2587,7 +2609,7 @@ import {
|
|
|
2587
2609
|
useLayoutEffect,
|
|
2588
2610
|
useEffect as useEffect3,
|
|
2589
2611
|
useMemo as useMemo3,
|
|
2590
|
-
useRef as
|
|
2612
|
+
useRef as useRef3,
|
|
2591
2613
|
useState as useState2,
|
|
2592
2614
|
useSyncExternalStore as useSyncExternalStore2
|
|
2593
2615
|
} from "react";
|
|
@@ -3826,6 +3848,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3826
3848
|
threadHeaderActions: [],
|
|
3827
3849
|
threadContextSegments: [],
|
|
3828
3850
|
threadInfoRows: [],
|
|
3851
|
+
threadRowMetadata: [],
|
|
3829
3852
|
threadInfoSections: [],
|
|
3830
3853
|
threadActions: [],
|
|
3831
3854
|
browserToolbarActions: [],
|
|
@@ -3836,6 +3859,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3836
3859
|
messageDirectives: [],
|
|
3837
3860
|
codeFenceRenderers: [],
|
|
3838
3861
|
messageActions: [],
|
|
3862
|
+
messageMetadata: [],
|
|
3839
3863
|
commandPaletteActions: [],
|
|
3840
3864
|
providerIcons: [],
|
|
3841
3865
|
icons: [],
|
|
@@ -3862,6 +3886,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3862
3886
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
3863
3887
|
threadContextSegment: /* @__PURE__ */ new Set(),
|
|
3864
3888
|
threadInfoRow: /* @__PURE__ */ new Set(),
|
|
3889
|
+
threadRowMetadata: /* @__PURE__ */ new Set(),
|
|
3865
3890
|
threadInfoSection: /* @__PURE__ */ new Set(),
|
|
3866
3891
|
threadAction: /* @__PURE__ */ new Set(),
|
|
3867
3892
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
@@ -3873,6 +3898,7 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3873
3898
|
codeFenceRenderer: /* @__PURE__ */ new Set(),
|
|
3874
3899
|
codeFenceLanguage: /* @__PURE__ */ new Set(),
|
|
3875
3900
|
messageAction: /* @__PURE__ */ new Set(),
|
|
3901
|
+
messageMetadata: /* @__PURE__ */ new Set(),
|
|
3876
3902
|
command: /* @__PURE__ */ new Set(),
|
|
3877
3903
|
providerIcon: /* @__PURE__ */ new Set(),
|
|
3878
3904
|
timelineRenderer: /* @__PURE__ */ new Set(),
|
|
@@ -3982,6 +4008,16 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
3982
4008
|
onWarning(`Legacy threadPanelAction ignored: ${String(error)}`);
|
|
3983
4009
|
}
|
|
3984
4010
|
},
|
|
4011
|
+
experimental_threadHeaderAction(registration) {
|
|
4012
|
+
const kind = "slots.experimental_threadHeaderAction";
|
|
4013
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4014
|
+
requireUniqueId(kind, seenIds.threadHeaderAction, id);
|
|
4015
|
+
collected.threadHeaderActions.push({
|
|
4016
|
+
id,
|
|
4017
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
4018
|
+
component: requireComponent(kind, registration.component)
|
|
4019
|
+
});
|
|
4020
|
+
},
|
|
3985
4021
|
experimental_sidebarHeader(registration) {
|
|
3986
4022
|
legacySidebarHeaders.push(
|
|
3987
4023
|
collectTitledComponent(
|
|
@@ -4187,16 +4223,6 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4187
4223
|
...headerComponent !== void 0 ? { headerComponent } : {}
|
|
4188
4224
|
});
|
|
4189
4225
|
},
|
|
4190
|
-
experimental_threadHeaderAction(registration) {
|
|
4191
|
-
const kind = "slots.experimental_threadHeaderAction";
|
|
4192
|
-
const id = requireSlotId(kind, registration?.id);
|
|
4193
|
-
requireUniqueId(kind, seenIds.threadHeaderAction, id);
|
|
4194
|
-
collected.threadHeaderActions.push({
|
|
4195
|
-
id,
|
|
4196
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
4197
|
-
component: requireComponent(kind, registration.component)
|
|
4198
|
-
});
|
|
4199
|
-
},
|
|
4200
4226
|
experimental_threadContextSegment(registration) {
|
|
4201
4227
|
const kind = "slots.experimental_threadContextSegment";
|
|
4202
4228
|
const id = requireSlotId(kind, registration?.id);
|
|
@@ -4230,6 +4256,19 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4230
4256
|
...registration.useVisible !== void 0 ? { useVisible: registration.useVisible } : {}
|
|
4231
4257
|
});
|
|
4232
4258
|
},
|
|
4259
|
+
experimental_threadRowMetadata(registration) {
|
|
4260
|
+
const kind = "slots.experimental_threadRowMetadata";
|
|
4261
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4262
|
+
requireUniqueId(kind, seenIds.threadRowMetadata, id);
|
|
4263
|
+
if (registration.useData !== void 0 && typeof registration.useData !== "function")
|
|
4264
|
+
throw new Error(`${kind}: "useData" must be a function`);
|
|
4265
|
+
collected.threadRowMetadata.push({
|
|
4266
|
+
id,
|
|
4267
|
+
...requireOptionalOrder(kind, registration.order),
|
|
4268
|
+
...registration.useData !== void 0 ? { useData: registration.useData } : {},
|
|
4269
|
+
component: requireComponent(kind, registration.component)
|
|
4270
|
+
});
|
|
4271
|
+
},
|
|
4233
4272
|
experimental_threadInfoRow(registration) {
|
|
4234
4273
|
const kind = "slots.experimental_threadInfoRow";
|
|
4235
4274
|
const id = requireSlotId(kind, registration?.id);
|
|
@@ -4267,12 +4306,16 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4267
4306
|
`${kind}: "experimental_bulkItem" must be a function`
|
|
4268
4307
|
);
|
|
4269
4308
|
}
|
|
4309
|
+
if (registration.placement !== void 0 && registration.placement !== "menu" && registration.placement !== "header") {
|
|
4310
|
+
throw new Error(`${kind}: "placement" must be "menu" or "header"`);
|
|
4311
|
+
}
|
|
4270
4312
|
collected.threadActions.push({
|
|
4271
4313
|
id,
|
|
4272
4314
|
title: requireNonEmptyString(kind, "title", registration.title),
|
|
4273
4315
|
icon: requireNonEmptyString(kind, "icon", registration.icon),
|
|
4274
4316
|
group: requireNonEmptyString(kind, "group", registration.group),
|
|
4275
4317
|
...requireOptionalOrder(kind, registration.order),
|
|
4318
|
+
...registration.placement !== void 0 ? { placement: registration.placement } : {},
|
|
4276
4319
|
...registration.useData !== void 0 ? { useData: registration.useData } : {},
|
|
4277
4320
|
item: registration.item,
|
|
4278
4321
|
...registration.experimental_bulkItem !== void 0 ? {
|
|
@@ -4395,6 +4438,22 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4395
4438
|
run: registration.run
|
|
4396
4439
|
});
|
|
4397
4440
|
},
|
|
4441
|
+
experimental_messageMetadata(registration) {
|
|
4442
|
+
const kind = "slots.experimental_messageMetadata";
|
|
4443
|
+
const id = requireSlotId(kind, registration?.id);
|
|
4444
|
+
requireUniqueId(kind, seenIds.messageMetadata, id);
|
|
4445
|
+
const placement = registration.placement ?? "above";
|
|
4446
|
+
if (placement !== "above" && placement !== "actionRow") {
|
|
4447
|
+
throw new Error(
|
|
4448
|
+
`${kind}: "placement" must be "above" or "actionRow"`
|
|
4449
|
+
);
|
|
4450
|
+
}
|
|
4451
|
+
collected.messageMetadata.push({
|
|
4452
|
+
id,
|
|
4453
|
+
placement,
|
|
4454
|
+
component: requireComponent(kind, registration.component)
|
|
4455
|
+
});
|
|
4456
|
+
},
|
|
4398
4457
|
commandPaletteAction(registration) {
|
|
4399
4458
|
registerCommand(registration);
|
|
4400
4459
|
},
|
|
@@ -4630,6 +4689,9 @@ function TestThreadStatusGlyph({
|
|
|
4630
4689
|
}
|
|
4631
4690
|
);
|
|
4632
4691
|
}
|
|
4692
|
+
function TestThreadRowMetadata({ thread }) {
|
|
4693
|
+
return /* @__PURE__ */ jsx("span", { "data-thread-row-metadata": thread.id });
|
|
4694
|
+
}
|
|
4633
4695
|
function SlotLifecycleGuard({
|
|
4634
4696
|
children,
|
|
4635
4697
|
onUnmount
|
|
@@ -4738,7 +4800,7 @@ function TestThreadActionsMenu({
|
|
|
4738
4800
|
onCloseAutoFocus
|
|
4739
4801
|
}) {
|
|
4740
4802
|
const menu = useTestMenuOpenState({ onOpenChange, onCloseAutoFocus });
|
|
4741
|
-
const triggerElement =
|
|
4803
|
+
const triggerElement = useRef3(null);
|
|
4742
4804
|
useLayoutEffect(() => {
|
|
4743
4805
|
const element = triggerElement.current;
|
|
4744
4806
|
if (element?.getAttribute("aria-haspopup") !== "menu") {
|
|
@@ -5426,7 +5488,7 @@ var testPluginSdkApp = {
|
|
|
5426
5488
|
},
|
|
5427
5489
|
useRealtime(channel, handler) {
|
|
5428
5490
|
const env = useSlotEnv("useRealtime");
|
|
5429
|
-
const handlerRef =
|
|
5491
|
+
const handlerRef = useRef3(handler);
|
|
5430
5492
|
useEffect3(() => {
|
|
5431
5493
|
handlerRef.current = handler;
|
|
5432
5494
|
});
|
|
@@ -5590,6 +5652,9 @@ var testPluginSdkApp = {
|
|
|
5590
5652
|
experimental_useTabVisible() {
|
|
5591
5653
|
return useSlotEnv("experimental_useTabVisible").tabVisible;
|
|
5592
5654
|
},
|
|
5655
|
+
experimental_useServers() {
|
|
5656
|
+
return useSlotEnv("experimental_useServers").servers;
|
|
5657
|
+
},
|
|
5593
5658
|
experimental_copyToClipboard(content) {
|
|
5594
5659
|
return activeClipboard?.(content) ?? Promise.resolve(true);
|
|
5595
5660
|
},
|
|
@@ -5692,6 +5757,7 @@ var testPluginSdkApp = {
|
|
|
5692
5757
|
},
|
|
5693
5758
|
ThreadTitle: TestThreadTitle,
|
|
5694
5759
|
experimental_ThreadStatusGlyph: TestThreadStatusGlyph,
|
|
5760
|
+
experimental_ThreadRowMetadata: TestThreadRowMetadata,
|
|
5695
5761
|
useEnvironmentProviders() {
|
|
5696
5762
|
return useSlotEnv("useEnvironmentProviders").environmentProviders;
|
|
5697
5763
|
},
|
|
@@ -6561,6 +6627,7 @@ ${block}
|
|
|
6561
6627
|
codeTheme,
|
|
6562
6628
|
canOpenFileExternally: options.canOpenFileExternally ?? (() => false),
|
|
6563
6629
|
tabVisible: options.tabVisible ?? true,
|
|
6630
|
+
servers: options.servers ?? null,
|
|
6564
6631
|
branchesState: {
|
|
6565
6632
|
branches: options.branchesState?.branches ?? [],
|
|
6566
6633
|
remoteBranches: options.branchesState?.remoteBranches ?? [],
|
package/dist/testing/index.js
CHANGED
|
@@ -2255,9 +2255,7 @@ function runPluginStorageMigrations(database, statements) {
|
|
|
2255
2255
|
if (!migrationColumns.some((column) => column.name === "statement_hash")) {
|
|
2256
2256
|
database.exec("ALTER TABLE _bb_migrations ADD COLUMN statement_hash TEXT");
|
|
2257
2257
|
}
|
|
2258
|
-
const rows = database.prepare(
|
|
2259
|
-
"SELECT id, statement_hash FROM _bb_migrations ORDER BY id"
|
|
2260
|
-
).all();
|
|
2258
|
+
const rows = database.prepare("SELECT id, statement_hash FROM _bb_migrations ORDER BY id").all();
|
|
2261
2259
|
const applied = /* @__PURE__ */ new Map();
|
|
2262
2260
|
for (const row of rows) applied.set(row.id, row.statement_hash);
|
|
2263
2261
|
const statementHashes = statements.map(migrationStatementHash);
|
|
@@ -3905,9 +3903,11 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3905
3903
|
installHandlers.push(handler);
|
|
3906
3904
|
}
|
|
3907
3905
|
};
|
|
3906
|
+
const hostLifetime = new AbortController();
|
|
3908
3907
|
async function disposeHost(cleanupStorage) {
|
|
3909
3908
|
if (disposed) return;
|
|
3910
3909
|
disposed = true;
|
|
3910
|
+
hostLifetime.abort();
|
|
3911
3911
|
for (const [id, pending] of pendingInteractions) {
|
|
3912
3912
|
clearTimeout(pending.timer);
|
|
3913
3913
|
pendingInteractions.delete(id);
|
|
@@ -4170,7 +4170,8 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
4170
4170
|
result = await record.handler(validatedInput, {
|
|
4171
4171
|
experimental_caller: options2.experimental_caller ?? {
|
|
4172
4172
|
kind: "client"
|
|
4173
|
-
}
|
|
4173
|
+
},
|
|
4174
|
+
experimental_signal: options2.signal === void 0 ? hostLifetime.signal : AbortSignal.any([options2.signal, hostLifetime.signal])
|
|
4174
4175
|
});
|
|
4175
4176
|
} catch (error) {
|
|
4176
4177
|
const refusal = readPluginRpcRefusal(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@get-bb/plugin-sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.99",
|
|
4
4
|
"homepage": "https://github.com/get-bb/bb#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/get-bb/bb/issues"
|
|
@@ -151,9 +151,9 @@
|
|
|
151
151
|
"scripts": {
|
|
152
152
|
"build": "node scripts/build-runtime.mjs",
|
|
153
153
|
"build:runtime": "node scripts/build-runtime.mjs",
|
|
154
|
-
"build:types": "node scripts/build-bundled-dts.mjs",
|
|
154
|
+
"build:types": "node --max-semi-space-size=128 --max-old-space-size=4096 scripts/build-bundled-dts.mjs",
|
|
155
155
|
"clean": "rimraf bundled-types dist tsconfig.tsbuildinfo",
|
|
156
|
-
"prepack": "node scripts/build-bundled-dts.mjs && node scripts/build-runtime.mjs",
|
|
156
|
+
"prepack": "node --max-semi-space-size=128 --max-old-space-size=4096 scripts/build-bundled-dts.mjs && node scripts/build-runtime.mjs",
|
|
157
157
|
"test": "vitest run --config vitest.config.ts",
|
|
158
158
|
"typecheck": "tsrs --noEmit"
|
|
159
159
|
},
|