@hoilab/ada-cli 0.84.17 → 0.84.18

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.
@@ -39,6 +39,7 @@ import { createLocalBashOperations } from "./tools/bash.js";
39
39
  import { createAllToolDefinitions } from "./tools/index.js";
40
40
  import { createMemoryEngineTools } from "./memory-engine/tools.js";
41
41
  import { redactSensitive } from "./memory-engine/security.js";
42
+ import { expandVaultRefs } from "./memory-engine/vault.js";
42
43
  import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
43
44
  import { addUsageToTotals, createUsageTotals } from "./usage-totals.js";
44
45
  /**
@@ -468,6 +469,8 @@ Task: given the CURRENT MEMORY and the LATEST CONVERSATION TURN, produce the COM
468
469
  // Track last assistant message for auto-compaction check
469
470
  _lastAssistantMessage = undefined;
470
471
  _lastAutoMemorizeAt = 0;
472
+ /** Redacted user-message content pending persistence (vault expansion). */
473
+ _pendingUserRedactions = [];
471
474
  /** Internal handler for agent events - shared by subscribe and reconnect */
472
475
  _handleAgentEvent = async (event) => {
473
476
  // When a user message starts, check if it's from either queue and remove it BEFORE emitting
@@ -527,8 +530,15 @@ Task: given the CURRENT MEMORY and the LATEST CONVERSATION TURN, produce the COM
527
530
  else if (event.message.role === "user" ||
528
531
  event.message.role === "assistant" ||
529
532
  event.message.role === "toolResult") {
530
- // Regular LLM message - persist as SessionMessageEntry
531
- this.sessionManager.appendMessage(event.message);
533
+ // Regular LLM message - persist as SessionMessageEntry.
534
+ // Vault expansion: persist the REDACTED form so secrets expanded
535
+ // from the vault never land in the session file.
536
+ let toPersist = event.message;
537
+ if (event.message.role === "user" && this._pendingUserRedactions.length > 0) {
538
+ const redactedText = this._pendingUserRedactions.shift();
539
+ toPersist = { ...event.message, content: [{ type: "text", text: redactedText }] };
540
+ }
541
+ this.sessionManager.appendMessage(toPersist);
532
542
  }
533
543
  // Other message types (bashExecution, compactionSummary, branchSummary) are persisted elsewhere
534
544
  // Track assistant message for auto-compaction (checked on agent_end)
@@ -1010,6 +1020,17 @@ Task: given the CURRENT MEMORY and the LATEST CONVERSATION TURN, produce the COM
1010
1020
  memoryEngine.checkUserTextForSensitive(expandedText);
1011
1021
  expandedText = redactSensitive(expandedText, memoryEngine.privacyLevel);
1012
1022
  }
1023
+ // Secure Vault: expand @vault:<name> references so the LLM can use
1024
+ // secrets without them ever being persisted. The redacted text is
1025
+ // kept for session persistence (applied in message_end).
1026
+ const vaultManager = this._resourceLoader.getVaultManager();
1027
+ if (vaultManager) {
1028
+ const expansion = expandVaultRefs(expandedText, vaultManager);
1029
+ if (expansion.expanded.length > 0) {
1030
+ this._pendingUserRedactions.push(expandedText);
1031
+ expandedText = expansion.text;
1032
+ }
1033
+ }
1013
1034
  // If streaming, queue via steer() or followUp() based on option
1014
1035
  if (this.isStreaming) {
1015
1036
  if (!options?.streamingBehavior) {