@interactive-inc/claude-funnel 0.52.0 → 0.55.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 (72) hide show
  1. package/README.md +25 -3
  2. package/dist/bin.js +1276 -520
  3. package/dist/claude.d.ts +22 -5
  4. package/dist/claude.js +456 -169
  5. package/dist/connector-adapter-1PxjN-Uk.d.ts +25 -0
  6. package/dist/{connector-adapter-D5Utumgz.js → connector-adapter-qwXLjQId.js} +1 -1
  7. package/dist/{connector-listener-DU54DN-f.js → connector-listener-CpHBecCj.js} +1 -1
  8. package/dist/connectors/discord.d.ts +6 -6
  9. package/dist/connectors/discord.js +2 -2
  10. package/dist/connectors/gh.d.ts +6 -6
  11. package/dist/connectors/gh.js +2 -2
  12. package/dist/connectors/schedule.d.ts +12 -2
  13. package/dist/connectors/schedule.js +2 -2
  14. package/dist/connectors/slack.d.ts +3 -3
  15. package/dist/connectors/slack.js +2 -2
  16. package/dist/{connector-diagnostic-log-yTOojKUR.d.ts → diagnostic-log-Bxe7Bbvw.d.ts} +2 -2
  17. package/dist/diagnostic-sql-reader-CzYgZpq2.js +83 -0
  18. package/dist/diagnostics.d.ts +2 -0
  19. package/dist/diagnostics.js +2 -0
  20. package/dist/{discord-connector-schema-CBDyGdOI.js → discord-connector-schema-B_N6IXLz.js} +1 -1
  21. package/dist/{discord-connector-schema-R0Uu-3ns.d.ts → discord-connector-schema-CPgcZkXh.d.ts} +1 -1
  22. package/dist/{discord-listener-_jSE3HsQ.js → discord-listener-C0MoKdQO.js} +6 -6
  23. package/dist/docs.d.ts +2 -0
  24. package/dist/docs.js +2 -0
  25. package/dist/doctor.d.ts +2 -0
  26. package/dist/doctor.js +2 -0
  27. package/dist/{file-process-guard-BgrVHe9I.d.ts → file-process-guard-DI1742H5.d.ts} +31 -15
  28. package/dist/funnel-diagnostics-BpKYrMSu.js +300 -0
  29. package/dist/funnel-diagnostics-qWy5tPSq.d.ts +176 -0
  30. package/dist/funnel-docs-dXPokzr5.d.ts +18 -0
  31. package/dist/funnel-docs-ng5K8w4j.js +653 -0
  32. package/dist/funnel-doctor-BF3Rdgk0.d.ts +34 -0
  33. package/dist/funnel-doctor-CApCezTq.js +82 -0
  34. package/dist/funnel-recovery-BUBsu7WX.d.ts +101 -0
  35. package/dist/funnel-recovery-D9CxD5Zs.js +134 -0
  36. package/dist/gateway/daemon.js +810 -211
  37. package/dist/{settings-store-D2XSXTyt.js → gateway-base-url-6foMXfFf.js} +19 -6
  38. package/dist/gateway.d.ts +3 -3
  39. package/dist/gateway.js +3 -2
  40. package/dist/{gh-connector-schema-eoTtHbY6.d.ts → gh-connector-schema-CU1ojfIF.d.ts} +1 -1
  41. package/dist/{gh-connector-schema-o3Q1-ojL.js → gh-connector-schema-DUcZgN2Q.js} +1 -1
  42. package/dist/{gh-listener-DH-fClQm.js → gh-listener-Dsx6AmhH.js} +5 -5
  43. package/dist/{index-NFs2jzCa.d.ts → index-CrngHrne.d.ts} +187 -619
  44. package/dist/index.d.ts +16 -11
  45. package/dist/index.js +512 -976
  46. package/dist/{local-config-json-schema-8IHjS4Q7.js → local-config-json-schema-DE1zkMcb.js} +35 -9
  47. package/dist/{local-config-sync-BdsrDZOu.d.ts → local-config-sync-B8b04LrZ.d.ts} +45 -25
  48. package/dist/local-config.d.ts +2 -2
  49. package/dist/local-config.js +2 -2
  50. package/dist/{memory-connector-diagnostic-log-CrW1ltLM.js → memory-diagnostic-log-BZ1VD80X.js} +61 -99
  51. package/dist/{memory-token-prompter-B5FFCsGP.d.ts → memory-token-prompter-Lo3YRDzq.d.ts} +4 -4
  52. package/dist/{memory-token-prompter-CLerGsgM.js → memory-token-prompter-vBXxY20-.js} +2 -2
  53. package/dist/{profiles-f0mNmEyP.d.ts → profiles-EHTeCOqB.d.ts} +3 -2
  54. package/dist/profiles.d.ts +1 -1
  55. package/dist/profiles.js +1 -1
  56. package/dist/recovery.d.ts +2 -0
  57. package/dist/recovery.js +2 -0
  58. package/dist/{resolve-connector-token-BHmZLRrV.js → resolve-connector-token-CczqG_Ig.js} +1 -1
  59. package/dist/{schedule-connector-schema-iCI61gzU.js → schedule-connector-schema-B_xO5z5B.js} +1 -1
  60. package/dist/{schedule-listener-CUyUFFR1.d.ts → schedule-listener-DKh0hnkK.d.ts} +5 -5
  61. package/dist/{schedule-listener-ePAjians.js → schedule-listener-DP9Jhc6U.js} +14 -4
  62. package/dist/settings-reader-CBrgz01o.d.ts +18 -0
  63. package/dist/{settings-reader-BSU6JyvM.d.ts → settings-schema-zhnMIa8I.d.ts} +1 -16
  64. package/dist/{slack-connector-schema-BCNWluHM.js → slack-connector-schema-C1zEf4TG.js} +1 -1
  65. package/dist/{slack-listener-Bv5xI9gC.d.ts → slack-listener-COQA8wAZ.d.ts} +4 -4
  66. package/dist/{slack-listener-ClQuHhEF.js → slack-listener-DUKPcpJH.js} +7 -7
  67. package/dist/{mcp-Dr-nIBwN.js → yaml-render-OhUN-qkS.js} +52 -34
  68. package/package.json +21 -1
  69. package/dist/connector-adapter-DKgsVuMH.d.ts +0 -11
  70. /package/dist/{file-system-BeOKXjlV.d.ts → file-system-Wub9Nto4.d.ts} +0 -0
  71. /package/dist/{process-runner-DfniuWVU.d.ts → process-runner-D5I_jhYQ.d.ts} +0 -0
  72. /package/dist/{profiles-wMRnjSid.js → profiles-MnXvYfZF.js} +0 -0
