@openacp/cli 0.6.1 → 0.6.3

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.
Files changed (101) hide show
  1. package/dist/{admin-IKPS5PFC.js → admin-3ZHEO5VP.js} +8 -4
  2. package/dist/{agent-catalog-T5ECPEDA.js → agent-catalog-IVU2KANH.js} +2 -2
  3. package/dist/{agents-55NX3DHM.js → agents-SXIY4IEF.js} +2 -2
  4. package/dist/{chunk-H7ZMPBZC.js → chunk-3KGRVAEV.js} +1 -1
  5. package/dist/chunk-3KGRVAEV.js.map +1 -0
  6. package/dist/{chunk-GINCOFNW.js → chunk-6LSFRNHE.js} +2 -2
  7. package/dist/chunk-6LSFRNHE.js.map +1 -0
  8. package/dist/{chunk-UB7XUO7C.js → chunk-AVCHZESZ.js} +3 -3
  9. package/dist/{chunk-J6X5SW6O.js → chunk-CKOK7JW6.js} +3 -2
  10. package/dist/{chunk-J6X5SW6O.js.map → chunk-CKOK7JW6.js.map} +1 -1
  11. package/dist/{chunk-4LFDEW22.js → chunk-EWYNCHUH.js} +33 -20
  12. package/dist/chunk-EWYNCHUH.js.map +1 -0
  13. package/dist/{chunk-4TR5Y3MP.js → chunk-F3AICYO4.js} +39 -1
  14. package/dist/chunk-F3AICYO4.js.map +1 -0
  15. package/dist/{chunk-LGQYTK55.js → chunk-FMWSVLRM.js} +31 -2
  16. package/dist/chunk-FMWSVLRM.js.map +1 -0
  17. package/dist/{chunk-AKIU4JBF.js → chunk-FZ5BIWG5.js} +6 -6
  18. package/dist/chunk-FZ5BIWG5.js.map +1 -0
  19. package/dist/{chunk-2KJC3ILH.js → chunk-G3OHCXZG.js} +34 -24
  20. package/dist/chunk-G3OHCXZG.js.map +1 -0
  21. package/dist/{chunk-R3UJUOXI.js → chunk-HP2IJYCA.js} +1817 -1015
  22. package/dist/chunk-HP2IJYCA.js.map +1 -0
  23. package/dist/chunk-IER5UCY7.js +298 -0
  24. package/dist/chunk-IER5UCY7.js.map +1 -0
  25. package/dist/{chunk-TOZQ3JFN.js → chunk-KO5RL7MZ.js} +2 -2
  26. package/dist/{chunk-7G5QKLLF.js → chunk-NXEQXRQR.js} +53 -9
  27. package/dist/chunk-NXEQXRQR.js.map +1 -0
  28. package/dist/{chunk-ZCHNAM3B.js → chunk-OHR6SBMC.js} +3 -3
  29. package/dist/chunk-PWFPTG5X.js +101 -0
  30. package/dist/chunk-PWFPTG5X.js.map +1 -0
  31. package/dist/{chunk-IMILOCR5.js → chunk-TMCQZAXN.js} +2 -2
  32. package/dist/chunk-TMCQZAXN.js.map +1 -0
  33. package/dist/{chunk-T22OLSET.js → chunk-TTDSLV35.js} +1 -1
  34. package/dist/chunk-TTDSLV35.js.map +1 -0
  35. package/dist/cli.js +41 -36
  36. package/dist/cli.js.map +1 -1
  37. package/dist/{config-AK2W3E67.js → config-4YSJ4NCI.js} +2 -2
  38. package/dist/{config-editor-VIA7A72X.js → config-editor-F25HEMGL.js} +4 -4
  39. package/dist/{config-registry-QQOJ2GQP.js → config-registry-7I6GGDOY.js} +2 -2
  40. package/dist/{daemon-G27YZUWB.js → daemon-I6XMRQ6P.js} +3 -3
  41. package/dist/{discord-2DKRH45T.js → discord-VHCBN3JJ.js} +226 -172
  42. package/dist/discord-VHCBN3JJ.js.map +1 -0
  43. package/dist/{doctor-CHCYUTV5.js → doctor-GPW5ECK6.js} +4 -4
  44. package/dist/doctor-Y3SCSVPI.js +9 -0
  45. package/dist/index.d.ts +176 -90
  46. package/dist/index.js +22 -12
  47. package/dist/install-cloudflared-G2GUKCHA.js +32 -0
  48. package/dist/install-cloudflared-G2GUKCHA.js.map +1 -0
  49. package/dist/install-jq-7QTU7XYY.js +31 -0
  50. package/dist/install-jq-7QTU7XYY.js.map +1 -0
  51. package/dist/{integrate-VOUYBPPZ.js → integrate-O4OCR4SN.js} +23 -11
  52. package/dist/integrate-O4OCR4SN.js.map +1 -0
  53. package/dist/{main-56SPFYW4.js → main-P4X6SAPZ.js} +29 -18
  54. package/dist/main-P4X6SAPZ.js.map +1 -0
  55. package/dist/{new-session-DRRP2J7E.js → new-session-PUNUHGYP.js} +3 -3
  56. package/dist/post-upgrade-6N4JCV5S.js +79 -0
  57. package/dist/post-upgrade-6N4JCV5S.js.map +1 -0
  58. package/dist/{session-FVFLBREJ.js → session-ZMAM67AA.js} +2 -2
  59. package/dist/{settings-LPOLJ6SA.js → settings-OEQEZS5Y.js} +3 -2
  60. package/dist/{setup-IPWJCIJM.js → setup-7YBFKRG7.js} +5 -3
  61. package/dist/{tunnel-service-U6V4HQOO.js → tunnel-service-BMIBHUBK.js} +35 -17
  62. package/dist/tunnel-service-BMIBHUBK.js.map +1 -0
  63. package/package.json +2 -1
  64. package/dist/chunk-2KJC3ILH.js.map +0 -1
  65. package/dist/chunk-4LFDEW22.js.map +0 -1
  66. package/dist/chunk-4TR5Y3MP.js.map +0 -1
  67. package/dist/chunk-7G5QKLLF.js.map +0 -1
  68. package/dist/chunk-AKIU4JBF.js.map +0 -1
  69. package/dist/chunk-GINCOFNW.js.map +0 -1
  70. package/dist/chunk-H7ZMPBZC.js.map +0 -1
  71. package/dist/chunk-IMILOCR5.js.map +0 -1
  72. package/dist/chunk-LGQYTK55.js.map +0 -1
  73. package/dist/chunk-R3UJUOXI.js.map +0 -1
  74. package/dist/chunk-RF3DUYFO.js +0 -103
  75. package/dist/chunk-RF3DUYFO.js.map +0 -1
  76. package/dist/chunk-T22OLSET.js.map +0 -1
  77. package/dist/chunk-THBR6OXH.js +0 -62
  78. package/dist/chunk-THBR6OXH.js.map +0 -1
  79. package/dist/discord-2DKRH45T.js.map +0 -1
  80. package/dist/doctor-AN6AZ3PF.js +0 -9
  81. package/dist/install-cloudflared-BTGUD7SW.js +0 -8
  82. package/dist/integrate-VOUYBPPZ.js.map +0 -1
  83. package/dist/main-56SPFYW4.js.map +0 -1
  84. package/dist/setup-IPWJCIJM.js.map +0 -1
  85. package/dist/tunnel-service-U6V4HQOO.js.map +0 -1
  86. /package/dist/{admin-IKPS5PFC.js.map → admin-3ZHEO5VP.js.map} +0 -0
  87. /package/dist/{agent-catalog-T5ECPEDA.js.map → agent-catalog-IVU2KANH.js.map} +0 -0
  88. /package/dist/{agents-55NX3DHM.js.map → agents-SXIY4IEF.js.map} +0 -0
  89. /package/dist/{chunk-UB7XUO7C.js.map → chunk-AVCHZESZ.js.map} +0 -0
  90. /package/dist/{chunk-TOZQ3JFN.js.map → chunk-KO5RL7MZ.js.map} +0 -0
  91. /package/dist/{chunk-ZCHNAM3B.js.map → chunk-OHR6SBMC.js.map} +0 -0
  92. /package/dist/{config-AK2W3E67.js.map → config-4YSJ4NCI.js.map} +0 -0
  93. /package/dist/{config-editor-VIA7A72X.js.map → config-editor-F25HEMGL.js.map} +0 -0
  94. /package/dist/{config-registry-QQOJ2GQP.js.map → config-registry-7I6GGDOY.js.map} +0 -0
  95. /package/dist/{daemon-G27YZUWB.js.map → daemon-I6XMRQ6P.js.map} +0 -0
  96. /package/dist/{doctor-AN6AZ3PF.js.map → doctor-GPW5ECK6.js.map} +0 -0
  97. /package/dist/{doctor-CHCYUTV5.js.map → doctor-Y3SCSVPI.js.map} +0 -0
  98. /package/dist/{install-cloudflared-BTGUD7SW.js.map → new-session-PUNUHGYP.js.map} +0 -0
  99. /package/dist/{new-session-DRRP2J7E.js.map → session-ZMAM67AA.js.map} +0 -0
  100. /package/dist/{session-FVFLBREJ.js.map → settings-OEQEZS5Y.js.map} +0 -0
  101. /package/dist/{settings-LPOLJ6SA.js.map → setup-7YBFKRG7.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { Readable, Writable } from 'node:stream';
5
5
  import { PromptResponse } from '@agentclientprotocol/sdk';
6
+ import * as http from 'node:http';
6
7
 
7
8
  interface Attachment {
8
9
  type: 'image' | 'audio' | 'file';
@@ -344,8 +345,8 @@ declare const ConfigSchema: z.ZodObject<{
344
345
  }, {
345
346
  command: string;
346
347
  args?: string[] | undefined;
347
- workingDirectory?: string | undefined;
348
348
  env?: Record<string, string> | undefined;
349
+ workingDirectory?: string | undefined;
349
350
  }>>>>;
350
351
  defaultAgent: z.ZodString;
351
352
  workspace: z.ZodDefault<z.ZodObject<{
@@ -479,50 +480,50 @@ declare const ConfigSchema: z.ZodObject<{
479
480
  stt: z.ZodDefault<z.ZodObject<{
480
481
  provider: z.ZodDefault<z.ZodNullable<z.ZodString>>;
481
482
  providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
482
- apiKey: z.ZodString;
483
+ apiKey: z.ZodOptional<z.ZodString>;
483
484
  model: z.ZodOptional<z.ZodString>;
484
485
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
485
- apiKey: z.ZodString;
486
+ apiKey: z.ZodOptional<z.ZodString>;
486
487
  model: z.ZodOptional<z.ZodString>;
487
488
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
488
- apiKey: z.ZodString;
489
+ apiKey: z.ZodOptional<z.ZodString>;
489
490
  model: z.ZodOptional<z.ZodString>;
490
491
  }, z.ZodTypeAny, "passthrough">>>>;
491
492
  }, "strip", z.ZodTypeAny, {
492
493
  provider: string | null;
493
494
  providers: Record<string, z.objectOutputType<{
494
- apiKey: z.ZodString;
495
+ apiKey: z.ZodOptional<z.ZodString>;
495
496
  model: z.ZodOptional<z.ZodString>;
496
497
  }, z.ZodTypeAny, "passthrough">>;
497
498
  }, {
498
499
  provider?: string | null | undefined;
499
500
  providers?: Record<string, z.objectInputType<{
500
- apiKey: z.ZodString;
501
+ apiKey: z.ZodOptional<z.ZodString>;
501
502
  model: z.ZodOptional<z.ZodString>;
502
503
  }, z.ZodTypeAny, "passthrough">> | undefined;
503
504
  }>>;
504
505
  tts: z.ZodDefault<z.ZodObject<{
505
506
  provider: z.ZodDefault<z.ZodNullable<z.ZodString>>;
506
507
  providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
507
- apiKey: z.ZodString;
508
+ apiKey: z.ZodOptional<z.ZodString>;
508
509
  model: z.ZodOptional<z.ZodString>;
509
510
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
510
- apiKey: z.ZodString;
511
+ apiKey: z.ZodOptional<z.ZodString>;
511
512
  model: z.ZodOptional<z.ZodString>;
512
513
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
513
- apiKey: z.ZodString;
514
+ apiKey: z.ZodOptional<z.ZodString>;
514
515
  model: z.ZodOptional<z.ZodString>;
515
516
  }, z.ZodTypeAny, "passthrough">>>>;
516
517
  }, "strip", z.ZodTypeAny, {
517
518
  provider: string | null;
518
519
  providers: Record<string, z.objectOutputType<{
519
- apiKey: z.ZodString;
520
+ apiKey: z.ZodOptional<z.ZodString>;
520
521
  model: z.ZodOptional<z.ZodString>;
521
522
  }, z.ZodTypeAny, "passthrough">>;
522
523
  }, {
523
524
  provider?: string | null | undefined;
524
525
  providers?: Record<string, z.objectInputType<{
525
- apiKey: z.ZodString;
526
+ apiKey: z.ZodOptional<z.ZodString>;
526
527
  model: z.ZodOptional<z.ZodString>;
527
528
  }, z.ZodTypeAny, "passthrough">> | undefined;
528
529
  }>>;
@@ -530,14 +531,14 @@ declare const ConfigSchema: z.ZodObject<{
530
531
  stt: {
531
532
  provider: string | null;
532
533
  providers: Record<string, z.objectOutputType<{
533
- apiKey: z.ZodString;
534
+ apiKey: z.ZodOptional<z.ZodString>;
534
535
  model: z.ZodOptional<z.ZodString>;
535
536
  }, z.ZodTypeAny, "passthrough">>;
536
537
  };
537
538
  tts: {
538
539
  provider: string | null;
539
540
  providers: Record<string, z.objectOutputType<{
540
- apiKey: z.ZodString;
541
+ apiKey: z.ZodOptional<z.ZodString>;
541
542
  model: z.ZodOptional<z.ZodString>;
542
543
  }, z.ZodTypeAny, "passthrough">>;
543
544
  };
@@ -545,14 +546,14 @@ declare const ConfigSchema: z.ZodObject<{
545
546
  stt?: {
546
547
  provider?: string | null | undefined;
547
548
  providers?: Record<string, z.objectInputType<{
548
- apiKey: z.ZodString;
549
+ apiKey: z.ZodOptional<z.ZodString>;
549
550
  model: z.ZodOptional<z.ZodString>;
550
551
  }, z.ZodTypeAny, "passthrough">> | undefined;
551
552
  } | undefined;
552
553
  tts?: {
553
554
  provider?: string | null | undefined;
554
555
  providers?: Record<string, z.objectInputType<{
555
- apiKey: z.ZodString;
556
+ apiKey: z.ZodOptional<z.ZodString>;
556
557
  model: z.ZodOptional<z.ZodString>;
557
558
  }, z.ZodTypeAny, "passthrough">> | undefined;
558
559
  } | undefined;
@@ -620,14 +621,14 @@ declare const ConfigSchema: z.ZodObject<{
620
621
  stt: {
621
622
  provider: string | null;
622
623
  providers: Record<string, z.objectOutputType<{
623
- apiKey: z.ZodString;
624
+ apiKey: z.ZodOptional<z.ZodString>;
624
625
  model: z.ZodOptional<z.ZodString>;
625
626
  }, z.ZodTypeAny, "passthrough">>;
626
627
  };
627
628
  tts: {
628
629
  provider: string | null;
629
630
  providers: Record<string, z.objectOutputType<{
630
- apiKey: z.ZodString;
631
+ apiKey: z.ZodOptional<z.ZodString>;
631
632
  model: z.ZodOptional<z.ZodString>;
632
633
  }, z.ZodTypeAny, "passthrough">>;
633
634
  };
@@ -645,8 +646,8 @@ declare const ConfigSchema: z.ZodObject<{
645
646
  agents?: Record<string, {
646
647
  command: string;
647
648
  args?: string[] | undefined;
648
- workingDirectory?: string | undefined;
649
649
  env?: Record<string, string> | undefined;
650
+ workingDirectory?: string | undefined;
650
651
  }> | undefined;
651
652
  tunnel?: {
652
653
  options?: Record<string, unknown> | undefined;
@@ -695,14 +696,14 @@ declare const ConfigSchema: z.ZodObject<{
695
696
  stt?: {
696
697
  provider?: string | null | undefined;
697
698
  providers?: Record<string, z.objectInputType<{
698
- apiKey: z.ZodString;
699
+ apiKey: z.ZodOptional<z.ZodString>;
699
700
  model: z.ZodOptional<z.ZodString>;
700
701
  }, z.ZodTypeAny, "passthrough">> | undefined;
701
702
  } | undefined;
702
703
  tts?: {
703
704
  provider?: string | null | undefined;
704
705
  providers?: Record<string, z.objectInputType<{
705
- apiKey: z.ZodString;
706
+ apiKey: z.ZodOptional<z.ZodString>;
706
707
  model: z.ZodOptional<z.ZodString>;
707
708
  }, z.ZodTypeAny, "passthrough">> | undefined;
708
709
  } | undefined;
@@ -766,7 +767,7 @@ interface IChannelAdapter {
766
767
  * Adapters can extend this or implement IChannelAdapter directly.
767
768
  */
768
769
  declare abstract class ChannelAdapter<TCore = unknown> implements IChannelAdapter {
769
- protected core: TCore;
770
+ readonly core: TCore;
770
771
  protected config: ChannelConfig;
771
772
  constructor(core: TCore, config: ChannelConfig);
772
773
  abstract start(): Promise<void>;
@@ -802,7 +803,45 @@ declare class StderrCapture {
802
803
  getLastLines(): string;
803
804
  }
804
805
 
805
- declare class AgentInstance {
806
+ /**
807
+ * A minimal, generic typed event emitter.
808
+ *
809
+ * Usage:
810
+ * interface MyEvents {
811
+ * data: (payload: string) => void
812
+ * error: (err: Error) => void
813
+ * }
814
+ * const emitter = new TypedEmitter<MyEvents>()
815
+ * emitter.on('data', (payload) => { ... })
816
+ * emitter.emit('data', 'hello')
817
+ */
818
+ declare class TypedEmitter<T extends Record<string & keyof T, (...args: any[]) => void>> {
819
+ private listeners;
820
+ private paused;
821
+ private buffer;
822
+ on<K extends keyof T>(event: K, listener: T[K]): this;
823
+ off<K extends keyof T>(event: K, listener: T[K]): this;
824
+ emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): void;
825
+ /**
826
+ * Pause event delivery. Events emitted while paused are buffered.
827
+ * Optionally pass a filter to allow specific events through even while paused.
828
+ */
829
+ pause(passthrough?: (event: keyof T, args: unknown[]) => boolean): void;
830
+ private passthroughFn?;
831
+ /** Resume event delivery and replay buffered events in order. */
832
+ resume(): void;
833
+ /** Discard all buffered events without delivering them. */
834
+ clearBuffer(): void;
835
+ get isPaused(): boolean;
836
+ get bufferSize(): number;
837
+ removeAllListeners(event?: keyof T): void;
838
+ private deliver;
839
+ }
840
+
841
+ interface AgentInstanceEvents {
842
+ agent_event: (event: AgentEvent) => void;
843
+ }
844
+ declare class AgentInstance extends TypedEmitter<AgentInstanceEvents> {
806
845
  private connection;
807
846
  private child;
808
847
  private stderrCapture;
@@ -813,7 +852,6 @@ declare class AgentInstance {
813
852
  image?: boolean;
814
853
  audio?: boolean;
815
854
  };
816
- onSessionUpdate: (event: AgentEvent) => void;
817
855
  onPermissionRequest: (request: PermissionRequest) => Promise<string>;
818
856
  private constructor();
819
857
  private static spawnSubprocess;
@@ -880,41 +918,6 @@ declare class AgentManager {
880
918
  resume(agentName: string, workingDirectory: string, agentSessionId: string): Promise<AgentInstance>;
881
919
  }
882
920
 
883
- /**
884
- * A minimal, generic typed event emitter.
885
- *
886
- * Usage:
887
- * interface MyEvents {
888
- * data: (payload: string) => void
889
- * error: (err: Error) => void
890
- * }
891
- * const emitter = new TypedEmitter<MyEvents>()
892
- * emitter.on('data', (payload) => { ... })
893
- * emitter.emit('data', 'hello')
894
- */
895
- declare class TypedEmitter<T extends Record<string & keyof T, (...args: any[]) => void>> {
896
- private listeners;
897
- private paused;
898
- private buffer;
899
- on<K extends keyof T>(event: K, listener: T[K]): this;
900
- off<K extends keyof T>(event: K, listener: T[K]): this;
901
- emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): void;
902
- /**
903
- * Pause event delivery. Events emitted while paused are buffered.
904
- * Optionally pass a filter to allow specific events through even while paused.
905
- */
906
- pause(passthrough?: (event: keyof T, args: unknown[]) => boolean): void;
907
- private passthroughFn?;
908
- /** Resume event delivery and replay buffered events in order. */
909
- resume(): void;
910
- /** Discard all buffered events without delivering them. */
911
- clearBuffer(): void;
912
- get isPaused(): boolean;
913
- get bufferSize(): number;
914
- removeAllListeners(event?: keyof T): void;
915
- private deliver;
916
- }
917
-
918
921
  /**
919
922
  * Encapsulates pending permission state with a typed Promise API.
920
923
  */
@@ -964,7 +967,7 @@ interface TTSProvider {
964
967
  synthesize(text: string, options?: TTSOptions): Promise<TTSResult>;
965
968
  }
966
969
  interface SpeechProviderConfig {
967
- apiKey: string;
970
+ apiKey?: string;
968
971
  model?: string;
969
972
  [key: string]: unknown;
970
973
  }
@@ -1020,6 +1023,7 @@ declare class Session extends TypedEmitter<SessionEvents> {
1020
1023
  private _status;
1021
1024
  name?: string;
1022
1025
  createdAt: Date;
1026
+ voiceMode: "off" | "next" | "on";
1023
1027
  dangerousMode: boolean;
1024
1028
  archiving: boolean;
1025
1029
  log: Logger;
@@ -1047,9 +1051,11 @@ declare class Session extends TypedEmitter<SessionEvents> {
1047
1051
  /** Number of prompts waiting in queue */
1048
1052
  get queueDepth(): number;
1049
1053
  get promptRunning(): boolean;
1054
+ setVoiceMode(mode: "off" | "next" | "on"): void;
1050
1055
  enqueuePrompt(text: string, attachments?: Attachment[]): Promise<void>;
1051
1056
  private processPrompt;
1052
1057
  private maybeTranscribeAudio;
1058
+ private processTTSResponse;
1053
1059
  private autoName;
1054
1060
  /** Fire-and-forget warm-up: primes model cache while user types their first message */
1055
1061
  warmup(): Promise<void>;
@@ -1170,9 +1176,38 @@ interface SessionStore {
1170
1176
  remove(sessionId: string): Promise<void>;
1171
1177
  }
1172
1178
 
1179
+ interface EventBusEvents {
1180
+ "session:created": (data: {
1181
+ sessionId: string;
1182
+ agent: string;
1183
+ status: SessionStatus;
1184
+ }) => void;
1185
+ "session:updated": (data: {
1186
+ sessionId: string;
1187
+ status?: SessionStatus;
1188
+ name?: string;
1189
+ dangerousMode?: boolean;
1190
+ }) => void;
1191
+ "session:deleted": (data: {
1192
+ sessionId: string;
1193
+ }) => void;
1194
+ "agent:event": (data: {
1195
+ sessionId: string;
1196
+ event: AgentEvent;
1197
+ }) => void;
1198
+ "permission:request": (data: {
1199
+ sessionId: string;
1200
+ permission: PermissionRequest;
1201
+ }) => void;
1202
+ }
1203
+ declare class EventBus extends TypedEmitter<EventBusEvents> {
1204
+ }
1205
+
1173
1206
  declare class SessionManager {
1174
1207
  private sessions;
1175
1208
  private store;
1209
+ private eventBus?;
1210
+ setEventBus(eventBus: EventBus): void;
1176
1211
  constructor(store?: SessionStore | null);
1177
1212
  createSession(channelId: string, agentName: string, workingDirectory: string, agentManager: AgentManager): Promise<Session>;
1178
1213
  getSession(sessionId: string): Session | undefined;
@@ -1192,10 +1227,23 @@ declare class SessionManager {
1192
1227
  destroyAll(): Promise<void>;
1193
1228
  }
1194
1229
 
1230
+ declare class SecurityGuard {
1231
+ private configManager;
1232
+ private sessionManager;
1233
+ constructor(configManager: ConfigManager, sessionManager: SessionManager);
1234
+ checkAccess(message: IncomingMessage): {
1235
+ allowed: true;
1236
+ } | {
1237
+ allowed: false;
1238
+ reason: string;
1239
+ };
1240
+ }
1241
+
1195
1242
  interface BridgeDeps {
1196
1243
  messageTransformer: MessageTransformer;
1197
1244
  notificationManager: NotificationManager;
1198
1245
  sessionManager: SessionManager;
1246
+ eventBus?: EventBus;
1199
1247
  fileService?: FileService;
1200
1248
  }
1201
1249
  declare class SessionBridge {
@@ -1204,6 +1252,7 @@ declare class SessionBridge {
1204
1252
  private deps;
1205
1253
  private connected;
1206
1254
  private agentEventHandler?;
1255
+ private sessionEventHandler?;
1207
1256
  private statusChangeHandler?;
1208
1257
  private namedHandler?;
1209
1258
  constructor(session: Session, adapter: ChannelAdapter, deps: BridgeDeps);
@@ -1256,6 +1305,30 @@ declare class UsageBudget {
1256
1305
  };
1257
1306
  }
1258
1307
 
1308
+ interface SessionCreateParams {
1309
+ channelId: string;
1310
+ agentName: string;
1311
+ workingDirectory: string;
1312
+ resumeAgentSessionId?: string;
1313
+ existingSessionId?: string;
1314
+ initialName?: string;
1315
+ }
1316
+ interface SideEffectDeps {
1317
+ usageStore?: UsageStore | null;
1318
+ usageBudget?: UsageBudget | null;
1319
+ notificationManager: NotificationManager;
1320
+ tunnelService?: TunnelService;
1321
+ }
1322
+ declare class SessionFactory {
1323
+ private agentManager;
1324
+ private sessionManager;
1325
+ private speechService;
1326
+ private eventBus;
1327
+ constructor(agentManager: AgentManager, sessionManager: SessionManager, speechService: SpeechService, eventBus: EventBus);
1328
+ create(params: SessionCreateParams): Promise<Session>;
1329
+ wireSideEffects(session: Session, deps: SideEffectDeps): void;
1330
+ }
1331
+
1259
1332
  declare class OpenACPCore {
1260
1333
  configManager: ConfigManager;
1261
1334
  agentCatalog: AgentCatalog;
@@ -1265,12 +1338,15 @@ declare class OpenACPCore {
1265
1338
  messageTransformer: MessageTransformer;
1266
1339
  fileService: FileService;
1267
1340
  readonly speechService: SpeechService;
1341
+ securityGuard: SecurityGuard;
1268
1342
  adapters: Map<string, ChannelAdapter>;
1269
1343
  /** Set by main.ts — triggers graceful shutdown with restart exit code */
1270
1344
  requestRestart: (() => Promise<void>) | null;
1271
1345
  private _tunnelService?;
1272
1346
  private sessionStore;
1273
1347
  private resumeLocks;
1348
+ eventBus: EventBus;
1349
+ sessionFactory: SessionFactory;
1274
1350
  readonly usageStore: UsageStore | null;
1275
1351
  readonly usageBudget: UsageBudget | null;
1276
1352
  constructor(configManager: ConfigManager);
@@ -1297,7 +1373,7 @@ declare class OpenACPCore {
1297
1373
  initialName?: string;
1298
1374
  }): Promise<Session>;
1299
1375
  handleNewSession(channelId: string, agentName?: string, workspacePath?: string): Promise<Session>;
1300
- adoptSession(agentName: string, agentSessionId: string, cwd: string): Promise<{
1376
+ adoptSession(agentName: string, agentSessionId: string, cwd: string, channelId?: string): Promise<{
1301
1377
  ok: true;
1302
1378
  sessionId: string;
1303
1379
  threadId: string;
@@ -1308,6 +1384,11 @@ declare class OpenACPCore {
1308
1384
  message: string;
1309
1385
  }>;
1310
1386
  handleNewChat(channelId: string, currentThreadId: string): Promise<Session | null>;
1387
+ /**
1388
+ * Get active session by thread, or attempt lazy resume from store.
1389
+ * Used by adapter command handlers that need a session but don't go through handleMessage().
1390
+ */
1391
+ getOrResumeSession(channelId: string, threadId: string): Promise<Session | null>;
1311
1392
  private lazyResume;
1312
1393
  /** Create a SessionBridge for the given session and adapter */
1313
1394
  createBridge(session: Session, adapter: ChannelAdapter): SessionBridge;
@@ -1315,7 +1396,7 @@ declare class OpenACPCore {
1315
1396
 
1316
1397
  interface AdapterFactory {
1317
1398
  name: string;
1318
- createAdapter(core: any, config: any): ChannelAdapter;
1399
+ createAdapter(core: OpenACPCore, config: ChannelConfig): ChannelAdapter;
1319
1400
  }
1320
1401
  declare function installPlugin(packageName: string): void;
1321
1402
  declare function uninstallPlugin(packageName: string): void;
@@ -1410,44 +1491,49 @@ declare class ApiServer {
1410
1491
  private startedAt;
1411
1492
  private secret;
1412
1493
  private secretFilePath;
1413
- constructor(core: OpenACPCore, config: ApiConfig, portFilePath?: string, topicManager?: TopicManager | undefined, secretFilePath?: string);
1494
+ private sseManager;
1495
+ private staticServer;
1496
+ private router;
1497
+ constructor(core: OpenACPCore, config: ApiConfig, portFilePath?: string, topicManager?: TopicManager | undefined, secretFilePath?: string, uiDir?: string);
1414
1498
  start(): Promise<void>;
1415
1499
  stop(): Promise<void>;
1416
1500
  getPort(): number;
1501
+ getSecret(): string;
1417
1502
  private writePortFile;
1418
1503
  private removePortFile;
1419
1504
  private loadOrCreateSecret;
1420
1505
  private authenticate;
1421
1506
  private handleRequest;
1422
- private handleCreateSession;
1423
- private handleSendPrompt;
1424
- private handleGetSession;
1425
- private handleToggleDangerous;
1426
- private handleHealth;
1427
- private handleVersion;
1428
- private handleGetEditableConfig;
1429
- private handleGetConfig;
1430
- private handleUpdateConfig;
1431
- private handleListAdapters;
1432
- private handleTunnelStatus;
1433
- private handleTunnelList;
1434
- private handleTunnelAdd;
1435
- private handleTunnelStop;
1436
- private handleTunnelStopAll;
1437
- private handleNotify;
1438
- private handleRestart;
1439
- private handleArchiveSession;
1440
- private handleCancelSession;
1441
- private handleListSessions;
1442
- private handleAdoptSession;
1443
- private handleListAgents;
1444
1507
  private sendJson;
1445
- private handleListTopics;
1446
- private handleDeleteTopic;
1447
- private handleCleanupTopics;
1448
1508
  private readBody;
1449
1509
  }
1450
1510
 
1511
+ interface SessionStats {
1512
+ active: number;
1513
+ total: number;
1514
+ }
1515
+ declare class SSEManager {
1516
+ private eventBus;
1517
+ private getSessionStats;
1518
+ private startedAt;
1519
+ private sseConnections;
1520
+ private sseCleanupHandlers;
1521
+ private healthInterval?;
1522
+ private boundHandlers;
1523
+ constructor(eventBus: EventBus | undefined, getSessionStats: () => SessionStats, startedAt: number);
1524
+ setup(): void;
1525
+ handleRequest(req: http.IncomingMessage, res: http.ServerResponse): void;
1526
+ broadcast(event: string, data: unknown): void;
1527
+ stop(): void;
1528
+ }
1529
+
1530
+ declare class StaticServer {
1531
+ private uiDir;
1532
+ constructor(uiDir?: string);
1533
+ isAvailable(): boolean;
1534
+ serve(req: http.IncomingMessage, res: http.ServerResponse): boolean;
1535
+ }
1536
+
1451
1537
  interface ConfigFieldDef {
1452
1538
  path: string;
1453
1539
  displayName: string;
@@ -1464,8 +1550,7 @@ declare function isHotReloadable(path: string): boolean;
1464
1550
  declare function resolveOptions(def: ConfigFieldDef, config: Config): string[] | undefined;
1465
1551
  declare function getConfigValue(config: Config, path: string): unknown;
1466
1552
 
1467
- interface TelegramChannelConfig {
1468
- enabled: boolean;
1553
+ interface TelegramChannelConfig extends ChannelConfig {
1469
1554
  botToken: string;
1470
1555
  chatId: number;
1471
1556
  notificationTopicId: number | null;
@@ -1491,6 +1576,7 @@ declare class TelegramAdapter extends ChannelAdapter<OpenACPCore> {
1491
1576
  start(): Promise<void>;
1492
1577
  stop(): Promise<void>;
1493
1578
  private setupRoutes;
1579
+ private messageHandlers;
1494
1580
  sendMessage(sessionId: string, content: OutgoingMessage): Promise<void>;
1495
1581
  sendPermissionRequest(sessionId: string, request: PermissionRequest): Promise<void>;
1496
1582
  sendNotification(notification: NotificationMessage): Promise<void>;
@@ -1507,4 +1593,4 @@ declare class TelegramAdapter extends ChannelAdapter<OpenACPCore> {
1507
1593
  } | null>;
1508
1594
  }
1509
1595
 
1510
- export { type AdapterFactory, AgentCatalog, type AgentCommand, type AgentDefinition, type AgentDistribution, type AgentEvent, AgentInstance, type AgentListItem, AgentManager, AgentStore, type ApiConfig, ApiServer, type Attachment, type AvailabilityResult, type BridgeDeps, CONFIG_REGISTRY, ChannelAdapter, type ChannelConfig, type CleanupResult, type Config, type ConfigFieldDef, ConfigManager, type DeleteTopicResult, type DiscordPlatformData, FileService, GroqSTT, type IChannelAdapter, type IncomingMessage, type InstallProgress, type InstallResult, type InstalledAgent, type Logger, type LoggingConfig, MessageTransformer, NotificationManager, type NotificationMessage, OpenACPCore, type OutgoingMessage, PLUGINS_DIR, PermissionGate, type PermissionOption, type PermissionRequest, type PlanEntry, PromptQueue, type RegistryAgent, type RegistryBinaryTarget, type RegistryDistribution, type STTOptions, type STTProvider, type STTResult, Session, SessionBridge, type SessionEvents, SessionManager, type SessionRecord, type SessionStatus, type SpeechProviderConfig, SpeechService, type SpeechServiceConfig, StderrCapture, type TTSOptions, type TTSProvider, type TTSResult, TelegramAdapter, type TelegramPlatformData, type TopicInfo, TopicManager, TypedEmitter, UsageBudget, type UsageConfig, type UsageRecord, UsageStore, type UsageSummary, cleanupOldSessionLogs, createChildLogger, createSessionLogger, expandHome, getConfigValue, getFieldDef, getPidPath, getSafeFields, getStatus, initLogger, installAutoStart, installPlugin, isAutoStartInstalled, isAutoStartSupported, isHotReloadable, listPlugins, loadAdapterFactory, log, nodeToWebReadable, nodeToWebWritable, resolveOptions, runConfigEditor, setLogLevel, shutdownLogger, startDaemon, stopDaemon, uninstallAutoStart, uninstallPlugin };
1596
+ export { type AdapterFactory, AgentCatalog, type AgentCommand, type AgentDefinition, type AgentDistribution, type AgentEvent, AgentInstance, type AgentListItem, AgentManager, AgentStore, type ApiConfig, ApiServer, type Attachment, type AvailabilityResult, type BridgeDeps, CONFIG_REGISTRY, ChannelAdapter, type ChannelConfig, type CleanupResult, type Config, type ConfigFieldDef, ConfigManager, type DeleteTopicResult, type DiscordPlatformData, EventBus, type EventBusEvents, FileService, GroqSTT, type IChannelAdapter, type IncomingMessage, type InstallProgress, type InstallResult, type InstalledAgent, type Logger, type LoggingConfig, MessageTransformer, NotificationManager, type NotificationMessage, OpenACPCore, type OutgoingMessage, PLUGINS_DIR, PermissionGate, type PermissionOption, type PermissionRequest, type PlanEntry, PromptQueue, type RegistryAgent, type RegistryBinaryTarget, type RegistryDistribution, SSEManager, type STTOptions, type STTProvider, type STTResult, SecurityGuard, Session, SessionBridge, type SessionCreateParams, type SessionEvents, SessionFactory, SessionManager, type SessionRecord, type SessionStatus, type SideEffectDeps, type SpeechProviderConfig, SpeechService, type SpeechServiceConfig, StaticServer, StderrCapture, type TTSOptions, type TTSProvider, type TTSResult, TelegramAdapter, type TelegramPlatformData, type TopicInfo, TopicManager, TypedEmitter, UsageBudget, type UsageConfig, type UsageRecord, UsageStore, type UsageSummary, cleanupOldSessionLogs, createChildLogger, createSessionLogger, expandHome, getConfigValue, getFieldDef, getPidPath, getSafeFields, getStatus, initLogger, installAutoStart, installPlugin, isAutoStartInstalled, isAutoStartSupported, isHotReloadable, listPlugins, loadAdapterFactory, log, nodeToWebReadable, nodeToWebWritable, resolveOptions, runConfigEditor, setLogLevel, shutdownLogger, startDaemon, stopDaemon, uninstallAutoStart, uninstallPlugin };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  AgentInstance,
3
3
  AgentManager,
4
4
  ApiServer,
5
+ EventBus,
5
6
  FileService,
6
7
  GroqSTT,
7
8
  MessageTransformer,
@@ -9,10 +10,14 @@ import {
9
10
  OpenACPCore,
10
11
  PermissionGate,
11
12
  PromptQueue,
13
+ SSEManager,
14
+ SecurityGuard,
12
15
  Session,
13
16
  SessionBridge,
17
+ SessionFactory,
14
18
  SessionManager,
15
19
  SpeechService,
20
+ StaticServer,
16
21
  StderrCapture,
17
22
  TelegramAdapter,
18
23
  TopicManager,
@@ -21,14 +26,11 @@ import {
21
26
  UsageStore,
22
27
  nodeToWebReadable,
23
28
  nodeToWebWritable
24
- } from "./chunk-R3UJUOXI.js";
29
+ } from "./chunk-HP2IJYCA.js";
25
30
  import {
26
31
  ChannelAdapter
27
- } from "./chunk-LGQYTK55.js";
28
- import {
29
- runConfigEditor
30
- } from "./chunk-UB7XUO7C.js";
31
- import "./chunk-ZCHNAM3B.js";
32
+ } from "./chunk-FMWSVLRM.js";
33
+ import "./chunk-OHR6SBMC.js";
32
34
  import "./chunk-NAMYZIS5.js";
33
35
  import "./chunk-7QJS2XBD.js";
34
36
  import {
@@ -36,27 +38,30 @@ import {
36
38
  getStatus,
37
39
  startDaemon,
38
40
  stopDaemon
39
- } from "./chunk-TOZQ3JFN.js";
41
+ } from "./chunk-KO5RL7MZ.js";
40
42
  import {
41
43
  AgentCatalog
42
- } from "./chunk-J6X5SW6O.js";
44
+ } from "./chunk-CKOK7JW6.js";
43
45
  import {
44
46
  AgentStore
45
47
  } from "./chunk-5HGXUCMX.js";
48
+ import {
49
+ runConfigEditor
50
+ } from "./chunk-AVCHZESZ.js";
46
51
  import {
47
52
  installAutoStart,
48
53
  isAutoStartInstalled,
49
54
  isAutoStartSupported,
50
55
  uninstallAutoStart
51
56
  } from "./chunk-PMGNLNSH.js";
52
- import "./chunk-2KJC3ILH.js";
57
+ import "./chunk-G3OHCXZG.js";
53
58
  import "./chunk-JKBFUAJK.js";
54
59
  import {
55
60
  installPlugin,
56
61
  listPlugins,
57
62
  loadAdapterFactory,
58
63
  uninstallPlugin
59
- } from "./chunk-IMILOCR5.js";
64
+ } from "./chunk-TMCQZAXN.js";
60
65
  import {
61
66
  CONFIG_REGISTRY,
62
67
  getConfigValue,
@@ -64,12 +69,12 @@ import {
64
69
  getSafeFields,
65
70
  isHotReloadable,
66
71
  resolveOptions
67
- } from "./chunk-4TR5Y3MP.js";
72
+ } from "./chunk-F3AICYO4.js";
68
73
  import {
69
74
  ConfigManager,
70
75
  PLUGINS_DIR,
71
76
  expandHome
72
- } from "./chunk-4LFDEW22.js";
77
+ } from "./chunk-EWYNCHUH.js";
73
78
  import {
74
79
  cleanupOldSessionLogs,
75
80
  createChildLogger,
@@ -88,6 +93,7 @@ export {
88
93
  CONFIG_REGISTRY,
89
94
  ChannelAdapter,
90
95
  ConfigManager,
96
+ EventBus,
91
97
  FileService,
92
98
  GroqSTT,
93
99
  MessageTransformer,
@@ -96,10 +102,14 @@ export {
96
102
  PLUGINS_DIR,
97
103
  PermissionGate,
98
104
  PromptQueue,
105
+ SSEManager,
106
+ SecurityGuard,
99
107
  Session,
100
108
  SessionBridge,
109
+ SessionFactory,
101
110
  SessionManager,
102
111
  SpeechService,
112
+ StaticServer,
103
113
  StderrCapture,
104
114
  TelegramAdapter,
105
115
  TopicManager,
@@ -0,0 +1,32 @@
1
+ import {
2
+ ensureBinary
3
+ } from "./chunk-PWFPTG5X.js";
4
+ import "./chunk-JKBFUAJK.js";
5
+ import "./chunk-ESOPMQAY.js";
6
+
7
+ // src/tunnel/providers/install-cloudflared.ts
8
+ var CLOUDFLARED_SPEC = {
9
+ name: "cloudflared",
10
+ githubBaseUrl: "https://github.com/cloudflare/cloudflared/releases/latest/download",
11
+ platforms: {
12
+ darwin: {
13
+ x64: "cloudflared-darwin-amd64.tgz",
14
+ arm64: "cloudflared-darwin-amd64.tgz"
15
+ },
16
+ win32: {
17
+ x64: "cloudflared-windows-amd64.exe"
18
+ },
19
+ linux: {
20
+ x64: "cloudflared-linux-amd64",
21
+ arm64: "cloudflared-linux-arm64"
22
+ }
23
+ },
24
+ isArchive: (url) => url.endsWith(".tgz")
25
+ };
26
+ async function ensureCloudflared() {
27
+ return ensureBinary(CLOUDFLARED_SPEC);
28
+ }
29
+ export {
30
+ ensureCloudflared
31
+ };
32
+ //# sourceMappingURL=install-cloudflared-G2GUKCHA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tunnel/providers/install-cloudflared.ts"],"sourcesContent":["import { ensureBinary, type BinarySpec } from '../../core/install-binary.js'\n\nconst CLOUDFLARED_SPEC: BinarySpec = {\n name: 'cloudflared',\n githubBaseUrl: 'https://github.com/cloudflare/cloudflared/releases/latest/download',\n platforms: {\n darwin: {\n x64: 'cloudflared-darwin-amd64.tgz',\n arm64: 'cloudflared-darwin-amd64.tgz',\n },\n win32: {\n x64: 'cloudflared-windows-amd64.exe',\n },\n linux: {\n x64: 'cloudflared-linux-amd64',\n arm64: 'cloudflared-linux-arm64',\n },\n },\n isArchive: (url) => url.endsWith('.tgz'),\n}\n\nexport async function ensureCloudflared(): Promise<string> {\n return ensureBinary(CLOUDFLARED_SPEC)\n}\n"],"mappings":";;;;;;;AAEA,IAAM,mBAA+B;AAAA,EACnC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,WAAW;AAAA,IACT,QAAQ;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,IACT;AAAA,IACA,OAAO;AAAA,MACL,KAAK;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACL,KAAK;AAAA,MACL,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,WAAW,CAAC,QAAQ,IAAI,SAAS,MAAM;AACzC;AAEA,eAAsB,oBAAqC;AACzD,SAAO,aAAa,gBAAgB;AACtC;","names":[]}