@interactive-inc/claude-funnel 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/claude-CB1WkV77.d.ts +115 -0
  3. package/dist/claude.d.ts +59 -0
  4. package/dist/claude.js +322 -0
  5. package/dist/{connector-diagnostic-log-OPpPi9V9.d.ts → connector-diagnostic-log-yTOojKUR.d.ts} +14 -14
  6. package/dist/{logger-Czli2OKh.js → connector-listener-DU54DN-f.js} +1 -9
  7. package/dist/connectors/discord.d.ts +3 -3
  8. package/dist/connectors/discord.js +2 -1
  9. package/dist/connectors/gh.d.ts +4 -3
  10. package/dist/connectors/gh.js +2 -1
  11. package/dist/connectors/schedule.d.ts +1 -1
  12. package/dist/connectors/schedule.js +2 -1
  13. package/dist/connectors/slack.d.ts +2 -2
  14. package/dist/connectors/slack.js +2 -1
  15. package/dist/discord-connector-schema-CBDyGdOI.js +21 -0
  16. package/dist/{discord-connector-schema-BeThExJp.js → discord-listener-_jSE3HsQ.js} +2 -22
  17. package/dist/file-system-BeOKXjlV.d.ts +26 -0
  18. package/dist/file-system-PWKKU7lA.js +9 -0
  19. package/dist/gateway.d.ts +3 -0
  20. package/dist/gateway.js +2 -0
  21. package/dist/gh-connector-schema-eoTtHbY6.d.ts +14 -0
  22. package/dist/{gh-connector-schema-eYE4g77K.js → gh-connector-schema-o3Q1-ojL.js} +1 -176
  23. package/dist/gh-listener-DH-fClQm.js +178 -0
  24. package/dist/index-ChomoTZ5.d.ts +3404 -0
  25. package/dist/index.d.ts +11 -4083
  26. package/dist/index.js +247 -3459
  27. package/dist/local-config-json-schema-8IHjS4Q7.js +439 -0
  28. package/dist/local-config-sync-BdsrDZOu.d.ts +381 -0
  29. package/dist/local-config.d.ts +3 -0
  30. package/dist/local-config.js +3 -0
  31. package/dist/logger-BP6SisKt.js +9 -0
  32. package/dist/mcp-Dr-nIBwN.js +253 -0
  33. package/dist/memory-connector-diagnostic-log-CrW1ltLM.js +2245 -0
  34. package/dist/memory-token-prompter-B5FFCsGP.d.ts +57 -0
  35. package/dist/memory-token-prompter-CLerGsgM.js +61 -0
  36. package/dist/node-file-system-BcrmWN9I.js +48 -0
  37. package/dist/{gh-connector-schema-CQmEWzdV.d.ts → process-runner-DfniuWVU.d.ts} +1 -14
  38. package/dist/profiles-f0mNmEyP.d.ts +64 -0
  39. package/dist/profiles-wMRnjSid.js +129 -0
  40. package/dist/profiles.d.ts +2 -0
  41. package/dist/profiles.js +2 -0
  42. package/dist/schedule-connector-schema-iCI61gzU.js +31 -0
  43. package/dist/{schedule-listener-3M6WkH1Y.d.ts → schedule-listener-CUyUFFR1.d.ts} +22 -46
  44. package/dist/{schedule-connector-schema-CM-sRkac.js → schedule-listener-ePAjians.js} +3 -86
  45. package/dist/settings-reader-BSU6JyvM.d.ts +167 -0
  46. package/dist/settings-reader-DPqrpV7s.js +11 -0
  47. package/dist/settings-store-D2XSXTyt.js +186 -0
  48. package/dist/slack-connector-schema-BCNWluHM.js +32 -0
  49. package/dist/{slack-listener-9UdAn_ui.d.ts → slack-listener-Bv5xI9gC.d.ts} +31 -31
  50. package/dist/{slack-connector-schema-DDbSGPZn.js → slack-listener-ClQuHhEF.js} +2 -32
  51. package/package.json +1 -1
  52. /package/dist/{connector-adapter-VA6undzc.d.ts → connector-adapter-DKgsVuMH.d.ts} +0 -0
  53. /package/dist/{discord-connector-schema-DF4pL3Sc.d.ts → discord-connector-schema-R0Uu-3ns.d.ts} +0 -0