@@ -1,18 +1,23 @@
1
- import { n as FunnelIdGenerator, s as Settings, t as FunnelSettingsReader } from "./settings-reader-BSU6JyvM.js";
2
- import { n as FunnelClaude, t as FileProcessGuard } from "./file-process-guard-BgrVHe9I.js";
3
- import { S as FunnelLogger, b as FunnelConnectorListener, c as ConnectorProcessedQuery, f as ConnectorRawQuery, g as StoredRawEvent, h as StoredProcessedEvent, i as ConnectorConnectionRecord, l as ConnectorProcessedRecord, m as StoredConnectionEvent, o as ConnectorDiagnosticLog, p as ConnectorRawRecord, r as ConnectorConnectionQuery } from "./connector-diagnostic-log-yTOojKUR.js";
4
- import { a as RunOptions, i as ProcessSnapshot, n as DetachOptions, o as RunResult, r as FunnelProcessRunner, t as AttachOptions } from "./process-runner-DfniuWVU.js";
5
- import { n as FunnelFileSystem, t as FileStat } from "./file-system-BeOKXjlV.js";
6
- import { t as FunnelProfiles } from "./profiles-f0mNmEyP.js";
7
- import { a as ChannelConnectorView, d as ConnectorConfig, i as FunnelTokenPrompter, l as ScheduleListenerOptions, m as FunnelLocalConfig, n as FunnelLocalConfigSync, o as FunnelChannels, s as FunnelClock, u as SlackListenerOptions } from "./local-config-sync-BdsrDZOu.js";
1
+ import { a as Settings } from "./settings-schema-zhnMIa8I.js";
2
+ import { n as FunnelClaude, t as FileProcessGuard } from "./file-process-guard-DI1742H5.js";
3
+ import { n as FunnelIdGenerator, t as FunnelSettingsReader } from "./settings-reader-CBrgz01o.js";
4
+ import { S as FunnelLogger, b as FunnelConnectorListener, c as ConnectorProcessedQuery, f as ConnectorRawQuery, g as StoredRawEvent, h as StoredProcessedEvent, i as ConnectorConnectionRecord, l as ConnectorProcessedRecord, m as StoredConnectionEvent, o as ConnectorDiagnosticLog, p as ConnectorRawRecord, r as ConnectorConnectionQuery } from "./diagnostic-log-Bxe7Bbvw.js";
5
+ import { a as RunOptions, i as ProcessSnapshot, n as DetachOptions, o as RunResult, r as FunnelProcessRunner, t as AttachOptions } from "./process-runner-D5I_jhYQ.js";
6
+ import { n as FunnelFileSystem, t as FileStat } from "./file-system-Wub9Nto4.js";
7
+ import { t as FunnelProfiles } from "./profiles-EHTeCOqB.js";
8
+ import { a as ChannelConnectorView, d as ConnectorConfig, i as FunnelTokenPrompter, l as ScheduleListenerOptions, m as FunnelLocalConfig, n as FunnelLocalConfigSync, o as FunnelChannels, s as FunnelClock, u as SlackListenerOptions } from "./local-config-sync-B8b04LrZ.js";
9
+ import { c as FunnelDiagnostics } from "./funnel-diagnostics-qWy5tPSq.js";
10
+ import { n as FunnelDocs } from "./funnel-docs-dXPokzr5.js";
11
+ import { t as FunnelRecovery } from "./funnel-recovery-BUBsu7WX.js";
12
+ import { r as FunnelDoctor } from "./funnel-doctor-BF3Rdgk0.js";
8
13
  import { hc } from "hono/client";
9
14
  import { z } from "zod";
10
15
  import * as _$hono_factory0 from "hono/factory";
11
- import { Server, ServerWebSocket } from "bun";
12
16
  import { Hono } from "hono";
17
+ import { Server, ServerWebSocket } from "bun";
13
18
  import * as _$hono_utils_http_status0 from "hono/utils/http-status";
14
- import * as _$hono_utils_types0 from "hono/utils/types";
15
19
  import * as _$hono_hono_base0 from "hono/hono-base";
20
+ import * as _$hono_utils_types0 from "hono/utils/types";
16
21
 
17
22
  //#region lib/engine/error/on-funnel-error.d.ts
18
23
  /**
@@ -58,7 +63,7 @@ type BroadcastSubscriber = (event: ReplayableEvent) => void;
58
63
  type ReplaySource = {
59
64
  loadSince(since: number): ReplayableEvent[];
60
65
  };
61
- type Deps$7 = {
66
+ type Deps$8 = {
62
67
  logger?: FunnelLogger; /** Host hook for surfacing subscriber-throw exceptions. Defaults to no-op. */
63
68
  onError?: OnFunnelError;
64
69
  maxBufferedBytes?: number;
@@ -110,7 +115,7 @@ declare class FunnelBroadcaster {
110
115
  private droppedSlowClients;
111
116
  private lastBroadcastAt;
112
117
  private latestOffset;
113
- constructor(deps?: Deps$7);
118
+ constructor(deps?: Deps$8);
114
119
  getMetrics(): BroadcasterMetrics;
115
120
  /**
116
121
  * Returns events with offset > since, filtered by the connector subscription
@@ -158,7 +163,7 @@ type ConnectorRegistry = {
158
163
  } | null;
159
164
  };
160
165
  type SupervisorNotify = (channelName: string, connectorName: string, content: string, meta?: Record<string, string>) => Promise<void>;
161
- type Deps$6 = {
166
+ type Deps$7 = {
162
167
  channels: ConnectorRegistry;
163
168
  notify: SupervisorNotify;
164
169
  logger?: FunnelLogger; /** Host hook for surfacing listener lifecycle exceptions. Defaults to no-op. */
@@ -205,7 +210,7 @@ declare class FunnelListenerSupervisor {
205
210
  private readonly now;
206
211
  private healthCheckTimer;
207
212
  private healthCheckInFlight;
208
- constructor(deps: Deps$6);
213
+ constructor(deps: Deps$7);
209
214
  static keyOf(channelName: string, connectorName: string): string;
210
215
  isRunning(channelName: string, connectorName: string): boolean;
211
216
  list(): ListenerEntryStatus[];
@@ -257,7 +262,7 @@ type Env$1 = {
257
262
  };
258
263
  };
259
264
  //#endregion
260
- //#region lib/gateway/funnel-event-log.d.ts
265
+ //#region lib/gateway/event-log/event-log.d.ts
261
266
  /**
262
267
  * Replayable event payload persisted by the gateway. Domain events the
263
268
  * broadcaster emits to WS clients land here so reconnects across daemon
@@ -306,12 +311,26 @@ declare abstract class FunnelEventLog {
306
311
  }
307
312
  //#endregion
308
313
  //#region lib/gateway/gateway-server.d.ts
309
- type Deps$5 = {
314
+ /**
315
+ * Where the gateway's durable replay log lives. The two ways to specify it are
316
+ * mutually exclusive — modeled as a union so you can't pass both (the old shape
317
+ * silently ignored `dbPath` when `eventLog` was also given).
318
+ *
319
+ * - omit both → SQLite at the default path (`<os.tmpdir()>/funnel/events.db`)
320
+ * - `dbPath` → SQLite at a custom path (parent dir created on demand)
321
+ * - `eventLog` → bring your own `FunnelEventLog` (e.g. `MemoryFunnelEventLog`)
322
+ */
323
+ type GatewayEventStore = {
324
+ dbPath?: string;
325
+ eventLog?: undefined;
326
+ } | {
327
+ dbPath?: undefined;
328
+ eventLog: FunnelEventLog;
329
+ };
330
+ type Deps$6 = GatewayEventStore & {
310
331
  channels: FunnelChannels;
311
332
  port?: number; /** Bind address for `Bun.serve`. Defaults to `127.0.0.1` (loopback only). Set to `0.0.0.0` to expose on the network. */
312
- hostname?: string; /** SQLite event store file path. Parent directory is created on demand. Defaults to `<os.tmpdir()>/funnel/events.db`. Ignored when `eventLog` is supplied. */
313
- dbPath?: string; /** Durable replay log. Defaults to a `SqliteFunnelEventLog` at `dbPath`. Inject a `MemoryFunnelEventLog` (or any `FunnelEventLog`) to swap or disable persistence. */
314
- eventLog?: FunnelEventLog;
333
+ hostname?: string;
315
334
  process?: FunnelProcessRunner;
316
335
  clock?: FunnelClock;
317
336
  logger?: FunnelLogger; /** Host hook for surfacing internal exceptions (broadcaster / supervisor). Defaults to no-op. */
@@ -320,6 +339,13 @@ type Deps$5 = {
320
339
  dir?: string;
321
340
  killCompetingSlack?: boolean; /** Bearer token required for `/listeners*`, `/status`, and `/ws`. Empty string disables auth (tests only). */
322
341
  token?: string;
342
+ /**
343
+ * Permit binding a non-loopback hostname without a token. Off by default:
344
+ * `start()` throws when `hostname` is reachable off-box and `token` is empty,
345
+ * because every privileged endpoint would then be open to the network. Set
346
+ * this only when you've deliberately fronted the gateway with your own auth.
347
+ */
348
+ allowInsecureHost?: boolean;
323
349
  /**
324
350
  * Additional hono app mounted before the built-in gateway routes.
325
351
  * Use to embed host-specific endpoints (e.g. an MCP route, custom `/api/*`).
@@ -358,6 +384,7 @@ declare class FunnelGatewayServer {
358
384
  private readonly dir;
359
385
  private readonly killCompetingSlack;
360
386
  private readonly token;
387
+ private readonly allowInsecureHost;
361
388
  private readonly broadcaster;
362
389
  private readonly eventLog;
363
390
  private readonly supervisor;
@@ -365,7 +392,7 @@ declare class FunnelGatewayServer {
365
392
  private readonly extraRoutes;
366
393
  private startedAt;
367
394
  private server;
368
- constructor(deps: Deps$5);
395
+ constructor(deps: Deps$6);
369
396
  start(): Promise<Server<WsData>>;
370
397
  stop(): Promise<void>;
371
398
  getStatus(): {
@@ -419,8 +446,53 @@ declare class FunnelGatewayServer {
419
446
  private lookupConnectorId;
420
447
  }
421
448
  //#endregion
449
+ //#region lib/gateway/channel-ws-url.d.ts
450
+ /**
451
+ * Builds the WebSocket URL a client uses to subscribe to a gateway channel.
452
+ *
453
+ * The gateway's `/ws` upgrade handler reads three query params — `channel`
454
+ * (required), `id` (the subscriber id for targeted delivery), and `since`
455
+ * (replay offset). Forgetting `channel=` silently drops the subscription
456
+ * (the broadcaster never matches the client), which has caused outages when
457
+ * callers hand-built the URL with string concatenation. This builder makes
458
+ * `channel` a required field, so the mistake becomes a compile error.
459
+ *
460
+ * `subscriberId` enables targeted delivery: events carrying `meta.target=<id>`
461
+ * reach only this client. Omit it to receive the channel's fanout.
462
+ *
463
+ * Pair with `channelWsProtocols()` to authenticate the upgrade when the
464
+ * gateway requires a token.
465
+ */
466
+ type ChannelWsUrlInput = {
467
+ /** Base WS endpoint, e.g. `ws://localhost:9743/ws`. Existing query is preserved. */base: string; /** Channel name to subscribe to. Required — the broadcaster filters by it. */
468
+ channel: string; /** Opaque subscriber id for targeted delivery (`meta.target=<id>`). Omit for fanout. */
469
+ subscriberId?: string; /** Replay from this event offset (inclusive). Omit to receive only new events. */
470
+ since?: number;
471
+ };
472
+ declare function channelWsUrl(input: ChannelWsUrlInput): string;
473
+ /**
474
+ * Builds the `Sec-WebSocket-Protocol` values that authenticate a gateway WS
475
+ * upgrade. Browser `WebSocket` cannot set an `Authorization` header, so the
476
+ * gateway also accepts the token as a `funnel.token.<token>` subprotocol.
477
+ * Returns an empty array when no token is given (auth disabled / loopback).
478
+ *
479
+ * Usage: `new WebSocket(channelWsUrl({ base, channel }), channelWsProtocols(token))`
480
+ */
481
+ declare function channelWsProtocols(token?: string | null): string[];
482
+ //#endregion
483
+ //#region lib/gateway/gateway-base-url.d.ts
484
+ /**
485
+ * The HTTP base URL of a gateway daemon on the loopback interface. The daemon
486
+ * always binds 127.0.0.1 for its management API (only the WS `/ws` endpoint is
487
+ * ever exposed off-box), so every in-process HTTP client — publisher, listeners
488
+ * client, MCP channel server — talks to it here. Centralizing the construction
489
+ * keeps the host/port shape in one place instead of re-spelling
490
+ * `http://127.0.0.1:${port}` at each call site.
491
+ */
492
+ declare function gatewayLoopbackUrl(port: number): string;
493
+ //#endregion
422
494
  //#region lib/gateway/gateway-token.d.ts
423
- type Deps$4 = {
495
+ type Deps$5 = {
424
496
  fs?: FunnelFileSystem;
425
497
  dir?: string;
426
498
  generate?: () => string;
@@ -437,7 +509,7 @@ declare class FunnelGatewayToken {
437
509
  private readonly fs;
438
510
  private readonly path;
439
511
  private readonly generate;
440
- constructor(deps?: Deps$4);
512
+ constructor(deps?: Deps$5);
441
513
  read(): string | null;
442
514
  /**
443
515
  * Returns the existing token or, if missing, generates one and writes it with mode 0600.
@@ -482,7 +554,7 @@ type PublishResult = {
482
554
  };
483
555
  //#endregion
484
556
  //#region lib/gateway/channel-publisher.d.ts
485
- type Deps$3 = {
557
+ type Deps$4 = {
486
558
  port: number;
487
559
  isDaemonRunning: () => boolean; /** Returns the daemon's gateway token, or null if unavailable. Sent as `Authorization: Bearer`. */
488
560
  getToken?: () => string | null;
@@ -496,15 +568,16 @@ declare class FunnelChannelPublisher {
496
568
  private readonly port;
497
569
  private readonly isDaemonRunning;
498
570
  private readonly getToken;
499
- constructor(deps: Deps$3);
571
+ constructor(deps: Deps$4);
500
572
  publish(channelName: string, request: PublishRequest): Promise<PublishResult>;
501
573
  private authHeaders;
502
574
  }
503
575
  //#endregion
504
- //#region lib/gateway/sqlite-funnel-event-log.d.ts
505
- type Props$7 = {
576
+ //#region lib/gateway/event-log/sqlite-event-log.d.ts
577
+ type Props$6 = {
506
578
  /** SQLite database file path. Created on first write. ":memory:" for tests. */path: string; /** Override for tests. Defaults to `Date.now`. */
507
- now?: () => number; /** Optional row cap. Pruned on every insert. */
579
+ now?: () => number; /** Surfaces a failed persist (PK collision, disk-full, locked WAL). Silent if absent. */
580
+ logger?: FunnelLogger; /** Optional row cap. Pruned on every insert. */
508
581
  maxRows?: number; /** Optional age cap in ms. Pruned on every insert. */
509
582
  maxAgeMs?: number; /** Optional on-disk byte cap. Checked periodically; on overflow the oldest rows are dropped toward targetBytes and the file is VACUUMed. */
510
583
  maxBytes?: number; /** Shrink target when maxBytes is exceeded. Defaults to maxBytes/4. */
@@ -530,7 +603,8 @@ type Props$7 = {
530
603
  declare class SqliteFunnelEventLog extends FunnelEventLog {
531
604
  private readonly sink;
532
605
  private readonly now;
533
- constructor(props: Props$7);
606
+ private readonly logger;
607
+ constructor(props: Props$6);
534
608
  /**
535
609
  * Persist a broadcaster-driven event with its assigned offset. Caller
536
610
  * (the gateway-server) supplies the offset from `broadcaster.broadcast()`
@@ -559,7 +633,7 @@ declare class SqliteFunnelEventLog extends FunnelEventLog {
559
633
  close(): void;
560
634
  }
561
635
  //#endregion
562
- //#region lib/gateway/memory-funnel-event-log.d.ts
636
+ //#region lib/gateway/event-log/memory-event-log.d.ts
563
637
  /**
564
638
  * In-process `FunnelEventLog` backed by a plain array. Used by tests and by
565
639
  * embedders that do not need durability — replay works within the process
@@ -577,8 +651,8 @@ declare class MemoryFunnelEventLog extends FunnelEventLog {
577
651
  close(): void;
578
652
  }
579
653
  //#endregion
580
- //#region lib/gateway/sqlite-connector-diagnostic-log.d.ts
581
- type Props$6 = {
654
+ //#region lib/gateway/diagnostic-log/sqlite-diagnostic-log.d.ts
655
+ type Props$5 = {
582
656
  /** SQLite file for the raw (pre-filter) table. ":memory:" for tests. */rawPath: string; /** SQLite file for the processed (verdict) table. ":memory:" for tests. */
583
657
  processedPath: string; /** SQLite file for the connection (lifecycle) table. ":memory:" for tests. */
584
658
  connectionPath: string;
@@ -613,7 +687,7 @@ declare class SqliteConnectorDiagnosticLog extends ConnectorDiagnosticLog {
613
687
  private readonly connection;
614
688
  private readonly now;
615
689
  private readonly logger;
616
- constructor(props: Props$6);
690
+ constructor(props: Props$5);
617
691
  recordRaw(record: ConnectorRawRecord): void;
618
692
  recordProcessed(record: ConnectorProcessedRecord): void;
619
693
  recordConnection(record: ConnectorConnectionRecord): void;
@@ -625,7 +699,7 @@ declare class SqliteConnectorDiagnosticLog extends ConnectorDiagnosticLog {
625
699
  close(): void;
626
700
  }
627
701
  //#endregion
628
- //#region lib/gateway/memory-connector-diagnostic-log.d.ts
702
+ //#region lib/gateway/diagnostic-log/memory-diagnostic-log.d.ts
629
703
  /**
630
704
  * In-process `ConnectorDiagnosticLog` backed by one array per table. Used by tests
631
705
  * and embedders that do not need durability. Like the SQLite log it keeps
@@ -653,7 +727,7 @@ declare class MemoryConnectorDiagnosticLog extends ConnectorDiagnosticLog {
653
727
  }
654
728
  //#endregion
655
729
  //#region lib/gateway/gateway.d.ts
656
- type Deps$2 = {
730
+ type Deps$3 = {
657
731
  process?: FunnelProcessRunner;
658
732
  fs?: FunnelFileSystem;
659
733
  clock?: FunnelClock;
@@ -677,7 +751,7 @@ declare class FunnelGateway {
677
751
  private readonly tmpDir;
678
752
  private readonly port;
679
753
  private readonly sleep;
680
- constructor(deps?: Deps$2);
754
+ constructor(deps?: Deps$3);
681
755
  isRunning(): boolean;
682
756
  getStatus(): {
683
757
  running: boolean;
@@ -708,7 +782,7 @@ declare class FunnelGateway {
708
782
  }
709
783
  //#endregion
710
784
  //#region lib/gateway/listeners-client.d.ts
711
- type Deps$1 = {
785
+ type Deps$2 = {
712
786
  port: number;
713
787
  isDaemonRunning: () => boolean; /** Returns the daemon's gateway token, or null if unavailable. Sent as `Authorization: Bearer`. */
714
788
  getToken?: () => string | null;
@@ -749,7 +823,7 @@ declare class FunnelListenersClient {
749
823
  private readonly port;
750
824
  private readonly isDaemonRunning;
751
825
  private readonly getToken;
752
- constructor(deps: Deps$1);
826
+ constructor(deps: Deps$2);
753
827
  list(): Promise<ListListenersResult>;
754
828
  start(channelName: string, connectorName: string): Promise<ListenerOpResult>;
755
829
  stop(channelName: string, connectorName: string): Promise<ListenerOpResult>;
@@ -759,36 +833,8 @@ declare class FunnelListenersClient {
759
833
  private call;
760
834
  }
761
835
  //#endregion
762
- //#region lib/gateway/funnel-debug.d.ts
763
- type FunnelDebugReport = {
764
- gateway: {
765
- running: boolean;
766
- pid: number | null;
767
- port: number | null;
768
- uptimeMs: number | null;
769
- };
770
- channels: Array<{
771
- name: string;
772
- connectors: string[];
773
- listener: {
774
- alive: boolean;
775
- events: number;
776
- errors: number;
777
- lastEventAt: string | null;
778
- } | null;
779
- claudeConnected: boolean;
780
- claudeClientCount: number;
781
- }>;
782
- recentEvents: Array<{
783
- ts: number;
784
- outcome: string;
785
- payload: string | null;
786
- preview: string | null;
787
- }> | null;
788
- };
789
- //#endregion
790
836
  //#region lib/funnel.d.ts
791
- type Props$5 = {
837
+ type Props$4 = {
792
838
  /** Settings persistence (channels with nested connectors / profiles). Defaults to a FunnelSettingsStore rooted at `dir`. */store?: FunnelSettingsReader; /** Filesystem boundary. Replace with MemoryFunnelFileSystem to sandbox all disk I/O. */
793
839
  fs?: FunnelFileSystem; /** Process runner used by gateway / claude / gh listener. Replace with MemoryFunnelProcessRunner for tests. */
794
840
  process?: FunnelProcessRunner; /** Logger flowed into every facet. Replace with MemoryFunnelLogger or NoopFunnelLogger to silence/inspect. */
@@ -832,6 +878,18 @@ type Props$5 = {
832
878
  */
833
879
  tokenPrompter?: FunnelTokenPrompter;
834
880
  };
881
+ /**
882
+ * Options for `Funnel.gatewayServer()`. The event store is a union (`dbPath`
883
+ * xor `eventLog`) so the two storage modes can't be mixed.
884
+ */
885
+ type GatewayServerOptions = GatewayEventStore & {
886
+ port?: number;
887
+ hostname?: string;
888
+ killCompetingSlack?: boolean;
889
+ token?: string; /** Permit a non-loopback `hostname` without a token. See FunnelGatewayServer. */
890
+ allowInsecureHost?: boolean;
891
+ extraRoutes?: Hono<Env$1>;
892
+ };
835
893
  /**
836
894
  * Facade that wires every funnel facet together and exposes the public surface.
837
895
  *
@@ -865,32 +923,28 @@ declare class Funnel {
865
923
  readonly profiles: FunnelProfiles;
866
924
  readonly localConfig: FunnelLocalConfig;
867
925
  readonly localConfigSync: FunnelLocalConfigSync;
926
+ readonly diagnostics: FunnelDiagnostics;
927
+ readonly recovery: FunnelRecovery;
928
+ readonly doctor: FunnelDoctor;
929
+ readonly docs: FunnelDocs;
868
930
  private readonly fs;
869
931
  private readonly process;
870
932
  private readonly logger;
871
933
  private readonly clock;
872
934
  private readonly onError;
873
- constructor(props?: Props$5);
935
+ constructor(props?: Props$4);
874
936
  /**
875
937
  * Sandboxed Funnel wired with in-memory implementations for every IO boundary.
876
938
  * Touches no real disk, processes, wall-clock time, or UUIDs — safe for tests
877
939
  * and ad-hoc experiments. Override individual fields by passing them in `props`.
878
940
  */
879
- static inMemory(props?: Props$5): Funnel;
941
+ static inMemory(props?: Props$4): Funnel;
880
942
  /**
881
943
  * In-process gateway server. Unlike `gateway.start()` (which spawns a daemon),
882
944
  * this returns a class that runs `Bun.serve` + listeners inside the current process —
883
945
  * useful for tests, embedding, or custom hosts.
884
946
  */
885
- gatewayServer(options?: {
886
- port?: number;
887
- hostname?: string;
888
- dbPath?: string;
889
- killCompetingSlack?: boolean;
890
- token?: string;
891
- eventLog?: FunnelEventLog;
892
- extraRoutes?: Hono<Env$1>;
893
- }): FunnelGatewayServer;
947
+ gatewayServer(options?: GatewayServerOptions): FunnelGatewayServer;
894
948
  /**
895
949
  * Create a ProcessGuard scoped to this Funnel's home directory.
896
950
  * Useful for hosts that need to check or manage singleton PID files
@@ -904,7 +958,6 @@ declare class Funnel {
904
958
  runGatewayForeground(options?: {
905
959
  caffeinate?: boolean;
906
960
  }): Promise<number>;
907
- debug(channelName?: string): Promise<FunnelDebugReport>;
908
961
  gatewayClient(): ReturnType<typeof hc<GatewayApp>>;
909
962
  }
910
963
  //#endregion
@@ -928,7 +981,7 @@ declare const DEFAULT_GATEWAY_PORT = 9742;
928
981
  declare function resolveFunnelPort(): number;
929
982
  declare const FUNNEL_DIR: string;
930
983
  declare const SETTINGS_PATH: string;
931
- type Deps = {
984
+ type Deps$1 = {
932
985
  path?: string;
933
986
  fs?: FunnelFileSystem;
934
987
  idGenerator?: FunnelIdGenerator;
@@ -937,7 +990,7 @@ declare class FunnelSettingsStore extends FunnelSettingsReader {
937
990
  private readonly path;
938
991
  private readonly fs;
939
992
  private readonly idGenerator;
940
- constructor(deps?: Deps);
993
+ constructor(deps?: Deps$1);
941
994
  read(): Settings;
942
995
  private looksLikeLegacy;
943
996
  /**
@@ -977,7 +1030,7 @@ declare class NodeFunnelFileSystem extends FunnelFileSystem {
977
1030
  }
978
1031
  //#endregion
979
1032
  //#region lib/engine/fs/memory-file-system.d.ts
980
- type Props$4 = {
1033
+ type Props$3 = {
981
1034
  dirs?: string[];
982
1035
  files?: Record<string, string>;
983
1036
  mtimes?: Record<string, number>;
@@ -990,7 +1043,7 @@ declare class MemoryFunnelFileSystem extends FunnelFileSystem {
990
1043
  private readonly mtimes;
991
1044
  private readonly modes;
992
1045
  private readonly now;
993
- constructor(props?: Props$4);
1046
+ constructor(props?: Props$3);
994
1047
  existsSync(path: string): boolean;
995
1048
  readFileSync(path: string): string;
996
1049
  writeFileSync(path: string, data: string): void;
@@ -1076,14 +1129,14 @@ declare class MemoryFunnelProcessRunner extends FunnelProcessRunner {
1076
1129
  }
1077
1130
  //#endregion
1078
1131
  //#region lib/engine/logger/node-logger.d.ts
1079
- type Props$3 = {
1132
+ type Props$2 = {
1080
1133
  file?: string;
1081
1134
  now?: () => Date;
1082
1135
  };
1083
1136
  declare class NodeFunnelLogger extends FunnelLogger {
1084
1137
  readonly file: string;
1085
1138
  private readonly now;
1086
- constructor(props?: Props$3);
1139
+ constructor(props?: Props$2);
1087
1140
  info(message: string, meta?: Record<string, unknown>): void;
1088
1141
  warn(message: string, meta?: Record<string, unknown>): void;
1089
1142
  error(message: string, meta?: Record<string, unknown>): void;
@@ -1119,12 +1172,12 @@ declare class NodeFunnelClock extends FunnelClock {
1119
1172
  }
1120
1173
  //#endregion
1121
1174
  //#region lib/engine/time/memory-clock.d.ts
1122
- type Props$2 = {
1175
+ type Props$1 = {
1123
1176
  start?: Date;
1124
1177
  };
1125
1178
  declare class MemoryFunnelClock extends FunnelClock {
1126
1179
  private current;
1127
- constructor(props?: Props$2);
1180
+ constructor(props?: Props$1);
1128
1181
  now(): Date;
1129
1182
  set(date: Date): void;
1130
1183
  advance(ms: number): void;
@@ -1136,48 +1189,31 @@ declare class NodeFunnelIdGenerator extends FunnelIdGenerator {
1136
1189
  }
1137
1190
  //#endregion
1138
1191
  //#region lib/engine/id/memory-id-generator.d.ts
1139
- type Props$1 = {
1192
+ type Props = {
1140
1193
  prefix?: string;
1141
1194
  };
1142
1195
  declare class MemoryFunnelIdGenerator extends FunnelIdGenerator {
1143
1196
  private counter;
1144
1197
  private readonly prefix;
1145
- constructor(props?: Props$1);
1198
+ constructor(props?: Props);
1146
1199
  generate(): string;
1147
1200
  }
1148
1201
  //#endregion
1149
- //#region lib/gateway/connector-diagnostic-sql-reader.d.ts
1150
- type Props = {
1151
- /** SQLite file holding the raw (pre-filter) table. */rawPath: string; /** SQLite file holding the processed (verdict) table. */
1152
- processedPath: string; /** SQLite file holding the connection (lifecycle) table. */
1153
- connectionPath: string;
1202
+ //#region lib/gateway/service-routes.d.ts
1203
+ type Deps = {
1204
+ diagnostics: FunnelDiagnostics;
1205
+ doctor: FunnelDoctor; /** Bearer token to gate every endpoint. Empty string disables auth (tests only). */
1206
+ token: string;
1154
1207
  };
1155
- type Row = Record<string, unknown>;
1156
1208
  /**
1157
- * Read-only SQL surface over the three diagnostic tables, for Claude to query
1158
- * the log with arbitrary `SELECT`s. It opens all files read-only and exposes
1159
- * three views `raw`, `processed`, `connection` that hide the storage
1160
- * details (the physical table is `leuco_log` and each row's columns live
1161
- * inside a JSON `event` blob): the views surface the columns as plain fields,
1162
- * with `payload` already pulled out of the nested JSON.
1163
- *
1164
- * The tables are separate files. `raw` and `processed` share an `event_id`,
1165
- * so a `JOIN` answers "the event arrived, but what verdict did it get?";
1166
- * `connection` answers the other half — "did the listener ever connect at
1167
- * all?". Writes are impossible: the connection is read-only and `query`
1168
- * rejects anything but a single `SELECT`.
1209
+ * Mountable Hono app that exposes the service layer (`FunnelDiagnostics` +
1210
+ * `FunnelDoctor`) over loopback HTTP. The MCP server, which lives in a
1211
+ * different process, calls these endpoints to drive the autonomous
1212
+ * troubleshooting loop. The CLI bypasses HTTP and calls the same services
1213
+ * directly through the in-process funnel facade, so CLI and MCP share one
1214
+ * code path.
1169
1215
  */
1170
- declare class ConnectorDiagnosticSqlReader {
1171
- private readonly db;
1172
- constructor(props: Props);
1173
- /**
1174
- * Run one read-only `SELECT` and return the rows. Returns an `Error` (rather
1175
- * than throwing) for a non-SELECT statement or a SQL error, so the caller
1176
- * can surface the message without a stack trace.
1177
- */
1178
- query(sql: string, params?: (string | number | null)[]): Row[] | Error;
1179
- close(): void;
1180
- }
1216
+ declare const buildServiceRoutes: (deps: Deps) => Hono<Env$1>;
1181
1217
  //#endregion
1182
1218
  //#region lib/cli/factory.d.ts
1183
1219
  type Env = {
@@ -1223,7 +1259,7 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1223
1259
  channel?: string | undefined;
1224
1260
  };
1225
1261
  };
1226
- output: "funnel claude — launch Claude Code\n\nusage:\n funnel claude launch the first channel from funnel.json, or the default profile\n funnel claude --channel <name> with funnel.json: select that channel; without: raw launch\n funnel claude -p <name> launch a named profile\n funnel claude --profile <name> (long form)\n funnel claude [...] any other argument is forwarded to the claude CLI\n\nresolution order:\n 1. --help print this help\n 2. --profile <name> named profile (ignores funnel.json)\n 3. ./funnel.json in the current directory + --channel selects (or first wins)\n 4. --channel <name> with no funnel.json → raw launch using an existing settings.json channel\n 5. the default profile (first entry in fnl profiles)\n\nfunnel-specific options (everything else passes through to claude verbatim):\n -p, --profile profile name to launch\n --channel channel name (selects from funnel.json, or raw-launches if no funnel.json)\n -h, --help show this help\n\nPositional args, unknown short flags (e.g. -c, -r), and claude's own flags\n(--agent, --resume, --model, --print, --output-format ...) are all forwarded.\nOn launch the FUNNEL_CHANNEL_ID env var is set and MCP connects to the gateway.";
1262
+ output: "funnel claude — launch Claude Code\n\nusage:\n funnel claude launch the first channel from funnel.json, or the default profile\n funnel claude --channel <name> with funnel.json: select that channel; without: raw launch\n funnel claude -p <name> launch a named profile\n funnel claude --profile <name> (long form)\n funnel claude [...] any other argument is forwarded to the claude CLI\n\nresolution order:\n 1. --help print this help\n 2. --profile <name> named profile (ignores funnel.json)\n 3. ./funnel.json in the current directory + --channel selects (or first wins)\n 4. --channel <name> with no funnel.json → raw launch using an existing settings.json channel\n 5. the default profile (first entry in fnl profiles)\n\nfunnel-specific options (everything else passes through to claude verbatim):\n -p, --profile profile name to launch\n --channel channel name (selects from funnel.json, or raw-launches if no funnel.json)\n -h, --help show this help\n\nPositional args, unknown short flags (e.g. -c, -r), and claude's own flags\n(--agent, --resume, --model, --print, --output-format ...) are all forwarded.\nOn launch the FUNNEL_CHANNEL_ID env var is set and MCP connects to the gateway.\n\nsee also:\n fnl docs claude full resolution order, side effects, double-launch guard\n fnl docs mcp what the MCP server exposes once Claude is up\n fnl docs debugging the diagnose → recover → verify loop\n\nprogrammable: funnel.claude.launch({ profileId | channelId, options, env, resume })";
1227
1263
  outputFormat: "text";
1228
1264
  status: _$hono_utils_http_status0.ContentfulStatusCode;
1229
1265
  };
@@ -1232,31 +1268,11 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1232
1268
  "/channels": {
1233
1269
  $get: {
1234
1270
  input: {
1235
- query: {
1236
- json?: "" | "true" | "false" | undefined;
1237
- };
1271
+ query: Record<string, never>;
1238
1272
  };
1239
1273
  output: string;
1240
1274
  outputFormat: "text";
1241
1275
  status: _$hono_utils_http_status0.ContentfulStatusCode;
1242
- } | {
1243
- input: {
1244
- query: {
1245
- json?: "" | "true" | "false" | undefined;
1246
- };
1247
- };
1248
- output: {
1249
- id: string;
1250
- name: string;
1251
- delivery: "fanout" | "exclusive";
1252
- connectors: {
1253
- id: string;
1254
- name: string;
1255
- type: "schedule" | "slack" | "discord" | "gh";
1256
- }[];
1257
- }[];
1258
- outputFormat: "json";
1259
- status: _$hono_utils_http_status0.ContentfulStatusCode;
1260
1276
  };
1261
1277
  };
1262
1278
  } & {
@@ -1486,34 +1502,11 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1486
1502
  channel: string;
1487
1503
  };
1488
1504
  } & {
1489
- query: {
1490
- json?: "" | "true" | "false" | undefined;
1491
- };
1505
+ query: Record<string, never>;
1492
1506
  };
1493
1507
  output: string;
1494
1508
  outputFormat: "text";
1495
1509
  status: _$hono_utils_http_status0.ContentfulStatusCode;
1496
- } | {
1497
- input: {
1498
- param: {
1499
- channel: string;
1500
- };
1501
- } & {
1502
- query: {
1503
- json?: "" | "true" | "false" | undefined;
1504
- };
1505
- };
1506
- output: {
1507
- channel: string;
1508
- valid: boolean;
1509
- issues: {
1510
- connector: string;
1511
- field: string;
1512
- message: string;
1513
- }[];
1514
- };
1515
- outputFormat: "json";
1516
- status: _$hono_utils_http_status0.ContentfulStatusCode;
1517
1510
  };
1518
1511
  };
1519
1512
  } & {
@@ -1884,6 +1877,7 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1884
1877
  query: {
1885
1878
  [x: string]: string | string[];
1886
1879
  method: string | string[];
1880
+ path?: string | undefined;
1887
1881
  };
1888
1882
  };
1889
1883
  output: string;
@@ -1949,9 +1943,9 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1949
1943
  };
1950
1944
  } & {
1951
1945
  query: {
1952
- cron: string | string[];
1953
- prompt: string | string[];
1954
- enabled?: string | string[] | undefined;
1946
+ cron: string;
1947
+ prompt: string;
1948
+ enabled?: "true" | "false" | undefined;
1955
1949
  "catchup-policy"?: "latest" | "all" | "skip" | undefined;
1956
1950
  };
1957
1951
  };
@@ -1967,9 +1961,9 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1967
1961
  };
1968
1962
  } & {
1969
1963
  query: {
1970
- cron: string | string[];
1971
- prompt: string | string[];
1972
- enabled?: string | string[] | undefined;
1964
+ cron: string;
1965
+ prompt: string;
1966
+ enabled?: "true" | "false" | undefined;
1973
1967
  "catchup-policy"?: "latest" | "all" | "skip" | undefined;
1974
1968
  };
1975
1969
  };
@@ -2348,25 +2342,11 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
2348
2342
  "/gateway/status": {
2349
2343
  $get: {
2350
2344
  input: {
2351
- query: {
2352
- json?: "" | "true" | "false" | undefined;
2353
- };
2345
+ query: Record<string, never>;
2354
2346
  };
2355
2347
  output: string;
2356
2348
  outputFormat: "text";
2357
2349
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2358
- } | {
2359
- input: {
2360
- query: {
2361
- json?: "" | "true" | "false" | undefined;
2362
- };
2363
- };
2364
- output: {
2365
- running: true;
2366
- port: number;
2367
- };
2368
- outputFormat: "json";
2369
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2370
2350
  };
2371
2351
  };
2372
2352
  } & {
@@ -2509,21 +2489,6 @@ declare const routes: _$hono_hono_base0.HonoBase<Env, {
2509
2489
  output: string;
2510
2490
  outputFormat: "text";
2511
2491
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2512
- } | {
2513
- input: {
2514
- query: Record<string, never>;
2515
- };
2516
- output: "funnel gateway: no running listeners";
2517
- outputFormat: "text";
2518
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2519
- } | {
2520
- input: {
2521
- query: Record<string, never>;
2522
- };
2523
- output: `funnel gateway: running listeners
2524
- ${string}`;
2525
- outputFormat: "text";
2526
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2527
2492
  };
2528
2493
  };
2529
2494
  } & {
@@ -2533,180 +2498,12 @@ ${string}`;
2533
2498
  query: {
2534
2499
  channel?: string | undefined;
2535
2500
  all?: "" | "true" | "false" | undefined;
2536
- json?: "" | "true" | "false" | undefined;
2537
2501
  limit?: string | undefined;
2538
2502
  };
2539
2503
  };
2540
2504
  output: string;
2541
2505
  outputFormat: "text";
2542
2506
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2543
- } | {
2544
- input: {
2545
- query: {
2546
- channel?: string | undefined;
2547
- all?: "" | "true" | "false" | undefined;
2548
- json?: "" | "true" | "false" | undefined;
2549
- limit?: string | undefined;
2550
- };
2551
- };
2552
- output: {
2553
- error: string;
2554
- nextAction: string;
2555
- };
2556
- outputFormat: "json";
2557
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2558
- } | {
2559
- input: {
2560
- query: {
2561
- channel?: string | undefined;
2562
- all?: "" | "true" | "false" | undefined;
2563
- json?: "" | "true" | "false" | undefined;
2564
- limit?: string | undefined;
2565
- };
2566
- };
2567
- output: {
2568
- summary: {
2569
- total: number;
2570
- ok: number;
2571
- warn: number;
2572
- error: number;
2573
- criticalChannels: string[];
2574
- warnChannels: string[];
2575
- suggestedActions: string[];
2576
- };
2577
- channels: {
2578
- channel: string;
2579
- gateway: {
2580
- running: boolean;
2581
- pid: number | null;
2582
- port: number | null;
2583
- uptimeMs: number | null;
2584
- };
2585
- listeners: {
2586
- name: string;
2587
- type: string;
2588
- alive: boolean;
2589
- events: number;
2590
- errors: number;
2591
- lastEventAt: string | null;
2592
- }[];
2593
- claudeClients: number;
2594
- channelId: string;
2595
- recentEvents: {
2596
- seq: number | null;
2597
- ts: number | null;
2598
- type: string;
2599
- outcome: string;
2600
- eventId: string | null;
2601
- payload: string | null;
2602
- payloadParsed: {
2603
- [x: string]: _$hono_utils_types0.JSONValue;
2604
- } | null;
2605
- preview: string | null;
2606
- }[];
2607
- connectionErrors: {
2608
- seq: number | null;
2609
- ts: number | null;
2610
- type: string;
2611
- status: string;
2612
- detail: string | null;
2613
- }[];
2614
- diagnosis: {
2615
- status: "ok" | "warn" | "error";
2616
- message: string;
2617
- nextActions: string[];
2618
- rootCause: string | null;
2619
- };
2620
- }[];
2621
- };
2622
- outputFormat: "json";
2623
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2624
- } | {
2625
- input: {
2626
- query: {
2627
- channel?: string | undefined;
2628
- all?: "" | "true" | "false" | undefined;
2629
- json?: "" | "true" | "false" | undefined;
2630
- limit?: string | undefined;
2631
- };
2632
- };
2633
- output: {
2634
- error: string;
2635
- availableChannels: string[];
2636
- };
2637
- outputFormat: "json";
2638
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2639
- } | {
2640
- input: {
2641
- query: {
2642
- channel?: string | undefined;
2643
- all?: "" | "true" | "false" | undefined;
2644
- json?: "" | "true" | "false" | undefined;
2645
- limit?: string | undefined;
2646
- };
2647
- };
2648
- output: {
2649
- error: string;
2650
- channels: string[];
2651
- hint: string;
2652
- };
2653
- outputFormat: "json";
2654
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2655
- } | {
2656
- input: {
2657
- query: {
2658
- channel?: string | undefined;
2659
- all?: "" | "true" | "false" | undefined;
2660
- json?: "" | "true" | "false" | undefined;
2661
- limit?: string | undefined;
2662
- };
2663
- };
2664
- output: {
2665
- channel: string;
2666
- gateway: {
2667
- running: boolean;
2668
- pid: number | null;
2669
- port: number | null;
2670
- uptimeMs: number | null;
2671
- };
2672
- listeners: {
2673
- name: string;
2674
- type: string;
2675
- alive: boolean;
2676
- events: number;
2677
- errors: number;
2678
- lastEventAt: string | null;
2679
- }[];
2680
- claudeClients: number;
2681
- channelId: string;
2682
- recentEvents: {
2683
- seq: number | null;
2684
- ts: number | null;
2685
- type: string;
2686
- outcome: string;
2687
- eventId: string | null;
2688
- payload: string | null;
2689
- payloadParsed: {
2690
- [x: string]: _$hono_utils_types0.JSONValue;
2691
- } | null;
2692
- preview: string | null;
2693
- }[];
2694
- connectionErrors: {
2695
- seq: number | null;
2696
- ts: number | null;
2697
- type: string;
2698
- status: string;
2699
- detail: string | null;
2700
- }[];
2701
- diagnosis: {
2702
- status: "ok" | "warn" | "error";
2703
- message: string;
2704
- nextActions: string[];
2705
- rootCause: string | null;
2706
- };
2707
- };
2708
- outputFormat: "json";
2709
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2710
2507
  };
2711
2508
  };
2712
2509
  } & {
@@ -2716,62 +2513,11 @@ ${string}`;
2716
2513
  query: {
2717
2514
  channel?: string | undefined;
2718
2515
  limit?: string | undefined;
2719
- json?: "" | "true" | "false" | undefined;
2720
2516
  };
2721
2517
  };
2722
2518
  output: string;
2723
2519
  outputFormat: "text";
2724
2520
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2725
- } | {
2726
- input: {
2727
- query: {
2728
- channel?: string | undefined;
2729
- limit?: string | undefined;
2730
- json?: "" | "true" | "false" | undefined;
2731
- };
2732
- };
2733
- output: {
2734
- error: string;
2735
- availableChannels: string[];
2736
- };
2737
- outputFormat: "json";
2738
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2739
- } | {
2740
- input: {
2741
- query: {
2742
- channel?: string | undefined;
2743
- limit?: string | undefined;
2744
- json?: "" | "true" | "false" | undefined;
2745
- };
2746
- };
2747
- output: {
2748
- error: string;
2749
- channels: string[];
2750
- };
2751
- outputFormat: "json";
2752
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2753
- } | {
2754
- input: {
2755
- query: {
2756
- channel?: string | undefined;
2757
- limit?: string | undefined;
2758
- json?: "" | "true" | "false" | undefined;
2759
- };
2760
- };
2761
- output: {
2762
- seq: number | null;
2763
- ts: number | null;
2764
- type: string;
2765
- outcome: string;
2766
- eventId: string | null;
2767
- payload: string | null;
2768
- payloadParsed: {
2769
- [x: string]: _$hono_utils_types0.JSONValue;
2770
- } | null;
2771
- preview: string | null;
2772
- }[];
2773
- outputFormat: "json";
2774
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2775
2521
  };
2776
2522
  };
2777
2523
  } & {
@@ -2781,62 +2527,11 @@ ${string}`;
2781
2527
  query: {
2782
2528
  channel?: string | undefined;
2783
2529
  limit?: string | undefined;
2784
- json?: "" | "true" | "false" | undefined;
2785
2530
  };
2786
2531
  };
2787
2532
  output: string;
2788
2533
  outputFormat: "text";
2789
2534
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2790
- } | {
2791
- input: {
2792
- query: {
2793
- channel?: string | undefined;
2794
- limit?: string | undefined;
2795
- json?: "" | "true" | "false" | undefined;
2796
- };
2797
- };
2798
- output: {
2799
- seq: number | null;
2800
- ts: number | null;
2801
- type: string;
2802
- outcome: string;
2803
- eventId: string | null;
2804
- payload: string | null;
2805
- payloadParsed: {
2806
- [x: string]: _$hono_utils_types0.JSONValue;
2807
- } | null;
2808
- preview: string | null;
2809
- }[];
2810
- outputFormat: "json";
2811
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2812
- } | {
2813
- input: {
2814
- query: {
2815
- channel?: string | undefined;
2816
- limit?: string | undefined;
2817
- json?: "" | "true" | "false" | undefined;
2818
- };
2819
- };
2820
- output: {
2821
- error: string;
2822
- availableChannels: string[];
2823
- };
2824
- outputFormat: "json";
2825
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2826
- } | {
2827
- input: {
2828
- query: {
2829
- channel?: string | undefined;
2830
- limit?: string | undefined;
2831
- json?: "" | "true" | "false" | undefined;
2832
- };
2833
- };
2834
- output: {
2835
- error: string;
2836
- channels: string[];
2837
- };
2838
- outputFormat: "json";
2839
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2840
2535
  };
2841
2536
  };
2842
2537
  } & {
@@ -2846,57 +2541,11 @@ ${string}`;
2846
2541
  query: {
2847
2542
  channel?: string | undefined;
2848
2543
  limit?: string | undefined;
2849
- json?: "" | "true" | "false" | undefined;
2850
2544
  };
2851
2545
  };
2852
2546
  output: string;
2853
2547
  outputFormat: "text";
2854
2548
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2855
- } | {
2856
- input: {
2857
- query: {
2858
- channel?: string | undefined;
2859
- limit?: string | undefined;
2860
- json?: "" | "true" | "false" | undefined;
2861
- };
2862
- };
2863
- output: {
2864
- error: string;
2865
- availableChannels: string[];
2866
- };
2867
- outputFormat: "json";
2868
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2869
- } | {
2870
- input: {
2871
- query: {
2872
- channel?: string | undefined;
2873
- limit?: string | undefined;
2874
- json?: "" | "true" | "false" | undefined;
2875
- };
2876
- };
2877
- output: {
2878
- error: string;
2879
- channels: string[];
2880
- };
2881
- outputFormat: "json";
2882
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2883
- } | {
2884
- input: {
2885
- query: {
2886
- channel?: string | undefined;
2887
- limit?: string | undefined;
2888
- json?: "" | "true" | "false" | undefined;
2889
- };
2890
- };
2891
- output: {
2892
- seq: number | null;
2893
- ts: number | null;
2894
- type: string;
2895
- status: string;
2896
- detail: string | null;
2897
- }[];
2898
- outputFormat: "json";
2899
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2900
2549
  };
2901
2550
  };
2902
2551
  } & {
@@ -2906,128 +2555,47 @@ ${string}`;
2906
2555
  query: {
2907
2556
  channel?: string | undefined;
2908
2557
  seq?: string | undefined;
2909
- json?: "" | "true" | "false" | undefined;
2910
2558
  };
2911
2559
  };
2912
2560
  output: string;
2913
2561
  outputFormat: "text";
2914
2562
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2915
- } | {
2916
- input: {
2917
- query: {
2918
- channel?: string | undefined;
2919
- seq?: string | undefined;
2920
- json?: "" | "true" | "false" | undefined;
2921
- };
2922
- };
2923
- output: `error: ${string}`;
2924
- outputFormat: "text";
2925
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2926
- } | {
2927
- input: {
2928
- query: {
2929
- channel?: string | undefined;
2930
- seq?: string | undefined;
2931
- json?: "" | "true" | "false" | undefined;
2932
- };
2933
- };
2934
- output: `channel not found: ${string}`;
2935
- outputFormat: "text";
2936
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2937
- } | {
2938
- input: {
2939
- query: {
2940
- channel?: string | undefined;
2941
- seq?: string | undefined;
2942
- json?: "" | "true" | "false" | undefined;
2943
- };
2944
- };
2945
- output: "no diagnostic store yet (start the gateway first)";
2946
- outputFormat: "text";
2947
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2948
- } | {
2949
- input: {
2950
- query: {
2951
- channel?: string | undefined;
2952
- seq?: string | undefined;
2953
- json?: "" | "true" | "false" | undefined;
2954
- };
2955
- };
2956
- output: `multiple channels \u2014 specify one with --channel:
2957
- ${string}`;
2958
- outputFormat: "text";
2959
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2960
- } | {
2961
- input: {
2962
- query: {
2963
- channel?: string | undefined;
2964
- seq?: string | undefined;
2965
- json?: "" | "true" | "false" | undefined;
2966
- };
2967
- };
2968
- output: "no channels configured";
2969
- outputFormat: "text";
2970
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2971
- } | {
2972
- input: {
2973
- query: {
2974
- channel?: string | undefined;
2975
- seq?: string | undefined;
2976
- json?: "" | "true" | "false" | undefined;
2977
- };
2978
- };
2979
- output: {
2980
- error: string;
2981
- };
2982
- outputFormat: "json";
2983
- status: _$hono_utils_http_status0.ContentfulStatusCode;
2984
- } | {
2563
+ };
2564
+ };
2565
+ } & {
2566
+ "/docs": {
2567
+ $get: {
2985
2568
  input: {
2986
- query: {
2987
- channel?: string | undefined;
2988
- seq?: string | undefined;
2989
- json?: "" | "true" | "false" | undefined;
2990
- };
2569
+ query: Record<string, never>;
2991
2570
  };
2992
- output: "no matching event found";
2571
+ output: string;
2993
2572
  outputFormat: "text";
2994
2573
  status: _$hono_utils_http_status0.ContentfulStatusCode;
2995
- } | {
2574
+ };
2575
+ };
2576
+ } & {
2577
+ "/docs/:topic": {
2578
+ $get: {
2996
2579
  input: {
2997
- query: {
2998
- channel?: string | undefined;
2999
- seq?: string | undefined;
3000
- json?: "" | "true" | "false" | undefined;
2580
+ param: {
2581
+ topic: string;
3001
2582
  };
3002
2583
  };
3003
- output: "event has no payload to replay";
2584
+ output: string;
3004
2585
  outputFormat: "text";
3005
2586
  status: _$hono_utils_http_status0.ContentfulStatusCode;
3006
- } | {
3007
- input: {
3008
- query: {
3009
- channel?: string | undefined;
3010
- seq?: string | undefined;
3011
- json?: "" | "true" | "false" | undefined;
3012
- };
3013
- };
3014
- output: {
3015
- replayed: true;
3016
- seq: number | null;
3017
- offset: number;
3018
- preview: string | null;
3019
- };
3020
- outputFormat: "json";
3021
- status: _$hono_utils_http_status0.ContentfulStatusCode;
3022
- } | {
2587
+ };
2588
+ };
2589
+ } & {
2590
+ "/doctor": {
2591
+ $get: {
3023
2592
  input: {
3024
2593
  query: {
3025
- channel?: string | undefined;
3026
- seq?: string | undefined;
3027
- json?: "" | "true" | "false" | undefined;
2594
+ fix?: "" | "true" | "false" | undefined;
2595
+ aggressive?: "" | "true" | "false" | undefined;
3028
2596
  };
3029
2597
  };
3030
- output: `replayed seq=${number} \u2192 offset=${number}${string}` | `replayed seq=? \u2192 offset=${number}${string}`;
2598
+ output: string;
3031
2599
  outputFormat: "text";
3032
2600
  status: _$hono_utils_http_status0.ContentfulStatusCode;
3033
2601
  };
@@ -3407,4 +2975,4 @@ declare function buildGatewayRoutes(): _$hono_hono_base0.HonoBase<Env$1, {
3407
2975
  };
3408
2976
  }, "/", "/channels/:channel/publish">;
3409
2977
  //#endregion
3410
- export { FunnelGatewayToken as $, FUNNEL_DIR as A, ListenerOpResult as B, ProcessListStub as C, MockFunnelSettingsReader as D, NodeFunnelFileSystem as E, Funnel as F, SqliteFunnelEventLog as G, MemoryConnectorDiagnosticLog as H, FunnelDebugReport as I, PublishResponse as J, FunnelChannelPublisher as K, FunnelListenersClient as L, SETTINGS_PATH as M, resolveFunnelDir as N, createSettings as O, resolveFunnelPort as P, DEFAULT_GATEWAY_TOKEN_PATH as Q, ListListenersResult as R, MemoryProcessSyncHandler as S, MemoryFunnelFileSystem as T, SqliteConnectorDiagnosticLog as U, FunnelGateway as V, MemoryFunnelEventLog as W, publishRequestSchema as X, PublishResult as Y, publishResponseSchema as Z, AliveStub as _, toRequest as a, Env$1 as at, MemoryProcessHandler as b, ConnectorDiagnosticSqlReader as c, FunnelListenerSupervisor as ct, MemoryFunnelClock as d, FunnelBroadcaster as dt, FunnelGatewayServer as et, NodeFunnelClock as f, ReplayableEvent as ft, NodeFunnelLogger as g, MemoryFunnelLogger as h, queryToCliArgs as i, funnelEventSchema as it, FunnelSettingsStore as j, DEFAULT_GATEWAY_PORT as k, MemoryFunnelIdGenerator as l, BroadcastEvent as lt, LogEntry as m, CliApp as n, FunnelEventLog as nt, Env as o, GatewayEmitInput as ot, NoopFunnelLogger as p, OnFunnelError as pt, PublishRequest as q, routes as r, FunnelEventRecord as rt, factory as s, GatewayRouteDeps as st, GatewayApp as t, FunnelEvent as tt, NodeFunnelIdGenerator as u, BroadcastSubscriber as ut, MemoryFunnelProcessRunner as v, NodeFunnelProcessRunner as w, MemoryProcessResponse as x, MemoryProcessCall as y, ListenerEntry as z };
2978
+ export { FunnelGatewayToken as $, FUNNEL_DIR as A, ListenerOpResult as B, ProcessListStub as C, MockFunnelSettingsReader as D, NodeFunnelFileSystem as E, Funnel as F, SqliteFunnelEventLog as G, MemoryConnectorDiagnosticLog as H, GatewayServerOptions as I, PublishResponse as J, FunnelChannelPublisher as K, FunnelListenersClient as L, SETTINGS_PATH as M, resolveFunnelDir as N, createSettings as O, resolveFunnelPort as P, DEFAULT_GATEWAY_TOKEN_PATH as Q, ListListenersResult as R, MemoryProcessSyncHandler as S, MemoryFunnelFileSystem as T, SqliteConnectorDiagnosticLog as U, FunnelGateway as V, MemoryFunnelEventLog as W, publishRequestSchema as X, PublishResult as Y, publishResponseSchema as Z, AliveStub as _, ReplayableEvent as _t, toRequest as a, GatewayEventStore as at, MemoryProcessHandler as b, buildServiceRoutes as c, FunnelEventRecord as ct, MemoryFunnelClock as d, GatewayEmitInput as dt, gatewayLoopbackUrl as et, NodeFunnelClock as f, GatewayRouteDeps as ft, NodeFunnelLogger as g, FunnelBroadcaster as gt, MemoryFunnelLogger as h, BroadcastSubscriber as ht, queryToCliArgs as i, FunnelGatewayServer as it, FunnelSettingsStore as j, DEFAULT_GATEWAY_PORT as k, MemoryFunnelIdGenerator as l, funnelEventSchema as lt, LogEntry as m, BroadcastEvent as mt, CliApp as n, channelWsProtocols as nt, Env as o, FunnelEvent as ot, NoopFunnelLogger as p, FunnelListenerSupervisor as pt, PublishRequest as q, routes as r, channelWsUrl as rt, factory as s, FunnelEventLog as st, GatewayApp as t, ChannelWsUrlInput as tt, NodeFunnelIdGenerator as u, Env$1 as ut, MemoryFunnelProcessRunner as v, OnFunnelError as vt, NodeFunnelProcessRunner as w, MemoryProcessResponse as x, MemoryProcessCall as y, ListenerEntry as z };