Skip to content

Add durable drafts to the SDK and CLI - #3501

Closed
brsbl wants to merge 7 commits into
mainfrom
bb/server-draft-resources-thr_8j56at3ii2
Closed

brsbl wants to merge 7 commits into
mainfrom
bb/server-draft-resources-thr_8j56at3ii2

Conversation

@brsbl

@brsbl brsbl commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

New-thread drafts only existed in the app's local composer storage. Agents could not create, edit, or submit the same durable drafts through the SDK and CLI.

What changed

  • Added server-backed drafts with stable IDs, contents, destinations, composer options, and revision-checked updates/deletion.
  • Added sdk.drafts and bb thread draft create/list/get/update/delete/submit operations, with guide and skill documentation.
  • Submission receipts prevent duplicate threads and preserve edits newer than the submitted revision.
  • Stable-ID creation acknowledges import retries without overwriting newer data or resurrecting deleted drafts.
  • Unsent draft contents now persist on the server, as explicitly approved. Existing browser composer data remains untouched in this layer.
  • The CLI uses the existing thread namespace, preserving plugin short names. Existing APIs and daemon protocols remain compatible. Plugin SDK patch 0.4.84 carries the additive SDK declarations.

The additive draft migration is now 0118_draft_resources, following main’s shipped machine-provider migration.

This foundation targets main and is independent of the palette stack. Draft UI, local recovery/import, opening/splits, and lifecycle preferences follow in focused layers.

How you verified

  • Exact-head remote CI and required PR checks passed at d70cb6fe262bf3ad7ad98d29c820dd2c63bd94ec, including current main’s machine-provider contract. A package job timed out in existing file-backed database tests and passed on rerun without code changes.
  • After integration, real source SDK/CLI passed with the app disconnected: create/read/update, stale-write rejection, provider-owned machine destination, submission retry, and preservation of a second draft.
  • Real migrated-database, API concurrency/recovery, SDK/CLI, plugin attribution, and packaged SDK checks passed remotely.
  • Real SDK and built CLI passed against the isolated source server with no browser connected.
  • The single permitted review is complete; both validated P1 findings are fixed.
Runtime verification

Using Node 22.19.0, BBSdk from packages/bb-app/src/public-sdk.ts and the source CLI (apps/cli/src/index.ts after integration; launcher-built CLI in the initial pass):

  • Created independent drafts through both interfaces and read identical IDs, contents, options, and destinations through the other.
  • Verified complete CLI IDs, empty-draft opt-in, project/text filtering, field-preserving edits, and stale revision rejection.
  • Verified acknowledged singleton import retries preserve newer edits and never resurrect a deleted draft.
  • Verified invalid submissions retain drafts and enforce existing Personal project workspace policy.
  • Submitted drafts with a real uploaded attachment and future schedule through SDK and CLI; cross-interface retries returned the same thread.
  • Confirmed another draft survived submission, then deleted the synthetic scheduled threads and remaining drafts.

The source launcher exceeded its startup timer on the busy host; its server and daemon subsequently became healthy and connected. Owned process directories and both health endpoints were verified before the interactions. Fixture setup was corrected to use the existing personal-workspace type and required thread-deletion confirmation field. No product correction was needed. No local tests, typechecks, or lint were run.

BB-Thread-ID: thr_8j56at3ii2

AGENT GENERATED

@brsbl
brsbl marked this pull request as ready for review September 11, 2026 18:01
@brsbl
brsbl added this pull request to stack #3532 September 11, 2026 20:31
@brsbl

brsbl commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded at the user's request. The current implementation builds on the shipped Drafts plugin, threads, and queued messages: #3930 (SDK/CLI lifecycle filtering and save actions), #3933 (sidebar filters), #3938 (palette filters), and #3931 (independent New thread split composers). This PR is no longer a merge candidate. Its branch is retained.

@brsbl brsbl closed this Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant