@salesforce/sfdx-agent-harness-mastra 0.12.0 → 0.13.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.
@@ -104,6 +104,14 @@ interface McpServerState {
104
104
  interface MastraAgentState {
105
105
  /** Mastra Agent instance. */
106
106
  agent: Agent;
107
+ /**
108
+ * The instructions string passed to the Mastra `Agent`'s constructor —
109
+ * `config.instructions` after rule bodies have been composed in (see
110
+ * `composeInstructionsWithRules`). Retained so `stream()` can surface
111
+ * it on the harness's debug log without re-deriving from the live
112
+ * Mastra `Agent`.
113
+ */
114
+ composedInstructions: string;
107
115
  /**
108
116
  * Pre-flight multimodal validation for this agent's model configuration.
109
117
  * Captured from {@link ResolvedModelConfig.validateFiles} at `createAgent`
@@ -623,6 +623,7 @@ export class MastraHarness {
623
623
  mastraAgentAdded = true;
624
624
  this.activeAgents.set(agentId, {
625
625
  agent,
626
+ composedInstructions,
626
627
  validateFiles,
627
628
  mcpServers: mcpServerStates,
628
629
  mcpConfig: config.mcpServers,
@@ -1026,6 +1027,24 @@ export class MastraHarness {
1026
1027
  agentState.streamBrokers.delete(threadId);
1027
1028
  }
1028
1029
  const streamInput = typeof message === 'string' ? message : this.toMastraStreamInput(agentState, message);
1030
+ // Debug-emit the composed instructions (config.instructions, with
1031
+ // any rule bodies appended by composeInstructionsWithRules) so
1032
+ // consumers — notably the dual-harness e2e suite — can
1033
+ // deterministically assert that `AgentConfig.rules` /
1034
+ // `AgentConfig.instructions` reached the underlying runtime, without
1035
+ // resorting to model-output marker assertions (#493). The Claude
1036
+ // harness emits the equivalent record from its own `stream()` so the
1037
+ // e2e captures the same record shape on both harnesses. Skip when
1038
+ // the assembled body is empty (no instructions, no rules) so the
1039
+ // emit guard matches the Claude harness's "skip when no system
1040
+ // prompt is configured" posture.
1041
+ if (agentState.composedInstructions.length > 0) {
1042
+ this.buses.getLogBus()?.debug('mastra harness assembled systemPrompt', {
1043
+ agentId,
1044
+ threadId,
1045
+ systemPrompt: agentState.composedInstructions,
1046
+ });
1047
+ }
1029
1048
  const output = await agentState.agent.stream(streamInput, {
1030
1049
  memory: {
1031
1050
  thread: threadId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sfdx-agent-harness-mastra",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Mastra-backed AgentHarness implementation for @salesforce/sfdx-agent-sdk",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,14 +35,14 @@
35
35
  "@mastra/memory": "^1.19.0",
36
36
  "@mastra/schema-compat": "^1.2.10",
37
37
  "@salesforce/agentic-common": "0.6.0",
38
- "@salesforce/llm-gateway-sdk": "0.9.0"
38
+ "@salesforce/llm-gateway-sdk": "0.10.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@salesforce/sfdx-agent-sdk": "0.13.0"
41
+ "@salesforce/sfdx-agent-sdk": "0.14.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@eslint/js": "^10.0.1",
45
- "@salesforce/sfdx-agent-sdk": "0.13.0",
45
+ "@salesforce/sfdx-agent-sdk": "0.14.0",
46
46
  "@types/node": "^22.19.17",
47
47
  "@vitest/coverage-istanbul": "^4.1.7",
48
48
  "@vitest/eslint-plugin": "^1.6.17",