@interactive-inc/claude-funnel 0.10.0 → 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/dist/bin.js +448 -448
- package/dist/connectors/slack.d.ts +1 -29
- package/dist/gateway/daemon.js +166 -166
- package/dist/index.d.ts +4 -11
- package/dist/index.js +133 -120
- package/dist/slack-event-processor-CS-bAit9.d.ts +43 -0
- package/package.json +1 -6
- package/dist/slack-connector-schema-D7zAHN8k.d.ts +0 -15
- package/lib/bin.ts +0 -3
- package/lib/cli/factory.ts +0 -10
- package/lib/cli/index.ts +0 -85
- package/lib/cli/router/query-to-cli-args.ts +0 -20
- package/lib/cli/router/to-request.ts +0 -113
- 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.publish.ts +0 -52
- 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 -70
- 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 -219
- 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 -49
- package/lib/cli/routes/profiles.remove.$profile.ts +0 -20
- package/lib/cli/routes/profiles.set.$profile.ts +0 -45
- 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/discord.ts +0 -4
- 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/gh.ts +0 -3
- 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/schedule.ts +0 -4
- 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/connectors/slack.ts +0 -4
- package/lib/engine/channels/channels.ts +0 -520
- package/lib/engine/claude/claude.ts +0 -205
- 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 -123
- package/lib/engine/mcp/channel-subscriber.ts +0 -82
- package/lib/engine/mcp/mcp.ts +0 -126
- package/lib/engine/mcp/read-channel-connectors.ts +0 -34
- package/lib/engine/mcp/read-gateway-token.ts +0 -16
- package/lib/engine/mcp/usage-hint-for-type.ts +0 -15
- 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 -48
- 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 -294
- package/lib/gateway/auth-middleware.ts +0 -44
- package/lib/gateway/broadcaster.ts +0 -319
- package/lib/gateway/channel-publisher.ts +0 -67
- 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 -426
- 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/publish-schema.ts +0 -27
- package/lib/gateway/resolve-daemon-script.ts +0 -26
- package/lib/gateway/routes/channels.connectors.call.ts +0 -39
- package/lib/gateway/routes/channels.publish.ts +0 -44
- package/lib/gateway/routes/health.ts +0 -13
- package/lib/gateway/routes/index.ts +0 -26
- 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 -19
- package/lib/gateway/routes/status.ts +0 -15
- package/lib/gateway/routes/validator.ts +0 -17
- package/lib/index.ts +0 -67
- 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,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,219 +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
|
-
channelsPublishHandler,
|
|
37
|
-
publishHelp as channelsPublishHelp,
|
|
38
|
-
} from "@/cli/routes/channels.$channel.publish"
|
|
39
|
-
import {
|
|
40
|
-
channelsRemoveHandler,
|
|
41
|
-
removeHelp as channelsRemoveHelp,
|
|
42
|
-
} from "@/cli/routes/channels.remove.$channel"
|
|
43
|
-
import {
|
|
44
|
-
channelsRenameHandler,
|
|
45
|
-
renameHelp as channelsRenameHelp,
|
|
46
|
-
} from "@/cli/routes/channels.$channel.rename.$newName"
|
|
47
|
-
import { channelsSetDeliveryHandler } from "@/cli/routes/channels.$channel.set.delivery.$mode"
|
|
48
|
-
import { channelsShowHandler } from "@/cli/routes/channels.$channel"
|
|
49
|
-
import { channelsGroupHandler } from "@/cli/routes/channels"
|
|
50
|
-
import { claudeHandler } from "@/cli/routes/claude"
|
|
51
|
-
import { gatewayGroupHandler } from "@/cli/routes/gateway"
|
|
52
|
-
import { gatewayListenersHandler } from "@/cli/routes/gateway.listeners"
|
|
53
|
-
import { gatewayLogsHandler } from "@/cli/routes/gateway.logs"
|
|
54
|
-
import { gatewayRestartHandler } from "@/cli/routes/gateway.restart"
|
|
55
|
-
import { gatewayRunHandler } from "@/cli/routes/gateway.run"
|
|
56
|
-
import { gatewayStartHandler } from "@/cli/routes/gateway.start"
|
|
57
|
-
import { gatewayStatusHandler } from "@/cli/routes/gateway.status"
|
|
58
|
-
import { gatewayStopHandler } from "@/cli/routes/gateway.stop"
|
|
59
|
-
import {
|
|
60
|
-
addHelp as profilesAddHelp,
|
|
61
|
-
profilesAddHandler,
|
|
62
|
-
} from "@/cli/routes/profiles.add.$profile"
|
|
63
|
-
import { profilesAsDefaultHandler } from "@/cli/routes/profiles.$profile.as-default"
|
|
64
|
-
import {
|
|
65
|
-
profilesRenameHandler,
|
|
66
|
-
renameHelp as profilesRenameHelp,
|
|
67
|
-
} from "@/cli/routes/profiles.$profile.rename.$newName"
|
|
68
|
-
import { profilesLaunchHandler } from "@/cli/routes/profiles.$profile.run"
|
|
69
|
-
import {
|
|
70
|
-
profilesRemoveHandler,
|
|
71
|
-
removeHelp as profilesRemoveHelp,
|
|
72
|
-
} from "@/cli/routes/profiles.remove.$profile"
|
|
73
|
-
import {
|
|
74
|
-
profilesSetHandler,
|
|
75
|
-
setHelp as profilesSetHelp,
|
|
76
|
-
} from "@/cli/routes/profiles.set.$profile"
|
|
77
|
-
import { profilesGroupHandler } from "@/cli/routes/profiles"
|
|
78
|
-
import { statusHandler } from "@/cli/routes/status"
|
|
79
|
-
import { updateHandler } from "@/cli/routes/update"
|
|
80
|
-
import { Funnel } from "@/funnel"
|
|
81
|
-
|
|
82
|
-
const helpRoute = (text: string) => factory.createHandlers((c) => c.text(text))
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Build the CLI Hono app wired to a specific Funnel instance.
|
|
86
|
-
* Exposed so library consumers can mount the same routes their `fnl` CLI
|
|
87
|
-
* uses against a custom Funnel (e.g. one with sandboxed boundaries).
|
|
88
|
-
*
|
|
89
|
-
* All CLI verbs (`add` / `remove` / `set` / `rename` / `as-default` / `request`) map to POST in
|
|
90
|
-
* to-request.ts and stay in the URL as a literal segment. Read paths (list / show / launch) keep GET.
|
|
91
|
-
* Help shortcuts at parameterless URLs return the help text directly so `funnel <verb>` (no args) is
|
|
92
|
-
* informative instead of 404.
|
|
93
|
-
*/
|
|
94
|
-
export const createCliApp = (funnel: Funnel) => {
|
|
95
|
-
const base = factory.createApp()
|
|
96
|
-
|
|
97
|
-
base.use((c, next) => {
|
|
98
|
-
c.set("funnel", funnel)
|
|
99
|
-
|
|
100
|
-
return next()
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
base.onError((error, c) => {
|
|
104
|
-
if (error instanceof HTTPException) {
|
|
105
|
-
return c.text(`error: ${error.message}`, error.status)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return c.text(`error: ${error instanceof Error ? error.message : String(error)}`, 400)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
return base
|
|
112
|
-
.get("/claude", ...claudeHandler)
|
|
113
|
-
.get("/channels", ...channelsGroupHandler)
|
|
114
|
-
.post("/channels/add", ...helpRoute(channelsAddHelp))
|
|
115
|
-
.post("/channels/add/:channel", ...channelsAddHandler)
|
|
116
|
-
.post("/channels/remove", ...helpRoute(channelsRemoveHelp))
|
|
117
|
-
.post("/channels/remove/:channel", ...channelsRemoveHandler)
|
|
118
|
-
.post("/channels/rename/:channel/:newName", ...channelsRenameHandler)
|
|
119
|
-
.post("/channels/:channel/rename/:newName", ...channelsRenameHandler)
|
|
120
|
-
.post("/channels/rename", ...helpRoute(channelsRenameHelp))
|
|
121
|
-
.post("/channels/:channel/rename", ...helpRoute(channelsRenameHelp))
|
|
122
|
-
.post("/channels/:channel/set/delivery/:mode", ...channelsSetDeliveryHandler)
|
|
123
|
-
.post("/channels/publish", ...helpRoute(channelsPublishHelp))
|
|
124
|
-
.post("/channels/:channel/publish", ...channelsPublishHandler)
|
|
125
|
-
.get("/channels/:channel", ...channelsShowHandler)
|
|
126
|
-
.get("/channels/:channel/connectors", ...channelsConnectorsGroupHandler)
|
|
127
|
-
.post(
|
|
128
|
-
"/channels/:channel/connectors/add",
|
|
129
|
-
...helpRoute(channelsConnectorsAddHelp),
|
|
130
|
-
)
|
|
131
|
-
.post(
|
|
132
|
-
"/channels/:channel/connectors/add/:connector",
|
|
133
|
-
...channelsConnectorsAddHandler,
|
|
134
|
-
)
|
|
135
|
-
.post(
|
|
136
|
-
"/channels/:channel/connectors/remove",
|
|
137
|
-
...helpRoute(channelsConnectorsRemoveHelp),
|
|
138
|
-
)
|
|
139
|
-
.post(
|
|
140
|
-
"/channels/:channel/connectors/remove/:connector",
|
|
141
|
-
...channelsConnectorsRemoveHandler,
|
|
142
|
-
)
|
|
143
|
-
.post(
|
|
144
|
-
"/channels/:channel/connectors/set",
|
|
145
|
-
...helpRoute(channelsConnectorsSetHelp),
|
|
146
|
-
)
|
|
147
|
-
.post(
|
|
148
|
-
"/channels/:channel/connectors/set/:connector",
|
|
149
|
-
...channelsConnectorsSetHandler,
|
|
150
|
-
)
|
|
151
|
-
.post(
|
|
152
|
-
"/channels/:channel/connectors/rename/:connector/:newName",
|
|
153
|
-
...channelsConnectorsRenameHandler,
|
|
154
|
-
)
|
|
155
|
-
.post(
|
|
156
|
-
"/channels/:channel/connectors/:connector/rename/:newName",
|
|
157
|
-
...channelsConnectorsRenameHandler,
|
|
158
|
-
)
|
|
159
|
-
.post(
|
|
160
|
-
"/channels/:channel/connectors/rename",
|
|
161
|
-
...helpRoute(channelsConnectorsRenameHelp),
|
|
162
|
-
)
|
|
163
|
-
.post(
|
|
164
|
-
"/channels/:channel/connectors/:connector/rename",
|
|
165
|
-
...helpRoute(channelsConnectorsRenameHelp),
|
|
166
|
-
)
|
|
167
|
-
.post(
|
|
168
|
-
"/channels/:channel/connectors/:connector/request",
|
|
169
|
-
...channelsConnectorsRequestHandler,
|
|
170
|
-
)
|
|
171
|
-
.get("/channels/:channel/connectors/:connector", ...channelsConnectorsShowHandler)
|
|
172
|
-
.get(
|
|
173
|
-
"/channels/:channel/connectors/:connector/schedules",
|
|
174
|
-
...channelsConnectorsSchedulesGroupHandler,
|
|
175
|
-
)
|
|
176
|
-
.post(
|
|
177
|
-
"/channels/:channel/connectors/:connector/schedules/add",
|
|
178
|
-
...helpRoute(channelsConnectorsSchedulesAddHelp),
|
|
179
|
-
)
|
|
180
|
-
.post(
|
|
181
|
-
"/channels/:channel/connectors/:connector/schedules/add/:id",
|
|
182
|
-
...channelsConnectorsSchedulesAddHandler,
|
|
183
|
-
)
|
|
184
|
-
.post(
|
|
185
|
-
"/channels/:channel/connectors/:connector/schedules/remove",
|
|
186
|
-
...helpRoute(channelsConnectorsSchedulesRemoveHelp),
|
|
187
|
-
)
|
|
188
|
-
.post(
|
|
189
|
-
"/channels/:channel/connectors/:connector/schedules/remove/:id",
|
|
190
|
-
...channelsConnectorsSchedulesRemoveHandler,
|
|
191
|
-
)
|
|
192
|
-
.get("/profiles", ...profilesGroupHandler)
|
|
193
|
-
.post("/profiles/add", ...helpRoute(profilesAddHelp))
|
|
194
|
-
.post("/profiles/add/:profile", ...profilesAddHandler)
|
|
195
|
-
.post("/profiles/set", ...helpRoute(profilesSetHelp))
|
|
196
|
-
.post("/profiles/set/:profile", ...profilesSetHandler)
|
|
197
|
-
.post("/profiles/remove", ...helpRoute(profilesRemoveHelp))
|
|
198
|
-
.post("/profiles/remove/:profile", ...profilesRemoveHandler)
|
|
199
|
-
.post("/profiles/rename/:profile/:newName", ...profilesRenameHandler)
|
|
200
|
-
.post("/profiles/:profile/rename/:newName", ...profilesRenameHandler)
|
|
201
|
-
.post("/profiles/rename", ...helpRoute(profilesRenameHelp))
|
|
202
|
-
.post("/profiles/:profile/rename", ...helpRoute(profilesRenameHelp))
|
|
203
|
-
.post("/profiles/:profile/as-default", ...profilesAsDefaultHandler)
|
|
204
|
-
.get("/profiles/:profile/run", ...profilesLaunchHandler)
|
|
205
|
-
.get("/profiles/:profile", ...profilesLaunchHandler)
|
|
206
|
-
.get("/gateway", ...gatewayGroupHandler)
|
|
207
|
-
.get("/gateway/status", ...gatewayStatusHandler)
|
|
208
|
-
.get("/gateway/start", ...gatewayStartHandler)
|
|
209
|
-
.get("/gateway/stop", ...gatewayStopHandler)
|
|
210
|
-
.get("/gateway/restart", ...gatewayRestartHandler)
|
|
211
|
-
.get("/gateway/run", ...gatewayRunHandler)
|
|
212
|
-
.get("/gateway/logs", ...gatewayLogsHandler)
|
|
213
|
-
.get("/gateway/listeners", ...gatewayListenersHandler)
|
|
214
|
-
.get("/status", ...statusHandler)
|
|
215
|
-
.get("/update", ...updateHandler)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** CLI Hono app wired to a default `new Funnel()`. For embedding with a custom Funnel use `createCliApp`. */
|
|
219
|
-
export const app = createCliApp(new Funnel())
|
|
@@ -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
|
-
)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { queryToCliArgs } from "@/cli/router/query-to-cli-args"
|
|
5
|
-
import { zValidator } from "@/cli/router/validator"
|
|
6
|
-
|
|
7
|
-
export const launchHelp = `funnel profiles <name> run — launch a profile (sugar for fnl claude)
|
|
8
|
-
|
|
9
|
-
usage: funnel profiles <name> run [additional claude args...]
|
|
10
|
-
funnel profiles <name> (alias)`
|
|
11
|
-
|
|
12
|
-
const RESERVED_KEYS: string[] = []
|
|
13
|
-
|
|
14
|
-
export const profilesLaunchHandler = factory.createHandlers(
|
|
15
|
-
zValidator("param", z.object({ profile: z.string() })),
|
|
16
|
-
zValidator("query", z.object({}).passthrough(), launchHelp),
|
|
17
|
-
async (c) => {
|
|
18
|
-
const param = c.req.valid("param")
|
|
19
|
-
const funnel = c.var.funnel
|
|
20
|
-
const profile = funnel.profiles.get(param.profile)
|
|
21
|
-
|
|
22
|
-
if (!profile) {
|
|
23
|
-
throw new HTTPException(404, { message: `profile "${param.profile}" not found` })
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const exitCode = await funnel.claude.launch({
|
|
27
|
-
channel: profile.channelId,
|
|
28
|
-
cwd: profile.path,
|
|
29
|
-
subAgent: profile.subAgent,
|
|
30
|
-
userArgs: queryToCliArgs(c.req.url, RESERVED_KEYS),
|
|
31
|
-
profileName: profile.name,
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
process.exit(exitCode)
|
|
35
|
-
},
|
|
36
|
-
)
|
|
@@ -1,49 +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 addHelp = `funnel profiles add — add a profile
|
|
7
|
-
|
|
8
|
-
usage: funnel profiles add <name> --path <path> --sub-agent <agent> --channel <channel-name> [--brief]
|
|
9
|
-
|
|
10
|
-
options:
|
|
11
|
-
--path working directory passed to claude as cwd
|
|
12
|
-
--sub-agent sub-agent name passed to claude --agent
|
|
13
|
-
--channel channel name (resolved to channel id internally)
|
|
14
|
-
--brief forward --brief to claude on launch (enables SendUserMessage tool)`
|
|
15
|
-
|
|
16
|
-
export const profilesAddHandler = factory.createHandlers(
|
|
17
|
-
zValidator("param", z.object({ profile: z.string() })),
|
|
18
|
-
zValidator(
|
|
19
|
-
"query",
|
|
20
|
-
z.object({
|
|
21
|
-
path: z.string(),
|
|
22
|
-
"sub-agent": z.string(),
|
|
23
|
-
channel: z.string(),
|
|
24
|
-
brief: z.coerce.boolean().optional(),
|
|
25
|
-
}),
|
|
26
|
-
addHelp,
|
|
27
|
-
),
|
|
28
|
-
(c) => {
|
|
29
|
-
const param = c.req.valid("param")
|
|
30
|
-
const query = c.req.valid("query")
|
|
31
|
-
const funnel = c.var.funnel
|
|
32
|
-
|
|
33
|
-
const channel = funnel.channels.get(query.channel)
|
|
34
|
-
|
|
35
|
-
if (!channel) {
|
|
36
|
-
throw new HTTPException(400, { message: `channel "${query.channel}" not found` })
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
funnel.profiles.add({
|
|
40
|
-
name: param.profile,
|
|
41
|
-
path: query.path,
|
|
42
|
-
subAgent: query["sub-agent"],
|
|
43
|
-
channelId: channel.id,
|
|
44
|
-
...(query.brief !== undefined ? { brief: query.brief } : {}),
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
return c.text(`added profile "${param.profile}"`)
|
|
48
|
-
},
|
|
49
|
-
)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
|
|
5
|
-
export const removeHelp = `funnel profiles remove — remove a profile
|
|
6
|
-
|
|
7
|
-
usage: funnel profiles remove <name>`
|
|
8
|
-
|
|
9
|
-
export const profilesRemoveHandler = factory.createHandlers(
|
|
10
|
-
zValidator("param", z.object({ profile: z.string() })),
|
|
11
|
-
zValidator("query", z.object({}), removeHelp),
|
|
12
|
-
(c) => {
|
|
13
|
-
const param = c.req.valid("param")
|
|
14
|
-
const funnel = c.var.funnel
|
|
15
|
-
|
|
16
|
-
funnel.profiles.remove(param.profile)
|
|
17
|
-
|
|
18
|
-
return c.text(`removed profile "${param.profile}"`)
|
|
19
|
-
},
|
|
20
|
-
)
|
|
@@ -1,45 +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 setHelp = `funnel profiles <name> set — update a profile
|
|
7
|
-
|
|
8
|
-
usage: funnel profiles <name> set [--path <path>] [--sub-agent <agent>] [--channel <channel-name>] [--brief | --no-brief]`
|
|
9
|
-
|
|
10
|
-
export const profilesSetHandler = factory.createHandlers(
|
|
11
|
-
zValidator("param", z.object({ profile: z.string() })),
|
|
12
|
-
zValidator(
|
|
13
|
-
"query",
|
|
14
|
-
z.object({
|
|
15
|
-
path: z.string().optional(),
|
|
16
|
-
"sub-agent": z.string().optional(),
|
|
17
|
-
channel: z.string().optional(),
|
|
18
|
-
brief: z.coerce.boolean().optional(),
|
|
19
|
-
"no-brief": z.coerce.boolean().optional(),
|
|
20
|
-
}),
|
|
21
|
-
setHelp,
|
|
22
|
-
),
|
|
23
|
-
(c) => {
|
|
24
|
-
const param = c.req.valid("param")
|
|
25
|
-
const query = c.req.valid("query")
|
|
26
|
-
const funnel = c.var.funnel
|
|
27
|
-
|
|
28
|
-
const channel = query.channel !== undefined ? funnel.channels.get(query.channel) : null
|
|
29
|
-
|
|
30
|
-
if (query.channel !== undefined && !channel) {
|
|
31
|
-
throw new HTTPException(400, { message: `channel "${query.channel}" not found` })
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const brief = query["no-brief"] ? false : query.brief
|
|
35
|
-
|
|
36
|
-
funnel.profiles.update(param.profile, {
|
|
37
|
-
path: query.path,
|
|
38
|
-
subAgent: query["sub-agent"],
|
|
39
|
-
channelId: channel?.id,
|
|
40
|
-
...(brief !== undefined ? { brief } : {}),
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return c.text(`updated profile "${param.profile}"`)
|
|
44
|
-
},
|
|
45
|
-
)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
|
|
5
|
-
export const groupHelp = `funnel profiles — manage launch profiles
|
|
6
|
-
|
|
7
|
-
usage: funnel profiles [subcommand]
|
|
8
|
-
|
|
9
|
-
subcommands:
|
|
10
|
-
(none) list (first entry is the default)
|
|
11
|
-
add <name> --path <path> --sub-agent <agent> --channel <channel>
|
|
12
|
-
<name> set [--path ...] [--sub-agent ...] [--channel ...]
|
|
13
|
-
<name> as-default move profile to the front (becomes default)
|
|
14
|
-
rename <old> <new> rename
|
|
15
|
-
remove <name> remove
|
|
16
|
-
<name> run launch (sugar for fnl claude -p <name>)
|
|
17
|
-
<name> launch (alias for run)
|
|
18
|
-
|
|
19
|
-
examples:
|
|
20
|
-
funnel profiles add cto --path /repo/myapp --sub-agent cto --channel prod-inbox
|
|
21
|
-
funnel profiles cto as-default
|
|
22
|
-
funnel profiles cto run`
|
|
23
|
-
|
|
24
|
-
export const profilesGroupHandler = factory.createHandlers(
|
|
25
|
-
zValidator("query", z.object({}), groupHelp),
|
|
26
|
-
(c) => {
|
|
27
|
-
const funnel = c.var.funnel
|
|
28
|
-
const profiles = funnel.profiles.list()
|
|
29
|
-
|
|
30
|
-
if (profiles.length === 0) return c.text("no profiles")
|
|
31
|
-
|
|
32
|
-
const lines = profiles.map((profile, index) => {
|
|
33
|
-
const tag = index === 0 ? " (default)" : ""
|
|
34
|
-
|
|
35
|
-
return `${profile.name}${tag} [path=${profile.path}, sub-agent=${profile.subAgent}, channel=${profile.channelId}]`
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
return c.text(lines.join("\n"))
|
|
39
|
-
},
|
|
40
|
-
)
|
package/lib/cli/routes/status.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { factory } from "@/cli/factory"
|
|
3
|
-
import { zValidator } from "@/cli/router/validator"
|
|
4
|
-
|
|
5
|
-
export const statusHelp = `funnel status — show overall connection status
|
|
6
|
-
|
|
7
|
-
usage: funnel status
|
|
8
|
-
|
|
9
|
-
Lists configured connectors / channels / profiles, gateway running status,
|
|
10
|
-
and active MCP WebSocket clients.`
|
|
11
|
-
|
|
12
|
-
type GatewayClient = { channel: string; connectors: string[] }
|
|
13
|
-
|
|
14
|
-
type GatewayStatus = {
|
|
15
|
-
ok: boolean
|
|
16
|
-
clients: GatewayClient[]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const isGatewayStatus = (value: unknown): value is GatewayStatus => {
|
|
20
|
-
if (value === null || typeof value !== "object") return false
|
|
21
|
-
if (!("clients" in value) || !Array.isArray(value.clients)) return false
|
|
22
|
-
|
|
23
|
-
return value.clients.every(
|
|
24
|
-
(client: unknown) =>
|
|
25
|
-
typeof client === "object" &&
|
|
26
|
-
client !== null &&
|
|
27
|
-
"channel" in client &&
|
|
28
|
-
typeof client.channel === "string" &&
|
|
29
|
-
"connectors" in client &&
|
|
30
|
-
Array.isArray(client.connectors),
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const statusHandler = factory.createHandlers(
|
|
35
|
-
zValidator("query", z.object({}), statusHelp),
|
|
36
|
-
async (c) => {
|
|
37
|
-
const funnel = c.var.funnel
|
|
38
|
-
const channels = funnel.channels.list()
|
|
39
|
-
const profiles = funnel.profiles.list()
|
|
40
|
-
const gatewayStatus = funnel.gateway.getStatus()
|
|
41
|
-
|
|
42
|
-
const lines: string[] = []
|
|
43
|
-
|
|
44
|
-
lines.push("= funnel status =")
|
|
45
|
-
lines.push("")
|
|
46
|
-
|
|
47
|
-
lines.push(`channels: ${channels.length}`)
|
|
48
|
-
for (const ch of channels) {
|
|
49
|
-
const attached =
|
|
50
|
-
ch.connectors.length > 0
|
|
51
|
-
? ch.connectors.map((c) => `${c.name}:${c.type}`).join(", ")
|
|
52
|
-
: "(none)"
|
|
53
|
-
lines.push(` - ${ch.name} [${attached}]`)
|
|
54
|
-
}
|
|
55
|
-
lines.push("")
|
|
56
|
-
|
|
57
|
-
lines.push(`profiles: ${profiles.length}`)
|
|
58
|
-
for (const [index, profile] of profiles.entries()) {
|
|
59
|
-
const tag = index === 0 ? " (default)" : ""
|
|
60
|
-
const channel = funnel.channels.getById(profile.channelId)
|
|
61
|
-
const channelLabel = channel ? channel.name : `id:${profile.channelId}`
|
|
62
|
-
|
|
63
|
-
lines.push(
|
|
64
|
-
` - ${profile.name}${tag} [path=${profile.path}, sub-agent=${profile.subAgent}, channel=${channelLabel}]`,
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
lines.push("")
|
|
68
|
-
|
|
69
|
-
if (!gatewayStatus.running) {
|
|
70
|
-
lines.push("gateway: not running")
|
|
71
|
-
} else {
|
|
72
|
-
lines.push(`gateway: running (pid ${gatewayStatus.pid}, port ${gatewayStatus.port})`)
|
|
73
|
-
|
|
74
|
-
const res = await fetch(`http://localhost:${gatewayStatus.port}/status`).catch(() => null)
|
|
75
|
-
|
|
76
|
-
if (res && res.ok) {
|
|
77
|
-
const body: unknown = await res.json()
|
|
78
|
-
|
|
79
|
-
if (isGatewayStatus(body)) {
|
|
80
|
-
lines.push(` clients: ${body.clients.length}`)
|
|
81
|
-
|
|
82
|
-
for (const client of body.clients) {
|
|
83
|
-
const connectorList =
|
|
84
|
-
client.connectors.length > 0 ? client.connectors.join(", ") : "(none)"
|
|
85
|
-
lines.push(` - channel=${client.channel || "(unset)"} [${connectorList}]`)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return c.text(lines.join("\n"))
|
|
92
|
-
},
|
|
93
|
-
)
|
package/lib/cli/routes/update.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from "hono/http-exception"
|
|
2
|
-
import { z } from "zod"
|
|
3
|
-
import { factory } from "@/cli/factory"
|
|
4
|
-
import { NodeFunnelProcessRunner } from "@/engine/process/node-process-runner"
|
|
5
|
-
import { zValidator } from "@/cli/router/validator"
|
|
6
|
-
|
|
7
|
-
export const updateHelp = `funnel update — update funnel to the latest version
|
|
8
|
-
|
|
9
|
-
usage: funnel update
|
|
10
|
-
|
|
11
|
-
Runs "bun i -g @interactive-inc/claude-funnel".`
|
|
12
|
-
|
|
13
|
-
const PACKAGE = "@interactive-inc/claude-funnel"
|
|
14
|
-
|
|
15
|
-
export const updateHandler = factory.createHandlers(
|
|
16
|
-
zValidator("query", z.object({}), updateHelp),
|
|
17
|
-
async (c) => {
|
|
18
|
-
const runner = new NodeFunnelProcessRunner()
|
|
19
|
-
const exitCode = await runner.attach(["bun", "i", "-g", PACKAGE])
|
|
20
|
-
|
|
21
|
-
if (exitCode !== 0) {
|
|
22
|
-
throw new HTTPException(500, { message: `update failed (exit ${exitCode})` })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return c.text(`updated ${PACKAGE}`)
|
|
26
|
-
},
|
|
27
|
-
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { discordConnectorSchema } from "@/connectors/discord-connector-schema"
|
|
3
|
-
import { ghConnectorSchema } from "@/connectors/gh-connector-schema"
|
|
4
|
-
import { scheduleConnectorSchema } from "@/connectors/schedule-connector-schema"
|
|
5
|
-
import { slackConnectorSchema } from "@/connectors/slack-connector-schema"
|
|
6
|
-
|
|
7
|
-
export const connectorConfigSchema = z.discriminatedUnion("type", [
|
|
8
|
-
slackConnectorSchema,
|
|
9
|
-
ghConnectorSchema,
|
|
10
|
-
discordConnectorSchema,
|
|
11
|
-
scheduleConnectorSchema,
|
|
12
|
-
])
|
|
13
|
-
|
|
14
|
-
export type ConnectorConfig = z.infer<typeof connectorConfigSchema>
|
|
15
|
-
|
|
16
|
-
export type ConnectorType = ConnectorConfig["type"]
|