@@ -1,5 +1,3 @@
1
- import { t as FunnelConnectorAdapter } from "./connector-adapter-D5Utumgz.js";
2
- import { n as FunnelConnectorListener } from "./logger-Czli2OKh.js";
3
1
  import { openSync } from "node:fs";
4
2
  import { z } from "zod";
5
3
  //#region lib/engine/process/process-runner.ts
@@ -225,179 +223,6 @@ var NodeFunnelProcessRunner = class extends FunnelProcessRunner {
225
223
  }
226
224
  };
227
225
  //#endregion
228
- //#region lib/connectors/gh-adapter.ts
229
- const defaultProcess$1 = new NodeFunnelProcessRunner();
230
- var FunnelGhAdapter = class extends FunnelConnectorAdapter {
231
- process;
232
- constructor(deps = {}) {
233
- super();
234
- this.process = deps.process ?? defaultProcess$1;
235
- Object.freeze(this);
236
- }
237
- async call(input) {
238
- const args = ["api", input.path];
239
- if (input.method && input.method.toLowerCase() !== "get") args.push("-X", input.method.toUpperCase());
240
- const hasBody = input.body && typeof input.body === "object" && Object.keys(input.body).length > 0;
241
- if (hasBody) args.push("--input", "-");
242
- const result = await this.process.run(["gh", ...args], { input: hasBody ? JSON.stringify(input.body) : void 0 });
243
- if (result.exitCode !== 0) throw new Error(`gh api failed: ${result.stderr.trim() || result.stdout.trim()}`);
244
- try {
245
- return JSON.parse(result.stdout);
246
- } catch {
247
- return result.stdout;
248
- }
249
- }
250
- };
251
- //#endregion
252
- //#region lib/connectors/gh-listener.ts
253
- const ghNotificationSchema = z.object({
254
- id: z.string(),
255
- reason: z.string(),
256
- subject: z.object({
257
- type: z.string(),
258
- url: z.string(),
259
- title: z.string()
260
- }),
261
- repository: z.object({ full_name: z.string() }),
262
- updated_at: z.string()
263
- });
264
- const ghNotificationsSchema = z.array(ghNotificationSchema);
265
- const defaultProcess = new NodeFunnelProcessRunner();
266
- const MAX_SEEN = 1e4;
267
- const KEEP_SEEN = 5e3;
268
- var FunnelGhListener = class extends FunnelConnectorListener {
269
- config;
270
- channelId;
271
- process;
272
- logger;
273
- diagnosticLog;
274
- now;
275
- seen = /* @__PURE__ */ new Map();
276
- bootstrapped = false;
277
- since;
278
- timer = null;
279
- constructor(deps) {
280
- super();
281
- this.config = deps.config;
282
- this.channelId = deps.channelId ?? null;
283
- this.process = deps.process ?? defaultProcess;
284
- this.logger = deps.logger;
285
- this.diagnosticLog = deps.diagnosticLog;
286
- this.now = deps.now ?? (() => /* @__PURE__ */ new Date());
287
- this.since = this.now().toISOString();
288
- }
289
- async start(notify) {
290
- this.recordConnection("started", "");
291
- await this.pollOnce(notify);
292
- const interval = this.config.pollInterval ?? 60;
293
- this.timer = setInterval(() => void this.pollOnce(notify), interval * 1e3);
294
- this.timer.unref();
295
- }
296
- async stop() {
297
- if (!this.timer) return;
298
- clearInterval(this.timer);
299
- this.timer = null;
300
- this.recordConnection("stopped", "");
301
- }
302
- isAlive() {
303
- return this.timer !== null;
304
- }
305
- async pollOnce(notify) {
306
- const nextSince = this.now().toISOString();
307
- const params = new URLSearchParams({
308
- since: this.since,
309
- all: "false"
310
- });
311
- try {
312
- const result = await this.process.run([
313
- "gh",
314
- "api",
315
- `/notifications?${params}`
316
- ]);
317
- if (result.exitCode !== 0) {
318
- this.recordConnection("error", `gh api exited ${result.exitCode}: ${result.stderr}`);
319
- this.logger?.error("gh poll failed", { stderr: result.stderr });
320
- return;
321
- }
322
- const parsed = ghNotificationsSchema.safeParse(JSON.parse(result.stdout));
323
- if (!parsed.success) {
324
- this.recordConnection("error", `gh response schema mismatch: ${parsed.error.message}`);
325
- this.logger?.warn("gh response did not match schema", { error: parsed.error.message });
326
- return;
327
- }
328
- if (!this.bootstrapped) this.recordConnection("connected", "");
329
- const items = parsed.data;
330
- for (const item of items) {
331
- if (this.seen.get(item.id) === item.updated_at) continue;
332
- this.seen.set(item.id, item.updated_at);
333
- this.recordRaw(item.id, item);
334
- if (!this.bootstrapped) {
335
- this.recordProcessed(item.id, item, "skip:bootstrap", "");
336
- continue;
337
- }
338
- const meta = {
339
- event_type: "gh",
340
- reason: item.reason,
341
- subject_type: item.subject.type,
342
- subject_url: item.subject.url,
343
- repository: item.repository.full_name,
344
- thread_id: item.id,
345
- updated_at: item.updated_at
346
- };
347
- const content = JSON.stringify(item);
348
- try {
349
- await notify(content, meta);
350
- } catch (error) {
351
- this.recordProcessed(item.id, item, "emitted:delivery-failed", content);
352
- throw error;
353
- }
354
- this.recordProcessed(item.id, item, "emitted", content);
355
- }
356
- if (this.seen.size > MAX_SEEN) {
357
- const toDrop = this.seen.size - KEEP_SEEN;
358
- let dropped = 0;
359
- for (const key of this.seen.keys()) {
360
- if (dropped >= toDrop) break;
361
- this.seen.delete(key);
362
- dropped++;
363
- }
364
- }
365
- this.since = nextSince;
366
- this.bootstrapped = true;
367
- } catch (error) {
368
- this.logger?.error("gh poll error", { error: error instanceof Error ? error.message : String(error) });
369
- }
370
- }
371
- recordRaw(eventId, item) {
372
- this.diagnosticLog?.recordRaw({
373
- eventId,
374
- type: "gh",
375
- connectorId: this.config.id,
376
- channelId: this.channelId,
377
- payload: JSON.stringify(item)
378
- });
379
- }
380
- recordProcessed(eventId, item, outcome, content) {
381
- this.diagnosticLog?.recordProcessed({
382
- eventId,
383
- type: "gh",
384
- connectorId: this.config.id,
385
- channelId: this.channelId,
386
- outcome,
387
- payload: content || JSON.stringify(item)
388
- });
389
- }
390
- recordConnection(status, detail) {
391
- this.diagnosticLog?.recordConnection({
392
- type: "gh",
393
- connectorId: this.config.id,
394
- channelId: this.channelId,
395
- status,
396
- detail
397
- });
398
- }
399
- };
400
- //#endregion
401
226
  //#region lib/connectors/gh-connector-schema.ts
