@interactive-inc/claude-funnel 0.40.0 → 0.49.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 +34 -9
- package/dist/bin.js +255 -256
- package/dist/gateway/daemon.js +151 -152
- package/dist/index.d.ts +160 -286
- package/dist/index.js +520 -981
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Slack のメンション、GitHub の Issue、毎朝 9 時の cron。こうし
|
|
|
16
16
|
返信は同じコネクタを逆向きに通る(エージェント → MCP tool → 外部サービス)。
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
コマンドは `funnel`(短縮形 `fnl`)。Claude Code
|
|
19
|
+
コマンドは `funnel`(短縮形 `fnl`)。Claude Code を中心に作っているが、アーキテクチャはエージェント非依存。現在のバージョンは `0.49.0`。
|
|
20
20
|
|
|
21
21
|
## funnel がやること
|
|
22
22
|
|
|
@@ -142,7 +142,7 @@ fnl gateway start
|
|
|
142
142
|
fnl claude --channel ops
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
delivery
|
|
145
|
+
delivery モードはチャネル作成時に選ぶ。`tap=all` は廃止されており、WS 購読は `?id=<uuid>` の targeted delivery のみ。
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
148
|
fnl channels add reviews # fanout(デフォルト): 全エージェントが全イベント
|
|
@@ -199,7 +199,7 @@ external sources outbound replies
|
|
|
199
199
|
|
|
200
200
|
transport モデルは 2 つの概念でできている。
|
|
201
201
|
|
|
202
|
-
Channel は名前付きの購読箱(transport のみ)。1 つ以上のコネクタと delivery モードを持ち、起動フラグは持たない。エージェントセッションはちょうど 1 つのチャネルを購読する。delivery は `fanout`(全 subscriber が全イベントを見る、デフォルト)か `exclusive`(1 イベントを 1 subscriber が round-robin で消費、ワーカープール向け)。
|
|
202
|
+
Channel は名前付きの購読箱(transport のみ)。1 つ以上のコネクタと delivery モードを持ち、起動フラグは持たない。エージェントセッションはちょうど 1 つのチャネルを購読する。WS 接続は `?id=<uuid>` の targeted delivery のみで、`tap=all` は廃止されている。delivery は `fanout`(全 subscriber が全イベントを見る、デフォルト)か `exclusive`(1 イベントを 1 subscriber が round-robin で消費、ワーカープール向け)。
|
|
203
203
|
|
|
204
204
|
Connector はチャネルから外部ソースへの 1 つの接続。`slack` / `gh` / `discord` / `schedule` の 4 型。前者 3 つは双方向(イベント入力・返信出力)、`schedule` は一方向(cron tick の入力のみ)。
|
|
205
205
|
|
|
@@ -330,7 +330,7 @@ Settings = { channels[], profiles[] } → ~/.funnel/settings.j
|
|
|
330
330
|
|
|
331
331
|
## プログラマブル API(Bun)
|
|
332
332
|
|
|
333
|
-
CLI を介さず、ライブラリとして組み込める。CLI が使うのと同じ `Funnel` facade をパッケージのルートから export
|
|
333
|
+
CLI を介さず、ライブラリとして組み込める。CLI が使うのと同じ `Funnel` facade をパッケージのルートから export している。`new Funnel()` は constructor で全依存を即座に組み立てて freeze する(完全イミュータブル)。
|
|
334
334
|
|
|
335
335
|
```ts
|
|
336
336
|
import { Funnel } from "@interactive-inc/claude-funnel"
|
|
@@ -346,16 +346,19 @@ funnel.channels.addConnector("inbox", {
|
|
|
346
346
|
})
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
-
`channels` / `profiles` / `gateway` / `listeners` / `
|
|
349
|
+
`channels` / `profiles` / `gateway` / `listeners` / `claude` / `localConfig` / `localConfigSync` など全ファセットが同じインスタンスの readonly プロパティとして辿れる。`gateway` はデーモンの起動・停止、`listeners` は動作中デーモンとの HTTP 会話、`claude` はエージェント起動を担う。
|
|
350
350
|
|
|
351
351
|
```ts
|
|
352
|
-
await funnel.gateway.start()
|
|
353
|
-
funnel.gateway.getStatus()
|
|
352
|
+
await funnel.gateway.start() // デーモンを別プロセスとして spawn
|
|
353
|
+
funnel.gateway.getStatus() // { running, pid, port }
|
|
354
354
|
|
|
355
355
|
await funnel.listeners.start("inbox", "my-slack")
|
|
356
356
|
await funnel.listeners.restart("inbox", "my-slack")
|
|
357
357
|
|
|
358
358
|
await funnel.claude.launch({ channel: "inbox" }) // claude を起動(.mcp.json も自動で書く)
|
|
359
|
+
|
|
360
|
+
// profiles / localConfig / localConfigSync も直接アクセス可
|
|
361
|
+
funnel.profiles.add({ name: "pm", path: "/repo", channelId: channel.id })
|
|
359
362
|
```
|
|
360
363
|
|
|
361
364
|
デーモンを spawn せず、gateway をインプロセスで動かすこともできる(テストや埋め込み向け)。`onEvent` で全 broadcast イベントをインプロセスで観測できる。
|
|
@@ -372,16 +375,38 @@ unsubscribe()
|
|
|
372
375
|
|
|
373
376
|
永続化と再生は `FunnelEventLog` port の裏にある。デフォルトは `SqliteFunnelEventLog`(デーモン再起動を跨いで durable。reconnect 時の再生を提供する)。`gatewayServer({ eventLog })` に `MemoryFunnelEventLog` を渡せば durable な再生を差し替え・無効化できる。`onEvent` は書き込み専用の観測フックで、再生(読み戻し)は EventLog の責務。
|
|
374
377
|
|
|
378
|
+
### サブエントリ
|
|
379
|
+
|
|
380
|
+
個別の層だけを import したい場合は sub-entry を使う。
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
// in-process gateway building blocks(FunnelGatewayServer, FunnelBroadcaster 等)
|
|
384
|
+
import { FunnelGatewayServer } from "@interactive-inc/claude-funnel/gateway"
|
|
385
|
+
|
|
386
|
+
// 名前付き起動プロファイル管理
|
|
387
|
+
import { FunnelProfiles } from "@interactive-inc/claude-funnel/profiles"
|
|
388
|
+
|
|
389
|
+
// funnel.json reader / writer / syncer
|
|
390
|
+
import { FunnelLocalConfig } from "@interactive-inc/claude-funnel/local-config"
|
|
391
|
+
|
|
392
|
+
// コネクタスキーマ(Slack / Discord / GitHub / Schedule)
|
|
393
|
+
import { slackConnectorSchema } from "@interactive-inc/claude-funnel/connectors/slack"
|
|
394
|
+
```
|
|
395
|
+
|
|
375
396
|
### テスト用のサンドボックス
|
|
376
397
|
|
|
377
398
|
`Funnel.inMemory()` は全 IO 境界(ディスク / プロセス / clock / UUID)を Memory 実装で配線済みの Funnel を返す。`props` の任意の部分集合で個々の seam を上書きできるので、実 FS や spawn に触れずにテストを書ける。
|
|
378
399
|
|
|
379
400
|
```ts
|
|
380
|
-
|
|
401
|
+
import { MemoryFunnelTokenPrompter } from "@interactive-inc/claude-funnel"
|
|
402
|
+
|
|
403
|
+
const funnel = Funnel.inMemory({
|
|
404
|
+
tokenPrompter: new MemoryFunnelTokenPrompter(), // TTY プロンプトを差し替え
|
|
405
|
+
})
|
|
381
406
|
funnel.channels.add({ name: "inbox" }) // インメモリ store を変更する
|
|
382
407
|
```
|
|
383
408
|
|
|
384
|
-
`fnl` を支える Hono アプリ(`
|
|
409
|
+
`fnl` を支える Hono アプリ(`cliRoutes` / `toRequest`)や、各コネクタの Zod スキーマも export している。詳細は型定義を参照。
|
|
385
410
|
|
|
386
411
|
## Claude Code skill
|
|
387
412
|
|