@interactive-inc/claude-funnel 0.60.1 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bin.js +428 -761
- package/dist/{channels-2g_BU1N0.d.ts → channels-CRGb6B5_.d.ts} +17 -16
- package/dist/claude.d.ts +5 -7
- package/dist/claude.js +143 -36
- package/dist/{connector-descriptor-6SXJoszo.d.ts → connector-descriptor-BFIhyTfa.d.ts} +49 -10
- package/dist/connector-diagnostics-recorder-COtNEmUp.js +42 -0
- package/dist/connectors/discord.d.ts +31 -37
- package/dist/connectors/discord.js +3 -3
- package/dist/connectors/gh.d.ts +37 -33
- package/dist/connectors/gh.js +3 -3
- package/dist/connectors/schedule.d.ts +9 -57
- package/dist/connectors/schedule.js +3 -3
- package/dist/connectors/slack.d.ts +106 -132
- package/dist/connectors/slack.js +4 -3
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +1 -1
- package/dist/discord-connector-DIFkYBbi.js +250 -0
- package/dist/discord-connector-schema-D-bOVAKt.d.ts +22 -0
- package/dist/docs.js +1 -1
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +1 -1
- package/dist/{file-process-guard-C_PLxfUX.d.ts → file-process-guard-tVcgckH6.d.ts} +6 -6
- package/dist/{file-system-o51IsM0W.d.ts → file-system-VhwwXZbm.d.ts} +8 -0
- package/dist/flume-source-listener-BNyAII7N.d.ts +133 -0
- package/dist/{funnel-diagnostics-CSiJmPlZ.js → funnel-diagnostics-Cvk6Sk4x.js} +193 -43
- package/dist/{funnel-diagnostics-DpXOsCty.d.ts → funnel-diagnostics-b9ar0Ing.d.ts} +67 -5
- package/dist/{funnel-docs-BxXZ9Ksx.js → funnel-docs-C-ge0MuB.js} +42 -6
- package/dist/{funnel-doctor-CZf_0Luq.d.ts → funnel-doctor-CnRQi4kM.d.ts} +2 -2
- package/dist/{funnel-doctor-DiJCjHsg.js → funnel-doctor-XrI2GBH8.js} +1 -1
- package/dist/funnel-error-0t1MK1R6.js +75 -0
- package/dist/{funnel-recovery-DnLrdWO9.d.ts → funnel-recovery-CMhY8Jfk.d.ts} +1 -1
- package/dist/gateway/daemon.js +167 -527
- package/dist/gateway.d.ts +3 -3
- package/dist/gateway.js +3 -3
- package/dist/gh-connector-BUGCOEWS.js +187 -0
- package/dist/{gh-connector-schema-Rzwc1c1N.js → gh-connector-schema-CAqIhzGr.js} +7 -0
- package/dist/gh-connector-schema-DWQaB6gX.d.ts +16 -0
- package/dist/{index-CgY8NdMz.d.ts → index-Ds6sHhA-.d.ts} +37 -19
- package/dist/index.d.ts +182 -22
- package/dist/index.js +363 -173
- package/dist/{local-config-json-schema-JyLqOQNX.js → local-config-json-schema-DexV8vX3.js} +24 -4
- package/dist/local-config.d.ts +39 -2
- package/dist/local-config.js +53 -2
- package/dist/logger.js +1 -1
- package/dist/loopback-fetch-CVNuN3YZ.js +40 -0
- package/dist/{local-config-sync-Dh1Croqe.d.ts → memory-token-prompter-BoV8Hf-n.d.ts} +30 -3
- package/dist/node-file-system-BOXIHW_Q.js +174 -0
- package/dist/{profiles-DSzTeKQw.js → profiles-ZHLONml4.js} +49 -49
- package/dist/{profiles-Cy5wXQ0L.d.ts → profiles-cVZQkM69.d.ts} +3 -3
- 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/resolve-connector-token-DxDG9mhf.js +22 -0
- package/dist/{schedule-connector-L4uzg5M8.js → schedule-connector-9k3gOIgl.js} +54 -55
- package/dist/schedule-connector-schema-Z0RXLgPI.d.ts +49 -0
- package/dist/settings-reader-BNxjsxCB.d.ts +27 -0
- package/dist/{settings-store-CUKSeTXC.js → settings-store-C2QdOH-t.js} +23 -4
- package/dist/slack-connector-CxpWagbT.js +388 -0
- package/dist/slack-event-processor-BhCf5Wiy.d.ts +95 -0
- package/dist/slack-event-processor-xFDG3US0.js +176 -0
- package/dist/slot-fields-D-pvMgTK.js +249 -0
- package/dist/{memory-diagnostic-log-CI60kNfB.js → sqlite-diagnostic-log-DOTPW-tG.js} +373 -249
- package/dist/{yaml-render-93pX7EF7.js → yaml-render--J1_3BSA.js} +25 -21
- package/package.json +2 -4
- package/dist/discord-connector-BL36yvbL.js +0 -250
- package/dist/gateway-base-url-Dy4Ykuoh.js +0 -14
- package/dist/gh-connector-DpiixfQZ.js +0 -226
- package/dist/http-client-oICicjuO.d.ts +0 -18
- package/dist/memory-token-prompter-B4sjyaAq.d.ts +0 -57
- package/dist/memory-token-prompter-CZde7e6y.js +0 -61
- package/dist/node-file-system-Blr8pAir.js +0 -48
- package/dist/settings-reader-BIFB_j2f.d.ts +0 -18
- package/dist/slack-connector-DQIFPdBF.js +0 -484
- package/dist/slot-fields-CMoRpwuy.js +0 -45
- /package/dist/{connector-adapter-DU9Rvyec.js → connector-adapter-Dvs8N7ew.js} +0 -0
- /package/dist/{connector-listener-DR3aKOuK.js → connector-listener-mPGZYa8e.js} +0 -0
- /package/dist/{diagnostic-sql-reader-C9zR-Csp.js → diagnostic-sql-reader-oXZnWFf_.js} +0 -0
- /package/dist/{discord-connector-schema-B_N6IXLz.js → discord-connector-schema-B4YpWpR3.js} +0 -0
- /package/dist/{error-message-of-Byi4y0Uf.js → error-message-of-ColuYmAk.js} +0 -0
- /package/dist/{funnel-log-sqlite-sink-kqJbx2H7.js → funnel-log-sqlite-sink-DLYkY0pZ.js} +0 -0
- /package/dist/{funnel-recovery-BFdPjL6Z.js → funnel-recovery-DKnEutUS.js} +0 -0
- /package/dist/{node-http-client-lowp60Oa.js → node-http-client-u00atiKx.js} +0 -0
- /package/dist/{schedule-connector-schema-CfyuMCMh.js → schedule-connector-schema-DKEPZnVv.js} +0 -0
- /package/dist/{settings-reader-CtQ-Ix8_.js → settings-reader-9FcX3qS1.js} +0 -0
- /package/dist/{settings-schema-D1xcOqRu.d.ts → settings-schema-BL_c2Udm.d.ts} +0 -0
- /package/dist/{slack-connector-schema-C1zEf4TG.js → slack-connector-schema-Dem8to4P.js} +0 -0
package/dist/connectors/gh.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { B as FunnelProcessRunner, M as NotifyFn, N as CallInput, P as FunnelConnectorAdapter, W as FunnelLogger, _ as ConnectorDiagnosticLog, r as ConnectorDescriptor } from "../connector-descriptor-BFIhyTfa.js";
|
|
2
|
+
import { t as FunnelFlumeSourceListener } from "../flume-source-listener-BNyAII7N.js";
|
|
3
|
+
import { n as ghConnectorSchema, t as GhConnectorConfig } from "../gh-connector-schema-DWQaB6gX.js";
|
|
4
|
+
import { FlumeRuntimeDeps } from "@interactive-inc/flume";
|
|
3
5
|
|
|
4
6
|
//#region lib/engine/connectors/gh-adapter.d.ts
|
|
5
7
|
type Deps$1 = {
|
|
@@ -15,48 +17,50 @@ declare class FunnelGhAdapter extends FunnelConnectorAdapter {
|
|
|
15
17
|
/**
|
|
16
18
|
* GitHub connector descriptor. Pass `ghConnector()` to
|
|
17
19
|
* `new Funnel({ connectors: [...] })` to enable the type.
|
|
20
|
+
*
|
|
21
|
+
* The listener is backed by `@interactive-inc/flume`'s `FlumeGitHubSource`
|
|
22
|
+
* (raw REST polling + Zod), authenticating with a token resolved from the
|
|
23
|
+
* environment or `gh auth token`. The adapter still uses `gh api` for
|
|
24
|
+
* outbound calls, so the auth model is unchanged end-to-end.
|
|
18
25
|
*/
|
|
19
26
|
declare const ghConnector: () => ConnectorDescriptor;
|
|
20
27
|
//#endregion
|
|
21
|
-
//#region lib/engine/connectors/gh-
|
|
22
|
-
declare const ghConnectorSchema: z.ZodObject<{
|
|
23
|
-
id: z.ZodString;
|
|
24
|
-
name: z.ZodString;
|
|
25
|
-
type: z.ZodLiteral<"gh">;
|
|
26
|
-
pollInterval: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
28
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
29
|
-
}, z.core.$strip>;
|
|
30
|
-
type GhConnectorConfig = z.infer<typeof ghConnectorSchema>;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region lib/engine/connectors/gh-listener.d.ts
|
|
28
|
+
//#region lib/engine/connectors/gh-flume-listener.d.ts
|
|
33
29
|
type Deps = {
|
|
34
|
-
config: GhConnectorConfig;
|
|
30
|
+
config: GhConnectorConfig;
|
|
35
31
|
channelId?: string;
|
|
32
|
+
env?: NodeJS.ProcessEnv;
|
|
36
33
|
process?: FunnelProcessRunner;
|
|
37
|
-
logger?: FunnelLogger;
|
|
34
|
+
logger?: FunnelLogger;
|
|
38
35
|
diagnosticLog?: ConnectorDiagnosticLog;
|
|
39
|
-
|
|
36
|
+
flumeDeps?: Partial<FlumeRuntimeDeps>; /** Shutdown signal forwarded to the underlying Flume. */
|
|
37
|
+
signal?: AbortSignal;
|
|
40
38
|
};
|
|
41
|
-
|
|
39
|
+
/**
|
|
40
|
+
* GitHub listener backed by `@interactive-inc/flume`'s `FlumeGitHubSource`
|
|
41
|
+
* (raw REST polling of `/notifications` + Zod).
|
|
42
|
+
*
|
|
43
|
+
* Token resolution order mirrors the other connectors' literal-or-env-ref
|
|
44
|
+
* slot, with a `gh auth token` fallback as the convenience path:
|
|
45
|
+
*
|
|
46
|
+
* 1. `config.token` (literal)
|
|
47
|
+
* 2. `config.tokenEnv` (env var name → value)
|
|
48
|
+
* 3. `gh auth token` (reuses the `gh` CLI's authenticated session)
|
|
49
|
+
*
|
|
50
|
+
* The adapter still uses `gh api` for outbound calls, so when the fallback
|
|
51
|
+
* is in use the auth model is unchanged end-to-end.
|
|
52
|
+
*/
|
|
53
|
+
declare class FunnelFlumeGhListener extends FunnelFlumeSourceListener {
|
|
42
54
|
private readonly config;
|
|
43
|
-
private readonly
|
|
55
|
+
private readonly env;
|
|
44
56
|
private readonly process;
|
|
45
|
-
private readonly
|
|
46
|
-
private readonly
|
|
47
|
-
private readonly now;
|
|
48
|
-
private readonly seen;
|
|
49
|
-
private bootstrapped;
|
|
50
|
-
private since;
|
|
51
|
-
private timer;
|
|
57
|
+
private readonly flumeDeps;
|
|
58
|
+
private readonly signal;
|
|
52
59
|
constructor(deps: Deps);
|
|
53
60
|
start(notify: NotifyFn): Promise<void>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
private recordRaw;
|
|
58
|
-
private recordProcessed;
|
|
59
|
-
private recordConnection;
|
|
61
|
+
private resolveToken;
|
|
62
|
+
private handleEvent;
|
|
63
|
+
private deliver;
|
|
60
64
|
}
|
|
61
65
|
//#endregion
|
|
62
|
-
export {
|
|
66
|
+
export { FunnelFlumeGhListener, FunnelGhAdapter, GhConnectorConfig, ghConnector, ghConnectorSchema };
|
package/dist/connectors/gh.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as ghConnectorSchema } from "../gh-connector-schema-
|
|
2
|
-
import { n as
|
|
3
|
-
export {
|
|
1
|
+
import { t as ghConnectorSchema } from "../gh-connector-schema-CAqIhzGr.js";
|
|
2
|
+
import { n as FunnelFlumeGhListener, r as FunnelGhAdapter, t as ghConnector } from "../gh-connector-BUGCOEWS.js";
|
|
3
|
+
export { FunnelFlumeGhListener, FunnelGhAdapter, ghConnector, ghConnectorSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as FunnelFileSystem } from "../file-system-
|
|
3
|
-
import {
|
|
1
|
+
import { M as NotifyFn, W as FunnelLogger, _ as ConnectorDiagnosticLog, j as FunnelConnectorListener, r as ConnectorDescriptor } from "../connector-descriptor-BFIhyTfa.js";
|
|
2
|
+
import { n as FunnelFileSystem } from "../file-system-VhwwXZbm.js";
|
|
3
|
+
import { a as scheduleConnectorSchema, i as scheduleCatchupPolicySchema, n as ScheduleConnectorConfig, o as scheduleEntrySchema, r as ScheduleEntry, t as ScheduleCatchupPolicy } from "../schedule-connector-schema-Z0RXLgPI.js";
|
|
4
4
|
|
|
5
5
|
//#region lib/engine/connectors/match-cron.d.ts
|
|
6
6
|
/**
|
|
@@ -26,7 +26,7 @@ type Deps$1 = {
|
|
|
26
26
|
* connectorDir) so this store does not know about the funnel directory layout
|
|
27
27
|
* (`channels/<id>/connectors/<id>/state.json` lives outside this class).
|
|
28
28
|
*/
|
|
29
|
-
declare class
|
|
29
|
+
declare class FunnelScheduleStateStore {
|
|
30
30
|
private readonly path;
|
|
31
31
|
private readonly fs;
|
|
32
32
|
constructor(deps: Deps$1);
|
|
@@ -34,57 +34,11 @@ declare class ScheduleStateStore {
|
|
|
34
34
|
save(state: Map<string, Date>): void;
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region lib/engine/connectors/schedule-connector-schema.d.ts
|
|
38
|
-
/**
|
|
39
|
-
* Catch-up behavior when the daemon was down past one or more matching minutes.
|
|
40
|
-
*
|
|
41
|
-
* - `latest`: fire once with the most recent missed match (default; preserves prior behavior).
|
|
42
|
-
* - `all`: fire once per missed minute, oldest first (capped at 24 h).
|
|
43
|
-
* - `skip`: never fire missed matches; only fire when the current minute matches.
|
|
44
|
-
*/
|
|
45
|
-
declare const scheduleCatchupPolicySchema: z.ZodEnum<{
|
|
46
|
-
latest: "latest";
|
|
47
|
-
all: "all";
|
|
48
|
-
skip: "skip";
|
|
49
|
-
}>;
|
|
50
|
-
type ScheduleCatchupPolicy = z.infer<typeof scheduleCatchupPolicySchema>;
|
|
51
|
-
declare const scheduleEntrySchema: z.ZodObject<{
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
cron: z.ZodString;
|
|
54
|
-
prompt: z.ZodString;
|
|
55
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
56
|
-
catchupPolicy: z.ZodDefault<z.ZodEnum<{
|
|
57
|
-
latest: "latest";
|
|
58
|
-
all: "all";
|
|
59
|
-
skip: "skip";
|
|
60
|
-
}>>;
|
|
61
|
-
}, z.core.$strip>;
|
|
62
|
-
type ScheduleEntry = z.infer<typeof scheduleEntrySchema>;
|
|
63
|
-
declare const scheduleConnectorSchema: z.ZodObject<{
|
|
64
|
-
id: z.ZodString;
|
|
65
|
-
name: z.ZodString;
|
|
66
|
-
type: z.ZodLiteral<"schedule">;
|
|
67
|
-
entries: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
68
|
-
id: z.ZodString;
|
|
69
|
-
cron: z.ZodString;
|
|
70
|
-
prompt: z.ZodString;
|
|
71
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
72
|
-
catchupPolicy: z.ZodDefault<z.ZodEnum<{
|
|
73
|
-
latest: "latest";
|
|
74
|
-
all: "all";
|
|
75
|
-
skip: "skip";
|
|
76
|
-
}>>;
|
|
77
|
-
}, z.core.$strip>>>;
|
|
78
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
79
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
80
|
-
}, z.core.$strip>;
|
|
81
|
-
type ScheduleConnectorConfig = z.infer<typeof scheduleConnectorSchema>;
|
|
82
|
-
//#endregion
|
|
83
37
|
//#region lib/engine/connectors/schedule-listener.d.ts
|
|
84
38
|
type ScheduleOnFired = (entry: ScheduleEntry, firedAt: Date) => void | Promise<void>;
|
|
85
39
|
type Deps = {
|
|
86
40
|
config: ScheduleConnectorConfig;
|
|
87
|
-
lastFiredStore:
|
|
41
|
+
lastFiredStore: FunnelScheduleStateStore; /** Funnel channel uuid this connector lives under; stamped onto diagnostic-log rows. */
|
|
88
42
|
channelId?: string;
|
|
89
43
|
logger?: FunnelLogger; /** Diagnostic log of fired entries and lifecycle. No-op when absent. */
|
|
90
44
|
diagnosticLog?: ConnectorDiagnosticLog;
|
|
@@ -99,16 +53,17 @@ type Deps = {
|
|
|
99
53
|
declare class FunnelScheduleListener extends FunnelConnectorListener {
|
|
100
54
|
private readonly config;
|
|
101
55
|
private readonly lastFiredStore;
|
|
102
|
-
private readonly channelId;
|
|
103
56
|
private readonly logger;
|
|
104
|
-
private readonly
|
|
57
|
+
private readonly diagnostics;
|
|
105
58
|
private readonly now;
|
|
106
59
|
private readonly onFired;
|
|
107
60
|
private timer;
|
|
108
61
|
private stopped;
|
|
62
|
+
private tickScheduled;
|
|
109
63
|
constructor(deps: Deps);
|
|
110
64
|
start(notify: NotifyFn): Promise<void>;
|
|
111
65
|
stop(): Promise<void>;
|
|
66
|
+
private recordTickError;
|
|
112
67
|
isAlive(): boolean;
|
|
113
68
|
tick(notify: NotifyFn): Promise<void>;
|
|
114
69
|
private fireEntry;
|
|
@@ -117,9 +72,6 @@ declare class FunnelScheduleListener extends FunnelConnectorListener {
|
|
|
117
72
|
private findAllMatches;
|
|
118
73
|
private logInvalidCron;
|
|
119
74
|
private truncateToMinute;
|
|
120
|
-
private recordRaw;
|
|
121
|
-
private recordProcessed;
|
|
122
|
-
private recordConnection;
|
|
123
75
|
}
|
|
124
76
|
//#endregion
|
|
125
77
|
//#region lib/engine/connectors/schedule-connector.d.ts
|
|
@@ -135,4 +87,4 @@ type ScheduleConnectorOptions = {
|
|
|
135
87
|
*/
|
|
136
88
|
declare const scheduleConnector: (options?: ScheduleConnectorOptions) => ConnectorDescriptor;
|
|
137
89
|
//#endregion
|
|
138
|
-
export { FunnelScheduleListener, ScheduleCatchupPolicy, ScheduleConnectorConfig, ScheduleConnectorOptions, ScheduleEntry, ScheduleOnFired,
|
|
90
|
+
export { FunnelScheduleListener, FunnelScheduleStateStore, ScheduleCatchupPolicy, ScheduleConnectorConfig, ScheduleConnectorOptions, ScheduleEntry, ScheduleOnFired, matchCron, scheduleCatchupPolicySchema, scheduleConnector, scheduleConnectorSchema, scheduleEntrySchema };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as scheduleConnectorSchema, r as scheduleEntrySchema, t as scheduleCatchupPolicySchema } from "../schedule-connector-schema-
|
|
2
|
-
import { i as matchCron, n as FunnelScheduleListener, r as
|
|
3
|
-
export { FunnelScheduleListener,
|
|
1
|
+
import { n as scheduleConnectorSchema, r as scheduleEntrySchema, t as scheduleCatchupPolicySchema } from "../schedule-connector-schema-DKEPZnVv.js";
|
|
2
|
+
import { i as matchCron, n as FunnelScheduleListener, r as FunnelScheduleStateStore, t as scheduleConnector } from "../schedule-connector-9k3gOIgl.js";
|
|
3
|
+
export { FunnelScheduleListener, FunnelScheduleStateStore, matchCron, scheduleCatchupPolicySchema, scheduleConnector, scheduleConnectorSchema, scheduleEntrySchema };
|
|
@@ -1,47 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { M as NotifyFn, N as CallInput, P as FunnelConnectorAdapter, W as FunnelLogger, _ as ConnectorDiagnosticLog, l as FunnelHttpClient, r as ConnectorDescriptor } from "../connector-descriptor-BFIhyTfa.js";
|
|
2
|
+
import { t as FunnelFlumeSourceListener } from "../flume-source-listener-BNyAII7N.js";
|
|
3
|
+
import { a as SlackRawEvent, c as SlackMessageEvent, d as slackConnectorSchema, i as SlackProcessedSkip, l as SlackReactionEvent, n as SlackProcessed, o as SlackSkipReason, r as SlackProcessedEmit, s as SlackEvent, t as FunnelSlackEventProcessor, u as SlackConnectorConfig } from "../slack-event-processor-BhCf5Wiy.js";
|
|
4
|
+
import { FlumeRuntimeDeps } from "@interactive-inc/flume";
|
|
4
5
|
|
|
5
|
-
//#region lib/engine/connectors/slack-connector-schema.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* A slack connector resolves its tokens one of two ways, set at sync time:
|
|
8
|
-
*
|
|
9
|
-
* - literal: `botToken` / `appToken` hold the real `xoxb-`/`xapp-` secret
|
|
10
|
-
* (set by a `fnl channels` command or a TTY prompt at launch).
|
|
11
|
-
* - by reference: `botTokenEnv` / `appTokenEnv` hold the *name* of an env var.
|
|
12
|
-
* The secret never lands in settings.json; the listener resolves it from
|
|
13
|
-
* `process.env` at start. This form is only set through the engine API
|
|
14
|
-
* (`new Funnel(...)`) — funnel.json and the `fnl` CLI produce literals.
|
|
15
|
-
*
|
|
16
|
-
* Both are optional at the schema level (a discriminated-union member can't
|
|
17
|
-
* carry a cross-field refine); the listener requires exactly one resolved
|
|
18
|
-
* token per slot and errors loudly otherwise.
|
|
19
|
-
*/
|
|
20
|
-
declare const slackConnectorSchema: z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
name: z.ZodString;
|
|
23
|
-
type: z.ZodLiteral<"slack">;
|
|
24
|
-
botToken: z.ZodOptional<z.ZodString>;
|
|
25
|
-
appToken: z.ZodOptional<z.ZodString>;
|
|
26
|
-
botTokenEnv: z.ZodOptional<z.ZodString>;
|
|
27
|
-
appTokenEnv: z.ZodOptional<z.ZodString>;
|
|
28
|
-
minify: z.ZodDefault<z.ZodBoolean>;
|
|
29
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
30
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
type SlackConnectorConfig = z.infer<typeof slackConnectorSchema>;
|
|
33
|
-
//#endregion
|
|
34
6
|
//#region lib/engine/connectors/slack-adapter.d.ts
|
|
35
|
-
type SlackWebClientLike = {
|
|
36
|
-
apiCall: (method: string, options?: Record<string, unknown>) => Promise<unknown>;
|
|
37
|
-
};
|
|
38
7
|
type Deps$1 = {
|
|
39
|
-
config: SlackConnectorConfig;
|
|
40
|
-
env?: NodeJS.ProcessEnv;
|
|
41
|
-
|
|
8
|
+
config: SlackConnectorConfig;
|
|
9
|
+
env?: NodeJS.ProcessEnv; /** HTTP client injection — defaults to `NodeFunnelHttpClient`. Tests inject `MemoryFunnelHttpClient`. */
|
|
10
|
+
http?: FunnelHttpClient;
|
|
42
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Slack Web API adapter over the injected `FunnelHttpClient`. `call()` posts
|
|
14
|
+
* to `https://slack.com/api/<method>` with `Authorization: Bearer <botToken>`
|
|
15
|
+
* and returns the parsed JSON body verbatim — Slack signals failures with
|
|
16
|
+
* `{ ok: false, error: "..." }` in a 200 response, so we surface that body
|
|
17
|
+
* unchanged and let the caller inspect `ok`.
|
|
18
|
+
*/
|
|
43
19
|
declare class FunnelSlackAdapter extends FunnelConnectorAdapter {
|
|
44
|
-
private readonly
|
|
20
|
+
private readonly token;
|
|
21
|
+
private readonly http;
|
|
45
22
|
constructor(deps: Deps$1);
|
|
46
23
|
call(input: CallInput): Promise<unknown>;
|
|
47
24
|
postMessage(props: {
|
|
@@ -61,118 +38,115 @@ declare class FunnelSlackAdapter extends FunnelConnectorAdapter {
|
|
|
61
38
|
}): Promise<unknown>;
|
|
62
39
|
}
|
|
63
40
|
//#endregion
|
|
64
|
-
//#region lib/engine/connectors/slack-
|
|
65
|
-
type SlackMessageEvent = {
|
|
66
|
-
kind: "message";
|
|
67
|
-
channel: string;
|
|
68
|
-
user: string;
|
|
69
|
-
rawText: string;
|
|
70
|
-
text: string;
|
|
71
|
-
threadTs: string;
|
|
72
|
-
ts: string;
|
|
73
|
-
isThreadRoot: boolean;
|
|
74
|
-
mentioned: boolean;
|
|
75
|
-
source: "app_mention" | "message";
|
|
76
|
-
};
|
|
77
|
-
type SlackReactionEvent = {
|
|
78
|
-
kind: "reaction_added" | "reaction_removed";
|
|
79
|
-
channel: string;
|
|
80
|
-
user: string;
|
|
81
|
-
emoji: string;
|
|
82
|
-
targetTs: string;
|
|
83
|
-
targetUser: string | null;
|
|
84
|
-
};
|
|
85
|
-
type SlackEvent = SlackMessageEvent | SlackReactionEvent;
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region lib/engine/connectors/slack-event-processor.d.ts
|
|
88
|
-
type SlackRawEvent = Record<string, unknown>;
|
|
41
|
+
//#region lib/engine/connectors/slack-flume-listener.d.ts
|
|
89
42
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
43
|
+
* Optional host hook: inspect the raw Slack event after envelope unwrap and
|
|
44
|
+
* before the funnel processor runs. Return the event (possibly transformed)
|
|
45
|
+
* to keep processing, or `null` to drop it with a `skip:preprocess` row in
|
|
46
|
+
* the diagnostic log. The funnel does not assume any specific transform —
|
|
47
|
+
* stripping images, neutralizing channel-tag injection, redacting PII, etc.
|
|
48
|
+
* are all valid uses.
|
|
95
49
|
*/
|
|
96
|
-
type
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
type
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
now?: () => number;
|
|
116
|
-
};
|
|
117
|
-
declare class FunnelSlackEventProcessor {
|
|
118
|
-
private readonly ownBotUserId;
|
|
119
|
-
private readonly ownBotId;
|
|
120
|
-
private readonly minify;
|
|
121
|
-
private readonly now;
|
|
122
|
-
private readonly dedup;
|
|
123
|
-
constructor(props: Props);
|
|
124
|
-
process(event: SlackRawEvent): SlackProcessed;
|
|
125
|
-
}
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region lib/engine/connectors/slack-listener.d.ts
|
|
128
|
-
type SlackOnAppCreated = (app: App) => void | Promise<void>;
|
|
129
|
-
type SlackPreprocessEvent = (event: SlackRawEvent) => SlackRawEvent | null;
|
|
50
|
+
type SlackPreprocessEvent = (event: SlackRawEvent) => SlackRawEvent | null | Promise<SlackRawEvent | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Optional host hook for Slack interactivity (`block_actions`,
|
|
53
|
+
* `view_submission`, `view_closed`, `message_action`, `shortcut`) delivered
|
|
54
|
+
* via Socket Mode under the `interactive` envelope type. Funnel auto-acks
|
|
55
|
+
* the envelope for the host (flume's socket layer sends `{envelope_id}` back
|
|
56
|
+
* regardless of payload), so the host can take its time responding via the
|
|
57
|
+
* Slack web API (`views.open`, `chat.update`, …). Returning is enough — the
|
|
58
|
+
* return value is unused. Thrown errors land in the funnel logger and the
|
|
59
|
+
* connector's diagnostic log but never bubble up to flume's queue.
|
|
60
|
+
*
|
|
61
|
+
* Payload shape is intentionally `Record<string, unknown>` because Slack's
|
|
62
|
+
* interactive payload is a wide discriminated union (`type: "block_actions" |
|
|
63
|
+
* "view_submission" | "view_closed" | "message_action" | "shortcut"`) whose
|
|
64
|
+
* narrowest accurate type would couple funnel to Slack's API revisions.
|
|
65
|
+
* Hosts that need a typed payload should parse it with their own zod schema
|
|
66
|
+
* scoped to the interaction types they care about.
|
|
67
|
+
*/
|
|
68
|
+
type SlackInteractiveHandler = (payload: Record<string, unknown>) => void | Promise<void>;
|
|
130
69
|
type Deps = {
|
|
131
|
-
config: SlackConnectorConfig;
|
|
132
|
-
channelId?: string;
|
|
70
|
+
config: SlackConnectorConfig;
|
|
71
|
+
channelId?: string;
|
|
133
72
|
env?: NodeJS.ProcessEnv;
|
|
134
|
-
logger?: FunnelLogger;
|
|
73
|
+
logger?: FunnelLogger;
|
|
135
74
|
diagnosticLog?: ConnectorDiagnosticLog;
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Transform or drop the raw Slack event before the built-in processor sees it.
|
|
143
|
-
* Return null to drop the event entirely.
|
|
144
|
-
*/
|
|
145
|
-
preprocessEvent?: SlackPreprocessEvent;
|
|
75
|
+
flumeDeps?: Partial<FlumeRuntimeDeps>; /** HTTP client for `auth.test` and `reactions.add`. Defaults to NodeFunnelHttpClient. */
|
|
76
|
+
http?: FunnelHttpClient; /** Shutdown signal forwarded to the underlying Flume. */
|
|
77
|
+
signal?: AbortSignal; /** See `SlackPreprocessEvent`. Default: identity (no preprocessing). */
|
|
78
|
+
preprocessEvent?: SlackPreprocessEvent; /** See `SlackInteractiveHandler`. Default: drop interactive envelopes silently. */
|
|
79
|
+
onInteractive?: SlackInteractiveHandler;
|
|
146
80
|
};
|
|
147
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Slack listener backed by `@interactive-inc/flume`'s `FlumeSlackSource` (raw
|
|
83
|
+
* Socket Mode WebSocket + Zod). The processor layer
|
|
84
|
+
* (`FunnelSlackEventProcessor`) is the application layer — self-skip, mention
|
|
85
|
+
* detection, dedup, minify. Self-detection needs `auth.test` to learn the
|
|
86
|
+
* bot's own user/bot id, which the listener calls once at start using the
|
|
87
|
+
* bot token. Flume delivers the events API envelope and nothing else; Bolt's
|
|
88
|
+
* `app.action` / `app.command` / `preprocessEvent` hooks have no equivalent
|
|
89
|
+
* here and must be re-implemented against Slack's HTTP endpoints if needed.
|
|
90
|
+
*/
|
|
91
|
+
declare class FunnelFlumeSlackListener extends FunnelFlumeSourceListener {
|
|
148
92
|
private readonly config;
|
|
149
|
-
private readonly channelId;
|
|
150
93
|
private readonly env;
|
|
151
|
-
private readonly
|
|
152
|
-
private readonly
|
|
153
|
-
private readonly
|
|
94
|
+
private readonly flumeDeps;
|
|
95
|
+
private readonly http;
|
|
96
|
+
private readonly signal;
|
|
154
97
|
private readonly preprocessEvent;
|
|
155
|
-
private
|
|
156
|
-
private
|
|
98
|
+
private readonly onInteractive;
|
|
99
|
+
private processor;
|
|
100
|
+
private botToken;
|
|
157
101
|
constructor(deps: Deps);
|
|
158
102
|
start(notify: NotifyFn): Promise<void>;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
private
|
|
162
|
-
private
|
|
163
|
-
private
|
|
103
|
+
protected onStop(): void;
|
|
104
|
+
private handleInteractive;
|
|
105
|
+
private callAuthTest;
|
|
106
|
+
private handleEvent;
|
|
107
|
+
private deliver;
|
|
108
|
+
private postReaction;
|
|
164
109
|
}
|
|
165
110
|
//#endregion
|
|
166
111
|
//#region lib/engine/connectors/slack-connector.d.ts
|
|
167
112
|
type SlackConnectorOptions = {
|
|
168
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Optional host-side preprocessor applied to every raw Slack event after
|
|
115
|
+
* the envelope is unwrapped and BEFORE the funnel processor runs. Return
|
|
116
|
+
* the (possibly transformed) event to keep processing, or `null` to drop
|
|
117
|
+
* it (the listener records `skip:preprocess` so the drop is auditable).
|
|
118
|
+
*
|
|
119
|
+
* Useful for tenant-specific concerns funnel deliberately does not
|
|
120
|
+
* enshrine: stripping attachments, neutralizing channel-tag injection,
|
|
121
|
+
* fan-out to multiple processors, etc. Returning `null` here is the only
|
|
122
|
+
* way to drop an event for a reason the processor's gates do not cover.
|
|
123
|
+
*/
|
|
169
124
|
preprocessEvent?: SlackPreprocessEvent;
|
|
125
|
+
/**
|
|
126
|
+
* Optional host handler for Slack interactivity (button clicks, modal
|
|
127
|
+
* submissions, message actions, global shortcuts) delivered via Socket
|
|
128
|
+
* Mode under the `interactive` envelope type. Funnel auto-acks the
|
|
129
|
+
* envelope for the host, so the handler can take its time and respond via
|
|
130
|
+
* the Slack web API. Setting this is the supported alternative to running
|
|
131
|
+
* a parallel Bolt app alongside funnel just for interactivity.
|
|
132
|
+
*/
|
|
133
|
+
onInteractive?: SlackInteractiveHandler;
|
|
170
134
|
};
|
|
171
135
|
/**
|
|
172
136
|
* Slack connector descriptor. Pass `slackConnector()` to
|
|
173
|
-
* `new Funnel({ connectors: [...] })` to enable the type.
|
|
174
|
-
*
|
|
137
|
+
* `new Funnel({ connectors: [...] })` to enable the type.
|
|
138
|
+
*
|
|
139
|
+
* The listener is backed by `@interactive-inc/flume`'s `FlumeSlackSource`
|
|
140
|
+
* (raw Socket Mode WebSocket). Both the `events_api` envelope (messages,
|
|
141
|
+
* mentions, reactions, …) and the `interactive` envelope (block actions,
|
|
142
|
+
* view submissions, message actions, shortcuts) are delivered — the former
|
|
143
|
+
* runs through the funnel processor and emits notifications, the latter is
|
|
144
|
+
* handed to the optional `onInteractive` host hook (funnel auto-acks the
|
|
145
|
+
* envelope, so the host can respond via the Slack web API at its leisure).
|
|
146
|
+
* Slash commands (`slash_commands` envelope) and Bolt's middleware chain
|
|
147
|
+
* have no equivalent here yet — wire those via the Slack HTTP endpoints if
|
|
148
|
+
* needed.
|
|
175
149
|
*/
|
|
176
150
|
declare const slackConnector: (options?: SlackConnectorOptions) => ConnectorDescriptor;
|
|
177
151
|
//#endregion
|
|
178
|
-
export { FunnelSlackAdapter, FunnelSlackEventProcessor,
|
|
152
|
+
export { FunnelFlumeSlackListener, FunnelSlackAdapter, FunnelSlackEventProcessor, SlackConnectorConfig, SlackConnectorOptions, SlackEvent, SlackInteractiveHandler, SlackMessageEvent, SlackPreprocessEvent, SlackProcessed, SlackProcessedEmit, SlackProcessedSkip, SlackRawEvent, SlackReactionEvent, SlackSkipReason, slackConnector, slackConnectorSchema };
|
package/dist/connectors/slack.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { t as slackConnectorSchema } from "../slack-connector-schema-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as slackConnectorSchema } from "../slack-connector-schema-Dem8to4P.js";
|
|
2
|
+
import { t as FunnelSlackEventProcessor } from "../slack-event-processor-xFDG3US0.js";
|
|
3
|
+
import { n as FunnelFlumeSlackListener, r as FunnelSlackAdapter, t as slackConnector } from "../slack-connector-CxpWagbT.js";
|
|
4
|
+
export { FunnelFlumeSlackListener, FunnelSlackAdapter, FunnelSlackEventProcessor, slackConnector, slackConnectorSchema };
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DiagnosticsGatewayProbe, c as FunnelDiagnostics, d as DiagnosticEvent, f as previewOf, h as toDiagnosticEvent, i as DiagnosticsChannelSource, l as ReplayResult, m as toDiagnosticConnectionError, n as DiagnoseAllReport, o as DiagnosticsPublisher, p as queryRows, r as DiagnosisStatus, s as DiagnosticsTokenReader, t as ChannelDiagnosis, u as DiagnosticConnectionError } from "./funnel-diagnostics-
|
|
1
|
+
import { a as DiagnosticsGatewayProbe, c as FunnelDiagnostics, d as DiagnosticEvent, f as previewOf, h as toDiagnosticEvent, i as DiagnosticsChannelSource, l as ReplayResult, m as toDiagnosticConnectionError, n as DiagnoseAllReport, o as DiagnosticsPublisher, p as queryRows, r as DiagnosisStatus, s as DiagnosticsTokenReader, t as ChannelDiagnosis, u as DiagnosticConnectionError } from "./funnel-diagnostics-b9ar0Ing.js";
|
|
2
2
|
export { ChannelDiagnosis, DiagnoseAllReport, DiagnosisStatus, DiagnosticConnectionError, DiagnosticEvent, DiagnosticsChannelSource, DiagnosticsGatewayProbe, DiagnosticsPublisher, DiagnosticsTokenReader, FunnelDiagnostics, ReplayResult, previewOf, queryRows, toDiagnosticConnectionError, toDiagnosticEvent };
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as toDiagnosticEvent, i as toDiagnosticConnectionError, n as previewOf, r as queryRows, t as FunnelDiagnostics } from "./funnel-diagnostics-
|
|
1
|
+
import { a as toDiagnosticEvent, i as toDiagnosticConnectionError, n as previewOf, r as queryRows, t as FunnelDiagnostics } from "./funnel-diagnostics-Cvk6Sk4x.js";
|
|
2
2
|
export { FunnelDiagnostics, previewOf, queryRows, toDiagnosticConnectionError, toDiagnosticEvent };
|