MCPcopy Create free account
hub / github.com/altic-dev/Pilot / subscribe

Method subscribe

src/lib/progress-store.ts:94–112  ·  view source on GitHub ↗
(id: string, callback: (message: ProgressMessage) => void, sendExisting: boolean = true)

Source from the content-addressed store, hash-verified

92 }
93
94 subscribe(id: string, callback: (message: ProgressMessage) => void, sendExisting: boolean = true): () => void {
95 const execution = this.executions.get(id);
96 if (!execution) {
97 console.warn(`No execution found for id: ${id}`);
98 return () => {};
99 }
100
101 execution.subscribers.add(callback);
102
103 // Send all existing messages to the new subscriber only if requested
104 if (sendExisting) {
105 execution.messages.forEach((msg) => callback(msg));
106 }
107
108 // Return unsubscribe function
109 return () => {
110 execution.subscribers.delete(callback);
111 };
112 }
113
114 getMessages(id: string): ProgressMessage[] {
115 const execution = this.executions.get(id);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected