@salesforce/sfdx-agent-harness-mastra 0.89.0 → 0.90.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to `@salesforce/sfdx-agent-harness-mastra` are documented in this file.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
+ ## [0.90.0] - 2026-09-23
7
+
8
+ ### Fixes
9
+ - **harness-mastra**: emit full llm-request body in wire-communication events (remove 256KB truncation) @W-24280587@ ([#839](https://github.com/forcedotcom/agentic-dx/pull/839))
10
+
11
+ ### Chores
12
+ - **deps**: bump @ai-sdk/provider from 4.0.4 to 4.0.14 ([#838](https://github.com/forcedotcom/agentic-dx/pull/838))
13
+
6
14
  ## [0.89.0] - 2026-09-21
7
15
 
8
16
  ### Features
@@ -280,11 +280,13 @@ export type GatewayFetchWireHooks = {
280
280
  * fetch resolution to HTTP-body terminality: an owned tee branch observes only
281
281
  * recognized assistant text deltas without blocking the provider SDK's branch.
282
282
  * Wire-communication events are best-effort: a failed body decode does NOT
283
- * prevent the call from completing. Body capture is
284
- * intentionally bounded — only requests with a JSON body shorter than 256 KB
285
- * are decoded; longer bodies are recorded as `{ truncated: true, byteLength:
286
- * <n> }` so wire-communication captures don't blow the consumer's log file
287
- * budget.
283
+ * prevent the call from completing. When a subscriber is present the request
284
+ * body is captured in full with no size cap (W-24280587) — the channel is
285
+ * opt-in and diagnostic, so fidelity wins; with no subscriber the decode is
286
+ * skipped entirely (the event is dropped by the wire bus anyway), so a
287
+ * subscriber-less production process pays no full-body parse on the hot path.
288
+ * (The streaming *response* observer separately bounds its in-memory text
289
+ * capture at `TRACE_BODY_BYTE_BUDGET`.)
288
290
  */
289
291
  export declare function createGatewayFetch(getHeaders: () => Record<string, string> | Promise<Record<string, string>>, wireHooks?: GatewayFetchWireHooks, innerFetch?: typeof fetch,
290
292
  /**
@@ -353,11 +353,13 @@ export function mapOpenAIUsage(usage) {
353
353
  * fetch resolution to HTTP-body terminality: an owned tee branch observes only
354
354
  * recognized assistant text deltas without blocking the provider SDK's branch.
355
355
  * Wire-communication events are best-effort: a failed body decode does NOT
356
- * prevent the call from completing. Body capture is
357
- * intentionally bounded — only requests with a JSON body shorter than 256 KB
358
- * are decoded; longer bodies are recorded as `{ truncated: true, byteLength:
359
- * <n> }` so wire-communication captures don't blow the consumer's log file
360
- * budget.
356
+ * prevent the call from completing. When a subscriber is present the request
357
+ * body is captured in full with no size cap (W-24280587) — the channel is
358
+ * opt-in and diagnostic, so fidelity wins; with no subscriber the decode is
359
+ * skipped entirely (the event is dropped by the wire bus anyway), so a
360
+ * subscriber-less production process pays no full-body parse on the hot path.
361
+ * (The streaming *response* observer separately bounds its in-memory text
362
+ * capture at `TRACE_BODY_BYTE_BUDGET`.)
361
363
  */
362
364
  export function createGatewayFetch(getHeaders, wireHooks, innerFetch = globalThis.fetch,
363
365
  /**
@@ -411,6 +413,13 @@ logBus) {
411
413
  const startedAt = clock.now();
412
414
  const correlationId = (wireHooks.idGenerator ?? new UUIDGenerator()).getUniqueId();
413
415
  const requestStart = performance.now();
416
+ // Decode the (now uncapped) request body ONLY when a subscriber is
417
+ // listening — mirroring the response-observer gating below. In production
418
+ // `wireHooks` is always supplied but subscribers are usually absent, and a
419
+ // real turn's body is large, so an unconditional full-body JSON.parse would
420
+ // be pure hot-path waste for a subscriber-less process (the event is dropped
421
+ // by the wire bus anyway). Fidelity for actual subscribers is unchanged.
422
+ const hasWireSubscribers = wireHooks.hasWireCommunicationSubscribers?.() ?? true;
414
423
  wireHooks.emitWireCommunication({
415
424
  type: 'llm-request',
416
425
  timestamp: startedAt,
@@ -418,7 +427,7 @@ logBus) {
418
427
  method,
419
428
  model,
420
429
  correlationId,
421
- body: tryDecodeBody(finalInit.body),
430
+ body: hasWireSubscribers ? tryDecodeBody(finalInit.body) : undefined,
422
431
  });
423
432
  try {
424
433
  const response = await innerFetch(input, finalInit);
@@ -791,10 +800,11 @@ function tryDecodeBody(body) {
791
800
  return undefined;
792
801
  if (typeof body !== 'string')
793
802
  return undefined; // Streams / FormData / Blob: skip.
794
- const byteLength = Buffer.byteLength(body, 'utf8');
795
- if (byteLength > TRACE_BODY_BYTE_BUDGET) {
796
- return { truncated: true, byteLength };
797
- }
803
+ // No size cap: the wire-communication channel is opt-in, subscriber-gated, and
804
+ // purely diagnostic — its whole point is fidelity, so emit the full request body
805
+ // (system / messages / tools) verbatim. (W-24280587; a 256 KB cap here used to
806
+ // replace large bodies with a `{ truncated, byteLength }` stub, hiding exactly
807
+ // the fields the channel exists to show.)
798
808
  try {
799
809
  const parsed = JSON.parse(body);
800
810
  return typeof parsed === 'object' && parsed !== null ? parsed : { value: parsed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sfdx-agent-harness-mastra",
3
- "version": "0.89.0",
3
+ "version": "0.90.0",
4
4
  "description": "Mastra-backed AgentHarness implementation for @salesforce/sfdx-agent-sdk",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "LICENSE.txt"
30
30
  ],
31
31
  "dependencies": {
32
- "@ai-sdk/provider": "4.0.4",
32
+ "@ai-sdk/provider": "4.0.14",
33
33
  "@anthropic-ai/bedrock-sdk": "^0.33.6",
34
34
  "@anthropic-ai/sdk": "^0.126.0",
35
35
  "@mastra/core": "^1.67.0",
@@ -42,12 +42,12 @@
42
42
  "openai": "^7.17.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@salesforce/sfdx-agent-sdk": "0.90.0"
45
+ "@salesforce/sfdx-agent-sdk": "0.91.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@eslint/js": "^10.0.1",
49
49
  "@salesforce/harness-conformance": "0.0.1",
50
- "@salesforce/sfdx-agent-sdk": "0.90.0",
50
+ "@salesforce/sfdx-agent-sdk": "0.91.0",
51
51
  "@types/node": "^22.20.1",
52
52
  "@vitest/coverage-istanbul": "^5.0.1",
53
53
  "@vitest/eslint-plugin": "^1.6.27",