@1agh/maude 2.2.1 → 2.3.2

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 (91) hide show
  1. package/apps/studio/acp/agents/auth.ts +241 -0
  2. package/apps/studio/acp/agents/catalog.ts +308 -0
  3. package/apps/studio/acp/agents/chat-key.ts +64 -0
  4. package/apps/studio/acp/agents/conformance.ts +1853 -0
  5. package/apps/studio/acp/agents/consent.ts +92 -0
  6. package/apps/studio/acp/agents/descriptor.ts +188 -0
  7. package/apps/studio/acp/agents/discover.ts +491 -0
  8. package/apps/studio/acp/agents/e2e-model.ts +58 -0
  9. package/apps/studio/acp/agents/health.ts +46 -0
  10. package/apps/studio/acp/agents/link-scan.ts +230 -0
  11. package/apps/studio/acp/agents/spawn.ts +164 -0
  12. package/apps/studio/acp/agents/state.ts +132 -0
  13. package/apps/studio/acp/ask-queue.ts +13 -4
  14. package/apps/studio/acp/bootstrap-brief.ts +16 -3
  15. package/apps/studio/acp/bridge.ts +709 -99
  16. package/apps/studio/acp/env.ts +43 -1
  17. package/apps/studio/acp/index.ts +428 -43
  18. package/apps/studio/acp/may-scope.ts +244 -21
  19. package/apps/studio/acp/policy/agent-home.ts +202 -0
  20. package/apps/studio/acp/policy/bridge-gate.ts +68 -0
  21. package/apps/studio/acp/policy/codex-home.ts +228 -0
  22. package/apps/studio/acp/policy/enforce.ts +620 -0
  23. package/apps/studio/acp/policy/gate-types.ts +41 -0
  24. package/apps/studio/acp/policy/launch-codex.ts +351 -0
  25. package/apps/studio/acp/policy/launch-copilot.ts +119 -0
  26. package/apps/studio/acp/policy/launch-gemini.ts +120 -0
  27. package/apps/studio/acp/policy/launch-opencode.ts +131 -0
  28. package/apps/studio/acp/policy/opencode-user-config.ts +240 -0
  29. package/apps/studio/acp/probe.ts +78 -14
  30. package/apps/studio/acp/transcript.ts +14 -0
  31. package/apps/studio/acp/write-scope.ts +62 -2
  32. package/apps/studio/annotations-layer.tsx +8 -0
  33. package/apps/studio/bin/_capture-init.js +5 -0
  34. package/apps/studio/bin/screenshot.sh +7 -1
  35. package/apps/studio/bridge/dgn-protocol.ts +3 -2
  36. package/apps/studio/canvas-shell.tsx +54 -0
  37. package/apps/studio/client/panels/ChatPanel.jsx +19 -4
  38. package/apps/studio/client/panels/PermissionPrompt.jsx +11 -6
  39. package/apps/studio/client/panels/SyncConsentDialog.jsx +4 -1
  40. package/apps/studio/client/panels/acp-runtime.js +95 -7
  41. package/apps/studio/client/v2/ai/Advanced.jsx +4 -3
  42. package/apps/studio/client/v2/ai/AgentNotice.jsx +138 -0
  43. package/apps/studio/client/v2/ai/AgentOffer.jsx +110 -0
  44. package/apps/studio/client/v2/ai/AgentPicker.jsx +121 -0
  45. package/apps/studio/client/v2/ai/Composer.jsx +4 -0
  46. package/apps/studio/client/v2/ai/ConnectSheet.jsx +13 -0
  47. package/apps/studio/client/v2/ai/Feed.jsx +8 -0
  48. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +24 -1
  49. package/apps/studio/client/v2/ai/Suggest.jsx +5 -1
  50. package/apps/studio/client/v2/ai/advanced-model.js +17 -6
  51. package/apps/studio/client/v2/ai/agents-model.js +333 -0
  52. package/apps/studio/client/v2/ai/agents-store.js +223 -0
  53. package/apps/studio/client/v2/ai/ai.css +63 -0
  54. package/apps/studio/client/v2/ai/needs-you.js +1 -1
  55. package/apps/studio/client/v2/empty/empty-host.jsx +11 -2
  56. package/apps/studio/client/v2/empty/use-empty-canvas.js +22 -7
  57. package/apps/studio/client/v2/fold/fold-store.js +1 -0
  58. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +1 -0
  59. package/apps/studio/client/v2/settings/agent-keys.js +88 -0
  60. package/apps/studio/client/v2/settings/agents-card.jsx +408 -0
  61. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  62. package/apps/studio/client/v2/settings/connections-section.jsx +4 -0
  63. package/apps/studio/client/v2/settings/settings-cards.js +2 -1
  64. package/apps/studio/client/v2/settings/settings-model.js +1 -0
  65. package/apps/studio/client/v2/settings/settings.css +7 -0
  66. package/apps/studio/client/v2/shell/served-routes.js +1 -0
  67. package/apps/studio/client/v2/undo/zoom-undo.jsx +19 -2
  68. package/apps/studio/cloud-build.ts +5 -0
  69. package/apps/studio/comments/reveal.ts +13 -0
  70. package/apps/studio/comments-overlay.tsx +36 -0
  71. package/apps/studio/dist/client.bundle.js +535 -535
  72. package/apps/studio/dist/comment-mount.js +2 -2
  73. package/apps/studio/dist/styles.css +1 -1
  74. package/apps/studio/editing/annotation-count.ts +25 -0
  75. package/apps/studio/editing/empty-report.ts +8 -3
  76. package/apps/studio/editing/empty-reporter.tsx +10 -1
  77. package/apps/studio/generation/keys.ts +197 -11
  78. package/apps/studio/outbox/policy.ts +8 -2
  79. package/apps/studio/outbox/types.ts +5 -0
  80. package/apps/studio/routes/agents.ts +479 -0
  81. package/apps/studio/routes/index.ts +3 -0
  82. package/apps/studio/scripts/acp-conformance-local.ts +95 -0
  83. package/apps/studio/scripts/acp-e2e-local.ts +1026 -0
  84. package/apps/studio/server.ts +9 -0
  85. package/apps/studio/sync/index.ts +9 -1
  86. package/apps/studio/sync/writer-registry.ts +12 -0
  87. package/apps/studio/whats-new.json +19 -0
  88. package/apps/studio/ws.ts +3 -0
  89. package/cli/commands/codex.mjs +36 -2
  90. package/cli/lib/harness/codex-runtime.mjs +98 -11
  91. package/package.json +9 -8
