@interactive-inc/claude-funnel 0.24.0 → 0.25.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/index.d.ts CHANGED
@@ -151,9 +151,6 @@ declare const channelConfigSchema: z.ZodObject<{
151
151
  fanout: "fanout";
152
152
  exclusive: "exclusive";
153
153
  }>>;
154
- options: z.ZodDefault<z.ZodArray<z.ZodString>>;
155
- env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
156
- resume: z.ZodDefault<z.ZodBoolean>;
157
154
  connectors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
158
155
  id: z.ZodString;
159
156
  name: z.ZodString;
@@ -201,6 +198,9 @@ declare const profileConfigSchema: z.ZodObject<{
201
198
  name: z.ZodString;
202
199
  path: z.ZodString;
203
200
  channelId: z.ZodString;
201
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
202
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
203
+ resume: z.ZodDefault<z.ZodBoolean>;
204
204
  }, z.core.$strip>;
205
205
  type ProfileConfig = z.infer<typeof profileConfigSchema>;
206
206
  declare const SETTINGS_VERSION = 1;
@@ -213,9 +213,6 @@ declare const settingsSchema: z.ZodObject<{
213
213
  fanout: "fanout";
214
214
  exclusive: "exclusive";
215
215
  }>>;
216
- options: z.ZodDefault<z.ZodArray<z.ZodString>>;
217
- env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
218
- resume: z.ZodDefault<z.ZodBoolean>;
219
216
  connectors: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
220
217
  id: z.ZodString;
221
218
  name: z.ZodString;
@@ -262,6 +259,9 @@ declare const settingsSchema: z.ZodObject<{
262
259
  name: z.ZodString;
263
260
  path: z.ZodString;
264
261
  channelId: z.ZodString;
262
+ options: z.ZodDefault<z.ZodArray<z.ZodString>>;
263
+ env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
264
+ resume: z.ZodDefault<z.ZodBoolean>;
265
265
  }, z.core.$strip>>>;
266
266
  }, z.core.$strip>;
267
267
  type Settings = z.infer<typeof settingsSchema>;
@@ -324,14 +324,8 @@ declare class FunnelChannels {
324
324
  add(input: {
325
325
  name: string;
326
326
  delivery?: ChannelDeliveryMode;
327
- options?: string[];
328
- env?: Record<string, string>;
329
- resume?: boolean;
330
327
  }): ChannelConfig;
331
328
  setDelivery(name: string, delivery: ChannelDeliveryMode): void;
332
- setResume(name: string, resume: boolean): void;
333
- setOptions(name: string, options: string[]): void;
334
- setEnv(name: string, env: Record<string, string>): void;
335
329
  remove(name: string): void;
336
330
  rename(oldName: string, newName: string): void;
337
331
  listConnectors(channelName: string): ConnectorConfig[];
@@ -447,7 +441,10 @@ type LaunchOptions = {
447
441
  channel: string;
448
442
  cwd?: string;
449
443
  userArgs?: string[];
450
- profileName?: string;
444
+ profileName?: string; /** Args prepended to the claude argv (typically a profile's recipe). Defaults to none. */
445
+ options?: string[]; /** Env vars layered under the launched claude process. process.env wins on collision. */
446
+ env?: Record<string, string>; /** Whether to inject a `--session-id`/`--resume` for the (channel, cwd). Defaults to true. */
447
+ resume?: boolean;
451
448
  /** Invoked synchronously after the child claude process has been spawned, with its PID.
452
449
  * Useful for hosts that need to register the spawned process before it exits
453
450
  * (e.g. multi-session registries that track per-claude liveness). */
@@ -497,8 +494,23 @@ declare class FunnelClaude {
497
494
  * a freshly minted one. Backs off when the user already passed a
498
495
  * session-shaping flag, since combining them would either confuse claude
499
496
  * or override the explicit user intent.
497
+ *
498
+ * A persisted id is only resumed when its session jsonl still exists on
499
+ * disk. claude errors out on `--resume <id>` for a missing conversation, and
500
+ * a persisted id can outlive its jsonl (claude pruned it, or the very first
501
+ * launch was aborted after `create` wrote the id but before the jsonl
502
+ * appeared). When the file is gone we mint a fresh session instead, which
503
+ * overwrites the dangling entry — so the store self-heals.
500
504
  */
501
505
  private resolveSession;
506
+ /**
507
+ * Mirrors claude's session storage path
508
+ * (`<config-dir>/projects/<cwd-with-slashes-as-dashes>/<id>.jsonl`) to check
509
+ * whether a recorded session still exists. Reads the same `CLAUDE_CONFIG_DIR`
510
+ * the child will run under so the check matches reality; a wrong guess can
511
+ * only ever produce a false negative (start fresh), never a bad resume.
512
+ */
513
+ private sessionFileExists;
502
514
  private buildEnv;
503
515
  }
504
516
  //#endregion
@@ -559,9 +571,6 @@ declare const connectorSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
559
571
  type ConnectorSpec = z.infer<typeof connectorSpecSchema>;
560
572
  declare const channelSpecSchema: z.ZodObject<{
561
573
  name: z.ZodString;
562
- options: z.ZodOptional<z.ZodArray<z.ZodString>>;
563
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
564
- resume: z.ZodOptional<z.ZodBoolean>;
565
574
  connectors: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
566
575
  type: z.ZodLiteral<"slack">;
567
576
  name: z.ZodString;
@@ -589,13 +598,18 @@ declare const channelSpecSchema: z.ZodObject<{
589
598
  }, z.core.$strip>], "type">>>;
590
599
  }, z.core.$strip>;
591
600
  type ChannelSpec = z.infer<typeof channelSpecSchema>;
601
+ declare const profileSpecSchema: z.ZodObject<{
602
+ name: z.ZodString;
603
+ channel: z.ZodString;
604
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
605
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
606
+ resume: z.ZodOptional<z.ZodBoolean>;
607
+ }, z.core.$strip>;
608
+ type ProfileSpec = z.infer<typeof profileSpecSchema>;
592
609
  declare const localConfigSchema: z.ZodObject<{
593
610
  $schema: z.ZodOptional<z.ZodString>;
594
611
  channels: z.ZodArray<z.ZodObject<{
595
612
  name: z.ZodString;
596
- options: z.ZodOptional<z.ZodArray<z.ZodString>>;
597
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
598
- resume: z.ZodOptional<z.ZodBoolean>;
599
613
  connectors: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
600
614
  type: z.ZodLiteral<"slack">;
601
615
  name: z.ZodString;
@@ -622,6 +636,13 @@ declare const localConfigSchema: z.ZodObject<{
622
636
  name: z.ZodString;
623
637
  }, z.core.$strip>], "type">>>;
624
638
  }, z.core.$strip>>;
639
+ profiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
640
+ name: z.ZodString;
641
+ channel: z.ZodString;
642
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
643
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
644
+ resume: z.ZodOptional<z.ZodBoolean>;
645
+ }, z.core.$strip>>>;
625
646
  }, z.core.$strip>;
626
647
  type LocalConfig = z.infer<typeof localConfigSchema>;
627
648
  declare const LOCAL_CONFIG_FILENAME = "funnel.json";
@@ -714,9 +735,10 @@ type Deps$8 = {
714
735
  };
715
736
  /**
716
737
  * Named launch presets for `fnl claude`. Each profile bundles a working
717
- * directory, a sub-agent name, and the channel id its Claude instance will
718
- * subscribe to. Implements ProfileChannelChecker so FunnelChannels can refuse
719
- * to remove a channel that is still referenced.
738
+ * directory, the channel id its Claude instance subscribes to, and the launch
739
+ * recipe (`options` prepended to the claude argv, `env` layered under the
740
+ * process, `resume` toggling session reuse). Implements ProfileChannelChecker
741
+ * so FunnelChannels can refuse to remove a channel that is still referenced.
720
742
  *
721
743
  * The first entry in the persisted array is treated as the default profile;
722
744
  * `asDefault` reorders the array to put a named profile first.
@@ -730,7 +752,14 @@ declare class FunnelProfiles {
730
752
  list(): ProfileConfig[];
731
753
  get(name: string): ProfileConfig | null;
732
754
  getDefault(): ProfileConfig | null;
733
- add(config: ProfileConfig): void;
755
+ add(input: {
756
+ name: string;
757
+ path: string;
758
+ channelId: string;
759
+ options?: string[];
760
+ env?: Record<string, string>;
761
+ resume?: boolean;
762
+ }): void;
734
763
  remove(name: string): void;
735
764
  rename(oldName: string, newName: string): void;
736
765
  asDefault(name: string): void;
@@ -1480,8 +1509,8 @@ declare const startChannelServer: (options?: ChannelServerOptions) => Promise<vo
1480
1509
  /**
1481
1510
  * Generates the JSON Schema (draft 2020-12) for `funnel.json`. Useful for
1482
1511
  * `$schema` references in committed `funnel.json` files so editors can give
1483
- * autocomplete and validation for channel / subAgent / env / connectors[]
1484
- * without anyone hand-maintaining a separate schema.
1512
+ * autocomplete and validation for channels[] (transport) and profiles[]
1513
+ * (launch recipe) without anyone hand-maintaining a separate schema.
1485
1514
  */
