@diegoaltoworks/chatter 0.61.0 → 0.63.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 +55 -17
- package/dist/auth/secretStrength.d.ts +1 -1
- package/dist/auth/secretStrength.d.ts.map +1 -1
- package/dist/bin/create-apikey.js +45 -28
- package/dist/bin/wa-pair.js +113 -46
- package/dist/channels/backoff.d.ts +10 -0
- package/dist/channels/backoff.d.ts.map +1 -0
- package/dist/channels/gates.d.ts +15 -8
- package/dist/channels/gates.d.ts.map +1 -1
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +38 -5
- package/dist/channels/index.mjs +37 -5
- package/dist/channels/matrix/api.d.ts +25 -6
- package/dist/channels/matrix/api.d.ts.map +1 -1
- package/dist/channels/matrix/channel.d.ts +4 -56
- package/dist/channels/matrix/channel.d.ts.map +1 -1
- package/dist/channels/matrix/handler.d.ts +16 -9
- package/dist/channels/matrix/handler.d.ts.map +1 -1
- package/dist/channels/matrix/index.d.ts +2 -2
- package/dist/channels/matrix/index.d.ts.map +1 -1
- package/dist/channels/matrix/index.js +196 -40
- package/dist/channels/matrix/index.mjs +189 -39
- package/dist/channels/matrix/sync.d.ts +4 -1
- package/dist/channels/matrix/sync.d.ts.map +1 -1
- package/dist/channels/matrix/updates.d.ts +39 -10
- package/dist/channels/matrix/updates.d.ts.map +1 -1
- package/dist/channels/pipeline.d.ts +14 -14
- package/dist/channels/pipeline.d.ts.map +1 -1
- package/dist/channels/polling.d.ts +67 -0
- package/dist/channels/polling.d.ts.map +1 -0
- package/dist/channels/telegram/channel.d.ts +2 -56
- package/dist/channels/telegram/channel.d.ts.map +1 -1
- package/dist/channels/telegram/index.js +53 -23
- package/dist/channels/telegram/index.mjs +53 -23
- package/dist/channels/telegram/poll.d.ts +5 -1
- package/dist/channels/telegram/poll.d.ts.map +1 -1
- package/dist/channels/telegram/webhook.d.ts +2 -10
- package/dist/channels/telegram/webhook.d.ts.map +1 -1
- package/dist/channels/whatsapp/authState.d.ts +40 -9
- package/dist/channels/whatsapp/authState.d.ts.map +1 -1
- package/dist/channels/whatsapp/channel.d.ts +39 -4
- package/dist/channels/whatsapp/channel.d.ts.map +1 -1
- package/dist/channels/whatsapp/inbound.d.ts +23 -25
- package/dist/channels/whatsapp/inbound.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.d.ts +3 -3
- package/dist/channels/whatsapp/index.d.ts.map +1 -1
- package/dist/channels/whatsapp/index.js +188 -66
- package/dist/channels/whatsapp/index.mjs +185 -66
- package/dist/channels/whatsapp/pairing.d.ts.map +1 -1
- package/dist/client/src/Chat.d.ts.map +1 -1
- package/dist/client/src/ChatButton.d.ts.map +1 -1
- package/dist/client/src/browser.d.ts.map +1 -1
- package/dist/core/answer.d.ts +8 -0
- package/dist/core/answer.d.ts.map +1 -1
- package/dist/core/buildLock.d.ts +52 -0
- package/dist/core/buildLock.d.ts.map +1 -0
- package/dist/core/pipeline.d.ts +42 -5
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/prompts.d.ts +2 -0
- package/dist/core/prompts.d.ts.map +1 -1
- package/dist/core/retrieval.d.ts +100 -25
- package/dist/core/retrieval.d.ts.map +1 -1
- package/dist/core/session.d.ts +8 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/flows/index.d.ts +1 -1
- package/dist/flows/index.d.ts.map +1 -1
- package/dist/flows/index.js +8 -6
- package/dist/flows/index.mjs +7 -6
- package/dist/flows/intent.d.ts +1 -1
- package/dist/flows/intent.d.ts.map +1 -1
- package/dist/flows/loader.d.ts +1 -2
- package/dist/flows/loader.d.ts.map +1 -1
- package/dist/flows/params.d.ts +1 -1
- package/dist/flows/params.d.ts.map +1 -1
- package/dist/flows/session.d.ts +4 -2
- package/dist/flows/session.d.ts.map +1 -1
- package/dist/flows/types.d.ts +2 -3
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.d.ts.map +1 -1
- package/dist/history/index.js +6 -3
- package/dist/history/index.mjs +5 -3
- package/dist/history/tursoStore.d.ts +6 -4
- package/dist/history/tursoStore.d.ts.map +1 -1
- package/dist/images/index.js +2 -2
- package/dist/images/index.mjs +2 -2
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +596 -295
- package/dist/index.mjs +595 -295
- package/dist/mcp-server/index.d.ts +5 -5
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/logger.d.ts +12 -2
- package/dist/mcp-server/logger.d.ts.map +1 -1
- package/dist/mcp-server/rate-limiter.d.ts +10 -3
- package/dist/mcp-server/rate-limiter.d.ts.map +1 -1
- package/dist/mcp-server/types.d.ts +20 -5
- package/dist/mcp-server/types.d.ts.map +1 -1
- package/dist/mcp-server.js +479 -244
- package/dist/mcp-server.mjs +485 -244
- package/dist/middleware/apiKey.d.ts +10 -0
- package/dist/middleware/apiKey.d.ts.map +1 -0
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/ratelimit.d.ts.map +1 -1
- package/dist/middleware/referrer.d.ts.map +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.d.ts.map +1 -1
- package/dist/routes/demo.d.ts.map +1 -1
- package/dist/routes/openai.d.ts.map +1 -1
- package/dist/routes/private.d.ts.map +1 -1
- package/dist/routes/public.d.ts.map +1 -1
- package/dist/scheduler/index.js +1 -1
- package/dist/scheduler/index.mjs +1 -1
- package/dist/scheduler/scheduler.d.ts +9 -1
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +491 -268
- package/dist/server.mjs +497 -268
- package/dist/shortener.d.ts +5 -4
- package/dist/shortener.d.ts.map +1 -1
- package/dist/types.d.ts +129 -75
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -3
package/dist/shortener.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* URL shortening against a Kutt-compatible API, config-injected (no
|
|
3
3
|
* `process.env` reads) so hosts can wire credentials however they like.
|
|
4
4
|
*
|
|
5
|
-
* The hard invariant: {@link Shortener.shorten} never throws. Any failure
|
|
6
|
-
* network error, an aborted request past `timeoutMs`, or a
|
|
7
|
-
* response
|
|
8
|
-
* never break something user-facing that only wanted
|
|
5
|
+
* The hard invariant: {@link Shortener.shorten} never throws. Any failure
|
|
6
|
+
* (a network error, an aborted request past `timeoutMs`, or a
|
|
7
|
+
* non-2xx/malformed response) resolves to the original URL instead, since a
|
|
8
|
+
* shortener outage must never break something user-facing that only wanted
|
|
9
|
+
* a shorter link.
|
|
9
10
|
*/
|
|
10
11
|
export interface ShortenerConfig {
|
|
11
12
|
/** Base URL of the Kutt (or Kutt-compatible) instance, e.g. "https://kutt.it". */
|
package/dist/shortener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortener.d.ts","sourceRoot":"","sources":["../src/shortener.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shortener.d.ts","sourceRoot":"","sources":["../src/shortener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,kFAAkF;IAClF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvC;AAQD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,SAAS,GAAE,OAAO,KAAa,GAC9B,SAAS,CAwCX"}
|
package/dist/types.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ import type { Channel, ChannelSenderRegistry } from "./channels";
|
|
|
11
11
|
import type { AnswerFn, TransformReply } from "./core/answer";
|
|
12
12
|
import type { BucketsFor } from "./core/buckets";
|
|
13
13
|
import type { Logger, LogLevel } from "./core/logger";
|
|
14
|
-
import type { RerankContext, RewriteQuery } from "./core/pipeline";
|
|
14
|
+
import type { FallbackFn, RerankContext, RewriteQuery } from "./core/pipeline";
|
|
15
15
|
import type { PromptLoader } from "./core/prompts";
|
|
16
|
-
import type {
|
|
16
|
+
import type { Retriever } from "./core/retrieval";
|
|
17
17
|
export type { Logger, LogLevel } from "./core/logger";
|
|
18
18
|
/**
|
|
19
19
|
* USD price per 1M tokens, used to turn token usage into an estimated cost.
|
|
@@ -58,10 +58,106 @@ export interface BotChatConfig {
|
|
|
58
58
|
/** Subtitle for private chat widget */
|
|
59
59
|
privateSubtitle?: string;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The brain and retrieval hooks a chat surface consults, in the order a turn
|
|
63
|
+
* reaches them: `bucketsFor` scopes retrieval, `rewriteQuery` shapes the
|
|
64
|
+
* search, `rerankContext` post-processes what came back, `fallbackFn` steps
|
|
65
|
+
* in only when that leaves nothing, `answerFn` replaces the completion call
|
|
66
|
+
* itself, and `transformReply` has the last word on what gets delivered.
|
|
67
|
+
* `ChatterConfig` sets the server-wide default for each; a
|
|
68
|
+
* channel config (`TelegramChannelConfig`, `MatrixChannelConfig`,
|
|
69
|
+
* `WhatsAppInboundConfig`, ...) extends this same interface so a single
|
|
70
|
+
* channel can override any of them for its own traffic, falling back to the
|
|
71
|
+
* server-level hook when unset: see `resolveBrainHooks` in `./channels`.
|
|
72
|
+
*/
|
|
73
|
+
export interface BrainHooks {
|
|
74
|
+
/**
|
|
75
|
+
* Replaces the completion call on every chat surface with your own brain —
|
|
76
|
+
* an agent framework, a graph runtime, a remote service. Receives the
|
|
77
|
+
* assembled system prompt and conversation from the pipeline and returns
|
|
78
|
+
* the answer text (optionally with token usage).
|
|
79
|
+
*
|
|
80
|
+
* Retrieval, prompt assembly, auth, rate limiting, transports and output
|
|
81
|
+
* guardrails all stay Chatter's. Errors surface as normal completion
|
|
82
|
+
* errors. Unset: the built-in OpenAI completion is used.
|
|
83
|
+
*/
|
|
84
|
+
answerFn?: AnswerFn;
|
|
85
|
+
/**
|
|
86
|
+
* Decides which knowledge buckets each chat turn may retrieve from, given
|
|
87
|
+
* the pipeline mode and — where the surface knows it — the sender's
|
|
88
|
+
* identity. Use it for role-gated knowledge: entitle a signed-in operator
|
|
89
|
+
* to buckets an anonymous visitor cannot see.
|
|
90
|
+
*
|
|
91
|
+
* Consulted by the chat routes, the OpenAI-compatible endpoints, the MCP
|
|
92
|
+
* chat tools and the demo route. Return `undefined` to keep the mode
|
|
93
|
+
* defaults (`base` plus the mode's own bucket). For a caller the surface
|
|
94
|
+
* could not identify, the answer is filtered down to those same defaults —
|
|
95
|
+
* the hook can narrow retrieval for an unnamed caller but never widen it.
|
|
96
|
+
*
|
|
97
|
+
* Unset: the mode defaults apply everywhere.
|
|
98
|
+
*/
|
|
99
|
+
bucketsFor?: BucketsFor;
|
|
100
|
+
/**
|
|
101
|
+
* Rewrites the retrieval query for a turn before it reaches the vector
|
|
102
|
+
* store — e.g. expanding an ambiguous follow-up into something embeddable
|
|
103
|
+
* on its own. Receives the same `sender` identity `answerFn` sees (not the
|
|
104
|
+
* retrieval-scope-restricted one `bucketsFor` sees on the public
|
|
105
|
+
* OpenAI-compatible route — rewriting a query widens nothing, so it isn't
|
|
106
|
+
* subject to that clamp).
|
|
107
|
+
*
|
|
108
|
+
* Consulted everywhere `bucketsFor` is. A throw/rejection, or a return
|
|
109
|
+
* value that isn't a non-blank string, falls back to the unmodified query
|
|
110
|
+
* — a broken rewrite degrades relevance, never the chat path. Unset:
|
|
111
|
+
* retrieval runs on the latest user message unmodified.
|
|
112
|
+
*/
|
|
113
|
+
rewriteQuery?: RewriteQuery;
|
|
114
|
+
/**
|
|
115
|
+
* Post-processes the chunks retrieval returned — reordering, filtering, or
|
|
116
|
+
* otherwise reranking — before they're folded into the system prompt.
|
|
117
|
+
*
|
|
118
|
+
* Consulted everywhere `bucketsFor` is, immediately after retrieval runs.
|
|
119
|
+
* A throw/rejection, or a return value that isn't a string array, falls
|
|
120
|
+
* back to the chunks retrieval returned, unmodified. Unset: retrieved
|
|
121
|
+
* chunks are used as-is.
|
|
122
|
+
*/
|
|
123
|
+
rerankContext?: RerankContext;
|
|
124
|
+
/**
|
|
125
|
+
* Injects turn-scoped guidance when retrieval comes back with nothing to
|
|
126
|
+
* fold into the prompt, after `rerankContext`, if configured, has had its
|
|
127
|
+
* say. Receives the query, mode, buckets retrieval ran against and (via
|
|
128
|
+
* `retrievedChunks`) what `store.query` itself returned before
|
|
129
|
+
* `rerankContext` ran, so a hook can tell "the store found nothing" apart
|
|
130
|
+
* from "a reranker filtered everything out". Return a string to add it as
|
|
131
|
+
* an extra system-prompt layer for this turn only; return `undefined` to
|
|
132
|
+
* leave the prompt as-is.
|
|
133
|
+
*
|
|
134
|
+
* Consulted everywhere `bucketsFor` is. A throw/rejection is logged and
|
|
135
|
+
* the turn proceeds without fallback guidance: a broken hook must never
|
|
136
|
+
* break the chat path. Unset: an empty retrieval changes nothing about the
|
|
137
|
+
* assembled prompt, same as today.
|
|
138
|
+
*/
|
|
139
|
+
fallbackFn?: FallbackFn;
|
|
140
|
+
/**
|
|
141
|
+
* Modifies or vetoes an outgoing reply after it has already been produced
|
|
142
|
+
* (by `answerFn` or the built-in completion, past guardrails). Return a
|
|
143
|
+
* string to replace the reply, or `null` to veto it — a deliberate drop,
|
|
144
|
+
* treated the same as an empty answer: nothing is delivered, and the
|
|
145
|
+
* channel pipeline never records an assistant turn for it (the user's own
|
|
146
|
+
* turn, already appended before answering, stays recorded either way). A
|
|
147
|
+
* throw/rejection is logged and the ORIGINAL reply is sent.
|
|
148
|
+
*
|
|
149
|
+
* Consulted by the channel pipeline and every non-streaming HTTP chat
|
|
150
|
+
* surface (widget and demo routes, OpenAI-compatible endpoints, MCP chat
|
|
151
|
+
* tools). Streaming responses are delivered incrementally as they're
|
|
152
|
+
* produced, before a final answer exists to transform, so this hook is
|
|
153
|
+
* never consulted for them. Unset: replies pass through unchanged.
|
|
154
|
+
*/
|
|
155
|
+
transformReply?: TransformReply;
|
|
156
|
+
}
|
|
61
157
|
/**
|
|
62
158
|
* Main configuration for Chatter server
|
|
63
159
|
*/
|
|
64
|
-
export interface ChatterConfig {
|
|
160
|
+
export interface ChatterConfig extends BrainHooks {
|
|
65
161
|
bot: BotIdentity;
|
|
66
162
|
branding?: BotBranding;
|
|
67
163
|
chat?: BotChatConfig;
|
|
@@ -88,12 +184,30 @@ export interface ChatterConfig {
|
|
|
88
184
|
*/
|
|
89
185
|
pricing?: PricingRates;
|
|
90
186
|
};
|
|
91
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Turso/libsql credentials for the default knowledge store. Required
|
|
189
|
+
* unless `retriever` is set - the default `VectorStore` has nowhere else
|
|
190
|
+
* to keep chunks and embeddings. A server started with neither fails fast
|
|
191
|
+
* at startup naming the missing one, rather than throwing on the first
|
|
192
|
+
* chat request.
|
|
193
|
+
*/
|
|
194
|
+
database?: {
|
|
92
195
|
/** Turso database URL */
|
|
93
196
|
url: string;
|
|
94
197
|
/** Turso auth token */
|
|
95
198
|
authToken: string;
|
|
96
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* Retrieval backend for `prepareChat`, replacing the default `VectorStore`
|
|
202
|
+
* (brute-force cosine similarity over embeddings in Turso). Set this to
|
|
203
|
+
* scale past the default's storage or search strategy (pgvector,
|
|
204
|
+
* sqlite-vec, Qdrant, a managed vector database) without touching any chat
|
|
205
|
+
* surface. See
|
|
206
|
+
* [patterns/adding-a-retriever.md](../docs/patterns/adding-a-retriever.md).
|
|
207
|
+
*
|
|
208
|
+
* Unset: `database` is required, and the built-in `VectorStore` is used.
|
|
209
|
+
*/
|
|
210
|
+
retriever?: Retriever;
|
|
97
211
|
auth?: {
|
|
98
212
|
/** Secret for JWT API key creation/verification */
|
|
99
213
|
secret?: string;
|
|
@@ -224,72 +338,6 @@ export interface ChatterConfig {
|
|
|
224
338
|
*/
|
|
225
339
|
strictTransportSecurity?: string | false;
|
|
226
340
|
};
|
|
227
|
-
/**
|
|
228
|
-
* Replaces the completion call on every chat surface with your own brain —
|
|
229
|
-
* an agent framework, a graph runtime, a remote service. Receives the
|
|
230
|
-
* assembled system prompt and conversation from the pipeline and returns
|
|
231
|
-
* the answer text (optionally with token usage).
|
|
232
|
-
*
|
|
233
|
-
* Retrieval, prompt assembly, auth, rate limiting, transports and output
|
|
234
|
-
* guardrails all stay Chatter's. Errors surface as normal completion
|
|
235
|
-
* errors. Unset: the built-in OpenAI completion is used.
|
|
236
|
-
*/
|
|
237
|
-
answerFn?: AnswerFn;
|
|
238
|
-
/**
|
|
239
|
-
* Modifies or vetoes an outgoing reply after it has already been produced
|
|
240
|
-
* (by `answerFn` or the built-in completion, past guardrails). Return a
|
|
241
|
-
* string to replace the reply, or `null` to veto it — a deliberate drop,
|
|
242
|
-
* treated the same as an empty answer: nothing is delivered, and the
|
|
243
|
-
* channel pipeline never records an assistant turn for it (the user's own
|
|
244
|
-
* turn, already appended before answering, stays recorded either way). A
|
|
245
|
-
* throw/rejection is logged and the ORIGINAL reply is sent.
|
|
246
|
-
*
|
|
247
|
-
* Consulted by the channel pipeline and every non-streaming HTTP chat
|
|
248
|
-
* surface (widget and demo routes, OpenAI-compatible endpoints, MCP chat
|
|
249
|
-
* tools). Streaming responses are delivered incrementally as they're
|
|
250
|
-
* produced, before a final answer exists to transform, so this hook is
|
|
251
|
-
* never consulted for them. Unset: replies pass through unchanged.
|
|
252
|
-
*/
|
|
253
|
-
transformReply?: TransformReply;
|
|
254
|
-
/**
|
|
255
|
-
* Decides which knowledge buckets each chat turn may retrieve from, given
|
|
256
|
-
* the pipeline mode and — where the surface knows it — the sender's
|
|
257
|
-
* identity. Use it for role-gated knowledge: entitle a signed-in operator
|
|
258
|
-
* to buckets an anonymous visitor cannot see.
|
|
259
|
-
*
|
|
260
|
-
* Consulted by the chat routes, the OpenAI-compatible endpoints, the MCP
|
|
261
|
-
* chat tools and the demo route. Return `undefined` to keep the mode
|
|
262
|
-
* defaults (`base` plus the mode's own bucket). For a caller the surface
|
|
263
|
-
* could not identify, the answer is filtered down to those same defaults —
|
|
264
|
-
* the hook can narrow retrieval for an unnamed caller but never widen it.
|
|
265
|
-
*
|
|
266
|
-
* Unset: the mode defaults apply everywhere.
|
|
267
|
-
*/
|
|
268
|
-
bucketsFor?: BucketsFor;
|
|
269
|
-
/**
|
|
270
|
-
* Rewrites the retrieval query for a turn before it reaches the vector
|
|
271
|
-
* store — e.g. expanding an ambiguous follow-up into something embeddable
|
|
272
|
-
* on its own. Receives the same `sender` identity `answerFn` sees (not the
|
|
273
|
-
* retrieval-scope-restricted one `bucketsFor` sees on the public
|
|
274
|
-
* OpenAI-compatible route — rewriting a query widens nothing, so it isn't
|
|
275
|
-
* subject to that clamp).
|
|
276
|
-
*
|
|
277
|
-
* Consulted everywhere `bucketsFor` is. A throw/rejection, or a return
|
|
278
|
-
* value that isn't a non-blank string, falls back to the unmodified query
|
|
279
|
-
* — a broken rewrite degrades relevance, never the chat path. Unset:
|
|
280
|
-
* retrieval runs on the latest user message unmodified.
|
|
281
|
-
*/
|
|
282
|
-
rewriteQuery?: RewriteQuery;
|
|
283
|
-
/**
|
|
284
|
-
* Post-processes the chunks retrieval returned — reordering, filtering, or
|
|
285
|
-
* otherwise reranking — before they're folded into the system prompt.
|
|
286
|
-
*
|
|
287
|
-
* Consulted everywhere `bucketsFor` is, immediately after retrieval runs.
|
|
288
|
-
* A throw/rejection, or a return value that isn't a string array, falls
|
|
289
|
-
* back to the chunks retrieval returned, unmodified. Unset: retrieved
|
|
290
|
-
* chunks are used as-is.
|
|
291
|
-
*/
|
|
292
|
-
rerankContext?: RerankContext;
|
|
293
341
|
/** Custom route handler for advanced use cases. May be async — see {@link CustomRoutes} */
|
|
294
342
|
customRoutes?: CustomRoutes;
|
|
295
343
|
/**
|
|
@@ -335,12 +383,18 @@ export type CustomRoutes = ((app: Hono, deps: ServerDependencies) => void) | ((a
|
|
|
335
383
|
export interface ServerDependencies {
|
|
336
384
|
/** OpenAI client instance */
|
|
337
385
|
client: OpenAI;
|
|
338
|
-
/**
|
|
339
|
-
store:
|
|
386
|
+
/** The retrieval backend `prepareChat` queries - the default `VectorStore`, or `config.retriever` when set. */
|
|
387
|
+
store: Retriever;
|
|
340
388
|
/**
|
|
341
|
-
* The libsql database client, shared with the vector store
|
|
342
|
-
* should use this handle rather than opening
|
|
343
|
-
* same database.
|
|
389
|
+
* The libsql database client, shared with the default vector store when
|
|
390
|
+
* one was built. Custom routes should use this handle rather than opening
|
|
391
|
+
* their own connection to the same database.
|
|
392
|
+
*
|
|
393
|
+
* Only actually present when `config.database` was set - the type stays
|
|
394
|
+
* required for now (narrowing it to reflect that is deferred, tracked as a
|
|
395
|
+
* follow-up ticket), so a host that configures `config.retriever` with no
|
|
396
|
+
* `config.database` and then reads `deps.db` gets `undefined` at runtime
|
|
397
|
+
* despite the type.
|
|
344
398
|
*/
|
|
345
399
|
db: LibsqlClient;
|
|
346
400
|
/** Chatter configuration */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,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ACR,uBAAuB;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,qBAAqB;QACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;QACrC,8BAA8B;QAC9B,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegoaltoworks/chatter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.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",
|
|
@@ -178,6 +178,9 @@
|
|
|
178
178
|
"@hono/node-server": {
|
|
179
179
|
"optional": true
|
|
180
180
|
},
|
|
181
|
+
"@libsql/client": {
|
|
182
|
+
"optional": true
|
|
183
|
+
},
|
|
181
184
|
"@modelcontextprotocol/sdk": {
|
|
182
185
|
"optional": true
|
|
183
186
|
},
|
|
@@ -198,14 +201,14 @@
|
|
|
198
201
|
"@biomejs/biome": "2.5.8",
|
|
199
202
|
"@commitlint/cli": "21.2.2",
|
|
200
203
|
"@commitlint/config-conventional": "21.2.2",
|
|
201
|
-
"@hono/node-server": "2.1.
|
|
204
|
+
"@hono/node-server": "2.1.1",
|
|
202
205
|
"@libsql/client": "0.17.4",
|
|
203
206
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
204
207
|
"@types/bun": "1.3.14",
|
|
205
208
|
"@types/node": "26.2.0",
|
|
206
209
|
"@whiskeysockets/baileys": "7.0.0-rc14",
|
|
207
210
|
"esbuild": "0.28.2",
|
|
208
|
-
"hono": "4.13.
|
|
211
|
+
"hono": "4.13.2",
|
|
209
212
|
"husky": "9.1.7",
|
|
210
213
|
"lint-staged": "17.3.0",
|
|
211
214
|
"openai": "7.4.0",
|