negotium 0.1.19 → 0.1.21

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.
Files changed (46) hide show
  1. package/dist/agent-helpers.js +146 -23
  2. package/dist/agent-helpers.js.map +14 -12
  3. package/dist/cron.js +137 -52
  4. package/dist/cron.js.map +20 -19
  5. package/dist/hosted-agent.js +29 -17
  6. package/dist/hosted-agent.js.map +7 -7
  7. package/dist/main.js +145 -55
  8. package/dist/main.js.map +20 -19
  9. package/dist/mcp-factories.js +23 -22
  10. package/dist/mcp-factories.js.map +3 -3
  11. package/dist/prompts.js +98 -9
  12. package/dist/prompts.js.map +6 -5
  13. package/dist/runtime/scripts/browser-passkey-policy.mjs +36 -0
  14. package/dist/runtime/scripts/browser-vault-transform.mjs +33 -0
  15. package/dist/runtime/scripts/mcp-patchright-http.mjs +22 -4
  16. package/dist/runtime/src/agents/archiver.ts +0 -14
  17. package/dist/runtime/src/agents/claude-provider.ts +11 -7
  18. package/dist/runtime/src/agents/execution-host.ts +10 -1
  19. package/dist/runtime/src/agents/idle-archiver.ts +21 -0
  20. package/dist/runtime/src/agents/maestro-provider.ts +9 -14
  21. package/dist/runtime/src/agents/mcp-tools/self-config.ts +1 -1
  22. package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +6 -1
  23. package/dist/runtime/src/agents/memory-archive-policy.ts +34 -0
  24. package/dist/runtime/src/agents/model-catalog.ts +84 -18
  25. package/dist/runtime/src/mcp/factories/vault.ts +36 -34
  26. package/dist/runtime/src/mcp/vault-server.ts +1 -0
  27. package/dist/runtime/src/platform/mcp-config.ts +4 -8
  28. package/dist/runtime/src/platform/playwright/manager.ts +5 -2
  29. package/dist/runtime/src/prompts/builders.ts +36 -7
  30. package/dist/runtime/src/runtime/turn-runner.ts +2 -0
  31. package/dist/runtime/src/storage/topic-archive.ts +5 -2
  32. package/dist/runtime/src/topics/lifecycle.ts +2 -1
  33. package/dist/runtime/src/topics/session.ts +2 -0
  34. package/dist/runtime/src/version.ts +1 -1
  35. package/dist/storage.js +23 -3
  36. package/dist/storage.js.map +5 -4
  37. package/dist/types/packages/core/src/agents/claude-provider.d.ts +1 -0
  38. package/dist/types/packages/core/src/agents/execution-host.d.ts +2 -0
  39. package/dist/types/packages/core/src/agents/idle-archiver.d.ts +2 -0
  40. package/dist/types/packages/core/src/agents/memory-archive-policy.d.ts +14 -0
  41. package/dist/types/packages/core/src/agents/model-catalog.d.ts +77 -0
  42. package/dist/types/packages/core/src/mcp/factories/vault.d.ts +1 -0
  43. package/dist/types/packages/core/src/prompts/builders.d.ts +5 -1
  44. package/dist/types/packages/core/src/storage/topic-archive.d.ts +1 -0
  45. package/dist/types/packages/core/src/version.d.ts +1 -1
  46. package/package.json +2 -2
@@ -854,6 +854,19 @@ function vaultListWithValues(userId) {
854
854
  function vaultList(userId) {
855
855
  return activeVaultDatabase().prepare("SELECT key, description FROM vault WHERE user_id = ? ORDER BY key").all(userId);
856
856
  }
857
+ function vaultSubstituteDetailed(userId, text) {
858
+ const entries = new Map(vaultListWithValues(userId).map((entry) => [entry.key, entry.value]));
859
+ const usedKeys = new Set;
860
+ const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
861
+ const key = normalizeVaultKey(rawKey);
862
+ const value = entries.get(key);
863
+ if (value === undefined)
864
+ return match;
865
+ usedKeys.add(key);
866
+ return value;
867
+ });
868
+ return { text: substituted, usedKeys: [...usedKeys] };
869
+ }
857
870
  function valueReferencesVaultKey(userId, value) {
858
871
  const keys = new Set(vaultList(userId).map((entry) => entry.key));
859
872
  const visit = (candidate) => {
@@ -919,7 +932,6 @@ var SENSITIVE_RUNTIME_NAMES = [
919
932
  "runtime-mcp-secret",
920
933
  "sessions.db"
921
934
  ];
922
- var VAULT_BROKER_REDIRECT_ERROR = "Vault placeholders must be executed through mcp__vault__vault_run (shell/CLI) or mcp__vault__vault_http_request (HTTP) so secret values cannot enter the model transcript.";
923
935
  function createVaultToolPolicy(host) {
924
936
  function isVaultBrokerTool(toolName) {
925
937
  return toolName.includes("vault_run") || toolName.includes("vault_http_request");
@@ -1456,9 +1468,7 @@ var MCP_CATALOG = {
1456
1468
  vault: {
1457
1469
  ...commonRuntimeMcpPolicy("vault"),
1458
1470
  build({ userId, agent }) {
1459
- const args = [`--user-id=${userId}`];
1460
- if (agent === "codex")
1461
- args.push("--http-only=true");
1471
+ const args = [`--user-id=${userId}`, "--list-only=true"];
1462
1472
  return buildStdioMcpServer(agent, VAULT_SERVER, args);
1463
1473
  }
1464
1474
  }
@@ -1680,6 +1690,7 @@ function getMcpServersForQuery(opts) {
1680
1690
  var defaultHost = {
1681
1691
  getMcpServersForQuery,
1682
1692
  redactVaultSecrets,
1693
+ substituteVaultSecrets: (userId, value) => vaultSubstituteDetailed(userId, value).text,
1683
1694
  referencesRuntimeSecretStorage,
1684
1695
  shouldRedirectVaultTool,
1685
1696
  claudeCodeExecutablePath: () => CLAUDE_EXECUTABLE,
@@ -1721,12 +1732,12 @@ function hostedMcpServers(opts) {
1721
1732
  function redactHostedSecrets(userId, value) {
1722
1733
  return activeHost().redactVaultSecrets(userId, value);
1723
1734
  }
1735
+ function substituteHostedSecrets(userId, value) {
1736
+ return activeHost().substituteVaultSecrets(userId, value);
1737
+ }
1724
1738
  function referencesHostedSecretStorage(value) {
1725
1739
  return activeHost().referencesRuntimeSecretStorage(value);
1726
1740
  }
1727
- function shouldRedirectHostedVaultTool(userId, toolName, input) {
1728
- return activeHost().shouldRedirectVaultTool(userId, toolName, input);
1729
- }
1730
1741
  function transformHostedQueryOptions(opts) {
1731
1742
  return activeHost().transformQueryOptions?.(opts) ?? opts;
1732
1743
  }
@@ -1781,6 +1792,9 @@ var CLAUDE_DEFAULT_DISALLOWED_TOOLS = [
1781
1792
  "TaskGet"
1782
1793
  ];
1783
1794
  var CLAUDE_NATIVE_AGENT_TOOLS = ["Task", "Agent", "TaskOutput", "TaskStop"];
1795
+ function substituteClaudeToolInput(userId, input) {
1796
+ return deepMapStrings(input, (value) => substituteHostedSecrets(userId, value));
1797
+ }
1784
1798
  function buildClaudeDisallowedTools(extra = undefined) {
1785
1799
  return [
1786
1800
  ...new Set([
@@ -2019,14 +2033,14 @@ async function* claudeProvider(opts) {
2019
2033
  };
2020
2034
  }
2021
2035
  const userId = opts.userId ?? "";
2022
- if (!shouldRedirectHostedVaultTool(userId, tool_name, tool_input)) {
2036
+ const withVault = substituteClaudeToolInput(userId, tool_input);
2037
+ if (JSON.stringify(withVault) === JSON.stringify(tool_input)) {
2023
2038
  return { continue: true };
2024
2039
  }
2025
2040
  return {
2026
2041
  hookSpecificOutput: {
2027
2042
  hookEventName: "PreToolUse",
2028
- permissionDecision: "deny",
2029
- permissionDecisionReason: VAULT_BROKER_REDIRECT_ERROR
2043
+ updatedInput: withVault
2030
2044
  }
2031
2045
  };
2032
2046
  }
@@ -2251,7 +2265,7 @@ import { createRequire } from "module";
2251
2265
  import { dirname as dirname4, join as join6 } from "path";
2252
2266
 
2253
2267
  // ../../packages/core/src/version.ts
2254
- var NEGOTIUM_VERSION = "0.1.19";
2268
+ var NEGOTIUM_VERSION = "0.1.21";
2255
2269
 
2256
2270
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2257
2271
  var NEGOTIUM_MODEL_CATALOG = "negotium-model-catalog.json";
@@ -3259,14 +3273,12 @@ function buildMaestroDisallowedTools(callerDisallowedTools = []) {
3259
3273
  function buildVaultHook(userId) {
3260
3274
  return {
3261
3275
  name: "vault-guard",
3262
- pre({ toolName, input }) {
3276
+ pre({ input }) {
3263
3277
  if (referencesHostedSecretStorage(input)) {
3264
3278
  return { decision: "block", error: "Runtime secret storage access is not permitted" };
3265
3279
  }
3266
- if (shouldRedirectHostedVaultTool(userId, toolName, input)) {
3267
- return { decision: "block", error: VAULT_BROKER_REDIRECT_ERROR };
3268
- }
3269
- return { decision: "allow" };
3280
+ const substituted = deepMapStrings(input, (value) => substituteHostedSecrets(userId, value));
3281
+ return JSON.stringify(substituted) === JSON.stringify(input) ? { decision: "allow" } : { decision: "modify", input: substituted };
3270
3282
  },
3271
3283
  post({ output }) {
3272
3284
  const redacted = redactHostedSecrets(userId, output);
@@ -3403,4 +3415,4 @@ export {
3403
3415
  buildClaudeDisallowedTools
3404
3416
  };
3405
3417
 
3406
- //# debugId=04B2126C9241989C64756E2164756E21
3418
+ //# debugId=8285C4044AB0E6D764756E2164756E21