@interactive-inc/claude-funnel 0.51.0 → 0.53.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/dist/claude.d.ts CHANGED
@@ -1,28 +1,9 @@
1
- import { a as McpInstaller, i as ProcessGuard, n as LaunchOptions, o as GatewayController, r as SessionStore, s as ChannelResolver, t as FunnelClaude } from "./claude-CB1WkV77.js";
2
- import { r as FunnelProcessRunner } from "./process-runner-DfniuWVU.js";
1
+ import { a as ProcessGuard, c as ChannelResolver, i as SessionStore, n as FunnelClaude, o as McpInstaller, r as LaunchOptions, s as GatewayController, t as FileProcessGuard } from "./file-process-guard-DMeLB6Zd.js";
3
2
  import { n as FunnelFileSystem } from "./file-system-BeOKXjlV.js";
4
3
  import { t as FunnelProfiles } from "./profiles-f0mNmEyP.js";
5
- import { C as profileSpecSchema, S as localConfigSchema, _ as LOCAL_CONFIG_FILENAME, b as channelSpecSchema, g as ConnectorSpec, h as ChannelSpec, i as FunnelTokenPrompter, m as FunnelLocalConfig, n as FunnelLocalConfigSync, r as LocalConfigSyncResult, t as ConnectorSyncOutcome, v as LocalConfig, x as connectorSpecSchema, y as ProfileSpec } from "./local-config-sync-BdsrDZOu.js";
6
- import { i as funnelJsonSchema, n as NodeFunnelTokenPrompter, r as FunnelLocalConfigWriter, t as MemoryFunnelTokenPrompter } from "./memory-token-prompter-B5FFCsGP.js";
4
+ import { C as profileSpecSchema, S as localConfigSchema, _ as LOCAL_CONFIG_FILENAME, b as channelSpecSchema, g as ConnectorSpec, h as ChannelSpec, i as FunnelTokenPrompter, m as FunnelLocalConfig, n as FunnelLocalConfigSync, r as LocalConfigSyncResult, t as ConnectorSyncOutcome, v as LocalConfig, x as connectorSpecSchema, y as ProfileSpec } from "./local-config-sync-Cq39mT6p.js";
5
+ import { i as funnelJsonSchema, n as NodeFunnelTokenPrompter, r as FunnelLocalConfigWriter, t as MemoryFunnelTokenPrompter } from "./memory-token-prompter-CKV7VBM5.js";
7
6
 
8
- //#region lib/engine/claude/file-process-guard.d.ts
9
- type Deps$1 = {
10
- fs?: FunnelFileSystem;
11
- process?: FunnelProcessRunner;
12
- dir?: string;
13
- };
14
- declare class FileProcessGuard implements ProcessGuard {
15
- private readonly fs;
16
- private readonly process;
17
- private readonly pidDir;
18
- constructor(deps?: Deps$1);
19
- isRunning(profileId: string): boolean;
20
- acquire(profileId: string): void;
21
- release(profileId: string): void;
22
- private pidPath;
23
- private readPid;
24
- }
25
- //#endregion
26
7
  //#region lib/engine/mcp/mcp.d.ts
27
8
  declare const FUNNEL_MCP_COMMAND = "bun";
28
9
  declare const FUNNEL_MCP_ARGS: string[];
package/dist/claude.js CHANGED
@@ -1,8 +1,8 @@
1
- import { d as settingsSchema, o as resolveFunnelPort } from "./settings-store-D2XSXTyt.js";
2
- import { a as FileProcessGuard, i as FunnelMcp, n as FUNNEL_MCP_COMMAND, o as FunnelClaude, r as FUNNEL_MCP_NAME, t as FUNNEL_MCP_ARGS } from "./mcp-Dr-nIBwN.js";
3
- import { a as FunnelLocalConfig, c as connectorSpecSchema, i as FunnelTokenPrompter, l as localConfigSchema, n as NodeFunnelTokenPrompter, o as LOCAL_CONFIG_FILENAME, r as FunnelLocalConfigSync, s as channelSpecSchema, t as funnelJsonSchema, u as profileSpecSchema } from "./local-config-json-schema-8IHjS4Q7.js";
1
+ import { f as settingsSchema, s as resolveFunnelPort, t as gatewayLoopbackUrl } from "./gateway-base-url-ssk_He5G.js";
2
+ import { a as FileProcessGuard, i as FunnelMcp, n as FUNNEL_MCP_COMMAND, o as FunnelClaude, r as FUNNEL_MCP_NAME, t as FUNNEL_MCP_ARGS } from "./mcp-QeNCBhOD.js";
3
+ import { a as FunnelLocalConfig, c as connectorSpecSchema, i as FunnelTokenPrompter, l as localConfigSchema, n as NodeFunnelTokenPrompter, o as LOCAL_CONFIG_FILENAME, r as FunnelLocalConfigSync, s as channelSpecSchema, t as funnelJsonSchema, u as profileSpecSchema } from "./local-config-json-schema-D8i-BogY.js";
4
4
  import { t as FunnelProfiles } from "./profiles-wMRnjSid.js";
5
- import { n as FunnelLocalConfigWriter, t as MemoryFunnelTokenPrompter } from "./memory-token-prompter-CLerGsgM.js";
5
+ import { n as FunnelLocalConfigWriter, t as MemoryFunnelTokenPrompter } from "./memory-token-prompter-Q7Snwsv2.js";
6
6
  import { join } from "node:path";
7
7
  import { existsSync, readFileSync } from "node:fs";
8
8
  import { homedir } from "node:os";
@@ -140,7 +140,7 @@ const readAllChannels = (dir) => {
140
140
  };
141
141
  const startChannelServer = async (options = {}) => {
142
142
  const dir = options.dir ?? DEFAULT_FUNNEL_DIR;
143
- const gatewayBaseUrl = options.gatewayUrl ?? process.env.FUNNEL_GATEWAY_URL ?? `http://127.0.0.1:${resolveFunnelPort()}`;
143
+ const gatewayBaseUrl = options.gatewayUrl ?? process.env.FUNNEL_GATEWAY_URL ?? gatewayLoopbackUrl(resolveFunnelPort());
144
144
  const gatewayWsUrl = `${gatewayBaseUrl.replace(/^http/, "ws")}/ws`;
145
145
  const channelId = options.channelId ?? process.env.FUNNEL_CHANNEL_ID;
146
146
  const channel = channelId ? readChannelConnectors(dir, channelId) : null;
@@ -243,7 +243,7 @@ const startChannelServer = async (options = {}) => {
243
243
  const args = request.params.arguments ?? {};
244
244
  const method = typeof args.method === "string" ? args.method : "";
245
245
  const path = typeof args.path === "string" ? args.path : "";
246
- const body = args.body ?? {};
246
+ const body = args.body;
247
247
  if (!method || !path) throw new Error("`method` and `path` are required");
248
248
  const url = `${gatewayBaseUrl}/channels/${encodeURIComponent(channel.channelName)}/connectors/${encodeURIComponent(toolName)}/call`;
249
249
  const headers = { "content-type": "application/json" };
@@ -0,0 +1,25 @@
1
+ //#region lib/connectors/connector-adapter.d.ts
2
+ /**
3
+ * A JSON-serializable value. Connector call bodies are sent to external APIs as
4
+ * JSON, so the body must be representable as JSON — `JsonValue` says exactly
5
+ * that, replacing a bare `unknown` that let non-serializable values (functions,
6
+ * symbols, class instances) slip through to `JSON.stringify`.
7
+ */
8
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
9
+ [key: string]: JsonValue;
10
+ };
11
+ type CallInput = {
12
+ method: string;
13
+ path: string; /** JSON request body. Omit for GET-like calls. */
14
+ body?: JsonValue;
15
+ };
16
+ declare abstract class FunnelConnectorAdapter {
17
+ /**
18
+ * Dispatches one Claude → external call. The response is the external API's
19
+ * raw payload, typed `unknown` because its shape is the provider's concern —
20
+ * the caller (Claude, via MCP) interprets it.
21
+ */
22
+ abstract call(input: CallInput): Promise<unknown>;
23
+ }
24
+ //#endregion
25
+ export { FunnelConnectorAdapter as n, CallInput as t };
@@ -1,5 +1,5 @@
1
1
  import { S as FunnelLogger, b as FunnelConnectorListener, o as ConnectorDiagnosticLog, x as NotifyFn } from "../connector-diagnostic-log-yTOojKUR.js";
2
- import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-DKgsVuMH.js";
2
+ import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-CePYBTgW.js";
3
3
  import { n as discordConnectorSchema, t as DiscordConnectorConfig } from "../discord-connector-schema-R0Uu-3ns.js";
4
4
 
5
5
  //#region lib/engine/http/http-client.d.ts
@@ -1,6 +1,6 @@
1
1
  import { S as FunnelLogger, b as FunnelConnectorListener, o as ConnectorDiagnosticLog, x as NotifyFn } from "../connector-diagnostic-log-yTOojKUR.js";
2
2
  import { r as FunnelProcessRunner } from "../process-runner-DfniuWVU.js";
3
- import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-DKgsVuMH.js";
3
+ import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-CePYBTgW.js";
4
4
  import { n as ghConnectorSchema, t as GhConnectorConfig } from "../gh-connector-schema-eoTtHbY6.js";
5
5
 
6
6
  //#region lib/connectors/gh-adapter.d.ts
@@ -1,4 +1,4 @@
1
- import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-DKgsVuMH.js";
1
+ import { n as FunnelConnectorAdapter, t as CallInput } from "../connector-adapter-CePYBTgW.js";
2
2
  import { a as slackConnectorSchema, c as SlackProcessedEmit, d as SlackSkipReason, i as SlackConnectorConfig, l as SlackProcessedSkip, n as SlackOnAppCreated, o as FunnelSlackEventProcessor, r as SlackPreprocessEvent, s as SlackProcessed, t as FunnelSlackListener, u as SlackRawEvent } from "../slack-listener-Bv5xI9gC.js";
3
3
 
4
4
  //#region lib/connectors/slack-adapter.d.ts
@@ -1,6 +1,7 @@
1
1
  import { n as FunnelIdGenerator, r as ChannelConfig } from "./settings-reader-BSU6JyvM.js";
2
2
  import { S as FunnelLogger } from "./connector-diagnostic-log-yTOojKUR.js";
3
3
  import { r as FunnelProcessRunner } from "./process-runner-DfniuWVU.js";
4
+ import { n as FunnelFileSystem } from "./file-system-BeOKXjlV.js";
4
5
 
5
6
  //#region lib/engine/claude/channel-resolver.d.ts
6
7
  type ChannelResolver = {
@@ -37,21 +38,12 @@ type SessionStore = {
37
38
  };
38
39
  //#endregion
39
40
  //#region lib/engine/claude/claude.d.ts
40
- type LaunchOptions = {
41
+ type LaunchCommon = {
41
42
  channel: string;
42
43
  cwd?: string;
43
- userArgs?: string[];
44
- /** Stable id of the launching profile (uuid). Keys the singleton PID file and
45
- * the resumable session. Absent for a profile-less launch (raw `--channel`),
46
- * which never enforces singleton-ness and never resumes. */
47
- profileId?: string; /** Args prepended to the claude argv (typically a profile's recipe). Defaults to none. */
44
+ userArgs?: string[]; /** Args prepended to the claude argv (typically a profile's recipe). Defaults to none. */
48
45
  options?: string[]; /** Env vars layered under the launched claude process. process.env wins on collision. */
49
46
  env?: Record<string, string>;
50
- /** Whether to inject a `--session-id`/`--resume` for this profile.
51
- * Defaults to false: resuming is opt-in and only meaningful for a profile,
52
- * since the persisted session is owned by the profile (by id). A launch
53
- * without a profile always starts a fresh session regardless of this flag. */
54
- resume?: boolean;
55
47
  /** Invoked synchronously after the child claude process has been spawned, with its PID.
56
48
  * Useful for hosts that need to register the spawned process before it exits
57
49
  * (e.g. multi-session registries that track per-claude liveness). */
@@ -61,7 +53,31 @@ type LaunchOptions = {
61
53
  * does not need the funnel binary as an MCP endpoint. */
62
54
  installMcp?: boolean;
63
55
  };
64
- type Deps = {
56
+ /**
57
+ * A launch carries one of two targets, distinguished by `profileId`.
58
+ *
59
+ * - **profile launch** — has a stable `profileId` (uuid). Enforces singleton-ness
60
+ * via the PID file and may opt into `resume` to reuse the profile's session.
61
+ * - **profile-less launch** — raw `--channel`. Never enforces singleton-ness and
62
+ * always starts a fresh session, so `resume` is meaningless and disallowed.
63
+ *
64
+ * Modeling these as a union (rather than two independent optional fields) makes
65
+ * `resume` without a `profileId` a compile error — previously it was silently
66
+ * ignored, which masked real bugs (a profile resume that never took effect).
67
+ */
68
+ type LaunchTarget = {
69
+ /** Stable id of the launching profile (uuid). Keys the singleton PID file
70
+ * and the resumable session. */
71
+ profileId: string;
72
+ /** Inject `--session-id`/`--resume` for this profile (opt-in, default false).
73
+ * The persisted session is owned by the profile (by id). */
74
+ resume?: boolean;
75
+ } | {
76
+ profileId?: undefined;
77
+ resume?: undefined;
78
+ };
79
+ type LaunchOptions = LaunchCommon & LaunchTarget;
80
+ type Deps$1 = {
65
81
  channels: ChannelResolver;
66
82
  mcp: McpInstaller;
67
83
  gateway: GatewayController;
@@ -86,7 +102,7 @@ declare class FunnelClaude {
86
102
  private readonly process;
87
103
  private readonly idGenerator;
88
104
  private readonly logger;
89
- constructor(deps: Deps);
105
+ constructor(deps: Deps$1);
90
106
  launch(options: LaunchOptions): Promise<number>;
91
107
  private buildArgs;
92
108
  /**
@@ -112,4 +128,22 @@ declare class FunnelClaude {
112
128
  private buildEnv;
113
129
  }
114
130
  //#endregion
115
- export { McpInstaller as a, ProcessGuard as i, LaunchOptions as n, GatewayController as o, SessionStore as r, ChannelResolver as s, FunnelClaude as t };
131
+ //#region lib/engine/claude/file-process-guard.d.ts
132
+ type Deps = {
133
+ fs?: FunnelFileSystem;
134
+ process?: FunnelProcessRunner;
135
+ dir?: string;
136
+ };
137
+ declare class FileProcessGuard implements ProcessGuard {
138
+ private readonly fs;
139
+ private readonly process;
140
+ private readonly pidDir;
141
+ constructor(deps?: Deps);
142
+ isRunning(profileId: string): boolean;
143
+ acquire(profileId: string): void;
144
+ release(profileId: string): void;
145
+ private pidPath;
146
+ private readPid;
147
+ }
148
+ //#endregion
149
+ export { ProcessGuard as a, ChannelResolver as c, SessionStore as i, FunnelClaude as n, McpInstaller as o, LaunchOptions as r, GatewayController as s, FileProcessGuard as t };