@@ -8,6 +8,14 @@
8
8
  // equivalent auth-token override) from the child env before spawning. This is
9
9
  // the single load-bearing detail that makes the whole panel subscription-correct
10
10
  // — the guarantee lives here, at the bottom of the stack, independent of the UI.
11
+ //
12
+ // DDR-252 amends DDR-123: "never metered billing UNLESS the person turned it on in Maude". This
13
+ // scrub is unchanged and still drops every ANTHROPIC_* the parent carries. The one way back is the
14
+ // per-profile Advanced opt-in ("Use an Anthropic API key for Claude instead of your Claude
15
+ // account"): acp/agents/chat-key.ts then re-adds ONLY `ANTHROPIC_API_KEY`, from the 0600 key store
16
+ // (generation/keys.ts) — never from the inherited env — into the Claude adapter's env alone, after
17
+ // this scrub (acp/agents/spawn.ts). Opt-in off → the Claude spawn is byte-identical to before
18
+ // (test/acp-agent-spawn.test.ts, test/acp-chat-keys.test.ts).
11
19
 
12
20
  /**
13
21
  * Env var names that flip Claude Code off the subscription and onto metered API
@@ -76,6 +84,35 @@ const GENERATION_KEY_CUSTODY_RE = /^MAUDE_GEN_KEY/i;
76
84
  */
