@diegoaltoworks/chatter 0.33.0 → 0.35.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/dist/channels/whatsapp/images.d.ts +85 -0
- package/dist/channels/whatsapp/images.d.ts.map +1 -0
- package/dist/channels/whatsapp/images.test.d.ts +2 -0
- package/dist/channels/whatsapp/images.test.d.ts.map +1 -0
- package/dist/channels/whatsapp/inbound.d.ts +9 -0
- package/dist/channels/whatsapp/inbound.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.d.ts +1 -0
- package/dist/channels/whatsapp/index.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.js +82 -0
- package/dist/channels/whatsapp/index.mjs +79 -0
- package/dist/scheduler/claimStore.d.ts +27 -0
- package/dist/scheduler/claimStore.d.ts.map +1 -0
- package/dist/scheduler/claimStore.test.d.ts +2 -0
- package/dist/scheduler/claimStore.test.d.ts.map +1 -0
- package/dist/scheduler/compose.d.ts +23 -0
- package/dist/scheduler/compose.d.ts.map +1 -0
- package/dist/scheduler/compose.test.d.ts +2 -0
- package/dist/scheduler/compose.test.d.ts.map +1 -0
- package/dist/scheduler/deliver.d.ts +10 -0
- package/dist/scheduler/deliver.d.ts.map +1 -0
- package/dist/scheduler/deliver.test.d.ts +2 -0
- package/dist/scheduler/deliver.test.d.ts.map +1 -0
- package/dist/scheduler/dueDrops.d.ts +13 -0
- package/dist/scheduler/dueDrops.d.ts.map +1 -0
- package/dist/scheduler/dueDrops.test.d.ts +2 -0
- package/dist/scheduler/dueDrops.test.d.ts.map +1 -0
- package/dist/scheduler/index.d.ts +31 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +332 -0
- package/dist/scheduler/index.mjs +290 -0
- package/dist/scheduler/scheduler.d.ts +44 -0
- package/dist/scheduler/scheduler.d.ts.map +1 -0
- package/dist/scheduler/scheduler.test.d.ts +2 -0
- package/dist/scheduler/scheduler.test.d.ts.map +1 -0
- package/dist/scheduler/tick.d.ts +19 -0
- package/dist/scheduler/tick.d.ts.map +1 -0
- package/dist/scheduler/tick.test.d.ts +2 -0
- package/dist/scheduler/tick.test.d.ts.map +1 -0
- package/dist/scheduler/types.d.ts +36 -0
- package/dist/scheduler/types.d.ts.map +1 -0
- package/package.json +8 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tick.test.d.ts","sourceRoot":"","sources":["../../src/scheduler/tick.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-free by design: chatter stores no schedule data of its own.
|
|
3
|
+
* `id`/`fireAt`/`channel`/`chatId` are the minimum the claim/grace/delivery
|
|
4
|
+
* machinery needs; `payload` is opaque caller data for the compose step.
|
|
5
|
+
*/
|
|
6
|
+
export interface ScheduleEntry {
|
|
7
|
+
/** Stable, caller-assigned id — the claim table's primary key. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Epoch ms the entry is due to fire. */
|
|
10
|
+
fireAt: number;
|
|
11
|
+
/** Sender-registry channel name to deliver through. */
|
|
12
|
+
channel: string;
|
|
13
|
+
/** Channel-specific recipient id. */
|
|
14
|
+
chatId: string;
|
|
15
|
+
/** Opaque caller data passed to the compose step; chatter never reads it. */
|
|
16
|
+
payload?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Turns an entry into outbound text. Chatter never inspects the result beyond checking it is non-blank. */
|
|
19
|
+
export type ComposeFn = (entry: ScheduleEntry) => Promise<string> | string;
|
|
20
|
+
export interface ScheduleClaimStore {
|
|
21
|
+
/** Atomically claims `id` for this instance; resolves false if another instance already holds it. */
|
|
22
|
+
claim(id: string, now: number): Promise<boolean>;
|
|
23
|
+
/** Releases this instance's claim on `id`, e.g. after a failed send, so it can be retried within grace. */
|
|
24
|
+
release(id: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface TickResult {
|
|
27
|
+
/** Ids delivered this tick. */
|
|
28
|
+
sent: string[];
|
|
29
|
+
/** Ids due within grace but already claimed by another instance. */
|
|
30
|
+
notClaimed: string[];
|
|
31
|
+
/** Ids due but past their grace window — skipped, never claimed or delivered. */
|
|
32
|
+
stale: string[];
|
|
33
|
+
/** Ids claimed this tick whose delivery failed; the claim was released so a later tick can retry. */
|
|
34
|
+
failed: string[];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scheduler/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,4GAA4G;AAC5G,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,qGAAqG;IACrG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,2GAA2G;IAC3G,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oEAAoE;IACpE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iFAAiF;IACjF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qGAAqG;IACrG,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegoaltoworks/chatter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Embeddable AI chatbot framework with RAG, authentication, and customizable widgets",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -59,6 +59,11 @@
|
|
|
59
59
|
"types": "./dist/images/index.d.ts",
|
|
60
60
|
"import": "./dist/images/index.mjs",
|
|
61
61
|
"require": "./dist/images/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./scheduler": {
|
|
64
|
+
"types": "./dist/scheduler/index.d.ts",
|
|
65
|
+
"import": "./dist/scheduler/index.mjs",
|
|
66
|
+
"require": "./dist/scheduler/index.js"
|
|
62
67
|
}
|
|
63
68
|
},
|
|
64
69
|
"files": [
|
|
@@ -68,7 +73,7 @@
|
|
|
68
73
|
],
|
|
69
74
|
"scripts": {
|
|
70
75
|
"dev": "bun --watch src/index.ts",
|
|
71
|
-
"build": "bun run build:clean && bun run build:types && bun run build:esm && bun run build:cjs && bun run build:mcp && bun run build:usage && bun run build:personas && bun run build:channels && bun run build:whatsapp && bun run build:flows && bun run build:images && bun run build:bin && bun run build:client && bun run build:copy-client",
|
|
76
|
+
"build": "bun run build:clean && bun run build:types && bun run build:esm && bun run build:cjs && bun run build:mcp && bun run build:usage && bun run build:personas && bun run build:channels && bun run build:whatsapp && bun run build:flows && bun run build:images && bun run build:scheduler && bun run build:bin && bun run build:client && bun run build:copy-client",
|
|
72
77
|
"build:clean": "rm -rf dist",
|
|
73
78
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
74
79
|
"build:esm": "esbuild src/index.ts --bundle --format=esm --outfile=dist/index.mjs --external:hono --external:openai --external:@libsql/client --external:jose --platform=node --target=node24",
|
|
@@ -80,6 +85,7 @@
|
|
|
80
85
|
"build:whatsapp": "esbuild src/channels/whatsapp/index.ts --bundle --format=esm --outfile=dist/channels/whatsapp/index.mjs --external:@libsql/client --external:@whiskeysockets/baileys --platform=node --target=node24 && esbuild src/channels/whatsapp/index.ts --bundle --format=cjs --outfile=dist/channels/whatsapp/index.js --external:@libsql/client --external:@whiskeysockets/baileys --platform=node --target=node24",
|
|
81
86
|
"build:flows": "esbuild src/flows/index.ts --bundle --format=esm --outfile=dist/flows/index.mjs --external:@libsql/client --external:openai --platform=node --target=node24 && esbuild src/flows/index.ts --bundle --format=cjs --outfile=dist/flows/index.js --external:@libsql/client --external:openai --platform=node --target=node24",
|
|
82
87
|
"build:images": "esbuild src/images/index.ts --bundle --format=esm --outfile=dist/images/index.mjs --external:@libsql/client --external:openai --platform=node --target=node24 && esbuild src/images/index.ts --bundle --format=cjs --outfile=dist/images/index.js --external:@libsql/client --external:openai --platform=node --target=node24",
|
|
88
|
+
"build:scheduler": "esbuild src/scheduler/index.ts --bundle --format=esm --outfile=dist/scheduler/index.mjs --external:@libsql/client --external:openai --platform=node --target=node24 && esbuild src/scheduler/index.ts --bundle --format=cjs --outfile=dist/scheduler/index.js --external:@libsql/client --external:openai --platform=node --target=node24",
|
|
83
89
|
"build:bin": "esbuild bin/create-apikey.ts --bundle --format=cjs --outfile=dist/bin/create-apikey.js --external:jose --platform=node --target=node18 --banner:js='#!/usr/bin/env node' && esbuild bin/wa-pair.ts --bundle --format=cjs --outfile=dist/bin/wa-pair.js --external:@libsql/client --external:@whiskeysockets/baileys --external:qrcode-terminal --platform=node --target=node18 --banner:js='#!/usr/bin/env node'",
|
|
84
90
|
"build:client": "cd src/client && bun run build",
|
|
85
91
|
"build:copy-client": "mkdir -p dist/static && cp src/client/dist/chatter.js src/client/dist/chatter.css dist/static/",
|