@interactive-inc/claude-funnel 0.59.0 → 0.60.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 (85) hide show
  1. package/README.md +9 -3
  2. package/dist/bin.js +524 -449
  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-B3IFCj_G.d.ts → file-process-guard-DOlCr4GF.d.ts} +5 -6
  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 +282 -209
  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-Dsx6AmhH.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 +383 -342
  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-5LzwJ_F7.js → memory-diagnostic-log-CI60kNfB.js} +33 -18
  47. package/dist/{memory-token-prompter-BlFwK9k7.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-DUcZgN2Q.js → node-process-runner-DxTvycoK.js} +35 -13
  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-6foMXfFf.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-C9Hhjk-0.js → yaml-render-qW34NlYz.js} +43 -10
  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-Conbxl5O.d.ts +0 -3595
  70. package/dist/local-config-sync--f739oCJ.d.ts +0 -401
  71. package/dist/process-runner-Cx5O_fTf.d.ts +0 -49
  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,5 +1,5 @@
1
1
  //#endregion
2
- //#region lib/services/docs/funnel-docs.ts
2
+ //#region lib/engine/docs/funnel-docs.ts
3
3
  const DOCS = {
4
4
  architecture: `funnel docs architecture — how Funnel routes events
5
5
 
@@ -492,8 +492,12 @@ Hono app over these services.
492
492
  ── facade ──────────────────────────────────────────────────────────────────
493
493
 
494
494
  import { Funnel } from "@interactive-inc/claude-funnel"
495
+ import { slackConnector } from "@interactive-inc/claude-funnel/connectors/slack"
495
496
 
496
- const funnel = new Funnel() // uses ~/.funnel
497
+ // Connectors are fully DI: pass only the types you use. The core import never
498
+ // bundles a connector SDK (@slack/bolt, discord.js) — importing the sub-entry
499
+ // does. With no connectors, the funnel handles zero connector types.
500
+ const funnel = new Funnel({ connectors: [slackConnector()] }) // uses ~/.funnel
497
501
  const sandbox = Funnel.inMemory() // touches no disk / process / clock
498
502
 
499
503
  funnel.paths // { dir, tmpDir, settings }
@@ -534,6 +538,72 @@ For targeted imports (smaller bundle / clearer dependency footprint):
534
538
  import { FunnelGatewayServer } from "@interactive-inc/claude-funnel/gateway"
535
539
  import { FunnelProfiles } from "@interactive-inc/claude-funnel/profiles"
536
540
  import { FunnelLocalConfig } from "@interactive-inc/claude-funnel/local-config"
541
+ import { slackConnector } from "@interactive-inc/claude-funnel/connectors/slack"
542
+ import { ghConnector } from "@interactive-inc/claude-funnel/connectors/gh"
543
+ import { discordConnector } from "@interactive-inc/claude-funnel/connectors/discord"
544
+ import { scheduleConnector } from "@interactive-inc/claude-funnel/connectors/schedule"
545
+
546
+ // Connector launch hooks are closed over by the descriptor factory:
547
+ // slackConnector({ onAppCreated, preprocessEvent })
548
+ // scheduleConnector({ onFired })
549
+
550
+ ── in-process gateway: receive events in your own process ──────────────────
551
+
552
+ The daemon (funnel.gateway.start()) runs in a separate process, so your code
553
+ cannot observe its events directly. To receive events in-process, host the
554
+ gateway yourself with gatewayServer():
555
+
556
+ import { Funnel, channelWsUrl } from "@interactive-inc/claude-funnel"
557
+ import { slackConnector } from "@interactive-inc/claude-funnel/connectors/slack"
558
+
559
+ const funnel = new Funnel({ connectors: [slackConnector()] })
560
+ funnel.channels.add({ name: "inbox" })
561
+ funnel.channels.addConnector("inbox", {
562
+ type: "slack", name: "ops",
563
+ botTokenEnv: "SLACK_BOT_TOKEN", appTokenEnv: "SLACK_APP_TOKEN",
564
+ })
565
+
566
+ const server = funnel.gatewayServer({ port: 9742 })
567
+ await server.start() // boots listeners, binds HTTP + WS
568
+ server.port // resolved port (use port: 0 to auto-assign)
569
+
570
+ const unsubscribe = server.onEvent((event) => {
571
+ console.log(event.content, event.meta, event.offset)
572
+ })
573
+
574
+ await funnel.publisher.publish("inbox", { content: "hello" })
575
+
576
+ unsubscribe()
577
+ await server.stop() // stops listeners, closes the socket
578
+
579
+ To observe a daemon (separate process) instead, connect a WebSocket client:
580
+
581
+ const url = channelWsUrl({ base: "ws://127.0.0.1:9743/ws", channel: "inbox" })
582
+ const ws = new WebSocket(url, channelWsProtocols(token))
583
+
584
+ ── publishing: publisher.publish vs server emit ────────────────────────────
585
+
586
+ funnel.publisher.publish(channel, req) // HTTP hop to the daemon; works from
587
+ // any process; returns { state: "ok" |
588
+ // "offline" | "error" }
589
+ server.emit(event) // direct in-process injection into a
590
+ // gatewayServer() you host yourself;
591
+ // no HTTP, no offline state
592
+
593
+ Rule of thumb: talking to the shared daemon → publish; hosting the gateway
594
+ in your own process → emit (or publish against your own port).
595
+
596
+ ── error handling: two deliberate styles ───────────────────────────────────
597
+
598
+ - Engine CRUD (channels / profiles / localConfig) THROWS. A failure there is
599
+ a programming or configuration error (duplicate name, unknown channel) —
600
+ let it surface, or try/catch at your boundary.
601
+ - Gateway clients (publisher / listeners / gateway / recovery) return result
602
+ objects like { state: "ok" | "offline" | "error" } or { ok, actions }. A
603
+ daemon being down is an expected runtime state, not an exception.
604
+
605
+ If a method talks over HTTP to a daemon that might not be running, expect a
606
+ result object; otherwise expect a throw.
537
607
 
538
608
  ── building your own CLI ───────────────────────────────────────────────────
539
609
 
@@ -541,8 +611,11 @@ The Funnel CLI is a Hono app you can embed:
541
611
 
542
612
  import { cliRoutes, toRequest } from "@interactive-inc/claude-funnel"
543
613
  import { Funnel } from "@interactive-inc/claude-funnel"
614
+ import { slackConnector } from "@interactive-inc/claude-funnel/connectors/slack"
615
+ import { ghConnector } from "@interactive-inc/claude-funnel/connectors/gh"
544
616
 
545
- const funnel = new Funnel()
617
+ // List every connector type your CLI's "channels ... connectors" commands accept.
618
+ const funnel = new Funnel({ connectors: [slackConnector(), ghConnector()] })
546
619
  const { method, url } = toRequest(process.argv.slice(2))
547
620
  const res = await cliRoutes.request(url, { method }, { funnel })
548
621
 
@@ -1,4 +1,4 @@
1
- //#region lib/services/docs/funnel-docs.d.ts
1
+ //#region lib/engine/docs/funnel-docs.d.ts
2
2
  type DocsTopicListing = {
3
3
  name: string;
4
4
  summary: string;
@@ -1,5 +1,5 @@
1
- import { c as FunnelDiagnostics, n as DiagnoseAllReport, t as ChannelDiagnosis } from "./funnel-diagnostics-K-wON25Y.js";
2
- import { n as RecoveryAction, t as FunnelRecovery } from "./funnel-recovery-COExL9MD.js";
1
+ import { c as FunnelDiagnostics, n as DiagnoseAllReport, t as ChannelDiagnosis } from "./funnel-diagnostics-DpXOsCty.js";
2
+ import { n as RecoveryAction, t as FunnelRecovery } from "./funnel-recovery-DnLrdWO9.js";
3
3
 
4
4
  //#region lib/services/doctor/funnel-doctor.d.ts
5
5
  type Props = {
@@ -1,4 +1,4 @@
1
- import { t as ChannelConfig } from "./settings-schema-1hh11jnN.js";
1
+ import { t as ChannelConfig } from "./settings-schema-D1xcOqRu.js";
2
2
 
3
3
  //#region lib/services/recovery/funnel-recovery.d.ts
4
4
  /** Narrow gateway control — start / stop / restart and a probe. */