@get-bb/plugin-sdk 0.5.27 → 0.5.30

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.
@@ -1717,15 +1717,31 @@ var systemMessageKindValues = [
1717
1717
  "unlabeled"
1718
1718
  ];
1719
1719
  var systemMessageKindSchema = z12.enum(systemMessageKindValues);
1720
+ var systemThreadInterruptedReasonSchema = z12.enum([
1721
+ "manual-stop",
1722
+ "host-daemon-restarted",
1723
+ "host-removed",
1724
+ "provider-turn-idle"
1725
+ ]);
1726
+ var childThreadOutcomeSchema = z12.object({
1727
+ threadId: z12.string(),
1728
+ status: z12.enum(["completed", "failed", "interrupted"]),
1729
+ interruption: z12.object({
1730
+ reason: systemThreadInterruptedReasonSchema,
1731
+ cause: z12.literal("host-connection-lost").optional()
1732
+ }).optional()
1733
+ });
1720
1734
  var systemMessageSubjectSchema = z12.discriminatedUnion("kind", [
1721
1735
  z12.object({
1722
1736
  kind: z12.literal("thread"),
1723
1737
  threadId: z12.string(),
1724
- threadName: z12.string()
1738
+ threadName: z12.string(),
1739
+ outcomes: z12.array(childThreadOutcomeSchema).optional()
1725
1740
  }),
1726
1741
  z12.object({
1727
1742
  kind: z12.literal("thread-batch"),
1728
- count: z12.number()
1743
+ count: z12.number(),
1744
+ outcomes: z12.array(childThreadOutcomeSchema).optional()
1729
1745
  }),
1730
1746
  z12.object({
1731
1747
  kind: z12.literal("tool-call"),
@@ -1873,15 +1889,6 @@ var systemUserQuestionLifecycleEventDataSchema = z13.object({
1873
1889
  statusReason: z13.string().nullable().default(null),
1874
1890
  payload: userQuestionPendingInteractionPayloadSchema
1875
1891
  });
1876
- var systemThreadInterruptedReasonValues = [
1877
- "manual-stop",
1878
- "host-daemon-restarted",
1879
- "host-removed",
1880
- "provider-turn-idle"
1881
- ];
1882
- var systemThreadInterruptedReasonSchema = z13.enum(
1883
- systemThreadInterruptedReasonValues
1884
- );
1885
1892
  var systemThreadInterruptedEventDataSchema = z13.object({
1886
1893
  reason: systemThreadInterruptedReasonSchema,
1887
1894
  cause: z13.literal("host-connection-lost").optional()
@@ -9065,7 +9072,10 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
9065
9072
  modelOption,
9066
9073
  reasoningProbePriorityModelIds
9067
9074
  });
9068
- const models = reasoningByModel === null ? configOptionModels : buildModelCatalogFromConfigOptions(modelOption, reasoningByModel);
9075
+ const models = buildModelCatalogFromConfigOptions(
9076
+ modelOption,
9077
+ reasoningByModel
9078
+ );
9069
9079
  cachedSessionDiscoveredModels = {
9070
9080
  key,
9071
9081
  models,
@@ -9088,7 +9098,7 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
9088
9098
  async function discoverAcpNativeReasoningByModel(args) {
9089
9099
  const modelOptions = args.modelOption?.options ?? [];
9090
9100
  if (!args.modelOption || modelOptions.length === 0) {
9091
- return null;
9101
+ return /* @__PURE__ */ new Map();
9092
9102
  }
9093
9103
  const modelOption = args.modelOption;
9094
9104
  const modelByValue = new Map(
@@ -9109,9 +9119,11 @@ async function discoverAcpNativeReasoningByModel(args) {
9109
9119
  }
9110
9120
  }
9111
9121
  const supportByModel = /* @__PURE__ */ new Map();
9122
+ let timedOut = false;
9112
9123
  let timeout;
9113
9124
  const timeoutReached = new Promise((resolve4) => {
9114
9125
  timeout = setTimeout(() => {
9126
+ timedOut = true;
9115
9127
  args.connection.kill();
9116
9128
  resolve4(supportByModel);
9117
9129
  }, ACP_NATIVE_REASONING_DISCOVERY_TIMEOUT_MS);
@@ -9120,28 +9132,36 @@ async function discoverAcpNativeReasoningByModel(args) {
9120
9132
  return await Promise.race([
9121
9133
  (async () => {
9122
9134
  for (const model of modelsToProbe) {
9123
- const configState = await args.connection.request({
9124
- method: "session/set_config_option",
9125
- params: {
9126
- sessionId: args.sessionId,
9127
- configId: modelOption.id,
9128
- value: model.value
9129
- },
9130
- resultSchema: acpConfigStateResultSchema
9131
- });
9132
- supportByModel.set(
9133
- model.value,
9134
- buildAcpNativeReasoningSupport(
9135
- findAcpThoughtLevelConfigOption(configState.configOptions)
9136
- )
9137
- );
9135
+ try {
9136
+ const configState = await args.connection.request({
9137
+ method: "session/set_config_option",
9138
+ params: {
9139
+ sessionId: args.sessionId,
9140
+ configId: modelOption.id,
9141
+ value: model.value
9142
+ },
9143
+ resultSchema: acpConfigStateResultSchema
9144
+ });
9145
+ supportByModel.set(
9146
+ model.value,
9147
+ buildAcpNativeReasoningSupport(
9148
+ findAcpThoughtLevelConfigOption(configState.configOptions)
9149
+ )
9150
+ );
9151
+ } catch (error) {
9152
+ if (timedOut) {
9153
+ break;
9154
+ }
9155
+ process.stderr.write(
9156
+ `acp bridge: ACP-native reasoning discovery for model "${model.value}" failed: ${error instanceof Error ? error.message : String(error)}
9157
+ `
9158
+ );
9159
+ }
9138
9160
  }
9139
9161
  return supportByModel;
9140
9162
  })(),
9141
9163
  timeoutReached
9142
9164
  ]);
9143
- } catch {
9144
- return supportByModel.size > 0 ? supportByModel : null;
9145
9165
  } finally {
9146
9166
  if (timeout !== void 0) {
9147
9167
  clearTimeout(timeout);
@@ -806,15 +806,31 @@ var systemMessageKindValues = [
806
806
  "unlabeled"
807
807
  ];
808
808
  var systemMessageKindSchema = z10.enum(systemMessageKindValues);
809
+ var systemThreadInterruptedReasonSchema = z10.enum([
810
+ "manual-stop",
811
+ "host-daemon-restarted",
812
+ "host-removed",
813
+ "provider-turn-idle"
814
+ ]);
815
+ var childThreadOutcomeSchema = z10.object({
816
+ threadId: z10.string(),
817
+ status: z10.enum(["completed", "failed", "interrupted"]),
818
+ interruption: z10.object({
819
+ reason: systemThreadInterruptedReasonSchema,
820
+ cause: z10.literal("host-connection-lost").optional()
821
+ }).optional()
822
+ });
809
823
  var systemMessageSubjectSchema = z10.discriminatedUnion("kind", [
810
824
  z10.object({
811
825
  kind: z10.literal("thread"),
812
826
  threadId: z10.string(),
813
- threadName: z10.string()
827
+ threadName: z10.string(),
828
+ outcomes: z10.array(childThreadOutcomeSchema).optional()
814
829
  }),
815
830
  z10.object({
816
831
  kind: z10.literal("thread-batch"),
817
- count: z10.number()
832
+ count: z10.number(),
833
+ outcomes: z10.array(childThreadOutcomeSchema).optional()
818
834
  }),
819
835
  z10.object({
820
836
  kind: z10.literal("tool-call"),
@@ -962,15 +978,6 @@ var systemUserQuestionLifecycleEventDataSchema = z11.object({
962
978
  statusReason: z11.string().nullable().default(null),
963
979
  payload: userQuestionPendingInteractionPayloadSchema
964
980
  });
965
- var systemThreadInterruptedReasonValues = [
966
- "manual-stop",
967
- "host-daemon-restarted",
968
- "host-removed",
969
- "provider-turn-idle"
970
- ];
971
- var systemThreadInterruptedReasonSchema = z11.enum(
972
- systemThreadInterruptedReasonValues
973
- );
974
981
  var systemThreadInterruptedEventDataSchema = z11.object({
975
982
  reason: systemThreadInterruptedReasonSchema,
976
983
  cause: z11.literal("host-connection-lost").optional()
@@ -2244,15 +2244,31 @@ var systemMessageKindValues = [
2244
2244
  "unlabeled"
2245
2245
  ];
2246
2246
  var systemMessageKindSchema = z14.enum(systemMessageKindValues);
2247
+ var systemThreadInterruptedReasonSchema = z14.enum([
2248
+ "manual-stop",
2249
+ "host-daemon-restarted",
2250
+ "host-removed",
2251
+ "provider-turn-idle"
2252
+ ]);
2253
+ var childThreadOutcomeSchema = z14.object({
2254
+ threadId: z14.string(),
2255
+ status: z14.enum(["completed", "failed", "interrupted"]),
2256
+ interruption: z14.object({
2257
+ reason: systemThreadInterruptedReasonSchema,
2258
+ cause: z14.literal("host-connection-lost").optional()
2259
+ }).optional()
2260
+ });
2247
2261
  var systemMessageSubjectSchema = z14.discriminatedUnion("kind", [
2248
2262
  z14.object({
2249
2263
  kind: z14.literal("thread"),
2250
2264
  threadId: z14.string(),
2251
- threadName: z14.string()
2265
+ threadName: z14.string(),
2266
+ outcomes: z14.array(childThreadOutcomeSchema).optional()
2252
2267
  }),
2253
2268
  z14.object({
2254
2269
  kind: z14.literal("thread-batch"),
2255
- count: z14.number()
2270
+ count: z14.number(),
2271
+ outcomes: z14.array(childThreadOutcomeSchema).optional()
2256
2272
  }),
2257
2273
  z14.object({
2258
2274
  kind: z14.literal("tool-call"),
@@ -2400,15 +2416,6 @@ var systemUserQuestionLifecycleEventDataSchema = z15.object({
2400
2416
  statusReason: z15.string().nullable().default(null),
2401
2417
  payload: userQuestionPendingInteractionPayloadSchema
2402
2418
  });
2403
- var systemThreadInterruptedReasonValues = [
2404
- "manual-stop",
2405
- "host-daemon-restarted",
2406
- "host-removed",
2407
- "provider-turn-idle"
2408
- ];
2409
- var systemThreadInterruptedReasonSchema = z15.enum(
2410
- systemThreadInterruptedReasonValues
2411
- );
2412
2419
  var systemThreadInterruptedEventDataSchema = z15.object({
2413
2420
  reason: systemThreadInterruptedReasonSchema,
2414
2421
  cause: z15.literal("host-connection-lost").optional()
@@ -2073,6 +2073,7 @@ function renderSlot(registration, props, options = {}) {
2073
2073
  experimental_archived: options.sidebarThreads?.experimental_archived ?? null,
2074
2074
  status: options.sidebarThreads?.status ?? "ready",
2075
2075
  threads: options.sidebarThreads?.threads ?? [],
2076
+ experimental_hosts: options.sidebarThreads?.experimental_hosts ?? [],
2076
2077
  projects: options.sidebarThreads?.projects ?? [],
2077
2078
  sections: options.sidebarThreads?.sections ?? []
2078
2079
  };
@@ -1968,6 +1968,12 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1968
1968
  declaration.experimental_existingPath,
1969
1969
  "experimental_existingPath"
1970
1970
  );
1971
+ assertOptionalFunction(
1972
+ "environment provider",
1973
+ id,
1974
+ declaration.restore,
1975
+ "a restore"
1976
+ );
1971
1977
  return {
1972
1978
  id,
1973
1979
  displayName,
@@ -1980,6 +1986,7 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
1980
1986
  validate: declaration.validate ?? null,
1981
1987
  experimental_existingPath: declaration.experimental_existingPath ?? null,
1982
1988
  create: declaration.create,
1989
+ restore: declaration.restore ?? null,
1983
1990
  remove: declaration.remove,
1984
1991
  policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
1985
1992
  };
@@ -4253,8 +4260,10 @@ function makeThreadResponse(overrides = {}) {
4253
4260
  updatedAt: 0,
4254
4261
  runtime: { displayStatus: "idle", hostReconnectGraceExpiresAt: null },
4255
4262
  activeBackgroundAgentCount: 0,
4263
+ canRestoreEnvironment: false,
4256
4264
  canSpawnChild: true,
4257
4265
  queuedMessageCount: 0,
4266
+ draft: null,
4258
4267
  ...overrides
4259
4268
  };
4260
4269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.5.27",
3
+ "version": "0.5.30",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"