@interactive-inc/claude-funnel 0.8.1 → 0.10.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 +179 -80
- package/dist/bin.js +726 -658
- package/dist/connector-adapter-CXB-q_XC.d.ts +11 -0
- package/dist/connector-adapter-D5Utumgz.js +4 -0
- package/dist/connectors/discord.d.ts +76 -0
- package/dist/connectors/discord.js +2 -0
- package/dist/connectors/gh.d.ts +38 -0
- package/dist/connectors/gh.js +2 -0
- package/dist/connectors/schedule.d.ts +53 -0
- package/dist/connectors/schedule.js +2 -0
- package/dist/connectors/slack.d.ts +34 -0
- package/dist/connectors/slack.js +2 -0
- package/dist/discord-connector-schema-Dww2I4zH.d.ts +14 -0
- package/dist/discord-connector-schema-ygf5Df-2.js +173 -0
- package/dist/file-system-Co60LrmR.d.ts +74 -0
- package/dist/gateway/daemon.js +233 -183
- package/dist/gh-connector-schema-2ml29MBC.js +218 -0
- package/dist/gh-connector-schema-BZFAS-p-.d.ts +45 -0
- package/dist/index.d.ts +3881 -36
- package/dist/index.js +6217 -3483
- package/dist/logger-CTlXs7z4.d.ts +33 -0
- package/dist/node-logger-DQz_BGOD.js +61 -0
- package/dist/schedule-connector-schema-CkuIQ0JQ.js +325 -0
- package/dist/slack-connector-schema-Cd22WiHB.js +153 -0
- package/dist/slack-event-processor-CS-bAit9.d.ts +43 -0
- package/package.json +34 -28
- package/dist/cli/factory.d.ts +0 -7
- package/dist/cli/router/query-to-cli-args.d.ts +0 -1
- package/dist/cli/router/to-request.d.ts +0 -5
- package/dist/cli/router/validator.d.ts +0 -5
- package/dist/cli/routes/channels.$channel.connectors.$connector.d.ts +0 -42
- package/dist/cli/routes/channels.$channel.connectors.$connector.rename.$newName.d.ts +0 -46
- package/dist/cli/routes/channels.$channel.connectors.$connector.request.d.ts +0 -54
- package/dist/cli/routes/channels.$channel.connectors.$connector.schedules.add.$id.d.ts +0 -66
- package/dist/cli/routes/channels.$channel.connectors.$connector.schedules.d.ts +0 -42
- package/dist/cli/routes/channels.$channel.connectors.$connector.schedules.remove.$id.d.ts +0 -46
- package/dist/cli/routes/channels.$channel.connectors.add.$connector.d.ts +0 -90
- package/dist/cli/routes/channels.$channel.connectors.d.ts +0 -38
- package/dist/cli/routes/channels.$channel.connectors.remove.$connector.d.ts +0 -42
- package/dist/cli/routes/channels.$channel.connectors.set.$connector.d.ts +0 -62
- package/dist/cli/routes/channels.$channel.d.ts +0 -38
- package/dist/cli/routes/channels.$channel.rename.$newName.d.ts +0 -42
- package/dist/cli/routes/channels.$channel.set.delivery.$mode.d.ts +0 -28
- package/dist/cli/routes/channels.add.$channel.d.ts +0 -46
- package/dist/cli/routes/channels.d.ts +0 -16
- package/dist/cli/routes/channels.remove.$channel.d.ts +0 -38
- package/dist/cli/routes/claude.d.ts +0 -32
- package/dist/cli/routes/gateway.d.ts +0 -20
- package/dist/cli/routes/gateway.listeners.d.ts +0 -17
- package/dist/cli/routes/gateway.logs.d.ts +0 -24
- package/dist/cli/routes/gateway.restart.d.ts +0 -24
- package/dist/cli/routes/gateway.run.d.ts +0 -24
- package/dist/cli/routes/gateway.start.d.ts +0 -24
- package/dist/cli/routes/gateway.status.d.ts +0 -13
- package/dist/cli/routes/gateway.stop.d.ts +0 -16
- package/dist/cli/routes/index.d.ts +0 -1222
- package/dist/cli/routes/profiles.$profile.as-default.d.ts +0 -38
- package/dist/cli/routes/profiles.$profile.rename.$newName.d.ts +0 -42
- package/dist/cli/routes/profiles.$profile.run.d.ts +0 -46
- package/dist/cli/routes/profiles.add.$profile.d.ts +0 -54
- package/dist/cli/routes/profiles.d.ts +0 -16
- package/dist/cli/routes/profiles.remove.$profile.d.ts +0 -38
- package/dist/cli/routes/profiles.set.$profile.d.ts +0 -54
- package/dist/cli/routes/status.d.ts +0 -16
- package/dist/cli/routes/update.d.ts +0 -16
- package/dist/connectors/connector-adapter.d.ts +0 -8
- package/dist/connectors/connector-config-schema.d.ts +0 -43
- package/dist/connectors/connector-factory.d.ts +0 -32
- package/dist/connectors/connector-listener.d.ts +0 -17
- package/dist/connectors/discord-adapter.d.ts +0 -14
- package/dist/connectors/discord-connector-schema.d.ts +0 -10
- package/dist/connectors/discord-event-processor.d.ts +0 -26
- package/dist/connectors/discord-listener.d.ts +0 -17
- package/dist/connectors/gh-adapter.d.ts +0 -11
- package/dist/connectors/gh-connector-schema.d.ts +0 -10
- package/dist/connectors/gh-listener.d.ts +0 -26
- package/dist/connectors/match-cron.d.ts +0 -1
- package/dist/connectors/schedule-connector-schema.d.ts +0 -45
- package/dist/connectors/schedule-listener.d.ts +0 -30
- package/dist/connectors/schedule-state-store.d.ts +0 -19
- package/dist/connectors/slack-adapter.d.ts +0 -15
- package/dist/connectors/slack-connector-schema.d.ts +0 -11
- package/dist/connectors/slack-event-processor.d.ts +0 -27
- package/dist/connectors/slack-listener.d.ts +0 -17
- package/dist/engine/channels/channels.d.ts +0 -106
- package/dist/engine/claude/claude.d.ts +0 -49
- package/dist/engine/claude/gateway-controller.d.ts +0 -6
- package/dist/engine/fs/file-system.d.ts +0 -24
- package/dist/engine/fs/memory-file-system.d.ts +0 -31
- package/dist/engine/fs/node-file-system.d.ts +0 -15
- package/dist/engine/http/http-client.d.ts +0 -15
- package/dist/engine/http/memory-http-client.d.ts +0 -12
- package/dist/engine/http/node-http-client.d.ts +0 -5
- package/dist/engine/id/id-generator.d.ts +0 -7
- package/dist/engine/id/memory-id-generator.d.ts +0 -11
- package/dist/engine/id/node-id-generator.d.ts +0 -4
- package/dist/engine/logger/logger.d.ts +0 -11
- package/dist/engine/logger/memory-logger.d.ts +0 -14
- package/dist/engine/logger/node-logger.d.ts +0 -15
- package/dist/engine/logger/noop-logger.d.ts +0 -7
- package/dist/engine/mcp/channel-server.d.ts +0 -1
- package/dist/engine/mcp/mcp.d.ts +0 -22
- package/dist/engine/process/memory-process-runner.d.ts +0 -43
- package/dist/engine/process/node-process-runner.d.ts +0 -9
- package/dist/engine/process/process-runner.d.ts +0 -29
- package/dist/engine/profiles/profile-channel-checker.d.ts +0 -7
- package/dist/engine/profiles/profiles.d.ts +0 -31
- package/dist/engine/settings/mock-settings-reader.d.ts +0 -9
- package/dist/engine/settings/settings-reader.d.ts +0 -5
- package/dist/engine/settings/settings-schema.d.ts +0 -132
- package/dist/engine/settings/settings-store.d.ts +0 -18
- package/dist/engine/time/clock.d.ts +0 -9
- package/dist/engine/time/memory-clock.d.ts +0 -12
- package/dist/engine/time/node-clock.d.ts +0 -4
- package/dist/funnel.d.ts +0 -95
- package/dist/gateway/auth-middleware.d.ts +0 -14
- package/dist/gateway/broadcaster.d.ts +0 -122
- package/dist/gateway/daemon.d.ts +0 -2
- package/dist/gateway/factory.d.ts +0 -7
- package/dist/gateway/funnel-event-store.d.ts +0 -81
- package/dist/gateway/gateway-server.d.ts +0 -94
- package/dist/gateway/gateway-token.d.ts +0 -33
- package/dist/gateway/gateway.d.ts +0 -58
- package/dist/gateway/kill-competing-slack-gateways.d.ts +0 -9
- package/dist/gateway/listener-supervisor.d.ts +0 -85
- package/dist/gateway/listeners-client.d.ts +0 -53
- package/dist/gateway/resolve-daemon-script.d.ts +0 -11
- package/dist/gateway/routes/channels.connectors.call.d.ts +0 -41
- package/dist/gateway/routes/health.d.ts +0 -17
- package/dist/gateway/routes/index.d.ts +0 -209
- package/dist/gateway/routes/listeners.list.d.ts +0 -14
- package/dist/gateway/routes/listeners.restart.d.ts +0 -34
- package/dist/gateway/routes/listeners.start.d.ts +0 -34
- package/dist/gateway/routes/listeners.stop.d.ts +0 -34
- package/dist/gateway/routes/route-deps.d.ts +0 -10
- package/dist/gateway/routes/status.d.ts +0 -30
- package/dist/gateway/routes/validator.d.ts +0 -19
- package/dist/logger/leuco-human-file-writer.d.ts +0 -33
- package/dist/logger/leuco-human-logger.d.ts +0 -46
- package/dist/logger/leuco-human-record.d.ts +0 -15
- package/dist/logger/leuco-human-stdout-writer.d.ts +0 -20
- package/dist/logger/leuco-human-writer.d.ts +0 -13
- package/dist/logger/leuco-logger-memory-sink.d.ts +0 -33
- package/dist/logger/leuco-logger-record.d.ts +0 -13
- package/dist/logger/leuco-logger-sink.d.ts +0 -34
- package/dist/logger/leuco-logger-sqlite-sink.d.ts +0 -102
- package/dist/logger/leuco-logger.d.ts +0 -56
- package/lib/bin.ts +0 -78
- package/lib/cli/factory.ts +0 -10
- package/lib/cli/router/query-to-cli-args.ts +0 -20
- package/lib/cli/router/to-request.ts +0 -112
- package/lib/cli/router/validator.ts +0 -27
- package/lib/cli/routes/channels.$channel.connectors.$connector.rename.$newName.ts +0 -27
- package/lib/cli/routes/channels.$channel.connectors.$connector.request.ts +0 -40
- package/lib/cli/routes/channels.$channel.connectors.$connector.schedules.add.$id.ts +0 -41
- package/lib/cli/routes/channels.$channel.connectors.$connector.schedules.remove.$id.ts +0 -22
- package/lib/cli/routes/channels.$channel.connectors.$connector.schedules.ts +0 -23
- package/lib/cli/routes/channels.$channel.connectors.$connector.ts +0 -26
- package/lib/cli/routes/channels.$channel.connectors.add.$connector.ts +0 -92
- package/lib/cli/routes/channels.$channel.connectors.remove.$connector.ts +0 -22
- package/lib/cli/routes/channels.$channel.connectors.set.$connector.ts +0 -63
- package/lib/cli/routes/channels.$channel.connectors.ts +0 -26
- package/lib/cli/routes/channels.$channel.rename.$newName.ts +0 -22
- package/lib/cli/routes/channels.$channel.set.delivery.$mode.ts +0 -34
- package/lib/cli/routes/channels.$channel.ts +0 -34
- package/lib/cli/routes/channels.add.$channel.ts +0 -33
- package/lib/cli/routes/channels.remove.$channel.ts +0 -20
- package/lib/cli/routes/channels.ts +0 -39
- package/lib/cli/routes/claude.ts +0 -69
- package/lib/cli/routes/gateway.listeners.ts +0 -41
- package/lib/cli/routes/gateway.logs.ts +0 -123
- package/lib/cli/routes/gateway.restart.ts +0 -50
- package/lib/cli/routes/gateway.run.ts +0 -41
- package/lib/cli/routes/gateway.start.ts +0 -50
- package/lib/cli/routes/gateway.status.ts +0 -19
- package/lib/cli/routes/gateway.stop.ts +0 -32
- package/lib/cli/routes/gateway.ts +0 -55
- package/lib/cli/routes/index.ts +0 -202
- package/lib/cli/routes/profiles.$profile.as-default.ts +0 -22
- package/lib/cli/routes/profiles.$profile.rename.$newName.ts +0 -22
- package/lib/cli/routes/profiles.$profile.run.ts +0 -36
- package/lib/cli/routes/profiles.add.$profile.ts +0 -46
- package/lib/cli/routes/profiles.remove.$profile.ts +0 -20
- package/lib/cli/routes/profiles.set.$profile.ts +0 -46
- package/lib/cli/routes/profiles.ts +0 -40
- package/lib/cli/routes/status.ts +0 -93
- package/lib/cli/routes/update.ts +0 -27
- package/lib/connectors/connector-adapter.ts +0 -9
- package/lib/connectors/connector-config-schema.ts +0 -16
- package/lib/connectors/connector-factory.ts +0 -94
- package/lib/connectors/connector-listener.ts +0 -20
- package/lib/connectors/discord-adapter.ts +0 -51
- package/lib/connectors/discord-connector-schema.ts +0 -12
- package/lib/connectors/discord-event-processor.ts +0 -48
- package/lib/connectors/discord-listener.ts +0 -111
- package/lib/connectors/gh-adapter.ts +0 -48
- package/lib/connectors/gh-connector-schema.ts +0 -12
- package/lib/connectors/gh-listener.ts +0 -137
- package/lib/connectors/match-cron.ts +0 -78
- package/lib/connectors/schedule-connector-schema.ts +0 -33
- package/lib/connectors/schedule-listener.ts +0 -207
- package/lib/connectors/schedule-state-store.ts +0 -54
- package/lib/connectors/slack-adapter.ts +0 -36
- package/lib/connectors/slack-connector-schema.ts +0 -13
- package/lib/connectors/slack-event-processor.ts +0 -97
- package/lib/connectors/slack-listener.ts +0 -97
- package/lib/engine/channels/channels.ts +0 -520
- package/lib/engine/claude/claude.ts +0 -199
- package/lib/engine/claude/gateway-controller.ts +0 -4
- package/lib/engine/fs/file-system.ts +0 -23
- package/lib/engine/fs/memory-file-system.ts +0 -102
- package/lib/engine/fs/node-file-system.ts +0 -68
- package/lib/engine/http/http-client.ts +0 -17
- package/lib/engine/http/memory-http-client.ts +0 -36
- package/lib/engine/http/node-http-client.ts +0 -23
- package/lib/engine/id/id-generator.ts +0 -7
- package/lib/engine/id/memory-id-generator.ts +0 -20
- package/lib/engine/id/node-id-generator.ts +0 -7
- package/lib/engine/logger/logger.ts +0 -11
- package/lib/engine/logger/memory-logger.ts +0 -28
- package/lib/engine/logger/node-logger.ts +0 -49
- package/lib/engine/logger/noop-logger.ts +0 -9
- package/lib/engine/mcp/channel-server.ts +0 -204
- package/lib/engine/mcp/mcp.ts +0 -126
- package/lib/engine/process/memory-process-runner.ts +0 -88
- package/lib/engine/process/node-process-runner.ts +0 -91
- package/lib/engine/process/process-runner.ts +0 -33
- package/lib/engine/profiles/profile-channel-checker.ts +0 -7
- package/lib/engine/profiles/profiles.ts +0 -126
- package/lib/engine/settings/mock-settings-reader.ts +0 -27
- package/lib/engine/settings/settings-reader.ts +0 -6
- package/lib/engine/settings/settings-schema.ts +0 -46
- package/lib/engine/settings/settings-store.ts +0 -110
- package/lib/engine/time/clock.ts +0 -15
- package/lib/engine/time/memory-clock.ts +0 -26
- package/lib/engine/time/node-clock.ts +0 -7
- package/lib/funnel.ts +0 -187
- package/lib/gateway/auth-middleware.ts +0 -44
- package/lib/gateway/broadcaster.ts +0 -319
- package/lib/gateway/daemon.ts +0 -47
- package/lib/gateway/factory.ts +0 -10
- package/lib/gateway/funnel-event-store.ts +0 -155
- package/lib/gateway/gateway-server.ts +0 -414
- package/lib/gateway/gateway-token.ts +0 -79
- package/lib/gateway/gateway.ts +0 -209
- package/lib/gateway/kill-competing-slack-gateways.ts +0 -56
- package/lib/gateway/listener-supervisor.ts +0 -339
- package/lib/gateway/listeners-client.ts +0 -128
- package/lib/gateway/resolve-daemon-script.ts +0 -26
- package/lib/gateway/routes/channels.connectors.call.ts +0 -39
- package/lib/gateway/routes/health.ts +0 -13
- package/lib/gateway/routes/index.ts +0 -24
- package/lib/gateway/routes/listeners.list.ts +0 -6
- package/lib/gateway/routes/listeners.restart.ts +0 -15
- package/lib/gateway/routes/listeners.start.ts +0 -15
- package/lib/gateway/routes/listeners.stop.ts +0 -15
- package/lib/gateway/routes/route-deps.ts +0 -11
- package/lib/gateway/routes/status.ts +0 -15
- package/lib/gateway/routes/validator.ts +0 -17
- package/lib/index.ts +0 -52
- package/lib/logger/leuco-human-file-writer.ts +0 -65
- package/lib/logger/leuco-human-logger.ts +0 -98
- package/lib/logger/leuco-human-record.ts +0 -16
- package/lib/logger/leuco-human-stdout-writer.ts +0 -26
- package/lib/logger/leuco-human-writer.ts +0 -14
- package/lib/logger/leuco-logger-memory-sink.ts +0 -67
- package/lib/logger/leuco-logger-record.ts +0 -13
- package/lib/logger/leuco-logger-sink.ts +0 -33
- package/lib/logger/leuco-logger-sqlite-sink.ts +0 -355
- package/lib/logger/leuco-logger.ts +0 -135
- package/lib/tui/app.tsx +0 -357
- package/lib/tui/components/add-row.tsx +0 -18
- package/lib/tui/components/brand.tsx +0 -27
- package/lib/tui/components/card.tsx +0 -44
- package/lib/tui/components/detail-bar.tsx +0 -46
- package/lib/tui/components/editable-field.tsx +0 -33
- package/lib/tui/components/empty-state.tsx +0 -11
- package/lib/tui/components/gateway-status.tsx +0 -66
- package/lib/tui/components/keymap.tsx +0 -29
- package/lib/tui/components/menu-item.tsx +0 -73
- package/lib/tui/components/menu.tsx +0 -26
- package/lib/tui/components/panel-header.tsx +0 -22
- package/lib/tui/components/readonly-field.tsx +0 -18
- package/lib/tui/components/section-header.tsx +0 -25
- package/lib/tui/components/selection-accent.tsx +0 -32
- package/lib/tui/components/session-item.tsx +0 -33
- package/lib/tui/components/session-list.tsx +0 -33
- package/lib/tui/components/ui/hascii/accordion-item.tsx +0 -88
- package/lib/tui/components/ui/hascii/accordion.tsx +0 -96
- package/lib/tui/components/ui/hascii/alert-dialog.tsx +0 -43
- package/lib/tui/components/ui/hascii/badge.tsx +0 -51
- package/lib/tui/components/ui/hascii/breadcrumb.tsx +0 -58
- package/lib/tui/components/ui/hascii/button.tsx +0 -194
- package/lib/tui/components/ui/hascii/card-content.tsx +0 -14
- package/lib/tui/components/ui/hascii/card-description.tsx +0 -13
- package/lib/tui/components/ui/hascii/card-footer.tsx +0 -14
- package/lib/tui/components/ui/hascii/card-header.tsx +0 -14
- package/lib/tui/components/ui/hascii/card-title.tsx +0 -13
- package/lib/tui/components/ui/hascii/card.tsx +0 -27
- package/lib/tui/components/ui/hascii/checkbox.tsx +0 -65
- package/lib/tui/components/ui/hascii/command.tsx +0 -159
- package/lib/tui/components/ui/hascii/dialog-content.tsx +0 -14
- package/lib/tui/components/ui/hascii/dialog-description.tsx +0 -13
- package/lib/tui/components/ui/hascii/dialog-footer.tsx +0 -14
- package/lib/tui/components/ui/hascii/dialog-header.tsx +0 -14
- package/lib/tui/components/ui/hascii/dialog-title.tsx +0 -13
- package/lib/tui/components/ui/hascii/dialog.tsx +0 -27
- package/lib/tui/components/ui/hascii/file-tree.tsx +0 -142
- package/lib/tui/components/ui/hascii/focus-group.tsx +0 -62
- package/lib/tui/components/ui/hascii/form-item.tsx +0 -43
- package/lib/tui/components/ui/hascii/input-otp.tsx +0 -86
- package/lib/tui/components/ui/hascii/input.tsx +0 -130
- package/lib/tui/components/ui/hascii/pagination.tsx +0 -105
- package/lib/tui/components/ui/hascii/progress.tsx +0 -28
- package/lib/tui/components/ui/hascii/select.tsx +0 -131
- package/lib/tui/components/ui/hascii/separator.tsx +0 -35
- package/lib/tui/components/ui/hascii/sidebar-content.tsx +0 -23
- package/lib/tui/components/ui/hascii/sidebar-header.tsx +0 -14
- package/lib/tui/components/ui/hascii/sidebar-menu-item.tsx +0 -67
- package/lib/tui/components/ui/hascii/sidebar.tsx +0 -24
- package/lib/tui/components/ui/hascii/skeleton.tsx +0 -60
- package/lib/tui/components/ui/hascii/slider.tsx +0 -91
- package/lib/tui/components/ui/hascii/snackbar.tsx +0 -75
- package/lib/tui/components/ui/hascii/sparkline.tsx +0 -53
- package/lib/tui/components/ui/hascii/spinner.tsx +0 -47
- package/lib/tui/components/ui/hascii/stepper.tsx +0 -54
- package/lib/tui/components/ui/hascii/switch.tsx +0 -66
- package/lib/tui/components/ui/hascii/table.tsx +0 -95
- package/lib/tui/components/ui/hascii/tabs.tsx +0 -59
- package/lib/tui/components/ui/hascii/toggle-group-item.tsx +0 -45
- package/lib/tui/components/ui/hascii/toggle-group.tsx +0 -99
- package/lib/tui/components/ui/hascii/tree.tsx +0 -104
- package/lib/tui/components/view-shell.tsx +0 -44
- package/lib/tui/filter-input.tsx +0 -33
- package/lib/tui/hooks/hascii/use-pressable.ts +0 -54
- package/lib/tui/parse-comma-list.ts +0 -14
- package/lib/tui/profile-launcher.tsx +0 -61
- package/lib/tui/scrollbar-options.ts +0 -19
- package/lib/tui/sidebar.tsx +0 -50
- package/lib/tui/theme.ts +0 -40
- package/lib/tui/tui.tsx +0 -20
- package/lib/tui/types.ts +0 -38
- package/lib/tui/unique-name.ts +0 -18
- package/lib/tui/use-event-stream.ts +0 -133
- package/lib/tui/use-snapshot.ts +0 -99
- package/lib/tui/utils/hascii/form-item-context.tsx +0 -23
- package/lib/tui/utils/hascii/input-focus-context.tsx +0 -31
- package/lib/tui/utils/hascii/theme-context.tsx +0 -26
- package/lib/tui/utils/hascii/theme.ts +0 -176
- package/lib/tui/views/channels-view.tsx +0 -108
- package/lib/tui/views/connectors-view.tsx +0 -164
- package/lib/tui/views/events-view.tsx +0 -160
- package/lib/tui/views/listeners-view.tsx +0 -80
- package/lib/tui/views/profiles-view.tsx +0 -152
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { zValidator } from "@/cli/router/validator"
|
|
5
|
-
|
|
6
|
-
export const listenersHelp = `funnel gateway listeners — show running connector listeners
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway listeners
|
|
9
|
-
|
|
10
|
-
Reads /listeners from the running gateway daemon and prints the live registry.
|
|
11
|
-
|
|
12
|
-
examples:
|
|
13
|
-
funnel gateway listeners`
|
|
14
|
-
|
|
15
|
-
export const gatewayListenersHandler = factory.createHandlers(
|
|
16
|
-
zValidator("query", z.object({}), listenersHelp),
|
|
17
|
-
async (c) => {
|
|
18
|
-
const funnel = c.var.funnel
|
|
19
|
-
const result = await funnel.listeners.list()
|
|
20
|
-
|
|
21
|
-
if (result.state === "offline") {
|
|
22
|
-
throw new HTTPException(503, { message: "funnel gateway: not running" })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (result.state === "error") {
|
|
26
|
-
throw new HTTPException(503, { message: `funnel gateway: ${result.reason}` })
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (result.listeners.length === 0) {
|
|
30
|
-
return c.text("funnel gateway: no running listeners")
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const lines = result.listeners.map((entry) => {
|
|
34
|
-
const health = entry.alive ? "alive" : "dead"
|
|
35
|
-
|
|
36
|
-
return ` [${health.padEnd(5)}] ${entry.type.padEnd(8)} ${entry.name}`
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return c.text(`funnel gateway: running listeners\n${lines.join("\n")}`)
|
|
40
|
-
},
|
|
41
|
-
)
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs"
|
|
2
|
-
import { stringify } from "yaml"
|
|
3
|
-
import { z } from "zod"
|
|
4
|
-
import { factory } from "@/cli/factory"
|
|
5
|
-
import { NodeFunnelLogger } from "@/engine/logger/node-logger"
|
|
6
|
-
import { zValidator } from "@/cli/router/validator"
|
|
7
|
-
|
|
8
|
-
export const logsHelp = `funnel gateway logs — tail diagnostic logs
|
|
9
|
-
|
|
10
|
-
usage: funnel gateway logs [-n <N>]
|
|
11
|
-
|
|
12
|
-
options:
|
|
13
|
-
-n <N> number of trailing lines to show (default: 20)
|
|
14
|
-
|
|
15
|
-
Tails /tmp/funnel/funnel.log (the daemon's diagnostic stream — gateway
|
|
16
|
-
lifecycle, channel connect/disconnect, listener boot). Exit with SIGINT.
|
|
17
|
-
Output is formatted as YAML.
|
|
18
|
-
|
|
19
|
-
Domain events fanned out to WebSocket clients live in the SQLite event
|
|
20
|
-
store (<logDir>/events.db); they are not shown here. Subscribe via the
|
|
21
|
-
WS endpoint or query the store directly.
|
|
22
|
-
|
|
23
|
-
examples:
|
|
24
|
-
funnel gateway logs
|
|
25
|
-
funnel gateway logs -n 100`
|
|
26
|
-
|
|
27
|
-
const logger = new NodeFunnelLogger()
|
|
28
|
-
|
|
29
|
-
type LogEntry = {
|
|
30
|
-
time: string
|
|
31
|
-
level: string
|
|
32
|
-
message: string
|
|
33
|
-
meta?: unknown
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const tryParseJson = (line: string): unknown => {
|
|
37
|
-
try {
|
|
38
|
-
return JSON.parse(line)
|
|
39
|
-
} catch {
|
|
40
|
-
return null
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const isLogEntry = (value: unknown): value is LogEntry => {
|
|
45
|
-
if (value === null || typeof value !== "object") return false
|
|
46
|
-
if (!("time" in value) || typeof value.time !== "string") return false
|
|
47
|
-
if (!("level" in value) || typeof value.level !== "string") return false
|
|
48
|
-
if (!("message" in value) || typeof value.message !== "string") return false
|
|
49
|
-
|
|
50
|
-
return true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const gatewayLogsHandler = factory.createHandlers(
|
|
54
|
-
zValidator(
|
|
55
|
-
"query",
|
|
56
|
-
z.object({
|
|
57
|
-
n: z.string().optional(),
|
|
58
|
-
}),
|
|
59
|
-
logsHelp,
|
|
60
|
-
),
|
|
61
|
-
async (c) => {
|
|
62
|
-
const query = c.req.valid("query")
|
|
63
|
-
const path = logger.file
|
|
64
|
-
|
|
65
|
-
if (!path || !existsSync(path)) {
|
|
66
|
-
return c.text("no logs")
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const lineCount = query.n ? Number(query.n) : 20
|
|
70
|
-
|
|
71
|
-
const tail = Bun.spawn(["tail", "-f", "-n", String(lineCount), path], {
|
|
72
|
-
stdout: "pipe",
|
|
73
|
-
stderr: "inherit",
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
const forward = (signal: "SIGINT" | "SIGTERM") => {
|
|
77
|
-
tail.kill(signal)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
process.on("SIGINT", () => forward("SIGINT"))
|
|
81
|
-
process.on("SIGTERM", () => forward("SIGTERM"))
|
|
82
|
-
|
|
83
|
-
const reader = tail.stdout.getReader()
|
|
84
|
-
const decoder = new TextDecoder()
|
|
85
|
-
let buffer = ""
|
|
86
|
-
|
|
87
|
-
logger.info("gateway.logs tail start", { file: path })
|
|
88
|
-
|
|
89
|
-
while (true) {
|
|
90
|
-
const result = await reader.read()
|
|
91
|
-
|
|
92
|
-
if (result.done) break
|
|
93
|
-
|
|
94
|
-
buffer += decoder.decode(result.value, { stream: true })
|
|
95
|
-
|
|
96
|
-
const lines = buffer.split("\n")
|
|
97
|
-
buffer = lines.pop() ?? ""
|
|
98
|
-
|
|
99
|
-
for (const line of lines) {
|
|
100
|
-
if (!line.trim()) continue
|
|
101
|
-
|
|
102
|
-
const parsed = tryParseJson(line)
|
|
103
|
-
|
|
104
|
-
if (!isLogEntry(parsed)) {
|
|
105
|
-
process.stdout.write(`${line}\n`)
|
|
106
|
-
continue
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const output = {
|
|
110
|
-
time: parsed.time,
|
|
111
|
-
level: parsed.level,
|
|
112
|
-
message: parsed.message,
|
|
113
|
-
...(parsed.meta ? { meta: parsed.meta } : {}),
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
process.stdout.write(`---\n${stringify(output)}`)
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
await tail.exited
|
|
121
|
-
process.exit(0)
|
|
122
|
-
},
|
|
123
|
-
)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { zValidator } from "@/cli/router/validator"
|
|
5
|
-
|
|
6
|
-
export const restartHelp = `funnel gateway restart — restart the gateway
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway restart [--no-caffeine]
|
|
9
|
-
|
|
10
|
-
Stops the running process then starts it again in background.
|
|
11
|
-
On macOS wraps with caffeinate -i by default. Use --no-caffeine to disable.
|
|
12
|
-
|
|
13
|
-
examples:
|
|
14
|
-
funnel gateway restart
|
|
15
|
-
funnel gateway restart --no-caffeine`
|
|
16
|
-
|
|
17
|
-
export const gatewayRestartHandler = factory.createHandlers(
|
|
18
|
-
zValidator(
|
|
19
|
-
"query",
|
|
20
|
-
z.object({
|
|
21
|
-
"no-caffeine": z.string().optional(),
|
|
22
|
-
}),
|
|
23
|
-
restartHelp,
|
|
24
|
-
),
|
|
25
|
-
async (c) => {
|
|
26
|
-
const query = c.req.valid("query")
|
|
27
|
-
const funnel = c.var.funnel
|
|
28
|
-
|
|
29
|
-
const result = await funnel.gateway.restart({
|
|
30
|
-
caffeinate: query["no-caffeine"] !== "true",
|
|
31
|
-
})
|
|
32
|
-
const lines: string[] = []
|
|
33
|
-
|
|
34
|
-
if (result.wasRunning) {
|
|
35
|
-
lines.push(result.stopped ? "funnel gateway: stopped" : "funnel gateway: failed to stop")
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (result.stopped) {
|
|
39
|
-
lines.push(result.started ? "funnel gateway: started" : "funnel gateway: failed to start")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const body = lines.join("\n")
|
|
43
|
-
|
|
44
|
-
if (!result.ok) {
|
|
45
|
-
throw new HTTPException(500, { message: body })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return c.text(body)
|
|
49
|
-
},
|
|
50
|
-
)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
import { resolveDaemonScript } from "@/gateway/resolve-daemon-script"
|
|
5
|
-
|
|
6
|
-
export const runHelp = `funnel gateway run — run the gateway in foreground
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway run [--no-caffeine]
|
|
9
|
-
|
|
10
|
-
For developers. The process is tied to the current terminal and exits on SIGINT / SIGTERM.
|
|
11
|
-
On macOS wraps with caffeinate -i by default. Use --no-caffeine to disable.
|
|
12
|
-
|
|
13
|
-
For normal usage prefer funnel gateway start.
|
|
14
|
-
|
|
15
|
-
examples:
|
|
16
|
-
funnel gateway run
|
|
17
|
-
funnel gateway run --no-caffeine`
|
|
18
|
-
|
|
19
|
-
export const gatewayRunHandler = factory.createHandlers(
|
|
20
|
-
zValidator(
|
|
21
|
-
"query",
|
|
22
|
-
z.object({
|
|
23
|
-
"no-caffeine": z.string().optional(),
|
|
24
|
-
}),
|
|
25
|
-
runHelp,
|
|
26
|
-
),
|
|
27
|
-
async (c) => {
|
|
28
|
-
const query = c.req.valid("query")
|
|
29
|
-
const funnel = c.var.funnel
|
|
30
|
-
|
|
31
|
-
const gatewayScript = resolveDaemonScript()
|
|
32
|
-
const useCaffeinate = query["no-caffeine"] !== "true" && process.platform === "darwin"
|
|
33
|
-
const command = useCaffeinate
|
|
34
|
-
? ["caffeinate", "-i", "bun", gatewayScript]
|
|
35
|
-
: ["bun", gatewayScript]
|
|
36
|
-
|
|
37
|
-
const exitCode = await funnel.process.attach(command)
|
|
38
|
-
|
|
39
|
-
process.exit(exitCode)
|
|
40
|
-
},
|
|
41
|
-
)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { zValidator } from "@/cli/router/validator"
|
|
5
|
-
|
|
6
|
-
export const startHelp = `funnel gateway start — start the gateway in background
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway start [--no-caffeine]
|
|
9
|
-
|
|
10
|
-
Daemonized with nohup, so it keeps running after the terminal is closed.
|
|
11
|
-
On macOS wraps the process with caffeinate -i by default to prevent idle sleep.
|
|
12
|
-
Use --no-caffeine to disable caffeinate.
|
|
13
|
-
|
|
14
|
-
port: 9742 (override via FUNNEL_PORT)
|
|
15
|
-
pid: ~/.funnel/gateway.pid
|
|
16
|
-
log: /tmp/funnel/gateway.log
|
|
17
|
-
|
|
18
|
-
examples:
|
|
19
|
-
funnel gateway start
|
|
20
|
-
funnel gateway start --no-caffeine`
|
|
21
|
-
|
|
22
|
-
export const gatewayStartHandler = factory.createHandlers(
|
|
23
|
-
zValidator(
|
|
24
|
-
"query",
|
|
25
|
-
z.object({
|
|
26
|
-
"no-caffeine": z.string().optional(),
|
|
27
|
-
}),
|
|
28
|
-
startHelp,
|
|
29
|
-
),
|
|
30
|
-
async (c) => {
|
|
31
|
-
const query = c.req.valid("query")
|
|
32
|
-
const funnel = c.var.funnel
|
|
33
|
-
|
|
34
|
-
if (funnel.gateway.isRunning()) {
|
|
35
|
-
const status = funnel.gateway.getStatus()
|
|
36
|
-
|
|
37
|
-
return c.text(`funnel gateway: already running (pid ${status.pid})`)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const started = await funnel.gateway.start({
|
|
41
|
-
caffeinate: query["no-caffeine"] !== "true",
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
if (!started) {
|
|
45
|
-
throw new HTTPException(500, { message: "funnel gateway: failed to start" })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return c.text("funnel gateway: started")
|
|
49
|
-
},
|
|
50
|
-
)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
import { renderGatewayStatus } from "@/cli/routes/gateway"
|
|
5
|
-
|
|
6
|
-
export const statusHelp = `funnel gateway status — show gateway running status
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway status
|
|
9
|
-
|
|
10
|
-
When running, prints PID, port, and connected channel count. When not running, exits with 503.
|
|
11
|
-
|
|
12
|
-
examples:
|
|
13
|
-
funnel gateway status
|
|
14
|
-
funnel gateway`
|
|
15
|
-
|
|
16
|
-
export const gatewayStatusHandler = factory.createHandlers(
|
|
17
|
-
zValidator("query", z.object({}), statusHelp),
|
|
18
|
-
renderGatewayStatus,
|
|
19
|
-
)
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { zValidator } from "@/cli/router/validator"
|
|
5
|
-
|
|
6
|
-
export const stopHelp = `funnel gateway stop — stop the gateway
|
|
7
|
-
|
|
8
|
-
usage: funnel gateway stop
|
|
9
|
-
|
|
10
|
-
Terminates the process whose PID is stored in ~/.funnel/gateway.pid.
|
|
11
|
-
|
|
12
|
-
examples:
|
|
13
|
-
funnel gateway stop`
|
|
14
|
-
|
|
15
|
-
export const gatewayStopHandler = factory.createHandlers(
|
|
16
|
-
zValidator("query", z.object({}), stopHelp),
|
|
17
|
-
async (c) => {
|
|
18
|
-
const funnel = c.var.funnel
|
|
19
|
-
|
|
20
|
-
if (!funnel.gateway.isRunning()) {
|
|
21
|
-
return c.text("funnel gateway: no running process")
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const stopped = await funnel.gateway.stop()
|
|
25
|
-
|
|
26
|
-
if (!stopped) {
|
|
27
|
-
throw new HTTPException(500, { message: "funnel gateway: failed to stop" })
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return c.text("funnel gateway: stopped")
|
|
31
|
-
},
|
|
32
|
-
)
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import type { Context } from "hono"
|
|
3
|
-
import { z } from "zod"
|
|
4
|
-
import { factory } from "@/cli/factory"
|
|
5
|
-
import type { Env } from "@/cli/factory"
|
|
6
|
-
import { zValidator } from "@/cli/router/validator"
|
|
7
|
-
|
|
8
|
-
export const groupHelp = `funnel gateway — manage the funnel daemon
|
|
9
|
-
|
|
10
|
-
The gateway daemon hosts the WebSocket /ws (used by Claude MCP), the
|
|
11
|
-
local web UI at /, and the listener supervisor that runs every
|
|
12
|
-
connector. One daemon, one port (9742), one PID file.
|
|
13
|
-
|
|
14
|
-
usage: funnel gateway [subcommand]
|
|
15
|
-
|
|
16
|
-
subcommands:
|
|
17
|
-
status show running status (default)
|
|
18
|
-
start start in background
|
|
19
|
-
stop stop
|
|
20
|
-
restart stop then start
|
|
21
|
-
run start in foreground (for developers)
|
|
22
|
-
logs [-n <N>] show event logs
|
|
23
|
-
listeners list running connector listeners (alive / dead)
|
|
24
|
-
|
|
25
|
-
examples:
|
|
26
|
-
funnel gateway check status
|
|
27
|
-
funnel gateway restart restart`
|
|
28
|
-
|
|
29
|
-
export const renderGatewayStatus = async (c: Context<Env>) => {
|
|
30
|
-
const funnel = c.var.funnel
|
|
31
|
-
const status = funnel.gateway.getStatus()
|
|
32
|
-
|
|
33
|
-
if (!status.running) {
|
|
34
|
-
throw new HTTPException(503, { message: "funnel gateway: not running" })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const res = await fetch(`http://localhost:${status.port}/health`).catch(() => null)
|
|
38
|
-
|
|
39
|
-
if (!res) {
|
|
40
|
-
return c.text(`funnel gateway: running (pid ${status.pid}) — health check failed`)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const health: unknown = await res.json()
|
|
44
|
-
const clients =
|
|
45
|
-
health !== null && typeof health === "object" && "clients" in health ? health.clients : 0
|
|
46
|
-
|
|
47
|
-
return c.text(
|
|
48
|
-
`funnel gateway: running (pid ${status.pid})\n port: ${status.port}\n clients: ${clients ?? 0}`,
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const gatewayGroupHandler = factory.createHandlers(
|
|
53
|
-
zValidator("query", z.object({}), groupHelp),
|
|
54
|
-
renderGatewayStatus,
|
|
55
|
-
)
|
package/lib/cli/routes/index.ts
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import {
|
|
4
|
-
addHelp as channelsAddHelp,
|
|
5
|
-
channelsAddHandler,
|
|
6
|
-
} from "@/cli/routes/channels.add.$channel"
|
|
7
|
-
import { channelsConnectorsGroupHandler } from "@/cli/routes/channels.$channel.connectors"
|
|
8
|
-
import {
|
|
9
|
-
addHelp as channelsConnectorsAddHelp,
|
|
10
|
-
channelsConnectorsAddHandler,
|
|
11
|
-
} from "@/cli/routes/channels.$channel.connectors.add.$connector"
|
|
12
|
-
import {
|
|
13
|
-
channelsConnectorsRemoveHandler,
|
|
14
|
-
removeHelp as channelsConnectorsRemoveHelp,
|
|
15
|
-
} from "@/cli/routes/channels.$channel.connectors.remove.$connector"
|
|
16
|
-
import {
|
|
17
|
-
channelsConnectorsSetHandler,
|
|
18
|
-
setHelp as channelsConnectorsSetHelp,
|
|
19
|
-
} from "@/cli/routes/channels.$channel.connectors.set.$connector"
|
|
20
|
-
import { channelsConnectorsShowHandler } from "@/cli/routes/channels.$channel.connectors.$connector"
|
|
21
|
-
import {
|
|
22
|
-
channelsConnectorsRenameHandler,
|
|
23
|
-
renameHelp as channelsConnectorsRenameHelp,
|
|
24
|
-
} from "@/cli/routes/channels.$channel.connectors.$connector.rename.$newName"
|
|
25
|
-
import { channelsConnectorsRequestHandler } from "@/cli/routes/channels.$channel.connectors.$connector.request"
|
|
26
|
-
import { channelsConnectorsSchedulesGroupHandler } from "@/cli/routes/channels.$channel.connectors.$connector.schedules"
|
|
27
|
-
import {
|
|
28
|
-
addHelp as channelsConnectorsSchedulesAddHelp,
|
|
29
|
-
channelsConnectorsSchedulesAddHandler,
|
|
30
|
-
} from "@/cli/routes/channels.$channel.connectors.$connector.schedules.add.$id"
|
|
31
|
-
import {
|
|
32
|
-
channelsConnectorsSchedulesRemoveHandler,
|
|
33
|
-
removeHelp as channelsConnectorsSchedulesRemoveHelp,
|
|
34
|
-
} from "@/cli/routes/channels.$channel.connectors.$connector.schedules.remove.$id"
|
|
35
|
-
import {
|
|
36
|
-
channelsRemoveHandler,
|
|
37
|
-
removeHelp as channelsRemoveHelp,
|
|
38
|
-
} from "@/cli/routes/channels.remove.$channel"
|
|
39
|
-
import {
|
|
40
|
-
channelsRenameHandler,
|
|
41
|
-
renameHelp as channelsRenameHelp,
|
|
42
|
-
} from "@/cli/routes/channels.$channel.rename.$newName"
|
|
43
|
-
import { channelsSetDeliveryHandler } from "@/cli/routes/channels.$channel.set.delivery.$mode"
|
|
44
|
-
import { channelsShowHandler } from "@/cli/routes/channels.$channel"
|
|
45
|
-
import { channelsGroupHandler } from "@/cli/routes/channels"
|
|
46
|
-
import { claudeHandler } from "@/cli/routes/claude"
|
|
47
|
-
import { gatewayGroupHandler } from "@/cli/routes/gateway"
|
|
48
|
-
import { gatewayListenersHandler } from "@/cli/routes/gateway.listeners"
|
|
49
|
-
import { gatewayLogsHandler } from "@/cli/routes/gateway.logs"
|
|
50
|
-
import { gatewayRestartHandler } from "@/cli/routes/gateway.restart"
|
|
51
|
-
import { gatewayRunHandler } from "@/cli/routes/gateway.run"
|
|
52
|
-
import { gatewayStartHandler } from "@/cli/routes/gateway.start"
|
|
53
|
-
import { gatewayStatusHandler } from "@/cli/routes/gateway.status"
|
|
54
|
-
import { gatewayStopHandler } from "@/cli/routes/gateway.stop"
|
|
55
|
-
import {
|
|
56
|
-
addHelp as profilesAddHelp,
|
|
57
|
-
profilesAddHandler,
|
|
58
|
-
} from "@/cli/routes/profiles.add.$profile"
|
|
59
|
-
import { profilesAsDefaultHandler } from "@/cli/routes/profiles.$profile.as-default"
|
|
60
|
-
import {
|
|
61
|
-
profilesRenameHandler,
|
|
62
|
-
renameHelp as profilesRenameHelp,
|
|
63
|
-
} from "@/cli/routes/profiles.$profile.rename.$newName"
|
|
64
|
-
import { profilesLaunchHandler } from "@/cli/routes/profiles.$profile.run"
|
|
65
|
-
import {
|
|
66
|
-
profilesRemoveHandler,
|
|
67
|
-
removeHelp as profilesRemoveHelp,
|
|
68
|
-
} from "@/cli/routes/profiles.remove.$profile"
|
|
69
|
-
import {
|
|
70
|
-
profilesSetHandler,
|
|
71
|
-
setHelp as profilesSetHelp,
|
|
72
|
-
} from "@/cli/routes/profiles.set.$profile"
|
|
73
|
-
import { profilesGroupHandler } from "@/cli/routes/profiles"
|
|
74
|
-
import { statusHandler } from "@/cli/routes/status"
|
|
75
|
-
import { updateHandler } from "@/cli/routes/update"
|
|
76
|
-
import { Funnel } from "@/funnel"
|
|
77
|
-
|
|
78
|
-
const base = factory.createApp()
|
|
79
|
-
|
|
80
|
-
base.use((c, next) => {
|
|
81
|
-
c.set("funnel", new Funnel())
|
|
82
|
-
|
|
83
|
-
return next()
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
base.onError((error, c) => {
|
|
87
|
-
if (error instanceof HTTPException) {
|
|
88
|
-
return c.text(`error: ${error.message}`, error.status)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return c.text(`error: ${error instanceof Error ? error.message : String(error)}`, 400)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
const helpRoute = (text: string) => factory.createHandlers((c) => c.text(text))
|
|
95
|
-
|
|
96
|
-
// All CLI verbs (`add` / `remove` / `set` / `rename` / `as-default` / `request`) map to POST in
|
|
97
|
-
// to-request.ts and stay in the URL as a literal segment. Read paths (list / show / launch) keep GET.
|
|
98
|
-
// Help shortcuts at parameterless URLs return the help text directly so `funnel <verb>` (no args) is
|
|
99
|
-
// informative instead of 404.
|
|
100
|
-
export const app = base
|
|
101
|
-
.get("/claude", ...claudeHandler)
|
|
102
|
-
.get("/channels", ...channelsGroupHandler)
|
|
103
|
-
.post("/channels/add", ...helpRoute(channelsAddHelp))
|
|
104
|
-
.post("/channels/add/:channel", ...channelsAddHandler)
|
|
105
|
-
.post("/channels/remove", ...helpRoute(channelsRemoveHelp))
|
|
106
|
-
.post("/channels/remove/:channel", ...channelsRemoveHandler)
|
|
107
|
-
.post("/channels/rename/:channel/:newName", ...channelsRenameHandler)
|
|
108
|
-
.post("/channels/:channel/rename/:newName", ...channelsRenameHandler)
|
|
109
|
-
.post("/channels/rename", ...helpRoute(channelsRenameHelp))
|
|
110
|
-
.post("/channels/:channel/rename", ...helpRoute(channelsRenameHelp))
|
|
111
|
-
.post("/channels/:channel/set/delivery/:mode", ...channelsSetDeliveryHandler)
|
|
112
|
-
.get("/channels/:channel", ...channelsShowHandler)
|
|
113
|
-
.get("/channels/:channel/connectors", ...channelsConnectorsGroupHandler)
|
|
114
|
-
.post(
|
|
115
|
-
"/channels/:channel/connectors/add",
|
|
116
|
-
...helpRoute(channelsConnectorsAddHelp),
|
|
117
|
-
)
|
|
118
|
-
.post(
|
|
119
|
-
"/channels/:channel/connectors/add/:connector",
|
|
120
|
-
...channelsConnectorsAddHandler,
|
|
121
|
-
)
|
|
122
|
-
.post(
|
|
123
|
-
"/channels/:channel/connectors/remove",
|
|
124
|
-
...helpRoute(channelsConnectorsRemoveHelp),
|
|
125
|
-
)
|
|
126
|
-
.post(
|
|
127
|
-
"/channels/:channel/connectors/remove/:connector",
|
|
128
|
-
...channelsConnectorsRemoveHandler,
|
|
129
|
-
)
|
|
130
|
-
.post(
|
|
131
|
-
"/channels/:channel/connectors/set",
|
|
132
|
-
...helpRoute(channelsConnectorsSetHelp),
|
|
133
|
-
)
|
|
134
|
-
.post(
|
|
135
|
-
"/channels/:channel/connectors/set/:connector",
|
|
136
|
-
...channelsConnectorsSetHandler,
|
|
137
|
-
)
|
|
138
|
-
.post(
|
|
139
|
-
"/channels/:channel/connectors/rename/:connector/:newName",
|
|
140
|
-
...channelsConnectorsRenameHandler,
|
|
141
|
-
)
|
|
142
|
-
.post(
|
|
143
|
-
"/channels/:channel/connectors/:connector/rename/:newName",
|
|
144
|
-
...channelsConnectorsRenameHandler,
|
|
145
|
-
)
|
|
146
|
-
.post(
|
|
147
|
-
"/channels/:channel/connectors/rename",
|
|
148
|
-
...helpRoute(channelsConnectorsRenameHelp),
|
|
149
|
-
)
|
|
150
|
-
.post(
|
|
151
|
-
"/channels/:channel/connectors/:connector/rename",
|
|
152
|
-
...helpRoute(channelsConnectorsRenameHelp),
|
|
153
|
-
)
|
|
154
|
-
.post(
|
|
155
|
-
"/channels/:channel/connectors/:connector/request",
|
|
156
|
-
...channelsConnectorsRequestHandler,
|
|
157
|
-
)
|
|
158
|
-
.get("/channels/:channel/connectors/:connector", ...channelsConnectorsShowHandler)
|
|
159
|
-
.get(
|
|
160
|
-
"/channels/:channel/connectors/:connector/schedules",
|
|
161
|
-
...channelsConnectorsSchedulesGroupHandler,
|
|
162
|
-
)
|
|
163
|
-
.post(
|
|
164
|
-
"/channels/:channel/connectors/:connector/schedules/add",
|
|
165
|
-
...helpRoute(channelsConnectorsSchedulesAddHelp),
|
|
166
|
-
)
|
|
167
|
-
.post(
|
|
168
|
-
"/channels/:channel/connectors/:connector/schedules/add/:id",
|
|
169
|
-
...channelsConnectorsSchedulesAddHandler,
|
|
170
|
-
)
|
|
171
|
-
.post(
|
|
172
|
-
"/channels/:channel/connectors/:connector/schedules/remove",
|
|
173
|
-
...helpRoute(channelsConnectorsSchedulesRemoveHelp),
|
|
174
|
-
)
|
|
175
|
-
.post(
|
|
176
|
-
"/channels/:channel/connectors/:connector/schedules/remove/:id",
|
|
177
|
-
...channelsConnectorsSchedulesRemoveHandler,
|
|
178
|
-
)
|
|
179
|
-
.get("/profiles", ...profilesGroupHandler)
|
|
180
|
-
.post("/profiles/add", ...helpRoute(profilesAddHelp))
|
|
181
|
-
.post("/profiles/add/:profile", ...profilesAddHandler)
|
|
182
|
-
.post("/profiles/set", ...helpRoute(profilesSetHelp))
|
|
183
|
-
.post("/profiles/set/:profile", ...profilesSetHandler)
|
|
184
|
-
.post("/profiles/remove", ...helpRoute(profilesRemoveHelp))
|
|
185
|
-
.post("/profiles/remove/:profile", ...profilesRemoveHandler)
|
|
186
|
-
.post("/profiles/rename/:profile/:newName", ...profilesRenameHandler)
|
|
187
|
-
.post("/profiles/:profile/rename/:newName", ...profilesRenameHandler)
|
|
188
|
-
.post("/profiles/rename", ...helpRoute(profilesRenameHelp))
|
|
189
|
-
.post("/profiles/:profile/rename", ...helpRoute(profilesRenameHelp))
|
|
190
|
-
.post("/profiles/:profile/as-default", ...profilesAsDefaultHandler)
|
|
191
|
-
.get("/profiles/:profile/run", ...profilesLaunchHandler)
|
|
192
|
-
.get("/profiles/:profile", ...profilesLaunchHandler)
|
|
193
|
-
.get("/gateway", ...gatewayGroupHandler)
|
|
194
|
-
.get("/gateway/status", ...gatewayStatusHandler)
|
|
195
|
-
.get("/gateway/start", ...gatewayStartHandler)
|
|
196
|
-
.get("/gateway/stop", ...gatewayStopHandler)
|
|
197
|
-
.get("/gateway/restart", ...gatewayRestartHandler)
|
|
198
|
-
.get("/gateway/run", ...gatewayRunHandler)
|
|
199
|
-
.get("/gateway/logs", ...gatewayLogsHandler)
|
|
200
|
-
.get("/gateway/listeners", ...gatewayListenersHandler)
|
|
201
|
-
.get("/status", ...statusHandler)
|
|
202
|
-
.get("/update", ...updateHandler)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
|
|
5
|
-
export const asDefaultHelp = `funnel profiles <name> as-default — move profile to the front of the list
|
|
6
|
-
|
|
7
|
-
usage: funnel profiles <name> as-default
|
|
8
|
-
|
|
9
|
-
the first profile in the list is treated as the default for fnl claude.`
|
|
10
|
-
|
|
11
|
-
export const profilesAsDefaultHandler = factory.createHandlers(
|
|
12
|
-
zValidator("param", z.object({ profile: z.string() })),
|
|
13
|
-
zValidator("query", z.object({}), asDefaultHelp),
|
|
14
|
-
(c) => {
|
|
15
|
-
const param = c.req.valid("param")
|
|
16
|
-
const funnel = c.var.funnel
|
|
17
|
-
|
|
18
|
-
funnel.profiles.asDefault(param.profile)
|
|
19
|
-
|
|
20
|
-
return c.text(`profile "${param.profile}" is now the default`)
|
|
21
|
-
},
|
|
22
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
|
|
5
|
-
export const renameHelp = `funnel profiles rename — rename a profile
|
|
6
|
-
|
|
7
|
-
usage:
|
|
8
|
-
funnel profiles rename <old> <new>
|
|
9
|
-
funnel profiles <old> rename <new>`
|
|
10
|
-
|
|
11
|
-
export const profilesRenameHandler = factory.createHandlers(
|
|
12
|
-
zValidator("param", z.object({ profile: z.string(), newName: z.string() })),
|
|
13
|
-
zValidator("query", z.object({}), renameHelp),
|
|
14
|
-
(c) => {
|
|
15
|
-
const param = c.req.valid("param")
|
|
16
|
-
const funnel = c.var.funnel
|
|
17
|
-
|
|
18
|
-
funnel.profiles.rename(param.profile, param.newName)
|
|
19
|
-
|
|
20
|
-
return c.text(`renamed profile "${param.profile}" to "${param.newName}"`)
|
|
21
|
-
},
|
|
22
|
-
)
|