@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,19 +0,0 @@
|
|
|
1
|
-
import type { ZodType } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Path-param validator for gateway routes. On failure it answers with the same
|
|
4
|
-
* `{ ok: false, reason }` shape the listener routes already use, so
|
|
5
|
-
* `FunnelListenersClient` can surface the message without special-casing.
|
|
6
|
-
*/
|
|
7
|
-
export declare const zParam: <T extends ZodType>(schema: T) => import("hono").MiddlewareHandler<import("hono").Env, string, {
|
|
8
|
-
in: (undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) ? true : false) extends true ? {
|
|
9
|
-
param?: ([T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never] extends [Record<string, string>] ? Record<string, string> & (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, undefined>] extends [never] ? {} : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, undefined>] extends [object] ? undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) ? ((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) & undefined) | (((Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) & undefined> extends infer T_3 ? { [K_2 in keyof T_3]: ([Exclude<T_3[K_2], undefined>] extends [string] ? [string & Exclude<T_3[K_2], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_3[K_2], undefined>>] ? false : true : false) extends true ? T_3[K_2] : ([unknown] extends [T_3[K_2]] ? false : undefined extends T_3[K_2] ? true : false) extends true ? T_3[K_2] : Target extends "form" ? T$1 | T$1[] : Target extends "query" ? string | string[] : Target extends "param" ? string : Target extends "header" ? string : Target extends "cookie" ? string : unknown; } : never) extends infer T_2 ? { [K_1 in keyof T_2]: T_2[K_1]; } : never) extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never) : (((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) extends infer T_6 ? { [K_5 in keyof T_6]: ([Exclude<T_6[K_5], undefined>] extends [string] ? [string & Exclude<T_6[K_5], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_6[K_5], undefined>>] ? false : true : false) extends true ? T_6[K_5] : ([unknown] extends [T_6[K_5]] ? false : undefined extends T_6[K_5] ? true : false) extends true ? T_6[K_5] : Target extends "form" ? T$1 | T$1[] : Target extends "query" ? string | string[] : Target extends "param" ? string : Target extends "header" ? string : Target extends "cookie" ? string : unknown; } : never) extends infer T_5 ? { [K_4 in keyof T_5]: T_5[K_4]; } : never) extends infer T_4 ? { [K_3 in keyof T_4]: T_4[K_3]; } : never : {}) | undefined;
|
|
10
|
-
} : {
|
|
11
|
-
param: [T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never] extends [Record<string, string>] ? Record<string, string> & (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, undefined>] extends [never] ? {} : [Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, undefined>] extends [object] ? undefined extends (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) ? ((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) & undefined) | (((Exclude<T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never, (T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) & undefined> extends infer T_9 ? { [K_2 in keyof T_9]: ([Exclude<T_9[K_2], undefined>] extends [string] ? [string & Exclude<T_9[K_2], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_9[K_2], undefined>>] ? false : true : false) extends true ? T_9[K_2] : ([unknown] extends [T_9[K_2]] ? false : undefined extends T_9[K_2] ? true : false) extends true ? T_9[K_2] : Target extends "form" ? T$1 | T$1[] : Target extends "query" ? string | string[] : Target extends "param" ? string : Target extends "header" ? string : Target extends "cookie" ? string : unknown; } : never) extends infer T_8 ? { [K_1 in keyof T_8]: T_8[K_1]; } : never) extends infer T_7 ? { [K in keyof T_7]: T_7[K]; } : never) : (((T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").input<T> : never) extends infer T_12 ? { [K_5 in keyof T_12]: ([Exclude<T_12[K_5], undefined>] extends [string] ? [string & Exclude<T_12[K_5], undefined>] extends [import("hono/utils/types").UnionToIntersection<string & Exclude<T_12[K_5], undefined>>] ? false : true : false) extends true ? T_12[K_5] : ([unknown] extends [T_12[K_5]] ? false : undefined extends T_12[K_5] ? true : false) extends true ? T_12[K_5] : Target extends "form" ? T$1 | T$1[] : Target extends "query" ? string | string[] : Target extends "param" ? string : Target extends "header" ? string : Target extends "cookie" ? string : unknown; } : never) extends infer T_11 ? { [K_4 in keyof T_11]: T_11[K_4]; } : never) extends infer T_10 ? { [K_3 in keyof T_10]: T_10[K_3]; } : never : {};
|
|
12
|
-
};
|
|
13
|
-
out: {
|
|
14
|
-
param: T extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").output<T> : T extends import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<T> : never;
|
|
15
|
-
};
|
|
16
|
-
}, import("hono").TypedResponse<{
|
|
17
|
-
ok: boolean;
|
|
18
|
-
reason: string;
|
|
19
|
-
}, 400, "json">>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { LeucoHumanRecord } from "./leuco-human-record";
|
|
2
|
-
import type { LeucoHumanWriter } from "./leuco-human-writer";
|
|
3
|
-
type Props = {
|
|
4
|
-
/** Filesystem path. Parent directory is created on construct. */
|
|
5
|
-
path: string;
|
|
6
|
-
/**
|
|
7
|
-
* Optional size cap in bytes. When the next write would push the file
|
|
8
|
-
* over the cap, the existing file becomes `<path>.1` (replacing any
|
|
9
|
-
* prior `.1`) and a fresh file takes its place. Single-keep rotation —
|
|
10
|
-
* a second cycle drops the previous `.1`.
|
|
11
|
-
*/
|
|
12
|
-
maxBytes?: number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Appends one JSON line per record to a file. Optional one-keep size
|
|
16
|
-
* rotation. Designed for diagnostic logs a human tails (`tail -f file |
|
|
17
|
-
* jq`); not for replay or queries — use `LeucoLoggerSqliteSink` if you
|
|
18
|
-
* need indexed lookups.
|
|
19
|
-
*
|
|
20
|
-
* Writes are synchronous (`appendFileSync`), so each line is durable
|
|
21
|
-
* before `write` returns. Throughput matches the OS file cache; for
|
|
22
|
-
* high-volume logging consider buffering at the call site or using a
|
|
23
|
-
* different writer.
|
|
24
|
-
*/
|
|
25
|
-
export declare class LeucoHumanFileWriter implements LeucoHumanWriter {
|
|
26
|
-
private readonly path;
|
|
27
|
-
private readonly maxBytes;
|
|
28
|
-
constructor(props: Props);
|
|
29
|
-
write(record: LeucoHumanRecord): void | Error;
|
|
30
|
-
private ensureDir;
|
|
31
|
-
private rotateIfNeeded;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { LeucoHumanLevel, LeucoHumanRecord } from "./leuco-human-record";
|
|
2
|
-
import type { LeucoHumanWriter } from "./leuco-human-writer";
|
|
3
|
-
type WriteErrorHandler = (error: Error, record: LeucoHumanRecord) => void;
|
|
4
|
-
type Props = {
|
|
5
|
-
/** Where records go. Use `LeucoHumanStdoutWriter`, `LeucoHumanFileWriter`, or your own. */
|
|
6
|
-
writer: LeucoHumanWriter;
|
|
7
|
-
/** Minimum level to emit. Lower-rank records are dropped. Default: "info". */
|
|
8
|
-
level?: LeucoHumanLevel;
|
|
9
|
-
/** Override for tests. Defaults to `Date.now`. */
|
|
10
|
-
now?: () => number;
|
|
11
|
-
/** Observer for writer failures. Default: silently swallow. */
|
|
12
|
-
onWriteError?: WriteErrorHandler;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Human-facing diagnostic logger. The companion to `LeucoLogger`: where
|
|
16
|
-
* `LeucoLogger` is for schema-validated, replayable domain events,
|
|
17
|
-
* `LeucoHumanLogger` is for free-form info/warn/error messages destined
|
|
18
|
-
* for a human tailing a log or skimming during incident response.
|
|
19
|
-
*
|
|
20
|
-
* Keeping the two separate matters operationally:
|
|
21
|
-
* - Diagnostics typically out-volume domain events 10–1000x; mixing
|
|
22
|
-
* them in the same store would push events out under retention.
|
|
23
|
-
* - Diagnostics are unstructured by design; mixing them in would defeat
|
|
24
|
-
* the schema-first guarantee that makes domain events replayable.
|
|
25
|
-
* - Different audiences and queries (humans grep `tail -f` vs. tools
|
|
26
|
-
* query `WHERE seq > ?`).
|
|
27
|
-
*
|
|
28
|
-
* The writer is a port. Level gating happens here so writers receive only
|
|
29
|
-
* what is worth persisting. Failure isolation matches `LeucoLogger`: a
|
|
30
|
-
* writer that throws or returns Error is contained, surfaced via
|
|
31
|
-
* `onWriteError`, and never blocks the caller.
|
|
32
|
-
*/
|
|
33
|
-
export declare class LeucoHumanLogger {
|
|
34
|
-
private readonly writer;
|
|
35
|
-
private readonly minRank;
|
|
36
|
-
private readonly now;
|
|
37
|
-
private readonly onWriteError;
|
|
38
|
-
constructor(props: Props);
|
|
39
|
-
info(message: string, meta?: Record<string, unknown>): void;
|
|
40
|
-
warn(message: string, meta?: Record<string, unknown>): void;
|
|
41
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
42
|
-
close(): void;
|
|
43
|
-
private emit;
|
|
44
|
-
private callWriter;
|
|
45
|
-
}
|
|
46
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type LeucoHumanLevel = "info" | "warn" | "error";
|
|
2
|
-
/**
|
|
3
|
-
* One human-facing diagnostic log entry. Distinct from `LeucoLoggerRecord`
|
|
4
|
-
* (which wraps a schema-validated domain event) — this is the free-form,
|
|
5
|
-
* for-humans-tailing-a-log shape: a level, a message, and optional meta.
|
|
6
|
-
*
|
|
7
|
-
* `meta` is `null` rather than `undefined` when absent so writers can
|
|
8
|
-
* persist a uniform shape (no missing-key ambiguity in JSON Lines).
|
|
9
|
-
*/
|
|
10
|
-
export type LeucoHumanRecord = {
|
|
11
|
-
ts: number;
|
|
12
|
-
level: LeucoHumanLevel;
|
|
13
|
-
message: string;
|
|
14
|
-
meta: Record<string, unknown> | null;
|
|
15
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { LeucoHumanRecord } from "./leuco-human-record";
|
|
2
|
-
import type { LeucoHumanWriter } from "./leuco-human-writer";
|
|
3
|
-
type Stream = {
|
|
4
|
-
write(s: string): void;
|
|
5
|
-
};
|
|
6
|
-
type Props = {
|
|
7
|
-
/** Override for tests. Defaults to `process.stdout`. */
|
|
8
|
-
out?: Stream;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Writes one JSON line per record to stdout. Useful as the default writer
|
|
12
|
-
* for foreground daemons, dev runs, and short-lived processes where a
|
|
13
|
-
* file-backed log would be overkill.
|
|
14
|
-
*/
|
|
15
|
-
export declare class LeucoHumanStdoutWriter implements LeucoHumanWriter {
|
|
16
|
-
private readonly out;
|
|
17
|
-
constructor(props?: Props);
|
|
18
|
-
write(record: LeucoHumanRecord): void;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { LeucoHumanRecord } from "./leuco-human-record";
|
|
2
|
-
/**
|
|
3
|
-
* Plugin port for `LeucoHumanLogger`. Writers decide where diagnostic
|
|
4
|
-
* records land — stdout, JSONL file, syslog, network, etc. — without the
|
|
5
|
-
* logger having to know about persistence shape.
|
|
6
|
-
*
|
|
7
|
-
* `write` returns `void` on success or an `Error` the logger surfaces via
|
|
8
|
-
* `onWriteError`. Throwing is also tolerated; the logger catches.
|
|
9
|
-
*/
|
|
10
|
-
export type LeucoHumanWriter = {
|
|
11
|
-
write(record: LeucoHumanRecord): void | Error;
|
|
12
|
-
close?(): void;
|
|
13
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { LeucoLoggerRecord } from "./leuco-logger-record";
|
|
2
|
-
import type { LeucoLoggerPrimarySink, LeucoLoggerSink } from "./leuco-logger-sink";
|
|
3
|
-
type Props = {
|
|
4
|
-
/** Hard cap on retained records. The oldest is evicted on overflow. 0 disables retention. */
|
|
5
|
-
capacity?: number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* In-memory ring buffer that doubles as primary or relay. As primary it
|
|
9
|
-
* owns its own seq counter (single-process only — for multi-process
|
|
10
|
-
* safety, use `LeucoLoggerSqliteSink` as primary and place this as a
|
|
11
|
-
* relay). As relay it accepts whatever seq the primary assigned and
|
|
12
|
-
* advances its own counter to match, so `getMaxSeq` stays meaningful.
|
|
13
|
-
*
|
|
14
|
-
* Useful as a test double, as a short-window replay buffer paired with a
|
|
15
|
-
* persistent primary (covering reconnects without round-tripping disk),
|
|
16
|
-
* or as a backing store for live subscribers.
|
|
17
|
-
*/
|
|
18
|
-
export declare class LeucoLoggerMemorySink<E> implements LeucoLoggerPrimarySink<E>, LeucoLoggerSink<E> {
|
|
19
|
-
private readonly capacity;
|
|
20
|
-
private readonly buffer;
|
|
21
|
-
private seq;
|
|
22
|
-
constructor(props?: Props);
|
|
23
|
-
insert(input: {
|
|
24
|
-
ts: number;
|
|
25
|
-
event: E;
|
|
26
|
-
}): LeucoLoggerRecord<E>;
|
|
27
|
-
write(record: LeucoLoggerRecord<E>): void;
|
|
28
|
-
getMaxSeq(): number;
|
|
29
|
-
getRecords(): ReadonlyArray<LeucoLoggerRecord<E>>;
|
|
30
|
-
clear(): void;
|
|
31
|
-
private append;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wrapper that `LeucoLogger.emit` puts around every event before handing it
|
|
3
|
-
* to a sink. `seq` is monotonic across the lifetime of the underlying store —
|
|
4
|
-
* sinks persist it as the primary key so replay (and broadcaster seeding
|
|
5
|
-
* after restart) is an indexed range scan, not a full table walk. `ts` is
|
|
6
|
-
* epoch milliseconds. `event` is the caller-defined payload validated by the
|
|
7
|
-
* Zod schema passed to the bus.
|
|
8
|
-
*/
|
|
9
|
-
export type LeucoLoggerRecord<E> = {
|
|
10
|
-
seq: number;
|
|
11
|
-
ts: number;
|
|
12
|
-
event: E;
|
|
13
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { LeucoLoggerRecord } from "./leuco-logger-record";
|
|
2
|
-
/**
|
|
3
|
-
* Relay sink. Receives records that already have a `seq` assigned by the
|
|
4
|
-
* primary and stores or forwards them — memory ring, stdout, network push,
|
|
5
|
-
* a second SQLite mirror, etc. Does not generate seq itself, so any number
|
|
6
|
-
* can be attached and they all observe the same monotonic stream.
|
|
7
|
-
*
|
|
8
|
-
* `write` returns `void` on success or an `Error` the bus surfaces via
|
|
9
|
-
* `onSinkError`. Throwing is also tolerated (the bus catches), but
|
|
10
|
-
* returning is preferred so the failure path is part of the type.
|
|
11
|
-
*/
|
|
12
|
-
export type LeucoLoggerSink<E> = {
|
|
13
|
-
write(record: LeucoLoggerRecord<E>): void | Error;
|
|
14
|
-
close?(): void;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Primary sink. Owns the canonical seq sequence for the bus. `insert` is
|
|
18
|
-
* the atomic boundary — it assigns a seq strictly greater than every
|
|
19
|
-
* previously assigned one, persists the record, and returns it. SQLite
|
|
20
|
-
* implementations get atomicity for free by delegating to `INTEGER PRIMARY
|
|
21
|
-
* KEY` so two processes sharing one database file see one monotonic
|
|
22
|
-
* stream without bus-level coordination.
|
|
23
|
-
*
|
|
24
|
-
* `getMaxSeq` is the highest seq currently in the sink — used for
|
|
25
|
-
* observability and for replay seeding by clients reading the store.
|
|
26
|
-
*/
|
|
27
|
-
export type LeucoLoggerPrimarySink<E> = {
|
|
28
|
-
insert(input: {
|
|
29
|
-
ts: number;
|
|
30
|
-
event: E;
|
|
31
|
-
}): LeucoLoggerRecord<E> | Error;
|
|
32
|
-
getMaxSeq(): number;
|
|
33
|
-
close?(): void;
|
|
34
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { LeucoLoggerRecord } from "./leuco-logger-record";
|
|
2
|
-
import type { LeucoLoggerPrimarySink, LeucoLoggerSink } from "./leuco-logger-sink";
|
|
3
|
-
type IndexValues<I extends ReadonlyArray<string>> = Record<I[number], string | null>;
|
|
4
|
-
/**
|
|
5
|
-
* Constructor props. The shape narrows on `I`: when no indexes are
|
|
6
|
-
* declared (the default), `extractIndexes` is forbidden; when indexes
|
|
7
|
-
* are declared, both `indexes` and `extractIndexes` are required and
|
|
8
|
-
* `extractIndexes` is type-checked against the index keys.
|
|
9
|
-
*/
|
|
10
|
-
type Props<E, I extends ReadonlyArray<string>> = I extends readonly [] ? {
|
|
11
|
-
path: string;
|
|
12
|
-
maxRows?: number;
|
|
13
|
-
maxAgeMs?: number;
|
|
14
|
-
now?: () => number;
|
|
15
|
-
indexes?: I;
|
|
16
|
-
extractIndexes?: never;
|
|
17
|
-
} : {
|
|
18
|
-
path: string;
|
|
19
|
-
maxRows?: number;
|
|
20
|
-
maxAgeMs?: number;
|
|
21
|
-
now?: () => number;
|
|
22
|
-
indexes: I;
|
|
23
|
-
extractIndexes: (event: E) => IndexValues<I>;
|
|
24
|
-
};
|
|
25
|
-
type GetRecordsProps<I extends ReadonlyArray<string>> = {
|
|
26
|
-
/** Return only records with seq strictly greater than this. */
|
|
27
|
-
sinceSeq?: number;
|
|
28
|
-
/** Filter by the top-level `event.type` discriminator. */
|
|
29
|
-
type?: string;
|
|
30
|
-
/** Filter by indexed columns. Keys are constrained to the declared `indexes`. */
|
|
31
|
-
where?: Partial<IndexValues<I>>;
|
|
32
|
-
/** Maximum rows returned. Default 1000. */
|
|
33
|
-
limit?: number;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* SQLite-backed sink built on `bun:sqlite`. Implements both primary and
|
|
37
|
-
* relay roles so the same instance can own seq generation for one bus and
|
|
38
|
-
* mirror records from another (e.g. cross-process replication, restore
|
|
39
|
-
* from a backup stream).
|
|
40
|
-
*
|
|
41
|
-
* Concurrency model: seq is `INTEGER PRIMARY KEY`, so SQLite assigns it
|
|
42
|
-
* atomically via `lastInsertRowid`. Two `LeucoLogger` instances pointed
|
|
43
|
-
* at the same database file therefore see one monotonically increasing
|
|
44
|
-
* seq stream without any bus-level coordination — the database itself is
|
|
45
|
-
* the synchronization point.
|
|
46
|
-
*
|
|
47
|
-
* Schema is version-managed via `PRAGMA user_version`. Migrations are
|
|
48
|
-
* append-only and run in a transaction on every construct so a partial
|
|
49
|
-
* upgrade rolls back cleanly. Caller-defined `indexes` are layered on top
|
|
50
|
-
* via `ALTER TABLE ADD COLUMN` + `CREATE INDEX IF NOT EXISTS`, so adding
|
|
51
|
-
* a new index to an existing database is a no-downtime operation.
|
|
52
|
-
*
|
|
53
|
-
* Type safety: the second generic parameter `I` is the literal tuple of
|
|
54
|
-
* index column names. `extractIndexes` and `getRecords({ where })` are
|
|
55
|
-
* both type-checked against this tuple, so a typo at the call site is a
|
|
56
|
-
* compile-time error rather than a silent miss at runtime.
|
|
57
|
-
*
|
|
58
|
-
* Retention is bounded by `maxRows` and/or `maxAgeMs`. Both run on every
|
|
59
|
-
* insert as a single indexed DELETE that no-ops below the cap.
|
|
60
|
-
*
|
|
61
|
-
* Bulk inserts use `insertMany`, which wraps the batch in one transaction
|
|
62
|
-
* for ~10–100x throughput at the cost of one fsync per batch instead of
|
|
63
|
-
* one per row.
|
|
64
|
-
*/
|
|
65
|
-
export declare class LeucoLoggerSqliteSink<E, const I extends ReadonlyArray<string> = readonly []> implements LeucoLoggerPrimarySink<E>, LeucoLoggerSink<E> {
|
|
66
|
-
private readonly db;
|
|
67
|
-
private readonly maxRows;
|
|
68
|
-
private readonly maxAgeMs;
|
|
69
|
-
private readonly now;
|
|
70
|
-
private readonly indexes;
|
|
71
|
-
private readonly extractIndexes;
|
|
72
|
-
private readonly insertStmt;
|
|
73
|
-
private readonly insertWithSeqStmt;
|
|
74
|
-
private readonly maxSeqStmt;
|
|
75
|
-
private readonly countStmt;
|
|
76
|
-
private readonly trimRowsStmt;
|
|
77
|
-
private readonly trimAgeStmt;
|
|
78
|
-
constructor(props: Props<E, I>);
|
|
79
|
-
insert(input: {
|
|
80
|
-
ts: number;
|
|
81
|
-
event: E;
|
|
82
|
-
}): LeucoLoggerRecord<E> | Error;
|
|
83
|
-
insertMany(inputs: ReadonlyArray<{
|
|
84
|
-
ts: number;
|
|
85
|
-
event: E;
|
|
86
|
-
}>): LeucoLoggerRecord<E>[] | Error;
|
|
87
|
-
write(record: LeucoLoggerRecord<E>): void | Error;
|
|
88
|
-
getMaxSeq(): number;
|
|
89
|
-
getRecords(props?: GetRecordsProps<I>): LeucoLoggerRecord<E>[];
|
|
90
|
-
/**
|
|
91
|
-
* Current schema version. Useful for diagnostics and for tests that want
|
|
92
|
-
* to verify migrations ran. Reads `PRAGMA user_version` once per call.
|
|
93
|
-
*/
|
|
94
|
-
getSchemaVersion(): number;
|
|
95
|
-
close(): void;
|
|
96
|
-
private buildInsertParams;
|
|
97
|
-
private appendWhereConditions;
|
|
98
|
-
private trim;
|
|
99
|
-
private syncIndexColumns;
|
|
100
|
-
private migrate;
|
|
101
|
-
}
|
|
102
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { ZodType } from "zod";
|
|
2
|
-
import type { LeucoLoggerRecord } from "./leuco-logger-record";
|
|
3
|
-
import type { LeucoLoggerPrimarySink, LeucoLoggerSink } from "./leuco-logger-sink";
|
|
4
|
-
type Listener<E> = (record: LeucoLoggerRecord<E>) => void;
|
|
5
|
-
type SinkErrorHandler<E> = (error: Error, record: LeucoLoggerRecord<E>, sink: LeucoLoggerSink<E>) => void;
|
|
6
|
-
type Props<E> = {
|
|
7
|
-
/** Zod schema for the event union. Validated on every `emit`. */
|
|
8
|
-
schema: ZodType<E>;
|
|
9
|
-
/** Owns seq assignment + durability. Use `LeucoLoggerSqliteSink` for multi-process safety. */
|
|
10
|
-
primary: LeucoLoggerPrimarySink<E>;
|
|
11
|
-
/** Optional fanout for already-sequenced records (memory ring, stdout, network mirror). */
|
|
12
|
-
relays?: ReadonlyArray<LeucoLoggerSink<E>>;
|
|
13
|
-
/** Override for tests. Defaults to `Date.now`. */
|
|
14
|
-
now?: () => number;
|
|
15
|
-
/** Observer for relay failures. Default: silently swallow. */
|
|
16
|
-
onSinkError?: SinkErrorHandler<E>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Schema-validated event log bus. Three responsibilities and nothing else:
|
|
20
|
-
* validate the event, delegate seq + persistence to the primary sink, and
|
|
21
|
-
* fan the resulting record out to relays and live subscribers.
|
|
22
|
-
*
|
|
23
|
-
* Splitting "primary" from "relays" makes the seq invariant honest: there
|
|
24
|
-
* is exactly one source of truth (the primary's atomic insert). Two
|
|
25
|
-
* `LeucoLogger` instances pointed at the same SQLite file therefore see
|
|
26
|
-
* one monotonic stream without bus-level coordination. Relays mirror
|
|
27
|
-
* already-sequenced records, so they can be added or removed without
|
|
28
|
-
* affecting correctness.
|
|
29
|
-
*
|
|
30
|
-
* Failure isolation:
|
|
31
|
-
* - Primary failure short-circuits emit and is returned to the caller.
|
|
32
|
-
* - Relay failures never block the primary path — they surface via the
|
|
33
|
-
* optional `onSinkError` callback so the caller can observe without
|
|
34
|
-
* being interrupted.
|
|
35
|
-
* - A subscriber that throws is contained; the rest of the fanout
|
|
36
|
-
* completes normally.
|
|
37
|
-
*/
|
|
38
|
-
export declare class LeucoLogger<E> {
|
|
39
|
-
private readonly schema;
|
|
40
|
-
private readonly primary;
|
|
41
|
-
private readonly relays;
|
|
42
|
-
private readonly now;
|
|
43
|
-
private readonly onSinkError;
|
|
44
|
-
private readonly listeners;
|
|
45
|
-
constructor(props: Props<E>);
|
|
46
|
-
emit(event: E): LeucoLoggerRecord<E> | Error;
|
|
47
|
-
subscribe(listener: Listener<E>): () => void;
|
|
48
|
-
getMaxSeq(): number;
|
|
49
|
-
close(): void;
|
|
50
|
-
private callPrimary;
|
|
51
|
-
private fanOutToRelays;
|
|
52
|
-
private callRelay;
|
|
53
|
-
private fanOutToListeners;
|
|
54
|
-
private callClose;
|
|
55
|
-
}
|
|
56
|
-
export {};
|
package/lib/bin.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import pkg from "../package.json" with { type: "json" }
|
|
3
|
-
import { startChannelServer } from "@/engine/mcp/channel-server"
|
|
4
|
-
import { toRequest } from "@/cli/router/to-request"
|
|
5
|
-
import { launchTui } from "@/tui/tui"
|
|
6
|
-
import { app } from "@/cli/routes"
|
|
7
|
-
import { Funnel } from "@/funnel"
|
|
8
|
-
|
|
9
|
-
process.title = "funnel"
|
|
10
|
-
|
|
11
|
-
const HELP = `funnel — Open Claude Funnel
|
|
12
|
-
|
|
13
|
-
usage: funnel [command]
|
|
14
|
-
|
|
15
|
-
commands:
|
|
16
|
-
(none) launch TUI
|
|
17
|
-
claude launch Claude Code (default profile or --profile)
|
|
18
|
-
channels manage subscription boxes (and their nested connectors)
|
|
19
|
-
profiles manage launch profiles
|
|
20
|
-
gateway manage the gateway daemon (HTTP + WS)
|
|
21
|
-
status show overall connection status
|
|
22
|
-
update update funnel to the latest version
|
|
23
|
-
mcp run as an MCP server (invoked from .mcp.json)
|
|
24
|
-
|
|
25
|
-
options:
|
|
26
|
-
--help, -h show help
|
|
27
|
-
--version, -v show version
|
|
28
|
-
|
|
29
|
-
more: funnel <command> --help`
|
|
30
|
-
|
|
31
|
-
const args = process.argv.slice(2)
|
|
32
|
-
|
|
33
|
-
if (args.length === 0) {
|
|
34
|
-
await launchTui(new Funnel())
|
|
35
|
-
process.exit(0)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (args[0] === "--version" || args[0] === "-v") {
|
|
39
|
-
process.stdout.write(`${pkg.version}\n`)
|
|
40
|
-
process.exit(0)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (args[0] === "mcp") {
|
|
44
|
-
await startChannelServer()
|
|
45
|
-
} else {
|
|
46
|
-
const { method, url } = toRequest(args)
|
|
47
|
-
const parsed = new URL(url)
|
|
48
|
-
const wantsHelp = parsed.searchParams.has("help")
|
|
49
|
-
|
|
50
|
-
if (wantsHelp && parsed.pathname === "/") {
|
|
51
|
-
process.stdout.write(`${HELP}\n`)
|
|
52
|
-
process.exit(0)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const res = await app.request(url, { method })
|
|
56
|
-
|
|
57
|
-
if (res.ok) {
|
|
58
|
-
const body = await res.text()
|
|
59
|
-
if (body) process.stdout.write(`${body}\n`)
|
|
60
|
-
process.exit(0)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (wantsHelp) {
|
|
64
|
-
const segments = parsed.pathname.split("/").filter(Boolean)
|
|
65
|
-
const group = segments[0]
|
|
66
|
-
const fallback = group
|
|
67
|
-
? await app.request(`http://localhost/${group}?help=true`, { method: "GET" })
|
|
68
|
-
: null
|
|
69
|
-
|
|
70
|
-
const text = fallback?.ok ? await fallback.text() : HELP
|
|
71
|
-
process.stdout.write(`${text}\n`)
|
|
72
|
-
process.exit(0)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const text = await res.text()
|
|
76
|
-
if (text) process.stderr.write(`${text}\n`)
|
|
77
|
-
process.exit(1)
|
|
78
|
-
}
|
package/lib/cli/factory.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const BUILTIN_SKIP = new Set(["help"])
|
|
2
|
-
|
|
3
|
-
export const queryToCliArgs = (url: string, reservedKeys: string[] = []): string[] => {
|
|
4
|
-
const skipped = new Set([...BUILTIN_SKIP, ...reservedKeys])
|
|
5
|
-
const args: string[] = []
|
|
6
|
-
const searchParams = new URL(url).searchParams
|
|
7
|
-
|
|
8
|
-
for (const entry of searchParams.entries()) {
|
|
9
|
-
const key = entry[0]
|
|
10
|
-
const value = entry[1]
|
|
11
|
-
|
|
12
|
-
if (skipped.has(key)) continue
|
|
13
|
-
|
|
14
|
-
args.push(`--${key}`)
|
|
15
|
-
|
|
16
|
-
if (value !== "true") args.push(value)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return args
|
|
20
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const SHORT_FLAGS: Record<string, string> = {
|
|
2
|
-
h: "help",
|
|
3
|
-
n: "name",
|
|
4
|
-
p: "profile",
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// All CLI verbs map to POST and stay in the URL (no method-stripping).
|
|
8
|
-
// Hono routes disambiguate by URL segment (e.g. /channels/add/:channel vs /channels/remove/:channel).
|
|
9
|
-
const METHOD_KEYWORDS = new Set([
|
|
10
|
-
"add",
|
|
11
|
-
"set",
|
|
12
|
-
"remove",
|
|
13
|
-
"rename",
|
|
14
|
-
"as-default",
|
|
15
|
-
"request",
|
|
16
|
-
])
|
|
17
|
-
|
|
18
|
-
const API_CALL_METHODS = new Set(["get", "post", "put", "patch", "delete", "head", "options"])
|
|
19
|
-
|
|
20
|
-
const isValue = (arg: string | undefined): arg is string => {
|
|
21
|
-
return typeof arg === "string" && !arg.startsWith("-")
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const consumeApiCall = (args: string[], i: number, params: URLSearchParams): number => {
|
|
25
|
-
const nextPath = args[i + 1]
|
|
26
|
-
|
|
27
|
-
if (!isValue(nextPath)) return 1
|
|
28
|
-
|
|
29
|
-
params.set("path", nextPath)
|
|
30
|
-
|
|
31
|
-
const nextBody = args[i + 2]
|
|
32
|
-
|
|
33
|
-
if (!isValue(nextBody)) return 2
|
|
34
|
-
|
|
35
|
-
params.set("body", nextBody)
|
|
36
|
-
|
|
37
|
-
return 3
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const toRequest = (args: string[]) => {
|
|
41
|
-
const segments: string[] = []
|
|
42
|
-
const params = new URLSearchParams()
|
|
43
|
-
let method = "GET"
|
|
44
|
-
|
|
45
|
-
let i = 0
|
|
46
|
-
while (i < args.length) {
|
|
47
|
-
const arg = args[i]!
|
|
48
|
-
|
|
49
|
-
if (arg.startsWith("--")) {
|
|
50
|
-
const key = arg.slice(2)
|
|
51
|
-
const next = args[i + 1]
|
|
52
|
-
|
|
53
|
-
if (isValue(next)) {
|
|
54
|
-
params.set(key, next)
|
|
55
|
-
i += 2
|
|
56
|
-
} else {
|
|
57
|
-
params.set(key, "true")
|
|
58
|
-
i++
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
continue
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (arg.startsWith("-") && arg.length === 2) {
|
|
65
|
-
const long = SHORT_FLAGS[arg[1]!]
|
|
66
|
-
|
|
67
|
-
if (!long) {
|
|
68
|
-
i++
|
|
69
|
-
continue
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const next = args[i + 1]
|
|
73
|
-
|
|
74
|
-
if (isValue(next)) {
|
|
75
|
-
params.set(long, next)
|
|
76
|
-
i += 2
|
|
77
|
-
} else {
|
|
78
|
-
params.set(long, "true")
|
|
79
|
-
i++
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
continue
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (METHOD_KEYWORDS.has(arg)) {
|
|
86
|
-
method = "POST"
|
|
87
|
-
segments.push(arg)
|
|
88
|
-
i++
|
|
89
|
-
continue
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (API_CALL_METHODS.has(arg) && !params.has("path")) {
|
|
93
|
-
segments.push(arg)
|
|
94
|
-
i += consumeApiCall(args, i, params)
|
|
95
|
-
continue
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (arg.includes("/") && !params.has("path")) {
|
|
99
|
-
params.set("path", arg)
|
|
100
|
-
i++
|
|
101
|
-
continue
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
segments.push(arg)
|
|
105
|
-
i++
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const path = segments.length > 0 ? `/${segments.join("/")}` : "/"
|
|
109
|
-
const query = params.size > 0 ? `?${params}` : ""
|
|
110
|
-
|
|
111
|
-
return { method, path, url: `http://localhost${path}${query}` }
|
|
112
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { zValidator as zv } from "@hono/zod-validator"
|
|
2
|
-
import { HTTPException } from "hono/http-exception"
|
|
3
|
-
import type { ZodType } from "zod"
|
|
4
|
-
|
|
5
|
-
export const zValidator = <Target extends "param" | "query" | "json", T extends ZodType>(
|
|
6
|
-
target: Target,
|
|
7
|
-
schema: T,
|
|
8
|
-
helpText?: string,
|
|
9
|
-
) =>
|
|
10
|
-
zv(target, schema, (result, c) => {
|
|
11
|
-
if (helpText && c.req.query("help")) {
|
|
12
|
-
return c.text(helpText)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (result.success) return
|
|
16
|
-
|
|
17
|
-
const issue = result.error.issues[0]
|
|
18
|
-
|
|
19
|
-
if (!issue) {
|
|
20
|
-
throw new HTTPException(400, { message: "invalid request" })
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const path = issue.path.join(".")
|
|
24
|
-
const message = path ? `${path}: ${issue.message}` : issue.message
|
|
25
|
-
|
|
26
|
-
throw new HTTPException(400, { message })
|
|
27
|
-
})
|