@everruns/channelkit 0.0.0-stage → 0.1.0-alpha.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mykhailo Chalyi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
1
+ # Channelkit for Node.js
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Rust-backed Slack and WhatsApp adapters for application-owned agents.
4
+ A library with no server, database, background worker, or install-time downloads.
5
+
6
+ ```sh
7
+ npm install @everruns/channelkit@alpha
8
+ ```
9
+
10
+ ```js
11
+ const {Slack} = require('@everruns/channelkit');
12
+ const slack = new Slack({
13
+ installation: 'support', teamId: process.env.SLACK_TEAM_ID,
14
+ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET,
15
+ });
16
+ async function main() {
17
+ const receipt = await slack.post(slack.conversation(process.env.SLACK_TEST_CHANNEL),
18
+ 'Hello from Rust-backed Node!');
19
+ console.log(receipt.status); // accepted, not delivery confirmation
20
+ }
21
+ main().catch(console.error);
22
+ ```
23
+
24
+ ## Signed webhooks and replies
25
+
26
+ ```js
27
+ // Your host supplies the ORIGINAL body Buffer, never JSON reserialization.
28
+ const ingress = slack.receive(rawBody, headers);
29
+ for (const event of ingress.events) {
30
+ const message = event.kind.Message;
31
+ if (message?.mentioned) await slack.reply(message, 'I received your message');
32
+ }
33
+ // Your host returns ingress.response.status, content_type, body.
34
+ // Persist/deduplicate accepted events before acknowledging when durability is needed.
35
+ ```
36
+
37
+ `receive` synchronously verifies signatures and normalizes the Rust event model.
38
+ It never sends an HTTP response or starts agent work. Outbound methods return
39
+ Promises and run on Rust's async runtime without blocking Node's event loop.
40
+ The host owns HTTP acceptance, event storage, authorization, agents, and recovery.
41
+ TypeScript declarations are included; ESM supports named imports too.
42
+
43
+ `new WhatsApp({installation, phoneNumberId, token, appSecret, verifyToken})`
44
+ verifies Meta signatures and GET challenges:
45
+ `receive(Buffer.alloc(0), {}, {method: 'GET', query})`.
46
+ `reply(message, text)` uses the verified message timestamp for WhatsApp's reply
47
+ window. `post` leaves window enforcement to Meta and maps a window rejection to
48
+ `ReplyWindowClosed`. For outbound conversations, use
49
+ `sendTemplate(target, 'approved_template', 'en_US')` for an approved template
50
+ and an opted-in recipient. The library never creates templates or recipients.
51
+
52
+ ## API and errors
53
+
54
+ Adapters expose `conversation`, `receive`, `post`, `reply`, `react`, `edit`,
55
+ `delete`, `history`, and `typing`; WhatsApp adds `sendTemplate`.
56
+ Unsupported provider operations fail explicitly. Rust-validated helpers:
57
+ `text`, `markdown`, `card(title, body, [{id: 'approve', label: 'Approve'}])`,
58
+ `conversation`, and Unicode-aware `splitText`.
59
+
60
+ `ChannelkitError` exposes `code`, `details`, `retryAfterMs`, and `confirmed`.
61
+ Never blindly repeat `DeliveryUnknown`. `PartialDelivery` preserves confirmed
62
+ message references and `details.source`. No automatic retries occur. A cancelled task or host timeout is also not proof
63
+ that a send was rejected; retain pending work and reconcile before recovery. Errors
64
+ redact raw provider bodies and credentials; keep tokens in your secret manager.
65
+
66
+ `providerCapabilities` describes the underlying Rust adapter. This initial
67
+ binding does not expose coordinator/durability hooks, streaming, media,
68
+ Slack-specific extensions, or other providers. Those remain Rust APIs.
69
+
70
+ Node 20+: macOS 11+ arm64/x64, Windows x64, Linux x64 glibc 2.35+.
71
+ Native N-API binaries are bundled. Unsupported platforms fail explicitly;
72
+ there is no network installer, WASM fallback, or musl support claim.
73
+
74
+ ## Sources of inspiration
75
+
76
+ [Chat SDK](https://chat-sdk.dev/), [BerriAI agentchat](https://github.com/BerriAI/agentchat),
77
+ [Bashkit](https://github.com/everruns/bashkit), and [Everruns](https://github.com/everruns/everruns).
78
+ Native bindings use [napi-rs](https://napi.rs/).
79
+
80
+ [Project](https://github.com/everruns/channelkit) · [MIT license](LICENSE)