MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / setThreadGoal

Method setThreadGoal

test/core/bridge_coordinator.test.ts:399–422  ·  view source on GitHub ↗
({ threadId, objective = null, status = null })

Source from the content-addressed store, hash-verified

397 }
398
399 async setThreadGoal({ threadId, objective = null, status = null }) {
400 if (!this.threads.has(threadId)) {
401 throw new Error(`thread not found: ${threadId}`);
402 }
403 const current = this.threadGoals.get(threadId) ?? null;
404 const nextObjective = typeof objective === 'string' && objective.trim()
405 ? objective.trim()
406 : current?.objective ?? '';
407 if (!nextObjective) {
408 throw new Error('missing goal objective');
409 }
410 const next = {
411 threadId,
412 objective: nextObjective,
413 status: typeof status === 'string' && status.trim() ? status.trim() : 'active',
414 tokenBudget: null,
415 tokensUsed: 0,
416 timeUsedSeconds: 0,
417 createdAt: current?.createdAt ?? new Date(this.nextUpdatedAt()).toISOString(),
418 updatedAt: new Date(this.nextUpdatedAt()).toISOString(),
419 };
420 this.threadGoals.set(threadId, next);
421 return { ...next };
422 }
423
424 async clearThreadGoal({ threadId }) {
425 this.threadGoals.delete(threadId);

Callers

nothing calls this directly

Calls 3

nextUpdatedAtMethod · 0.95
hasMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected