@get-bb/plugin-sdk 0.6.52 → 0.6.59
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 +444 -13
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-host.d.ts +11 -2
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +7 -3
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +72 -11
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +27 -7
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +30 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +42 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +30 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk.d.ts +446 -14
- package/dist/app.js +12 -0
- package/dist/host.js +150 -5
- package/dist/internal/plugin-app-collector.js +89 -15
- package/dist/provider-bridge-acp-next.js +314 -81
- package/dist/provider-bridge-acp.js +6733 -632
- package/dist/provider-bridge-testing.js +77 -32
- package/dist/provider-bridge-worker-entry.mjs +136 -5
- package/dist/provider-bridge.js +196 -8
- package/dist/testing/app.js +169 -15
- package/dist/testing/index.js +1 -0
- package/package.json +1 -2
package/dist/provider-bridge.js
CHANGED
|
@@ -2260,6 +2260,7 @@ var systemMessageKindValues = [
|
|
|
2260
2260
|
"child-interrupted",
|
|
2261
2261
|
"child-outcome-batch",
|
|
2262
2262
|
"tool-result-delivered",
|
|
2263
|
+
"environment-directory-updated",
|
|
2263
2264
|
"unlabeled"
|
|
2264
2265
|
];
|
|
2265
2266
|
var systemMessageKindSchema = z14.enum(systemMessageKindValues);
|
|
@@ -2293,6 +2294,10 @@ var systemMessageSubjectSchema = z14.discriminatedUnion("kind", [
|
|
|
2293
2294
|
kind: z14.literal("tool-call"),
|
|
2294
2295
|
toolName: z14.string(),
|
|
2295
2296
|
suppress: z14.boolean()
|
|
2297
|
+
}),
|
|
2298
|
+
z14.object({
|
|
2299
|
+
kind: z14.literal("directory"),
|
|
2300
|
+
path: z14.string()
|
|
2296
2301
|
})
|
|
2297
2302
|
]);
|
|
2298
2303
|
|
|
@@ -2536,6 +2541,7 @@ var threadEventScopeDefinitionByType = {
|
|
|
2536
2541
|
},
|
|
2537
2542
|
"turn/plan/updated": { policy: "turn" },
|
|
2538
2543
|
"turn/diff/updated": { policy: "turn" },
|
|
2544
|
+
"turn/mainRun/updated": { policy: "turn" },
|
|
2539
2545
|
"provider/error": {
|
|
2540
2546
|
policy: "thread-or-turn",
|
|
2541
2547
|
rationale: "Provider diagnostics use thread scope for provider setup/session failures; in-turn failures use turn scope."
|
|
@@ -2910,6 +2916,7 @@ var threadEventBackgroundTaskItemSchema = z18.object({
|
|
|
2910
2916
|
status: threadEventItemStatusSchema,
|
|
2911
2917
|
taskStatus: backgroundTaskStatusSchema,
|
|
2912
2918
|
skipTranscript: z18.boolean(),
|
|
2919
|
+
foreground: z18.boolean(),
|
|
2913
2920
|
workflowName: z18.string().optional(),
|
|
2914
2921
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2915
2922
|
usage: backgroundTaskUsageSchema.optional(),
|
|
@@ -2954,6 +2961,7 @@ var threadEventItemSchema = z18.discriminatedUnion("type", [
|
|
|
2954
2961
|
changes: z18.array(threadEventFileChangeSchema),
|
|
2955
2962
|
status: threadEventItemStatusSchema,
|
|
2956
2963
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
2964
|
+
error: z18.string().optional(),
|
|
2957
2965
|
...itemPresentationField,
|
|
2958
2966
|
parentToolCallId: z18.string().optional()
|
|
2959
2967
|
}),
|
|
@@ -3154,6 +3162,12 @@ var unscopedProviderEventSchema = z18.discriminatedUnion("type", [
|
|
|
3154
3162
|
plan: z18.array(threadEventPlanStepSchema),
|
|
3155
3163
|
explanation: z18.string().optional()
|
|
3156
3164
|
}),
|
|
3165
|
+
z18.object({
|
|
3166
|
+
type: z18.literal("turn/mainRun/updated"),
|
|
3167
|
+
threadId: z18.string(),
|
|
3168
|
+
providerThreadId: z18.string(),
|
|
3169
|
+
state: z18.enum(["idle", "running"])
|
|
3170
|
+
}),
|
|
3157
3171
|
z18.object({
|
|
3158
3172
|
type: z18.literal("turn/diff/updated"),
|
|
3159
3173
|
threadId: z18.string(),
|
|
@@ -10933,8 +10947,157 @@ var {
|
|
|
10933
10947
|
getCancelSignal: getCancelSignal2
|
|
10934
10948
|
} = getIpcExport();
|
|
10935
10949
|
|
|
10950
|
+
// ../process-utils/src/vcs-process-scheduler.ts
|
|
10951
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10952
|
+
import { availableParallelism } from "node:os";
|
|
10953
|
+
var ranks = { interactive: 0, status: 1, background: 2 };
|
|
10954
|
+
function localProcessCapacities(parallelism) {
|
|
10955
|
+
const total = Math.min(6, Math.max(4, parallelism - 2));
|
|
10956
|
+
return [total, total - 1, total - 2];
|
|
10957
|
+
}
|
|
10958
|
+
var capacities = {
|
|
10959
|
+
local: localProcessCapacities(availableParallelism()),
|
|
10960
|
+
network: [4, 3, 2]
|
|
10961
|
+
};
|
|
10962
|
+
var githubCapacity = 2;
|
|
10963
|
+
var agingMs = 15e3;
|
|
10964
|
+
var networkGitSubcommands = /* @__PURE__ */ new Set([
|
|
10965
|
+
"fetch",
|
|
10966
|
+
"pull",
|
|
10967
|
+
"push",
|
|
10968
|
+
"clone",
|
|
10969
|
+
"ls-remote"
|
|
10970
|
+
]);
|
|
10971
|
+
var gitGlobalOptionsWithValue = /* @__PURE__ */ new Set([
|
|
10972
|
+
"-C",
|
|
10973
|
+
"-c",
|
|
10974
|
+
"--git-dir",
|
|
10975
|
+
"--work-tree",
|
|
10976
|
+
"--namespace",
|
|
10977
|
+
"--config-env"
|
|
10978
|
+
]);
|
|
10979
|
+
function isNetworkGitCommand(args) {
|
|
10980
|
+
let index = 0;
|
|
10981
|
+
while (index < args.length && args[index].startsWith("-")) {
|
|
10982
|
+
index += gitGlobalOptionsWithValue.has(args[index]) ? 2 : 1;
|
|
10983
|
+
}
|
|
10984
|
+
const subcommand = args[index];
|
|
10985
|
+
if (subcommand === void 0) return false;
|
|
10986
|
+
if (networkGitSubcommands.has(subcommand)) return true;
|
|
10987
|
+
const action = args.slice(index + 1).find((arg) => !arg.startsWith("-"));
|
|
10988
|
+
return (subcommand === "submodule" || subcommand === "remote") && action === "update";
|
|
10989
|
+
}
|
|
10990
|
+
var VcsProcessScheduler = class {
|
|
10991
|
+
priority = new AsyncLocalStorage();
|
|
10992
|
+
admitted = new AsyncLocalStorage();
|
|
10993
|
+
active = { local: 0, network: 0 };
|
|
10994
|
+
githubActive = 0;
|
|
10995
|
+
queue = [];
|
|
10996
|
+
timer;
|
|
10997
|
+
acquire(command, args, options) {
|
|
10998
|
+
const pool = command === "gh" || isNetworkGitCommand(args) ? "network" : "local";
|
|
10999
|
+
const slots = options.slots ?? 1;
|
|
11000
|
+
if (!Number.isInteger(slots) || slots < 1 || slots > capacities[pool][ranks.background]) {
|
|
11001
|
+
return Promise.reject(new Error("Invalid VCS process slot count"));
|
|
11002
|
+
}
|
|
11003
|
+
if (options.signal?.aborted) {
|
|
11004
|
+
return Promise.reject(this.abortError(options.signal));
|
|
11005
|
+
}
|
|
11006
|
+
return new Promise((grant, reject) => {
|
|
11007
|
+
const waiter = {
|
|
11008
|
+
command,
|
|
11009
|
+
pool,
|
|
11010
|
+
priority: options.priority ?? this.priority.getStore() ?? "status",
|
|
11011
|
+
slots,
|
|
11012
|
+
queuedAt: performance.now(),
|
|
11013
|
+
signal: options.signal,
|
|
11014
|
+
grant,
|
|
11015
|
+
onAbort: () => {
|
|
11016
|
+
const index = this.queue.indexOf(waiter);
|
|
11017
|
+
if (index === -1) return;
|
|
11018
|
+
this.queue.splice(index, 1);
|
|
11019
|
+
reject(this.abortError(options.signal));
|
|
11020
|
+
this.drain();
|
|
11021
|
+
}
|
|
11022
|
+
};
|
|
11023
|
+
this.queue.push(waiter);
|
|
11024
|
+
options.signal?.addEventListener("abort", waiter.onAbort, { once: true });
|
|
11025
|
+
this.drain();
|
|
11026
|
+
});
|
|
11027
|
+
}
|
|
11028
|
+
abortError(signal) {
|
|
11029
|
+
return Object.assign(
|
|
11030
|
+
new Error("The operation was aborted", { cause: signal?.reason }),
|
|
11031
|
+
{
|
|
11032
|
+
name: "AbortError",
|
|
11033
|
+
code: "ABORT_ERR"
|
|
11034
|
+
}
|
|
11035
|
+
);
|
|
11036
|
+
}
|
|
11037
|
+
rank(waiter) {
|
|
11038
|
+
return Math.max(
|
|
11039
|
+
0,
|
|
11040
|
+
ranks[waiter.priority] - Math.floor((performance.now() - waiter.queuedAt) / agingMs)
|
|
11041
|
+
);
|
|
11042
|
+
}
|
|
11043
|
+
drain() {
|
|
11044
|
+
clearTimeout(this.timer);
|
|
11045
|
+
this.queue.sort(
|
|
11046
|
+
(a2, b) => this.rank(a2) - this.rank(b) || a2.queuedAt - b.queuedAt
|
|
11047
|
+
);
|
|
11048
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
11049
|
+
for (let index = 0; index < this.queue.length; ) {
|
|
11050
|
+
const waiter = this.queue[index];
|
|
11051
|
+
if (blocked.has(waiter.pool) || waiter.command === "gh" && this.githubActive + waiter.slots > githubCapacity) {
|
|
11052
|
+
index += 1;
|
|
11053
|
+
continue;
|
|
11054
|
+
}
|
|
11055
|
+
if (this.active[waiter.pool] + waiter.slots > capacities[waiter.pool][this.rank(waiter)]) {
|
|
11056
|
+
blocked.add(waiter.pool);
|
|
11057
|
+
index += 1;
|
|
11058
|
+
continue;
|
|
11059
|
+
}
|
|
11060
|
+
this.queue.splice(index, 1);
|
|
11061
|
+
waiter.signal?.removeEventListener("abort", waiter.onAbort);
|
|
11062
|
+
this.active[waiter.pool] += waiter.slots;
|
|
11063
|
+
if (waiter.command === "gh") this.githubActive += waiter.slots;
|
|
11064
|
+
let released = false;
|
|
11065
|
+
waiter.grant(() => {
|
|
11066
|
+
if (released) return;
|
|
11067
|
+
released = true;
|
|
11068
|
+
this.active[waiter.pool] -= waiter.slots;
|
|
11069
|
+
if (waiter.command === "gh") this.githubActive -= waiter.slots;
|
|
11070
|
+
this.drain();
|
|
11071
|
+
});
|
|
11072
|
+
}
|
|
11073
|
+
if (this.queue.length > 0) {
|
|
11074
|
+
const delay = Math.min(
|
|
11075
|
+
...this.queue.map(
|
|
11076
|
+
(waiter) => agingMs - (performance.now() - waiter.queuedAt) % agingMs
|
|
11077
|
+
)
|
|
11078
|
+
);
|
|
11079
|
+
this.timer = setTimeout(() => this.drain(), delay);
|
|
11080
|
+
}
|
|
11081
|
+
}
|
|
11082
|
+
};
|
|
11083
|
+
var registry = globalThis;
|
|
11084
|
+
var scheduler3 = registry.__bbVcsProcessScheduler ??= new VcsProcessScheduler();
|
|
11085
|
+
async function runVcsProcess(command, args, operation, options = {}) {
|
|
11086
|
+
if (scheduler3.admitted.getStore()) {
|
|
11087
|
+
options.signal?.throwIfAborted();
|
|
11088
|
+
return operation();
|
|
11089
|
+
}
|
|
11090
|
+
const release = await scheduler3.acquire(command, args, options);
|
|
11091
|
+
try {
|
|
11092
|
+
options.signal?.throwIfAborted();
|
|
11093
|
+
return await scheduler3.admitted.run(true, operation);
|
|
11094
|
+
} finally {
|
|
11095
|
+
release();
|
|
11096
|
+
}
|
|
11097
|
+
}
|
|
11098
|
+
|
|
10936
11099
|
// ../process-utils/src/exec-portable-file.ts
|
|
10937
|
-
import { extname as extname2 } from "node:path";
|
|
11100
|
+
import { basename, extname as extname2 } from "node:path";
|
|
10938
11101
|
|
|
10939
11102
|
// ../../node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js
|
|
10940
11103
|
import fs from "node:fs";
|
|
@@ -11021,6 +11184,21 @@ function whichCommandSync(command, options = {}) {
|
|
|
11021
11184
|
|
|
11022
11185
|
// ../process-utils/src/exec-portable-file.ts
|
|
11023
11186
|
async function execPortableFile(command, args, options) {
|
|
11187
|
+
const executable = basename(command).toLowerCase().replace(/\.(exe|cmd|bat)$/u, "");
|
|
11188
|
+
if (executable === "git" || executable === "gh") {
|
|
11189
|
+
return runVcsProcess(
|
|
11190
|
+
executable,
|
|
11191
|
+
args,
|
|
11192
|
+
() => execPortableFileUnbounded(command, args, options),
|
|
11193
|
+
{
|
|
11194
|
+
priority: options.priority,
|
|
11195
|
+
signal: options.signal
|
|
11196
|
+
}
|
|
11197
|
+
);
|
|
11198
|
+
}
|
|
11199
|
+
return execPortableFileUnbounded(command, args, options);
|
|
11200
|
+
}
|
|
11201
|
+
async function execPortableFileUnbounded(command, args, options) {
|
|
11024
11202
|
if (options.signal?.aborted) throw options.signal.reason;
|
|
11025
11203
|
if (process.platform === "win32") {
|
|
11026
11204
|
const envKeys = Object.keys(options.env).sort();
|
|
@@ -11146,11 +11324,6 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
11146
11324
|
import { promisify as promisify3 } from "node:util";
|
|
11147
11325
|
var execFileAsync = promisify3(execFile2);
|
|
11148
11326
|
|
|
11149
|
-
// ../process-utils/src/performance-diagnostics.ts
|
|
11150
|
-
import { Session } from "node:inspector/promises";
|
|
11151
|
-
var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
|
|
11152
|
-
var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
|
|
11153
|
-
|
|
11154
11327
|
// ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
|
|
11155
11328
|
var import_compare = __toESM(require_compare(), 1);
|
|
11156
11329
|
var import_valid = __toESM(require_valid(), 1);
|
|
@@ -11398,7 +11571,8 @@ var bridgeCapabilitiesSchema = z29.object({
|
|
|
11398
11571
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
11399
11572
|
]),
|
|
11400
11573
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
11401
|
-
skills: z29.object({ configure: z29.boolean().default(false) }).default({ configure: false })
|
|
11574
|
+
skills: z29.object({ configure: z29.boolean().default(false) }).default({ configure: false }),
|
|
11575
|
+
commands: z29.object({ list: z29.boolean().default(false) }).default({ list: false })
|
|
11402
11576
|
}).passthrough();
|
|
11403
11577
|
var initializeParamsSchema = z29.object({
|
|
11404
11578
|
protocolVersion: z29.number().int().positive(),
|
|
@@ -11570,6 +11744,7 @@ import { z as z32 } from "zod";
|
|
|
11570
11744
|
var BRIDGE_REQUEST_METHODS = {
|
|
11571
11745
|
initialize: "initialize",
|
|
11572
11746
|
modelList: "model/list",
|
|
11747
|
+
commandList: "commands/list",
|
|
11573
11748
|
providerHealth: "provider/health",
|
|
11574
11749
|
providerUsage: "provider/usage",
|
|
11575
11750
|
providerInstallationStatus: "provider/installation/status",
|
|
@@ -11595,7 +11770,12 @@ var sessionConstructionFields = {
|
|
|
11595
11770
|
disallowedTools: z32.array(z32.string().min(1)).optional(),
|
|
11596
11771
|
instructionMode: instructionModeSchema
|
|
11597
11772
|
};
|
|
11598
|
-
var modelListParamsSchema = z32.object({
|
|
11773
|
+
var modelListParamsSchema = z32.object({
|
|
11774
|
+
cwd: z32.string().min(1).optional(),
|
|
11775
|
+
envVars: z32.record(z32.string(), z32.string()).optional()
|
|
11776
|
+
}).passthrough();
|
|
11777
|
+
var commandListParamsSchema = z32.object({ cwd: z32.string().min(1) }).passthrough();
|
|
11778
|
+
var commandListResultSchema = threadProviderCommandsStateSchema;
|
|
11599
11779
|
var threadStartParamsSchema = z32.object({
|
|
11600
11780
|
...sessionConstructionFields,
|
|
11601
11781
|
input: z32.array(promptInputSchema).optional()
|
|
@@ -11719,6 +11899,7 @@ var deltaBackgroundTaskShapeSchema = z34.object({
|
|
|
11719
11899
|
status: threadEventItemStatusSchema,
|
|
11720
11900
|
taskStatus: backgroundTaskStatusSchema,
|
|
11721
11901
|
skipTranscript: z34.boolean(),
|
|
11902
|
+
foreground: z34.boolean().optional(),
|
|
11722
11903
|
workflowName: z34.string().optional(),
|
|
11723
11904
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
11724
11905
|
usage: backgroundTaskUsageSchema.optional(),
|
|
@@ -11853,6 +12034,10 @@ var threadDeltaSchema = z34.discriminatedUnion("kind", [
|
|
|
11853
12034
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
11854
12035
|
parentRef: deltaKeyPartSchema.optional()
|
|
11855
12036
|
}),
|
|
12037
|
+
z34.object({
|
|
12038
|
+
kind: z34.literal("turn.mainRun"),
|
|
12039
|
+
state: z34.enum(["idle", "running"])
|
|
12040
|
+
}),
|
|
11856
12041
|
z34.object({
|
|
11857
12042
|
kind: z34.literal("turn.boundary"),
|
|
11858
12043
|
status: threadEventTurnStatusSchema,
|
|
@@ -12124,6 +12309,7 @@ export {
|
|
|
12124
12309
|
LOW_REASONING_EFFORT,
|
|
12125
12310
|
MAX_REASONING_EFFORT,
|
|
12126
12311
|
MEDIUM_REASONING_EFFORT,
|
|
12312
|
+
PLUGIN_INTERACTION_MAX_TITLE_LENGTH,
|
|
12127
12313
|
PROVIDER_BRIDGE_EXPORT_NAME,
|
|
12128
12314
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
12129
12315
|
ProviderRequestDecodeError,
|
|
@@ -12151,6 +12337,8 @@ export {
|
|
|
12151
12337
|
buildShellEnvOverrides,
|
|
12152
12338
|
claudeTaskToolNameSchema,
|
|
12153
12339
|
claudeTaskToolOutputSchema,
|
|
12340
|
+
commandListParamsSchema,
|
|
12341
|
+
commandListResultSchema,
|
|
12154
12342
|
contextSnapshotSchema,
|
|
12155
12343
|
createBridgeIo,
|
|
12156
12344
|
createBridgeLineHandler,
|
package/dist/testing/app.js
CHANGED
|
@@ -1098,21 +1098,30 @@ var NAV_PANEL_REGISTRATION_KEYS = new Set(
|
|
|
1098
1098
|
path: true,
|
|
1099
1099
|
component: true,
|
|
1100
1100
|
fixedTabs: true,
|
|
1101
|
-
|
|
1101
|
+
experimental_useBadge: true,
|
|
1102
1102
|
headerContent: true
|
|
1103
1103
|
})
|
|
1104
1104
|
);
|
|
1105
1105
|
var RENAMED_NAV_PANEL_KEYS = /* @__PURE__ */ new Map([
|
|
1106
|
-
["experimental_fixedTabs", "fixedTabs"]
|
|
1106
|
+
["experimental_fixedTabs", 'was renamed to "fixedTabs" in SDK 0.4.16']
|
|
1107
1107
|
]);
|
|
1108
|
-
|
|
1108
|
+
var RETIRED_NAV_PANEL_KEYS = /* @__PURE__ */ new Map([
|
|
1109
|
+
[
|
|
1110
|
+
"experimental_sidebarAccessory",
|
|
1111
|
+
'is ignored: it was replaced by "experimental_useBadge", a hook returning a badge value, in SDK 0.6.53'
|
|
1112
|
+
]
|
|
1113
|
+
]);
|
|
1114
|
+
function checkStaleNavPanelKeys(kind, registration, onWarning) {
|
|
1109
1115
|
for (const key of Object.keys(registration)) {
|
|
1110
1116
|
if (NAV_PANEL_REGISTRATION_KEYS.has(key)) continue;
|
|
1111
|
-
const
|
|
1112
|
-
if (
|
|
1113
|
-
throw new Error(
|
|
1114
|
-
|
|
1115
|
-
|
|
1117
|
+
const renamed = RENAMED_NAV_PANEL_KEYS.get(key);
|
|
1118
|
+
if (renamed !== void 0) {
|
|
1119
|
+
throw new Error(`${kind}: "${key}" ${renamed}`);
|
|
1120
|
+
}
|
|
1121
|
+
const retired = RETIRED_NAV_PANEL_KEYS.get(key);
|
|
1122
|
+
if (retired !== void 0) {
|
|
1123
|
+
onWarning(`${kind}: "${key}" ${retired}`);
|
|
1124
|
+
continue;
|
|
1116
1125
|
}
|
|
1117
1126
|
if (key.startsWith("experimental_")) {
|
|
1118
1127
|
throw new Error(`${kind}: unknown field "${key}"`);
|
|
@@ -1174,7 +1183,7 @@ function collectPanelAction(kind, seen, registration) {
|
|
|
1174
1183
|
...registration.run !== void 0 ? { run: registration.run } : {}
|
|
1175
1184
|
};
|
|
1176
1185
|
}
|
|
1177
|
-
function collectPluginAppRegistrations(definition,
|
|
1186
|
+
function collectPluginAppRegistrations(definition, onWarning = (message) => console.warn(message)) {
|
|
1178
1187
|
const sidebarFooterItems = [];
|
|
1179
1188
|
const collected = {
|
|
1180
1189
|
homepageSections: [],
|
|
@@ -1188,6 +1197,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1188
1197
|
sidebarFooterActions: [],
|
|
1189
1198
|
experimentalSidebarFooterItems: [],
|
|
1190
1199
|
threadLists: [],
|
|
1200
|
+
experimentalSidebarNavigations: [],
|
|
1191
1201
|
threadHeaderActions: [],
|
|
1192
1202
|
threadActions: [],
|
|
1193
1203
|
browserToolbarActions: [],
|
|
@@ -1218,6 +1228,8 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1218
1228
|
pendingInteraction: /* @__PURE__ */ new Set(),
|
|
1219
1229
|
sidebarFooterItem: /* @__PURE__ */ new Set(),
|
|
1220
1230
|
threadList: /* @__PURE__ */ new Set(),
|
|
1231
|
+
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
1232
|
+
sidebarHeader: /* @__PURE__ */ new Set(),
|
|
1221
1233
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
1222
1234
|
threadAction: /* @__PURE__ */ new Set(),
|
|
1223
1235
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
@@ -1267,9 +1279,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1267
1279
|
run: registration.run
|
|
1268
1280
|
});
|
|
1269
1281
|
}
|
|
1282
|
+
const legacySidebarHeaders = [];
|
|
1283
|
+
const legacySlotAliases = {
|
|
1284
|
+
experimental_sidebarHeader(registration) {
|
|
1285
|
+
legacySidebarHeaders.push(
|
|
1286
|
+
collectTitledComponent(
|
|
1287
|
+
"slots.experimental_sidebarHeader",
|
|
1288
|
+
seenIds.sidebarHeader,
|
|
1289
|
+
registration
|
|
1290
|
+
).component
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1270
1294
|
definition.setup({
|
|
1271
1295
|
commands: { register: registerCommand },
|
|
1272
1296
|
slots: {
|
|
1297
|
+
...legacySlotAliases,
|
|
1273
1298
|
homepageSection(registration) {
|
|
1274
1299
|
const kind = "slots.homepageSection";
|
|
1275
1300
|
const id = requireSlotId(kind, registration?.id);
|
|
@@ -1315,7 +1340,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1315
1340
|
const kind = "slots.navPanel";
|
|
1316
1341
|
const id = requireSlotId(kind, registration?.id);
|
|
1317
1342
|
requireUniqueId(kind, seenIds.navPanel, id);
|
|
1318
|
-
|
|
1343
|
+
checkStaleNavPanelKeys(kind, registration, onWarning);
|
|
1319
1344
|
const panelId = id;
|
|
1320
1345
|
const path = requireNonEmptyString(kind, "path", registration.path);
|
|
1321
1346
|
if (!PLUGIN_SLOT_ID_PATTERN.test(path)) {
|
|
@@ -1328,9 +1353,9 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1328
1353
|
`${kind}: "headerContent" must be a React component function when set`
|
|
1329
1354
|
);
|
|
1330
1355
|
}
|
|
1331
|
-
if (registration.
|
|
1356
|
+
if (registration.experimental_useBadge !== void 0 && typeof registration.experimental_useBadge !== "function") {
|
|
1332
1357
|
throw new Error(
|
|
1333
|
-
`${kind}: "
|
|
1358
|
+
`${kind}: "experimental_useBadge" must be a React hook function when set`
|
|
1334
1359
|
);
|
|
1335
1360
|
}
|
|
1336
1361
|
const fixedTabs = (() => {
|
|
@@ -1390,8 +1415,8 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1390
1415
|
path,
|
|
1391
1416
|
component: requireComponent(kind, registration.component),
|
|
1392
1417
|
...fixedTabs.length > 0 ? { fixedTabs } : {},
|
|
1393
|
-
...registration.
|
|
1394
|
-
|
|
1418
|
+
...registration.experimental_useBadge !== void 0 ? {
|
|
1419
|
+
experimental_useBadge: registration.experimental_useBadge
|
|
1395
1420
|
} : {},
|
|
1396
1421
|
...registration.headerContent !== void 0 ? { headerContent: registration.headerContent } : {}
|
|
1397
1422
|
});
|
|
@@ -1448,6 +1473,29 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1448
1473
|
)
|
|
1449
1474
|
);
|
|
1450
1475
|
},
|
|
1476
|
+
experimental_sidebarNavigation(registration) {
|
|
1477
|
+
const kind = "slots.experimental_sidebarNavigation";
|
|
1478
|
+
const collectedRegistration = collectTitledComponent(
|
|
1479
|
+
kind,
|
|
1480
|
+
seenIds.sidebarNavigation,
|
|
1481
|
+
registration
|
|
1482
|
+
);
|
|
1483
|
+
const placement = registration.placement;
|
|
1484
|
+
if (placement !== void 0 && placement !== "rail" && placement !== "list") {
|
|
1485
|
+
throw new Error(`${kind}: "placement" must be "rail" or "list"`);
|
|
1486
|
+
}
|
|
1487
|
+
const headerComponent = registration.headerComponent;
|
|
1488
|
+
if (headerComponent !== void 0 && typeof headerComponent !== "function") {
|
|
1489
|
+
throw new Error(
|
|
1490
|
+
`${kind}: "headerComponent" must be a React component function`
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
collected.experimentalSidebarNavigations.push({
|
|
1494
|
+
...collectedRegistration,
|
|
1495
|
+
placement: placement ?? "list",
|
|
1496
|
+
...headerComponent !== void 0 ? { headerComponent } : {}
|
|
1497
|
+
});
|
|
1498
|
+
},
|
|
1451
1499
|
experimental_threadHeaderAction(registration) {
|
|
1452
1500
|
const kind = "slots.experimental_threadHeaderAction";
|
|
1453
1501
|
const id = requireSlotId(kind, registration?.id);
|
|
@@ -1657,7 +1705,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1657
1705
|
const customization = collectComposerCustomization(
|
|
1658
1706
|
registration,
|
|
1659
1707
|
seenIds.composerCustomization,
|
|
1660
|
-
|
|
1708
|
+
(reason) => onWarning(`composer customization rejected: ${reason}`),
|
|
1661
1709
|
seenIds.composerPopup
|
|
1662
1710
|
);
|
|
1663
1711
|
if (customization !== null) {
|
|
@@ -1697,11 +1745,50 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1697
1745
|
}
|
|
1698
1746
|
}
|
|
1699
1747
|
});
|
|
1748
|
+
attachLegacySidebarHeaders(
|
|
1749
|
+
collected.experimentalSidebarNavigations,
|
|
1750
|
+
legacySidebarHeaders,
|
|
1751
|
+
onWarning
|
|
1752
|
+
);
|
|
1700
1753
|
return collected;
|
|
1701
1754
|
}
|
|
1755
|
+
function attachLegacySidebarHeaders(navigations, headers, onWarning) {
|
|
1756
|
+
const [header, ...extraHeaders] = headers;
|
|
1757
|
+
if (header === void 0) return;
|
|
1758
|
+
const kind = "slots.experimental_sidebarHeader";
|
|
1759
|
+
if (extraHeaders.length > 0) {
|
|
1760
|
+
onWarning(
|
|
1761
|
+
`${kind}: only the first header is used; pass "headerComponent" to each experimental_sidebarNavigation instead`
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
let attached = false;
|
|
1765
|
+
navigations.forEach((navigation, index) => {
|
|
1766
|
+
if (navigation.headerComponent !== void 0) return;
|
|
1767
|
+
navigations[index] = { ...navigation, headerComponent: header };
|
|
1768
|
+
attached = true;
|
|
1769
|
+
});
|
|
1770
|
+
if (!attached) {
|
|
1771
|
+
onWarning(
|
|
1772
|
+
`${kind}: ignored because the plugin registers no navigation without a "headerComponent"`
|
|
1773
|
+
);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1702
1776
|
|
|
1703
1777
|
// src/testing/app.tsx
|
|
1704
1778
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1779
|
+
function TestSidebarNavigationIcon({
|
|
1780
|
+
icon,
|
|
1781
|
+
className
|
|
1782
|
+
}) {
|
|
1783
|
+
return /* @__PURE__ */ jsx(
|
|
1784
|
+
"span",
|
|
1785
|
+
{
|
|
1786
|
+
"aria-hidden": "true",
|
|
1787
|
+
className,
|
|
1788
|
+
"data-sidebar-navigation-icon": icon.kind === "host" ? icon.name : `${icon.pluginId}/${icon.icon ?? ""}`
|
|
1789
|
+
}
|
|
1790
|
+
);
|
|
1791
|
+
}
|
|
1705
1792
|
function testComposerKey(scope) {
|
|
1706
1793
|
switch (scope.kind) {
|
|
1707
1794
|
case "thread":
|
|
@@ -2548,6 +2635,28 @@ var testPluginSdkApp = {
|
|
|
2548
2635
|
experimental_ThreadActionsMenu: TestThreadActionsMenu,
|
|
2549
2636
|
experimental_ThreadActionsContextMenu: TestThreadActionsContextMenu,
|
|
2550
2637
|
experimental_THREAD_ACTION_GROUPS,
|
|
2638
|
+
experimental_useSidebarNavigation() {
|
|
2639
|
+
return useSlotEnv("experimental_useSidebarNavigation").sidebarNavigation;
|
|
2640
|
+
},
|
|
2641
|
+
experimental_useSidebarNavigationSplit(itemId, _options) {
|
|
2642
|
+
const env = useSlotEnv("experimental_useSidebarNavigationSplit");
|
|
2643
|
+
return useMemo(
|
|
2644
|
+
() => ({
|
|
2645
|
+
splitProps: {
|
|
2646
|
+
onPointerDown: () => {
|
|
2647
|
+
env.sidebarNavigationCalls.push({
|
|
2648
|
+
method: "beginSplitDrag",
|
|
2649
|
+
itemId
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
},
|
|
2653
|
+
isAvailable: true,
|
|
2654
|
+
layout: null
|
|
2655
|
+
}),
|
|
2656
|
+
[env, itemId]
|
|
2657
|
+
);
|
|
2658
|
+
},
|
|
2659
|
+
experimental_SidebarNavigationIcon: TestSidebarNavigationIcon,
|
|
2551
2660
|
experimental_useSidebarThreadSplit(threadId) {
|
|
2552
2661
|
const env = useSlotEnv("experimental_useSidebarThreadSplit");
|
|
2553
2662
|
return useMemo(
|
|
@@ -2881,6 +2990,47 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2881
2990
|
}
|
|
2882
2991
|
};
|
|
2883
2992
|
const sidebarActionCalls = [];
|
|
2993
|
+
const sidebarNavigationCalls = [];
|
|
2994
|
+
const sidebarNavigation = {
|
|
2995
|
+
items: options.sidebarNavigation?.items ?? [],
|
|
2996
|
+
activeItemId: options.sidebarNavigation?.activeItemId ?? null,
|
|
2997
|
+
isHomeActive: options.sidebarNavigation?.isHomeActive ?? true,
|
|
2998
|
+
isShortcutModifierHeld: options.sidebarNavigation?.isShortcutModifierHeld ?? false,
|
|
2999
|
+
actions: {
|
|
3000
|
+
activate(itemId, activationOptions) {
|
|
3001
|
+
sidebarNavigationCalls.push({
|
|
3002
|
+
method: "activate",
|
|
3003
|
+
itemId,
|
|
3004
|
+
openInSplit: activationOptions.openInSplit
|
|
3005
|
+
});
|
|
3006
|
+
},
|
|
3007
|
+
goHome() {
|
|
3008
|
+
sidebarNavigationCalls.push({ method: "goHome" });
|
|
3009
|
+
},
|
|
3010
|
+
setVisible(itemId, isVisible) {
|
|
3011
|
+
sidebarNavigationCalls.push({
|
|
3012
|
+
method: "setVisible",
|
|
3013
|
+
itemId,
|
|
3014
|
+
isVisible
|
|
3015
|
+
});
|
|
3016
|
+
},
|
|
3017
|
+
setOrder(itemIds) {
|
|
3018
|
+
sidebarNavigationCalls.push({
|
|
3019
|
+
method: "setOrder",
|
|
3020
|
+
itemIds: [...itemIds]
|
|
3021
|
+
});
|
|
3022
|
+
},
|
|
3023
|
+
openCustomize() {
|
|
3024
|
+
sidebarNavigationCalls.push({ method: "openCustomize" });
|
|
3025
|
+
},
|
|
3026
|
+
openDetails(itemId) {
|
|
3027
|
+
sidebarNavigationCalls.push({ method: "openDetails", itemId });
|
|
3028
|
+
},
|
|
3029
|
+
async disablePlugin(itemId) {
|
|
3030
|
+
sidebarNavigationCalls.push({ method: "disablePlugin", itemId });
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
};
|
|
2884
3034
|
const environmentArchiveCalls = [];
|
|
2885
3035
|
const sidebarPullRequests = new Map(
|
|
2886
3036
|
Object.entries(options.sidebarPullRequests ?? {})
|
|
@@ -3266,6 +3416,8 @@ ${block}
|
|
|
3266
3416
|
sidebarThreads,
|
|
3267
3417
|
sidebarActions,
|
|
3268
3418
|
sidebarActionCalls,
|
|
3419
|
+
sidebarNavigation,
|
|
3420
|
+
sidebarNavigationCalls,
|
|
3269
3421
|
environmentArchiveCalls,
|
|
3270
3422
|
threadActions: options.threadActions ?? NO_THREAD_ACTIONS,
|
|
3271
3423
|
threadActionRegistrations: options.threadActionRegistrations ?? NO_THREAD_ACTION_REGISTRATIONS,
|
|
@@ -3345,6 +3497,7 @@ ${block}
|
|
|
3345
3497
|
navigateCalls,
|
|
3346
3498
|
experimental_fixedTabOpenCalls,
|
|
3347
3499
|
sidebarActionCalls,
|
|
3500
|
+
sidebarNavigationCalls,
|
|
3348
3501
|
experimental_environmentArchiveCalls: environmentArchiveCalls,
|
|
3349
3502
|
sdkCalls,
|
|
3350
3503
|
experimental_clipboardWrites,
|
|
@@ -3360,6 +3513,7 @@ ${block}
|
|
|
3360
3513
|
navigateCalls,
|
|
3361
3514
|
experimental_fixedTabOpenCalls,
|
|
3362
3515
|
sidebarActionCalls,
|
|
3516
|
+
sidebarNavigationCalls,
|
|
3363
3517
|
experimental_environmentArchiveCalls: environmentArchiveCalls,
|
|
3364
3518
|
sdkCalls,
|
|
3365
3519
|
experimental_clipboardWrites,
|
package/dist/testing/index.js
CHANGED
|
@@ -4291,6 +4291,7 @@ function makeThreadResponse(overrides = {}) {
|
|
|
4291
4291
|
runtime: { displayStatus: "idle" },
|
|
4292
4292
|
activeBackgroundAgentCount: 0,
|
|
4293
4293
|
canRestoreEnvironment: false,
|
|
4294
|
+
canEditMessages: true,
|
|
4294
4295
|
canSpawnChild: true,
|
|
4295
4296
|
queuedMessageCount: 0,
|
|
4296
4297
|
...overrides
|
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.59",
|
|
4
4
|
"homepage": "https://github.com/get-bb/bb#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/get-bb/bb/issues"
|
|
@@ -147,7 +147,6 @@
|
|
|
147
147
|
"@bb/domain": "workspace:*",
|
|
148
148
|
"@bb/process-utils": "workspace:*",
|
|
149
149
|
"@bb/provider-bridge-acp": "workspace:*",
|
|
150
|
-
"@bb/provider-bridge-acp-next": "workspace:*",
|
|
151
150
|
"@bb/provider-bridge-protocol": "workspace:*",
|
|
152
151
|
"@bb/sdk": "workspace:*",
|
|
153
152
|
"@bb/server-contract": "workspace:*",
|