@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.
- package/README.md +9 -3
- package/dist/bin.js +549 -487
- package/dist/channels-2g_BU1N0.d.ts +174 -0
- package/dist/claude.d.ts +9 -5
- package/dist/claude.js +54 -17
- package/dist/{diagnostic-log-Cb3v8P7p.d.ts → connector-descriptor-6SXJoszo.d.ts} +158 -2
- package/dist/connectors/discord.d.ts +30 -4
- package/dist/connectors/discord.js +2 -2
- package/dist/connectors/gh.d.ts +21 -5
- package/dist/connectors/gh.js +3 -3
- package/dist/connectors/schedule.d.ts +124 -2
- package/dist/connectors/schedule.js +3 -3
- package/dist/connectors/slack.d.ts +149 -5
- package/dist/connectors/slack.js +2 -2
- package/dist/{diagnostic-sql-reader-CzYgZpq2.js → diagnostic-sql-reader-C9zR-Csp.js} +5 -5
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +1 -1
- package/dist/{discord-listener-CKsZGTnH.js → discord-connector-BL36yvbL.js} +60 -37
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -1
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +1 -1
- package/dist/error-message-of-Byi4y0Uf.js +9 -0
- package/dist/{file-process-guard-JhFpmHYo.d.ts → file-process-guard-C_PLxfUX.d.ts} +6 -5
- package/dist/{funnel-diagnostics-BpKYrMSu.js → funnel-diagnostics-CSiJmPlZ.js} +19 -2
- package/dist/{funnel-diagnostics-K-wON25Y.d.ts → funnel-diagnostics-DpXOsCty.d.ts} +3 -3
- package/dist/{funnel-docs-ng5K8w4j.js → funnel-docs-BxXZ9Ksx.js} +76 -3
- package/dist/{funnel-docs-DYBs1-H_.d.ts → funnel-docs-CNklHvbt.d.ts} +1 -1
- package/dist/{funnel-doctor-vxO96TCA.d.ts → funnel-doctor-CZf_0Luq.d.ts} +2 -2
- package/dist/{funnel-recovery-COExL9MD.d.ts → funnel-recovery-DnLrdWO9.d.ts} +1 -1
- package/dist/gateway/daemon.js +326 -266
- package/dist/gateway-base-url-Dy4Ykuoh.js +14 -0
- package/dist/gateway.d.ts +2 -2
- package/dist/gateway.js +2 -2
- package/dist/{gh-listener-B2I4s8qh.js → gh-connector-DpiixfQZ.js} +53 -5
- package/dist/gh-connector-schema-Rzwc1c1N.js +12 -0
- package/dist/http-client-oICicjuO.d.ts +18 -0
- package/dist/index-CgY8NdMz.d.ts +1057 -0
- package/dist/index.d.ts +1558 -17
- package/dist/index.js +376 -343
- package/dist/{local-config-json-schema-DE1zkMcb.js → local-config-json-schema-JyLqOQNX.js} +9 -5
- package/dist/local-config-sync-Dh1Croqe.d.ts +169 -0
- package/dist/local-config.d.ts +2 -2
- package/dist/local-config.js +2 -2
- package/dist/logger.js +1 -1
- package/dist/{memory-diagnostic-log-B9Us7X05.js → memory-diagnostic-log-CI60kNfB.js} +33 -18
- package/dist/{memory-token-prompter-CcShtF8B.d.ts → memory-token-prompter-B4sjyaAq.d.ts} +2 -2
- package/dist/{memory-token-prompter-C7vREzCL.js → memory-token-prompter-CZde7e6y.js} +1 -1
- package/dist/{node-file-system-BcrmWN9I.js → node-file-system-Blr8pAir.js} +1 -1
- package/dist/node-http-client-lowp60Oa.js +25 -0
- package/dist/{gh-connector-schema-ClPLSYD9.js → node-process-runner-DxTvycoK.js} +1 -12
- package/dist/{profiles-g2qGVOWv.d.ts → profiles-Cy5wXQ0L.d.ts} +3 -3
- package/dist/{profiles-MnXvYfZF.js → profiles-DSzTeKQw.js} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +1 -1
- package/dist/recovery.d.ts +1 -1
- package/dist/recovery.js +1 -1
- package/dist/{schedule-listener-DP9Jhc6U.js → schedule-connector-L4uzg5M8.js} +109 -9
- package/dist/{settings-reader-DPwqOVUm.d.ts → settings-reader-BIFB_j2f.d.ts} +1 -1
- package/dist/settings-schema-D1xcOqRu.d.ts +78 -0
- package/dist/{gateway-base-url-DxVjjDoW.js → settings-store-CUKSeTXC.js} +27 -29
- package/dist/{slack-listener-C4wlZaOq.js → slack-connector-DQIFPdBF.js} +67 -12
- package/dist/slot-fields-CMoRpwuy.js +45 -0
- package/dist/{yaml-render-cZu6CxkE.js → yaml-render-93pX7EF7.js} +7 -4
- package/package.json +1 -1
- package/dist/connector-adapter-DGacCppE.d.ts +0 -25
- package/dist/discord-connector-schema-CQyfDkLD.d.ts +0 -39
- package/dist/gh-connector-schema-CZzwzvqY.d.ts +0 -14
- package/dist/index-D7mjirUL.d.ts +0 -3602
- package/dist/local-config-sync-BGPAS9Be.d.ts +0 -401
- package/dist/process-runner-DIm1cy95.d.ts +0 -52
- package/dist/resolve-connector-token-CczqG_Ig.js +0 -22
- package/dist/schedule-listener-DoMPjHZj.d.ts +0 -112
- package/dist/settings-schema-1hh11jnN.d.ts +0 -152
- package/dist/slack-listener-Dj9NFbAJ.d.ts +0 -136
- /package/dist/{connector-adapter-qwXLjQId.js → connector-adapter-DU9Rvyec.js} +0 -0
- /package/dist/{connector-listener-CpHBecCj.js → connector-listener-DR3aKOuK.js} +0 -0
- /package/dist/{file-system-PWKKU7lA.js → file-system-Wvzc2ePY.js} +0 -0
- /package/dist/{file-system-DxpnnUVb.d.ts → file-system-o51IsM0W.d.ts} +0 -0
- /package/dist/{funnel-doctor-CApCezTq.js → funnel-doctor-DiJCjHsg.js} +0 -0
- /package/dist/{funnel-log-sqlite-sink-B_5_4ybn.js → funnel-log-sqlite-sink-kqJbx2H7.js} +0 -0
- /package/dist/{funnel-recovery-D9CxD5Zs.js → funnel-recovery-BFdPjL6Z.js} +0 -0
- /package/dist/{logger-BP6SisKt.js → logger-B6iyNbxM.js} +0 -0
- /package/dist/{schedule-connector-schema-B_xO5z5B.js → schedule-connector-schema-CfyuMCMh.js} +0 -0
- /package/dist/{settings-reader-DPqrpV7s.js → settings-reader-CtQ-Ix8_.js} +0 -0
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import { n as ChannelDeliveryMode, t as ChannelConfig } from "./settings-schema-1hh11jnN.js";
|
|
2
|
-
import { n as FunnelIdGenerator, t as FunnelSettingsReader } from "./settings-reader-DPwqOVUm.js";
|
|
3
|
-
import { S as FunnelLogger, b as FunnelConnectorListener, o as ConnectorDiagnosticLog } from "./diagnostic-log-Cb3v8P7p.js";
|
|
4
|
-
import { r as FunnelProcessRunner } from "./process-runner-DIm1cy95.js";
|
|
5
|
-
import { n as FunnelFileSystem } from "./file-system-DxpnnUVb.js";
|
|
6
|
-
import { n as FunnelConnectorAdapter, t as CallInput } from "./connector-adapter-DGacCppE.js";
|
|
7
|
-
import { a as ScheduleEntry, n as ScheduleOnFired } from "./schedule-listener-DoMPjHZj.js";
|
|
8
|
-
import { n as SlackOnAppCreated, r as SlackPreprocessEvent } from "./slack-listener-Dj9NFbAJ.js";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
|
|
11
|
-
//#region lib/services/local-config/local-config-schema.d.ts
|
|
12
|
-
declare const connectorSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<"slack">;
|
|
14
|
-
name: z.ZodString;
|
|
15
|
-
minify: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
-
type: z.ZodLiteral<"discord">;
|
|
18
|
-
name: z.ZodString;
|
|
19
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
-
type: z.ZodLiteral<"gh">;
|
|
21
|
-
name: z.ZodString;
|
|
22
|
-
pollInterval: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
-
type: z.ZodLiteral<"schedule">;
|
|
25
|
-
name: z.ZodString;
|
|
26
|
-
}, z.core.$strip>], "type">;
|
|
27
|
-
type ConnectorSpec = z.infer<typeof connectorSpecSchema>;
|
|
28
|
-
declare const channelSpecSchema: z.ZodObject<{
|
|
29
|
-
name: z.ZodString;
|
|
30
|
-
connectors: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
|
-
type: z.ZodLiteral<"slack">;
|
|
32
|
-
name: z.ZodString;
|
|
33
|
-
minify: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
-
type: z.ZodLiteral<"discord">;
|
|
36
|
-
name: z.ZodString;
|
|
37
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
-
type: z.ZodLiteral<"gh">;
|
|
39
|
-
name: z.ZodString;
|
|
40
|
-
pollInterval: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
-
type: z.ZodLiteral<"schedule">;
|
|
43
|
-
name: z.ZodString;
|
|
44
|
-
}, z.core.$strip>], "type">>>;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
type ChannelSpec = z.infer<typeof channelSpecSchema>;
|
|
47
|
-
declare const profileSpecSchema: z.ZodObject<{
|
|
48
|
-
name: z.ZodString;
|
|
49
|
-
channel: z.ZodString;
|
|
50
|
-
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
-
resume: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
type ProfileSpec = z.infer<typeof profileSpecSchema>;
|
|
55
|
-
declare const localConfigSchema: z.ZodObject<{
|
|
56
|
-
$schema: z.ZodOptional<z.ZodString>;
|
|
57
|
-
id: z.ZodOptional<z.ZodString>;
|
|
58
|
-
channels: z.ZodArray<z.ZodObject<{
|
|
59
|
-
name: z.ZodString;
|
|
60
|
-
connectors: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
61
|
-
type: z.ZodLiteral<"slack">;
|
|
62
|
-
name: z.ZodString;
|
|
63
|
-
minify: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
-
type: z.ZodLiteral<"discord">;
|
|
66
|
-
name: z.ZodString;
|
|
67
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
-
type: z.ZodLiteral<"gh">;
|
|
69
|
-
name: z.ZodString;
|
|
70
|
-
pollInterval: z.ZodOptional<z.ZodNumber>;
|
|
71
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
-
type: z.ZodLiteral<"schedule">;
|
|
73
|
-
name: z.ZodString;
|
|
74
|
-
}, z.core.$strip>], "type">>>;
|
|
75
|
-
}, z.core.$strip>>;
|
|
76
|
-
profiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
-
name: z.ZodString;
|
|
78
|
-
channel: z.ZodString;
|
|
79
|
-
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
-
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
81
|
-
resume: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
-
}, z.core.$strip>>>;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
type LocalConfig = z.infer<typeof localConfigSchema>;
|
|
85
|
-
declare const LOCAL_CONFIG_FILENAME = "funnel.json";
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region lib/services/local-config/local-config.d.ts
|
|
88
|
-
type Deps$3 = {
|
|
89
|
-
fs: FunnelFileSystem;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Reads `funnel.json` from a directory. Returns `null` when the file is
|
|
93
|
-
* absent so callers can fall through to other resolution paths (default
|
|
94
|
-
* profile, help). Throws on present-but-invalid files so misconfiguration
|
|
95
|
-
* surfaces loudly instead of silently launching the wrong channel.
|
|
96
|
-
*/
|
|
97
|
-
declare class FunnelLocalConfig {
|
|
98
|
-
private readonly fs;
|
|
99
|
-
constructor(deps: Deps$3);
|
|
100
|
-
read(cwd: string): LocalConfig | null;
|
|
101
|
-
private assertProfilesValid;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region lib/engine/connectors/connector-config-schema.d.ts
|
|
105
|
-
declare const connectorConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
106
|
-
id: z.ZodString;
|
|
107
|
-
name: z.ZodString;
|
|
108
|
-
type: z.ZodLiteral<"slack">;
|
|
109
|
-
botToken: z.ZodOptional<z.ZodString>;
|
|
110
|
-
appToken: z.ZodOptional<z.ZodString>;
|
|
111
|
-
botTokenEnv: z.ZodOptional<z.ZodString>;
|
|
112
|
-
appTokenEnv: z.ZodOptional<z.ZodString>;
|
|
113
|
-
minify: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
115
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
116
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
-
id: z.ZodString;
|
|
118
|
-
name: z.ZodString;
|
|
119
|
-
type: z.ZodLiteral<"gh">;
|
|
120
|
-
pollInterval: z.ZodOptional<z.ZodNumber>;
|
|
121
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
122
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
123
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
-
id: z.ZodString;
|
|
125
|
-
name: z.ZodString;
|
|
126
|
-
type: z.ZodLiteral<"discord">;
|
|
127
|
-
botToken: z.ZodOptional<z.ZodString>;
|
|
128
|
-
botTokenEnv: z.ZodOptional<z.ZodString>;
|
|
129
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
130
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
131
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
132
|
-
id: z.ZodString;
|
|
133
|
-
name: z.ZodString;
|
|
134
|
-
type: z.ZodLiteral<"schedule">;
|
|
135
|
-
entries: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
136
|
-
id: z.ZodString;
|
|
137
|
-
cron: z.ZodString;
|
|
138
|
-
prompt: z.ZodString;
|
|
139
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
140
|
-
catchupPolicy: z.ZodDefault<z.ZodEnum<{
|
|
141
|
-
latest: "latest";
|
|
142
|
-
all: "all";
|
|
143
|
-
skip: "skip";
|
|
144
|
-
}>>;
|
|
145
|
-
}, z.core.$strip>>>;
|
|
146
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
147
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
148
|
-
}, z.core.$strip>], "type">;
|
|
149
|
-
type ConnectorConfig = z.infer<typeof connectorConfigSchema>;
|
|
150
|
-
type ConnectorType = ConnectorConfig["type"];
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region lib/engine/connectors/either-token.d.ts
|
|
153
|
-
/**
|
|
154
|
-
* A single connector token slot is supplied one of two non-empty ways, which
|
|
155
|
-
* are mutually exclusive, or left empty:
|
|
156
|
-
*
|
|
157
|
-
* - the literal secret (`botToken: "xoxb-…"`)
|
|
158
|
-
* - the *name* of an env var holding it (`botTokenEnv: "SLACK_BOT_TOKEN"`)
|
|
159
|
-
* - neither — left for the CLI / TTY prompt to fill in at launch
|
|
160
|
-
*
|
|
161
|
-
* `EitherToken<"botToken", "botTokenEnv">` makes "both set at once" a compile
|
|
162
|
-
* error while still allowing "neither". Compose multiple slots with `&` (a slack
|
|
163
|
-
* connector intersects a bot slot and an app slot); the intersection keeps each
|
|
164
|
-
* slot independently exclusive without enumerating the cross-product.
|
|
165
|
-
*
|
|
166
|
-
* To build a value, use the slot helpers below (`botTokenSlot` etc.). They take
|
|
167
|
-
* a resolved `{ literal, env }` and return the exclusive shape. A generic
|
|
168
|
-
* builder can't: TS can't prove a `Record<Env, …>` omits the `Literal` key when
|
|
169
|
-
* both are free type params, so each helper fixes concrete key names instead.
|
|
170
|
-
*/
|
|
171
|
-
type EitherToken<Literal extends string, Env extends string> = (Partial<Record<Literal, string>> & Partial<Record<Env, never>>) | (Partial<Record<Literal, never>> & Partial<Record<Env, string>>);
|
|
172
|
-
//#endregion
|
|
173
|
-
//#region lib/engine/connectors/connector-factory.d.ts
|
|
174
|
-
type SlackListenerOptions = {
|
|
175
|
-
onAppCreated?: SlackOnAppCreated;
|
|
176
|
-
preprocessEvent?: SlackPreprocessEvent;
|
|
177
|
-
};
|
|
178
|
-
type ScheduleListenerOptions = {
|
|
179
|
-
onFired?: ScheduleOnFired;
|
|
180
|
-
};
|
|
181
|
-
type Deps$2 = {
|
|
182
|
-
fs?: FunnelFileSystem;
|
|
183
|
-
process?: FunnelProcessRunner;
|
|
184
|
-
logger?: FunnelLogger;
|
|
185
|
-
dir?: string; /** Diagnostic log of inbound connector traffic. Threaded into listeners that record raw/processed events. No-op when absent. */
|
|
186
|
-
diagnosticLog?: ConnectorDiagnosticLog; /** Per-listener hooks for the slack connector type. Threaded into every Slack listener built by this factory. */
|
|
187
|
-
slackListenerOptions?: SlackListenerOptions; /** Per-listener hooks for the schedule connector type. Threaded into every Schedule listener built by this factory. */
|
|
188
|
-
scheduleListenerOptions?: ScheduleListenerOptions;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Pure factory for per-type listeners and adapters. The factory has no CRUD
|
|
192
|
-
* responsibility — connector configs live inside settings.json under their
|
|
193
|
-
* channel, and FunnelChannels passes them in by value.
|
|
194
|
-
*
|
|
195
|
-
* `dir` is the funnel home (defaults to ~/.funnel); per-connector state files
|
|
196
|
-
* land at `<dir>/channels/<channel-id>/connectors/<connector-id>/state.json`.
|
|
197
|
-
*
|
|
198
|
-
* Host integrations can supply per-type listener hooks via
|
|
199
|
-
* `slackListenerOptions` / `scheduleListenerOptions` — e.g. to attach a
|
|
200
|
-
* Bolt `app.action` handler or to drop one-shot schedule entries on fire.
|
|
201
|
-
*/
|
|
202
|
-
declare class FunnelConnectorFactory {
|
|
203
|
-
private readonly fs;
|
|
204
|
-
private readonly process;
|
|
205
|
-
private readonly logger;
|
|
206
|
-
private readonly diagnosticLog;
|
|
207
|
-
private readonly dir;
|
|
208
|
-
private readonly slackListenerOptions;
|
|
209
|
-
private readonly scheduleListenerOptions;
|
|
210
|
-
constructor(deps?: Deps$2);
|
|
211
|
-
createListener(channelId: string, config: ConnectorConfig): FunnelConnectorListener;
|
|
212
|
-
createAdapter(config: ConnectorConfig): FunnelConnectorAdapter | null;
|
|
213
|
-
connectorDir(channelId: string, connectorId: string): string;
|
|
214
|
-
channelDir(channelId: string): string;
|
|
215
|
-
}
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region lib/engine/profiles/profile-channel-checker.d.ts
|
|
218
|
-
/**
|
|
219
|
-
* Read-side dependency that lets FunnelChannels ask whether a profile
|
|
220
|
-
* references a given channel id, without depending on FunnelProfiles directly.
|
|
221
|
-
*/
|
|
222
|
-
type ProfileChannelChecker = {
|
|
223
|
-
hasChannelRef(channelId: string): boolean;
|
|
224
|
-
};
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region lib/engine/time/clock.d.ts
|
|
227
|
-
/**
|
|
228
|
-
* Time boundary. Default NodeFunnelClock returns `new Date()`; MemoryFunnelClock
|
|
229
|
-
* is settable and `advance(ms)`-able for deterministic schedule / timeout tests.
|
|
230
|
-
*/
|
|
231
|
-
declare abstract class FunnelClock {
|
|
232
|
-
abstract now(): Date;
|
|
233
|
-
millis(): number;
|
|
234
|
-
iso(): string;
|
|
235
|
-
}
|
|
236
|
-
//#endregion
|
|
237
|
-
//#region lib/engine/channels/channels.d.ts
|
|
238
|
-
type Deps$1 = {
|
|
239
|
-
store: FunnelSettingsReader;
|
|
240
|
-
factory: FunnelConnectorFactory;
|
|
241
|
-
profileChecker?: ProfileChannelChecker;
|
|
242
|
-
clock?: FunnelClock;
|
|
243
|
-
idGenerator?: FunnelIdGenerator;
|
|
244
|
-
};
|
|
245
|
-
type ChannelConnectorView = ConnectorConfig & {
|
|
246
|
-
channelId: string;
|
|
247
|
-
channelName: string;
|
|
248
|
-
};
|
|
249
|
-
type AddConnectorInput = ({
|
|
250
|
-
type: "slack";
|
|
251
|
-
name: string;
|
|
252
|
-
minify?: boolean;
|
|
253
|
-
} & EitherToken<"botToken", "botTokenEnv"> & EitherToken<"appToken", "appTokenEnv">) | {
|
|
254
|
-
type: "gh";
|
|
255
|
-
name: string;
|
|
256
|
-
pollInterval?: number;
|
|
257
|
-
} | ({
|
|
258
|
-
type: "discord";
|
|
259
|
-
name: string;
|
|
260
|
-
} & EitherToken<"botToken", "botTokenEnv">) | {
|
|
261
|
-
type: "schedule";
|
|
262
|
-
name: string;
|
|
263
|
-
entries?: ScheduleEntry[];
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Channels own their connectors. Each channel has a stable id (UUID); the
|
|
267
|
-
* `name` is the human-facing label used by the CLI. Connectors live nested
|
|
268
|
-
* inside `channel.connectors[]`, so add/remove/rename are channel-scoped — no
|
|
269
|
-
* global connector namespace exists. Token uniqueness is enforced across all
|
|
270
|
-
* channels at add/update time so the same Slack/Discord credentials cannot
|
|
271
|
-
* be registered twice.
|
|
272
|
-
*/
|
|
273
|
-
declare class FunnelChannels {
|
|
274
|
-
private readonly store;
|
|
275
|
-
private readonly factory;
|
|
276
|
-
private readonly profileChecker;
|
|
277
|
-
private readonly clock;
|
|
278
|
-
private readonly idGenerator;
|
|
279
|
-
constructor(deps: Deps$1);
|
|
280
|
-
list(): ChannelConfig[];
|
|
281
|
-
get(name: string): ChannelConfig | null;
|
|
282
|
-
getById(id: string): ChannelConfig | null;
|
|
283
|
-
add(input: {
|
|
284
|
-
name: string;
|
|
285
|
-
delivery?: ChannelDeliveryMode;
|
|
286
|
-
}): ChannelConfig;
|
|
287
|
-
setDelivery(name: string, delivery: ChannelDeliveryMode): void;
|
|
288
|
-
remove(name: string): void;
|
|
289
|
-
rename(oldName: string, newName: string): void;
|
|
290
|
-
listConnectors(channelName: string): ConnectorConfig[];
|
|
291
|
-
getConnector(channelName: string, connectorName: string): ConnectorConfig | null;
|
|
292
|
-
listAllConnectors(): ChannelConnectorView[];
|
|
293
|
-
addConnector(channelName: string, input: AddConnectorInput): ConnectorConfig;
|
|
294
|
-
private fromInput;
|
|
295
|
-
removeConnector(channelName: string, connectorName: string): void;
|
|
296
|
-
renameConnector(channelName: string, oldName: string, newName: string): void;
|
|
297
|
-
updateSlackConnector(channelName: string, connectorName: string, fields: {
|
|
298
|
-
botToken?: string;
|
|
299
|
-
appToken?: string;
|
|
300
|
-
botTokenEnv?: string;
|
|
301
|
-
appTokenEnv?: string;
|
|
302
|
-
}): void;
|
|
303
|
-
updateGhConnector(channelName: string, connectorName: string, fields: {
|
|
304
|
-
pollInterval?: number;
|
|
305
|
-
}): void;
|
|
306
|
-
updateDiscordConnector(channelName: string, connectorName: string, fields: {
|
|
307
|
-
botToken?: string;
|
|
308
|
-
botTokenEnv?: string;
|
|
309
|
-
}): void;
|
|
310
|
-
listScheduleEntries(channelName: string, connectorName: string): ScheduleEntry[];
|
|
311
|
-
addScheduleEntry(channelName: string, connectorName: string, entry: Pick<ScheduleEntry, "cron" | "prompt"> & Partial<Pick<ScheduleEntry, "id" | "enabled" | "catchupPolicy">>): ScheduleEntry;
|
|
312
|
-
removeScheduleEntry(channelName: string, connectorName: string, id: string): void;
|
|
313
|
-
call(channelName: string, connectorName: string, input: CallInput): Promise<unknown>;
|
|
314
|
-
createListener(channelName: string, connectorName: string): {
|
|
315
|
-
config: ConnectorConfig;
|
|
316
|
-
channelId: string;
|
|
317
|
-
listener: FunnelConnectorListener;
|
|
318
|
-
} | null;
|
|
319
|
-
createAllListeners(): {
|
|
320
|
-
config: ConnectorConfig;
|
|
321
|
-
channelId: string;
|
|
322
|
-
channelName: string;
|
|
323
|
-
listener: FunnelConnectorListener;
|
|
324
|
-
}[];
|
|
325
|
-
private requireChannel;
|
|
326
|
-
private replaceConnector;
|
|
327
|
-
private assertNoTokenCollision;
|
|
328
|
-
}
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region lib/engine/token-prompter/token-prompter.d.ts
|
|
331
|
-
/**
|
|
332
|
-
* Asks the user for a secret value on stdin. Used as a last resort when a
|
|
333
|
-
* funnel.json token field is absent and not present in `~/.funnel`. The Node
|
|
334
|
-
* implementation refuses to prompt when stdin is not a TTY so non-interactive
|
|
335
|
-
* launches (CI, agent spawning agent, daemons) fail fast instead of hanging.
|
|
336
|
-
*/
|
|
337
|
-
declare abstract class FunnelTokenPrompter {
|
|
338
|
-
abstract promptSecret(label: string): Promise<string>;
|
|
339
|
-
}
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region lib/services/local-config/local-config-sync.d.ts
|
|
342
|
-
type Deps = {
|
|
343
|
-
channels: FunnelChannels;
|
|
344
|
-
prompter: FunnelTokenPrompter;
|
|
345
|
-
};
|
|
346
|
-
type ConnectorSyncOutcome = {
|
|
347
|
-
name: string;
|
|
348
|
-
changed: boolean;
|
|
349
|
-
};
|
|
350
|
-
type LocalConfigSyncResult = {
|
|
351
|
-
touched: ConnectorSyncOutcome[];
|
|
352
|
-
removed: string[];
|
|
353
|
-
};
|
|
354
|
-
/**
|
|
355
|
-
* Reconciles a single funnel.json channel spec with `~/.funnel/settings.json`.
|
|
356
|
-
* The spec is the source of truth for the channel it declares:
|
|
357
|
-
*
|
|
358
|
-
* - missing channel → created
|
|
359
|
-
* - declared connector matched by name → tokens reconciled
|
|
360
|
-
* - declared connector with no name match → added (prompting for its tokens)
|
|
361
|
-
* - any connector left in the channel that the spec did not touch → removed
|
|
362
|
-
*
|
|
363
|
-
* Connectors are matched by NAME only — there is no rename-by-token path. A spec
|
|
364
|
-
* that renames a connector (same token, new name) is reconciled as "add the new
|
|
365
|
-
* name, remove the old one". Because the collision check runs at add time while
|
|
366
|
-
* the old connector is still present, re-using its token at the new name throws
|
|
367
|
-
* a token-collision error; remove the old connector via the CLI first.
|
|
368
|
-
*
|
|
369
|
-
* Removal only fires when the channel spec has a `connectors` field. An
|
|
370
|
-
* absent field means "do not manage connectors from here" and leaves
|
|
371
|
-
* everything in `~/.funnel` alone. Other channels in funnel.json (not
|
|
372
|
-
* passed to this call) are untouched.
|
|
373
|
-
*
|
|
374
|
-
* Returns the per-connector change set so callers (e.g. the claude launcher)
|
|
375
|
-
* can drive listener hot-reload on the gateway after settings are written.
|
|
376
|
-
*/
|
|
377
|
-
declare class FunnelLocalConfigSync {
|
|
378
|
-
private readonly channels;
|
|
379
|
-
private readonly prompter;
|
|
380
|
-
constructor(deps: Deps);
|
|
381
|
-
ensure(channel: ChannelSpec): Promise<LocalConfigSyncResult>;
|
|
382
|
-
private ensureConnector;
|
|
383
|
-
private ensureSlack;
|
|
384
|
-
private ensureDiscord;
|
|
385
|
-
private ensureGh;
|
|
386
|
-
private ensureSchedule;
|
|
387
|
-
private findExistingSlack;
|
|
388
|
-
private findExistingDiscord;
|
|
389
|
-
private removeExtras;
|
|
390
|
-
/**
|
|
391
|
-
* Decides how a single token slot is stored in settings.json. funnel.json
|
|
392
|
-
* never carries tokens, so the only sources are a value already in
|
|
393
|
-
* settings.json (carried over verbatim, whichever form it was — literal or an
|
|
394
|
-
* `env`-var reference set via the CLI) or, on first sync, a TTY prompt for a
|
|
395
|
-
* literal (throws when stdin is not a TTY). Either way the secret lands in the
|
|
396
|
-
* repo-scoped settings, never in the repo itself.
|
|
397
|
-
*/
|
|
398
|
-
private resolveSlot;
|
|
399
|
-
}
|
|
400
|
-
//#endregion
|
|
401
|
-
export { profileSpecSchema as C, localConfigSchema as S, LOCAL_CONFIG_FILENAME as _, ChannelConnectorView as a, channelSpecSchema as b, FunnelConnectorFactory as c, ConnectorConfig as d, ConnectorType as f, ConnectorSpec as g, ChannelSpec as h, FunnelTokenPrompter as i, ScheduleListenerOptions as l, FunnelLocalConfig as m, FunnelLocalConfigSync as n, FunnelChannels as o, connectorConfigSchema as p, LocalConfigSyncResult as r, FunnelClock as s, ConnectorSyncOutcome as t, SlackListenerOptions as u, LocalConfig as v, connectorSpecSchema as x, ProfileSpec as y };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//#region lib/engine/process/process-runner.d.ts
|
|
2
|
-
type RunOptions = {
|
|
3
|
-
cwd?: string;
|
|
4
|
-
env?: Record<string, string>;
|
|
5
|
-
input?: string;
|
|
6
|
-
};
|
|
7
|
-
type RunResult = {
|
|
8
|
-
exitCode: number;
|
|
9
|
-
stdout: string;
|
|
10
|
-
stderr: string;
|
|
11
|
-
};
|
|
12
|
-
type AttachOptions = {
|
|
13
|
-
cwd?: string;
|
|
14
|
-
env?: Record<string, string>;
|
|
15
|
-
/** Invoked synchronously after the child process has been spawned, with its PID.
|
|
16
|
-
* Useful for hosts that need to register the spawned process before it exits. */
|
|
17
|
-
onSpawned?: (pid: number) => void;
|
|
18
|
-
};
|
|
19
|
-
type DetachOptions = {
|
|
20
|
-
env?: Record<string, string>; /** Append stdout to this file. Parent dir is the caller's responsibility. */
|
|
21
|
-
stdoutFile?: string; /** Append stderr to this file. Parent dir is the caller's responsibility. */
|
|
22
|
-
stderrFile?: string;
|
|
23
|
-
};
|
|
24
|
-
type ProcessSnapshot = {
|
|
25
|
-
pid: number;
|
|
26
|
-
command: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Process boundary covering one-shot runs, sync runs, foreground attach, and
|
|
30
|
-
* detached background spawns. Default is NodeFunnelProcessRunner (Bun.spawn);
|
|
31
|
-
* MemoryFunnelProcessRunner records calls and lets tests stub responses.
|
|
32
|
-
*
|
|
33
|
-
* Liveness and process-listing helpers absorb POSIX/Windows differences so
|
|
34
|
-
* callers do not branch on `process.platform`. `isAlive` checks whether a PID
|
|
35
|
-
* names a live (non-zombie) process; `listProcessesContaining` enumerates
|
|
36
|
-
* processes whose command line includes `marker`, used for funnel-gateway tag
|
|
37
|
-
* matching across daemons that share a home dir. `getStartTime` returns a
|
|
38
|
-
* stable string identifying when a PID was started, used to detect PID reuse
|
|
39
|
-
* after the original process died abnormally (no exit hook fired).
|
|
40
|
-
*/
|
|
41
|
-
declare abstract class FunnelProcessRunner {
|
|
42
|
-
abstract run(command: string[], options?: RunOptions): Promise<RunResult>;
|
|
43
|
-
abstract runSync(command: string[]): RunResult;
|
|
44
|
-
abstract attach(command: string[], options?: AttachOptions): Promise<number>;
|
|
45
|
-
abstract detach(command: string[], options?: DetachOptions): void;
|
|
46
|
-
abstract kill(pid: number, signal?: string): void;
|
|
47
|
-
abstract isAlive(pid: number): boolean;
|
|
48
|
-
abstract listProcessesContaining(marker: string): ProcessSnapshot[];
|
|
49
|
-
abstract getStartTime(pid: number): string | null;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { RunOptions as a, ProcessSnapshot as i, DetachOptions as n, RunResult as o, FunnelProcessRunner as r, AttachOptions as t };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region lib/engine/connectors/resolve-connector-token.ts
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a connector token from either a literal value or the name of an env
|
|
4
|
-
* var. A connector config carries one or the other per slot (see
|
|
5
|
-
* slack-connector-schema): literals are inlined into settings.json, references
|
|
6
|
-
* keep the secret in `process.env` and out of settings.json.
|
|
7
|
-
*
|
|
8
|
-
* Errors loudly when neither yields a value — a misconfigured connector should
|
|
9
|
-
* fail at listener start, not connect with an empty token and silently never
|
|
10
|
-
* receive events.
|
|
11
|
-
*/
|
|
12
|
-
const resolveConnectorToken = (props) => {
|
|
13
|
-
if (props.literal !== void 0 && props.literal !== "") return props.literal;
|
|
14
|
-
if (props.envVar !== void 0 && props.envVar !== "") {
|
|
15
|
-
const fromEnv = props.env[props.envVar];
|
|
16
|
-
if (fromEnv !== void 0 && fromEnv !== "") return fromEnv;
|
|
17
|
-
throw new Error(`${props.label} references env var "${props.envVar}" but it is not set in the environment`);
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`${props.label} has neither a literal token nor an env var reference`);
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { resolveConnectorToken as t };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { S as FunnelLogger, b as FunnelConnectorListener, o as ConnectorDiagnosticLog, x as NotifyFn } from "./diagnostic-log-Cb3v8P7p.js";
|
|
2
|
-
import { n as FunnelFileSystem } from "./file-system-DxpnnUVb.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
//#region lib/engine/connectors/schedule-state-store.d.ts
|
|
6
|
-
type Deps$1 = {
|
|
7
|
-
path: string;
|
|
8
|
-
fs?: FunnelFileSystem;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Per-connector lastFiredAt persistence for the schedule listener. The path is
|
|
12
|
-
* passed in by FunnelConnectorFactory so this store does not know about the
|
|
13
|
-
* funnel directory layout (`channels/<id>/connectors/<id>/state.json` lives
|
|
14
|
-
* outside this class).
|
|
15
|
-
*/
|
|
16
|
-
declare class ScheduleStateStore {
|
|
17
|
-
private readonly path;
|
|
18
|
-
private readonly fs;
|
|
19
|
-
constructor(deps: Deps$1);
|
|
20
|
-
load(): Map<string, Date>;
|
|
21
|
-
save(state: Map<string, Date>): void;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region lib/engine/connectors/schedule-connector-schema.d.ts
|
|
25
|
-
/**
|
|
26
|
-
* Catch-up behavior when the daemon was down past one or more matching minutes.
|
|
27
|
-
*
|
|
28
|
-
* - `latest`: fire once with the most recent missed match (default; preserves prior behavior).
|
|
29
|
-
* - `all`: fire once per missed minute, oldest first (capped at 24 h).
|
|
30
|
-
* - `skip`: never fire missed matches; only fire when the current minute matches.
|
|
31
|
-
*/
|
|
32
|
-
declare const scheduleCatchupPolicySchema: z.ZodEnum<{
|
|
33
|
-
latest: "latest";
|
|
34
|
-
all: "all";
|
|
35
|
-
skip: "skip";
|
|
36
|
-
}>;
|
|
37
|
-
type ScheduleCatchupPolicy = z.infer<typeof scheduleCatchupPolicySchema>;
|
|
38
|
-
declare const scheduleEntrySchema: z.ZodObject<{
|
|
39
|
-
id: z.ZodString;
|
|
40
|
-
cron: z.ZodString;
|
|
41
|
-
prompt: z.ZodString;
|
|
42
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
-
catchupPolicy: z.ZodDefault<z.ZodEnum<{
|
|
44
|
-
latest: "latest";
|
|
45
|
-
all: "all";
|
|
46
|
-
skip: "skip";
|
|
47
|
-
}>>;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
type ScheduleEntry = z.infer<typeof scheduleEntrySchema>;
|
|
50
|
-
declare const scheduleConnectorSchema: z.ZodObject<{
|
|
51
|
-
id: z.ZodString;
|
|
52
|
-
name: z.ZodString;
|
|
53
|
-
type: z.ZodLiteral<"schedule">;
|
|
54
|
-
entries: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
55
|
-
id: z.ZodString;
|
|
56
|
-
cron: z.ZodString;
|
|
57
|
-
prompt: z.ZodString;
|
|
58
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
-
catchupPolicy: z.ZodDefault<z.ZodEnum<{
|
|
60
|
-
latest: "latest";
|
|
61
|
-
all: "all";
|
|
62
|
-
skip: "skip";
|
|
63
|
-
}>>;
|
|
64
|
-
}, z.core.$strip>>>;
|
|
65
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
66
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$strip>;
|
|
68
|
-
type ScheduleConnectorConfig = z.infer<typeof scheduleConnectorSchema>;
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region lib/engine/connectors/schedule-listener.d.ts
|
|
71
|
-
type ScheduleOnFired = (entry: ScheduleEntry, firedAt: Date) => void | Promise<void>;
|
|
72
|
-
type Deps = {
|
|
73
|
-
config: ScheduleConnectorConfig;
|
|
74
|
-
lastFiredStore: ScheduleStateStore; /** Funnel channel uuid this connector lives under; stamped onto diagnostic-log rows. */
|
|
75
|
-
channelId?: string;
|
|
76
|
-
logger?: FunnelLogger; /** Diagnostic log of fired entries and lifecycle. No-op when absent. */
|
|
77
|
-
diagnosticLog?: ConnectorDiagnosticLog;
|
|
78
|
-
now?: () => Date;
|
|
79
|
-
/**
|
|
80
|
-
* Invoked after a schedule entry fires successfully. Use to remove one-shot
|
|
81
|
-
* entries from the connector config, or to log per-fire side effects.
|
|
82
|
-
* Errors from this callback are caught and logged; they do not abort the tick.
|
|
83
|
-
*/
|
|
84
|
-
onFired?: ScheduleOnFired;
|
|
85
|
-
};
|
|
86
|
-
declare class FunnelScheduleListener extends FunnelConnectorListener {
|
|
87
|
-
private readonly config;
|
|
88
|
-
private readonly lastFiredStore;
|
|
89
|
-
private readonly channelId;
|
|
90
|
-
private readonly logger;
|
|
91
|
-
private readonly diagnosticLog;
|
|
92
|
-
private readonly now;
|
|
93
|
-
private readonly onFired;
|
|
94
|
-
private timer;
|
|
95
|
-
private stopped;
|
|
96
|
-
constructor(deps: Deps);
|
|
97
|
-
start(notify: NotifyFn): Promise<void>;
|
|
98
|
-
stop(): Promise<void>;
|
|
99
|
-
isAlive(): boolean;
|
|
100
|
-
tick(notify: NotifyFn): Promise<void>;
|
|
101
|
-
private fireEntry;
|
|
102
|
-
private notifyOne;
|
|
103
|
-
private findMostRecentMatch;
|
|
104
|
-
private findAllMatches;
|
|
105
|
-
private logInvalidCron;
|
|
106
|
-
private truncateToMinute;
|
|
107
|
-
private recordRaw;
|
|
108
|
-
private recordProcessed;
|
|
109
|
-
private recordConnection;
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
export { ScheduleEntry as a, scheduleEntrySchema as c, ScheduleConnectorConfig as i, ScheduleStateStore as l, ScheduleOnFired as n, scheduleCatchupPolicySchema as o, ScheduleCatchupPolicy as r, scheduleConnectorSchema as s, FunnelScheduleListener as t };
|