@get-bb/plugin-sdk 0.6.105 → 0.6.112

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.
@@ -1831,6 +1831,10 @@ var queuedMessageStateValues = [
1831
1831
  "claimed"
1832
1832
  ];
1833
1833
  var queuedMessageStateSchema = z10.enum(queuedMessageStateValues);
1834
+ var queuedMessageDeliveryModeValues = ["steer", "queue"];
1835
+ var queuedMessageDeliveryModeSchema = z10.enum(
1836
+ queuedMessageDeliveryModeValues
1837
+ );
1834
1838
 
1835
1839
  // ../domain/src/thread-status.ts
1836
1840
  import { z as z11 } from "zod";
@@ -3578,6 +3582,113 @@ var experimental_THREAD_ACTION_GROUPS = {
3578
3582
  lifecycle: "4_lifecycle"
3579
3583
  };
3580
3584
 
3585
+ // src/internal/thread-status.ts
3586
+ var INDICATOR_LABELS = {
3587
+ "unread-error": "Unread thread failed",
3588
+ "waiting-for-input": "Thread needs user input",
3589
+ "working-draft": "Thread working with unsubmitted draft",
3590
+ workflow: "Workflow running",
3591
+ "background-agent": "Background agent running",
3592
+ "background-command": "Background command running",
3593
+ "plan-mode": "Plan mode active",
3594
+ goal: "Goal active",
3595
+ runtime: "Thread working",
3596
+ "queued-failed": "Queued message failed to send",
3597
+ "queued-waiting": "Thread has a message waiting to send",
3598
+ draft: "Thread has unsubmitted draft",
3599
+ "unread-success": "Unread thread succeeded"
3600
+ };
3601
+ var RUNNING_RUNTIME_STATUSES = {
3602
+ active: true,
3603
+ provisioning: true,
3604
+ starting: true,
3605
+ stopping: true,
3606
+ error: false,
3607
+ idle: false,
3608
+ pending: false,
3609
+ "waiting-for-host": false
3610
+ };
3611
+ var DONE_THREAD_STATUSES = {
3612
+ error: true,
3613
+ idle: true,
3614
+ active: false,
3615
+ starting: false,
3616
+ stopping: false,
3617
+ pending: false
3618
+ };
3619
+ var INDICATORS_OVER_ROW_STATUS = /* @__PURE__ */ new Set(["runtime", "unread-error", "waiting-for-input"]);
3620
+ function threadIndicatorLabel(indicator) {
3621
+ return indicator === "none" ? null : INDICATOR_LABELS[indicator];
3622
+ }
3623
+ function visibleThreadRowStatus(indicator, rowStatus) {
3624
+ return INDICATORS_OVER_ROW_STATUS.has(indicator) ? null : rowStatus;
3625
+ }
3626
+ function isUnreadDoneThread(thread) {
3627
+ return thread.parentThreadId === null && thread.isUnread && DONE_THREAD_STATUSES[thread.status];
3628
+ }
3629
+ function addThreadFlags(flags, thread) {
3630
+ const unreadDone = isUnreadDoneThread(thread);
3631
+ flags.pending ||= thread.hasPendingInteraction;
3632
+ flags.unreadError ||= unreadDone && thread.status === "error";
3633
+ flags.unreadSuccess ||= unreadDone && thread.status !== "error";
3634
+ flags.runtime ||= RUNNING_RUNTIME_STATUSES[thread.runtimeStatus];
3635
+ flags.workflow ||= thread.activity.workflows > 0;
3636
+ flags.backgroundAgent ||= thread.activity.backgroundAgents > 0;
3637
+ flags.backgroundCommand ||= thread.activity.backgroundCommands > 0;
3638
+ flags.planMode ||= thread.activity.planMode > 0;
3639
+ flags.goal ||= thread.activity.goals > 0;
3640
+ }
3641
+ function resolveIndicator(flags, queuedWork, hasUnsubmittedDraft, isWorking) {
3642
+ if (flags.unreadError) return "unread-error";
3643
+ if (flags.pending) return "waiting-for-input";
3644
+ if (hasUnsubmittedDraft && isWorking) return "working-draft";
3645
+ if (flags.planMode) return "plan-mode";
3646
+ if (flags.goal) return "goal";
3647
+ if (flags.runtime) return "runtime";
3648
+ if (flags.workflow) return "workflow";
3649
+ if (queuedWork === "failed") return "queued-failed";
3650
+ if (flags.unreadSuccess) return "unread-success";
3651
+ if (flags.backgroundAgent) return "background-agent";
3652
+ if (flags.backgroundCommand) return "background-command";
3653
+ if (queuedWork === "waiting") return "queued-waiting";
3654
+ if (hasUnsubmittedDraft) return "draft";
3655
+ return "none";
3656
+ }
3657
+ function experimental_resolveThreadStatus({
3658
+ thread,
3659
+ hiddenThreads,
3660
+ hasUnsubmittedDraft,
3661
+ rowStatus
3662
+ }) {
3663
+ const flags = {
3664
+ pending: false,
3665
+ unreadError: false,
3666
+ unreadSuccess: false,
3667
+ runtime: false,
3668
+ workflow: false,
3669
+ backgroundAgent: false,
3670
+ backgroundCommand: false,
3671
+ planMode: false,
3672
+ goal: false
3673
+ };
3674
+ if (thread !== null) addThreadFlags(flags, thread);
3675
+ for (const hiddenThread of hiddenThreads) addThreadFlags(flags, hiddenThread);
3676
+ const isThreadWorking = flags.runtime || flags.workflow || flags.backgroundAgent || flags.backgroundCommand || flags.planMode || flags.goal;
3677
+ const indicator = resolveIndicator(
3678
+ flags,
3679
+ thread?.queuedWork ?? "none",
3680
+ hasUnsubmittedDraft,
3681
+ isThreadWorking
3682
+ );
3683
+ const shownRowStatus = visibleThreadRowStatus(indicator, rowStatus);
3684
+ return {
3685
+ indicator,
3686
+ rowStatus: shownRowStatus,
3687
+ label: shownRowStatus?.label ?? threadIndicatorLabel(indicator),
3688
+ isWorking: isThreadWorking || rowStatus?.tone === "running"
3689
+ };
3690
+ }
3691
+
3581
3692
  // src/thread-info-groups.ts
