@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.
- package/README.md +26 -23
- package/bundled-types/bb-plugin-sdk-app.d.ts +1009 -896
- package/bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts +7 -0
- package/bundled-types/bb-plugin-sdk-process.d.ts +61 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -21
- package/bundled-types/bb-plugin-sdk-testing.d.ts +11 -0
- package/bundled-types/bb-plugin-sdk.d.ts +1006 -894
- package/dist/app.js +4 -0
- package/dist/host.js +557 -13
- package/dist/index.js +1 -1
- package/dist/internal/file-navigation-validation.js +14 -3
- package/dist/internal/host-policy.js +1 -1
- package/dist/internal/plugin-app-collector.js +11 -3
- package/dist/internal/rpc-query-host.js +333 -489
- package/dist/process.js +694 -0
- package/dist/provider-bridge-acp-next.js +724 -317
- package/dist/provider-bridge-acp.js +724 -317
- package/dist/provider-bridge-testing.js +677 -43
- package/dist/provider-bridge-worker-entry.mjs +534 -66
- package/dist/provider-bridge.js +604 -212
- package/dist/testing/app.js +563 -617
- package/dist/testing/index.js +126 -108
- package/package.json +7 -1
|
@@ -10,6 +10,13 @@ type ExperimentalLiveFileTarget = {
|
|
|
10
10
|
kind: "workspace";
|
|
11
11
|
environmentId: string;
|
|
12
12
|
path: string;
|
|
13
|
+
/**
|
|
14
|
+
* Git revision to read instead of the working copy: `"HEAD"` or a 4–40
|
|
15
|
+
* character commit SHA; other values make the target invalid. Previews
|
|
16
|
+
* open read-only and are labelled with the ref; external opens ignore it
|
|
17
|
+
* and open the working copy.
|
|
18
|
+
*/
|
|
19
|
+
experimental_ref?: string;
|
|
13
20
|
} | {
|
|
14
21
|
kind: "host";
|
|
15
22
|
hostId: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Portable type declarations for `@get-bb/plugin-sdk`. Unpublished BB
|
|
2
|
+
// workspace contracts are flattened; public subpaths may reuse the
|
|
3
|
+
// package root without requiring any other @bb/* package.
|
|
4
|
+
//
|
|
5
|
+
// Confused by the API, or need a symbol that isn't here? Clone the BB repo
|
|
6
|
+
// and read the real source: https://github.com/get-bb/bb
|
|
7
|
+
|
|
8
|
+
import { ExecFileOptionsWithStringEncoding, ChildProcess, ExecFileException, ForkOptions, SpawnOptionsWithoutStdio, ChildProcessWithoutNullStreams, SpawnOptionsWithStdioTuple, StdioPipe, ChildProcessByStdio, StdioNull, SpawnOptions } from 'node:child_process';
|
|
9
|
+
import { Writable, Readable } from 'node:stream';
|
|
10
|
+
|
|
11
|
+
interface HostCommand {
|
|
12
|
+
command: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
env: NodeJS.ProcessEnv;
|
|
15
|
+
}
|
|
16
|
+
interface HostCommandOptions {
|
|
17
|
+
cwd?: string | URL;
|
|
18
|
+
env?: NodeJS.ProcessEnv;
|
|
19
|
+
}
|
|
20
|
+
declare class HostToolchain {
|
|
21
|
+
private readonly baseEnv;
|
|
22
|
+
private readonly runtimePath;
|
|
23
|
+
private shellEnv;
|
|
24
|
+
private readonly inheritedPath;
|
|
25
|
+
private readonly misses;
|
|
26
|
+
private nodePath;
|
|
27
|
+
private refreshing;
|
|
28
|
+
private refreshedAt;
|
|
29
|
+
constructor(baseEnv?: NodeJS.ProcessEnv, runtimePath?: string);
|
|
30
|
+
refresh(): Promise<void>;
|
|
31
|
+
invalidateFailure(errorOrCode: unknown): void;
|
|
32
|
+
private searchPath;
|
|
33
|
+
environment(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
34
|
+
private lookup;
|
|
35
|
+
resolve(command: string, options?: HostCommandOptions): string | null;
|
|
36
|
+
node(options?: HostCommandOptions): string;
|
|
37
|
+
bundledNpmCli(command?: "npm" | "npx"): string;
|
|
38
|
+
npmCli(command?: "npm" | "npx", options?: HostCommandOptions): {
|
|
39
|
+
node: string;
|
|
40
|
+
cli: string;
|
|
41
|
+
} | null;
|
|
42
|
+
command(command: string, args?: readonly string[], options?: HostCommandOptions): HostCommand;
|
|
43
|
+
}
|
|
44
|
+
declare const hostToolchain: HostToolchain;
|
|
45
|
+
|
|
46
|
+
declare function spawnHostProcess(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
|
47
|
+
declare function spawnHostProcess(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): ChildProcessByStdio<Writable, Readable, Readable>;
|
|
48
|
+
declare function spawnHostProcess(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): ChildProcessByStdio<null, Readable, Readable>;
|
|
49
|
+
declare function spawnHostProcess(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): ChildProcessByStdio<null, Readable, null>;
|
|
50
|
+
declare function spawnHostProcess(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): ChildProcessByStdio<Writable, null, null>;
|
|
51
|
+
declare function spawnHostProcess(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
|
|
52
|
+
declare function forkHostProcess(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
|
|
53
|
+
declare function execHostFileCallback(command: string, args: readonly string[], options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
|
54
|
+
declare function execHostFile(command: string, args?: readonly string[], options?: ExecFileOptionsWithStringEncoding): Promise<{
|
|
55
|
+
stdout: string;
|
|
56
|
+
stderr: string;
|
|
57
|
+
}> & {
|
|
58
|
+
child: ChildProcess;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { execHostFile as experimental_execHostFile, execHostFileCallback as experimental_execHostFileCallback, forkHostProcess as experimental_forkHostProcess, hostToolchain as experimental_hostToolchain, spawnHostProcess as experimental_spawnHostProcess };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import * as _get_bb_plugin_sdk from '@get-bb/plugin-sdk';
|
|
9
|
-
import { ExperimentalSidebarFooterItemRegistration, PluginNavPanelRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, ExperimentalThreadContextSegmentRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadInfoSectionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus,
|
|
9
|
+
import { ExperimentalSidebarFooterItemRegistration, PluginNavPanelRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, ExperimentalThreadContextSegmentRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadInfoSectionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalComposerRendererApi, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalLiveFileTarget, ExperimentalPanelController, JsonValue, ExperimentalPageTitle, ExperimentalOpenTabOptions, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
|
|
10
10
|
import { ComponentType, ReactNode } from 'react';
|
|
11
11
|
import { RenderResult } from '@testing-library/react';
|
|
12
12
|
|
|
@@ -110,9 +110,6 @@ type NavigateCall = {
|
|
|
110
110
|
} | {
|
|
111
111
|
method: "toCompose";
|
|
112
112
|
options?: Parameters<BbNavigate["toCompose"]>[0];
|
|
113
|
-
} | {
|
|
114
|
-
method: "openThreadPanel";
|
|
115
|
-
options: Parameters<BbNavigate["openThreadPanel"]>[0];
|
|
116
113
|
} | {
|
|
117
114
|
method: "openUrl";
|
|
118
115
|
url: string;
|
|
@@ -126,12 +123,12 @@ type NavigateCall = {
|
|
|
126
123
|
method: "experimental_openTerminal";
|
|
127
124
|
options: Parameters<BbNavigate["experimental_openTerminal"]>[0];
|
|
128
125
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
126
|
+
type ExperimentalPanelCall = {
|
|
127
|
+
method: "openTab" | "toggleTab";
|
|
128
|
+
options: ExperimentalOpenTabOptions;
|
|
129
|
+
} | {
|
|
130
|
+
method: "close";
|
|
131
|
+
};
|
|
135
132
|
interface ComposerLog {
|
|
136
133
|
/** Latest plain text in this isolated composer scope. */
|
|
137
134
|
readonly text: string;
|
|
@@ -185,6 +182,15 @@ interface ComposerLog {
|
|
|
185
182
|
type TestThreadActionsResolver = (thread: PluginThreadActionTarget, options: {
|
|
186
183
|
requestRename(threadId: string): void;
|
|
187
184
|
}) => readonly PluginThreadActionEntry[];
|
|
185
|
+
/**
|
|
186
|
+
* What the fake `experimental_ThreadActionsContextMenu` lists when its
|
|
187
|
+
* `experimental_bulkThreads` has two or more threads, in menu order; the host's
|
|
188
|
+
* own actions are not emulated. That menu is labelled `Actions for N threads`,
|
|
189
|
+
* lists these entries and its `inline` items as `menuitem` buttons, closes
|
|
190
|
+
* after one runs, and calls `onEscapeKeyDown` and closes on Escape. Omitted →
|
|
191
|
+
* an empty list.
|
|
192
|
+
*/
|
|
193
|
+
type TestThreadBulkActionsResolver = (threads: readonly PluginThreadActionTarget[]) => readonly PluginThreadActionEntry[];
|
|
188
194
|
/**
|
|
189
195
|
* One recorded `experimental_useSidebarNavigation()` action, or a split drag
|
|
190
196
|
* started from `experimental_useSidebarNavigationSplit()` (`beginSplitDrag`).
|
|
@@ -401,6 +407,11 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
401
407
|
* order. Omitted → an empty list.
|
|
402
408
|
*/
|
|
403
409
|
threadActions?: TestThreadActionsResolver;
|
|
410
|
+
/**
|
|
411
|
+
* What `experimental_ThreadActionsContextMenu` lists for an
|
|
412
|
+
* `experimental_bulkThreads`, in menu order. Omitted → an empty list.
|
|
413
|
+
*/
|
|
414
|
+
threadBulkActions?: TestThreadBulkActionsResolver;
|
|
404
415
|
/**
|
|
405
416
|
* What `experimental_useThreadActionRegistrations()` reports. Omitted → an
|
|
406
417
|
* empty list.
|
|
@@ -417,22 +428,31 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
417
428
|
* in `inspection.sdkCalls`; a call to a method you did not provide throws.
|
|
418
429
|
*/
|
|
419
430
|
sdk?: PluginSdkTestFakes;
|
|
420
|
-
/** Host acceptance for `useBbNavigate().openThreadPanel`. */
|
|
421
|
-
openThreadPanel?: (options: Parameters<BbNavigate["openThreadPanel"]>[0]) => boolean;
|
|
422
431
|
/** Host acceptance for URL intents from the hook or `UrlLink`. */
|
|
423
432
|
openUrl?: (url: string) => boolean;
|
|
424
433
|
/** Host acceptance for preview intents from the hook or file link. */
|
|
425
434
|
openFilePreview?: (options: ExperimentalFileOpenOptions) => boolean;
|
|
426
435
|
/** Host acceptance for preferred-external file intents. */
|
|
427
436
|
openFileExternally?: (options: ExperimentalFileOpenOptions) => boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Answer for `experimental_useCanOpenFileExternally(target)`. Omitted →
|
|
439
|
+
* false for every target.
|
|
440
|
+
*/
|
|
441
|
+
canOpenFileExternally?: (target: ExperimentalLiveFileTarget) => boolean;
|
|
428
442
|
/** Host acceptance for `useBbNavigate().experimental_openTerminal`. */
|
|
429
443
|
openTerminal?: (options: Parameters<BbNavigate["experimental_openTerminal"]>[0]) => boolean;
|
|
430
|
-
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
444
|
+
/**
|
|
445
|
+
* Host acceptance for `experimental_useAppPanel()` calls, one handler per
|
|
446
|
+
* method; an omitted method declines. An accepted `openTab` of a fixed tab
|
|
447
|
+
* with a `target` makes that target visible to `experimental_useFixedTabTarget`.
|
|
448
|
+
*/
|
|
449
|
+
experimental_panel?: Partial<ExperimentalPanelController>;
|
|
450
|
+
/**
|
|
451
|
+
* Initial session target visible to `experimental_useFixedTabTarget`.
|
|
452
|
+
* Omit `panelId` for a thread fixed tab.
|
|
453
|
+
*/
|
|
434
454
|
experimental_fixedTabTarget?: {
|
|
435
|
-
panelId
|
|
455
|
+
panelId?: string;
|
|
436
456
|
tabId: string;
|
|
437
457
|
target: JsonValue;
|
|
438
458
|
};
|
|
@@ -460,9 +480,8 @@ interface RenderedSlotInspectionState {
|
|
|
460
480
|
readonly rpcCalls: RpcCall[];
|
|
461
481
|
/** Every `useBbNavigate()` call, in order. */
|
|
462
482
|
readonly navigateCalls: NavigateCall[];
|
|
463
|
-
/** Every
|
|
464
|
-
readonly
|
|
465
|
-
readonly experimental_tabOpenCalls: _get_bb_plugin_sdk.ExperimentalTabOpenOptions[];
|
|
483
|
+
/** Every `experimental_useAppPanel()` call, in order. */
|
|
484
|
+
readonly experimental_panelCalls: ExperimentalPanelCall[];
|
|
466
485
|
/**
|
|
467
486
|
* Every `experimental_useSidebarNavigation()` action and navigation split
|
|
468
487
|
* drag, in order.
|
|
@@ -500,4 +519,4 @@ declare function renderSlot<Props extends object, Contract extends PluginRpcCont
|
|
|
500
519
|
}, props: Props, options?: RenderSlotOptions<Contract>): RenderedSlot;
|
|
501
520
|
|
|
502
521
|
export { installTestPluginRuntime, loadPluginApp, mountPluginContentScripts, renderSlot };
|
|
503
|
-
export type { CapturedPluginApp, ComposerLog, ContentScriptTestMountOptions, ContentScriptThreadRowStatusCall,
|
|
522
|
+
export type { CapturedPluginApp, ComposerLog, ContentScriptTestMountOptions, ContentScriptThreadRowStatusCall, MountedPluginContentScripts, NavigateCall, PluginAppSource, PluginRpcTestHandlers, PluginSdkTestFakes, RenderSlotOptions, RenderedSlot, RenderedSlotBehaviorDrivers, RenderedSlotInspectionState, RenderedSlotLifecycleControls, RpcCall, SdkCall, SidebarNavigationCall, TestThreadActionsResolver, TestThreadBulkActionsResolver };
|
|
@@ -1321,6 +1321,17 @@ interface FakePluginBehaviorDrivers {
|
|
|
1321
1321
|
callRpc(method: string, input?: unknown, options?: {
|
|
1322
1322
|
experimental_caller?: ExperimentalPluginRpcCaller;
|
|
1323
1323
|
}): Promise<unknown>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Start a client watch of one read, as the first client of a watched read
|
|
1326
|
+
* does: runs the method's `experimental_whileWatched` producer. The returned
|
|
1327
|
+
* function ends the watch and aborts the producer's signal; disposing the
|
|
1328
|
+
* plugin aborts every watch still running.
|
|
1329
|
+
*/
|
|
1330
|
+
experimental_watchRpc(method: string, read: {
|
|
1331
|
+
input: JsonValue$2;
|
|
1332
|
+
} | {
|
|
1333
|
+
key: string;
|
|
1334
|
+
}): () => void;
|
|
1324
1335
|
/**
|
|
1325
1336
|
* Invoke the plugin's CLI command with host semantics: the result's
|
|
1326
1337
|
* exitCode must be a number, stdout/stderr default to "", and a throwing
|