@chatlychat/cli 0.1.7 → 0.3.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.
Files changed (35) hide show
  1. package/dist/commands/config.d.ts.map +1 -1
  2. package/dist/commands/config.js +29 -3
  3. package/dist/commands/config.js.map +1 -1
  4. package/dist/commands/listen-bot.d.ts +52 -0
  5. package/dist/commands/listen-bot.d.ts.map +1 -0
  6. package/dist/commands/listen-bot.js +253 -0
  7. package/dist/commands/listen-bot.js.map +1 -0
  8. package/dist/commands/listen-core.d.ts +107 -0
  9. package/dist/commands/listen-core.d.ts.map +1 -0
  10. package/dist/commands/listen-core.js +334 -0
  11. package/dist/commands/listen-core.js.map +1 -0
  12. package/dist/commands/listen-relay-options.d.ts +78 -0
  13. package/dist/commands/listen-relay-options.d.ts.map +1 -0
  14. package/dist/commands/listen-relay-options.js +195 -0
  15. package/dist/commands/listen-relay-options.js.map +1 -0
  16. package/dist/commands/listen-relay-sign.d.ts +36 -0
  17. package/dist/commands/listen-relay-sign.d.ts.map +1 -0
  18. package/dist/commands/listen-relay-sign.js +136 -0
  19. package/dist/commands/listen-relay-sign.js.map +1 -0
  20. package/dist/commands/listen-relay.d.ts +43 -0
  21. package/dist/commands/listen-relay.d.ts.map +1 -0
  22. package/dist/commands/listen-relay.js +434 -0
  23. package/dist/commands/listen-relay.js.map +1 -0
  24. package/dist/commands/listen.d.ts +20 -0
  25. package/dist/commands/listen.d.ts.map +1 -0
  26. package/dist/commands/listen.js +355 -0
  27. package/dist/commands/listen.js.map +1 -0
  28. package/dist/help.d.ts +1 -1
  29. package/dist/help.d.ts.map +1 -1
  30. package/dist/help.js +28 -1
  31. package/dist/help.js.map +1 -1
  32. package/dist/run.d.ts.map +1 -1
  33. package/dist/run.js +11 -1
  34. package/dist/run.js.map +1 -1
  35. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listen-relay.js","sourceRoot":"","sources":["../../src/commands/listen-relay.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YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;YACrF,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type ListenDeps, type ListenOptions, type ListenSummary } from './listen-core.js';
