@interactive-inc/claude-funnel 0.59.1 → 0.60.1

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