77
85
  const SHELL_SECRET_RE = /^MAUDE_(TOKEN|SHELL|HOME)_/i;
78
86
 
87
+ /**
88
+ * Universal ACP (DDR-252, contract rule 14) — other vendors' credentials. Every agent, Claude
89
+ * included, loses them: a Codex key in the person's shell must not ride into Gemini, and none of
90
+ * them into Claude. An agent that needs one names it in its descriptor's `envAllow` — the only
91
+ * keys `envAllow` can bring back (ANTHROPIC_* and Maude's own secrets never come back).
92
+ *
93
+ * Security review 2026-11-12 (defender M7): every `OPENCODE_*` and `CODEX_*` too, not only their
94
+ * keys. opencode reads `OPENCODE_PERMISSION` / `OPENCODE_CONFIG` / `OPENCODE_CONFIG_DIR` and Codex
95
+ * `CODEX_HOME` / `CODEX_CONFIG` from its env, so an inherited one could override Maude's launch
96
+ * policy. The launch policy adds back exactly the ones it sets (spawn.ts passes its keys as the
97
+ * allow list).
98
+ */
99
+ const AGENT_SECRET_RE = /^(OPENAI_|GEMINI_|COPILOT_|OPENCODE_|CODEX_)/i;
100
+ const AGENT_SECRET_KEYS: ReadonlySet<string> = new Set([
101
+ 'CODEX_API_KEY',
102
+ 'GOOGLE_API_KEY',
103
+ 'GOOGLE_APPLICATION_CREDENTIALS',
104
+ 'GITHUB_TOKEN',
105
+ 'GH_TOKEN',
106
+ 'OPENCODE_API_KEY',
107
+ 'OPENCODE_AUTH_CONTENT',
108
+ 'OPENCODE_CONSOLE_TOKEN',
109
+ ]);
110
+
111
+ /** True for a vendor credential the shared scrub drops (rule 14) and `envAllow` may re-add. */
112
+ export function isAgentSecretKey(key: string): boolean {
113
+ return AGENT_SECRET_RE.test(key) || AGENT_SECRET_KEYS.has(key.toUpperCase());
114
+ }
115
+
79
116
  /** V2-8.9 M2 — the profile's credential-file pointers (sidecar::profile_env), never the agent's. */
80
117
  const PROFILE_POINTER_KEYS: ReadonlySet<string> = new Set([
81
118
  'MAUDE_CLOUD_CONFIG',
@@ -134,14 +171,19 @@ export function teamsSpawnEnv(
134
171
  * Return a copy of `source` with the billing/provider-redirect keys removed and
135
172
  * any `undefined` values dropped (Bun.spawn's `env` wants Record<string,string>).
136
173
  * Pure — never mutates the input, so `process.env` stays intact for the parent.
174
+ *
175
+ * `allow` (a descriptor's `envAllow`) keeps the named vendor credentials (`isAgentSecretKey`) and
176
+ * nothing else: Anthropic billing keys and Maude's own secrets are dropped whatever it says.
137
177
  */
138
178
  export function scrubAgentEnv(
139
- source: Record<string, string | undefined> = process.env
179
+ source: Record<string, string | undefined> = process.env,
180
+ allow: readonly string[] = []
140
181
  ): Record<string, string> {
141
182
  const out: Record<string, string> = {};
142
183
  for (const [key, value] of Object.entries(source)) {
143
184
  if (value === undefined) continue;
144
185
  if (PROVIDER_REDIRECT_RE.test(key)) continue;
186
+ if (isAgentSecretKey(key) && !allow.includes(key)) continue;
145
187
  if (GENERATION_KEY_CUSTODY_RE.test(key)) continue;
146
188
  // The cell materializer's loopback credential is the studio's alone — an
147
189
  // agent it spawns has no business filling the cache (Phase 1 review L3).