3582
3693
  var experimental_THREAD_CONTEXT_SEGMENT_GROUPS = {
3583
3694
  thread: "1_thread",
@@ -5834,6 +5945,7 @@ var testPluginSdkApp = {
5834
5945
  },
5835
5946
  ThreadTitle: TestThreadTitle,
5836
5947
  experimental_ThreadStatusGlyph: TestThreadStatusGlyph,
5948
+ experimental_resolveThreadStatus,
5837
5949
  experimental_ThreadRowMetadata: TestThreadRowMetadata,
5838
5950
  useEnvironmentProviders() {
5839
5951
  return useSlotEnv("useEnvironmentProviders").environmentProviders;
@@ -3859,6 +3859,9 @@ function createFakePluginHostInternal(options, sharedState) {
3859
3859
  }
3860
3860
  };
3861
3861
  const bb = {
3862
+ internal_DO_NOT_USE_recordPluginUse() {
3863
+ assertLive();
3864
+ },
3862
3865
  pluginId,
3863
3866
  log,
3864
3867
  settings,
@@ -4749,6 +4752,7 @@ function makeTurnFailedEvent(overrides = {}) {
4749
4752
  inputAccepted: true,
4750
4753
  rateLimits: null,
4751
4754
  attemptNumber: 1,
4755
+ originPluginId: null,
4752
4756
  ...overrides
4753
4757
  };
4754
4758
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.6.105",
3
+ "version": "0.6.112",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"
@@ -92,6 +92,12 @@
92
92
  "import": "./dist/internal/composer-view.js",
93
93
  "default": "./dist/internal/composer-view.js"
94
94
  },
95
+ "./internal/thread-status": {
96
+ "source": "./src/internal/thread-status.ts",
97
+ "types": "./bundled-types/bb-plugin-sdk-internal-thread-status.d.ts",
98
+ "import": "./dist/internal/thread-status.js",
99
+ "default": "./dist/internal/thread-status.js"
100
+ },
95
101
  "./internal/file-navigation-validation": {
96
102
  "source": "./src/internal/file-navigation-validation.ts",
97
103
  "types": "./bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts",