@interactive-inc/claude-funnel 0.41.0 → 0.50.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 (55) hide show
  1. package/README.md +34 -9
  2. package/dist/bin.js +255 -256
  3. package/dist/claude-CB1WkV77.d.ts +115 -0
  4. package/dist/claude.d.ts +59 -0
  5. package/dist/claude.js +322 -0
  6. package/dist/{connector-diagnostic-log-OPpPi9V9.d.ts → connector-diagnostic-log-yTOojKUR.d.ts} +14 -14
  7. package/dist/{logger-Czli2OKh.js → connector-listener-DU54DN-f.js} +1 -9
  8. package/dist/connectors/discord.d.ts +3 -3
  9. package/dist/connectors/discord.js +2 -1
  10. package/dist/connectors/gh.d.ts +4 -3
  11. package/dist/connectors/gh.js +2 -1
  12. package/dist/connectors/schedule.d.ts +1 -1
  13. package/dist/connectors/schedule.js +2 -1
  14. package/dist/connectors/slack.d.ts +2 -2
  15. package/dist/connectors/slack.js +2 -1
  16. package/dist/discord-connector-schema-CBDyGdOI.js +21 -0
  17. package/dist/{discord-connector-schema-BeThExJp.js → discord-listener-_jSE3HsQ.js} +2 -22
  18. package/dist/file-system-BeOKXjlV.d.ts +26 -0
  19. package/dist/file-system-PWKKU7lA.js +9 -0
  20. package/dist/gateway/daemon.js +151 -152
  21. package/dist/gateway.d.ts +3 -0
  22. package/dist/gateway.js +2 -0
  23. package/dist/gh-connector-schema-eoTtHbY6.d.ts +14 -0
  24. package/dist/{gh-connector-schema-eYE4g77K.js → gh-connector-schema-o3Q1-ojL.js} +1 -176
  25. package/dist/gh-listener-DH-fClQm.js +178 -0
  26. package/dist/index-ChomoTZ5.d.ts +3404 -0
  27. package/dist/index.d.ts +11 -4214
  28. package/dist/index.js +195 -3869
  29. package/dist/local-config-json-schema-8IHjS4Q7.js +439 -0
  30. package/dist/local-config-sync-BdsrDZOu.d.ts +381 -0
  31. package/dist/local-config.d.ts +3 -0
  32. package/dist/local-config.js +3 -0
  33. package/dist/logger-BP6SisKt.js +9 -0
  34. package/dist/mcp-Dr-nIBwN.js +253 -0
  35. package/dist/memory-connector-diagnostic-log-CrW1ltLM.js +2245 -0
  36. package/dist/memory-token-prompter-B5FFCsGP.d.ts +57 -0
  37. package/dist/memory-token-prompter-CLerGsgM.js +61 -0
  38. package/dist/node-file-system-BcrmWN9I.js +48 -0
  39. package/dist/{gh-connector-schema-CQmEWzdV.d.ts → process-runner-DfniuWVU.d.ts} +1 -14
  40. package/dist/profiles-f0mNmEyP.d.ts +64 -0
  41. package/dist/profiles-wMRnjSid.js +129 -0
  42. package/dist/profiles.d.ts +2 -0
  43. package/dist/profiles.js +2 -0
  44. package/dist/schedule-connector-schema-iCI61gzU.js +31 -0
  45. package/dist/{schedule-listener-3M6WkH1Y.d.ts → schedule-listener-CUyUFFR1.d.ts} +22 -46
  46. package/dist/{schedule-connector-schema-CM-sRkac.js → schedule-listener-ePAjians.js} +3 -86
  47. package/dist/settings-reader-BSU6JyvM.d.ts +167 -0
  48. package/dist/settings-reader-DPqrpV7s.js +11 -0
  49. package/dist/settings-store-D2XSXTyt.js +186 -0
  50. package/dist/slack-connector-schema-BCNWluHM.js +32 -0
  51. package/dist/{slack-listener-9UdAn_ui.d.ts → slack-listener-Bv5xI9gC.d.ts} +31 -31
  52. package/dist/{slack-connector-schema-DDbSGPZn.js → slack-listener-ClQuHhEF.js} +2 -32
  53. package/package.json +16 -1
  54. /package/dist/{connector-adapter-VA6undzc.d.ts → connector-adapter-DKgsVuMH.d.ts} +0 -0
  55. /package/dist/{discord-connector-schema-DF4pL3Sc.d.ts → discord-connector-schema-R0Uu-3ns.d.ts} +0 -0
@@ -0,0 +1,3404 @@
1
+ import { n as FunnelIdGenerator, s as Settings, t as FunnelSettingsReader } from "./settings-reader-BSU6JyvM.js";
2
+ import { t as FunnelClaude } from "./claude-CB1WkV77.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";
8
+ import { hc } from "hono/client";
9
+ import { z } from "zod";
10
+ import * as _$hono_factory0 from "hono/factory";
11
+ import { Server, ServerWebSocket } from "bun";
12
+ import { Hono } from "hono";
13
+ import * as _$hono_utils_http_status0 from "hono/utils/http-status";
14
+ import * as _$hono_utils_types0 from "hono/utils/types";
15
+ import * as _$hono_hono_base0 from "hono/hono-base";
16
+
17
+ //#region lib/engine/error/on-funnel-error.d.ts
18
+ /**
19
+ * Host integration hook called when Funnel catches an exception that would
20
+ * otherwise be silently swallowed (subscriber throw, listener start failure,
21
+ * MCP forward failure, etc.). Pass `Sentry.captureException` from the host to
22
+ * pipe these into your error reporter. Defaults to a no-op when omitted.
23
+ *
24
+ * `context` carries the component name and any extra metadata the caller had
25
+ * at the catch site (channel / connector / subscriber id when available).
26
+ */
27
+ type OnFunnelError = (error: Error, context?: Record<string, unknown>) => void;
28
+ //#endregion
29
+ //#region lib/gateway/broadcaster.d.ts
30
+ type ClientData = {
31
+ /** Stable channel id (uuid) that the WS client subscribed to. */channel: string; /** Human-facing channel name resolved at upgrade time, kept for log readability. */
32
+ channelName?: string | null; /** Connector names belonging to that channel. */
33
+ connectors: string[]; /** Routing mode resolved from channel config at upgrade time. Defaults to fanout. */
34
+ delivery?: "fanout" | "exclusive";
35
+ /**
36
+ * Opaque per-client id declared at upgrade time (`?id=<subscriberId>`). When an
37
+ * event carries `meta.target`, only the client whose `subscriberId` equals it
38
+ * receives the event among that channel's regular subscribers. Targeted delivery
39
+ * is how a publisher addresses one specific instance (e.g. a single agent
40
+ * session) without every subscriber having to receive and discard it.
41
+ */
42
+ subscriberId?: string;
43
+ };
44
+ type BroadcastEvent = {
45
+ content: string;
46
+ meta?: Record<string, string>;
47
+ };
48
+ type ReplayableEvent = BroadcastEvent & {
49
+ offset: number;
50
+ };
51
+ type BroadcastSubscriber = (event: ReplayableEvent) => void;
52
+ /**
53
+ * Optional persistent replay source. Wired in by the gateway-server with a
54
+ * `FunnelEventLog` (SQLite-backed by default) so reconnects across daemon
55
+ * restarts can recover events older than the in-memory buffer via an indexed
56
+ * `seq > since` range scan.
57
+ */
58
+ type ReplaySource = {
59
+ loadSince(since: number): ReplayableEvent[];
60
+ };
61
+ type Deps$7 = {
62
+ logger?: FunnelLogger; /** Host hook for surfacing subscriber-throw exceptions. Defaults to no-op. */
63
+ onError?: OnFunnelError;
64
+ maxBufferedBytes?: number;
65
+ now?: () => number; /** Number of recent events kept in the in-memory replay buffer. */
66
+ replayBufferSize?: number; /** Hard byte cap on replay buffer payloads. Older events are evicted FIFO until under this cap. */
67
+ replayBufferMaxBytes?: number; /** Persistent replay source consulted when the in-memory buffer cannot satisfy `since`. */
68
+ persistentReplay?: ReplaySource;
69
+ };
70
+ type BroadcasterMetrics = {
71
+ clients: number;
72
+ subscribers: number;
73
+ eventsBroadcast: number;
74
+ droppedSlowClients: number;
75
+ lastBroadcastAt: string | null; /** Latest emitted offset. Clients can `?since=<offset>` to ask for events strictly after this point. */
76
+ latestOffset: number; /** Oldest offset still held in the replay buffer. Older values cannot be replayed and trigger a full resync. */
77
+ oldestReplayableOffset: number | null;
78
+ };
79
+ /**
80
+ * In-process pub/sub for connector events.
81
+ *
82
+ * Two outbound paths:
83
+ * - WS clients connected via the gateway's `/ws` endpoint, scoped per channel
84
+ * - In-process subscribers registered via `subscribe()` (programmable API)
85
+ *
86
+ * Backpressure: if a WS client's `bufferedAmount` exceeds `maxBufferedBytes`
87
+ * (default 1 MiB), the client is closed with code 1009 and dropped from the
88
+ * registry to keep one slow consumer from blocking the daemon.
89
+ *
90
+ * Replay: every emitted event gets a strictly increasing `offset`. The latest
91
+ * `replayBufferSize` events are kept in memory; reconnecting WS clients can
92
+ * pass `?since=<offset>` and the broadcaster resends matching events before
93
+ * resuming the live stream. The in-memory ring covers short reconnects;
94
+ * older history is served from the event log wired in as `persistentReplay`.
95
+ */
96
+ declare class FunnelBroadcaster {
97
+ private readonly clients;
98
+ private readonly subscribers;
99
+ private readonly logger;
100
+ private readonly onError;
101
+ private readonly maxBufferedBytes;
102
+ private readonly now;
103
+ private readonly replayBufferSize;
104
+ private readonly replayBufferMaxBytes;
105
+ private readonly replayBuffer;
106
+ private readonly persistentReplay;
107
+ private readonly exclusiveCursor;
108
+ private replayBufferBytes;
109
+ private eventsBroadcast;
110
+ private droppedSlowClients;
111
+ private lastBroadcastAt;
112
+ private latestOffset;
113
+ constructor(deps?: Deps$7);
114
+ getMetrics(): BroadcasterMetrics;
115
+ /**
116
+ * Returns events with offset > since, filtered by the connector subscription
117
+ * rules of `data`. Used at WS upgrade time when the client passes `?since=<offset>`.
118
+ *
119
+ * Two-tier lookup:
120
+ * 1. The in-memory ring buffer (covers short reconnects, last `replayBufferSize` events).
121
+ * 2. If `since` predates the oldest in-memory entry and a persistent replay source
122
+ * is wired in (SQLite by default), the gap is filled from it. This covers reconnects
123
+ * across daemon restarts where the in-memory buffer was lost.
124
+ *
125
+ * Result is sorted ascending by offset and de-duplicated against the in-memory buffer.
126
+ */
127
+ replaySince(since: number, data: ClientData): ReplayableEvent[];
128
+ private matchesClient;
129
+ /**
130
+ * Returns the list of WS clients that should receive `event`. For each per-channel group:
131
+ * - fanout → every matching client receives
132
+ * - exclusive → exactly one client receives, picked round-robin per channel
133
+ *
134
+ * `meta.target` narrows the recipient set via `matchesClient`: only the subscriber
135
+ * whose `subscriberId` equals `target` receives a targeted event.
136
+ */
137
+ private pickRecipients;
138
+ addClient(ws: ServerWebSocket<unknown>, data: ClientData): void;
139
+ removeClient(ws: ServerWebSocket<unknown>): void;
140
+ getClientCount(): number;
141
+ listChannels(): {
142
+ channel: string;
143
+ connectors: string[];
144
+ }[];
145
+ subscribe(handler: BroadcastSubscriber): () => void;
146
+ broadcast(content: string, meta?: Record<string, string>): ReplayableEvent;
147
+ /** Forward-seed the offset counter (used at startup from the persisted event store). */
148
+ seedLatestOffset(offset: number): void;
149
+ }
150
+ //#endregion
151
+ //#region lib/gateway/listener-supervisor.d.ts
152
+ type ConnectorRegistry = {
153
+ listAllConnectors(): ChannelConnectorView[];
154
+ createListener(channelName: string, connectorName: string): {
155
+ config: ConnectorConfig;
156
+ channelId: string;
157
+ listener: FunnelConnectorListener;
158
+ } | null;
159
+ };
160
+ type SupervisorNotify = (channelName: string, connectorName: string, content: string, meta?: Record<string, string>) => Promise<void>;
161
+ type Deps$6 = {
162
+ channels: ConnectorRegistry;
163
+ notify: SupervisorNotify;
164
+ logger?: FunnelLogger; /** Host hook for surfacing listener lifecycle exceptions. Defaults to no-op. */
165
+ onError?: OnFunnelError;
166
+ healthCheckIntervalMs?: number;
167
+ maxBackoffMs?: number;
168
+ sleep?: (ms: number) => Promise<void>;
169
+ now?: () => number;
170
+ };
171
+ type ListenerEntryStatus = {
172
+ channelName: string;
173
+ channelId: string;
174
+ name: string;
175
+ type: ConnectorConfig["type"];
176
+ alive: boolean;
177
+ events: number;
178
+ errors: number;
179
+ failureCount: number;
180
+ lastEventAt: string | null;
181
+ };
182
+ /**
183
+ * Owns the running listener instances and their lifecycle.
184
+ *
185
+ * Lives in the gateway process and is the only place that calls
186
+ * `listener.start()` / `listener.stop()`. Each entry is keyed by
187
+ * `${channelName}/${connectorName}` so the same connector name can exist in
188
+ * multiple channels without colliding.
189
+ *
190
+ * Periodically polls each running listener's `isAlive()` and auto-restarts
191
+ * dead listeners with exponential backoff (1s, 2s, 4s, ... capped). Resets
192
+ * the backoff counter on successful restart.
193
+ */
194
+ declare class FunnelListenerSupervisor {
195
+ private readonly channels;
196
+ private readonly notify;
197
+ private readonly logger;
198
+ private readonly onError;
199
+ private readonly running;
200
+ private readonly failureCounts;
201
+ private readonly stats;
202
+ private readonly healthCheckIntervalMs;
203
+ private readonly maxBackoffMs;
204
+ private readonly sleep;
205
+ private readonly now;
206
+ private healthCheckTimer;
207
+ private healthCheckInFlight;
208
+ constructor(deps: Deps$6);
209
+ static keyOf(channelName: string, connectorName: string): string;
210
+ isRunning(channelName: string, connectorName: string): boolean;
211
+ list(): ListenerEntryStatus[];
212
+ start(channelName: string, connectorName: string): Promise<{
213
+ ok: boolean;
214
+ reason?: string;
215
+ }>;
216
+ stop(channelName: string, connectorName: string): Promise<{
217
+ ok: boolean;
218
+ reason?: string;
219
+ }>;
220
+ restart(channelName: string, connectorName: string): Promise<{
221
+ ok: boolean;
222
+ reason?: string;
223
+ }>;
224
+ startAll(): Promise<void>;
225
+ stopAll(): Promise<void>;
226
+ private ensureStats;
227
+ private recordEvent;
228
+ private recordError;
229
+ private startHealthCheck;
230
+ private stopHealthCheck;
231
+ private runHealthCheck;
232
+ private recoverDead;
233
+ }
234
+ //#endregion
235
+ //#region lib/gateway/routes/route-deps.d.ts
236
+ type GatewayEmitInput = {
237
+ channel: string;
238
+ connector?: string;
239
+ content: string;
240
+ meta?: Record<string, string>;
241
+ };
242
+ type GatewayRouteDeps = {
243
+ selfPid: number;
244
+ broadcaster: FunnelBroadcaster;
245
+ supervisor: FunnelListenerSupervisor;
246
+ channels: FunnelChannels;
247
+ uptimeMs: () => number;
248
+ emit: (input: GatewayEmitInput) => {
249
+ offset: number;
250
+ };
251
+ };
252
+ //#endregion
253
+ //#region lib/gateway/factory.d.ts
254
+ type Env$1 = {
255
+ Variables: {
256
+ deps: GatewayRouteDeps;
257
+ };
258
+ };
259
+ //#endregion
260
+ //#region lib/gateway/funnel-event-log.d.ts
261
+ /**
262
+ * Replayable event payload persisted by the gateway. Domain events the
263
+ * broadcaster emits to WS clients land here so reconnects across daemon
264
+ * restarts can be served from disk. System events (gateway start, channel
265
+ * connected, etc.) are routed to `FunnelLogger` instead — they never go
266
+ * through this log, which keeps the offset space clean for replay.
267
+ */
268
+ declare const funnelEventSchema: z.ZodObject<{
269
+ type: z.ZodString;
270
+ content: z.ZodString;
271
+ channel_id: z.ZodNullable<z.ZodString>;
272
+ connector_id: z.ZodNullable<z.ZodString>;
273
+ meta: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
274
+ }, z.core.$strip>;
275
+ type FunnelEvent = z.infer<typeof funnelEventSchema>;
276
+ /** One broadcast event to persist, carrying the offset the broadcaster assigned. */
277
+ type FunnelEventRecord = {
278
+ content: string;
279
+ channelId: string | null;
280
+ connectorId: string | null;
281
+ meta: Record<string, string> | null;
282
+ offset: number;
283
+ };
284
+ /**
285
+ * Durable, append-only log of broadcaster events keyed by the offset the
286
+ * broadcaster assigns. The gateway persists every domain event here, and
287
+ * across restarts it both seeds the broadcaster's offset counter
288
+ * (`findMaxOffset`) and serves reconnect replay (`loadSince`) from it.
289
+ *
290
+ * `loadSince` is the only method the broadcaster itself needs, which makes
291
+ * any implementation assignable to the broadcaster's narrow `ReplaySource`.
292
+ *
293
+ * Implementations:
294
+ * - `SqliteFunnelEventLog` — the default; durable across daemon restarts.
295
+ * - `MemoryFunnelEventLog` — an in-process double for tests and embedders
296
+ * that do not need durability (replay is lost when the process exits).
297
+ */
298
+ declare abstract class FunnelEventLog {
299
+ abstract record(record: FunnelEventRecord): void;
300
+ abstract loadSince(since: number): ReplayableEvent[];
301
+ abstract findMaxOffset(): number;
302
+ /** Drop every stored event and reclaim the file. The broadcaster's in-memory
303
+ * offset counter is unaffected, so offsets keep increasing after a clear. */
304
+ abstract clear(): void;
305
+ abstract close(): void;
306
+ }
307
+ //#endregion
308
+ //#region lib/gateway/gateway-server.d.ts
309
+ type Deps$5 = {
310
+ channels: FunnelChannels;
311
+ 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;
315
+ process?: FunnelProcessRunner;
316
+ clock?: FunnelClock;
317
+ logger?: FunnelLogger; /** Host hook for surfacing internal exceptions (broadcaster / supervisor). Defaults to no-op. */
318
+ onError?: OnFunnelError;
319
+ selfPid?: number; /** Funnel home dir, used to scope kill-competing to daemons rooted at the same dir. Defaults to FUNNEL_DIR. */
320
+ dir?: string;
321
+ killCompetingSlack?: boolean; /** Bearer token required for `/listeners*`, `/status`, and `/ws`. Empty string disables auth (tests only). */
322
+ token?: string;
323
+ /**
324
+ * Additional hono app mounted before the built-in gateway routes.
325
+ * Use to embed host-specific endpoints (e.g. an MCP route, custom `/api/*`).
326
+ * Host routes are mounted first; built-in `/listeners`, `/status`,
327
+ * `/channels`, `/health` are mounted after and take precedence on conflict.
328
+ */
329
+ extraRoutes?: Hono<Env$1>;
330
+ };
331
+ type WsData = {
332
+ /** Stable channel id (uuid) the client subscribed to. */channel: string; /** Resolved channel name (for log readability). null for unknown. */
333
+ channelName: string | null; /** Connector names belonging to that channel. */
334
+ connectors: string[]; /** Routing mode for this channel; resolved at upgrade time from settings. */
335
+ delivery: "fanout" | "exclusive"; /** Opaque client id from `?id=<subscriberId>`; lets publishers target this client via `meta.target`. */
336
+ subscriberId?: string; /** Replay any events with offset strictly greater than this on open, then resume the live stream. */
337
+ since?: number;
338
+ };
339
+ /**
340
+ * In-process gateway: runs `Bun.serve` (HTTP + WebSocket /ws), boots connector
341
+ * listeners through `FunnelListenerSupervisor`, fans events out via
342
+ * `FunnelBroadcaster`, and persists them via a `FunnelEventLog` (SQLite by default).
343
+ * System events (gateway lifecycle, connect/disconnect) flow to `FunnelLogger`
344
+ * instead — keeping the SQLite seq space exclusive to broadcaster traffic so
345
+ * the broadcaster's offset counter and `getMaxSeq()` stay aligned without
346
+ * per-event coordination. Exposes `/listeners` HTTP for runtime
347
+ * start/stop/restart of individual connectors.
348
+ */
349
+ declare class FunnelGatewayServer {
350
+ private readonly channels;
351
+ private readonly port;
352
+ private readonly hostname;
353
+ private readonly dbPath;
354
+ private readonly process?;
355
+ private readonly logger;
356
+ private readonly onError;
357
+ private readonly selfPid;
358
+ private readonly dir;
359
+ private readonly killCompetingSlack;
360
+ private readonly token;
361
+ private readonly broadcaster;
362
+ private readonly eventLog;
363
+ private readonly supervisor;
364
+ private readonly nowMs;
365
+ private readonly extraRoutes;
366
+ private startedAt;
367
+ private server;
368
+ constructor(deps: Deps$5);
369
+ start(): Promise<Server<WsData>>;
370
+ stop(): Promise<void>;
371
+ getStatus(): {
372
+ clients: number;
373
+ channels: {
374
+ channel: string;
375
+ connectors: string[];
376
+ }[];
377
+ };
378
+ getBroadcaster(): FunnelBroadcaster;
379
+ getSupervisor(): FunnelListenerSupervisor;
380
+ getEventLog(): FunnelEventLog;
381
+ /**
382
+ * Register an in-process observer for every broadcast event. Fires after
383
+ * the event is fanned out to WS clients and recorded in the event log.
384
+ * Returns an unsubscribe function. Only meaningful in-process (embedded
385
+ * hosts / `new Funnel(...)` running their own gateway-server); a separate
386
+ * daemon process cannot be observed this way — use a WS client for that.
387
+ */
388
+ onEvent(handler: BroadcastSubscriber): () => void;
389
+ private handleFetch;
390
+ private handleWsOpen;
391
+ private handleWsClose;
392
+ private logServerStarted;
393
+ private buildApp;
394
+ /**
395
+ * Reads the bearer token from the WebSocket upgrade request. Accepts:
396
+ * - `Sec-WebSocket-Protocol: funnel.token.<value>` (preferred — header, never logged in URLs)
397
+ * - `Authorization: Bearer <value>` (also header-based)
398
+ * Returns true on a constant-time match against the daemon token.
399
+ */
400
+ private tokenMatchesUpgrade;
401
+ private resolveChannel;
402
+ private bootListeners;
403
+ /**
404
+ * Broadcast `content` to subscribers of `channel`, persisting the event in
405
+ * the SQLite store and stamping `meta.channel{,Id}` / `meta.connector{,Id}`
406
+ * when they resolve. Used by both the connector-listener path (via the
407
+ * supervisor's `notify` callback) and the public `/channels/:channel/publish`
408
+ * route. Returns the assigned event offset.
409
+ */
410
+ emit(input: {
411
+ channel: string;
412
+ connector?: string;
413
+ content: string;
414
+ meta?: Record<string, string>;
415
+ }): {
416
+ offset: number;
417
+ };
418
+ private lookupChannelId;
419
+ private lookupConnectorId;
420
+ }
421
+ //#endregion
422
+ //#region lib/gateway/gateway-token.d.ts
423
+ type Deps$4 = {
424
+ fs?: FunnelFileSystem;
425
+ dir?: string;
426
+ generate?: () => string;
427
+ };
428
+ /**
429
+ * Reads / generates the gateway daemon token used to authenticate
430
+ * `/listeners*`, `/status`, and `/ws` connections.
431
+ *
432
+ * Token file: `<dir>/gateway.token` (default `~/.funnel/gateway.token`),
433
+ * written with mode 0600. Clients on the same machine as the daemon read
434
+ * the file directly; the token never leaves the user's home directory.
435
+ */
436
+ declare class FunnelGatewayToken {
437
+ private readonly fs;
438
+ private readonly path;
439
+ private readonly generate;
440
+ constructor(deps?: Deps$4);
441
+ read(): string | null;
442
+ /**
443
+ * Returns the existing token or, if missing, generates one and writes it with mode 0600.
444
+ *
445
+ * NOTE: not atomic — two concurrent `ensure()` calls (e.g., `fnl gateway start` racing
446
+ * itself before the PID lock is acquired) could each generate independent tokens. The
447
+ * gateway PID file makes this practically a non-issue; if you need stronger guarantees,
448
+ * take a file lock around this call externally.
449
+ */
450
+ ensure(): string;
451
+ getPath(): string;
452
+ }
453
+ declare const DEFAULT_GATEWAY_TOKEN_PATH: string;
454
+ //#endregion
455
+ //#region lib/gateway/publish-schema.d.ts
456
+ /**
457
+ * Shared schema for `POST /channels/:channel/publish` — used by both the
458
+ * gateway route handler (input validation) and the CLI / programmable client
459
+ * (request shape). The route resolves `channel` from the path; this body
460
+ * covers everything else.
461
+ */
462
+ declare const publishRequestSchema: z.ZodObject<{
463
+ content: z.ZodString;
464
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
465
+ connector: z.ZodOptional<z.ZodString>;
466
+ target: z.ZodOptional<z.ZodString>;
467
+ }, z.core.$strip>;
468
+ type PublishRequest = z.infer<typeof publishRequestSchema>;
469
+ declare const publishResponseSchema: z.ZodObject<{
470
+ ok: z.ZodLiteral<true>;
471
+ offset: z.ZodNumber;
472
+ }, z.core.$strip>;
473
+ type PublishResponse = z.infer<typeof publishResponseSchema>;
474
+ type PublishResult = {
475
+ state: "ok";
476
+ offset: number;
477
+ } | {
478
+ state: "offline";
479
+ } | {
480
+ state: "error";
481
+ reason: string;
482
+ };
483
+ //#endregion
484
+ //#region lib/gateway/channel-publisher.d.ts
485
+ type Deps$3 = {
486
+ port: number;
487
+ isDaemonRunning: () => boolean; /** Returns the daemon's gateway token, or null if unavailable. Sent as `Authorization: Bearer`. */
488
+ getToken?: () => string | null;
489
+ };
490
+ /**
491
+ * HTTP client for `POST /channels/:channel/publish` on a running gateway
492
+ * daemon. Returns `{ state: "offline" }` when the daemon isn't up so callers
493
+ * can branch without exceptions, mirroring `FunnelListenersClient`.
494
+ */
495
+ declare class FunnelChannelPublisher {
496
+ private readonly port;
497
+ private readonly isDaemonRunning;
498
+ private readonly getToken;
499
+ constructor(deps: Deps$3);
500
+ publish(channelName: string, request: PublishRequest): Promise<PublishResult>;
501
+ private authHeaders;
502
+ }
503
+ //#endregion
504
+ //#region lib/gateway/sqlite-funnel-event-log.d.ts
505
+ type Props$7 = {
506
+ /** 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. */
508
+ maxRows?: number; /** Optional age cap in ms. Pruned on every insert. */
509
+ maxAgeMs?: number; /** Optional on-disk byte cap. Checked periodically; on overflow the oldest rows are dropped toward targetBytes and the file is VACUUMed. */
510
+ maxBytes?: number; /** Shrink target when maxBytes is exceeded. Defaults to maxBytes/4. */
511
+ targetBytes?: number;
512
+ };
513
+ /**
514
+ * SQLite-backed `FunnelEventLog`. One indexed table holds every broadcaster
515
+ * event with `channel_id` and `connector_id` as dedicated columns, so
516
+ * per-channel and per-connector replay is an indexed range scan.
517
+ *
518
+ * Concurrency: `seq` is `INTEGER PRIMARY KEY`, so SQLite assigns it
519
+ * atomically. The broadcaster owns its own offset counter at runtime
520
+ * (seeded from `findMaxOffset()` at startup); each broadcaster event
521
+ * flows in here via `record()` with that pre-assigned offset, which the
522
+ * sink stores via `write()` — PK uniqueness catches double-emit bugs.
523
+ *
524
+ * System events (gateway lifecycle, channel connect/disconnect, etc.) do
525
+ * NOT go through this store. They are diagnostic only and live in
526
+ * `FunnelLogger`'s file so the seq space here stays exclusive to
527
+ * broadcaster traffic. This is what makes the broadcaster's seq seeding
528
+ * (`getMaxSeq()` at startup) correct without per-event coordination.
529
+ */
530
+ declare class SqliteFunnelEventLog extends FunnelEventLog {
531
+ private readonly sink;
532
+ private readonly now;
533
+ constructor(props: Props$7);
534
+ /**
535
+ * Persist a broadcaster-driven event with its assigned offset. Caller
536
+ * (the gateway-server) supplies the offset from `broadcaster.broadcast()`
537
+ * so this store and the broadcaster's in-memory ring stay aligned.
538
+ */
539
+ record(record: FunnelEventRecord): void;
540
+ /**
541
+ * Returns events with offset > since. Filtering by channel/connector is
542
+ * the broadcaster's responsibility (it knows the client's subscription),
543
+ * so this returns the full slice and lets the caller filter.
544
+ */
545
+ loadSince(since: number): ReplayableEvent[];
546
+ /**
547
+ * Returns events for one channel (and optionally one connector). Used
548
+ * by the gateway logs CLI for scoped queries. Channel/connector filters
549
+ * are indexed columns, so this is an indexed range scan.
550
+ */
551
+ loadForChannel(props: {
552
+ channelId: string;
553
+ connectorId?: string;
554
+ sinceSeq?: number;
555
+ limit?: number;
556
+ }): ReplayableEvent[];
557
+ findMaxOffset(): number;
558
+ clear(): void;
559
+ close(): void;
560
+ }
561
+ //#endregion
562
+ //#region lib/gateway/memory-funnel-event-log.d.ts
563
+ /**
564
+ * In-process `FunnelEventLog` backed by a plain array. Used by tests and by
565
+ * embedders that do not need durability — replay works within the process
566
+ * lifetime but is lost when the process exits. Unlike the SQLite log it does
567
+ * not truncate content or prune, so it is not meant for unbounded production
568
+ * traffic.
569
+ */
570
+ declare class MemoryFunnelEventLog extends FunnelEventLog {
571
+ private readonly events;
572
+ constructor();
573
+ record(record: FunnelEventRecord): void;
574
+ loadSince(since: number): ReplayableEvent[];
575
+ findMaxOffset(): number;
576
+ clear(): void;
577
+ close(): void;
578
+ }
579
+ //#endregion
580
+ //#region lib/gateway/sqlite-connector-diagnostic-log.d.ts
581
+ type Props$6 = {
582
+ /** SQLite file for the raw (pre-filter) table. ":memory:" for tests. */rawPath: string; /** SQLite file for the processed (verdict) table. ":memory:" for tests. */
583
+ processedPath: string; /** SQLite file for the connection (lifecycle) table. ":memory:" for tests. */
584
+ connectionPath: string;
585
+ now?: () => number; /** Row cap for the processed and connection tables. Pruned on every insert. */
586
+ maxRows?: number;
587
+ /**
588
+ * Row cap for the raw table specifically. Raw rows can each hold up to
589
+ * `RAW_PAYLOAD_CAP` bytes, so they want a tighter cap than the small
590
+ * processed/connection verdict rows. Defaults to `maxRows` when unset.
591
+ */
592
+ rawMaxRows?: number; /** Age cap in ms for all tables — bounds how long untouched payloads (with PII) live. Pruned on every insert. */
593
+ maxAgeMs?: number; /** When set, `insert()` errors (disk full, WAL lock) are logged instead of silently dropped. */
594
+ logger?: FunnelLogger;
595
+ };
596
+ /**
597
+ * Default `ConnectorDiagnosticLog`: three independent `LeucoLoggerSqliteSink`s, one
598
+ * per table (raw / processed / connection), in separate files. Each sink
599
+ * indexes the columns its queries filter on — `event_id` / `connector_id` /
600
+ * `channel_id` for raw, plus `outcome` for processed and `status` for
601
+ * connection — so those lookups are indexed scans (`type` is a fixed column
602
+ * the sink extracts separately, not an index, so filtering by it is a scan).
603
+ *
604
+ * The raw table offloads any payload over `RAW_PAYLOAD_CAP`: rather than
605
+ * truncating mid-string (which yields unparseable JSON), it replaces the
606
+ * body with a small JSON object that keeps the diagnostic essentials and
607
+ * records the dropped size under `_funnel_oversized`. Every stored payload
608
+ * therefore stays valid JSON.
609
+ */
610
+ declare class SqliteConnectorDiagnosticLog extends ConnectorDiagnosticLog {
611
+ private readonly raw;
612
+ private readonly processed;
613
+ private readonly connection;
614
+ private readonly now;
615
+ private readonly logger;
616
+ constructor(props: Props$6);
617
+ recordRaw(record: ConnectorRawRecord): void;
618
+ recordProcessed(record: ConnectorProcessedRecord): void;
619
+ recordConnection(record: ConnectorConnectionRecord): void;
620
+ private report;
621
+ queryRaw(query: ConnectorRawQuery): StoredRawEvent[];
622
+ queryProcessed(query: ConnectorProcessedQuery): StoredProcessedEvent[];
623
+ queryConnection(query: ConnectorConnectionQuery): StoredConnectionEvent[];
624
+ clear(): void;
625
+ close(): void;
626
+ }
627
+ //#endregion
628
+ //#region lib/gateway/memory-connector-diagnostic-log.d.ts
629
+ /**
630
+ * In-process `ConnectorDiagnosticLog` backed by one array per table. Used by tests
631
+ * and embedders that do not need durability. Like the SQLite log it keeps
632
+ * `seq` per-table (each array's 1-based position) and returns the most recent
633
+ * `limit` rows oldest-first; unlike it, it never prunes and never offloads
634
+ * oversized payloads — it keeps whatever the caller hands it, which is fine
635
+ * for the bounded volumes a test produces. Payload-validity is therefore a
636
+ * SQLite-only guarantee; do not write a test that leans on this double
637
+ * rejecting a malformed payload.
638
+ */
639
+ declare class MemoryConnectorDiagnosticLog extends ConnectorDiagnosticLog {
640
+ private readonly now;
641
+ private readonly raws;
642
+ private readonly processeds;
643
+ private readonly connections;
644
+ constructor(now?: () => number);
645
+ recordRaw(record: ConnectorRawRecord): void;
646
+ recordProcessed(record: ConnectorProcessedRecord): void;
647
+ recordConnection(record: ConnectorConnectionRecord): void;
648
+ queryRaw(query: ConnectorRawQuery): StoredRawEvent[];
649
+ queryProcessed(query: ConnectorProcessedQuery): StoredProcessedEvent[];
650
+ queryConnection(query: ConnectorConnectionQuery): StoredConnectionEvent[];
651
+ clear(): void;
652
+ close(): void;
653
+ }
654
+ //#endregion
655
+ //#region lib/gateway/gateway.d.ts
656
+ type Deps$2 = {
657
+ process?: FunnelProcessRunner;
658
+ fs?: FunnelFileSystem;
659
+ clock?: FunnelClock;
660
+ dir?: string;
661
+ tmpDir?: string;
662
+ port?: number;
663
+ sleep?: (ms: number) => Promise<void>;
664
+ };
665
+ /**
666
+ * Manages the gateway daemon as a separate process via PID file.
667
+ * Use `start()` to spawn `bun daemon.ts` in the background and `stop()` to
668
+ * terminate it. For an in-process gateway, use `Funnel.gatewayServer` instead.
669
+ */
670
+ declare class FunnelGateway {
671
+ private readonly process;
672
+ private readonly fs;
673
+ private readonly clock;
674
+ private readonly dir;
675
+ private readonly pidFile;
676
+ private readonly gatewayLog;
677
+ private readonly tmpDir;
678
+ private readonly port;
679
+ private readonly sleep;
680
+ constructor(deps?: Deps$2);
681
+ isRunning(): boolean;
682
+ getStatus(): {
683
+ running: boolean;
684
+ pid: number | null;
685
+ port: number;
686
+ };
687
+ start(options?: {
688
+ caffeinate?: boolean;
689
+ }): Promise<boolean>;
690
+ buildStartCommand(gatewayScript: string, options?: {
691
+ caffeinate?: boolean;
692
+ }): string[];
693
+ stop(): Promise<boolean>;
694
+ restart(options?: {
695
+ onlyIfRunning?: boolean;
696
+ caffeinate?: boolean;
697
+ }): Promise<{
698
+ ok: boolean;
699
+ wasRunning: boolean;
700
+ stopped: boolean;
701
+ started: boolean;
702
+ }>;
703
+ getGatewayLog(): string;
704
+ getPort(): number;
705
+ private readPid;
706
+ private removePid;
707
+ private isProcessAlive;
708
+ }
709
+ //#endregion
710
+ //#region lib/gateway/listeners-client.d.ts
711
+ type Deps$1 = {
712
+ port: number;
713
+ isDaemonRunning: () => boolean; /** Returns the daemon's gateway token, or null if unavailable. Sent as `Authorization: Bearer`. */
714
+ getToken?: () => string | null;
715
+ };
716
+ declare const listenerEntrySchema: z.ZodObject<{
717
+ channelName: z.ZodString;
718
+ channelId: z.ZodString;
719
+ name: z.ZodString;
720
+ type: z.ZodString;
721
+ alive: z.ZodBoolean;
722
+ }, z.core.$strip>;
723
+ type ListenerEntry = z.infer<typeof listenerEntrySchema>;
724
+ type ListenerOpResult = {
725
+ state: "ok";
726
+ } | {
727
+ state: "offline";
728
+ } | {
729
+ state: "error";
730
+ reason: string;
731
+ };
732
+ type ListListenersResult = {
733
+ state: "ok";
734
+ listeners: ListenerEntry[];
735
+ } | {
736
+ state: "offline";
737
+ } | {
738
+ state: "error";
739
+ reason: string;
740
+ };
741
+ /**
742
+ * HTTP client for listener operations on a running gateway daemon.
743
+ *
744
+ * Returns `{ state: "offline" }` when the daemon isn't running so callers
745
+ * (CLI hot-reload paths) can treat that as a no-op without parsing strings.
746
+ * Pair this with `FunnelGateway` (process control) for the full picture.
747
+ */
748
+ declare class FunnelListenersClient {
749
+ private readonly port;
750
+ private readonly isDaemonRunning;
751
+ private readonly getToken;
752
+ constructor(deps: Deps$1);
753
+ list(): Promise<ListListenersResult>;
754
+ start(channelName: string, connectorName: string): Promise<ListenerOpResult>;
755
+ stop(channelName: string, connectorName: string): Promise<ListenerOpResult>;
756
+ restart(channelName: string, connectorName: string): Promise<ListenerOpResult>;
757
+ private path;
758
+ private authHeaders;
759
+ private call;
760
+ }
761
+ //#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
+ //#region lib/funnel.d.ts
791
+ type Props$5 = {
792
+ /** 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
+ fs?: FunnelFileSystem; /** Process runner used by gateway / claude / gh listener. Replace with MemoryFunnelProcessRunner for tests. */
794
+ process?: FunnelProcessRunner; /** Logger flowed into every facet. Replace with MemoryFunnelLogger or NoopFunnelLogger to silence/inspect. */
795
+ logger?: FunnelLogger; /** Clock used by schedule listener, gh poll watermarks, and gateway timeouts. */
796
+ clock?: FunnelClock; /** ID generator for channel and connector ids. Use MemoryFunnelIdGenerator for deterministic tests. */
797
+ idGenerator?: FunnelIdGenerator; /** Funnel home directory (settings.json + per-channel/per-connector dirs). Defaults to ~/.funnel. */
798
+ dir?: string; /** Temp / runtime directory (gateway logs and PID adjacent files). Defaults to `<os.tmpdir()>/funnel`. */
799
+ tmpDir?: string;
800
+ /**
801
+ * Host integration hooks for Slack listeners — `onAppCreated` for attaching
802
+ * Bolt `app.action` handlers, `preprocessEvent` for transforming/dropping
803
+ * raw Slack events before the built-in processor sees them.
804
+ */
805
+ slackListenerOptions?: SlackListenerOptions;
806
+ /**
807
+ * Host integration hooks for Schedule listeners — `onFired` is invoked after
808
+ * each successful fire, useful for dropping one-shot entries.
809
+ */
810
+ scheduleListenerOptions?: ScheduleListenerOptions;
811
+ /**
812
+ * Diagnostic log of inbound connector traffic (raw events before filtering
813
+ * and the processor's verdict after). Threaded into listeners that record
814
+ * it. Only the gateway daemon injects a `SqliteConnectorDiagnosticLog`; everywhere
815
+ * else this stays absent and recording is a no-op.
816
+ */
817
+ diagnosticLog?: ConnectorDiagnosticLog;
818
+ /**
819
+ * Called when Funnel catches an exception that would otherwise be silently
820
+ * swallowed (subscriber throw, listener start/stop failure, etc.). Pass
821
+ * `Sentry.captureException` from the host to surface these. Defaults to no-op.
822
+ */
823
+ onError?: OnFunnelError;
824
+ /**
825
+ * Gateway daemon port. Passed directly to FunnelGateway so hosts can override
826
+ * the default (9742) without setting FUNNEL_PORT in the environment.
827
+ */
828
+ port?: number;
829
+ /**
830
+ * Token prompter used by FunnelLocalConfigSync when funnel.json omits a token.
831
+ * Defaults to a TTY-only stdin prompter. Inject MemoryFunnelTokenPrompter in tests.
832
+ */
833
+ tokenPrompter?: FunnelTokenPrompter;
834
+ };
835
+ /**
836
+ * Facade that wires every funnel facet together and exposes the public surface.
837
+ *
838
+ * All side-effecting boundaries (filesystem, process, logger, clock, id, paths)
839
+ * are injected via Props — passing memory implementations gives a fully sandboxed
840
+ * Funnel that touches no real disk, processes, or wall-clock time.
841
+ *
842
+ * Fully immutable: all fields are resolved in the constructor and frozen.
843
+ * No lazy initialisation — every dependency is wired at construction time.
844
+ *
845
+ * @example
846
+ * ```ts
847
+ * const funnel = new Funnel({})
848
+ * const channel = funnel.channels.add({ name: "inbox" })
849
+ * funnel.channels.addConnector("inbox", { type: "slack", name: "ops", botToken, appToken })
850
+ * await funnel.gatewayServer({ port: 9742 }).start()
851
+ * ```
852
+ */
853
+ declare class Funnel {
854
+ readonly paths: {
855
+ dir: string;
856
+ tmpDir: string;
857
+ settings: string;
858
+ };
859
+ readonly channels: FunnelChannels;
860
+ readonly gateway: FunnelGateway;
861
+ readonly gatewayToken: FunnelGatewayToken;
862
+ readonly publisher: FunnelChannelPublisher;
863
+ readonly listeners: FunnelListenersClient;
864
+ readonly claude: FunnelClaude;
865
+ readonly profiles: FunnelProfiles;
866
+ readonly localConfig: FunnelLocalConfig;
867
+ readonly localConfigSync: FunnelLocalConfigSync;
868
+ private readonly fs;
869
+ private readonly process;
870
+ private readonly logger;
871
+ private readonly clock;
872
+ private readonly onError;
873
+ constructor(props?: Props$5);
874
+ /**
875
+ * Sandboxed Funnel wired with in-memory implementations for every IO boundary.
876
+ * Touches no real disk, processes, wall-clock time, or UUIDs — safe for tests
877
+ * and ad-hoc experiments. Override individual fields by passing them in `props`.
878
+ */
879
+ static inMemory(props?: Props$5): Funnel;
880
+ /**
881
+ * In-process gateway server. Unlike `gateway.start()` (which spawns a daemon),
882
+ * this returns a class that runs `Bun.serve` + listeners inside the current process —
883
+ * useful for tests, embedding, or custom hosts.
884
+ */
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;
894
+ /**
895
+ * Run the gateway daemon in the foreground (tied to this terminal).
896
+ * For background daemon management, use `funnel.gateway.start()` instead.
897
+ */
898
+ runGatewayForeground(options?: {
899
+ caffeinate?: boolean;
900
+ }): Promise<number>;
901
+ debug(channelName?: string): Promise<FunnelDebugReport>;
902
+ gatewayClient(): ReturnType<typeof hc<GatewayApp>>;
903
+ }
904
+ //#endregion
905
+ //#region lib/engine/settings/settings-store.d.ts
906
+ /**
907
+ * Resolves the funnel home dir. Defaults to `~/.funnel`, overridable via
908
+ * `FUNNEL_DIR` so a funnel.json-scoped launch can point everything (settings,
909
+ * gateway pid/token, claude pids) at a repo-local `<repo>/.funnel` and never
910
+ * touch the global home. Read at call time, not module load, so a daemon
911
+ * spawned with the env set resolves the override.
912
+ */
913
+ declare function resolveFunnelDir(): string;
914
+ declare const DEFAULT_GATEWAY_PORT = 9742;
915
+ /**
916
+ * Resolves the gateway port. Defaults to 9742 — the port a programmatically
917
+ * hosted gateway (`new Funnel().gatewayServer()`) uses. The `funnel` CLI entry
918
+ * sets `FUNNEL_PORT` to a distinct default so a CLI launch never collides with
919
+ * an embedding app's gateway on 9742. Read at call time so a daemon spawned
920
+ * with the env set resolves the override.
921
+ */
922
+ declare function resolveFunnelPort(): number;
923
+ declare const FUNNEL_DIR: string;
924
+ declare const SETTINGS_PATH: string;
925
+ type Deps = {
926
+ path?: string;
927
+ fs?: FunnelFileSystem;
928
+ idGenerator?: FunnelIdGenerator;
929
+ };
930
+ declare class FunnelSettingsStore extends FunnelSettingsReader {
931
+ private readonly path;
932
+ private readonly fs;
933
+ private readonly idGenerator;
934
+ constructor(deps?: Deps);
935
+ read(): Settings;
936
+ private looksLikeLegacy;
937
+ /**
938
+ * Non-destructive migration for profiles written before `id` existed. Mints a
939
+ * uuid for each profile lacking one and returns whether anything was minted, so
940
+ * `read` can persist it immediately — a profile id must be STABLE across reads,
941
+ * otherwise `setSessionId` (a second read) sees a different id and can't match
942
+ * the one the launch used. Mutates `parsed` in place (freshly JSON-parsed).
943
+ */
944
+ private backfillProfileIds;
945
+ write(settings: Settings): void;
946
+ }
947
+ //#endregion
948
+ //#region lib/engine/settings/mock-settings-reader.d.ts
949
+ declare const createSettings: (partial?: Partial<Settings>) => Settings;
950
+ declare class MockFunnelSettingsReader extends FunnelSettingsReader {
951
+ private state;
952
+ constructor(initial?: Partial<Settings>);
953
+ read(): Settings;
954
+ write(settings: Settings): void;
955
+ }
956
+ //#endregion
957
+ //#region lib/engine/fs/node-file-system.d.ts
958
+ declare class NodeFunnelFileSystem extends FunnelFileSystem {
959
+ constructor();
960
+ existsSync(path: string): boolean;
961
+ readFileSync(path: string): string;
962
+ writeFileSync(path: string, data: string): void;
963
+ writeSecretFileSync(path: string, data: string): void;
964
+ appendFileSync(path: string, data: string): void;
965
+ unlink(path: string): void;
966
+ mkdirSync(path: string, options?: {
967
+ recursive?: boolean;
968
+ }): void;
969
+ readdirSync(path: string): string[];
970
+ statSync(path: string): FileStat;
971
+ }
972
+ //#endregion
973
+ //#region lib/engine/fs/memory-file-system.d.ts
974
+ type Props$4 = {
975
+ dirs?: string[];
976
+ files?: Record<string, string>;
977
+ mtimes?: Record<string, number>;
978
+ modes?: Record<string, number>;
979
+ now?: () => number;
980
+ };
981
+ declare class MemoryFunnelFileSystem extends FunnelFileSystem {
982
+ private readonly dirs;
983
+ private readonly files;
984
+ private readonly mtimes;
985
+ private readonly modes;
986
+ private readonly now;
987
+ constructor(props?: Props$4);
988
+ existsSync(path: string): boolean;
989
+ readFileSync(path: string): string;
990
+ writeFileSync(path: string, data: string): void;
991
+ writeSecretFileSync(path: string, data: string): void;
992
+ appendFileSync(path: string, data: string): void;
993
+ unlink(path: string): void;
994
+ mkdirSync(path: string, options?: {
995
+ recursive?: boolean;
996
+ }): void;
997
+ readdirSync(path: string): string[];
998
+ statSync(path: string): FileStat;
999
+ setMtime(path: string, mtimeMs: number): void;
1000
+ setMode(path: string, mode: number): void;
1001
+ private touch;
1002
+ }
1003
+ //#endregion
1004
+ //#region lib/engine/process/node-process-runner.d.ts
1005
+ declare class NodeFunnelProcessRunner extends FunnelProcessRunner {
1006
+ constructor();
1007
+ runSync(command: string[]): RunResult;
1008
+ run(command: string[], options?: RunOptions): Promise<RunResult>;
1009
+ attach(command: string[], options?: AttachOptions): Promise<number>;
1010
+ detach(command: string[], options?: DetachOptions): void;
1011
+ kill(pid: number, signal?: string): void;
1012
+ isAlive(pid: number): boolean;
1013
+ listProcessesContaining(marker: string): ProcessSnapshot[];
1014
+ private isAlivePosix;
1015
+ private isAliveWindows;
1016
+ private listProcessesContainingPosix;
1017
+ private listProcessesContainingWindows;
1018
+ }
1019
+ //#endregion
1020
+ //#region lib/engine/process/memory-process-runner.d.ts
1021
+ type MemoryProcessResponse = {
1022
+ exitCode?: number;
1023
+ stdout?: string;
1024
+ stderr?: string;
1025
+ };
1026
+ type MemoryProcessHandler = (command: string[]) => MemoryProcessResponse | Promise<MemoryProcessResponse>;
1027
+ type MemoryProcessSyncHandler = (command: string[]) => MemoryProcessResponse;
1028
+ type MemoryProcessCall = {
1029
+ kind: "run";
1030
+ command: string[];
1031
+ options: RunOptions;
1032
+ } | {
1033
+ kind: "runSync";
1034
+ command: string[];
1035
+ } | {
1036
+ kind: "attach";
1037
+ command: string[];
1038
+ options: AttachOptions;
1039
+ } | {
1040
+ kind: "detach";
1041
+ command: string[];
1042
+ options: DetachOptions;
1043
+ } | {
1044
+ kind: "kill";
1045
+ command: string[];
1046
+ };
1047
+ type AliveStub = (pid: number) => boolean;
1048
+ type ProcessListStub = (marker: string) => ProcessSnapshot[];
1049
+ declare class MemoryFunnelProcessRunner extends FunnelProcessRunner {
1050
+ readonly calls: MemoryProcessCall[];
1051
+ readonly killed: {
1052
+ pid: number;
1053
+ signal: string;
1054
+ }[];
1055
+ private handler;
1056
+ private syncHandler;
1057
+ private aliveStub;
1058
+ private listStub;
1059
+ on(handler: MemoryProcessHandler): this;
1060
+ onSync(handler: MemoryProcessSyncHandler): this;
1061
+ onIsAlive(stub: AliveStub): this;
1062
+ onListProcessesContaining(stub: ProcessListStub): this;
1063
+ run(command: string[], options?: RunOptions): Promise<RunResult>;
1064
+ runSync(command: string[]): RunResult;
1065
+ attach(command: string[], options?: AttachOptions): Promise<number>;
1066
+ detach(command: string[], options?: DetachOptions): void;
1067
+ kill(pid: number, signal?: string): void;
1068
+ isAlive(pid: number): boolean;
1069
+ listProcessesContaining(marker: string): ProcessSnapshot[];
1070
+ }
1071
+ //#endregion
1072
+ //#region lib/engine/logger/node-logger.d.ts
1073
+ type Props$3 = {
1074
+ file?: string;
1075
+ now?: () => Date;
1076
+ };
1077
+ declare class NodeFunnelLogger extends FunnelLogger {
1078
+ readonly file: string;
1079
+ private readonly now;
1080
+ constructor(props?: Props$3);
1081
+ info(message: string, meta?: Record<string, unknown>): void;
1082
+ warn(message: string, meta?: Record<string, unknown>): void;
1083
+ error(message: string, meta?: Record<string, unknown>): void;
1084
+ private write;
1085
+ }
1086
+ //#endregion
1087
+ //#region lib/engine/logger/memory-logger.d.ts
1088
+ type LogEntry = {
1089
+ level: "info" | "warn" | "error";
1090
+ message: string;
1091
+ meta?: Record<string, unknown>;
1092
+ };
1093
+ declare class MemoryFunnelLogger extends FunnelLogger {
1094
+ readonly file: null;
1095
+ readonly entries: LogEntry[];
1096
+ info(message: string, meta?: Record<string, unknown>): void;
1097
+ warn(message: string, meta?: Record<string, unknown>): void;
1098
+ error(message: string, meta?: Record<string, unknown>): void;
1099
+ clear(): void;
1100
+ }
1101
+ //#endregion
1102
+ //#region lib/engine/logger/noop-logger.d.ts
1103
+ declare class NoopFunnelLogger extends FunnelLogger {
1104
+ readonly file: null;
1105
+ info(): void;
1106
+ warn(): void;
1107
+ error(): void;
1108
+ }
1109
+ //#endregion
1110
+ //#region lib/engine/time/node-clock.d.ts
1111
+ declare class NodeFunnelClock extends FunnelClock {
1112
+ now(): Date;
1113
+ }
1114
+ //#endregion
1115
+ //#region lib/engine/time/memory-clock.d.ts
1116
+ type Props$2 = {
1117
+ start?: Date;
1118
+ };
1119
+ declare class MemoryFunnelClock extends FunnelClock {
1120
+ private current;
1121
+ constructor(props?: Props$2);
1122
+ now(): Date;
1123
+ set(date: Date): void;
1124
+ advance(ms: number): void;
1125
+ }
1126
+ //#endregion
1127
+ //#region lib/engine/id/node-id-generator.d.ts
1128
+ declare class NodeFunnelIdGenerator extends FunnelIdGenerator {
1129
+ generate(): string;
1130
+ }
1131
+ //#endregion
1132
+ //#region lib/engine/id/memory-id-generator.d.ts
1133
+ type Props$1 = {
1134
+ prefix?: string;
1135
+ };
1136
+ declare class MemoryFunnelIdGenerator extends FunnelIdGenerator {
1137
+ private counter;
1138
+ private readonly prefix;
1139
+ constructor(props?: Props$1);
1140
+ generate(): string;
1141
+ }
1142
+ //#endregion
1143
+ //#region lib/gateway/connector-diagnostic-sql-reader.d.ts
1144
+ type Props = {
1145
+ /** SQLite file holding the raw (pre-filter) table. */rawPath: string; /** SQLite file holding the processed (verdict) table. */
1146
+ processedPath: string; /** SQLite file holding the connection (lifecycle) table. */
1147
+ connectionPath: string;
1148
+ };
1149
+ type Row = Record<string, unknown>;
1150
+ /**
1151
+ * Read-only SQL surface over the three diagnostic tables, for Claude to query
1152
+ * the log with arbitrary `SELECT`s. It opens all files read-only and exposes
1153
+ * three views — `raw`, `processed`, `connection` — that hide the storage
1154
+ * details (the physical table is `leuco_log` and each row's columns live
1155
+ * inside a JSON `event` blob): the views surface the columns as plain fields,
1156
+ * with `payload` already pulled out of the nested JSON.
1157
+ *
1158
+ * The tables are separate files. `raw` and `processed` share an `event_id`,
1159
+ * so a `JOIN` answers "the event arrived, but what verdict did it get?";
1160
+ * `connection` answers the other half — "did the listener ever connect at
1161
+ * all?". Writes are impossible: the connection is read-only and `query`
1162
+ * rejects anything but a single `SELECT`.
1163
+ */
1164
+ declare class ConnectorDiagnosticSqlReader {
1165
+ private readonly db;
1166
+ constructor(props: Props);
1167
+ /**
1168
+ * Run one read-only `SELECT` and return the rows. Returns an `Error` (rather
1169
+ * than throwing) for a non-SELECT statement or a SQL error, so the caller
1170
+ * can surface the message without a stack trace.
1171
+ */
1172
+ query(sql: string, params?: (string | number | null)[]): Row[] | Error;
1173
+ close(): void;
1174
+ }
1175
+ //#endregion
1176
+ //#region lib/cli/factory.d.ts
1177
+ type Env = {
1178
+ Bindings: {
1179
+ funnel: Funnel;
1180
+ claude: FunnelClaude;
1181
+ profiles: FunnelProfiles;
1182
+ localConfig: FunnelLocalConfig;
1183
+ localConfigSync: FunnelLocalConfigSync;
1184
+ };
1185
+ };
1186
+ declare const factory: _$hono_factory0.Factory<Env, string>;
1187
+ //#endregion
1188
+ //#region lib/cli/router/to-request.d.ts
1189
+ declare const toRequest: (args: string[]) => {
1190
+ method: string;
1191
+ path: string;
1192
+ url: string;
1193
+ };
1194
+ //#endregion
1195
+ //#region lib/cli/router/query-to-cli-args.d.ts
1196
+ declare const queryToCliArgs: (url: string, reservedKeys?: string[]) => string[];
1197
+ //#endregion
1198
+ //#region lib/cli/routes/index.d.ts
1199
+ declare const routes: _$hono_hono_base0.HonoBase<Env, {
1200
+ "/claude": {
1201
+ $get: {
1202
+ input: {
1203
+ query: {
1204
+ [x: string]: string | string[];
1205
+ profile?: string | undefined;
1206
+ channel?: string | undefined;
1207
+ };
1208
+ };
1209
+ output: string;
1210
+ outputFormat: "text";
1211
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1212
+ } | {
1213
+ input: {
1214
+ query: {
1215
+ [x: string]: string | string[];
1216
+ profile?: string | undefined;
1217
+ channel?: string | undefined;
1218
+ };
1219
+ };
1220
+ 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.";
1221
+ outputFormat: "text";
1222
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1223
+ };
1224
+ };
1225
+ } & {
1226
+ "/channels": {
1227
+ $get: {
1228
+ input: {
1229
+ query: {
1230
+ json?: "" | "true" | "false" | undefined;
1231
+ };
1232
+ };
1233
+ output: string;
1234
+ outputFormat: "text";
1235
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1236
+ } | {
1237
+ input: {
1238
+ query: {
1239
+ json?: "" | "true" | "false" | undefined;
1240
+ };
1241
+ };
1242
+ output: {
1243
+ id: string;
1244
+ name: string;
1245
+ delivery: "fanout" | "exclusive";
1246
+ connectors: {
1247
+ id: string;
1248
+ name: string;
1249
+ type: "gh" | "discord" | "schedule" | "slack";
1250
+ }[];
1251
+ }[];
1252
+ outputFormat: "json";
1253
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1254
+ };
1255
+ };
1256
+ } & {
1257
+ "/channels/add": {
1258
+ $post: {
1259
+ input: {};
1260
+ output: "funnel channels add — add a channel\n\nusage: funnel channels add <name> [--delivery fanout|exclusive]\n\noptions:\n --delivery routing mode (default fanout):\n fanout every connected client receives every event\n exclusive each event delivered to exactly one client (round-robin)";
1261
+ outputFormat: "text";
1262
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1263
+ };
1264
+ };
1265
+ } & {
1266
+ "/channels/add/:channel": {
1267
+ $post: {
1268
+ input: {
1269
+ param: {
1270
+ channel: string;
1271
+ };
1272
+ } & {
1273
+ query: {
1274
+ delivery?: "fanout" | "exclusive" | undefined;
1275
+ };
1276
+ };
1277
+ output: string;
1278
+ outputFormat: "text";
1279
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1280
+ } | {
1281
+ input: {
1282
+ param: {
1283
+ channel: string;
1284
+ };
1285
+ } & {
1286
+ query: {
1287
+ delivery?: "fanout" | "exclusive" | undefined;
1288
+ };
1289
+ };
1290
+ output: `added channel "${string}" (id: ${string})`;
1291
+ outputFormat: "text";
1292
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1293
+ };
1294
+ };
1295
+ } & {
1296
+ "/channels/remove": {
1297
+ $post: {
1298
+ input: {};
1299
+ output: "funnel channels remove — remove a channel\n\nusage: funnel channels remove <name>";
1300
+ outputFormat: "text";
1301
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1302
+ };
1303
+ };
1304
+ } & {
1305
+ "/channels/remove/:channel": {
1306
+ $post: {
1307
+ input: {
1308
+ param: {
1309
+ channel: string;
1310
+ };
1311
+ } & {
1312
+ query: Record<string, never>;
1313
+ };
1314
+ output: string;
1315
+ outputFormat: "text";
1316
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1317
+ } | {
1318
+ input: {
1319
+ param: {
1320
+ channel: string;
1321
+ };
1322
+ } & {
1323
+ query: Record<string, never>;
1324
+ };
1325
+ output: `removed channel "${string}"`;
1326
+ outputFormat: "text";
1327
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1328
+ };
1329
+ };
1330
+ } & {
1331
+ "/channels/rename/:channel/:newName": {
1332
+ $post: {
1333
+ input: {
1334
+ param: {
1335
+ channel: string;
1336
+ newName: string;
1337
+ };
1338
+ } & {
1339
+ query: Record<string, never>;
1340
+ };
1341
+ output: string;
1342
+ outputFormat: "text";
1343
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1344
+ } | {
1345
+ input: {
1346
+ param: {
1347
+ channel: string;
1348
+ newName: string;
1349
+ };
1350
+ } & {
1351
+ query: Record<string, never>;
1352
+ };
1353
+ output: `renamed channel "${string}" to "${string}"`;
1354
+ outputFormat: "text";
1355
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1356
+ };
1357
+ };
1358
+ } & {
1359
+ "/channels/:channel/rename/:newName": {
1360
+ $post: {
1361
+ input: {
1362
+ param: {
1363
+ channel: string;
1364
+ newName: string;
1365
+ };
1366
+ } & {
1367
+ query: Record<string, never>;
1368
+ };
1369
+ output: string;
1370
+ outputFormat: "text";
1371
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1372
+ } | {
1373
+ input: {
1374
+ param: {
1375
+ channel: string;
1376
+ newName: string;
1377
+ };
1378
+ } & {
1379
+ query: Record<string, never>;
1380
+ };
1381
+ output: `renamed channel "${string}" to "${string}"`;
1382
+ outputFormat: "text";
1383
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1384
+ };
1385
+ };
1386
+ } & {
1387
+ "/channels/rename": {
1388
+ $post: {
1389
+ input: {};
1390
+ output: "funnel channels rename — rename a channel\n\nusage:\n funnel channels rename <old> <new>\n funnel channels <old> rename <new>";
1391
+ outputFormat: "text";
1392
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1393
+ };
1394
+ };
1395
+ } & {
1396
+ "/channels/:channel/rename": {
1397
+ $post: {
1398
+ input: {
1399
+ param: {
1400
+ channel: string;
1401
+ };
1402
+ };
1403
+ output: "funnel channels rename — rename a channel\n\nusage:\n funnel channels rename <old> <new>\n funnel channels <old> rename <new>";
1404
+ outputFormat: "text";
1405
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1406
+ };
1407
+ };
1408
+ } & {
1409
+ "/channels/:channel/set/delivery/:mode": {
1410
+ $post: {
1411
+ input: {
1412
+ param: {
1413
+ channel: string;
1414
+ mode: "fanout" | "exclusive";
1415
+ };
1416
+ };
1417
+ output: string;
1418
+ outputFormat: "text";
1419
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1420
+ } | {
1421
+ input: {
1422
+ param: {
1423
+ channel: string;
1424
+ mode: "fanout" | "exclusive";
1425
+ };
1426
+ };
1427
+ output: `channel "${string}" delivery set to fanout` | `channel "${string}" delivery set to exclusive`;
1428
+ outputFormat: "text";
1429
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1430
+ };
1431
+ };
1432
+ } & {
1433
+ "/channels/publish": {
1434
+ $post: {
1435
+ input: {};
1436
+ output: "funnel channels <channel> publish — push arbitrary content into a channel\n\nusage: funnel channels <channel> publish --content=\"<text>\" [--connector=<name>] [--meta-<key>=<value> ...]\n\noptions:\n --content Required. The event body delivered to subscribers.\n --connector Optional. Stamp the event with a connector name (resolved to id when found).\n --meta-<key> Optional. Repeatable. Added to meta. Example: --meta-source=cron";
1437
+ outputFormat: "text";
1438
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1439
+ };
1440
+ };
1441
+ } & {
1442
+ "/channels/:channel/publish": {
1443
+ $post: {
1444
+ input: {
1445
+ param: {
1446
+ channel: string;
1447
+ };
1448
+ } & {
1449
+ query: {
1450
+ [x: string]: string | string[];
1451
+ content: string | string[];
1452
+ connector?: string | undefined;
1453
+ };
1454
+ };
1455
+ output: string;
1456
+ outputFormat: "text";
1457
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1458
+ } | {
1459
+ input: {
1460
+ param: {
1461
+ channel: string;
1462
+ };
1463
+ } & {
1464
+ query: {
1465
+ [x: string]: string | string[];
1466
+ content: string | string[];
1467
+ connector?: string | undefined;
1468
+ };
1469
+ };
1470
+ output: `published (offset=${number})`;
1471
+ outputFormat: "text";
1472
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1473
+ };
1474
+ };
1475
+ } & {
1476
+ "/channels/:channel/validate": {
1477
+ $get: {
1478
+ input: {
1479
+ param: {
1480
+ channel: string;
1481
+ };
1482
+ } & {
1483
+ query: {
1484
+ json?: "" | "true" | "false" | undefined;
1485
+ };
1486
+ };
1487
+ output: string;
1488
+ outputFormat: "text";
1489
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1490
+ } | {
1491
+ input: {
1492
+ param: {
1493
+ channel: string;
1494
+ };
1495
+ } & {
1496
+ query: {
1497
+ json?: "" | "true" | "false" | undefined;
1498
+ };
1499
+ };
1500
+ output: {
1501
+ channel: string;
1502
+ valid: boolean;
1503
+ issues: {
1504
+ connector: string;
1505
+ field: string;
1506
+ message: string;
1507
+ }[];
1508
+ };
1509
+ outputFormat: "json";
1510
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1511
+ };
1512
+ };
1513
+ } & {
1514
+ "/channels/validate": {
1515
+ $get: {
1516
+ input: {};
1517
+ output: "funnel channels <channel> validate — check connector configuration\n\nusage: funnel channels <channel> validate [--json]\n\noptions:\n --json output as JSON\n\nChecks that each connector has the required tokens and fields set.\nDoes not make any network calls — static config check only.\n\nexamples:\n funnel channels open-karte validate\n funnel channels open-karte validate --json";
1518
+ outputFormat: "text";
1519
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1520
+ };
1521
+ };
1522
+ } & {
1523
+ "/channels/:channel": {
1524
+ $get: {
1525
+ input: {
1526
+ param: {
1527
+ channel: string;
1528
+ };
1529
+ } & {
1530
+ query: Record<string, never>;
1531
+ };
1532
+ output: string;
1533
+ outputFormat: "text";
1534
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1535
+ };
1536
+ };
1537
+ } & {
1538
+ "/channels/:channel/connectors": {
1539
+ $get: {
1540
+ input: {
1541
+ param: {
1542
+ channel: string;
1543
+ };
1544
+ } & {
1545
+ query: Record<string, never>;
1546
+ };
1547
+ output: string;
1548
+ outputFormat: "text";
1549
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1550
+ };
1551
+ };
1552
+ } & {
1553
+ "/channels/:channel/connectors/add": {
1554
+ $post: {
1555
+ input: {
1556
+ param: {
1557
+ channel: string;
1558
+ };
1559
+ };
1560
+ output: "funnel channels <channel> connectors add <connector> — add a connector to a channel\n\nusage:\n funnel channels <channel> connectors add <connector> --type=slack --bot-token=xoxb-... --app-token=xapp-...\n funnel channels <channel> connectors add <connector> --type=gh [--poll-interval=60]\n funnel channels <channel> connectors add <connector> --type=discord --bot-token=...\n funnel channels <channel> connectors add <connector> --type=schedule\n\nToken uniqueness is enforced across all channels.";
1561
+ outputFormat: "text";
1562
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1563
+ };
1564
+ };
1565
+ } & {
1566
+ "/channels/:channel/connectors/add/:connector": {
1567
+ $post: {
1568
+ input: {
1569
+ param: {
1570
+ channel: string;
1571
+ connector: string;
1572
+ };
1573
+ } & {
1574
+ query: {
1575
+ type: string | string[];
1576
+ "bot-token": string | string[];
1577
+ "app-token": string | string[];
1578
+ } | {
1579
+ type: string | string[];
1580
+ "poll-interval"?: string | string[] | undefined;
1581
+ } | {
1582
+ type: string | string[];
1583
+ "bot-token": string | string[];
1584
+ } | {
1585
+ type: string | string[];
1586
+ };
1587
+ };
1588
+ output: string;
1589
+ outputFormat: "text";
1590
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1591
+ } | {
1592
+ input: {
1593
+ param: {
1594
+ channel: string;
1595
+ connector: string;
1596
+ };
1597
+ } & {
1598
+ query: {
1599
+ type: string | string[];
1600
+ "bot-token": string | string[];
1601
+ "app-token": string | string[];
1602
+ } | {
1603
+ type: string | string[];
1604
+ "poll-interval"?: string | string[] | undefined;
1605
+ } | {
1606
+ type: string | string[];
1607
+ "bot-token": string | string[];
1608
+ } | {
1609
+ type: string | string[];
1610
+ };
1611
+ };
1612
+ output: `added slack connector "${string}" to channel "${string}"`;
1613
+ outputFormat: "text";
1614
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1615
+ } | {
1616
+ input: {
1617
+ param: {
1618
+ channel: string;
1619
+ connector: string;
1620
+ };
1621
+ } & {
1622
+ query: {
1623
+ type: string | string[];
1624
+ "bot-token": string | string[];
1625
+ "app-token": string | string[];
1626
+ } | {
1627
+ type: string | string[];
1628
+ "poll-interval"?: string | string[] | undefined;
1629
+ } | {
1630
+ type: string | string[];
1631
+ "bot-token": string | string[];
1632
+ } | {
1633
+ type: string | string[];
1634
+ };
1635
+ };
1636
+ output: `added gh connector "${string}" to channel "${string}"`;
1637
+ outputFormat: "text";
1638
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1639
+ } | {
1640
+ input: {
1641
+ param: {
1642
+ channel: string;
1643
+ connector: string;
1644
+ };
1645
+ } & {
1646
+ query: {
1647
+ type: string | string[];
1648
+ "bot-token": string | string[];
1649
+ "app-token": string | string[];
1650
+ } | {
1651
+ type: string | string[];
1652
+ "poll-interval"?: string | string[] | undefined;
1653
+ } | {
1654
+ type: string | string[];
1655
+ "bot-token": string | string[];
1656
+ } | {
1657
+ type: string | string[];
1658
+ };
1659
+ };
1660
+ output: `added discord connector "${string}" to channel "${string}"`;
1661
+ outputFormat: "text";
1662
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1663
+ } | {
1664
+ input: {
1665
+ param: {
1666
+ channel: string;
1667
+ connector: string;
1668
+ };
1669
+ } & {
1670
+ query: {
1671
+ type: string | string[];
1672
+ "bot-token": string | string[];
1673
+ "app-token": string | string[];
1674
+ } | {
1675
+ type: string | string[];
1676
+ "poll-interval"?: string | string[] | undefined;
1677
+ } | {
1678
+ type: string | string[];
1679
+ "bot-token": string | string[];
1680
+ } | {
1681
+ type: string | string[];
1682
+ };
1683
+ };
1684
+ output: `added schedule connector "${string}" to channel "${string}"`;
1685
+ outputFormat: "text";
1686
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1687
+ };
1688
+ };
1689
+ } & {
1690
+ "/channels/:channel/connectors/remove": {
1691
+ $post: {
1692
+ input: {
1693
+ param: {
1694
+ channel: string;
1695
+ };
1696
+ };
1697
+ output: "funnel channels <channel> connectors remove <connector> — remove a connector\n\nusage: funnel channels <channel> connectors remove <connector>";
1698
+ outputFormat: "text";
1699
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1700
+ };
1701
+ };
1702
+ } & {
1703
+ "/channels/:channel/connectors/remove/:connector": {
1704
+ $post: {
1705
+ input: {
1706
+ param: {
1707
+ channel: string;
1708
+ connector: string;
1709
+ };
1710
+ } & {
1711
+ query: Record<string, never>;
1712
+ };
1713
+ output: string;
1714
+ outputFormat: "text";
1715
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1716
+ } | {
1717
+ input: {
1718
+ param: {
1719
+ channel: string;
1720
+ connector: string;
1721
+ };
1722
+ } & {
1723
+ query: Record<string, never>;
1724
+ };
1725
+ output: `removed connector "${string}" from channel "${string}"`;
1726
+ outputFormat: "text";
1727
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1728
+ };
1729
+ };
1730
+ } & {
1731
+ "/channels/:channel/connectors/set": {
1732
+ $post: {
1733
+ input: {
1734
+ param: {
1735
+ channel: string;
1736
+ };
1737
+ };
1738
+ output: "funnel channels <channel> connectors set <connector> — update connector fields\n\nusage:\n funnel channels <ch> connectors set <conn> [--bot-token=...] [--app-token=...] # slack\n funnel channels <ch> connectors set <conn> [--bot-token=...] # discord\n funnel channels <ch> connectors set <conn> [--poll-interval=N] # gh";
1739
+ outputFormat: "text";
1740
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1741
+ };
1742
+ };
1743
+ } & {
1744
+ "/channels/:channel/connectors/set/:connector": {
1745
+ $post: {
1746
+ input: {
1747
+ param: {
1748
+ channel: string;
1749
+ connector: string;
1750
+ };
1751
+ } & {
1752
+ query: {
1753
+ [x: string]: string | string[];
1754
+ "bot-token"?: string | undefined;
1755
+ "app-token"?: string | undefined;
1756
+ "poll-interval"?: string | string[] | undefined;
1757
+ };
1758
+ };
1759
+ output: string;
1760
+ outputFormat: "text";
1761
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1762
+ } | {
1763
+ input: {
1764
+ param: {
1765
+ channel: string;
1766
+ connector: string;
1767
+ };
1768
+ } & {
1769
+ query: {
1770
+ [x: string]: string | string[];
1771
+ "bot-token"?: string | undefined;
1772
+ "app-token"?: string | undefined;
1773
+ "poll-interval"?: string | string[] | undefined;
1774
+ };
1775
+ };
1776
+ output: `updated connector "${string}" in channel "${string}"`;
1777
+ outputFormat: "text";
1778
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1779
+ };
1780
+ };
1781
+ } & {
1782
+ "/channels/:channel/connectors/rename/:connector/:newName": {
1783
+ $post: {
1784
+ input: {
1785
+ param: {
1786
+ channel: string;
1787
+ connector: string;
1788
+ newName: string;
1789
+ };
1790
+ } & {
1791
+ query: Record<string, never>;
1792
+ };
1793
+ output: string;
1794
+ outputFormat: "text";
1795
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1796
+ } | {
1797
+ input: {
1798
+ param: {
1799
+ channel: string;
1800
+ connector: string;
1801
+ newName: string;
1802
+ };
1803
+ } & {
1804
+ query: Record<string, never>;
1805
+ };
1806
+ output: `renamed connector "${string}" to "${string}"`;
1807
+ outputFormat: "text";
1808
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1809
+ };
1810
+ };
1811
+ } & {
1812
+ "/channels/:channel/connectors/:connector/rename/:newName": {
1813
+ $post: {
1814
+ input: {
1815
+ param: {
1816
+ channel: string;
1817
+ connector: string;
1818
+ newName: string;
1819
+ };
1820
+ } & {
1821
+ query: Record<string, never>;
1822
+ };
1823
+ output: string;
1824
+ outputFormat: "text";
1825
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1826
+ } | {
1827
+ input: {
1828
+ param: {
1829
+ channel: string;
1830
+ connector: string;
1831
+ newName: string;
1832
+ };
1833
+ } & {
1834
+ query: Record<string, never>;
1835
+ };
1836
+ output: `renamed connector "${string}" to "${string}"`;
1837
+ outputFormat: "text";
1838
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1839
+ };
1840
+ };
1841
+ } & {
1842
+ "/channels/:channel/connectors/rename": {
1843
+ $post: {
1844
+ input: {
1845
+ param: {
1846
+ channel: string;
1847
+ };
1848
+ };
1849
+ output: "funnel channels <channel> connectors rename <connector> <new-name>\n\nusage: funnel channels <channel> connectors rename <connector> <new-name>";
1850
+ outputFormat: "text";
1851
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1852
+ };
1853
+ };
1854
+ } & {
1855
+ "/channels/:channel/connectors/:connector/rename": {
1856
+ $post: {
1857
+ input: {
1858
+ param: {
1859
+ channel: string;
1860
+ } & {
1861
+ connector: string;
1862
+ };
1863
+ };
1864
+ output: "funnel channels <channel> connectors rename <connector> <new-name>\n\nusage: funnel channels <channel> connectors rename <connector> <new-name>";
1865
+ outputFormat: "text";
1866
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1867
+ };
1868
+ };
1869
+ } & {
1870
+ "/channels/:channel/connectors/:connector/request": {
1871
+ $post: {
1872
+ input: {
1873
+ param: {
1874
+ channel: string;
1875
+ connector: string;
1876
+ };
1877
+ } & {
1878
+ query: {
1879
+ [x: string]: string | string[];
1880
+ method: string | string[];
1881
+ };
1882
+ };
1883
+ output: string;
1884
+ outputFormat: "text";
1885
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1886
+ };
1887
+ };
1888
+ } & {
1889
+ "/channels/:channel/connectors/:connector": {
1890
+ $get: {
1891
+ input: {
1892
+ param: {
1893
+ channel: string;
1894
+ connector: string;
1895
+ };
1896
+ } & {
1897
+ query: Record<string, never>;
1898
+ };
1899
+ output: string;
1900
+ outputFormat: "text";
1901
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1902
+ };
1903
+ };
1904
+ } & {
1905
+ "/channels/:channel/connectors/:connector/schedules": {
1906
+ $get: {
1907
+ input: {
1908
+ param: {
1909
+ channel: string;
1910
+ connector: string;
1911
+ };
1912
+ } & {
1913
+ query: Record<string, never>;
1914
+ };
1915
+ output: string;
1916
+ outputFormat: "text";
1917
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1918
+ };
1919
+ };
1920
+ } & {
1921
+ "/channels/:channel/connectors/:connector/schedules/add": {
1922
+ $post: {
1923
+ input: {
1924
+ param: {
1925
+ channel: string;
1926
+ } & {
1927
+ connector: string;
1928
+ };
1929
+ };
1930
+ output: "funnel channels <ch> connectors <conn> schedules add <id> — add a schedule entry\n\nusage: funnel channels <ch> connectors <conn> schedules add <id> --cron=\"*/5 * * * *\" --prompt=\"...\" [--enabled=true] [--catchup-policy=latest|all|skip]";
1931
+ outputFormat: "text";
1932
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1933
+ };
1934
+ };
1935
+ } & {
1936
+ "/channels/:channel/connectors/:connector/schedules/add/:id": {
1937
+ $post: {
1938
+ input: {
1939
+ param: {
1940
+ channel: string;
1941
+ connector: string;
1942
+ id: string;
1943
+ };
1944
+ } & {
1945
+ query: {
1946
+ cron: string | string[];
1947
+ prompt: string | string[];
1948
+ enabled?: string | string[] | undefined;
1949
+ "catchup-policy"?: "latest" | "all" | "skip" | undefined;
1950
+ };
1951
+ };
1952
+ output: string;
1953
+ outputFormat: "text";
1954
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1955
+ } | {
1956
+ input: {
1957
+ param: {
1958
+ channel: string;
1959
+ connector: string;
1960
+ id: string;
1961
+ };
1962
+ } & {
1963
+ query: {
1964
+ cron: string | string[];
1965
+ prompt: string | string[];
1966
+ enabled?: string | string[] | undefined;
1967
+ "catchup-policy"?: "latest" | "all" | "skip" | undefined;
1968
+ };
1969
+ };
1970
+ output: `added schedule entry "${string}"`;
1971
+ outputFormat: "text";
1972
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1973
+ };
1974
+ };
1975
+ } & {
1976
+ "/channels/:channel/connectors/:connector/schedules/remove": {
1977
+ $post: {
1978
+ input: {
1979
+ param: {
1980
+ channel: string;
1981
+ } & {
1982
+ connector: string;
1983
+ };
1984
+ };
1985
+ output: "funnel channels <ch> connectors <conn> schedules remove <id>\n\nusage: funnel channels <ch> connectors <conn> schedules remove <id>";
1986
+ outputFormat: "text";
1987
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
1988
+ };
1989
+ };
1990
+ } & {
1991
+ "/channels/:channel/connectors/:connector/schedules/remove/:id": {
1992
+ $post: {
1993
+ input: {
1994
+ param: {
1995
+ channel: string;
1996
+ connector: string;
1997
+ id: string;
1998
+ };
1999
+ } & {
2000
+ query: Record<string, never>;
2001
+ };
2002
+ output: string;
2003
+ outputFormat: "text";
2004
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2005
+ } | {
2006
+ input: {
2007
+ param: {
2008
+ channel: string;
2009
+ connector: string;
2010
+ id: string;
2011
+ };
2012
+ } & {
2013
+ query: Record<string, never>;
2014
+ };
2015
+ output: `removed schedule entry "${string}"`;
2016
+ outputFormat: "text";
2017
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2018
+ };
2019
+ };
2020
+ } & {
2021
+ "/profiles": {
2022
+ $get: {
2023
+ input: {
2024
+ query: Record<string, never>;
2025
+ };
2026
+ output: string;
2027
+ outputFormat: "text";
2028
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2029
+ };
2030
+ };
2031
+ } & {
2032
+ "/profiles/add": {
2033
+ $post: {
2034
+ input: {};
2035
+ output: "funnel profiles add — add a profile\n\nusage: funnel profiles add <name> --path <path> --channel <channel-name> [recipe]\n\noptions:\n --path working directory passed to claude as cwd\n --channel channel name (resolved to channel id internally)\n --agent sub-agent name, prepended to the launch argv as --agent <name>\n --options extra launch argv as one whitespace-split string (e.g. \"--brief\")\n --env env vars layered under the process, as \"KEY=VAL,KEY2=VAL2\"\n --no-resume start a fresh claude session every launch (default resumes)\n\nThe launch recipe (--agent / --options / --env / --resume) lives on the\nprofile; the channel only declares transport (connectors / delivery).";
2036
+ outputFormat: "text";
2037
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2038
+ };
2039
+ };
2040
+ } & {
2041
+ "/profiles/add/:profile": {
2042
+ $post: {
2043
+ input: {
2044
+ param: {
2045
+ profile: string;
2046
+ };
2047
+ } & {
2048
+ query: {
2049
+ path: string;
2050
+ channel: string;
2051
+ agent?: string | undefined;
2052
+ options?: string | undefined;
2053
+ env?: string | undefined;
2054
+ resume?: string | undefined;
2055
+ "no-resume"?: string | undefined;
2056
+ };
2057
+ };
2058
+ output: string;
2059
+ outputFormat: "text";
2060
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2061
+ } | {
2062
+ input: {
2063
+ param: {
2064
+ profile: string;
2065
+ };
2066
+ } & {
2067
+ query: {
2068
+ path: string;
2069
+ channel: string;
2070
+ agent?: string | undefined;
2071
+ options?: string | undefined;
2072
+ env?: string | undefined;
2073
+ resume?: string | undefined;
2074
+ "no-resume"?: string | undefined;
2075
+ };
2076
+ };
2077
+ output: `added profile "${string}"`;
2078
+ outputFormat: "text";
2079
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2080
+ };
2081
+ };
2082
+ } & {
2083
+ "/profiles/set": {
2084
+ $post: {
2085
+ input: {};
2086
+ output: "funnel profiles <name> set — update a profile\n\nusage: funnel profiles <name> set [--path <path>] [--channel <channel-name>] [recipe]\n\noptions:\n --path working directory passed to claude as cwd\n --channel channel name (resolved to channel id internally)\n --agent sub-agent name, prepended to the launch argv as --agent <name>\n --options extra launch argv as one whitespace-split string (e.g. \"--brief\")\n --env env vars layered under the process, as \"KEY=VAL,KEY2=VAL2\"\n --resume / --no-resume toggle claude session reuse\n\nOnly the flags you pass are changed; --agent and --options together replace\nthe profile's whole options list.";
2087
+ outputFormat: "text";
2088
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2089
+ };
2090
+ };
2091
+ } & {
2092
+ "/profiles/set/:profile": {
2093
+ $post: {
2094
+ input: {
2095
+ param: {
2096
+ profile: string;
2097
+ };
2098
+ } & {
2099
+ query: {
2100
+ path?: string | undefined;
2101
+ channel?: string | undefined;
2102
+ agent?: string | undefined;
2103
+ options?: string | undefined;
2104
+ env?: string | undefined;
2105
+ resume?: string | undefined;
2106
+ "no-resume"?: string | undefined;
2107
+ };
2108
+ };
2109
+ output: string;
2110
+ outputFormat: "text";
2111
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2112
+ } | {
2113
+ input: {
2114
+ param: {
2115
+ profile: string;
2116
+ };
2117
+ } & {
2118
+ query: {
2119
+ path?: string | undefined;
2120
+ channel?: string | undefined;
2121
+ agent?: string | undefined;
2122
+ options?: string | undefined;
2123
+ env?: string | undefined;
2124
+ resume?: string | undefined;
2125
+ "no-resume"?: string | undefined;
2126
+ };
2127
+ };
2128
+ output: `updated profile "${string}"`;
2129
+ outputFormat: "text";
2130
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2131
+ };
2132
+ };
2133
+ } & {
2134
+ "/profiles/remove": {
2135
+ $post: {
2136
+ input: {};
2137
+ output: "funnel profiles remove — remove a profile\n\nusage: funnel profiles remove <name>";
2138
+ outputFormat: "text";
2139
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2140
+ };
2141
+ };
2142
+ } & {
2143
+ "/profiles/remove/:profile": {
2144
+ $post: {
2145
+ input: {
2146
+ param: {
2147
+ profile: string;
2148
+ };
2149
+ } & {
2150
+ query: Record<string, never>;
2151
+ };
2152
+ output: string;
2153
+ outputFormat: "text";
2154
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2155
+ } | {
2156
+ input: {
2157
+ param: {
2158
+ profile: string;
2159
+ };
2160
+ } & {
2161
+ query: Record<string, never>;
2162
+ };
2163
+ output: `removed profile "${string}"`;
2164
+ outputFormat: "text";
2165
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2166
+ };
2167
+ };
2168
+ } & {
2169
+ "/profiles/rename/:profile/:newName": {
2170
+ $post: {
2171
+ input: {
2172
+ param: {
2173
+ profile: string;
2174
+ newName: string;
2175
+ };
2176
+ } & {
2177
+ query: Record<string, never>;
2178
+ };
2179
+ output: string;
2180
+ outputFormat: "text";
2181
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2182
+ } | {
2183
+ input: {
2184
+ param: {
2185
+ profile: string;
2186
+ newName: string;
2187
+ };
2188
+ } & {
2189
+ query: Record<string, never>;
2190
+ };
2191
+ output: `renamed profile "${string}" to "${string}"`;
2192
+ outputFormat: "text";
2193
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2194
+ };
2195
+ };
2196
+ } & {
2197
+ "/profiles/:profile/rename/:newName": {
2198
+ $post: {
2199
+ input: {
2200
+ param: {
2201
+ profile: string;
2202
+ newName: string;
2203
+ };
2204
+ } & {
2205
+ query: Record<string, never>;
2206
+ };
2207
+ output: string;
2208
+ outputFormat: "text";
2209
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2210
+ } | {
2211
+ input: {
2212
+ param: {
2213
+ profile: string;
2214
+ newName: string;
2215
+ };
2216
+ } & {
2217
+ query: Record<string, never>;
2218
+ };
2219
+ output: `renamed profile "${string}" to "${string}"`;
2220
+ outputFormat: "text";
2221
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2222
+ };
2223
+ };
2224
+ } & {
2225
+ "/profiles/rename": {
2226
+ $post: {
2227
+ input: {};
2228
+ output: "funnel profiles rename — rename a profile\n\nusage:\n funnel profiles rename <old> <new>\n funnel profiles <old> rename <new>";
2229
+ outputFormat: "text";
2230
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2231
+ };
2232
+ };
2233
+ } & {
2234
+ "/profiles/:profile/rename": {
2235
+ $post: {
2236
+ input: {
2237
+ param: {
2238
+ profile: string;
2239
+ };
2240
+ };
2241
+ output: "funnel profiles rename — rename a profile\n\nusage:\n funnel profiles rename <old> <new>\n funnel profiles <old> rename <new>";
2242
+ outputFormat: "text";
2243
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2244
+ };
2245
+ };
2246
+ } & {
2247
+ "/profiles/:profile/as-default": {
2248
+ $post: {
2249
+ input: {
2250
+ param: {
2251
+ profile: string;
2252
+ };
2253
+ } & {
2254
+ query: Record<string, never>;
2255
+ };
2256
+ output: string;
2257
+ outputFormat: "text";
2258
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2259
+ } | {
2260
+ input: {
2261
+ param: {
2262
+ profile: string;
2263
+ };
2264
+ } & {
2265
+ query: Record<string, never>;
2266
+ };
2267
+ output: `profile "${string}" is now the default`;
2268
+ outputFormat: "text";
2269
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2270
+ };
2271
+ };
2272
+ } & {
2273
+ "/profiles/:profile/run": {
2274
+ $get: {
2275
+ input: {
2276
+ param: {
2277
+ profile: string;
2278
+ };
2279
+ } & {
2280
+ query: {
2281
+ [x: string]: string | string[];
2282
+ };
2283
+ };
2284
+ output: string;
2285
+ outputFormat: "text";
2286
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2287
+ } | {
2288
+ input: {
2289
+ param: {
2290
+ profile: string;
2291
+ };
2292
+ } & {
2293
+ query: {
2294
+ [x: string]: string | string[];
2295
+ };
2296
+ };
2297
+ output: Promise<never>;
2298
+ outputFormat: "json";
2299
+ status: _$hono_utils_http_status0.StatusCode;
2300
+ };
2301
+ };
2302
+ } & {
2303
+ "/profiles/:profile": {
2304
+ $get: {
2305
+ input: {
2306
+ param: {
2307
+ profile: string;
2308
+ };
2309
+ } & {
2310
+ query: {
2311
+ [x: string]: string | string[];
2312
+ };
2313
+ };
2314
+ output: string;
2315
+ outputFormat: "text";
2316
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2317
+ } | {
2318
+ input: {
2319
+ param: {
2320
+ profile: string;
2321
+ };
2322
+ } & {
2323
+ query: {
2324
+ [x: string]: string | string[];
2325
+ };
2326
+ };
2327
+ output: Promise<never>;
2328
+ outputFormat: "json";
2329
+ status: _$hono_utils_http_status0.StatusCode;
2330
+ };
2331
+ };
2332
+ } & {
2333
+ "/gateway": {
2334
+ $get: {
2335
+ input: {};
2336
+ output: string;
2337
+ outputFormat: "text";
2338
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2339
+ };
2340
+ };
2341
+ } & {
2342
+ "/gateway/status": {
2343
+ $get: {
2344
+ input: {
2345
+ query: {
2346
+ json?: "" | "true" | "false" | undefined;
2347
+ };
2348
+ };
2349
+ output: string;
2350
+ outputFormat: "text";
2351
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2352
+ } | {
2353
+ input: {
2354
+ query: {
2355
+ json?: "" | "true" | "false" | undefined;
2356
+ };
2357
+ };
2358
+ output: {
2359
+ running: true;
2360
+ port: number;
2361
+ };
2362
+ outputFormat: "json";
2363
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2364
+ };
2365
+ };
2366
+ } & {
2367
+ "/gateway/start": {
2368
+ $get: {
2369
+ input: {
2370
+ query: {
2371
+ "no-caffeine"?: string | undefined;
2372
+ };
2373
+ };
2374
+ output: string;
2375
+ outputFormat: "text";
2376
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2377
+ } | {
2378
+ input: {
2379
+ query: {
2380
+ "no-caffeine"?: string | undefined;
2381
+ };
2382
+ };
2383
+ output: "funnel gateway: already running (pid null)" | `funnel gateway: already running (pid ${number})`;
2384
+ outputFormat: "text";
2385
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2386
+ } | {
2387
+ input: {
2388
+ query: {
2389
+ "no-caffeine"?: string | undefined;
2390
+ };
2391
+ };
2392
+ output: "funnel gateway: started";
2393
+ outputFormat: "text";
2394
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2395
+ };
2396
+ };
2397
+ } & {
2398
+ "/gateway/stop": {
2399
+ $get: {
2400
+ input: {
2401
+ query: Record<string, never>;
2402
+ };
2403
+ output: string;
2404
+ outputFormat: "text";
2405
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2406
+ } | {
2407
+ input: {
2408
+ query: Record<string, never>;
2409
+ };
2410
+ output: "funnel gateway: no running process";
2411
+ outputFormat: "text";
2412
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2413
+ } | {
2414
+ input: {
2415
+ query: Record<string, never>;
2416
+ };
2417
+ output: "funnel gateway: stopped";
2418
+ outputFormat: "text";
2419
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2420
+ };
2421
+ };
2422
+ } & {
2423
+ "/gateway/restart": {
2424
+ $get: {
2425
+ input: {
2426
+ query: {
2427
+ "no-caffeine"?: string | undefined;
2428
+ };
2429
+ };
2430
+ output: string;
2431
+ outputFormat: "text";
2432
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2433
+ };
2434
+ };
2435
+ } & {
2436
+ "/gateway/run": {
2437
+ $get: {
2438
+ input: {
2439
+ query: {
2440
+ "no-caffeine"?: string | undefined;
2441
+ };
2442
+ };
2443
+ output: string;
2444
+ outputFormat: "text";
2445
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2446
+ } | {
2447
+ input: {
2448
+ query: {
2449
+ "no-caffeine"?: string | undefined;
2450
+ };
2451
+ };
2452
+ output: Promise<never>;
2453
+ outputFormat: "json";
2454
+ status: _$hono_utils_http_status0.StatusCode;
2455
+ };
2456
+ };
2457
+ } & {
2458
+ "/gateway/logs": {
2459
+ $get: {
2460
+ input: {
2461
+ query: {
2462
+ n?: string | undefined;
2463
+ format?: "json" | "plain" | undefined;
2464
+ };
2465
+ };
2466
+ output: string;
2467
+ outputFormat: "text";
2468
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2469
+ } | {
2470
+ input: {
2471
+ query: {
2472
+ n?: string | undefined;
2473
+ format?: "json" | "plain" | undefined;
2474
+ };
2475
+ };
2476
+ output: "no logs";
2477
+ outputFormat: "text";
2478
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2479
+ };
2480
+ };
2481
+ } & {
2482
+ "/gateway/sql": {
2483
+ $get: {
2484
+ input: {
2485
+ query: {
2486
+ query?: string | undefined;
2487
+ preset?: string | undefined;
2488
+ channel?: string | undefined;
2489
+ limit?: string | undefined;
2490
+ };
2491
+ };
2492
+ output: string;
2493
+ outputFormat: "text";
2494
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2495
+ };
2496
+ };
2497
+ } & {
2498
+ "/gateway/listeners": {
2499
+ $get: {
2500
+ input: {
2501
+ query: Record<string, never>;
2502
+ };
2503
+ output: string;
2504
+ outputFormat: "text";
2505
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2506
+ } | {
2507
+ input: {
2508
+ query: Record<string, never>;
2509
+ };
2510
+ output: "funnel gateway: no running listeners";
2511
+ outputFormat: "text";
2512
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2513
+ } | {
2514
+ input: {
2515
+ query: Record<string, never>;
2516
+ };
2517
+ output: `funnel gateway: running listeners
2518
+ ${string}`;
2519
+ outputFormat: "text";
2520
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2521
+ };
2522
+ };
2523
+ } & {
2524
+ "/debug": {
2525
+ $get: {
2526
+ input: {
2527
+ query: {
2528
+ channel?: string | undefined;
2529
+ all?: "" | "true" | "false" | undefined;
2530
+ json?: "" | "true" | "false" | undefined;
2531
+ limit?: string | undefined;
2532
+ };
2533
+ };
2534
+ output: string;
2535
+ outputFormat: "text";
2536
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2537
+ } | {
2538
+ input: {
2539
+ query: {
2540
+ channel?: string | undefined;
2541
+ all?: "" | "true" | "false" | undefined;
2542
+ json?: "" | "true" | "false" | undefined;
2543
+ limit?: string | undefined;
2544
+ };
2545
+ };
2546
+ output: {
2547
+ error: string;
2548
+ nextAction: string;
2549
+ };
2550
+ outputFormat: "json";
2551
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2552
+ } | {
2553
+ input: {
2554
+ query: {
2555
+ channel?: string | undefined;
2556
+ all?: "" | "true" | "false" | undefined;
2557
+ json?: "" | "true" | "false" | undefined;
2558
+ limit?: string | undefined;
2559
+ };
2560
+ };
2561
+ output: {
2562
+ summary: {
2563
+ total: number;
2564
+ ok: number;
2565
+ warn: number;
2566
+ error: number;
2567
+ criticalChannels: string[];
2568
+ warnChannels: string[];
2569
+ suggestedActions: string[];
2570
+ };
2571
+ channels: {
2572
+ channel: string;
2573
+ gateway: {
2574
+ running: boolean;
2575
+ pid: number | null;
2576
+ port: number | null;
2577
+ uptimeMs: number | null;
2578
+ };
2579
+ listeners: {
2580
+ name: string;
2581
+ type: string;
2582
+ alive: boolean;
2583
+ events: number;
2584
+ errors: number;
2585
+ lastEventAt: string | null;
2586
+ }[];
2587
+ claudeClients: number;
2588
+ channelId: string;
2589
+ recentEvents: {
2590
+ seq: number | null;
2591
+ ts: number | null;
2592
+ type: string;
2593
+ outcome: string;
2594
+ eventId: string | null;
2595
+ payload: string | null;
2596
+ payloadParsed: {
2597
+ [x: string]: _$hono_utils_types0.JSONValue;
2598
+ } | null;
2599
+ preview: string | null;
2600
+ }[];
2601
+ connectionErrors: {
2602
+ seq: number | null;
2603
+ ts: number | null;
2604
+ type: string;
2605
+ status: string;
2606
+ detail: string | null;
2607
+ }[];
2608
+ diagnosis: {
2609
+ status: "ok" | "warn" | "error";
2610
+ message: string;
2611
+ nextActions: string[];
2612
+ rootCause: string | null;
2613
+ };
2614
+ }[];
2615
+ };
2616
+ outputFormat: "json";
2617
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2618
+ } | {
2619
+ input: {
2620
+ query: {
2621
+ channel?: string | undefined;
2622
+ all?: "" | "true" | "false" | undefined;
2623
+ json?: "" | "true" | "false" | undefined;
2624
+ limit?: string | undefined;
2625
+ };
2626
+ };
2627
+ output: {
2628
+ error: string;
2629
+ availableChannels: string[];
2630
+ };
2631
+ outputFormat: "json";
2632
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2633
+ } | {
2634
+ input: {
2635
+ query: {
2636
+ channel?: string | undefined;
2637
+ all?: "" | "true" | "false" | undefined;
2638
+ json?: "" | "true" | "false" | undefined;
2639
+ limit?: string | undefined;
2640
+ };
2641
+ };
2642
+ output: {
2643
+ error: string;
2644
+ channels: string[];
2645
+ hint: string;
2646
+ };
2647
+ outputFormat: "json";
2648
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2649
+ } | {
2650
+ input: {
2651
+ query: {
2652
+ channel?: string | undefined;
2653
+ all?: "" | "true" | "false" | undefined;
2654
+ json?: "" | "true" | "false" | undefined;
2655
+ limit?: string | undefined;
2656
+ };
2657
+ };
2658
+ output: {
2659
+ channel: string;
2660
+ gateway: {
2661
+ running: boolean;
2662
+ pid: number | null;
2663
+ port: number | null;
2664
+ uptimeMs: number | null;
2665
+ };
2666
+ listeners: {
2667
+ name: string;
2668
+ type: string;
2669
+ alive: boolean;
2670
+ events: number;
2671
+ errors: number;
2672
+ lastEventAt: string | null;
2673
+ }[];
2674
+ claudeClients: number;
2675
+ channelId: string;
2676
+ recentEvents: {
2677
+ seq: number | null;
2678
+ ts: number | null;
2679
+ type: string;
2680
+ outcome: string;
2681
+ eventId: string | null;
2682
+ payload: string | null;
2683
+ payloadParsed: {
2684
+ [x: string]: _$hono_utils_types0.JSONValue;
2685
+ } | null;
2686
+ preview: string | null;
2687
+ }[];
2688
+ connectionErrors: {
2689
+ seq: number | null;
2690
+ ts: number | null;
2691
+ type: string;
2692
+ status: string;
2693
+ detail: string | null;
2694
+ }[];
2695
+ diagnosis: {
2696
+ status: "ok" | "warn" | "error";
2697
+ message: string;
2698
+ nextActions: string[];
2699
+ rootCause: string | null;
2700
+ };
2701
+ };
2702
+ outputFormat: "json";
2703
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2704
+ };
2705
+ };
2706
+ } & {
2707
+ "/debug/events": {
2708
+ $get: {
2709
+ input: {
2710
+ query: {
2711
+ channel?: string | undefined;
2712
+ limit?: string | undefined;
2713
+ json?: "" | "true" | "false" | undefined;
2714
+ };
2715
+ };
2716
+ output: string;
2717
+ outputFormat: "text";
2718
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2719
+ } | {
2720
+ input: {
2721
+ query: {
2722
+ channel?: string | undefined;
2723
+ limit?: string | undefined;
2724
+ json?: "" | "true" | "false" | undefined;
2725
+ };
2726
+ };
2727
+ output: {
2728
+ error: string;
2729
+ availableChannels: string[];
2730
+ };
2731
+ outputFormat: "json";
2732
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2733
+ } | {
2734
+ input: {
2735
+ query: {
2736
+ channel?: string | undefined;
2737
+ limit?: string | undefined;
2738
+ json?: "" | "true" | "false" | undefined;
2739
+ };
2740
+ };
2741
+ output: {
2742
+ error: string;
2743
+ channels: string[];
2744
+ };
2745
+ outputFormat: "json";
2746
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2747
+ } | {
2748
+ input: {
2749
+ query: {
2750
+ channel?: string | undefined;
2751
+ limit?: string | undefined;
2752
+ json?: "" | "true" | "false" | undefined;
2753
+ };
2754
+ };
2755
+ output: {
2756
+ seq: number | null;
2757
+ ts: number | null;
2758
+ type: string;
2759
+ outcome: string;
2760
+ eventId: string | null;
2761
+ payload: string | null;
2762
+ payloadParsed: {
2763
+ [x: string]: _$hono_utils_types0.JSONValue;
2764
+ } | null;
2765
+ preview: string | null;
2766
+ }[];
2767
+ outputFormat: "json";
2768
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2769
+ };
2770
+ };
2771
+ } & {
2772
+ "/debug/dropped": {
2773
+ $get: {
2774
+ input: {
2775
+ query: {
2776
+ channel?: string | undefined;
2777
+ limit?: string | undefined;
2778
+ json?: "" | "true" | "false" | undefined;
2779
+ };
2780
+ };
2781
+ output: string;
2782
+ outputFormat: "text";
2783
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2784
+ } | {
2785
+ input: {
2786
+ query: {
2787
+ channel?: string | undefined;
2788
+ limit?: string | undefined;
2789
+ json?: "" | "true" | "false" | undefined;
2790
+ };
2791
+ };
2792
+ output: {
2793
+ seq: number | null;
2794
+ ts: number | null;
2795
+ type: string;
2796
+ outcome: string;
2797
+ eventId: string | null;
2798
+ payload: string | null;
2799
+ payloadParsed: {
2800
+ [x: string]: _$hono_utils_types0.JSONValue;
2801
+ } | null;
2802
+ preview: string | null;
2803
+ }[];
2804
+ outputFormat: "json";
2805
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2806
+ } | {
2807
+ input: {
2808
+ query: {
2809
+ channel?: string | undefined;
2810
+ limit?: string | undefined;
2811
+ json?: "" | "true" | "false" | undefined;
2812
+ };
2813
+ };
2814
+ output: {
2815
+ error: string;
2816
+ availableChannels: string[];
2817
+ };
2818
+ outputFormat: "json";
2819
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2820
+ } | {
2821
+ input: {
2822
+ query: {
2823
+ channel?: string | undefined;
2824
+ limit?: string | undefined;
2825
+ json?: "" | "true" | "false" | undefined;
2826
+ };
2827
+ };
2828
+ output: {
2829
+ error: string;
2830
+ channels: string[];
2831
+ };
2832
+ outputFormat: "json";
2833
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2834
+ };
2835
+ };
2836
+ } & {
2837
+ "/debug/errors": {
2838
+ $get: {
2839
+ input: {
2840
+ query: {
2841
+ channel?: string | undefined;
2842
+ limit?: string | undefined;
2843
+ json?: "" | "true" | "false" | undefined;
2844
+ };
2845
+ };
2846
+ output: string;
2847
+ outputFormat: "text";
2848
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2849
+ } | {
2850
+ input: {
2851
+ query: {
2852
+ channel?: string | undefined;
2853
+ limit?: string | undefined;
2854
+ json?: "" | "true" | "false" | undefined;
2855
+ };
2856
+ };
2857
+ output: {
2858
+ error: string;
2859
+ availableChannels: string[];
2860
+ };
2861
+ outputFormat: "json";
2862
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2863
+ } | {
2864
+ input: {
2865
+ query: {
2866
+ channel?: string | undefined;
2867
+ limit?: string | undefined;
2868
+ json?: "" | "true" | "false" | undefined;
2869
+ };
2870
+ };
2871
+ output: {
2872
+ error: string;
2873
+ channels: string[];
2874
+ };
2875
+ outputFormat: "json";
2876
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2877
+ } | {
2878
+ input: {
2879
+ query: {
2880
+ channel?: string | undefined;
2881
+ limit?: string | undefined;
2882
+ json?: "" | "true" | "false" | undefined;
2883
+ };
2884
+ };
2885
+ output: {
2886
+ seq: number | null;
2887
+ ts: number | null;
2888
+ type: string;
2889
+ status: string;
2890
+ detail: string | null;
2891
+ }[];
2892
+ outputFormat: "json";
2893
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2894
+ };
2895
+ };
2896
+ } & {
2897
+ "/debug/replay": {
2898
+ $get: {
2899
+ input: {
2900
+ query: {
2901
+ channel?: string | undefined;
2902
+ seq?: string | undefined;
2903
+ json?: "" | "true" | "false" | undefined;
2904
+ };
2905
+ };
2906
+ output: string;
2907
+ outputFormat: "text";
2908
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2909
+ } | {
2910
+ input: {
2911
+ query: {
2912
+ channel?: string | undefined;
2913
+ seq?: string | undefined;
2914
+ json?: "" | "true" | "false" | undefined;
2915
+ };
2916
+ };
2917
+ output: `error: ${string}`;
2918
+ outputFormat: "text";
2919
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2920
+ } | {
2921
+ input: {
2922
+ query: {
2923
+ channel?: string | undefined;
2924
+ seq?: string | undefined;
2925
+ json?: "" | "true" | "false" | undefined;
2926
+ };
2927
+ };
2928
+ output: `channel not found: ${string}`;
2929
+ outputFormat: "text";
2930
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2931
+ } | {
2932
+ input: {
2933
+ query: {
2934
+ channel?: string | undefined;
2935
+ seq?: string | undefined;
2936
+ json?: "" | "true" | "false" | undefined;
2937
+ };
2938
+ };
2939
+ output: "no diagnostic store yet (start the gateway first)";
2940
+ outputFormat: "text";
2941
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2942
+ } | {
2943
+ input: {
2944
+ query: {
2945
+ channel?: string | undefined;
2946
+ seq?: string | undefined;
2947
+ json?: "" | "true" | "false" | undefined;
2948
+ };
2949
+ };
2950
+ output: `multiple channels \u2014 specify one with --channel:
2951
+ ${string}`;
2952
+ outputFormat: "text";
2953
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2954
+ } | {
2955
+ input: {
2956
+ query: {
2957
+ channel?: string | undefined;
2958
+ seq?: string | undefined;
2959
+ json?: "" | "true" | "false" | undefined;
2960
+ };
2961
+ };
2962
+ output: "no channels configured";
2963
+ outputFormat: "text";
2964
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2965
+ } | {
2966
+ input: {
2967
+ query: {
2968
+ channel?: string | undefined;
2969
+ seq?: string | undefined;
2970
+ json?: "" | "true" | "false" | undefined;
2971
+ };
2972
+ };
2973
+ output: {
2974
+ error: string;
2975
+ };
2976
+ outputFormat: "json";
2977
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2978
+ } | {
2979
+ input: {
2980
+ query: {
2981
+ channel?: string | undefined;
2982
+ seq?: string | undefined;
2983
+ json?: "" | "true" | "false" | undefined;
2984
+ };
2985
+ };
2986
+ output: "no matching event found";
2987
+ outputFormat: "text";
2988
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
2989
+ } | {
2990
+ input: {
2991
+ query: {
2992
+ channel?: string | undefined;
2993
+ seq?: string | undefined;
2994
+ json?: "" | "true" | "false" | undefined;
2995
+ };
2996
+ };
2997
+ output: "event has no payload to replay";
2998
+ outputFormat: "text";
2999
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3000
+ } | {
3001
+ input: {
3002
+ query: {
3003
+ channel?: string | undefined;
3004
+ seq?: string | undefined;
3005
+ json?: "" | "true" | "false" | undefined;
3006
+ };
3007
+ };
3008
+ output: {
3009
+ replayed: true;
3010
+ seq: number | null;
3011
+ offset: number;
3012
+ preview: string | null;
3013
+ };
3014
+ outputFormat: "json";
3015
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3016
+ } | {
3017
+ input: {
3018
+ query: {
3019
+ channel?: string | undefined;
3020
+ seq?: string | undefined;
3021
+ json?: "" | "true" | "false" | undefined;
3022
+ };
3023
+ };
3024
+ output: `replayed seq=${number} \u2192 offset=${number}${string}` | `replayed seq=? \u2192 offset=${number}${string}`;
3025
+ outputFormat: "text";
3026
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3027
+ };
3028
+ };
3029
+ } & {
3030
+ "/schema": {
3031
+ $get: {
3032
+ input: {
3033
+ query: Record<string, never>;
3034
+ };
3035
+ output: string;
3036
+ outputFormat: "text";
3037
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3038
+ } | {
3039
+ input: {
3040
+ query: Record<string, never>;
3041
+ };
3042
+ output: `${string}
3043
+ `;
3044
+ outputFormat: "text";
3045
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3046
+ };
3047
+ };
3048
+ } & {
3049
+ "/status": {
3050
+ $get: {
3051
+ input: {
3052
+ query: {
3053
+ watch?: "" | "true" | "false" | undefined;
3054
+ interval?: string | undefined;
3055
+ };
3056
+ };
3057
+ output: string;
3058
+ outputFormat: "text";
3059
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3060
+ };
3061
+ };
3062
+ } & {
3063
+ "/update": {
3064
+ $get: {
3065
+ input: {
3066
+ query: Record<string, never>;
3067
+ };
3068
+ output: string;
3069
+ outputFormat: "text";
3070
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3071
+ } | {
3072
+ input: {
3073
+ query: Record<string, never>;
3074
+ };
3075
+ output: "updated @interactive-inc/claude-funnel";
3076
+ outputFormat: "text";
3077
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3078
+ };
3079
+ };
3080
+ }, "/", "/update">;
3081
+ type CliApp = typeof routes;
3082
+ //#endregion
3083
+ //#region lib/gateway/routes/index.d.ts
3084
+ /**
3085
+ * Top-level Hono app for the gateway daemon. Mounts every HTTP endpoint flat
3086
+ * (the WebSocket /ws upgrade is handled directly by `Bun.serve`). Deps come
3087
+ * from the `deps` variable set by `FunnelGatewayServer`'s middleware — same
3088
+ * shape as CLI's `c.var.funnel`.
3089
+ */
3090
+ type GatewayApp = ReturnType<typeof buildGatewayRoutes>;
3091
+ declare function buildGatewayRoutes(): _$hono_hono_base0.HonoBase<Env$1, {
3092
+ "/health": {
3093
+ $get: {
3094
+ input: {};
3095
+ output: {
3096
+ ok: true;
3097
+ pid: number;
3098
+ clients: number;
3099
+ listeners: {
3100
+ channelName: string;
3101
+ channelId: string;
3102
+ name: string;
3103
+ type: ConnectorConfig["type"];
3104
+ alive: boolean;
3105
+ events: number;
3106
+ errors: number;
3107
+ failureCount: number;
3108
+ lastEventAt: string | null;
3109
+ }[];
3110
+ };
3111
+ outputFormat: "json";
3112
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3113
+ };
3114
+ };
3115
+ } & {
3116
+ "/status": {
3117
+ $get: {
3118
+ input: {};
3119
+ output: {
3120
+ ok: true;
3121
+ pid: number;
3122
+ uptimeMs: number;
3123
+ clients: {
3124
+ channel: string;
3125
+ connectors: string[];
3126
+ }[];
3127
+ listeners: {
3128
+ channelName: string;
3129
+ channelId: string;
3130
+ name: string;
3131
+ type: ConnectorConfig["type"];
3132
+ alive: boolean;
3133
+ events: number;
3134
+ errors: number;
3135
+ failureCount: number;
3136
+ lastEventAt: string | null;
3137
+ }[];
3138
+ broadcaster: {
3139
+ clients: number;
3140
+ subscribers: number;
3141
+ eventsBroadcast: number;
3142
+ droppedSlowClients: number;
3143
+ lastBroadcastAt: string | null;
3144
+ latestOffset: number;
3145
+ oldestReplayableOffset: number | null;
3146
+ };
3147
+ };
3148
+ outputFormat: "json";
3149
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3150
+ };
3151
+ };
3152
+ } & {
3153
+ "/debug": {
3154
+ $get: {
3155
+ input: {};
3156
+ output: {
3157
+ pid: number;
3158
+ uptimeMs: number;
3159
+ eventsBroadcast: number;
3160
+ channels: {
3161
+ id: string;
3162
+ name: string;
3163
+ connectors: string[];
3164
+ listener: {
3165
+ alive: boolean;
3166
+ events: number;
3167
+ errors: number;
3168
+ lastEventAt: string | null;
3169
+ } | null;
3170
+ claudeClients: number;
3171
+ recentEvents: {
3172
+ seq: number | null;
3173
+ ts: number | null;
3174
+ type: string;
3175
+ outcome: string;
3176
+ payload: string | null;
3177
+ payloadParsed: {
3178
+ [x: string]: _$hono_utils_types0.JSONValue;
3179
+ } | null;
3180
+ preview: string | null;
3181
+ }[];
3182
+ connectionErrors: {
3183
+ ts: number | null;
3184
+ type: string;
3185
+ status: string;
3186
+ detail: string | null;
3187
+ }[];
3188
+ diagnosis: {
3189
+ status: "ok" | "warn" | "error";
3190
+ message: string;
3191
+ nextActions: string[];
3192
+ rootCause: string | null;
3193
+ };
3194
+ }[];
3195
+ };
3196
+ outputFormat: "json";
3197
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3198
+ };
3199
+ };
3200
+ } & {
3201
+ "/listeners": {
3202
+ $get: {
3203
+ input: {};
3204
+ output: {
3205
+ listeners: {
3206
+ channelName: string;
3207
+ channelId: string;
3208
+ name: string;
3209
+ type: ConnectorConfig["type"];
3210
+ alive: boolean;
3211
+ events: number;
3212
+ errors: number;
3213
+ failureCount: number;
3214
+ lastEventAt: string | null;
3215
+ }[];
3216
+ };
3217
+ outputFormat: "json";
3218
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3219
+ };
3220
+ };
3221
+ } & {
3222
+ "/listeners/:channel/:connector/start": {
3223
+ $post: {
3224
+ input: {
3225
+ param: {
3226
+ channel: string;
3227
+ connector: string;
3228
+ };
3229
+ };
3230
+ output: {
3231
+ ok: boolean;
3232
+ reason: string;
3233
+ };
3234
+ outputFormat: "json";
3235
+ status: 400;
3236
+ } | {
3237
+ input: {
3238
+ param: {
3239
+ channel: string;
3240
+ connector: string;
3241
+ };
3242
+ };
3243
+ output: {
3244
+ ok: boolean;
3245
+ reason?: string | undefined;
3246
+ };
3247
+ outputFormat: "json";
3248
+ status: 200 | 400;
3249
+ };
3250
+ };
3251
+ } & {
3252
+ "/listeners/:channel/:connector": {
3253
+ $delete: {
3254
+ input: {
3255
+ param: {
3256
+ channel: string;
3257
+ connector: string;
3258
+ };
3259
+ };
3260
+ output: {
3261
+ ok: boolean;
3262
+ reason: string;
3263
+ };
3264
+ outputFormat: "json";
3265
+ status: 400;
3266
+ } | {
3267
+ input: {
3268
+ param: {
3269
+ channel: string;
3270
+ connector: string;
3271
+ };
3272
+ };
3273
+ output: {
3274
+ ok: boolean;
3275
+ reason?: string | undefined;
3276
+ };
3277
+ outputFormat: "json";
3278
+ status: 200 | 400;
3279
+ };
3280
+ };
3281
+ } & {
3282
+ "/listeners/:channel/:connector/restart": {
3283
+ $post: {
3284
+ input: {
3285
+ param: {
3286
+ channel: string;
3287
+ connector: string;
3288
+ };
3289
+ };
3290
+ output: {
3291
+ ok: boolean;
3292
+ reason: string;
3293
+ };
3294
+ outputFormat: "json";
3295
+ status: 400;
3296
+ } | {
3297
+ input: {
3298
+ param: {
3299
+ channel: string;
3300
+ connector: string;
3301
+ };
3302
+ };
3303
+ output: {
3304
+ ok: boolean;
3305
+ reason?: string | undefined;
3306
+ };
3307
+ outputFormat: "json";
3308
+ status: 200 | 400;
3309
+ };
3310
+ };
3311
+ } & {
3312
+ "/channels/:channel/connectors/:connector/call": {
3313
+ $post: {
3314
+ input: {
3315
+ param: {
3316
+ channel: string;
3317
+ connector: string;
3318
+ };
3319
+ };
3320
+ output: {
3321
+ ok: boolean;
3322
+ reason: string;
3323
+ };
3324
+ outputFormat: "json";
3325
+ status: 400;
3326
+ } | {
3327
+ input: {
3328
+ param: {
3329
+ channel: string;
3330
+ connector: string;
3331
+ };
3332
+ };
3333
+ output: {
3334
+ ok: true;
3335
+ result: _$hono_utils_types0.JSONValue;
3336
+ };
3337
+ outputFormat: "json";
3338
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3339
+ };
3340
+ };
3341
+ } & {
3342
+ "/channels/:channel/publish": {
3343
+ $post: {
3344
+ input: {
3345
+ param: {
3346
+ channel: string;
3347
+ };
3348
+ } & {
3349
+ json: {
3350
+ content: string;
3351
+ meta?: Record<string, string> | undefined;
3352
+ connector?: string | undefined;
3353
+ target?: string | undefined;
3354
+ };
3355
+ };
3356
+ output: {
3357
+ ok: boolean;
3358
+ reason: string;
3359
+ };
3360
+ outputFormat: "json";
3361
+ status: 400;
3362
+ } | {
3363
+ input: {
3364
+ param: {
3365
+ channel: string;
3366
+ };
3367
+ } & {
3368
+ json: {
3369
+ content: string;
3370
+ meta?: Record<string, string> | undefined;
3371
+ connector?: string | undefined;
3372
+ target?: string | undefined;
3373
+ };
3374
+ };
3375
+ output: {
3376
+ ok: boolean;
3377
+ reason: string;
3378
+ };
3379
+ outputFormat: "json";
3380
+ status: 400;
3381
+ } | {
3382
+ input: {
3383
+ param: {
3384
+ channel: string;
3385
+ };
3386
+ } & {
3387
+ json: {
3388
+ content: string;
3389
+ meta?: Record<string, string> | undefined;
3390
+ connector?: string | undefined;
3391
+ target?: string | undefined;
3392
+ };
3393
+ };
3394
+ output: {
3395
+ ok: true;
3396
+ offset: number;
3397
+ };
3398
+ outputFormat: "json";
3399
+ status: _$hono_utils_http_status0.ContentfulStatusCode;
3400
+ };
3401
+ };
3402
+ }, "/", "/channels/:channel/publish">;
3403
+ //#endregion
3404
+ 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 };