@chatlychat/cli 0.2.0 → 0.4.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 (37) 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-harness.d.ts +80 -0
  13. package/dist/commands/listen-relay-harness.d.ts.map +1 -0
  14. package/dist/commands/listen-relay-harness.js +163 -0
  15. package/dist/commands/listen-relay-harness.js.map +1 -0
  16. package/dist/commands/listen-relay-options.d.ts +78 -0
  17. package/dist/commands/listen-relay-options.d.ts.map +1 -0
  18. package/dist/commands/listen-relay-options.js +195 -0
  19. package/dist/commands/listen-relay-options.js.map +1 -0
  20. package/dist/commands/listen-relay-sign.d.ts +36 -0
  21. package/dist/commands/listen-relay-sign.d.ts.map +1 -0
  22. package/dist/commands/listen-relay-sign.js +136 -0
  23. package/dist/commands/listen-relay-sign.js.map +1 -0
  24. package/dist/commands/listen-relay.d.ts +43 -0
  25. package/dist/commands/listen-relay.d.ts.map +1 -0
  26. package/dist/commands/listen-relay.js +434 -0
  27. package/dist/commands/listen-relay.js.map +1 -0
  28. package/dist/commands/listen.d.ts +2 -39
  29. package/dist/commands/listen.d.ts.map +1 -1
  30. package/dist/commands/listen.js +73 -208
  31. package/dist/commands/listen.js.map +1 -1
  32. package/dist/help.d.ts +1 -1
  33. package/dist/help.d.ts.map +1 -1
  34. package/dist/help.js +19 -3
  35. package/dist/help.js.map +1 -1
  36. package/dist/run.js +1 -1
  37. package/package.json +3 -4
@@ -1,6 +1,15 @@
1
1
  /**
2
- * `chatly listen` — watch this workspace's webhook traffic and forward it to a
3
- * local URL.
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.
4
13
  *
5
14
  * ═══ HOW A LAPTOP RECEIVES EVENTS AT ALL ══════════════════════════════════
6
15
  *
@@ -37,6 +46,17 @@
37
46
  * startup banner, because "what did that leave behind" is the first question
38
47
  * a developer tool of this shape has to answer.
39
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
+ *
40
60
  * ═══ WHAT THIS CANNOT DO, AND THE ROUTE THAT WOULD FIX IT ═════════════════
41
61
  *
42
62
  * It cannot relay Chatly's OWN signature, because the server does not keep
@@ -45,16 +65,8 @@
45
65
  * persisted, the secret is returned by exactly one route and never read back,
46
66
  * `jsonb` does not preserve key order, and the signed envelope's `id` is the
47
67
  * BullMQ-era `deliveryId` which is not the delivery row's `id`. So the exact
48
- * signed bytes are unreconstructable by construction, not by omission.
49
- *
50
- * What this command forwards is therefore re-signed locally with `--secret`,
51
- * using the same construction the worker uses (`t=<unix seconds>,v1=HMAC over
52
- * <t>.<rawBody>`), and the header is **verified with the SDK's own
53
- * `verifyChatlySignature` before the request goes out**. That self-check is
54
- * not ceremony: it is the one thing that catches a signer and a verifier
55
- * drifting on construction or on timestamp unit, which is a bug this product
56
- * has actually shipped. If it ever fails, the forward is refused rather than
57
- * sent.
68
+ * signed bytes are unreconstructable by construction, not by omission. The
69
+ * same is true of `agent_deliveries`.
58
70
  *
59
71
  * A true `stripe listen` — the developer's handler seeing byte-for-byte what
60
72
  * production sends — needs a server-side surface, and there are two shapes:
@@ -64,108 +76,19 @@
64
76
  * from the same `signWebhookPayload` the dispatcher uses. Best for the
65
77
  * use case; needs a streaming route and a fan-out off the webhook queue.
66
78
  * 2. Cheaper: add `signed_body text` and `signature text` to
67
- * `webhook_deliveries`, return them from
68
- * `GET /v1/webhooks/deliveries/{id}`, and this poller relays them
69
- * untouched. One migration, two columns, no new route shape.
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.
70
82
  *
71
83
  * Both are in `apps/api`, `apps/worker` and `packages/db`, so neither is done
72
84
  * here. Until one lands, this command is honest about what it mints.
73
85
  */
74
- import { createHmac } from 'node:crypto';
75
- import { verifyChatlySignature } from '@chatlychat/sdk-node';
76
- import { bool, num, str } from '../args.js';
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';
77
90
  import { printJson } from '../output.js';
78
- /** Deliveries remembered before the oldest id is dropped. */
79
- const SEEN_CAP = 5_000;
80
- const DEFAULT_INTERVAL_SECONDS = 2;
81
- const MIN_INTERVAL_SECONDS = 1;
82
- const DEFAULT_PAGE_LIMIT = 50;
83
- /**
84
- * Sign a forwarded body the way the worker signs a real delivery.
85
- *
86
- * Deliberately not imported from `@livechat/shared/webhook-signature`: this
87
- * package is published and depends on `@chatlychat/sdk-node` alone, and
88
- * `sync-sdk-repos.mjs` cannot mirror a private workspace import. `node:crypto`
89
- * is the standard library, not a dependency.
90
- *
91
- * The construction is written out here so it reads beside the verification
92
- * below, and the verification is what keeps the two honest — see this file's
93
- * header.
94
- */
95
- function signForForward(body, secret, nowMs) {
96
- const t = Math.floor(nowMs / 1000).toString();
97
- const v1 = createHmac('sha256', secret).update(`${t}.${body}`).digest('hex');
98
- return `t=${t},v1=${v1}`;
99
- }
100
- function parseEventFilter(args) {
101
- const raw = args.flags['event'];
102
- if (raw === undefined) {
103
- return null;
104
- }
105
- const list = (Array.isArray(raw) ? raw : [String(raw)]).flatMap((v) => v
106
- .split(',')
107
- .map((s) => s.trim())
108
- .filter((s) => s.length > 0));
109
- return list.length === 0 ? null : new Set(list);
110
- }
111
- /** Read the flags, refusing anything that cannot work, with the fix named. */
112
- export function parseListenOptions(args) {
113
- const forwardTo = str(args.flags, 'forward-to') ?? null;
114
- if (forwardTo !== null) {
115
- let parsed = null;
116
- try {
117
- parsed = new URL(forwardTo);
118
- }
119
- catch {
120
- parsed = null;
121
- }
122
- /*
123
- * One message for both failures, because `localhost:3000` — the mistake
124
- * everyone makes — hits the SECOND branch, not the first: the WHATWG
125
- * parser reads `localhost:` as a SCHEME and succeeds. A test caught this
126
- * command telling a developer who typed `localhost:3000` that the scheme
127
- * `"localhost:"` was unsupported, which is true and useless.
128
- */
129
- if (parsed === null || (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')) {
130
- throw new Error(`--forward-to "${forwardTo}" is not an http(s) URL${parsed === null ? '' : ` (it parsed as the scheme "${parsed.protocol}")`}. Include the scheme:\n` + ' chatly listen --forward-to http://localhost:3000/webhooks');
131
- }
132
- }
133
- const intervalSeconds = num(args.flags, 'interval') ?? DEFAULT_INTERVAL_SECONDS;
134
- if (intervalSeconds < MIN_INTERVAL_SECONDS) {
135
- throw new Error(`--interval ${String(intervalSeconds)} is below the ${String(MIN_INTERVAL_SECONDS)}s floor. ` +
136
- 'This polls a real API on your own rate limit; a tighter loop buys nothing, because the ' +
137
- 'delivery row is written after the attempt completes.');
138
- }
139
- const pageLimit = num(args.flags, 'limit') ?? DEFAULT_PAGE_LIMIT;
140
- if (pageLimit < 1) {
141
- throw new Error(`--limit ${String(pageLimit)} must be at least 1.`);
142
- }
143
- const replay = num(args.flags, 'replay') ?? 0;
144
- if (replay < 0) {
145
- throw new Error(`--replay ${String(replay)} cannot be negative.`);
146
- }
147
- if (replay > pageLimit) {
148
- throw new Error(`--replay ${String(replay)} is more than --limit ${String(pageLimit)}, and this command ` +
149
- 'only ever reads one page per poll. Raise --limit to match.');
150
- }
151
- const secret = str(args.flags, 'secret') ?? null;
152
- if (secret !== null && !secret.startsWith('whsec_')) {
153
- throw new Error(`--secret should be the endpoint's whsec_ signing secret (got "${secret.slice(0, 6)}…").\n` +
154
- 'It is returned exactly once, by `chatly webhooks create`, and by no other route — if ' +
155
- 'you no longer have it, create another endpoint.');
156
- }
157
- return {
158
- forwardTo,
159
- endpointId: str(args.flags, 'endpoint') ?? null,
160
- events: parseEventFilter(args),
161
- status: str(args.flags, 'status') ?? null,
162
- secret,
163
- intervalMs: intervalSeconds * 1000,
164
- replay,
165
- pageLimit,
166
- json: bool(args.flags, 'json'),
167
- };
168
- }
91
+ export { parseListenOptions, } from './listen-core.js';
169
92
  function asRows(value) {
170
93
  const items = typeof value === 'object' && value !== null ? value.items : undefined;
171
94
  if (!Array.isArray(items)) {
@@ -199,7 +122,8 @@ async function resolveEndpoints(chatly, opts) {
199
122
  ' chatly webhooks create --url https://example.test/hook --event conversation.created\n' +
200
123
  '`chatly webhooks events` lists the subscribable names.\n\n' +
201
124
  'The URL has to be one the platform can reach — it is the real destination, and this\n' +
202
- 'command tails what was attempted against it rather than replacing it.');
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>`.");
203
127
  }
204
128
  if (opts.endpointId !== null) {
205
129
  const match = rows.find((r) => r.id === opts.endpointId);
@@ -238,86 +162,12 @@ function banner(opts, endpoints, deps) {
238
162
  deps.out(opts.secret === null
239
163
  ? 'UNSIGNED: no --secret, so forwarded requests carry no x-livechat-signature and your ' +
240
164
  "handler's verifier will reject them. Pass the endpoint's whsec_ secret."
241
- : 'Signed locally with --secret. This is NOT the signature Chatly sent — the delivery log ' +
242
- 'does not store one — so it proves nothing about the original request.');
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.');
243
168
  }
244
169
  deps.out('Registers nothing on the server; there is nothing to clean up. Ctrl-C to stop.\n');
245
170
  }
246
- /** Drop the oldest ids once the set is at its cap. Sets iterate in insertion order. */
247
- function remember(seen, id) {
248
- seen.add(id);
249
- if (seen.size > SEEN_CAP) {
250
- for (const old of seen) {
251
- seen.delete(old);
252
- if (seen.size <= SEEN_CAP) {
253
- break;
254
- }
255
- }
256
- }
257
- }
258
- /** POST one event on, verifying the header we just minted before sending it. */
259
- async function forward(opts, deps, envelope) {
260
- if (opts.forwardTo === null) {
261
- return false;
262
- }
263
- const body = JSON.stringify(envelope);
264
- const headers = {
265
- 'content-type': 'application/json',
266
- 'x-livechat-event': envelope.type,
267
- 'x-livechat-delivery': envelope.id,
268
- // Not a header Chatly sends. A handler that logs it can tell a replayed
269
- // local forward from a real delivery, which matters the first time
270
- // somebody points this at a staging environment.
271
- 'x-chatly-cli-forwarded': '1',
272
- };
273
- if (opts.secret !== null) {
274
- const nowMs = deps.now();
275
- const signature = signForForward(body, opts.secret, nowMs);
276
- /*
277
- * The self-check. `verifyChatlySignature` is the code a customer runs, so
278
- * if it disagrees with the signer four lines up, the two have drifted on
279
- * the construction or on the timestamp unit — and forwarding anyway would
280
- * teach the developer that their correct handler is broken.
281
- */
282
- const check = verifyChatlySignature({
283
- surface: 'event_webhook',
284
- body,
285
- headers: { 'x-livechat-signature': signature },
286
- secret: opts.secret,
287
- nowMs,
288
- });
289
- if (!check.ok) {
290
- deps.err(`refusing to forward ${envelope.id}: the signature this CLI minted does not verify ` +
291
- `(${check.reason}: ${check.message}). This is a bug in chatly listen, not in your ` +
292
- 'handler — please report it.\n');
293
- return false;
294
- }
295
- headers['x-livechat-signature'] = signature;
296
- headers['x-livechat-timestamp'] = signature.slice('t='.length, signature.indexOf(','));
297
- }
298
- try {
299
- const res = await deps.fetchFn(opts.forwardTo, {
300
- method: 'POST',
301
- headers,
302
- body,
303
- signal: deps.signal,
304
- });
305
- if (!res.ok) {
306
- deps.err(` ↳ ${opts.forwardTo} answered ${String(res.status)}. ` +
307
- (res.status === 401 || res.status === 403
308
- ? 'That is usually signature verification — check --secret matches the endpoint.\n'
309
- : '\n'));
310
- return false;
311
- }
312
- deps.out(` ↳ ${String(res.status)} from ${opts.forwardTo}`);
313
- return true;
314
- }
315
- catch (err) {
316
- const reason = err instanceof Error ? err.message : String(err);
317
- deps.err(` ↳ ${opts.forwardTo} unreachable: ${reason}. Is your server running on that port?\n`);
318
- return false;
319
- }
320
- }
321
171
  /**
322
172
  * The tail loop, abortable, with the process boundary left to the caller.
323
173
  *
@@ -414,7 +264,16 @@ export async function tail(chatly, opts, deps) {
414
264
  (row.error === null ? '' : ` (${row.error})`));
415
265
  }
416
266
  if (opts.forwardTo !== null) {
417
- if (await forward(opts, deps, envelope)) {
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) {
418
277
  forwarded += 1;
419
278
  }
420
279
  else {
@@ -429,24 +288,6 @@ export async function tail(chatly, opts, deps) {
429
288
  }
430
289
  return { seen: seenCount, forwarded, refused, polls };
431
290
  }
432
- /** An abortable sleep, so Ctrl-C does not wait out the poll interval. */
433
- function sleepUntilAborted(ms, signal) {
434
- return new Promise((resolve) => {
435
- if (signal.aborted) {
436
- resolve();
437
- return;
438
- }
439
- const timer = setTimeout(() => {
440
- signal.removeEventListener('abort', onAbort);
441
- resolve();
442
- }, ms);
443
- function onAbort() {
444
- clearTimeout(timer);
445
- resolve();
446
- }
447
- signal.addEventListener('abort', onAbort, { once: true });
448
- });
449
- }
450
291
  /**
451
292
  * The command entry point.
452
293
  *
@@ -455,7 +296,21 @@ function sleepUntilAborted(ms, signal) {
455
296
  * purpose did not fail.
456
297
  */
457
298
  export async function listen(chatly, args) {
458
- const opts = parseListenOptions(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);
459
314
  const controller = new AbortController();
460
315
  const stop = () => {
461
316
  controller.abort();
@@ -475,7 +330,17 @@ export async function listen(chatly, args) {
475
330
  },
476
331
  };
477
332
  try {
478
- const summary = await tail(chatly, opts, deps);
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);
479
344
  process.stdout.write(`\nStopped. ${String(summary.seen)} event(s) seen` +
480
345
  (opts.forwardTo === null
481
346
  ? '.\n'
@@ -1 +1 @@
1
- {"version":3,"file":"listen.js","sourceRoot":"","sources":["../../src/commands/listen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAmB,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAsEzC,6DAA6D;AAC7D,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,MAAc,EAAE,KAAa;IACjE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9C,MAAM,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AAC3B,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAgB;IACxC,MAAM,GAAG,GAA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E,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,OAAO,GACX,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3F,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB;YAChD,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI;gBACtB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,eAAe,MAAM,CAAC,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\nDEVELOPING AGAINST WEBHOOKS\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> delivered | failed | dead\n --replay <n> forward the n newest rows first\n --interval <seconds> poll interval, default 2\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,21NA2JhB,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,16 +113,30 @@ INTEGRATIONS
111
113
  channels list | get <id> | adapters | create | update <id>
112
114
  channels rotate-secret <id>
113
115
 
114
- DEVELOPING AGAINST WEBHOOKS
116
+ DEVELOPING AGAINST WEBHOOKS AND AGENTS
115
117
  listen Tail this workspace's webhook deliveries and POST
116
118
  each one to a local URL. Registers nothing
117
119
  --forward-to <url> where to POST (omit to print only)
118
120
  --secret <whsec_…> sign the forwarded request
119
121
  --endpoint <id> one subscription's traffic only
120
122
  --event <name> repeatable; filters client-side
121
- --status <s> delivered | failed | dead
123
+ --status <s> pending | delivered | failed | dead
122
124
  --replay <n> forward the n newest rows first
123
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
124
140
 
125
141
  WORKSPACE AS CODE
126
142
  plan Diff chatly.json against the live workspace. Reads only
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2JnB,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.js CHANGED
@@ -27,7 +27,7 @@ import { HELP } from './help.js';
27
27
  * drifts — it said `0.1.0` while the published package was `0.1.2` — so
28
28
  * `cli.spec.ts` asserts the two agree and fails if they do not.
29
29
  */
30
- const VERSION = '0.2.0';
30
+ const VERSION = '0.3.0';
31
31
  /** Commands that need no credential. Everything else resolves a key first. */
32
32
  const UNAUTHENTICATED = new Set(['login', 'logout', 'help', 'version']);
33
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatlychat/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.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.4.0"
33
+ "@chatlychat/sdk-node": "0.7.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.14.10",
@@ -41,8 +41,7 @@
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public",
44
- "registry": "https://registry.npmjs.org/",
45
- "provenance": true
44
+ "registry": "https://registry.npmjs.org/"
46
45
  },
47
46
  "engines": {
48
47
  "node": ">=20"