402
227
  const ghConnectorSchema = z.object({
403
228
  id: z.string(),
@@ -408,4 +233,4 @@ const ghConnectorSchema = z.object({
408
233
  updatedAt: z.string().datetime().optional()
409
234
  });
410
235
  //#endregion
411
- export { FunnelProcessRunner as a, NodeFunnelProcessRunner as i, FunnelGhListener as n, FunnelGhAdapter as r, ghConnectorSchema as t };
236
+ export { NodeFunnelProcessRunner as n, FunnelProcessRunner as r, ghConnectorSchema as t };
@@ -0,0 +1,178 @@
1
+ import { t as FunnelConnectorAdapter } from "./connector-adapter-D5Utumgz.js";
2
+ import { t as FunnelConnectorListener } from "./connector-listener-DU54DN-f.js";
3
+ import { n as NodeFunnelProcessRunner } from "./gh-connector-schema-o3Q1-ojL.js";
4
+ import { z } from "zod";
5
+ //#region lib/connectors/gh-adapter.ts
6
+ const defaultProcess$1 = new NodeFunnelProcessRunner();
7
+ var FunnelGhAdapter = class extends FunnelConnectorAdapter {
8
+ process;
9
+ constructor(deps = {}) {
10
+ super();
11
+ this.process = deps.process ?? defaultProcess$1;
12
+ Object.freeze(this);
13
+ }
14
+ async call(input) {
15
+ const args = ["api", input.path];
16
+ if (input.method && input.method.toLowerCase() !== "get") args.push("-X", input.method.toUpperCase());
17
+ const hasBody = input.body && typeof input.body === "object" && Object.keys(input.body).length > 0;
18
+ if (hasBody) args.push("--input", "-");
19
+ const result = await this.process.run(["gh", ...args], { input: hasBody ? JSON.stringify(input.body) : void 0 });
20
+ if (result.exitCode !== 0) throw new Error(`gh api failed: ${result.stderr.trim() || result.stdout.trim()}`);
21
+ try {
22
+ return JSON.parse(result.stdout);
23
+ } catch {
24
+ return result.stdout;
25
+ }
26
+ }
27
+ };
28
+ //#endregion
29
+ //#region lib/connectors/gh-listener.ts
30
+ const ghNotificationSchema = z.object({
31
+ id: z.string(),
32
+ reason: z.string(),
33
+ subject: z.object({
34
+ type: z.string(),
35
+ url: z.string(),
36
+ title: z.string()
37
+ }),
38
+ repository: z.object({ full_name: z.string() }),
39
+ updated_at: z.string()
40
+ });
41
+ const ghNotificationsSchema = z.array(ghNotificationSchema);
42
+ const defaultProcess = new NodeFunnelProcessRunner();
43
+ const MAX_SEEN = 1e4;
44
+ const KEEP_SEEN = 5e3;
45
+ var FunnelGhListener = class extends FunnelConnectorListener {
46
+ config;
47
+ channelId;
48
+ process;
49
+ logger;
50
+ diagnosticLog;
51
+ now;
52
+ seen = /* @__PURE__ */ new Map();
53
+ bootstrapped = false;
54
+ since;
55
+ timer = null;
56
+ constructor(deps) {
57
+ super();
58
+ this.config = deps.config;
59
+ this.channelId = deps.channelId ?? null;
60
+ this.process = deps.process ?? defaultProcess;
61
+ this.logger = deps.logger;
62
+ this.diagnosticLog = deps.diagnosticLog;
63
+ this.now = deps.now ?? (() => /* @__PURE__ */ new Date());
64
+ this.since = this.now().toISOString();
65
+ }
66
+ async start(notify) {
67
+ this.recordConnection("started", "");
68
+ await this.pollOnce(notify);
69
+ const interval = this.config.pollInterval ?? 60;
70
+ this.timer = setInterval(() => void this.pollOnce(notify), interval * 1e3);
71
+ this.timer.unref();
72
+ }
73
+ async stop() {
74
+ if (!this.timer) return;
75
+ clearInterval(this.timer);
76
+ this.timer = null;
77
+ this.recordConnection("stopped", "");
78
+ }
79
+ isAlive() {
80
+ return this.timer !== null;
81
+ }
82
+ async pollOnce(notify) {
83
+ const nextSince = this.now().toISOString();
84
+ const params = new URLSearchParams({
85
+ since: this.since,
86
+ all: "false"
87
+ });
88
+ try {
89
+ const result = await this.process.run([
90
+ "gh",
91
+ "api",
92
+ `/notifications?${params}`
93
+ ]);
94
+ if (result.exitCode !== 0) {
95
+ this.recordConnection("error", `gh api exited ${result.exitCode}: ${result.stderr}`);
96
+ this.logger?.error("gh poll failed", { stderr: result.stderr });
97
+ return;
98
+ }
99
+ const parsed = ghNotificationsSchema.safeParse(JSON.parse(result.stdout));
100
+ if (!parsed.success) {
101
+ this.recordConnection("error", `gh response schema mismatch: ${parsed.error.message}`);
102
+ this.logger?.warn("gh response did not match schema", { error: parsed.error.message });
103
+ return;
104
+ }
105
+ if (!this.bootstrapped) this.recordConnection("connected", "");
106
+ const items = parsed.data;
107
+ for (const item of items) {
108
+ if (this.seen.get(item.id) === item.updated_at) continue;
109
+ this.seen.set(item.id, item.updated_at);
110
+ this.recordRaw(item.id, item);
111
+ if (!this.bootstrapped) {
112
+ this.recordProcessed(item.id, item, "skip:bootstrap", "");
113
+ continue;
114
+ }
115
+ const meta = {
116
+ event_type: "gh",
117
+ reason: item.reason,
118
+ subject_type: item.subject.type,
119
+ subject_url: item.subject.url,
120
+ repository: item.repository.full_name,
121
+ thread_id: item.id,
122
+ updated_at: item.updated_at
123
+ };
124
+ const content = JSON.stringify(item);
125
+ try {
126
+ await notify(content, meta);
127
+ } catch (error) {
128
+ this.recordProcessed(item.id, item, "emitted:delivery-failed", content);
129
+ throw error;
130
+ }
131
+ this.recordProcessed(item.id, item, "emitted", content);
132
+ }
133
+ if (this.seen.size > MAX_SEEN) {
134
+ const toDrop = this.seen.size - KEEP_SEEN;
135
+ let dropped = 0;
136
+ for (const key of this.seen.keys()) {
137
+ if (dropped >= toDrop) break;
138
+ this.seen.delete(key);
139
+ dropped++;
140
+ }
141
+ }
142
+ this.since = nextSince;
143
+ this.bootstrapped = true;
144
+ } catch (error) {
145
+ this.logger?.error("gh poll error", { error: error instanceof Error ? error.message : String(error) });
146
+ }
147
+ }
148
+ recordRaw(eventId, item) {
149
+ this.diagnosticLog?.recordRaw({
150
+ eventId,
151
+ type: "gh",
152
+ connectorId: this.config.id,
153
+ channelId: this.channelId,
154
+ payload: JSON.stringify(item)
155
+ });
156
+ }
157
+ recordProcessed(eventId, item, outcome, content) {
158
+ this.diagnosticLog?.recordProcessed({
159
+ eventId,
160
+ type: "gh",
161
+ connectorId: this.config.id,
162
+ channelId: this.channelId,
163
+ outcome,
164
+ payload: content || JSON.stringify(item)
165
+ });
166
+ }
167
+ recordConnection(status, detail) {
168
+ this.diagnosticLog?.recordConnection({
169
+ type: "gh",
170
+ connectorId: this.config.id,
171
+ channelId: this.channelId,
172
+ status,
173
+ detail
174
+ });
175
+ }
176
+ };
177
+ //#endregion
178
+ export { FunnelGhAdapter as n, FunnelGhListener as t };