@@ -59,12 +59,6 @@ const logger = getLogger([LOG_NAMESPACE_ROOT, "agent", "director"]);
5959// (mount, description edit, reorder) drops the next turn's cache hit. The
6060// digest stays deterministic — it only moves when discovery grows the set.
6161// Hashed: MCP descriptions are arbitrary server text, not log material.
62- //
63- // Pure by design: the memoization lives on the director (_toolSetDigest), the
64- // only production caller, so the module keeps no per-array state. Callers swap
65- // tool arrays wholesale (constructor, updateToolDefinitions) without in-place
66- // mutation; mutating an installed array in place would leave the director's
67- // cached digest stale.
6862export function toolSetDigest ( tools : readonly ToolDefinition [ ] ) : string {
6963 const shape = tools
7064 . map (
@@ -481,12 +475,6 @@ class ChatDirectorImpl extends DefaultDirector {
481475 private readonly askOperatorCalls = new Set < string > ( ) ;
482476 private readonly _systemPrompt : string ;
483477 private _toolDefinitions : ToolDefinition [ ] ;
484- // Digest of the installed _toolDefinitions, stored when the array is set so
485- // updateToolDefinitions can compare an incoming set without re-hashing the
486- // current one. One slot per director — the digest is only consumed by the
487- // next update on this instance, never by shared/static context (all
488- // production call sites are here). Stale only if a caller mutates the
489- // installed array in place; callers swap arrays wholesale instead.
490478 private _toolSetDigest : string | undefined ;
491479 private inactivityTimeoutMs : number | undefined ;
492480 private totalTimeoutMs : number | undefined ;
@@ -712,9 +700,6 @@ class ChatDirectorImpl extends DefaultDirector {
712700 }
713701
714702 updateToolDefinitions ( toolDefinitions : ToolDefinition [ ] ) : void {
715- // The stored digest covers the current set (installed by the constructor
716- // or a prior update); only the very first update has to hash it, and the
717- // fallback runs once per director.
718703 const before = this . _toolSetDigest ?? toolSetDigest ( this . _toolDefinitions ) ;
719704 const after = toolSetDigest ( toolDefinitions ) ;
720705 this . _toolDefinitions = toolDefinitions ;
0 commit comments