@get-bb/plugin-sdk 0.6.60 → 0.6.68
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 +477 -169
- package/bundled-types/bb-plugin-sdk-host.d.ts +196 -214
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +60 -35
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +17 -7
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +5 -11
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +192 -0
- package/bundled-types/bb-plugin-sdk-internal-rpc-tags.d.ts +23 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +8 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +29 -5
- package/bundled-types/bb-plugin-sdk.d.ts +622 -195
- package/dist/app.js +98 -0
- package/dist/host.js +12 -0
- package/dist/index.js +81 -0
- package/dist/internal/composer-handle.js +13 -14
- package/dist/internal/host-policy.js +33 -1
- package/dist/internal/plugin-app-collector.js +104 -85
- package/dist/internal/rpc-query-host.js +1574 -0
- package/dist/internal/rpc-tags.js +18 -0
- package/dist/provider-bridge-acp-next.js +2636 -2653
- package/dist/provider-bridge-acp.js +2636 -2653
- package/dist/provider-bridge-testing.js +1210 -1238
- package/dist/provider-bridge.js +1279 -1306
- package/dist/replay-provider-child.mjs +6 -2
- package/dist/testing/app.js +1826 -163
- package/dist/testing/index.js +302 -104
- package/package.json +16 -2
|
@@ -9,6 +9,75 @@ import { z } from 'zod';
|
|
|
9
9
|
import { ChildProcess } from 'node:child_process';
|
|
10
10
|
import { Readable } from 'node:stream';
|
|
11
11
|
|
|
12
|
+
/** The input form a resolver writes: the options optional, filled per side by the normalizer. */
|
|
13
|
+
declare const providerResolvedNativeRootInputSchema: z.ZodObject<{
|
|
14
|
+
ancestors: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
namePrefix: z.ZodOptional<z.ZodString>;
|
|
17
|
+
origin: z.ZodEnum<{
|
|
18
|
+
project: "project";
|
|
19
|
+
user: "user";
|
|
20
|
+
}>;
|
|
21
|
+
path: z.ZodString;
|
|
22
|
+
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
shape: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
"command-file": "command-file";
|
|
25
|
+
"skill-file": "skill-file";
|
|
26
|
+
commands: "commands";
|
|
27
|
+
skill: "skill";
|
|
28
|
+
skills: "skills";
|
|
29
|
+
}>>;
|
|
30
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
type ProviderResolvedNativeRootInput = z.input<typeof providerResolvedNativeRootInputSchema>;
|
|
33
|
+
declare const providerResolvedNativeRootsSchema: z.ZodObject<{
|
|
34
|
+
commands: z.ZodArray<z.ZodObject<{
|
|
35
|
+
ancestors: z.ZodBoolean;
|
|
36
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
37
|
+
namePrefix: z.ZodString;
|
|
38
|
+
origin: z.ZodEnum<{
|
|
39
|
+
project: "project";
|
|
40
|
+
user: "user";
|
|
41
|
+
}>;
|
|
42
|
+
path: z.ZodString;
|
|
43
|
+
recursive: z.ZodBoolean;
|
|
44
|
+
shape: z.ZodEnum<{
|
|
45
|
+
"command-file": "command-file";
|
|
46
|
+
"skill-file": "skill-file";
|
|
47
|
+
commands: "commands";
|
|
48
|
+
skill: "skill";
|
|
49
|
+
skills: "skills";
|
|
50
|
+
}>;
|
|
51
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
54
|
+
ancestors: z.ZodBoolean;
|
|
55
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
56
|
+
namePrefix: z.ZodString;
|
|
57
|
+
origin: z.ZodEnum<{
|
|
58
|
+
project: "project";
|
|
59
|
+
user: "user";
|
|
60
|
+
}>;
|
|
61
|
+
path: z.ZodString;
|
|
62
|
+
recursive: z.ZodBoolean;
|
|
63
|
+
shape: z.ZodEnum<{
|
|
64
|
+
"command-file": "command-file";
|
|
65
|
+
"skill-file": "skill-file";
|
|
66
|
+
commands: "commands";
|
|
67
|
+
skill: "skill";
|
|
68
|
+
skills: "skills";
|
|
69
|
+
}>;
|
|
70
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
type ProviderResolvedNativeRoots = z.infer<typeof providerResolvedNativeRootsSchema>;
|
|
74
|
+
|
|
75
|
+
interface ContractTagDeclarations<Input, Output> {
|
|
76
|
+
tags?(input: Input, output: Output): readonly string[];
|
|
77
|
+
keyTags?(key: string, value: Output extends Readonly<Record<string, infer Value>> ? Value : unknown): readonly string[];
|
|
78
|
+
invalidates?(input: Input, output: Output): readonly string[];
|
|
79
|
+
}
|
|
80
|
+
|
|
12
81
|
/**
|
|
13
82
|
* The validator-neutral subset of Standard Schema v1 used by plugin contracts.
|
|
14
83
|
* Zod 4 schemas implement this interface directly; other validators can do
|
|
@@ -47,7 +116,7 @@ interface StandardSchemaV1Issue {
|
|
|
47
116
|
}
|
|
48
117
|
type StandardSchemaV1InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
49
118
|
type StandardSchemaV1InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
50
|
-
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> {
|
|
119
|
+
interface PluginRpcMethodContract<InputSchema extends StandardSchemaV1 = StandardSchemaV1, OutputSchema extends StandardSchemaV1 = StandardSchemaV1> extends ContractTagDeclarations<StandardSchemaV1InferOutput<InputSchema>, StandardSchemaV1InferOutput<OutputSchema>> {
|
|
51
120
|
readonly experimental_description?: string;
|
|
52
121
|
readonly input: InputSchema;
|
|
53
122
|
readonly output: OutputSchema;
|
|
@@ -133,94 +202,6 @@ declare function experimental_defineHostEntry<const Contract extends PluginRpcCo
|
|
|
133
202
|
dispose?: () => void | Promise<void>;
|
|
134
203
|
}): ExperimentalHostEntry<Contract, Signals>;
|
|
135
204
|
|
|
136
|
-
/** The input form a resolver writes: the options optional, filled per side by the normalizer. */
|
|
137
|
-
declare const providerResolvedNativeRootInputSchema: z.ZodObject<{
|
|
138
|
-
ancestors: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
-
fallbackName: z.ZodOptional<z.ZodString>;
|
|
140
|
-
namePrefix: z.ZodOptional<z.ZodString>;
|
|
141
|
-
origin: z.ZodEnum<{
|
|
142
|
-
project: "project";
|
|
143
|
-
user: "user";
|
|
144
|
-
}>;
|
|
145
|
-
path: z.ZodString;
|
|
146
|
-
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
-
shape: z.ZodOptional<z.ZodEnum<{
|
|
148
|
-
"command-file": "command-file";
|
|
149
|
-
"skill-file": "skill-file";
|
|
150
|
-
commands: "commands";
|
|
151
|
-
skill: "skill";
|
|
152
|
-
skills: "skills";
|
|
153
|
-
}>>;
|
|
154
|
-
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
155
|
-
}, z.core.$strict>;
|
|
156
|
-
type ProviderResolvedNativeRootInput = z.input<typeof providerResolvedNativeRootInputSchema>;
|
|
157
|
-
declare const providerResolvedNativeRootsSchema: z.ZodObject<{
|
|
158
|
-
commands: z.ZodArray<z.ZodObject<{
|
|
159
|
-
ancestors: z.ZodBoolean;
|
|
160
|
-
fallbackName: z.ZodOptional<z.ZodString>;
|
|
161
|
-
namePrefix: z.ZodString;
|
|
162
|
-
origin: z.ZodEnum<{
|
|
163
|
-
project: "project";
|
|
164
|
-
user: "user";
|
|
165
|
-
}>;
|
|
166
|
-
path: z.ZodString;
|
|
167
|
-
recursive: z.ZodBoolean;
|
|
168
|
-
shape: z.ZodEnum<{
|
|
169
|
-
"command-file": "command-file";
|
|
170
|
-
"skill-file": "skill-file";
|
|
171
|
-
commands: "commands";
|
|
172
|
-
skill: "skill";
|
|
173
|
-
skills: "skills";
|
|
174
|
-
}>;
|
|
175
|
-
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
176
|
-
}, z.core.$strict>>;
|
|
177
|
-
skills: z.ZodArray<z.ZodObject<{
|
|
178
|
-
ancestors: z.ZodBoolean;
|
|
179
|
-
fallbackName: z.ZodOptional<z.ZodString>;
|
|
180
|
-
namePrefix: z.ZodString;
|
|
181
|
-
origin: z.ZodEnum<{
|
|
182
|
-
project: "project";
|
|
183
|
-
user: "user";
|
|
184
|
-
}>;
|
|
185
|
-
path: z.ZodString;
|
|
186
|
-
recursive: z.ZodBoolean;
|
|
187
|
-
shape: z.ZodEnum<{
|
|
188
|
-
"command-file": "command-file";
|
|
189
|
-
"skill-file": "skill-file";
|
|
190
|
-
commands: "commands";
|
|
191
|
-
skill: "skill";
|
|
192
|
-
skills: "skills";
|
|
193
|
-
}>;
|
|
194
|
-
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
195
|
-
}, z.core.$strict>>;
|
|
196
|
-
}, z.core.$strict>;
|
|
197
|
-
type ProviderResolvedNativeRoots = z.infer<typeof providerResolvedNativeRootsSchema>;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* The host RPC a provider plugin implements when its declaration sets
|
|
201
|
-
* `experimental_resolvesNativeRoots`. Core calls `resolveNativeRoots` on the
|
|
202
|
-
* workspace host each time it lists a provider's commands or skills (cached
|
|
203
|
-
* briefly per host and workspace) and scans the returned roots beside the
|
|
204
|
-
* declared ones. The plugin answers from the host's own files — a moved
|
|
205
|
-
* config directory, installed vendor plugins, config-file skill entries —
|
|
206
|
-
* and decides each root's origin: a project-scoped vendor plugin is
|
|
207
|
-
* `project`, a home-directory entry is `user`.
|
|
208
|
-
*
|
|
209
|
-
* Paths are host-absolute without dot segments. A root's `shape` says how the
|
|
210
|
-
* daemon reads it; the defaults (`skills` for the skills side, `commands` for
|
|
211
|
-
* the commands side) are filled by the contract. A thrown error or a
|
|
212
|
-
* malformed answer is logged by core and yields no resolved roots for that
|
|
213
|
-
* listing; it never fails the listing. A side longer than
|
|
214
|
-
* `PROVIDER_RESOLVED_NATIVE_ROOTS_MAX` is cut to the cap, not refused.
|
|
215
|
-
*
|
|
216
|
-
* The contract validates the whole answer at once, so one root the contract
|
|
217
|
-
* refuses (a vendor plugin whose name cannot be a name prefix, say) would
|
|
218
|
-
* cost the user every other root. A resolver runs its answer through
|
|
219
|
-
* `experimental_filterResolvedNativeRoots` before it returns: each root is
|
|
220
|
-
* judged on its own, a refused one is dropped with a warning, and the rest
|
|
221
|
-
* stand.
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
205
|
declare const experimental_nativeRootsResolveInputSchema: z.ZodObject<{
|
|
225
206
|
cwd: z.ZodNullable<z.ZodString>;
|
|
226
207
|
providerId: z.ZodString;
|
|
@@ -391,132 +372,133 @@ declare function experimental_filterResolvedNativeRoots<Skill extends ProviderRe
|
|
|
391
372
|
warned?: Set<string>;
|
|
392
373
|
}): ExperimentalFilteredNativeRoots<Skill, Command>;
|
|
393
374
|
declare const experimental_nativeRootsHostContract: {
|
|
394
|
-
readonly resolveNativeRoots: {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}>;
|
|
517
|
-
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
518
|
-
}, z.core.$strict>>;
|
|
375
|
+
readonly resolveNativeRoots: PluginRpcMethodContract<z.ZodObject<{
|
|
376
|
+
cwd: z.ZodNullable<z.ZodString>;
|
|
377
|
+
providerId: z.ZodString;
|
|
378
|
+
}, z.core.$strict>, z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
379
|
+
commands: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
380
|
+
ancestors: z.ZodOptional<z.ZodBoolean>;
|
|
381
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
382
|
+
namePrefix: z.ZodOptional<z.ZodString>;
|
|
383
|
+
origin: z.ZodEnum<{
|
|
384
|
+
project: "project";
|
|
385
|
+
user: "user";
|
|
386
|
+
}>;
|
|
387
|
+
path: z.ZodString;
|
|
388
|
+
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
389
|
+
shape: z.ZodOptional<z.ZodEnum<{
|
|
390
|
+
"command-file": "command-file";
|
|
391
|
+
"skill-file": "skill-file";
|
|
392
|
+
commands: "commands";
|
|
393
|
+
skill: "skill";
|
|
394
|
+
skills: "skills";
|
|
395
|
+
}>>;
|
|
396
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
397
|
+
}, z.core.$strict>>>;
|
|
398
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
399
|
+
ancestors: z.ZodOptional<z.ZodBoolean>;
|
|
400
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
401
|
+
namePrefix: z.ZodOptional<z.ZodString>;
|
|
402
|
+
origin: z.ZodEnum<{
|
|
403
|
+
project: "project";
|
|
404
|
+
user: "user";
|
|
405
|
+
}>;
|
|
406
|
+
path: z.ZodString;
|
|
407
|
+
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
408
|
+
shape: z.ZodOptional<z.ZodEnum<{
|
|
409
|
+
"command-file": "command-file";
|
|
410
|
+
"skill-file": "skill-file";
|
|
411
|
+
commands: "commands";
|
|
412
|
+
skill: "skill";
|
|
413
|
+
skills: "skills";
|
|
414
|
+
}>>;
|
|
415
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, z.core.$strict>>>;
|
|
417
|
+
}, z.core.$strict>, z.ZodTransform<{
|
|
418
|
+
skills: {
|
|
419
|
+
path: string;
|
|
420
|
+
origin: "project" | "user";
|
|
421
|
+
recursive: boolean;
|
|
422
|
+
ancestors: boolean;
|
|
423
|
+
namePrefix: string;
|
|
424
|
+
shape: "command-file" | "commands" | "skill" | "skill-file" | "skills";
|
|
425
|
+
fallbackName?: string | undefined;
|
|
426
|
+
skipIfManifest?: string | undefined;
|
|
427
|
+
}[];
|
|
428
|
+
commands: {
|
|
429
|
+
path: string;
|
|
430
|
+
origin: "project" | "user";
|
|
431
|
+
recursive: boolean;
|
|
432
|
+
ancestors: boolean;
|
|
433
|
+
namePrefix: string;
|
|
434
|
+
shape: "command-file" | "commands" | "skill" | "skill-file" | "skills";
|
|
435
|
+
fallbackName?: string | undefined;
|
|
436
|
+
skipIfManifest?: string | undefined;
|
|
437
|
+
}[];
|
|
438
|
+
}, {
|
|
439
|
+
skills?: {
|
|
440
|
+
path: string;
|
|
441
|
+
origin: "project" | "user";
|
|
442
|
+
recursive?: boolean | undefined;
|
|
443
|
+
ancestors?: boolean | undefined;
|
|
444
|
+
namePrefix?: string | undefined;
|
|
445
|
+
shape?: "command-file" | "commands" | "skill" | "skill-file" | "skills" | undefined;
|
|
446
|
+
fallbackName?: string | undefined;
|
|
447
|
+
skipIfManifest?: string | undefined;
|
|
448
|
+
}[] | undefined;
|
|
449
|
+
commands?: {
|
|
450
|
+
path: string;
|
|
451
|
+
origin: "project" | "user";
|
|
452
|
+
recursive?: boolean | undefined;
|
|
453
|
+
ancestors?: boolean | undefined;
|
|
454
|
+
namePrefix?: string | undefined;
|
|
455
|
+
shape?: "command-file" | "commands" | "skill" | "skill-file" | "skills" | undefined;
|
|
456
|
+
fallbackName?: string | undefined;
|
|
457
|
+
skipIfManifest?: string | undefined;
|
|
458
|
+
}[] | undefined;
|
|
459
|
+
}>>, z.ZodObject<{
|
|
460
|
+
commands: z.ZodArray<z.ZodObject<{
|
|
461
|
+
ancestors: z.ZodBoolean;
|
|
462
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
463
|
+
namePrefix: z.ZodString;
|
|
464
|
+
origin: z.ZodEnum<{
|
|
465
|
+
project: "project";
|
|
466
|
+
user: "user";
|
|
467
|
+
}>;
|
|
468
|
+
path: z.ZodString;
|
|
469
|
+
recursive: z.ZodBoolean;
|
|
470
|
+
shape: z.ZodEnum<{
|
|
471
|
+
"command-file": "command-file";
|
|
472
|
+
"skill-file": "skill-file";
|
|
473
|
+
commands: "commands";
|
|
474
|
+
skill: "skill";
|
|
475
|
+
skills: "skills";
|
|
476
|
+
}>;
|
|
477
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
478
|
+
}, z.core.$strict>>;
|
|
479
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
480
|
+
ancestors: z.ZodBoolean;
|
|
481
|
+
fallbackName: z.ZodOptional<z.ZodString>;
|
|
482
|
+
namePrefix: z.ZodString;
|
|
483
|
+
origin: z.ZodEnum<{
|
|
484
|
+
project: "project";
|
|
485
|
+
user: "user";
|
|
486
|
+
}>;
|
|
487
|
+
path: z.ZodString;
|
|
488
|
+
recursive: z.ZodBoolean;
|
|
489
|
+
shape: z.ZodEnum<{
|
|
490
|
+
"command-file": "command-file";
|
|
491
|
+
"skill-file": "skill-file";
|
|
492
|
+
commands: "commands";
|
|
493
|
+
skill: "skill";
|
|
494
|
+
skills: "skills";
|
|
495
|
+
}>;
|
|
496
|
+
skipIfManifest: z.ZodOptional<z.ZodString>;
|
|
519
497
|
}, z.core.$strict>>;
|
|
498
|
+
}, z.core.$strict>>>;
|
|
499
|
+
} & {
|
|
500
|
+
readonly resolveNativeRoots: {
|
|
501
|
+
keyTags?: never;
|
|
520
502
|
};
|
|
521
503
|
};
|
|
522
504
|
type ExperimentalNativeRootsHostContract = typeof experimental_nativeRootsHostContract;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1,
|
|
9
|
+
import { JsonValue as JsonValue$2, PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1, ComposerMention as ComposerMention$1, PluginComposerTextEffect as PluginComposerTextEffect$1 } from '@get-bb/plugin-sdk';
|
|
10
10
|
|
|
11
11
|
interface JsonObject {
|
|
12
12
|
[key: string]: JsonValue$1;
|
|
@@ -295,29 +295,41 @@ interface PluginComposerApi {
|
|
|
295
295
|
/** Focus the composer caret at the end of the draft. */
|
|
296
296
|
focus(): void;
|
|
297
297
|
/**
|
|
298
|
-
* Submit this composer's draft
|
|
299
|
-
*
|
|
300
|
-
* provider handoff creates a new thread
|
|
298
|
+
* Submit this composer's draft through the composer's own send and steer
|
|
299
|
+
* handlers, the ones Enter and modifier+Enter run, including a
|
|
300
|
+
* provider handoff that creates a new thread. The draft's attachments and
|
|
301
301
|
* @-mentions, and — in the new-thread composer — the provider, model,
|
|
302
302
|
* reasoning level, service tier, permission mode and environment the user
|
|
303
303
|
* has selected on screen, all travel with it.
|
|
304
304
|
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
305
|
+
* It submits only the draft, so it rejects an empty one, even where the
|
|
306
|
+
* shortcut would steer the next queued message instead. Otherwise it runs
|
|
307
|
+
* only when the matching shortcut would. While attachments are uploading it
|
|
308
|
+
* waits for them, then checks again; it rejects if an upload fails. When
|
|
309
|
+
* the shortcut could not submit, it rejects with the reason, a message safe
|
|
310
|
+
* to show to the user. The composer must be on screen. The queued-message
|
|
311
|
+
* and sent-message editors reject.
|
|
309
312
|
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
313
|
+
* Every option combines with the others. `experimental_mode` uses the
|
|
314
|
+
* names `bb.sdk.threads.send` uses. Without it, submit does what Enter
|
|
315
|
+
* does for this user, which may be to queue or to steer.
|
|
316
|
+
* `"queue-if-active"` queues behind the running turn, or starts a turn.
|
|
317
|
+
* `"steer-if-active"` adds the message to the running turn. Where nothing
|
|
318
|
+
* can be steered, such as on an idle thread, it starts a turn.
|
|
319
|
+
* `sendAt` makes the chosen action wait until the given time; a scheduled
|
|
320
|
+
* steer steers whatever turn is running then. `experimental_data` is
|
|
321
|
+
* opaque JSON delivered to dispatch hooks together with the calling
|
|
322
|
+
* plugin's id on this initial attempt. Hooks run before operational core
|
|
323
|
+
* waits. If a hook queues the message, its existing plugin wait identifies
|
|
324
|
+
* the owner on later attempts; core does not persist or interpret the
|
|
325
|
+
* opaque data.
|
|
315
326
|
*
|
|
316
|
-
* Resolves once the
|
|
317
|
-
* Failures of the underlying request
|
|
318
|
-
*
|
|
327
|
+
* Resolves once the composer has accepted the submission and cleared the
|
|
328
|
+
* draft. Failures of the underlying request show bb's usual error toast
|
|
329
|
+
* and restore the draft, exactly as an interactive failure does, and then
|
|
330
|
+
* reject with the toast's message.
|
|
319
331
|
*/
|
|
320
|
-
submit(options
|
|
332
|
+
submit(options?: ComposerSubmitOptions): Promise<void>;
|
|
321
333
|
/**
|
|
322
334
|
* Set this composer's pickers as if each value had been picked by hand.
|
|
323
335
|
*
|
|
@@ -396,20 +408,22 @@ interface ComposerSelection {
|
|
|
396
408
|
serviceTier?: ServiceTier;
|
|
397
409
|
permissionMode?: PermissionMode;
|
|
398
410
|
}
|
|
399
|
-
/**
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
/** What `submit` adds to pressing Enter. Every field combines with the others. */
|
|
412
|
+
interface ComposerSubmitOptions {
|
|
413
|
+
/**
|
|
414
|
+
* `"queue-if-active"` queues behind the running turn and
|
|
415
|
+
* `"steer-if-active"` adds to it; both start a turn when none is running.
|
|
416
|
+
* Omitted, it does what Enter does for this user.
|
|
417
|
+
*/
|
|
418
|
+
experimental_mode?: "queue-if-active" | "steer-if-active";
|
|
419
|
+
/** Epoch ms in the future; the action waits until then. */
|
|
420
|
+
sendAt?: number;
|
|
421
|
+
/**
|
|
422
|
+
* Opaque JSON delivered to dispatch hooks with the calling plugin's id on
|
|
423
|
+
* the initial dispatch attempt.
|
|
424
|
+
*/
|
|
408
425
|
experimental_data?: JsonValue;
|
|
409
|
-
}
|
|
410
|
-
experimental_data: JsonValue;
|
|
411
|
-
sendAt?: never;
|
|
412
|
-
};
|
|
426
|
+
}
|
|
413
427
|
|
|
414
428
|
declare function reconcileComposerMentions(currentText: string, nextText: string, mentions: readonly ComposerMention[]): ComposerMention[];
|
|
415
429
|
|
|
@@ -425,6 +439,16 @@ interface ComposerEditorState {
|
|
|
425
439
|
isAttaching: boolean;
|
|
426
440
|
attachmentError: string | null;
|
|
427
441
|
}
|
|
442
|
+
interface ComposerSubmitExtras {
|
|
443
|
+
sendAt?: number;
|
|
444
|
+
pluginSubmission?: {
|
|
445
|
+
pluginId: string;
|
|
446
|
+
data: JsonValue$2;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
interface ComposerEditorSubmission extends ComposerSubmitExtras {
|
|
450
|
+
mode: "enter" | "queue-if-active" | "steer-if-active";
|
|
451
|
+
}
|
|
428
452
|
interface ComposerHandleTarget {
|
|
429
453
|
key: string;
|
|
430
454
|
scope: PluginComposerScope$1;
|
|
@@ -440,10 +464,11 @@ interface ComposerHandleTarget {
|
|
|
440
464
|
focus(): void;
|
|
441
465
|
openPopup?(pluginId: string, popupId: string): boolean;
|
|
442
466
|
closePopup?(pluginId: string): boolean;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
467
|
+
/**
|
|
468
|
+
* Runs the on-screen composer's own Enter, queue or steer handler with the
|
|
469
|
+
* submission's extras, or returns null when no composer box is mounted.
|
|
470
|
+
*/
|
|
471
|
+
editorSubmit(submission: ComposerEditorSubmission): Promise<void> | null;
|
|
447
472
|
setSelection?(selection: ComposerSelection$1): Promise<ComposerSelection$1>;
|
|
448
473
|
}
|
|
449
474
|
interface ComposerHandleController {
|
|
@@ -464,4 +489,4 @@ declare function appendComposerDraft(current: ComposerDraft$1, value: ComposerDr
|
|
|
464
489
|
declare function createComposerHandleBinding(key: string, initial: ComposerHandleController): ComposerHandleBinding;
|
|
465
490
|
|
|
466
491
|
export { OFF_SCREEN_EDITOR_STATE, appendComposerDraft, createComposerDraftActions, createComposerHandleBinding, reconcileComposerMentions };
|
|
467
|
-
export type { ComposerEditorState, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget };
|
|
492
|
+
export type { ComposerEditorState, ComposerEditorSubmission, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget, ComposerSubmitExtras };
|