(ctx: AdapterContext)
| 85 | private started = false; |
| 86 | |
| 87 | async start(ctx: AdapterContext): Promise<void> { |
| 88 | // IPC channel only exists when spawned via child_process.fork/spawn with stdio "ipc". |
| 89 | if (typeof process.send !== "function") { |
| 90 | return; |
| 91 | } |
| 92 | |
| 93 | this.agent = ctx.agent; |
| 94 | this.rootDir = ctx.rootDir; |
| 95 | this.adapterMap = ctx.adapterMap ?? null; |
| 96 | this.conversationService = new ConversationService(ctx.rootDir); |
| 97 | |
| 98 | this.messageListener = (message: unknown) => { |
| 99 | if (!this.isIpcRequest(message)) return; |
| 100 | void this.handleRequest(message); |
| 101 | }; |
| 102 | process.on("message", this.messageListener); |
| 103 | |
| 104 | this.started = true; |
| 105 | console.log("[IpcAdapter] Started"); |
| 106 | } |
| 107 | |
| 108 | async stop(): Promise<void> { |
| 109 | if (this.messageListener) { |
no test coverage detected