commune-ai 0.2.63 → 0.2.65
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 +11 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# commune-ai
|
|
2
2
|
|
|
3
3
|
Commune is the **communication infrastructure for agents**. It gives your agent a **unified inbox**
|
|
4
4
|
for **email**, so your agent can talk to humans where they already work. Most teams
|
|
@@ -30,7 +30,7 @@ This is the simplest full flow: receive webhook → run agent → reply in threa
|
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import express from "express";
|
|
33
|
-
import { CommuneClient, createWebhookHandler, verifyCommuneWebhook } from "
|
|
33
|
+
import { CommuneClient, createWebhookHandler, verifyCommuneWebhook } from "commune-ai";
|
|
34
34
|
|
|
35
35
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
36
36
|
|
|
@@ -82,7 +82,7 @@ app.listen(3000, () => console.log("listening on 3000"));
|
|
|
82
82
|
|
|
83
83
|
## 0) Install
|
|
84
84
|
```bash
|
|
85
|
-
npm install
|
|
85
|
+
npm install commune-ai
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
---
|
|
@@ -197,7 +197,7 @@ Commune provides powerful semantic search capabilities to help your agent find r
|
|
|
197
197
|
|
|
198
198
|
### Basic Search
|
|
199
199
|
```ts
|
|
200
|
-
import { CommuneClient } from "
|
|
200
|
+
import { CommuneClient } from "commune-ai";
|
|
201
201
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
202
202
|
|
|
203
203
|
// Search across all conversations in an organization
|
|
@@ -290,6 +290,7 @@ interface SearchResult {
|
|
|
290
290
|
participants: string[];
|
|
291
291
|
threadId: string;
|
|
292
292
|
timestamp: Date;
|
|
293
|
+
direction?: 'inbound' | 'outbound'; // Email direction (sent or received)
|
|
293
294
|
attachmentIds?: string[]; // Attachment IDs in this conversation
|
|
294
295
|
hasAttachments?: boolean; // Whether conversation has attachments
|
|
295
296
|
attachmentCount?: number; // Number of attachments
|
|
@@ -346,7 +347,7 @@ This ensures your domain maintains high deliverability and isn't flagged by emai
|
|
|
346
347
|
If a spam email gets through, you can report it:
|
|
347
348
|
|
|
348
349
|
```ts
|
|
349
|
-
import { CommuneClient } from "
|
|
350
|
+
import { CommuneClient } from "commune-ai";
|
|
350
351
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
351
352
|
|
|
352
353
|
// Report a message as spam
|
|
@@ -363,7 +364,7 @@ The system learns from reports and automatically blocks repeat offenders.
|
|
|
363
364
|
Commune stores conversation state so your agent can respond with context.
|
|
364
365
|
|
|
365
366
|
```ts
|
|
366
|
-
import { CommuneClient } from "
|
|
367
|
+
import { CommuneClient } from "commune-ai";
|
|
367
368
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
368
369
|
|
|
369
370
|
// Thread history (email thread)
|
|
@@ -393,7 +394,7 @@ The `UnifiedMessage` shape works for email messages.
|
|
|
393
394
|
|
|
394
395
|
```ts
|
|
395
396
|
import express from "express";
|
|
396
|
-
import { CommuneClient, createWebhookHandler } from "
|
|
397
|
+
import { CommuneClient, createWebhookHandler } from "commune-ai";
|
|
397
398
|
|
|
398
399
|
// Hosted API is default. If self-hosted, pass { baseUrl: "https://your-api" }
|
|
399
400
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
@@ -527,7 +528,7 @@ const handler = createWebhookHandler({
|
|
|
527
528
|
|
|
528
529
|
### Example: Invoice extraction (end-to-end)
|
|
529
530
|
```ts
|
|
530
|
-
import { CommuneClient, createWebhookHandler } from "
|
|
531
|
+
import { CommuneClient, createWebhookHandler } from "commune-ai";
|
|
531
532
|
|
|
532
533
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
|
533
534
|
|
|
@@ -570,7 +571,7 @@ Commune signs outbound webhooks using your **inbox webhook secret**. Verify the
|
|
|
570
571
|
signature before processing the request.
|
|
571
572
|
|
|
572
573
|
```ts
|
|
573
|
-
import { createWebhookHandler, verifyCommuneWebhook } from "
|
|
574
|
+
import { createWebhookHandler, verifyCommuneWebhook } from "commune-ai";
|
|
574
575
|
|
|
575
576
|
const handler = createWebhookHandler({
|
|
576
577
|
verify: ({ rawBody, headers }) => {
|
|
@@ -602,7 +603,7 @@ A complete copy‑paste example that:
|
|
|
602
603
|
|
|
603
604
|
```ts
|
|
604
605
|
import express from "express";
|
|
605
|
-
import { CommuneClient, createWebhookHandler } from "
|
|
606
|
+
import { CommuneClient, createWebhookHandler } from "commune-ai";
|
|
606
607
|
import fs from "fs";
|
|
607
608
|
|
|
608
609
|
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
|
package/package.json
CHANGED