@agentfield/sdk 0.1.142-rc.9 → 0.1.142

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/index.js CHANGED
@@ -5234,7 +5234,10 @@ var MemoryClientBase = class {
5234
5234
  baseURL: baseUrl.replace(/\/$/, ""),
5235
5235
  timeout: 3e4,
5236
5236
  httpAgent,
5237
- httpsAgent
5237
+ httpsAgent,
5238
+ // Memory API routes never redirect. Refuse all redirects to keep caller
5239
+ // identity and credentials on the configured control plane, even via proxies.
5240
+ maxRedirects: 0
5238
5241
  });
5239
5242
  this.defaultHeaders = this.sanitizeHeaders(defaultHeaders ?? {});
5240
5243
  }
@@ -6707,8 +6710,17 @@ var Agent = class {
6707
6710
  apiKey: this.config.apiKey,
6708
6711
  headers: this.sanitizeDefaultHeaders(this.config.defaultHeaders)
6709
6712
  });
6710
- this.memoryClient = new MemoryClient(this.config.agentFieldUrl, this.config.defaultHeaders);
6711
- this.memoryEventClient = new MemoryEventClient(this.config.agentFieldUrl, this.config.defaultHeaders);
6713
+ const memoryHeaders = { ...this.config.defaultHeaders };
6714
+ const hasMemoryHeader = (name) => Object.entries(memoryHeaders).some(([key, value]) => key.toLowerCase() === name.toLowerCase() && value != null);
6715
+ if (this.config.apiKey && !hasMemoryHeader("X-API-Key")) {
6716
+ memoryHeaders["X-API-Key"] = this.config.apiKey;
6717
+ }
6718
+ this.memoryClient = new MemoryClient(this.config.agentFieldUrl, memoryHeaders);
6719
+ const memoryEventHeaders = { ...memoryHeaders };
6720
+ if (!hasMemoryHeader("X-Agent-Node-ID")) {
6721
+ memoryEventHeaders["X-Agent-Node-ID"] = this.config.nodeId;
6722
+ }
6723
+ this.memoryEventClient = new MemoryEventClient(this.config.agentFieldUrl, memoryEventHeaders);
6712
6724
  this.didClient = new DidClient(this.config.agentFieldUrl, this.config.defaultHeaders);
6713
6725
  this.didManager = new DidManager(this.didClient, this.config.nodeId);
6714
6726
  this.executionLogger = createExecutionLogger({