@ccpocket/bridge 1.86.0 → 1.86.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.
@@ -211,6 +211,7 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
211
211
  * Sends thread/name/set which persists to ~/.codex/session_index.jsonl.
212
212
  */
213
213
  renameThread(name: string): Promise<void>;
214
+ private goalLookup;
214
215
  /** Read the persisted goal attached to this Codex thread. */
215
216
  getGoal(timeoutMs?: number): Promise<CodexGoal | null>;
216
217
  /** Create or update the persisted goal attached to this Codex thread. */
@@ -240,13 +240,21 @@ export class CodexProcess extends EventEmitter {
240
240
  name,
241
241
  });
242
242
  }
243
+ goalLookup;
243
244
  /** Read the persisted goal attached to this Codex thread. */
244
245
  async getGoal(timeoutMs = 3_000) {
245
246
  if (!this._threadId) {
246
247
  throw new Error("No thread ID available for goal lookup");
247
248
  }
248
- const response = (await this.request("thread/goal/get", { threadId: this._threadId }, timeoutMs));
249
- return response.goal == null ? null : parseCodexGoal(response.goal);
249
+ if (!this.goalLookup) {
250
+ this.goalLookup = this.request("thread/goal/get", { threadId: this._threadId }, timeoutMs).then((value) => {
251
+ const response = value;
252
+ return response.goal == null ? null : parseCodexGoal(response.goal);
253
+ }).finally(() => {
254
+ this.goalLookup = undefined;
255
+ });
256
+ }
257
+ return this.goalLookup;
250
258
  }
251
259
  /** Create or update the persisted goal attached to this Codex thread. */
252
260
  async setGoal(update) {