@bluecopa/harness 0.1.0-snapshot.64 → 0.1.0-snapshot.66

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluecopa/harness",
3
- "version": "0.1.0-snapshot.64",
3
+ "version": "0.1.0-snapshot.66",
4
4
  "description": "Provider-agnostic TypeScript agent framework",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
@@ -114,6 +114,8 @@ export class ArcLoop {
114
114
  private readonly processListeners: Promise<void>[] = [];
115
115
  private readonly skillResolver: SkillResolver | undefined;
116
116
  private readonly createModel: ModelFactory;
117
+ /** Cached session memo facts — loaded once at stream start, injected into all threads. */
118
+ private cachedSessionMemoFacts: string[] | undefined;
117
119
 
118
120
  constructor(config: ArcLoopConfig) {
119
121
  this.config = config;
@@ -172,6 +174,12 @@ export class ArcLoop {
172
174
  }
173
175
 
174
176
  async *stream(userMessages: AgentMessage[], signal: AbortSignal): AsyncGenerator<ArcEvent> {
177
+ // Pre-load session memos once so dispatch() can inject them synchronously
178
+ try {
179
+ const memos = await this.config.sessionMemoStore.getMemosBySession(this.config.sessionId);
180
+ this.cachedSessionMemoFacts = memos.slice(-5).map(m => m.content);
181
+ } catch { this.cachedSessionMemoFacts = []; }
182
+
175
183
  const startTime = Date.now();
176
184
  const maxTurns = this.config.maxTurns ?? 30;
177
185
 
@@ -623,14 +631,11 @@ export class ArcLoop {
623
631
  // Keep legacy promise for backward compat (returns null — progressive loading handles it)
624
632
  const skillPromptPromise = skillRefPromise?.then(() => null);
625
633
 
626
- // Enrich contextFacts with session memos so threads see what the orchestrator learned
627
- let threadContextFacts = this.config.contextFacts ?? [];
628
- try {
629
- const memos = await this.config.sessionMemoStore.getMemosBySession(this.config.sessionId);
630
- if (memos.length > 0) {
631
- threadContextFacts = [...threadContextFacts, ...memos.slice(-5).map(m => m.content)];
632
- }
633
- } catch { /* best-effort */ }
634
+ // Enrich contextFacts with cached session memos so threads see what the orchestrator learned
635
+ const threadContextFacts = [
636
+ ...(this.config.contextFacts ?? []),
637
+ ...(this.cachedSessionMemoFacts ?? []),
638
+ ];
634
639
 
635
640
  const proc = createProcess(request, {
636
641
  toolProvider: this.config.toolProvider,