negotium 0.1.19 → 0.1.20

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.
@@ -1907,6 +1907,19 @@ function vaultListWithValues(userId) {
1907
1907
  function vaultList(userId) {
1908
1908
  return activeVaultDatabase().prepare("SELECT key, description FROM vault WHERE user_id = ? ORDER BY key").all(userId);
1909
1909
  }
1910
+ function vaultSubstituteDetailed(userId, text) {
1911
+ const entries = new Map(vaultListWithValues(userId).map((entry) => [entry.key, entry.value]));
1912
+ const usedKeys = new Set;
1913
+ const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
1914
+ const key = normalizeVaultKey(rawKey);
1915
+ const value = entries.get(key);
1916
+ if (value === undefined)
1917
+ return match;
1918
+ usedKeys.add(key);
1919
+ return value;
1920
+ });
1921
+ return { text: substituted, usedKeys: [...usedKeys] };
1922
+ }
1910
1923
  function valueReferencesVaultKey(userId, value) {
1911
1924
  const keys = new Set(vaultList(userId).map((entry) => entry.key));
1912
1925
  const visit = (candidate) => {
@@ -2533,9 +2546,7 @@ var MCP_CATALOG = {
2533
2546
  vault: {
2534
2547
  ...commonRuntimeMcpPolicy("vault"),
2535
2548
  build({ userId, agent }) {
2536
- const args = [`--user-id=${userId}`];
2537
- if (agent === "codex")
2538
- args.push("--http-only=true");
2549
+ const args = [`--user-id=${userId}`, "--list-only=true"];
2539
2550
  return buildStdioMcpServer(agent, VAULT_SERVER, args);
2540
2551
  }
2541
2552
  }
@@ -2757,6 +2768,7 @@ function getMcpServersForQuery(opts) {
2757
2768
  var defaultHost = {
2758
2769
  getMcpServersForQuery,
2759
2770
  redactVaultSecrets,
2771
+ substituteVaultSecrets: (userId, value) => vaultSubstituteDetailed(userId, value).text,
2760
2772
  referencesRuntimeSecretStorage,
2761
2773
  shouldRedirectVaultTool,
2762
2774
  claudeCodeExecutablePath: () => CLAUDE_EXECUTABLE,
@@ -2779,12 +2791,12 @@ function hostedMcpServers(opts) {
2779
2791
  function redactHostedSecrets(userId, value) {
2780
2792
  return activeHost().redactVaultSecrets(userId, value);
2781
2793
  }
2794
+ function substituteHostedSecrets(userId, value) {
2795
+ return activeHost().substituteVaultSecrets(userId, value);
2796
+ }
2782
2797
  function referencesHostedSecretStorage(value) {
2783
2798
  return activeHost().referencesRuntimeSecretStorage(value);
2784
2799
  }
2785
- function shouldRedirectHostedVaultTool(userId, toolName, input) {
2786
- return activeHost().shouldRedirectVaultTool(userId, toolName, input);
2787
- }
2788
2800
  function hostedClaudeCodeExecutablePath() {
2789
2801
  return activeHost().claudeCodeExecutablePath();
2790
2802
  }
@@ -2836,6 +2848,9 @@ var CLAUDE_DEFAULT_DISALLOWED_TOOLS = [
2836
2848
  "TaskGet"
2837
2849
  ];
2838
2850
  var CLAUDE_NATIVE_AGENT_TOOLS = ["Task", "Agent", "TaskOutput", "TaskStop"];
2851
+ function substituteClaudeToolInput(userId, input) {
2852
+ return deepMapStrings(input, (value) => substituteHostedSecrets(userId, value));
2853
+ }
2839
2854
  function buildClaudeDisallowedTools(extra = undefined) {
2840
2855
  return [
2841
2856
  ...new Set([
@@ -3074,14 +3089,14 @@ async function* claudeProvider(opts) {
3074
3089
  };
3075
3090
  }
3076
3091
  const userId = opts.userId ?? "";
3077
- if (!shouldRedirectHostedVaultTool(userId, tool_name, tool_input)) {
3092
+ const withVault = substituteClaudeToolInput(userId, tool_input);
3093
+ if (JSON.stringify(withVault) === JSON.stringify(tool_input)) {
3078
3094
  return { continue: true };
3079
3095
  }
3080
3096
  return {
3081
3097
  hookSpecificOutput: {
3082
3098
  hookEventName: "PreToolUse",
3083
- permissionDecision: "deny",
3084
- permissionDecisionReason: VAULT_BROKER_REDIRECT_ERROR
3099
+ updatedInput: withVault
3085
3100
  }
3086
3101
  };
3087
3102
  }
@@ -3306,7 +3321,7 @@ import { createRequire } from "module";
3306
3321
  import { dirname as dirname6, join as join11 } from "path";
3307
3322
 
3308
3323
  // ../../packages/core/src/version.ts
3309
- var NEGOTIUM_VERSION = "0.1.19";
3324
+ var NEGOTIUM_VERSION = "0.1.20";
3310
3325
 
3311
3326
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
3312
3327
  var NEGOTIUM_MODEL_CATALOG = "negotium-model-catalog.json";
@@ -3941,14 +3956,12 @@ function buildMaestroDisallowedTools(callerDisallowedTools = []) {
3941
3956
  function buildVaultHook(userId) {
3942
3957
  return {
3943
3958
  name: "vault-guard",
3944
- pre({ toolName, input }) {
3959
+ pre({ input }) {
3945
3960
  if (referencesHostedSecretStorage(input)) {
3946
3961
  return { decision: "block", error: "Runtime secret storage access is not permitted" };
3947
3962
  }
3948
- if (shouldRedirectHostedVaultTool(userId, toolName, input)) {
3949
- return { decision: "block", error: VAULT_BROKER_REDIRECT_ERROR };
3950
- }
3951
- return { decision: "allow" };
3963
+ const substituted = deepMapStrings(input, (value) => substituteHostedSecrets(userId, value));
3964
+ return JSON.stringify(substituted) === JSON.stringify(input) ? { decision: "allow" } : { decision: "modify", input: substituted };
3952
3965
  },
3953
3966
  post({ output }) {
3954
3967
  const redacted = redactHostedSecrets(userId, output);
@@ -6242,4 +6255,4 @@ export {
6242
6255
  VAULT_BROKER_REDIRECT_ERROR
6243
6256
  };
6244
6257
 
6245
- //# debugId=305266BD0EF55A1F64756E2164756E21
6258
+ //# debugId=03A8268BD14CA74064756E2164756E21