1486
1515
  declare const funnelJsonSchema: () => Record<string, unknown>;
1487
1516
  //#endregion
@@ -2537,6 +2566,11 @@ declare const createCliApp: (funnel: Funnel) => _$hono_hono_base0.HonoBase<Env,
2537
2566
  query: {
2538
2567
  path: string;
2539
2568
  channel: string;
2569
+ agent?: string | undefined;
2570
+ options?: string | undefined;
2571
+ env?: string | undefined;
2572
+ resume?: string | undefined;
2573
+ "no-resume"?: string | undefined;
2540
2574
  };
2541
2575
  };
2542
2576
  output: string;
@@ -2551,6 +2585,11 @@ declare const createCliApp: (funnel: Funnel) => _$hono_hono_base0.HonoBase<Env,
2551
2585
  query: {
2552
2586
  path: string;
2553
2587
  channel: string;
2588
+ agent?: string | undefined;
2589
+ options?: string | undefined;
2590
+ env?: string | undefined;
2591
+ resume?: string | undefined;
2592
+ "no-resume"?: string | undefined;
2554
2593
  };
2555
2594
  };
2556
2595
  output: `added profile "${string}"`;
@@ -2578,6 +2617,11 @@ declare const createCliApp: (funnel: Funnel) => _$hono_hono_base0.HonoBase<Env,
2578
2617
  query: {
2579
2618
  path?: string | undefined;
2580
2619
  channel?: string | undefined;
2620
+ agent?: string | undefined;
2621
+ options?: string | undefined;
2622
+ env?: string | undefined;
2623
+ resume?: string | undefined;
2624
+ "no-resume"?: string | undefined;
2581
2625
  };
2582
2626
  };
2583
2627
  output: string;
@@ -2592,6 +2636,11 @@ declare const createCliApp: (funnel: Funnel) => _$hono_hono_base0.HonoBase<Env,
2592
2636
  query: {
2593
2637
  path?: string | undefined;
2594
2638
  channel?: string | undefined;
2639
+ agent?: string | undefined;
2640
+ options?: string | undefined;
2641
+ env?: string | undefined;
2642
+ resume?: string | undefined;
2643
+ "no-resume"?: string | undefined;
2595
2644
  };
2596
2645
  };
2597
2646
  output: `updated profile "${string}"`;
@@ -3818,6 +3867,11 @@ declare const app: _$hono_hono_base0.HonoBase<Env, {
3818
3867
  query: {
3819
3868
  path: string;
3820
3869
  channel: string;
3870
+ agent?: string | undefined;
3871
+ options?: string | undefined;
3872
+ env?: string | undefined;
3873
+ resume?: string | undefined;
3874
+ "no-resume"?: string | undefined;
3821
3875
  };
3822
3876
  };
3823
3877
  output: string;
@@ -3832,6 +3886,11 @@ declare const app: _$hono_hono_base0.HonoBase<Env, {
3832
3886
  query: {
3833
3887
  path: string;
3834
3888
  channel: string;
3889
+ agent?: string | undefined;
3890
+ options?: string | undefined;
3891
+ env?: string | undefined;
3892
+ resume?: string | undefined;
3893
+ "no-resume"?: string | undefined;
3835
3894
  };
3836
3895
  };
3837
3896
  output: `added profile "${string}"`;
@@ -3859,6 +3918,11 @@ declare const app: _$hono_hono_base0.HonoBase<Env, {
3859
3918
  query: {
3860
3919
  path?: string | undefined;
3861
3920
  channel?: string | undefined;
3921
+ agent?: string | undefined;
3922
+ options?: string | undefined;
3923
+ env?: string | undefined;
3924
+ resume?: string | undefined;
3925
+ "no-resume"?: string | undefined;
3862
3926
  };
3863
3927
  };
3864
3928
  output: string;
@@ -3873,6 +3937,11 @@ declare const app: _$hono_hono_base0.HonoBase<Env, {
3873
3937
  query: {
3874
3938
  path?: string | undefined;
3875
3939
  channel?: string | undefined;
3940
+ agent?: string | undefined;
3941
+ options?: string | undefined;
3942
+ env?: string | undefined;
3943
+ resume?: string | undefined;
3944
+ "no-resume"?: string | undefined;
3876
3945
  };
3877
3946
  };
3878
3947
  output: `updated profile "${string}"`;
@@ -4317,4 +4386,4 @@ ${string}`;
4317
4386
  //#region lib/tui/tui.d.ts
4318
4387
  declare function launchTui(funnel: Funnel): Promise<void>;
4319
4388
  //#endregion
4320
- export { AliveStub, AttachOptions, BroadcastEvent, BroadcastSubscriber, ChannelConfig, ChannelConnectorView, ChannelDeliveryMode, ChannelServerOptions, ChannelSpec, ConnectorConfig, 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, FunnelDotenvReader, FunnelEvent, FunnelEventStore, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSessions, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, type GatewayEmitInput, type GatewayRouteDeps, type Env$1 as GatewayServerEnv, GhConnectorConfig, LOCAL_CONFIG_FILENAME, LOCAL_ENV_FILENAME, LaunchOptions, ListListenersResult, ListenerEntry, ListenerOpResult, LocalConfig, LocalConfigSyncResult, LogEntry, MemoryFunnelClock, MemoryFunnelFileSystem, MemoryFunnelIdGenerator, MemoryFunnelLogger, MemoryFunnelProcessRunner, MemoryFunnelTokenPrompter, MemoryProcessCall, MemoryProcessHandler, MemoryProcessResponse, MemoryProcessSyncHandler, MockFunnelSettingsReader, NodeFunnelClock, NodeFunnelFileSystem, NodeFunnelIdGenerator, NodeFunnelLogger, NodeFunnelProcessRunner, NodeFunnelTokenPrompter, NoopFunnelLogger, NotifyFn, OnFunnelError, ProcessListStub, ProcessSnapshot, ProfileConfig, PublishRequest, PublishResponse, PublishResult, ReplayableEvent, RunOptions, RunResult, SETTINGS_PATH, SETTINGS_VERSION, ScheduleCatchupPolicy, ScheduleConnectorConfig, ScheduleEntry, ScheduleListenerOptions, Settings, SlackConnectorConfig, SlackListenerOptions, SlackProcessed, SlackProcessedEmit, SlackProcessedSkip, SlackRawEvent, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, launchTui, localConfigSchema, profileConfigSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };
4389
+ export { AliveStub, AttachOptions, BroadcastEvent, BroadcastSubscriber, ChannelConfig, ChannelConnectorView, ChannelDeliveryMode, ChannelServerOptions, ChannelSpec, ConnectorConfig, 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, FunnelDotenvReader, FunnelEvent, FunnelEventStore, FunnelFileSystem, FunnelGateway, FunnelGatewayServer, FunnelGatewayToken, FunnelIdGenerator, FunnelListenerSupervisor, FunnelListenersClient, FunnelLocalConfig, FunnelLocalConfigSync, FunnelLogger, FunnelMcp, FunnelProcessRunner, FunnelProfiles, FunnelSessions, FunnelSettingsReader, FunnelSettingsStore, FunnelSlackEventProcessor, FunnelTokenPrompter, type GatewayEmitInput, type GatewayRouteDeps, type Env$1 as GatewayServerEnv, GhConnectorConfig, LOCAL_CONFIG_FILENAME, LOCAL_ENV_FILENAME, LaunchOptions, ListListenersResult, ListenerEntry, ListenerOpResult, LocalConfig, LocalConfigSyncResult, LogEntry, MemoryFunnelClock, 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, channelConfigSchema, channelDeliveryModeSchema, channelSpecSchema, app as cliApp, connectorConfigSchema, connectorSpecSchema, createCliApp, createSettings, discordConnectorSchema, factory, funnelEventSchema, funnelJsonSchema, ghConnectorSchema, launchTui, localConfigSchema, profileConfigSchema, profileSpecSchema, publishRequestSchema, publishResponseSchema, queryToCliArgs, scheduleCatchupPolicySchema, scheduleConnectorSchema, scheduleEntrySchema, settingsSchema, slackConnectorSchema, startChannelServer, toRequest };