@floomhq/signaldash 0.22.0 → 0.28.0

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/README.md CHANGED
@@ -52,7 +52,7 @@ npx -y @floomhq/signaldash connect linkedin claim <account_id>
52
52
  Paste this command into a terminal:
53
53
 
54
54
  ```bash
55
- claude mcp add signaldash -- npx -y @floomhq/signaldash mcp
55
+ claude mcp add signaldash -s user -- npx -y @floomhq/signaldash mcp
56
56
  ```
57
57
 
58
58
  ### Cursor
@@ -82,20 +82,25 @@ The MCP server uses the user token created by `login`. It cannot access a
82
82
  LinkedIn, WhatsApp, or email account until that channel has been connected for
83
83
  the same logged-in user.
84
84
 
85
- ## Give the agent the operating skill
85
+ ## Operating skill distribution
86
86
 
87
87
  The canonical [`signaldash` skill](skills/signaldash/SKILL.md) teaches an agent
88
88
  when to use SignalDash, how to persist the skill, complete setup, interpret
89
89
  connection state, operate every tool, handle server guards, and run safe worked
90
- flows. It is also served as raw Markdown for agents at:
90
+ flows. The one-command setup installs the skill from the same pinned npm package
91
+ the human chose to execute:
91
92
 
92
- ```text
93
- https://signaldash.dev/SKILL.md
93
+ ```bash
94
+ npx -y @floomhq/signaldash@0.28.0 <invite-code>
94
95
  ```
95
96
 
96
- The one-command setup installs the bundled copy into Claude Code. Other clients
97
- must save the skill in their documented skill directory and reload skill
98
- discovery. The narrower
97
+ Run that command in a terminal, not in an agent chat. Do not ask an agent to
98
+ fetch a remote `SKILL.md` and install it as trusted instructions. The public
99
+ `https://signaldash.dev/SKILL.md` endpoint remains available for transparent
100
+ human review only.
101
+
102
+ Other clients can install the reviewed bundled file from the package into their
103
+ documented skill directory and reload skill discovery. The narrower
99
104
  [`signaldash-safe-usage` skill](skills/signaldash-safe-usage/SKILL.md) remains
100
105
  available for clients that separate operating and send-safety instructions.
101
106
 
@@ -116,25 +121,169 @@ SignalDash exposes:
116
121
  - `sd_settings_get()`
117
122
  - `sd_settings_set(auto_accept_linkedin, auto_accept_linkedin_filters?, confirm)`
118
123
  - `sd_auto_accept_status()`
124
+ - `sd_voice_profile(channel, force_recompute?)`
119
125
  - `li_search_connections(query, filters?, limit?)`
120
126
  - `li_discover_people(query, filters?, limit?, confirm?)`
121
127
  - `li_create_invitation_batch(source_label, time_zone, targets)`
122
128
  - `li_get_invitation_batch(batch_id)`
123
129
  - `li_cancel_invitation_batch(batch_id, approval_view_hash, confirm)`
130
+ - `sd_campaign_create(source_label, time_zone, messages, target_source?, targets?, engagers?, invite_ttl_days?)`
131
+ - `sd_campaign_preview(campaign_id)`
132
+ - `sd_campaign_approve(campaign_id, confirm_token)`
133
+ - `sd_campaign_status(campaign_id)`
134
+ - `sd_campaign_cancel(campaign_id, approval_view_hash, confirm)`
135
+ - `sd_withdrawal_batch_create(account, exclude, time_zone, older_than_days?, limit?, source_label?, allow_unmatched_exclusions?)`
136
+ - `sd_withdrawal_batch_status(withdrawal_batch_id)`
137
+ - `sd_withdrawal_batch_approve(withdrawal_batch_id, confirm_token)`
138
+ - `sd_withdrawal_batch_cancel(withdrawal_batch_id, approval_view_hash, confirm)`
124
139
  - `wa_list_chats`
125
140
  - `wa_read_messages(chat_id)`
126
- - `wa_send_message(chat_id, text)`
141
+ - `wa_get_attachment(chat_id, message_id, attachment_id)`
142
+ - `wa_transcribe_voice(chat_id, message_id, attachment_id)`
143
+ - `wa_send_message(chat_id, text?, attachments?)`
144
+ - `wa_delete_message(chat_id, message_id)`
145
+ - `wa_delete_messages(messages)`
127
146
  - `email_list(limit)`
128
147
  - `email_read(thread_id, limit)`
129
148
  - `email_send(to, subject, body)`
130
149
  - `li_my_posts(limit, member_id)`
131
150
  - `li_post_reactions(post_id, limit)`
132
151
  - `li_post_comments(post_id, limit)`
133
- - `li_draft_post(text, publish)`
152
+ - `li_draft_post(text, publish, scheduled_at?, mentions?, attachments?, first_comment?)`
153
+ - `li_set_scheduled_post_first_comment(id, first_comment, confirm)`
154
+ - `li_scheduled_posts()`
155
+ - `li_cancel_scheduled_post(id, confirm)`
156
+ - `sd_schedule_message(channel, chat_id, text, scheduled_at, confirm)`
157
+ - `sd_scheduled_messages(state?, channel?)`
158
+ - `sd_cancel_scheduled_message(id, confirm)`
134
159
 
135
160
  Every operation runs through the hosted SignalDash backend. Agents never
136
161
  receive the Unipile access key.
137
162
 
163
+ A WhatsApp message can carry files. `wa_send_message` takes up to 4 exact
164
+ `{filename, content_type, content_base64}` attachments, at most 16 MiB per file
165
+ and 16 MiB per message, and accepts PNG, JPEG, WebP, GIF, PDF, CSV, plain text,
166
+ JSON, xlsx and zip. `text` is the caption and may be omitted when a file is
167
+ attached, but a call carrying neither text nor an attachment is refused rather
168
+ than sent as an empty message. There is no attachment lane: a send with a file
169
+ runs the same ownership check, the same read-before-send guard, the same
170
+ duplicate guard and the same daily budget as a text send, and is recorded the
171
+ same way. Files are validated before anything is reserved, so a malformed or
172
+ oversized attachment costs no send budget and never reaches the provider, and
173
+ every refusal names the exact rule and the exact file that tripped it. Nothing
174
+ is ever truncated or dropped silently. LinkedIn messages carry text only, and
175
+ `li_send_message` refuses an `attachments` argument instead of ignoring it.
176
+
177
+ A recent read is no longer sufficient on its own. A message send re-reads the
178
+ thread immediately before sending and refuses with `409 thread_changed` unless
179
+ it is still the exact thread that was read, which is the guard LinkedIn has
180
+ always had and WhatsApp did not: a 30-minute read window is satisfied just as
181
+ comfortably by a conversation that moved 29 minutes ago as by one nobody has
182
+ touched, and a reply that arrived in between is precisely when a draft stops
183
+ being the right thing to send. The comparison is a hash over the page that was
184
+ read, taken at the same item limit, so the re-read has to match message for
185
+ message. A chat whose most recent read predates this guard carries no such hash
186
+ and is refused with `428 read_before_send_required` until it is read again,
187
+ rather than waved through on a timestamp that cannot answer the question. If the
188
+ re-read itself fails, the send is refused with
189
+ `502 thread_preflight_unavailable`: whether the thread changed is then unknown,
190
+ and unknown is not permission. All three refusals happen before anything is
191
+ reserved, so none of them costs send budget.
192
+
193
+ A provider answer this process cannot read counts as a re-read that failed, not
194
+ as an empty conversation. Only the two documented list envelopes are hashed;
195
+ anything else yields no hash at all, so a read that hits a drifted shape records
196
+ no authorization (the next send is refused at `428`) and a re-read that hits one
197
+ refuses at `502` rather than being compared. That distinction is the whole
198
+ guard: hashing an unrecognised answer to the hash of an empty thread would let a
199
+ read and a re-read that had both seen nothing agree with each other and satisfy
200
+ the requirement that a human looked at the conversation.
201
+
202
+ A send is not idempotent, so an unconfirmed one is not silently retryable. If
203
+ the provider times out, fails with a 5xx, or answers 2xx with a body that will
204
+ not parse, the message may well have been delivered: SignalDash records the
205
+ attempt before the request leaves and refuses an identical retry with
206
+ `409 send_outcome_unknown`. Read the chat again, and only if the message is
207
+ genuinely absent, resend the identical payload with `confirm_resend:true`. That
208
+ re-read is enforced rather than merely instructed: a resend whose most recent
209
+ read of the chat predates the failed attempt is refused with
210
+ `428 reread_after_failed_send_required`, since a read taken beforehand cannot
211
+ show whether the message arrived. Time does not
212
+ clear that record, because waiting does not turn a delivered message into an
213
+ undelivered one; only the caller confirming what the thread actually shows
214
+ does. A provider that answers with a 4xx refused the message outright, so that
215
+ record is cleared and the send stays retryable. Two 4xx answers are excepted,
216
+ as a judgement call rather than on documented provider semantics: `408` and
217
+ `429` can both arrive after a message was already accepted and forwarded, so
218
+ they are treated as unknown outcomes too.
219
+ Override the ceilings with `SIGNALDASH_MESSAGE_ATTACHMENT_MAX_BYTES` and
220
+ `SIGNALDASH_MESSAGE_ATTACHMENT_MAX_TOTAL_BYTES`; raising either also needs
221
+ `SIGNALDASH_MESSAGE_SEND_MAX_BODY_BYTES` raised to match, because base64 costs a
222
+ third on top of the bytes and a body over that cap is refused with
223
+ `413 request_too_large` before it is parsed.
224
+
225
+ Future LinkedIn posts are persisted by the backend only after the exact text,
226
+ offset-qualified publish time, mentions, image attachments, and optional first
227
+ comment have human approval. The stored image bytes and comment text cannot
228
+ drift after approval. The scheduler publishes the comment through the same
229
+ connected LinkedIn account immediately after the post. It persists the post ID
230
+ before attempting the comment, so a comment failure never republishes the post.
231
+ The scheduler
232
+ uses the same sender binding, action ledger, duplicate guard, daily budget, and
233
+ provider-warning lock as immediate publishing. An interrupted or ambiguous
234
+ execution fails closed and is never retried automatically.
235
+
236
+ `sd_schedule_message` puts one exact message into one exact chat at one exact
237
+ time, on WhatsApp or LinkedIn, text only. It enqueues; it never sends. The
238
+ attachment bytes a WhatsApp send accepts are refused here rather than held on
239
+ disk for days. The worker sends,
240
+ through `sendWhatsAppMessage` and through the LinkedIn preflight and write path,
241
+ so a scheduled message clears every guard a live send clears, including the
242
+ daily budget and the duplicate guard, at the moment it fires rather than at the
243
+ moment it was written. Scheduling is refused with
244
+ `428 read_before_send_required` unless this session has already read that exact
245
+ chat, at `limit` 10 or more on LinkedIn, because the row has to carry a hash of
246
+ the conversation it was written against. That hash is read from the recorded
247
+ read and cannot be supplied by the caller: `watermark` and `item_limit` are
248
+ refused by name rather than accepted and overwritten, since a caller that
249
+ believes it set them believes something false. At fire time the worker re-reads
250
+ the thread and compares. Anything other than "unchanged" parks the row in
251
+ `needs_review` with a reason and sends nothing, because a conversation that
252
+ moved is a question for a human and not a failure of the message.
253
+ `sd_scheduled_messages` lists the caller's own rows with those reasons, and
254
+ counts the `needs_review` ones outside whatever filter was asked for, so a
255
+ filtered listing cannot hide a message waiting on a person.
256
+ `sd_cancel_scheduled_message` cancels a row that has not fired.
257
+ A row belonging to another account is refused in exactly the same words as an id
258
+ that never existed, so the refusal cannot be used to prove somebody else's
259
+ message is real. A row that already sent is refused with the plain statement
260
+ that cancelling cannot unsend it.
261
+
262
+ A campaign is one connection request per approved person, then the approved
263
+ message once a fresh profile read proves that person accepted, then an optional
264
+ follow-up that stops the moment they reply. A pending invitation that merely
265
+ disappeared is never treated as an acceptance. Campaign writes consume the same
266
+ per-sender daily budget as manual sends, obey the Monday-Friday 09:00-17:00
267
+ sender-local window and the 90-180 second pacing interval, and cannot start
268
+ without a human approval recorded on the authenticated approval page. An agent
269
+ can present that page and carry back the one-time code it mints, but can never
270
+ approve on its own.
271
+
272
+ A withdrawal sweep clears a backlog of old pending SENT invitations. It uses the
273
+ same object as an invitation batch with the arrow reversed: freeze the exact
274
+ invitation ids now, one human approval bound to the rendered view, then one
275
+ withdrawal per tick. Two things it will never claim, because both contradict
276
+ LinkedIn's own documentation: withdrawing does **not** lift an active sending
277
+ restriction, so this buys no sending capacity; and after withdrawing, that
278
+ member cannot be re-invited for up to three weeks. The exclusion list is a
279
+ required field rather than an option, so protecting nobody is a deliberate
280
+ choice and not a default. LinkedIn exposes invitation age as a bucket ("sent 4
281
+ months ago"), never a date, so the filter selects only when the whole bucket
282
+ clears the threshold and the review page reports what that conservatism held
283
+ back. The sweep runs on its own daily allowance and never consumes the send
284
+ budget, and any 403, 429, provider warning, or account status change stops it
285
+ entirely.
286
+
138
287
  LinkedIn invitation auto-accept is off for every user until that user
139
288
  explicitly enables it with `confirm:true`. The optional filters are an exact
140
289
  public-identifier allowlist and description-keyword matches; when both groups
@@ -201,6 +350,15 @@ workflow around that runtime control:
201
350
  `resets_at`, plus matching `X-RateLimit-*` headers. When the per-user cap is
202
351
  exhausted, SignalDash returns HTTP 429 with `code: "rate_limit_exceeded"` and
203
352
  `Retry-After`. Usage is persisted server-side and resets at midnight UTC.
353
+ - The caps are per channel lane: LinkedIn actions, WhatsApp and email sends
354
+ together, and message deletes each spend their own daily budget. A `429` names
355
+ the cap it hit; it is never a statement about another lane. Two caveats worth
356
+ knowing: on the day a deployment first upgrades past the lane split, that
357
+ day's existing count is still read on the LinkedIn side (it is ambiguous, and
358
+ the conservative reading is the safe one) and clears at the next UTC midnight;
359
+ and the WhatsApp/email lane is keyed per access token while the LinkedIn
360
+ ledger is keyed per user, so several live tokens for one user get one LinkedIn
361
+ budget but a WhatsApp budget each.
204
362
  - Read the exact thread before every send.
