Skip to content

feat(sdk): add builder functions for workflows, DMs, and presence#589

Merged
wpfleger96 merged 2 commits into
mainfrom
wpfleger/sdk-workflow-dm-presence-builders
May 14, 2026
Merged

feat(sdk): add builder functions for workflows, DMs, and presence#589
wpfleger96 merged 2 commits into
mainfrom
wpfleger/sdk-workflow-dm-presence-builders

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

Summary

  • Adds 8 builder functions to sprout-sdk/src/builders.rs: build_workflow_def, build_workflow_update, build_workflow_delete, build_workflow_trigger, build_workflow_approval, build_dm_open, build_dm_add_member, build_presence_update
  • Updates 3 CLI modules (workflows.rs, dms.rs, users.rs) to use the new SDK builders instead of raw nostr::{EventBuilder, Kind, Tag} with magic kind number literals
  • Uses named constants from sprout_core::kind (KIND_WORKFLOW_DEF, KIND_DM_OPEN, etc.) instead of raw integers

Prerequisite for #585 — once merged, the CLI restructuring branch can rebase to pick up the builders and remove its TODO(phase-4) items.

Three CLI modules constructed Nostr events by hand using raw
EventBuilder with magic kind numbers while every other module used
sprout_sdk builders. Added 8 builders (build_workflow_def,
build_workflow_update, build_workflow_delete, build_workflow_trigger,
build_workflow_approval, build_dm_open, build_dm_add_member,
build_presence_update) and updated the CLI consumers to use them.
@wpfleger96 wpfleger96 requested a review from wesbillman as a code owner May 14, 2026 21:29
Presence wire format: relay reads status from event.content, not tags.
build_presence_update now sets content=status (Codex caught this).

Workflow update: relay requires h-tag for channel-scoped authorization.
build_workflow_update now takes channel_id parameter (confirmed by
Gemini against relay handler source — extract_h_tag_channel rejects
events without it).

Exit code regression: SdkError::InvalidInput mapped to CliError::Other
(exit 4) instead of CliError::Usage (exit 1). Added sdk_err() helper
that routes InvalidInput to Usage across all 8 CLI call sites.

Additional fixes from review: token_hash hex validation in
build_workflow_approval, check_content guard on workflow YAML,
hardcoded "30620" replaced with KIND_WORKFLOW_DEF constant,
workflow_id typed as Uuid, section headers normalized, 27 new tests.
@wesbillman
Copy link
Copy Markdown
Collaborator

@codex please review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wpfleger96 wpfleger96 merged commit 01a3df7 into main May 14, 2026
15 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/sdk-workflow-dm-presence-builders branch May 14, 2026 22:49
wpfleger96 added a commit that referenced this pull request May 14, 2026
Both branches added parse_uuid to validate.rs — keep the version
with the more descriptive error message (includes parse error detail).
tlongwell-block added a commit that referenced this pull request May 15, 2026
* origin/main: (33 commits)
  dev-mcp: add view_image tool (#602)
  fix(relay,desktop): only advertise NIP-43 when enforced; probe pairing by supported_nips (#601)
  fix(desktop): derive unread state from NIP-RS + relay catch-up only (#599)
  docs(testing): rewrite TESTING.md for current API and CLI-first workflow (#597)
  fix(agent): fix OpenAI-compat request body serialization and max_tokens (#595)
  feat(desktop): per-persona and per-agent env var overrides (#594)
  fix(desktop): stop pinning agents to deprecated SPROUT_ACP_TURN_TIMEOUT (#592)
  fix(desktop): populate member_count in get_channels so channel browser shows real counts (#548)
  fix(desktop): autofocus message composer on channel/thread open (#572)
  refactor(cli): restructure flat commands into 12 subcommand groups (#585)
  feat(sdk): add builder functions for workflows, DMs, and presence (#589)
  feat(desktop): add message more-actions dropdown menu (#590)
  fix(mobile): preserve channel list across background/resume reconnection (#588)
  Redesign Home as an inbox (#582)
  fix(desktop): drive unread badges from live subscription, not refetched lastMessageAt (#581)
  fix(desktop): refine header scaling and shadow (#573)
  fix(desktop): keep day dividers below header (#574)
  Move agent activity below composer (#579)
  docs(nips): NIP-AE — Agent Engrams (#575)
  refactor: extract shared @mention resolver into sprout-sdk (#580)
  ...

Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
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.

3 participants