@salesforce/sfdx-agent-harness-mastra 0.93.0 → 0.94.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,11 @@
|
|
|
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.94.0] - 2026-10-01
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
- **harness-mastra**: persist declined tool-call reason from approval.reason @W-24066893@ ([#850](https://github.com/forcedotcom/agentic-dx/pull/850))
|
|
10
|
+
|
|
6
11
|
## [0.93.0] - 2026-09-29
|
|
7
12
|
|
|
8
13
|
### Features
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright 2026, Salesforce, Inc. All rights reserved.
|
|
3
3
|
* See LICENSE.txt for license terms.
|
|
4
4
|
*/
|
|
5
|
+
import { DEFAULT_TOOL_DECLINE_REASON } from '@mastra/core/agent';
|
|
5
6
|
import { CONTEXT_LENGTH_EXCEEDED_CODE, createContextLengthExceededError } from '@salesforce/sfdx-agent-sdk';
|
|
6
7
|
import { hasToolArgsValidationErrorMarker } from './tool-args-marker.js';
|
|
7
8
|
import { isClassifiedStreamError } from './stream-errors.js';
|
|
@@ -140,7 +141,7 @@ export class MastraEventAdapter {
|
|
|
140
141
|
type: 'tool-result',
|
|
141
142
|
toolCallId: chunk.payload.toolCallId,
|
|
142
143
|
toolName: chunk.payload.toolName,
|
|
143
|
-
result: chunk.payload.approval.reason ??
|
|
144
|
+
result: chunk.payload.approval.reason ?? DEFAULT_TOOL_DECLINE_REASON,
|
|
144
145
|
isError: true,
|
|
145
146
|
};
|
|
146
147
|
case 'step-start':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MastraDBMessage, type MastraMessagePart } from '@mastra/core/agent';
|
|
2
2
|
import type { Message, MessagePart } from '@salesforce/sfdx-agent-sdk';
|
|
3
3
|
import type { LogBus } from '@salesforce/agentic-common';
|
|
4
4
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright 2026, Salesforce, Inc. All rights reserved.
|
|
3
3
|
* See LICENSE.txt for license terms.
|
|
4
4
|
*/
|
|
5
|
+
import { DEFAULT_TOOL_DECLINE_REASON } from '@mastra/core/agent';
|
|
5
6
|
import { hasToolArgsValidationErrorMarker } from './tool-args-marker.js';
|
|
6
7
|
/**
|
|
7
8
|
* Reads the SDK `fileName` stashed under `providerMetadata.salesforce.fileName` when a file part
|
|
@@ -188,14 +189,24 @@ export function mapMastraPartToMessagePart(part, logBus) {
|
|
|
188
189
|
// Prefer the structured `result` (the write path preserves it
|
|
189
190
|
// alongside `errorText`) so a non-string error payload round-trips
|
|
190
191
|
// as an object, not a JSON string; fall back to `errorText` for
|
|
191
|
-
// natively-persisted error invocations that carry only that.
|
|
192
|
+
// natively-persisted error invocations that carry only that. A
|
|
193
|
+
// decline persists as `output-denied` carrying its reason on
|
|
194
|
+
// `approval.reason` (no `result`/`errorText`), so read that last —
|
|
195
|
+
// otherwise the declined call's message is lost on reload. A
|
|
196
|
+
// compatible persisted record can omit the optional reason;
|
|
197
|
+
// use Mastra's default denial text as the final fallback for that
|
|
198
|
+
// state so history never reloads an empty decline.
|
|
192
199
|
return [
|
|
193
200
|
toolCall,
|
|
194
201
|
{
|
|
195
202
|
type: 'tool-result',
|
|
196
203
|
toolCallId: inv.toolCallId,
|
|
197
204
|
toolName: inv.toolName,
|
|
198
|
-
result: inv.result ??
|
|
205
|
+
result: inv.result ??
|
|
206
|
+
inv.errorText ??
|
|
207
|
+
(inv.state === 'output-denied'
|
|
208
|
+
? (inv.approval?.reason ?? DEFAULT_TOOL_DECLINE_REASON)
|
|
209
|
+
: undefined),
|
|
199
210
|
isError: true,
|
|
200
211
|
},
|
|
201
212
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sfdx-agent-harness-mastra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"description": "Mastra-backed AgentHarness implementation for @salesforce/sfdx-agent-sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"openai": "^7.23.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@salesforce/sfdx-agent-sdk": "0.
|
|
45
|
+
"@salesforce/sfdx-agent-sdk": "0.95.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.
|
|
50
|
+
"@salesforce/sfdx-agent-sdk": "0.95.0",
|
|
51
51
|
"@types/node": "^22.20.1",
|
|
52
52
|
"@vitest/coverage-istanbul": "^5.0.1",
|
|
53
53
|
"@vitest/eslint-plugin": "^1.6.27",
|