2
+ import { type ParsedArgs } from '../args.js';
3
+ import type { ChatlyClient } from '@chatlychat/sdk-node';
4
+ export { parseListenOptions, type ListenDeps, type ListenOptions, type ListenSummary, } from './listen-core.js';
5
+ /**
6
+ * The tail loop, abortable, with the process boundary left to the caller.
7
+ *
8
+ * Exported so the spec can drive it with a bounded `maxPolls` and a scripted
9
+ * fetch, rather than racing a timer against a signal handler.
10
+ */
11
+ export declare function tail(chatly: ChatlyClient, opts: ListenOptions, deps: ListenDeps): Promise<ListenSummary>;
12
+ /**
13
+ * The command entry point.
14
+ *
15
+ * SIGINT and SIGTERM abort the loop rather than killing the process, so the
16
+ * summary still prints and the exit code is 0 — a developer tool stopped on
17
+ * purpose did not fail.
18
+ */
19
+ export declare function listen(chatly: ChatlyClient, args: ParsedArgs): Promise<number>;
20
+ //# sourceMappingURL=listen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../src/commands/listen.ts"],"names":[],"mappings":"AAsFA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,kBAAkB,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AA6H1B;;;;;GAKG;AACH,wBAAsB,IAAI,CACxB,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,aAAa,CAAC,CAoIxB;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAgEpF"}
@@ -0,0 +1,355 @@
1
+ /**
2
+ * `chatly listen` — watch this workspace's outbound traffic and forward it to
3
+ * a local URL.
4
+ *
5
+ * Two ledgers: webhook subscriptions by default, and one external agent's
6
+ * push deliveries with `--bot <id>` (`listen-bot.ts`). And one live mode,
7
+ * `--relay` (`listen-relay.ts`), for the three synchronous surfaces no ledger
8
+ * can carry — whose server half is `apps/api/src/modules/relay/`, built against
9
+ * `RELAY-SERVER-SPEC.md`. Everything the two ledgers share
10
+ * — the flags, the seen-set, the signing and the forward leg — is in
11
+ * `listen-core.ts`, which also records what the minted signature is and is
12
+ * not.
13
+ *
14
+ * ═══ HOW A LAPTOP RECEIVES EVENTS AT ALL ══════════════════════════════════
15
+ *
16
+ * Chatly delivers webhooks by POSTing to a URL, so a machine behind NAT cannot
17
+ * be a destination. Three ways out were considered and only one of them is
18
+ * real with a `ck_` workspace key:
19
+ *
20
+ * **(a) Poll the delivery log. This is what this command does.**
21
+ * `GET /v1/webhooks/deliveries` records one row per attempt — event type,
22
+ * payload, attempt number, HTTP status, latency, error, next retry — and is
23
+ * open to a `ck_` key (`@AllowApiKey()` on `WebhookDeliveriesController`,
24
+ * `integrations:read`), keyset-paginated newest-first on `created_at`, with
25
+ * `endpointId` and `status` filters. `GET /v1/webhooks/deliveries/{id}`
26
+ * returns the exact payload we POSTed. Both verified against their handlers,
27
+ * because a route list in this repo has been wrong in both directions.
28
+ *
29
+ * **(b) Subscribe over the realtime socket. Not possible.**
30
+ * `apps/realtime/src/gateway.ts` accepts exactly two credentials in its
31
+ * handshake: an agent RS256 access token or a visitor HS256 token. A
32
+ * workspace API key is neither, and there is no key-accessible route that
33
+ * mints either one. The realtime envelope vocabulary is also not the webhook
34
+ * catalogue — it is the dashboard's own event stream, with a different shape
35
+ * and a different subscription model.
36
+ *
37
+ * **(c) Register a temporary subscription and deregister on exit. Not
38
+ * possible either, and this is the finding worth writing down.**
39
+ * `POST /v1/webhooks` carries `@AllowApiKey()`. `DELETE /v1/webhooks/{id}`
40
+ * does **not** — it is the one route on that controller without it, so a key
41
+ * gets a 403. A CLI that registered an endpoint could therefore never remove
42
+ * it, and `listen` would leak a subscription into the customer's workspace on
43
+ * every run, with no key-accessible way to disable it either (there is no
44
+ * enable/disable route; the only PATCH moves the schema pin). So **this
45
+ * command registers nothing and has nothing to clean up** — stated in its own
46
+ * startup banner, because "what did that leave behind" is the first question
47
+ * a developer tool of this shape has to answer.
48
+ *
49
+ * ═══ THE THREE SURFACES THIS STILL CANNOT SHOW ════════════════════════════
50
+ *
51
+ * AI tool calls, customer-card fetches and canvas/step requests are
52
+ * **synchronous**: Chatly calls out and waits for the answer inside a
53
+ * visitor's request. There is no ledger to poll, because the response is the
54
+ * point — a log row would arrive after the visitor has already been told
55
+ * something went wrong. Relaying them needs a server-side surface that holds
56
+ * the inbound request open while a locally connected CLI answers it, which is
57
+ * a route and a socket in `apps/api`, not something this poller can fake.
58
+ * Written up in the C-01 report rather than half-built here.
59
+ *
60
+ * ═══ WHAT THIS CANNOT DO, AND THE ROUTE THAT WOULD FIX IT ═════════════════
61
+ *
62
+ * It cannot relay Chatly's OWN signature, because the server does not keep
63
+ * it. `webhook_deliveries` stores `payload` as `jsonb` and that is all: the
64
+ * signature is computed per attempt from the endpoint's secret and never
65
+ * persisted, the secret is returned by exactly one route and never read back,
66
+ * `jsonb` does not preserve key order, and the signed envelope's `id` is the
67
+ * BullMQ-era `deliveryId` which is not the delivery row's `id`. So the exact
68
+ * signed bytes are unreconstructable by construction, not by omission. The
69
+ * same is true of `agent_deliveries`.
70
+ *
71
+ * A true `stripe listen` — the developer's handler seeing byte-for-byte what
72
+ * production sends — needs a server-side surface, and there are two shapes:
73
+ *
74
+ * 1. `GET /v1/webhooks/tail` as Server-Sent Events: `@AllowApiKey()`,
75
+ * `integrations:read`, emitting `{ id, type, signedBody, signature }`
76
+ * from the same `signWebhookPayload` the dispatcher uses. Best for the
77
+ * use case; needs a streaming route and a fan-out off the webhook queue.
78
+ * 2. Cheaper: add `signed_body text` and `signature text` to
79
+ * `webhook_deliveries` (and `agent_deliveries`), return them from the
80
+ * per-delivery read, and this poller relays them untouched. One
81
+ * migration, two columns, no new route shape.
82
+ *
83
+ * Both are in `apps/api`, `apps/worker` and `packages/db`, so neither is done
84
+ * here. Until one lands, this command is honest about what it mints.
85
+ */
86
+ import { tailBot } from './listen-bot.js';
87
+ import { WEBHOOK_SIGN_PLAN, forward, parseListenOptions, remember, sleepUntilAborted, } from './listen-core.js';
88
+ import { parseRelayOptions, relay, relayOnlyFlagWithoutRelay } from './listen-relay.js';
89
+ import { bool } from '../args.js';
90
+ import { printJson } from '../output.js';
91
+ export { parseListenOptions, } from './listen-core.js';
92
+ function asRows(value) {
93
+ const items = typeof value === 'object' && value !== null ? value.items : undefined;
94
+ if (!Array.isArray(items)) {
95
+ return [];
96
+ }
97
+ return items.filter((row) => {
98
+ if (typeof row !== 'object' || row === null) {
99
+ return false;
100
+ }
101
+ const r = row;
102
+ return typeof r['id'] === 'string' && typeof r['eventType'] === 'string';
103
+ });
104
+ }
105
+ /**
106
+ * Which endpoints this will see traffic from, and the refusal when there are
107
+ * none.
108
+ *
109
+ * The empty case is the one worth getting right: a developer running
110
+ * `chatly listen` with no subscription configured sees an empty tail forever
111
+ * and concludes the command is broken, when the real answer is that no event
112
+ * has ever been dispatched to this workspace. So it is an error naming the
113
+ * command that fixes it.
114
+ */
115
+ async function resolveEndpoints(chatly, opts) {
116
+ const endpoints = await chatly.request('GET', '/v1/webhooks');
117
+ const rows = Array.isArray(endpoints) ? endpoints : [];
118
+ if (rows.length === 0) {
119
+ throw new Error('This workspace has no webhook subscriptions, so nothing is ever dispatched and the\n' +
120
+ 'delivery log this command tails will stay empty.\n\n' +
121
+ 'Create one first:\n' +
122
+ ' chatly webhooks create --url https://example.test/hook --event conversation.created\n' +
123
+ '`chatly webhooks events` lists the subscribable names.\n\n' +
124
+ 'The URL has to be one the platform can reach — it is the real destination, and this\n' +
125
+ 'command tails what was attempted against it rather than replacing it.\n\n' +
126
+ "To tail an external agent's push deliveries instead, use `chatly listen --bot <id>`.");
127
+ }
128
+ if (opts.endpointId !== null) {
129
+ const match = rows.find((r) => r.id === opts.endpointId);
130
+ if (match === undefined) {
131
+ throw new Error(`No webhook endpoint "${opts.endpointId}" in this workspace. The ids are:\n` +
132
+ rows.map((r) => ` ${String(r.id)} ${String(r.url)}`).join('\n'));
133
+ }
134
+ return [match];
135
+ }
136
+ return rows;
137
+ }
138
+ /**
139
+ * The startup banner.
140
+ *
141
+ * It says what was registered (nothing) and what the signature is (minted
142
+ * here), because both are things a developer would otherwise have to read
143
+ * this file to find out — and the second one changes how they should read a
144
+ * passing verification in their own handler.
145
+ */
146
+ function banner(opts, endpoints, deps) {
147
+ deps.out(`Tailing ${String(endpoints.length)} webhook endpoint(s) via the delivery log, ` +
148
+ `every ${String(opts.intervalMs / 1000)}s.`);
149
+ for (const e of endpoints) {
150
+ const types = Array.isArray(e.eventTypes) ? e.eventTypes.length : 0;
151
+ deps.out(` ${String(e.id)} ${String(e.url)} ${String(types)} event type(s)` +
152
+ (e.enabled === false ? ' [DISABLED — it receives nothing]' : ''));
153
+ }
154
+ if (opts.events !== null) {
155
+ deps.out(`Filtering to: ${[...opts.events].join(', ')} ` +
156
+ '(client-side — an event no endpoint subscribes to never reaches the log at all)');
157
+ }
158
+ deps.out(opts.forwardTo === null
159
+ ? 'Printing only. Pass --forward-to http://localhost:PORT/path to POST each event on.'
160
+ : `Forwarding to ${opts.forwardTo}`);
161
+ if (opts.forwardTo !== null) {
162
+ deps.out(opts.secret === null
163
+ ? 'UNSIGNED: no --secret, so forwarded requests carry no x-livechat-signature and your ' +
164
+ "handler's verifier will reject them. Pass the endpoint's whsec_ secret."
165
+ : 'Signed locally with --secret, as x-livechat-signature AND x-chatly-signature-v2. ' +
166
+ 'This is NOT the signature Chatly sent — the delivery log does not store one — so ' +
167
+ 'it proves nothing about the original request.');
168
+ }
169
+ deps.out('Registers nothing on the server; there is nothing to clean up. Ctrl-C to stop.\n');
170
+ }
171
+ /**
172
+ * The tail loop, abortable, with the process boundary left to the caller.
173
+ *
174
+ * Exported so the spec can drive it with a bounded `maxPolls` and a scripted
175
+ * fetch, rather than racing a timer against a signal handler.
176
+ */
177
+ export async function tail(chatly, opts, deps) {
178
+ const endpoints = await resolveEndpoints(chatly, opts);
179
+ banner(opts, endpoints, deps);
180
+ const query = { limit: opts.pageLimit };
181
+ if (opts.endpointId !== null) {
182
+ query['endpointId'] = opts.endpointId;
183
+ }
184
+ if (opts.status !== null) {
185
+ query['status'] = opts.status;
186
+ }
187
+ const seen = new Set();
188
+ let seenCount = 0;
189
+ let forwarded = 0;
190
+ let refused = 0;
191
+ let polls = 0;
192
+ /*
193
+ * The baseline. Without it, the first poll replays everything already in
194
+ * the log — which for a busy workspace is `--limit` surprise POSTs at a
195
+ * handler the developer just started. `--replay N` deliberately leaves the
196
+ * newest N rows unseen, which is the "show me the last few" case.
197
+ */
198
+ const firstPage = asRows(await chatly.request('GET', '/v1/webhooks/deliveries', { query }));
199
+ for (const row of firstPage.slice(opts.replay)) {
200
+ remember(seen, row.id);
201
+ }
202
+ if (opts.replay > 0) {
203
+ deps.out(`Replaying the ${String(Math.min(opts.replay, firstPage.length))} most recent.\n`);
204
+ }
205
+ const matches = (row) => opts.events === null || opts.events.has(row.eventType);
206
+ for (;;) {
207
+ if (deps.signal.aborted) {
208
+ break;
209
+ }
210
+ if (deps.maxPolls !== undefined && polls >= deps.maxPolls) {
211
+ break;
212
+ }
213
+ polls += 1;
214
+ /*
215
+ * The first poll REUSES the baseline page rather than asking again. Two
216
+ * identical requests back to back is one more than the rate limit needs
217
+ * to see, and with `--replay` the baseline page is exactly what has to be
218
+ * replayed — so there is no case where re-reading it is right.
219
+ */
220
+ const page = polls === 1
221
+ ? firstPage
222
+ : asRows(await chatly.request('GET', '/v1/webhooks/deliveries', { query }));
223
+ // Newest-first off the wire; replay in the order they happened.
224
+ const fresh = page.filter((row) => !seen.has(row.id)).reverse();
225
+ /*
226
+ * Poll 1 is exempt: it is the baseline page, not a window this loop could
227
+ * have overflowed, and with `--replay N` its `fresh` rows are new on
228
+ * purpose. From poll 2 on, a FULL page with nothing already seen on it
229
+ * means ≥ --limit deliveries landed since the last look and some are gone
230
+ * from the window.
231
+ */
232
+ if (polls > 1 && fresh.length === page.length && page.length === opts.pageLimit) {
233
+ /*
234
+ * Every row on a FULL page was new, so the window may have overflowed
235
+ * between polls and some deliveries were never seen. This command reads
236
+ * one page per poll by design — walking the cursor backwards on every
237
+ * tick would re-read the whole log — so the honest thing is to say it.
238
+ */
239
+ deps.err(`warning: all ${String(opts.pageLimit)} rows on this page were new, so events may have ` +
240
+ 'been missed between polls. Use a shorter --interval or a larger --limit.\n');
241
+ }
242
+ for (const row of fresh) {
243
+ remember(seen, row.id);
244
+ if (!matches(row)) {
245
+ continue;
246
+ }
247
+ seenCount += 1;
248
+ const detail = await chatly.request('GET', `/v1/webhooks/deliveries/${encodeURIComponent(row.id)}`);
249
+ /*
250
+ * The envelope the worker signs is `{ id, type, payload }`. `id` here
251
+ * is the DELIVERY ROW's id, not the `deliveryId` that was in the
252
+ * original signed body — that value is not stored anywhere readable. It
253
+ * is still stable per attempt, which is what a handler deduping on it
254
+ * needs.
255
+ */
256
+ const envelope = { id: row.id, type: row.eventType, payload: detail.payload };
257
+ if (opts.json) {
258
+ printJson({ ...envelope, delivery: row });
259
+ }
260
+ else {
261
+ const http = row.httpStatus === null ? '—' : String(row.httpStatus);
262
+ deps.out(`${row.eventType} ${row.id} attempt ${String(row.attempt)} ${row.status} ` +
263
+ `http ${http} ${row.createdAt}` +
264
+ (row.error === null ? '' : ` (${row.error})`));
265
+ }
266
+ if (opts.forwardTo !== null) {
267
+ const sent = await forward(opts, deps, {
268
+ id: row.id,
269
+ body: JSON.stringify(envelope),
270
+ headers: {
271
+ 'x-livechat-event': envelope.type,
272
+ 'x-livechat-delivery': envelope.id,
273
+ },
274
+ plan: WEBHOOK_SIGN_PLAN,
275
+ });
276
+ if (sent) {
277
+ forwarded += 1;
278
+ }
279
+ else {
280
+ refused += 1;
281
+ }
282
+ }
283
+ }
284
+ if (deps.maxPolls !== undefined && polls >= deps.maxPolls) {
285
+ break;
286
+ }
287
+ await deps.sleep(opts.intervalMs, deps.signal);
288
+ }
289
+ return { seen: seenCount, forwarded, refused, polls };
290
+ }
291
+ /**
292
+ * The command entry point.
293
+ *
294
+ * SIGINT and SIGTERM abort the loop rather than killing the process, so the
295
+ * summary still prints and the exit code is 0 — a developer tool stopped on
296
+ * purpose did not fail.
297
+ */
298
+ export async function listen(chatly, args) {
299
+ const relayMode = bool(args.flags, 'relay');
300
+ if (!relayMode) {
301
+ /*
302
+ * `--tool` on a ledger tail would be silently ignored, and the developer
303
+ * would wait for a tool call that the ledger can never contain.
304
+ */
305
+ const stray = relayOnlyFlagWithoutRelay(args);
306
+ if (stray !== null) {
307
+ throw new Error(`--${stray} selects a target for --relay, and no ledger records those calls. Did you ` +
308
+ `mean:\n chatly listen --relay --${stray} <id> --forward-to http://localhost:3000`);
309
+ }
310
+ }
311
+ // Parse BEFORE installing signal handlers, so a refusal leaves none behind.
312
+ const relayOpts = relayMode ? parseRelayOptions(args) : null;
313
+ const opts = relayMode ? null : parseListenOptions(args);
314
+ const controller = new AbortController();
315
+ const stop = () => {
316
+ controller.abort();
317
+ };
318
+ process.once('SIGINT', stop);
319
+ process.once('SIGTERM', stop);
320
+ const deps = {
321
+ fetchFn: globalThis.fetch.bind(globalThis),
322
+ now: () => Date.now(),
323
+ sleep: sleepUntilAborted,
324
+ signal: controller.signal,
325
+ out: (line) => {
326
+ process.stdout.write(`${line}\n`);
327
+ },
328
+ err: (line) => {
329
+ process.stderr.write(line);
330
+ },
331
+ };
332
+ try {
333
+ if (relayOpts !== null) {
334
+ const r = await relay(chatly, relayOpts, deps);
335
+ process.stdout.write(`\nDetached (${r.endReason}). ${String(r.frames)} call(s) relayed, ` +
336
+ `${String(r.answered)} answered by your handler, ${String(r.failed)} not.\n`);
337
+ // The server ending a relay the developer did not ask to end is a failure.
338
+ return r.endReason === 'interrupted' || r.endReason === 'idle' ? 0 : 1;
339
+ }
340
+ if (opts === null) {
341
+ throw new Error('unreachable: neither relay nor ledger options were parsed');
342
+ }
343
+ const summary = opts.botId === null ? await tail(chatly, opts, deps) : await tailBot(chatly, opts, deps);
344
+ process.stdout.write(`\nStopped. ${String(summary.seen)} event(s) seen` +
345
+ (opts.forwardTo === null
346
+ ? '.\n'
347
+ : `, ${String(summary.forwarded)} forwarded, ${String(summary.refused)} not.\n`));
348
+ return 0;
349
+ }
350
+ finally {
351
+ process.off('SIGINT', stop);
352
+ process.off('SIGTERM', stop);
353
+ }
354
+ }
355
+ //# sourceMappingURL=listen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listen.js","sourceRoot":"","sources":["../../src/commands/listen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,GAIlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,IAAI,EAAmB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EACL,kBA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AAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CACrF,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
package/dist/help.d.ts CHANGED
@@ -22,5 +22,5 @@
22
22
  * The convention the spec relies on: a command line starts with exactly two
23
23
  * spaces and its first word is the command group.
24
24
  */
25
- export declare const HELP = "chatly \u2014 the Chatly command line\n\nUSAGE\n chatly <command> [subcommand] [flags]\n\nAUTH\n login Store an API key in ~/.config/chatly/config.json (0600)\n logout Remove the stored key\n whoami Which workspace this key belongs to, and its scopes\n\nCONVERSATIONS\n conversations list Open conversations, newest first\n conversations get <id> One conversation\n conversations messages <id> The thread\n conversations send <id> <body>\n Reply as the key's machine identity\n conversations unattended Open with no agent reply yet\n conversations mood <id> Sentiment over the thread\n conversations return-to-bot <id> <bot-id>\n Give an open thread back to an assistant\n\nCONTACTS\n contacts list People in this workspace\n contacts get <id>\n contacts upsert --email --name --external-id --phone\n contacts tag <id> <tag> Add a tag\n contacts journey <id> Timeline: conversations, events, tickets\n contacts cards <id> Customer-card data for this person\n\nTICKETS\n tickets list --status --queue\n tickets get <id>\n tickets comments <id>\n tickets queues\n tickets lineage <id> Merge and split history\n tickets time <id> Time logged\n tickets status-history <id>\n\nKNOWLEDGE + SEARCH\n search <query> Across contacts, conversations, messages, tickets, KB\n kb articles Help-centre articles\n kb article <slug>\n kb collections\n\nEVENTS\n events track <contact-id> <name>\n Fire a CDP event. --prop key=value, repeatable\n events list --contact-id\n\nBOTS + EXTERNAL AGENTS\n bots list | get <id>\n bots create --body. type:\"external\" answers with a secret, ONCE\n bots update <id> --body\n bots update-external <id> --body. webhookUrl, timeoutSeconds, fallbackMessage\n bots rotate-secret <id> New signing secret, shown once. No overlap window\n bots deliveries <id> The push ledger. --status pending|delivered|failed|dead\n bots delivery <id> <delivery-id>\n One delivery, with the exact signed payload\n bots redeliver <id> <delivery-id>\n Queue the recorded payload again, from attempt 0\n bots test-delivery <id> Sign and POST a rehearsal payload; prints the response\n\nROUTING + AUTOMATION\n bot-routes list | fields | create | update <id> | delete <id>\n bot-routes resolve Dry-run the table. --body with a hypothetical visitor\n triggers list | get <id> | upsert | delete <id>\n brands list | get <id> | create | update <id> | delete <id>\n macros list | get <id> | create | update <id> | delete <id>\n email-templates templates | get <kind> | set <kind> | reset <kind>\n knowledge-gaps list | triage <id>\n\nINTEGRATIONS\n webhooks deliveries --status\n webhooks delivery <id>\n webhooks redeliver <id>\n webhooks endpoints Subscriptions, not traffic\n webhooks events The subscribable event catalogue\n webhooks schema-versions\n webhooks create --url --event (repeatable). Answers with whsec_, once\n webhooks pin <id> <version>\n customer-cards list | create | update <id> | delete <id>\n customer-cards rotate-secret <id>\n Update your endpoint BEFORE calling this\n docs-sources list | providers | discover | create | update <id> | delete <id>\n docs-sources sync <id> --full re-reads every page\n docs-sources subscribe <id> A refusal is a success: read the response\n channels list | get <id> | adapters | create | update <id>\n channels rotate-secret <id>\n\nWORKSPACE AS CODE\n plan Diff chatly.json against the live workspace. Reads only\n apply Make the plan's changes. Never deletes unless told\n --file <path> the document (- for stdin). Default: ./chatly.json\n --prune also delete what the document omits\n --write-only also send fields that cannot be read back\n --exit-code plan only: exit 2 when there is drift\n\nAI\n ai providers | quota\n ai add-provider BYOK. --body\n ai test-provider <key>\n ai tools | create-tool | update-tool <id> | delete-tool <id>\n ai tone | set-tone | generate-tone <sample>\n\nREPORTS\n reports overview --days\n reports agents Means, not percentiles\n reports conversations-by-day\n reports sources | response-times | voice\n reports attribution <dim> One of ten dimensions; an unknown one is refused\n reports cohorts --weeks, NOT --days\n reports themes --date. A daily snapshot; there is no regenerate\n reports theme-conversations <theme-id>\n reports teams | labels | sla\n --from --to --days --group-by\n\nBILLING\n billing summary | plans | invoices\n billing usage <event-type> One meter over a window. --from --to\n billing usage-daily <event-type>\n Dense: one row per UTC day, zeros included\n billing usage-monthly --month\n\nWORKSPACE\n workspace settings\n workspace labels | inboxes | skills\n workspace team-members <team-id>\n workspace key-scopes What a key may be granted\n\nRAW\n api <METHOD> <path> Any route, with auth, idempotency and retries\n chatly api GET /v1/feature-flags\n chatly api POST /v1/macros --body '{\"name\":\"Refund\"}'\n\nGLOBAL FLAGS\n --json Raw API response instead of a table\n --all Follow pagination to the end (list commands)\n --limit <n> Page size\n --cursor <c> Start from a cursor\n --key <ck_\u2026> Override the stored key for this call\n --api-url <url> Point at another Chatly environment\n --help, --version\n\nDocs: https://chatlychat.com/docs/sdk-cli\n";
25
+ export declare const HELP = "chatly \u2014 the Chatly command line\n\nUSAGE\n chatly <command> [subcommand] [flags]\n\nAUTH\n login Store an API key in ~/.config/chatly/config.json (0600)\n logout Remove the stored key\n whoami Which workspace this key belongs to, and its scopes\n\nCONVERSATIONS\n conversations list Open conversations, newest first\n conversations get <id> One conversation\n conversations messages <id> The thread\n conversations send <id> <body>\n Reply as the key's machine identity\n conversations unattended Open with no agent reply yet\n conversations mood <id> Sentiment over the thread\n conversations return-to-bot <id> <bot-id>\n Give an open thread back to an assistant\n\nCONTACTS\n contacts list People in this workspace\n contacts get <id>\n contacts upsert --email --name --external-id --phone\n contacts tag <id> <tag> Add a tag\n contacts journey <id> Timeline: conversations, events, tickets\n contacts cards <id> Customer-card data for this person\n\nTICKETS\n tickets list --status --queue\n tickets get <id>\n tickets comments <id>\n tickets queues\n tickets lineage <id> Merge and split history\n tickets time <id> Time logged\n tickets status-history <id>\n\nKNOWLEDGE + SEARCH\n search <query> Across contacts, conversations, messages, tickets, KB\n kb articles Help-centre articles\n kb article <slug>\n kb collections\n\nEVENTS\n events track <contact-id> <name>\n Fire a CDP event. --prop key=value, repeatable\n events list --contact-id\n\nBOTS + EXTERNAL AGENTS\n bots list | get <id>\n bots create --body. type:\"external\" answers with a secret, ONCE\n bots update <id> --body\n bots update-external <id> --body. webhookUrl, timeoutSeconds, fallbackMessage\n bots rotate-secret <id> New signing secret, shown once. Hard cut, or\n --activate-at <ISO instant> (\u2264168h) keeps the old\n one signing until then\n bots deliveries <id> The push ledger. --status pending|delivered|failed|dead\n bots delivery <id> <delivery-id>\n One delivery, with the exact signed payload\n bots redeliver <id> <delivery-id>\n Queue the recorded payload again, from attempt 0\n bots test-delivery <id> Sign and POST a rehearsal payload; prints the response\n\nROUTING + AUTOMATION\n bot-routes list | fields | create | update <id> | delete <id>\n bot-routes resolve Dry-run the table. --body with a hypothetical visitor\n triggers list | get <id> | upsert | delete <id>\n brands list | get <id> | create | update <id> | delete <id>\n macros list | get <id> | create | update <id> | delete <id>\n email-templates templates | get <kind> | set <kind> | reset <kind>\n knowledge-gaps list | triage <id>\n\nINTEGRATIONS\n webhooks deliveries --status\n webhooks delivery <id>\n webhooks redeliver <id>\n webhooks endpoints Subscriptions, not traffic\n webhooks events The subscribable event catalogue\n webhooks schema-versions\n webhooks create --url --event (repeatable). Answers with whsec_, once\n webhooks pin <id> <version>\n customer-cards list | create | update <id> | delete <id>\n customer-cards rotate-secret <id>\n Update your endpoint BEFORE calling this\n docs-sources list | providers | discover | create | update <id> | delete <id>\n docs-sources sync <id> --full re-reads every page\n docs-sources subscribe <id> A refusal is a success: read the response\n channels list | get <id> | adapters | create | update <id>\n channels rotate-secret <id>\n\nDEVELOPING AGAINST WEBHOOKS AND AGENTS\n listen Tail this workspace's webhook deliveries and POST\n each one to a local URL. Registers nothing\n --forward-to <url> where to POST (omit to print only)\n --secret <whsec_\u2026> sign the forwarded request\n --endpoint <id> one subscription's traffic only\n --event <name> repeatable; filters client-side\n --status <s> pending | delivered | failed | dead\n --replay <n> forward the n newest rows first\n --interval <seconds> poll interval, default 2\n listen --bot <id> Tail one external agent's push deliveries instead,\n the same ledger as 'bots deliveries'. Same flags, except:\n --secret <chsec_\u2026> the AGENT's secret, not whsec_\n --event <kind> message | transfer (agent.message too)\n Forwards the payload itself, with the five\n x-chatly-* headers a real delivery carries\n listen --relay Receive LIVE tool calls, card fetches and canvas steps\n on localhost and answer them. Takes PRODUCTION traffic\n for the ids named, so they are required:\n --tool <id> | --card <id> | --canvas <channelId>\n --forward-to <url> required; each call's path is appended\n --secret <s> or <id>=<s>, repeatable; re-signs\n Detaches after 10 minutes idle, or on Ctrl-C. The\n dashboard shows a banner for as long as it is attached\n\nWORKSPACE AS CODE\n plan Diff chatly.json against the live workspace. Reads only\n apply Make the plan's changes. Never deletes unless told\n --file <path> the document (- for stdin). Default: ./chatly.json\n --prune also delete what the document omits\n --write-only also send fields that cannot be read back\n --exit-code plan only: exit 2 when there is drift\n\nAI\n ai providers | quota\n ai add-provider BYOK. --body\n ai test-provider <key>\n ai tools | create-tool | update-tool <id> | delete-tool <id>\n ai tone | set-tone | generate-tone <sample>\n\nREPORTS\n reports overview --days\n reports agents Means, not percentiles\n reports conversations-by-day\n reports sources | response-times | voice\n reports attribution <dim> One of ten dimensions; an unknown one is refused\n reports cohorts --weeks, NOT --days\n reports themes --date. A daily snapshot; there is no regenerate\n reports theme-conversations <theme-id>\n reports teams | labels | sla\n --from --to --days --group-by\n\nBILLING\n billing summary | plans | invoices\n billing usage <event-type> One meter over a window. --from --to\n billing usage-daily <event-type>\n Dense: one row per UTC day, zeros included\n billing usage-monthly --month\n\nWORKSPACE\n workspace settings\n workspace labels | inboxes | skills\n workspace team-members <team-id>\n workspace key-scopes What a key may be granted\n\nRAW\n api <METHOD> <path> Any route, with auth, idempotency and retries\n chatly api GET /v1/feature-flags\n chatly api POST /v1/macros --body '{\"name\":\"Refund\"}'\n\nGLOBAL FLAGS\n --json Raw API response instead of a table\n --all Follow pagination to the end (list commands)\n --limit <n> Page size\n --cursor <c> Start from a cursor\n --key <ck_\u2026> Override the stored key for this call\n --api-url <url> Point at another Chatly environment\n --help, --version\n\nDocs: https://chatlychat.com/docs/sdk-cli\n";
26
26
  //# sourceMappingURL=help.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,8lMAgJhB,CAAC"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,IAAI,ooQA2KhB,CAAC"}
package/dist/help.js CHANGED
@@ -76,7 +76,9 @@ BOTS + EXTERNAL AGENTS
76
76
  bots create --body. type:"external" answers with a secret, ONCE
77
77
  bots update <id> --body
78
78
  bots update-external <id> --body. webhookUrl, timeoutSeconds, fallbackMessage
79
- bots rotate-secret <id> New signing secret, shown once. No overlap window
79
+ bots rotate-secret <id> New signing secret, shown once. Hard cut, or
80
+ --activate-at <ISO instant> (≤168h) keeps the old
81
+ one signing until then
80
82
  bots deliveries <id> The push ledger. --status pending|delivered|failed|dead
81
83
  bots delivery <id> <delivery-id>
82
84
  One delivery, with the exact signed payload
@@ -111,6 +113,31 @@ INTEGRATIONS
111
113
  channels list | get <id> | adapters | create | update <id>
112
114
  channels rotate-secret <id>
113
115
 
116
+ DEVELOPING AGAINST WEBHOOKS AND AGENTS
117
+ listen Tail this workspace's webhook deliveries and POST
118
+ each one to a local URL. Registers nothing
119
+ --forward-to <url> where to POST (omit to print only)
120
+ --secret <whsec_…> sign the forwarded request
121
+ --endpoint <id> one subscription's traffic only
122
+ --event <name> repeatable; filters client-side
123
+ --status <s> pending | delivered | failed | dead
124
+ --replay <n> forward the n newest rows first
125
+ --interval <seconds> poll interval, default 2
126
+ listen --bot <id> Tail one external agent's push deliveries instead,
127
+ the same ledger as 'bots deliveries'. Same flags, except:
128
+ --secret <chsec_…> the AGENT's secret, not whsec_
129
+ --event <kind> message | transfer (agent.message too)
130
+ Forwards the payload itself, with the five
131
+ x-chatly-* headers a real delivery carries
132
+ listen --relay Receive LIVE tool calls, card fetches and canvas steps
133
+ on localhost and answer them. Takes PRODUCTION traffic
134
+ for the ids named, so they are required:
135
+ --tool <id> | --card <id> | --canvas <channelId>
136
+ --forward-to <url> required; each call's path is appended
137
+ --secret <s> or <id>=<s>, repeatable; re-signs
138
+ Detaches after 10 minutes idle, or on Ctrl-C. The
139
+ dashboard shows a banner for as long as it is attached
140
+
114
141
  WORKSPACE AS CODE
115
142
  plan Diff chatly.json against the live workspace. Reads only
116
143
  apply Make the plan's changes. Never deletes unless told
package/dist/help.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJnB,CAAC"}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2KnB,CAAC"}
package/dist/run.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAkB,YAAY,EAAwB,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,WA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D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,YAAY,CAAC;AAIxF,wBAAsB,GAAG,CACvB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,UAAU,GAAE,aAA8B,GACzC,OAAO,CAAC,MAAM,CAAC,CAkDjB;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAqBvE"}
package/dist/run.js CHANGED
@@ -13,6 +13,7 @@ import * as auth from './commands/auth.js';
13
13
  import * as config from './commands/config.js';
14
14
  import * as insights from './commands/insights.js';
15
15
  import * as integrations from './commands/integrations.js';
16
+ import * as listenCmd from './commands/listen.js';
16
17
  import * as cmd from './commands/resources.js';
17
18
  import * as wac from './commands/workspace-as-code.js';
18
19
  import { resolveCredentials } from './config.js';
@@ -26,7 +27,7 @@ import { HELP } from './help.js';
26
27
  * drifts — it said `0.1.0` while the published package was `0.1.2` — so
27
28
  * `cli.spec.ts` asserts the two agree and fails if they do not.
28
29
  */
29
- const VERSION = '0.1.7';
30
+ const VERSION = '0.3.0';
30
31
  /** Commands that need no credential. Everything else resolves a key first. */
31
32
  const UNAUTHENTICATED = new Set(['login', 'logout', 'help', 'version']);
32
33
  /**
@@ -62,6 +63,15 @@ export const COMMANDS = {
62
63
  'knowledge-gaps': config.knowledgeGaps,
63
64
  // ── Integrations ──────────────────────────────────────────────────────
64
65
  webhooks: integrations.webhooks,
66
+ /*
67
+ * `listen` sits beside `webhooks` rather than under it, because it is not a
68
+ * CRUD verb on the same resource — it is the `stripe listen` equivalent, a
69
+ * long-running tail, and it is what a developer types without reading
70
+ * anything first. Read `commands/listen.ts`'s header before changing how it
71
+ * gets its events: the three possible designs are enumerated there and two
72
+ * of them are impossible with a `ck_` key.
73
+ */
74
+ listen: listenCmd.listen,
65
75
  'customer-cards': integrations.customerCards,
66
76
  'docs-sources': integrations.docsSources,
67
77
  channels: integrations.channels,
package/dist/run.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,GAAG,MAAM,yBAAyB,CAAC;AAC/C,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,8EAA8E;AAC9E,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,QAAQ,GAEjB;IACF,yEAAyE;IACzE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC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ACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AAChF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatlychat/cli",
3
- "version": "0.1.7",
3
+ "version": "0.3.0",
4
4
  "description": "The Chatly command line — inspect conversations, send replies, read reports and call any API route from a terminal.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/chatlychat/chatly-cli#readme",
@@ -30,7 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "dependencies": {
33
- "@chatlychat/sdk-node": "0.3.1"
33
+ "@chatlychat/sdk-node": "0.6.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.14.10",