@hmharness/agent 0.14.23 → 0.18.13

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/dist/runner.d.ts CHANGED
@@ -92,6 +92,7 @@ export interface RunnerEvents {
92
92
  promptTokens: number;
93
93
  completionTokens: number;
94
94
  };
95
+ messages?: ChatMessage[];
95
96
  }): void;
96
97
  }
97
98
  /** Live runtime-steering channel (web Ctrl+Enter / TUI Enter-while-running):
package/dist/runner.js CHANGED
@@ -133,8 +133,10 @@ export async function contextPack(task, sessionId, opts = {}) {
133
133
  // 2026-09-27 plan A: experience retrieval - the K most RELEVANT past
134
134
  // insights for THIS task (bigram similarity, recency tiebreak) instead
135
135
  // of the 5 most recent; a task similar to one from a month ago now
136
- // surfaces that lesson instead of five unrelated recent rows
137
- retrieveInsights(home, task),
136
+ // surfaces that lesson instead of five unrelated recent rows.
137
+ // Plan C: cross-project lessons stay retrievable but carry their
138
+ // origin stamp ([来自项目:X]) so the model can weigh them.
139
+ retrieveInsights(home, task, { workspace: opts.workspace ?? undefined }),
138
140
  ]);
139
141
  let canaryBlock = '';
140
142
  let canaryNames = [];
@@ -493,6 +495,11 @@ export async function runAgentTask(opts) {
493
495
  toolUses: result.toolUses,
494
496
  toolsUsed: [...new Set(toolsUsed)],
495
497
  skillsInjected: pack.skillsInjected,
498
+ // plan C (2026-09-27): provenance for cross-project experience - a
499
+ // lesson learned in project A stays retrievable everywhere (plan A
500
+ // retrieval is global) AND carries its origin so the model can weigh
501
+ // "same tooling" vs "different codebase" advice appropriately
502
+ ...(workspace ? { workspace } : {}),
496
503
  });
497
504
  // daily self-evolution: every N insights, one background cycle fires
498
505
  // (default on; autoEvolveEvery: 0 disables). Fire-and-forget - it never
@@ -509,8 +516,12 @@ export async function runAgentTask(opts) {
509
516
  /* insight count is best-effort */
510
517
  }
511
518
  }
512
- events.onFinal?.({ text: result.text, turns: result.turns, toolUses: result.toolUses, sessionId: session.id, usage: result.usage });
513
- return { ...result, sessionId: session.id, toolsUsed: [...new Set(toolsUsed)] };
519
+ // messages rides along so cross-task callers (web thread mode) can extend
520
+ // their conversation with the assistant turns - without it the caller could
521
+ // only ever see the final text and every follow-up lost the answers (the
522
+ // web conversation bug, 2026-09-27).
523
+ events.onFinal?.({ text: result.text, turns: result.turns, toolUses: result.toolUses, sessionId: session.id, usage: result.usage, messages });
524
+ return { ...result, sessionId: session.id, toolsUsed: [...new Set(toolsUsed)], messages };
514
525
  }
515
526
  /** One background evolution cycle (auto-triggered). Logs to the evolution
516
527
  * journal only; failures never surface into the user's chat. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/agent",
3
- "version": "0.14.23",
3
+ "version": "0.18.13",
4
4
  "description": "hmharness agent execution layer: base tools, system prompt, sub-agent spawn, and the shared task runner that frontends (cli, web) drive.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",