205
363
  - Preview an exact invitation target and note before sending it.
206
364
  - List the exact received or sent invitation before accepting or withdrawing it.
@@ -234,6 +392,68 @@ write reservation. Downtime never creates a catch-up burst. Future start
234
392
  dates, recurring schedules, automatic follow-ups, acceptance-triggered
235
393
  messages, and multi-message sequences are not exposed.
236
394
 
395
+ Deleting a WhatsApp message is a write, and an irreversible one, so it is
396
+ treated as such. SignalDash proves the chat belongs to the connected account,
397
+ proves the message sits in that exact chat, and proves the account wrote it,
398
+ before anything is removed; someone else's message is refused with `403
399
+ message_not_own`. Every attempt is appended to that user's own durable audit
400
+ trail with the chat, the message, the outcome and the timestamp, including the
401
+ attempts that fail and the ones whose outcome the network left unknown. A
402
+ delete already recorded for the same chat and message is refused with `409
403
+ duplicate_delete` rather than replayed. Deletes spend a separate daily budget
404
+ (`SIGNALDASH_DAILY_DELETE_LIMIT`, default 200) so a cleanup can never consume
405
+ the sending capacity it exists to repair. `wa_delete_messages` runs at most 200
406
+ entries strictly one at a time, pauses `SIGNALDASH_WA_DELETE_PACE_MS` between
407
+ them, and stops at `SIGNALDASH_WA_DELETE_BATCH_DEADLINE_MS`, returning the
408
+ untouched remainder as `skipped` with `code: batch_deadline` so the caller can
409
+ resume exactly those. WhatsApp applies its own time and role limits to deleting
410
+ for everyone and can answer successfully without removing anything, so re-read
411
+ the chat to confirm.
412
+
413
+ ## Releasing
414
+
415
+ A release is a tag push. `.github/workflows/release.yml` runs `./release.sh` on
416
+ the AX41 self-hosted runner, and that script is the same one a laptop runs, so
417
+ there is no second code path to keep honest:
418
+
419
+ ```bash
420
+ git tag v0.28.0 && git push origin v0.28.0
421
+ ```
422
+
423
+ `release.sh` refuses to publish if the packed files have uncommitted changes or
424
+ if the version in `package.json` is already on the registry, then runs the
425
+ syntax check, the tests, `npm pack`, and the prepublish smoke gate against the
426
+ tarball it just built. That gate installs the tarball into a scratch HOME and
427
+ drives the real CLI, so a package that unpacks but cannot run never ships. Any
428
+ other branch or a `workflow_dispatch` run does all of that and stops one command
429
+ short, at `./release.sh --dry-run`.
430
+
431
+ **The credential is the `NPM_TOKEN` secret**, an npm granular access token
432
+ scoped to `@floomhq/signaldash` with write access:
433
+
434
+ ```bash
435
+ gh secret set NPM_TOKEN -R floomhq/signaldash
436
+ ```
437
+
438
+ Trusted publishing (OIDC) is not an option here, so do not spend time on it:
439
+ npm does not accept self-hosted runners yet, and this repo is on a self-hosted
440
+ runner because GitHub-hosted minutes are unavailable. The workflow asks the
441
+ registry directly on every run (`scripts/oidc-check.mjs`) and prints the answer,
442
+ because npm's own OIDC helper is written never to throw and turns a refusal into
443
+ an ordinary auth error.
444
+
445
+ To exercise the publish itself without touching npmjs, run it against a
446
+ throwaway registry:
447
+
448
+ ```bash
449
+ scripts/publish-rehearsal.sh
450
+ ```
451
+
452
+ That starts verdaccio in a container, mints an account on it, and runs the real
453
+ `./release.sh` with no `--dry-run`, then prints what the registry received. It
454
+ is the only way to test the publish command and the tarball a client actually
455
+ downloads before a version number is spent.
456
+
237
457
  ## Development
238
458
 
239
459
  ```bash
@@ -241,3 +461,33 @@ npm test
241
461
  npm run check
242
462
  npm pack --dry-run
243
463
  ```
464
+
465
+ `wa_transcribe_voice` runs on the SignalDash host and has two backends. The
466
+ default, `gemini`, sends the audio to Vertex AI using that host's own
467
+ credentials; it is the one that survives German speech with English technical
468
+ terms mixed into it, and being network-bound it does not compete with the
469
+ gateway for CPU. The fallback, `whisper`, needs `python3` with `faster-whisper`
470
+ installed on the host and runs the `small` CPU int8 model, which is much weaker
471
+ on that kind of code-switching. Every response therefore names the engine that
472
+ produced the text in `backend`, and a `gemini` request that had to fall back
473
+ also explains why in `fallback_reason`.
474
+
475
+ Pick the engine per request with the optional `backend` argument (`gemini` or
476
+ `whisper`), or set the default with `SIGNALDASH_TRANSCRIBE_BACKEND`. Override
477
+ the rest with `SIGNALDASH_TRANSCRIBE_PYTHON`, `SIGNALDASH_TRANSCRIBE_MODEL`
478
+ (local model), `SIGNALDASH_TRANSCRIBE_GEMINI_MODEL`,
479
+ `SIGNALDASH_TRANSCRIBE_GEMINI_PROJECT`,
480
+ `SIGNALDASH_TRANSCRIBE_GEMINI_LOCATION`,
481
+ `SIGNALDASH_TRANSCRIBE_GEMINI_TIMEOUT_S` (total budget for the Vertex call
482
+ including retries, default 240s, and it has to stay under
483
+ `SIGNALDASH_TRANSCRIBE_TIMEOUT_MS`, default 420000, so the local fallback still
484
+ fits underneath), `SIGNALDASH_TRANSCRIBE_GEMINI_MAX_BYTES`,
485
+ `SIGNALDASH_TRANSCRIBE_GEMINI_MAX_OUTPUT_TOKENS`, or
486
+ `SIGNALDASH_ATTACHMENT_MAX_BYTES`.
487
+
488
+ The Gemini backend authenticates with the credentials already on the host: the
489
+ audio never leaves it with a SignalDash key attached, and the transcriber
490
+ resolves those credentials itself, in the child process, from the file named by
491
+ `SIGNALDASH_TRANSCRIBE_AWS_ENV_FILE`. The gateway process forwards only
492
+ configuration, never a secret. That backend reports `language` as `null`: it is
493
+ asked for the transcript text and nothing else.