@interactive-inc/claude-funnel 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bin.js +302 -302
- package/dist/gateway/daemon.js +165 -165
- package/dist/index.d.ts +10 -1
- package/dist/index.js +16 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1492,6 +1492,15 @@ declare const funnelJsonSchema: () => Record<string, unknown>;
|
|
|
1492
1492
|
* spawned with the env set resolves the override.
|
|
1493
1493
|
*/
|
|
1494
1494
|
declare function resolveFunnelDir(): string;
|
|
1495
|
+
declare const DEFAULT_GATEWAY_PORT = 9742;
|
|
1496
|
+
/**
|
|
1497
|
+
* Resolves the gateway port. Defaults to 9742 — the port a programmatically
|
|
1498
|
+
* hosted gateway (`new Funnel().gatewayServer()`) uses. The `funnel` CLI entry
|
|
1499
|
+
* sets `FUNNEL_PORT` to a distinct default so a CLI launch never collides with
|
|
1500
|
+
* an embedding app's gateway on 9742. Read at call time so a daemon spawned
|
|
1501
|
+
* with the env set resolves the override.
|
|
1502
|
+
*/
|
|
1503
|
+
declare function resolveFunnelPort(): number;
|
|
1495
1504
|
declare const FUNNEL_DIR: string;
|
|
1496
1505
|
declare const SETTINGS_PATH: string;
|
|
1497
1506
|
type Deps = {
|
|
@@ -4580,4 +4589,4 @@ ${string}`;
|
|
|
4580
4589
|
};
|
|
4581
4590
|
}, "/", "/update">;
|
|
4582
4591
|
//#endregion
|
|
4583
|
-
export { AliveStub, AttachOptions, BroadcastEvent, BroadcastSubscriber, CONNECTOR_CONNECTION_STATUSES, ChannelConfig, ChannelConnectorView, ChannelDeliveryMode, ChannelServerOptions, ChannelSpec, ConnectorConfig, ConnectorConnectionEvent, ConnectorConnectionQuery, ConnectorConnectionRecord, ConnectorConnectionStatus, ConnectorDiagnosticLog, ConnectorDiagnosticSqlReader, ConnectorProcessedEvent, ConnectorProcessedQuery, ConnectorProcessedRecord, ConnectorQuery, ConnectorRawEvent, ConnectorRawQuery, ConnectorRawRecord, ConnectorSpec, ConnectorSyncOutcome, ConnectorType, DEFAULT_GATEWAY_TOKEN_PATH, DetachOptions, DiscordConnectorConfig, Env, FUNNEL_DIR, FUNNEL_MCP_COMMAND, FUNNEL_MCP_NAME, FileStat, Funnel, FunnelBroadcaster, FunnelChannelPublisher, FunnelChannels, FunnelClaude, FunnelClock, FunnelConnectorFactory, FunnelConnectorListener, FunnelEvent, FunnelEventLog, FunnelEventRecord, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLocalConfigWriter, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, type GatewayEmitInput, type GatewayRouteDeps, type Env$1 as GatewayServerEnv, GhConnectorConfig, LOCAL_CONFIG_FILENAME, LaunchOptions, ListListenersResult, ListenerEntry, ListenerOpResult, LocalConfig, LocalConfigSyncResult, LogEntry, MemoryConnectorDiagnosticLog, MemoryFunnelClock, MemoryFunnelEventLog, MemoryFunnelFileSystem, MemoryFunnelIdGenerator, MemoryFunnelLogger, MemoryFunnelProcessRunner, MemoryFunnelTokenPrompter, MemoryProcessCall, MemoryProcessHandler, MemoryProcessResponse, MemoryProcessSyncHandler, MockFunnelSettingsReader, NodeFunnelClock, NodeFunnelFileSystem, NodeFunnelIdGenerator, NodeFunnelLogger, NodeFunnelProcessRunner, NodeFunnelTokenPrompter, NoopFunnelLogger, NotifyFn, OnFunnelError, ProcessListStub, ProcessSnapshot, ProfileConfig, ProfileSpec, PublishRequest, PublishResponse, PublishResult, ReplayableEvent, RunOptions, RunResult, SETTINGS_PATH, SETTINGS_VERSION, ScheduleCatchupPolicy, ScheduleConnectorConfig, ScheduleEntry, ScheduleListenerOptions, Settings, SlackConnectorConfig, SlackListenerOptions, SlackProcessed, SlackProcessedEmit, SlackProcessedSkip, SlackRawEvent, SlackSkipReason, SqliteConnectorDiagnosticLog, SqliteFunnelEventLog, StoredConnectionEvent, StoredProcessedEvent, StoredRawEvent, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorConnectionEventSchema, connectorProcessedEventSchema, connectorRawEventSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, localConfigSchema, profileConfigSchema, profileSpecSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, resolveFunnelDir, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };
|
|
4592
|
+
export { AliveStub, AttachOptions, BroadcastEvent, BroadcastSubscriber, CONNECTOR_CONNECTION_STATUSES, ChannelConfig, ChannelConnectorView, ChannelDeliveryMode, ChannelServerOptions, ChannelSpec, ConnectorConfig, ConnectorConnectionEvent, ConnectorConnectionQuery, ConnectorConnectionRecord, ConnectorConnectionStatus, ConnectorDiagnosticLog, ConnectorDiagnosticSqlReader, ConnectorProcessedEvent, ConnectorProcessedQuery, ConnectorProcessedRecord, ConnectorQuery, ConnectorRawEvent, ConnectorRawQuery, ConnectorRawRecord, ConnectorSpec, ConnectorSyncOutcome, ConnectorType, DEFAULT_GATEWAY_PORT, DEFAULT_GATEWAY_TOKEN_PATH, DetachOptions, DiscordConnectorConfig, Env, FUNNEL_DIR, FUNNEL_MCP_COMMAND, FUNNEL_MCP_NAME, FileStat, Funnel, FunnelBroadcaster, FunnelChannelPublisher, FunnelChannels, FunnelClaude, FunnelClock, FunnelConnectorFactory, FunnelConnectorListener, FunnelEvent, FunnelEventLog, FunnelEventRecord, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLocalConfigWriter, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, type GatewayEmitInput, type GatewayRouteDeps, type Env$1 as GatewayServerEnv, GhConnectorConfig, LOCAL_CONFIG_FILENAME, LaunchOptions, ListListenersResult, ListenerEntry, ListenerOpResult, LocalConfig, LocalConfigSyncResult, LogEntry, MemoryConnectorDiagnosticLog, MemoryFunnelClock, MemoryFunnelEventLog, MemoryFunnelFileSystem, MemoryFunnelIdGenerator, MemoryFunnelLogger, MemoryFunnelProcessRunner, MemoryFunnelTokenPrompter, MemoryProcessCall, MemoryProcessHandler, MemoryProcessResponse, MemoryProcessSyncHandler, MockFunnelSettingsReader, NodeFunnelClock, NodeFunnelFileSystem, NodeFunnelIdGenerator, NodeFunnelLogger, NodeFunnelProcessRunner, NodeFunnelTokenPrompter, NoopFunnelLogger, NotifyFn, OnFunnelError, ProcessListStub, ProcessSnapshot, ProfileConfig, ProfileSpec, PublishRequest, PublishResponse, PublishResult, ReplayableEvent, RunOptions, RunResult, SETTINGS_PATH, SETTINGS_VERSION, ScheduleCatchupPolicy, ScheduleConnectorConfig, ScheduleEntry, ScheduleListenerOptions, Settings, SlackConnectorConfig, SlackListenerOptions, SlackProcessed, SlackProcessedEmit, SlackProcessedSkip, SlackRawEvent, SlackSkipReason, SqliteConnectorDiagnosticLog, SqliteFunnelEventLog, StoredConnectionEvent, StoredProcessedEvent, StoredRawEvent, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorConnectionEventSchema, connectorProcessedEventSchema, connectorRawEventSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, localConfigSchema, profileConfigSchema, profileSpecSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, resolveFunnelDir, resolveFunnelPort, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };
|
package/dist/index.js
CHANGED
|
@@ -112,6 +112,17 @@ function resolveFunnelDir() {
|
|
|
112
112
|
if (override && override.length > 0) return override;
|
|
113
113
|
return join(homedir(), ".funnel");
|
|
114
114
|
}
|
|
115
|
+
const DEFAULT_GATEWAY_PORT = 9742;
|
|
116
|
+
/**
|
|
117
|
+
* Resolves the gateway port. Defaults to 9742 — the port a programmatically
|
|
118
|
+
* hosted gateway (`new Funnel().gatewayServer()`) uses. The `funnel` CLI entry
|
|
119
|
+
* sets `FUNNEL_PORT` to a distinct default so a CLI launch never collides with
|
|
120
|
+
* an embedding app's gateway on 9742. Read at call time so a daemon spawned
|
|
121
|
+
* with the env set resolves the override.
|
|
122
|
+
*/
|
|
123
|
+
function resolveFunnelPort() {
|
|
124
|
+
return Number(process.env.FUNNEL_PORT) || 9742;
|
|
125
|
+
}
|
|
115
126
|
const FUNNEL_DIR = join(homedir(), ".funnel");
|
|
116
127
|
const SETTINGS_PATH = join(FUNNEL_DIR, "settings.json");
|
|
117
128
|
const defaultFs$5 = new NodeFunnelFileSystem();
|
|
@@ -1802,7 +1813,6 @@ const resolveDaemonScript = () => {
|
|
|
1802
1813
|
};
|
|
1803
1814
|
//#endregion
|
|
1804
1815
|
//#region lib/gateway/gateway.ts
|
|
1805
|
-
const DEFAULT_PORT$1 = 9742;
|
|
1806
1816
|
const STARTUP_TIMEOUT_MS = 5e3;
|
|
1807
1817
|
const SIGTERM_TIMEOUT_MS = 2e3;
|
|
1808
1818
|
const POLL_INTERVAL_MS = 100;
|
|
@@ -1836,7 +1846,7 @@ var FunnelGateway = class {
|
|
|
1836
1846
|
this.tmpDir = deps.tmpDir ?? funnelTmpDir();
|
|
1837
1847
|
this.pidFile = join(this.dir, "gateway.pid");
|
|
1838
1848
|
this.gatewayLog = join(this.tmpDir, "gateway.log");
|
|
1839
|
-
this.port = deps.port ??
|
|
1849
|
+
this.port = deps.port ?? resolveFunnelPort();
|
|
1840
1850
|
this.sleep = deps.sleep ?? defaultSleep$1;
|
|
1841
1851
|
Object.freeze(this);
|
|
1842
1852
|
}
|
|
@@ -3044,7 +3054,6 @@ const statusHandler$1 = factory$1.createHandlers((c) => {
|
|
|
3044
3054
|
const gatewayRoutes = factory$1.createApp().get("/health", ...healthHandler).get("/status", ...statusHandler$1).get("/listeners", ...listenersListHandler).post("/listeners/:channel/:connector/start", ...listenersStartHandler).delete("/listeners/:channel/:connector", ...listenersStopHandler).post("/listeners/:channel/:connector/restart", ...listenersRestartHandler).post("/channels/:channel/connectors/:connector/call", ...channelsConnectorsCallHandler).post("/channels/:channel/publish", ...channelsPublishHandler$1);
|
|
3045
3055
|
//#endregion
|
|
3046
3056
|
//#region lib/gateway/gateway-server.ts
|
|
3047
|
-
const DEFAULT_PORT = 9742;
|
|
3048
3057
|
const DEFAULT_HOST = "127.0.0.1";
|
|
3049
3058
|
const LOOPBACK_HOSTS = new Set([
|
|
3050
3059
|
"127.0.0.1",
|
|
@@ -3087,7 +3096,7 @@ var FunnelGatewayServer = class {
|
|
|
3087
3096
|
constructor(deps) {
|
|
3088
3097
|
this.channels = deps.channels;
|
|
3089
3098
|
this.settings = deps.settings;
|
|
3090
|
-
this.port = deps.port ??
|
|
3099
|
+
this.port = deps.port ?? resolveFunnelPort();
|
|
3091
3100
|
this.hostname = deps.hostname ?? DEFAULT_HOST;
|
|
3092
3101
|
this.dbPath = deps.dbPath ?? defaultDbPath();
|
|
3093
3102
|
this.process = deps.process;
|
|
@@ -3857,10 +3866,9 @@ const usageHintForType = (type) => {
|
|
|
3857
3866
|
//#endregion
|
|
3858
3867
|
//#region lib/engine/mcp/channel-server.ts
|
|
3859
3868
|
const DEFAULT_FUNNEL_DIR = join(homedir(), ".funnel");
|
|
3860
|
-
const DEFAULT_GATEWAY_BASE_URL = "http://localhost:9742";
|
|
3861
3869
|
const startChannelServer = async (options = {}) => {
|
|
3862
3870
|
const dir = options.dir ?? DEFAULT_FUNNEL_DIR;
|
|
3863
|
-
const gatewayBaseUrl = options.gatewayUrl ?? process.env.FUNNEL_GATEWAY_URL ??
|
|
3871
|
+
const gatewayBaseUrl = options.gatewayUrl ?? process.env.FUNNEL_GATEWAY_URL ?? `http://localhost:${resolveFunnelPort()}`;
|
|
3864
3872
|
const gatewayWsUrl = `${gatewayBaseUrl.replace(/^http/, "ws")}/ws`;
|
|
3865
3873
|
const channelId = options.channelId ?? process.env.FUNNEL_CHANNEL_ID;
|
|
3866
3874
|
const channel = channelId ? readChannelConnectors(dir, channelId) : null;
|
|
@@ -5387,7 +5395,7 @@ Spawned as a detached background process so it keeps running after the terminal
|
|
|
5387
5395
|
On macOS wraps the process with caffeinate -is by default to prevent idle and system sleep.
|
|
5388
5396
|
Use --no-caffeine to disable caffeinate.
|
|
5389
5397
|
|
|
5390
|
-
port:
|
|
5398
|
+
port: 9743 (CLI default; override via FUNNEL_PORT)
|
|
5391
5399
|
pid: ~/.funnel/gateway.pid
|
|
5392
5400
|
log: ${join(funnelTmpDir(), "gateway.log")}
|
|
5393
5401
|
|
|
@@ -5747,4 +5755,4 @@ const createCliApp = (funnel) => {
|
|
|
5747
5755
|
/** CLI Hono app wired to a default `new Funnel()`. For embedding with a custom Funnel use `createCliApp`. */
|
|
5748
5756
|
const app = createCliApp(new Funnel());
|
|
5749
5757
|
//#endregion
|
|
5750
|
-
export { CONNECTOR_CONNECTION_STATUSES, ConnectorDiagnosticLog, ConnectorDiagnosticSqlReader, DEFAULT_GATEWAY_TOKEN_PATH, FUNNEL_DIR, FUNNEL_MCP_COMMAND, FUNNEL_MCP_NAME, Funnel, FunnelBroadcaster, FunnelChannelPublisher, FunnelChannels, FunnelClaude, FunnelClock, FunnelConnectorFactory, FunnelConnectorListener, FunnelEventLog, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLocalConfigWriter, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, LOCAL_CONFIG_FILENAME, MemoryConnectorDiagnosticLog, MemoryFunnelClock, MemoryFunnelEventLog, MemoryFunnelFileSystem, MemoryFunnelIdGenerator, MemoryFunnelLogger, MemoryFunnelProcessRunner, MemoryFunnelTokenPrompter, MockFunnelSettingsReader, NodeFunnelClock, NodeFunnelFileSystem, NodeFunnelIdGenerator, NodeFunnelLogger, NodeFunnelProcessRunner, NodeFunnelTokenPrompter, NoopFunnelLogger, SETTINGS_PATH, SETTINGS_VERSION, SqliteConnectorDiagnosticLog, SqliteFunnelEventLog, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorConnectionEventSchema, connectorProcessedEventSchema, connectorRawEventSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, localConfigSchema, profileConfigSchema, profileSpecSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, resolveFunnelDir, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };
|
|
5758
|
+
export { CONNECTOR_CONNECTION_STATUSES, ConnectorDiagnosticLog, ConnectorDiagnosticSqlReader, DEFAULT_GATEWAY_PORT, DEFAULT_GATEWAY_TOKEN_PATH, FUNNEL_DIR, FUNNEL_MCP_COMMAND, FUNNEL_MCP_NAME, Funnel, FunnelBroadcaster, FunnelChannelPublisher, FunnelChannels, FunnelClaude, FunnelClock, FunnelConnectorFactory, FunnelConnectorListener, FunnelEventLog, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLocalConfigWriter, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, LOCAL_CONFIG_FILENAME, MemoryConnectorDiagnosticLog, MemoryFunnelClock, MemoryFunnelEventLog, MemoryFunnelFileSystem, MemoryFunnelIdGenerator, MemoryFunnelLogger, MemoryFunnelProcessRunner, MemoryFunnelTokenPrompter, MockFunnelSettingsReader, NodeFunnelClock, NodeFunnelFileSystem, NodeFunnelIdGenerator, NodeFunnelLogger, NodeFunnelProcessRunner, NodeFunnelTokenPrompter, NoopFunnelLogger, SETTINGS_PATH, SETTINGS_VERSION, SqliteConnectorDiagnosticLog, SqliteFunnelEventLog, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorConnectionEventSchema, connectorProcessedEventSchema, connectorRawEventSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, localConfigSchema, profileConfigSchema, profileSpecSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, resolveFunnelDir, resolveFunnelPort, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };
|
package/package.json
CHANGED