@get-bb/plugin-sdk 0.4.97 → 0.4.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 +42 -1
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +3 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +5 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk.d.ts +430 -1
- package/dist/internal/host-policy.js +1 -0
- package/dist/provider-bridge-acp.js +8 -2
- package/dist/provider-bridge-testing.js +70 -3
- package/dist/provider-bridge.js +8 -2
- package/dist/testing/app.js +17 -0
- package/dist/testing/index.js +2 -0
- package/package.json +1 -1
|
@@ -651,7 +651,7 @@ var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
|
651
651
|
var promptMentionPathEntryKindSchema = z3.enum(
|
|
652
652
|
promptMentionPathEntryKindValues
|
|
653
653
|
);
|
|
654
|
-
var promptMentionCommandTriggerValues = ["/"];
|
|
654
|
+
var promptMentionCommandTriggerValues = ["/", "$"];
|
|
655
655
|
var promptMentionCommandTriggerSchema = z3.enum(
|
|
656
656
|
promptMentionCommandTriggerValues
|
|
657
657
|
);
|
|
@@ -2625,7 +2625,13 @@ var unscopedProviderEventSchema = z16.discriminatedUnion("type", [
|
|
|
2625
2625
|
source: z16.union([
|
|
2626
2626
|
z16.literal("shell"),
|
|
2627
2627
|
z16.object({ plugin: z16.string() }).strict(),
|
|
2628
|
-
z16.object({
|
|
2628
|
+
z16.object({
|
|
2629
|
+
core: z16.enum([
|
|
2630
|
+
"machine-git",
|
|
2631
|
+
"machine-environment",
|
|
2632
|
+
"project-environment"
|
|
2633
|
+
])
|
|
2634
|
+
}).strict()
|
|
2629
2635
|
]),
|
|
2630
2636
|
value: z16.union([
|
|
2631
2637
|
z16.string(),
|
|
@@ -86,7 +86,7 @@ var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
|
86
86
|
var promptMentionPathEntryKindSchema = z3.enum(
|
|
87
87
|
promptMentionPathEntryKindValues
|
|
88
88
|
);
|
|
89
|
-
var promptMentionCommandTriggerValues = ["/"];
|
|
89
|
+
var promptMentionCommandTriggerValues = ["/", "$"];
|
|
90
90
|
var promptMentionCommandTriggerSchema = z3.enum(
|
|
91
91
|
promptMentionCommandTriggerValues
|
|
92
92
|
);
|
|
@@ -1723,7 +1723,13 @@ var unscopedProviderEventSchema = z14.discriminatedUnion("type", [
|
|
|
1723
1723
|
source: z14.union([
|
|
1724
1724
|
z14.literal("shell"),
|
|
1725
1725
|
z14.object({ plugin: z14.string() }).strict(),
|
|
1726
|
-
z14.object({
|
|
1726
|
+
z14.object({
|
|
1727
|
+
core: z14.enum([
|
|
1728
|
+
"machine-git",
|
|
1729
|
+
"machine-environment",
|
|
1730
|
+
"project-environment"
|
|
1731
|
+
])
|
|
1732
|
+
}).strict()
|
|
1727
1733
|
]),
|
|
1728
1734
|
value: z14.union([
|
|
1729
1735
|
z14.string(),
|
|
@@ -4640,6 +4646,13 @@ var providerRecoveryHintSchema = z25.object({
|
|
|
4640
4646
|
var bridgeErrorDataSchema = z25.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4641
4647
|
|
|
4642
4648
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4649
|
+
var BRIDGE_NOTIFICATION_METHODS = {
|
|
4650
|
+
threadIdentity: "thread/identity",
|
|
4651
|
+
sessionReplaced: "session/replaced",
|
|
4652
|
+
providerRaw: "provider/raw",
|
|
4653
|
+
providerRecovery: "provider/recovery",
|
|
4654
|
+
error: "error"
|
|
4655
|
+
};
|
|
4643
4656
|
var threadIdentityNotificationSchema = z26.object({
|
|
4644
4657
|
threadId: z26.string().min(1),
|
|
4645
4658
|
providerThreadId: z26.string().min(1),
|
|
@@ -4846,6 +4859,36 @@ var IDENTITY_RESULT_SHAPE = "{ providerThreadId, sessionRestorable? }";
|
|
|
4846
4859
|
function identityProblem(parsed, result2) {
|
|
4847
4860
|
return `the result must be ${IDENTITY_RESULT_SHAPE} \u2014 the runtime adopts no session without providerThreadId on the result (a thread/identity notification does not substitute for it); issues: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")} (got ${JSON.stringify(result2)})`;
|
|
4848
4861
|
}
|
|
4862
|
+
var identityNotificationParamsSchema = z28.object({ threadId: z28.string(), providerThreadId: z28.string() }).passthrough();
|
|
4863
|
+
async function checkIdentityAnnounced(context, args) {
|
|
4864
|
+
const { client } = context;
|
|
4865
|
+
const announced = await client.waitFor(() => {
|
|
4866
|
+
const notified = client.notifications(BRIDGE_NOTIFICATION_METHODS.threadIdentity).some((message) => {
|
|
4867
|
+
const params = identityNotificationParamsSchema.safeParse(
|
|
4868
|
+
message.params
|
|
4869
|
+
);
|
|
4870
|
+
return params.success && params.data.threadId === args.threadId && params.data.providerThreadId === args.providerThreadId;
|
|
4871
|
+
});
|
|
4872
|
+
const assembled = threadEvents(context, args.threadId).some(
|
|
4873
|
+
(event) => event.type === "thread/identity" && event.providerThreadId === args.providerThreadId
|
|
4874
|
+
);
|
|
4875
|
+
return notified || assembled ? true : void 0;
|
|
4876
|
+
});
|
|
4877
|
+
if (announced === null) {
|
|
4878
|
+
const named = client.notifications(BRIDGE_NOTIFICATION_METHODS.threadIdentity).flatMap((message) => {
|
|
4879
|
+
const params = identityNotificationParamsSchema.safeParse(
|
|
4880
|
+
message.params
|
|
4881
|
+
);
|
|
4882
|
+
return params.success && params.data.threadId === args.threadId ? [params.data.providerThreadId] : [];
|
|
4883
|
+
});
|
|
4884
|
+
return fail(
|
|
4885
|
+
args.id,
|
|
4886
|
+
args.title,
|
|
4887
|
+
`${args.request} returned providerThreadId "${args.providerThreadId}" for thread "${args.threadId}", but no thread/identity notification or thread.identity delta announced it${named.length === 0 ? "" : ` (thread/identity named ${named.map((id) => `"${id}"`).join(", ")})`}; bb persists and resumes only sessions announced this way, so every later send would start a new session`
|
|
4888
|
+
);
|
|
4889
|
+
}
|
|
4890
|
+
return pass(args.id, args.title);
|
|
4891
|
+
}
|
|
4849
4892
|
function pass(id, title) {
|
|
4850
4893
|
return { id, title, status: "pass", detail: "" };
|
|
4851
4894
|
}
|
|
@@ -5120,6 +5163,8 @@ async function runSkillsConfigureDeclaredScenario(client, declared) {
|
|
|
5120
5163
|
)
|
|
5121
5164
|
];
|
|
5122
5165
|
}
|
|
5166
|
+
var START_IDENTITY_ANNOUNCED_ID = "session/start-identity-announced";
|
|
5167
|
+
var START_IDENTITY_ANNOUNCED_TITLE = "thread/start announces the returned session through thread/identity";
|
|
5123
5168
|
async function runSessionLifecycleScenarios(context) {
|
|
5124
5169
|
const { client, fixture } = context;
|
|
5125
5170
|
const results = [];
|
|
@@ -5160,6 +5205,19 @@ async function runSessionLifecycleScenarios(context) {
|
|
|
5160
5205
|
}
|
|
5161
5206
|
}
|
|
5162
5207
|
const startSkipDetail = "prerequisite session/start-identity failed";
|
|
5208
|
+
results.push(
|
|
5209
|
+
context.providerThreadId === void 0 ? skipped(
|
|
5210
|
+
START_IDENTITY_ANNOUNCED_ID,
|
|
5211
|
+
START_IDENTITY_ANNOUNCED_TITLE,
|
|
5212
|
+
startSkipDetail
|
|
5213
|
+
) : await checkIdentityAnnounced(context, {
|
|
5214
|
+
id: START_IDENTITY_ANNOUNCED_ID,
|
|
5215
|
+
providerThreadId: context.providerThreadId,
|
|
5216
|
+
request: "thread/start",
|
|
5217
|
+
threadId,
|
|
5218
|
+
title: START_IDENTITY_ANNOUNCED_TITLE
|
|
5219
|
+
})
|
|
5220
|
+
);
|
|
5163
5221
|
if (context.providerThreadId === void 0) {
|
|
5164
5222
|
results.push(
|
|
5165
5223
|
skipped(
|
|
@@ -5404,6 +5462,8 @@ async function runSessionLifecycleScenarios(context) {
|
|
|
5404
5462
|
var RESUME_IDENTITY_ID = "session/resume-identity";
|
|
5405
5463
|
var RESUME_IDENTITY_TITLE = "thread/resume returns a provider thread identity";
|
|
5406
5464
|
var FORK_IDENTITY_ID = "session/fork-identity";
|
|
5465
|
+
var FORK_IDENTITY_ANNOUNCED_ID = "session/fork-identity-announced";
|
|
5466
|
+
var FORK_IDENTITY_ANNOUNCED_TITLE = "thread/fork announces the forked session through thread/identity";
|
|
5407
5467
|
var FORK_IDENTITY_TITLE = "thread/fork returns a provider thread identity for the forked session";
|
|
5408
5468
|
async function runForkIdentityScenario(context, threadId) {
|
|
5409
5469
|
const { client, fixture } = context;
|
|
@@ -5456,6 +5516,13 @@ async function runForkIdentityScenario(context, threadId) {
|
|
|
5456
5516
|
)
|
|
5457
5517
|
];
|
|
5458
5518
|
}
|
|
5519
|
+
const announced = await checkIdentityAnnounced(context, {
|
|
5520
|
+
id: FORK_IDENTITY_ANNOUNCED_ID,
|
|
5521
|
+
providerThreadId: parsed.data.providerThreadId,
|
|
5522
|
+
request: "thread/fork",
|
|
5523
|
+
threadId: forkThreadId,
|
|
5524
|
+
title: FORK_IDENTITY_ANNOUNCED_TITLE
|
|
5525
|
+
});
|
|
5459
5526
|
const releaseId = client.request(BRIDGE_REQUEST_METHODS.threadStop, {
|
|
5460
5527
|
threadId: forkThreadId,
|
|
5461
5528
|
providerThreadId: parsed.data.providerThreadId,
|
|
@@ -5463,7 +5530,7 @@ async function runForkIdentityScenario(context, threadId) {
|
|
|
5463
5530
|
activeTurnId: null
|
|
5464
5531
|
});
|
|
5465
5532
|
await client.waitForResponse(releaseId);
|
|
5466
|
-
return [pass(FORK_IDENTITY_ID, FORK_IDENTITY_TITLE)];
|
|
5533
|
+
return [pass(FORK_IDENTITY_ID, FORK_IDENTITY_TITLE), announced];
|
|
5467
5534
|
}
|
|
5468
5535
|
var THREADS_INDEPENDENT_ID = "session/threads-independent";
|
|
5469
5536
|
var THREADS_INDEPENDENT_TITLE = "requests on different threads are independent";
|
package/dist/provider-bridge.js
CHANGED
|
@@ -1647,7 +1647,7 @@ var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
|
1647
1647
|
var promptMentionPathEntryKindSchema = z5.enum(
|
|
1648
1648
|
promptMentionPathEntryKindValues
|
|
1649
1649
|
);
|
|
1650
|
-
var promptMentionCommandTriggerValues = ["/"];
|
|
1650
|
+
var promptMentionCommandTriggerValues = ["/", "$"];
|
|
1651
1651
|
var promptMentionCommandTriggerSchema = z5.enum(
|
|
1652
1652
|
promptMentionCommandTriggerValues
|
|
1653
1653
|
);
|
|
@@ -3655,7 +3655,13 @@ var unscopedProviderEventSchema = z18.discriminatedUnion("type", [
|
|
|
3655
3655
|
source: z18.union([
|
|
3656
3656
|
z18.literal("shell"),
|
|
3657
3657
|
z18.object({ plugin: z18.string() }).strict(),
|
|
3658
|
-
z18.object({
|
|
3658
|
+
z18.object({
|
|
3659
|
+
core: z18.enum([
|
|
3660
|
+
"machine-git",
|
|
3661
|
+
"machine-environment",
|
|
3662
|
+
"project-environment"
|
|
3663
|
+
])
|
|
3664
|
+
}).strict()
|
|
3659
3665
|
]),
|
|
3660
3666
|
value: z18.union([
|
|
3661
3667
|
z18.string(),
|
package/dist/testing/app.js
CHANGED
|
@@ -15803,6 +15803,7 @@ function renderSlot(registration, props, options = {}) {
|
|
|
15803
15803
|
submits: []
|
|
15804
15804
|
};
|
|
15805
15805
|
const composerOwnership = { active: true };
|
|
15806
|
+
const submissionListeners = /* @__PURE__ */ new Set();
|
|
15806
15807
|
const composer = {
|
|
15807
15808
|
getAttachmentCount: () => composerAttachmentCount,
|
|
15808
15809
|
getScope: () => composerScope,
|
|
@@ -15846,6 +15847,21 @@ ${block}
|
|
|
15846
15847
|
}
|
|
15847
15848
|
composerLog.focusCount += 1;
|
|
15848
15849
|
},
|
|
15850
|
+
experimental_onSubmitted(listener) {
|
|
15851
|
+
submissionListeners.add(listener);
|
|
15852
|
+
return () => {
|
|
15853
|
+
submissionListeners.delete(listener);
|
|
15854
|
+
};
|
|
15855
|
+
},
|
|
15856
|
+
experimental_removeMention({ provider, id }) {
|
|
15857
|
+
for (let index = composerLog.mentions.length - 1; index >= 0; index -= 1) {
|
|
15858
|
+
const mention = composerLog.mentions[index];
|
|
15859
|
+
if (mention?.provider === provider && mention.id === id) {
|
|
15860
|
+
commitComposerText(composerText.replace(mention.label, ""));
|
|
15861
|
+
composerLog.mentions.splice(index, 1);
|
|
15862
|
+
}
|
|
15863
|
+
}
|
|
15864
|
+
},
|
|
15849
15865
|
insertMention(mention) {
|
|
15850
15866
|
const label = mention.label.trim() || mention.id;
|
|
15851
15867
|
const separator = composerText.length === 0 || /\s$/u.test(composerText) ? "" : " ";
|
|
@@ -15868,6 +15884,7 @@ ${block}
|
|
|
15868
15884
|
}
|
|
15869
15885
|
composerLog.submits.push(options2);
|
|
15870
15886
|
commitComposerText("");
|
|
15887
|
+
for (const listener of submissionListeners) listener();
|
|
15871
15888
|
}
|
|
15872
15889
|
}
|
|
15873
15890
|
};
|
package/dist/testing/index.js
CHANGED
|
@@ -35,6 +35,7 @@ var RESERVED_BB_CLI_COMMANDS = [
|
|
|
35
35
|
"plugin",
|
|
36
36
|
"project",
|
|
37
37
|
"provider",
|
|
38
|
+
"server",
|
|
38
39
|
"settings",
|
|
39
40
|
"skill",
|
|
40
41
|
"status",
|
|
@@ -4244,6 +4245,7 @@ function makeThreadResponse(overrides = {}) {
|
|
|
4244
4245
|
sectionId: null,
|
|
4245
4246
|
status: "idle",
|
|
4246
4247
|
parentThreadId: null,
|
|
4248
|
+
lifecycleOwnerThreadId: null,
|
|
4247
4249
|
sourceThreadId: null,
|
|
4248
4250
|
originKind: null,
|
|
4249
4251
|
originPluginId: null,
|