@1agh/maude 2.2.0 → 2.3.1

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 (79) 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/canvas-pages-view.tsx +3 -2
  33. package/apps/studio/canvas-theme-pill.tsx +125 -72
  34. package/apps/studio/client/panels/ChatPanel.jsx +19 -4
  35. package/apps/studio/client/panels/PermissionPrompt.jsx +11 -6
  36. package/apps/studio/client/panels/acp-runtime.js +95 -7
  37. package/apps/studio/client/v2/ai/Advanced.jsx +4 -3
  38. package/apps/studio/client/v2/ai/AgentNotice.jsx +138 -0
  39. package/apps/studio/client/v2/ai/AgentOffer.jsx +110 -0
  40. package/apps/studio/client/v2/ai/AgentPicker.jsx +121 -0
  41. package/apps/studio/client/v2/ai/Composer.jsx +4 -0
  42. package/apps/studio/client/v2/ai/ConnectSheet.jsx +13 -0
  43. package/apps/studio/client/v2/ai/Feed.jsx +8 -0
  44. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +24 -1
  45. package/apps/studio/client/v2/ai/Suggest.jsx +5 -1
  46. package/apps/studio/client/v2/ai/advanced-model.js +17 -6
  47. package/apps/studio/client/v2/ai/agents-model.js +333 -0
  48. package/apps/studio/client/v2/ai/agents-store.js +223 -0
  49. package/apps/studio/client/v2/ai/ai.css +63 -0
  50. package/apps/studio/client/v2/ai/needs-you.js +1 -1
  51. package/apps/studio/client/v2/fold/fold-store.js +1 -0
  52. package/apps/studio/client/v2/left-panel/left-panel.css +8 -0
  53. package/apps/studio/client/v2/settings/agent-keys.js +88 -0
  54. package/apps/studio/client/v2/settings/agents-card.jsx +408 -0
  55. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  56. package/apps/studio/client/v2/settings/connections-section.jsx +4 -0
  57. package/apps/studio/client/v2/settings/settings-cards.js +2 -1
  58. package/apps/studio/client/v2/settings/settings-model.js +1 -0
  59. package/apps/studio/client/v2/settings/settings.css +7 -0
  60. package/apps/studio/client/v2/shell/served-routes.js +1 -0
  61. package/apps/studio/cloud-build.ts +5 -0
  62. package/apps/studio/dist/client.bundle.js +604 -604
  63. package/apps/studio/dist/styles.css +1 -1
  64. package/apps/studio/ds/board/board.css +4 -78
  65. package/apps/studio/ds/board/ds-bar.tsx +15 -9
  66. package/apps/studio/generation/keys.ts +197 -11
  67. package/apps/studio/outbox/policy.ts +8 -2
  68. package/apps/studio/outbox/types.ts +5 -0
  69. package/apps/studio/routes/agents.ts +479 -0
  70. package/apps/studio/routes/index.ts +3 -0
  71. package/apps/studio/scripts/acp-conformance-local.ts +95 -0
  72. package/apps/studio/scripts/acp-e2e-local.ts +1026 -0
  73. package/apps/studio/server.ts +9 -0
  74. package/apps/studio/sync/writer-registry.ts +12 -0
  75. package/apps/studio/whats-new.json +19 -0
  76. package/apps/studio/ws.ts +3 -0
  77. package/cli/commands/codex.mjs +36 -2
  78. package/cli/lib/harness/codex-runtime.mjs +98 -11
  79. package/package.json +9 -8
@@ -70,10 +70,12 @@ import { runStageHooks } from './routes/index.ts';
70
70
  import { bindShellRuntime, shellPendingWork } from './routes/shell.ts';
71
71
  import { normalizeSessionKey, runInSession, SESSION_HEADER } from './session-scope.ts';
72
72
  import {
73
+ apiKeyRequired,
73
74
  bootApiKey,
74
75
  LAUNCH_PARAM,
75
76
  mainOriginKeyRefusal,
76
77
  mintLaunchToken,
78
+ requestCredential,
77
79
  terminalKeylessForSplitOff,
78
80
  terminalKeyMode,
79
81
  } from './shell/api-key.ts';
@@ -739,6 +741,13 @@ function startServer(port: number, hostname = V4_LOOPBACK): BunServer {
739
741
  id: crypto.randomUUID(),
740
742
  remote: req.headers.get('x-forwarded-for') ?? '127.0.0.1',
741
743
  kind: 'acp',
744
+ // Security review 2026-11-12 (M5) — an agent consent on this socket counts only when
745
+ // the person's page opened it: a browser always sends Origin on a WS handshake (the
746
+ // same-origin check above vouched for it), and with the API key on, only the session
747
+ // cookie (never the header key a helper holds) is the person — as `personRequest`.
748
+ person:
749
+ !!req.headers.get('origin') &&
750
+ (!apiKeyRequired() || requestCredential(req) === 'session'),
742
751
  },
743
752
  });
744
753
  if (ok) return undefined as unknown as Response;
@@ -607,6 +607,18 @@ export const WRITER_REGISTRY: Record<string, WriterEntry> = {
607
607
  // S11.13 routes/settings.ts — Settings › Advanced reads (a count; plugin versions)
608
608
  '/_api/kg/summary': { class: 'read' },
609
609
  '/_api/settings/about': { class: 'read' },
610
+ '/_api/agents': { class: 'read' }, // routes/agents.ts (F2): ACP agents on this Mac, a bounded --version probe, no effect
611
+ // routes/agents.ts (F7): which agents the person connected — this profile's agents.json outside the project
612
+ // (acp/agents/state.ts) — and the vendor's own sign-in child; nothing under the design root
613
+ '/_api/agents/:id/connect': { class: 'local' },
614
+ '/_api/agents/:id/signin': { class: 'local' },
615
+ '/_api/agents/:id/signin-status': { class: 'read' }, // a bounded status probe of the vendor CLI, no effect
616
+ '/_api/agents/:id/signin-cancel': { class: 'local' },
617
+ '/_api/agents/:id/disconnect': { class: 'local' },
618
+ '/_api/agents/:id/dismiss-offer': { class: 'local' },
619
+ // B7 — own API key: writes the 0600 key store (~/.config/maude/keys.json), nothing under the design root
620
+ '/_api/agents/:id/key': { class: 'local' },
621
+ '/_api/agents/:id/key-remove': { class: 'local' },
610
622
  '/_api/sync/availability': { class: 'read' }, // routes/availability.ts (S11.4): listed minus on disk, no effect
611
623
  '/_api/sync/conflicts': { class: 'read' }, // routes/sync-conflicts.ts (S9.24): this Mac's _state/conflicts/, no effect
612
624
  // S9.24 — a conflict pick is the canvas's own op path: one batch, one annotations lane.replace.
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "$schema": "./whats-new.schema.json",
3
3
  "entries": [
4
+ {
5
+ "id": "codex-and-other-agents-in-chat",
6
+ "version": "2.3.0",
7
+ "date": "2026-11-13",
8
+ "kind": "feature",
9
+ "title": "Codex and other agents in the AI chat",
10
+ "summary": "When Codex, opencode, Gemini CLI or GitHub Copilot CLI is installed on this Mac, the AI chat can run it under the same limits as Claude. Connect it from the chat or from Settings › Connections › AI agents, where you can also add your own API key.",
11
+ "learnMore": "https://maude.sh/docs/desktop#other-ai-agents-advanced",
12
+ "surface": "design-ui"
13
+ },
14
+ {
15
+ "id": "ds-screen-fixes-2-2-1",
16
+ "version": "2.2.1",
17
+ "date": "2026-11-12",
18
+ "kind": "fix",
19
+ "title": "Design system screen fixes",
20
+ "summary": "The left panel scrolls again while a Design system is open, and its top bar now sits in the same place as on every canvas, with the path above the buttons.",
21
+ "surface": "design-ui"
22
+ },
4
23
  {
5
24
  "id": "export-and-chat-fixes-2026-11",
6
25
  "version": "2.1.2",
package/apps/studio/ws.ts CHANGED
@@ -99,6 +99,9 @@ export type WsData =
99
99
  id: string;
100
100
  remote: string;
101
101
  kind: 'acp';
102
+ /** Security review 2026-11-12 (M5) — the person's own page opened it (server.ts): an agent
103
+ * consent sent on this socket counts. Absent/false: a helper's socket, consent ignored. */
104
+ person?: boolean;
102
105
  };
103
106
 
104
107
  /**
@@ -6,8 +6,42 @@ import { delimiter, isAbsolute, join, relative, resolve, sep } from 'node:path';
6
6
  import { parseArgs } from '../lib/argv.mjs';
7
7
  import { assertCodexPermissionAuthority, syncCodexRuntime } from '../lib/harness/codex-runtime.mjs';
8
8
 
9
- export async function run({ args, io = defaultIo() }) {
9
+ /**
10
+ * #226 — Codex commands that read nothing Maude projects (version, help, sign-in, shell
11
+ * completion) go straight to the real binary: no Claude-state sync, no plugin-CLI calls.
12
+ */
13
+ const PASS_THROUGH_FIRST = new Set([
14
+ '--version',
15
+ '-V',
16
+ '--help',
17
+ '-h',
18
+ 'help',
19
+ 'login',
20
+ 'logout',
21
+ 'completion',
22
+ ]);
23
+
24
+ export function isPassThroughCodexCommand(args) {
25
+ return args.length > 0 && PASS_THROUGH_FIRST.has(args[0]);
26
+ }
27
+
28
+ export async function run({ args, io = defaultIo(), sync = syncCodexRuntime, stdio = 'inherit' }) {
10
29
  const syncOnly = args[0] === 'sync';
30
+ if (!syncOnly && isPassThroughCodexCommand(args)) {
31
+ if (process.env.MAUDE_CODEX_BRIDGE_ACTIVE === '1') {
32
+ throw new Error(
33
+ 'refusing recursive maude codex launch; set MAUDE_CODEX_REAL to the real binary'
34
+ );
35
+ }
36
+ const executable = await resolveCodexExecutable(undefined);
37
+ const result = spawnSync(executable, args, {
38
+ env: { ...process.env, MAUDE_CODEX_BRIDGE_ACTIVE: '1' },
39
+ stdio,
40
+ });
41
+ if (result.error) throw result.error;
42
+ process.exitCode = result.status ?? 1;
43
+ return { passThrough: true, exitCode: process.exitCode };
44
+ }
11
45
  const { flags } = syncOnly ? parseArgs(args.slice(1), { booleans: ['json'] }) : { flags: {} };
12
46
  const launchArgs = [...args];
13
47
  if (!syncOnly) assertLocalCodexTarget(launchArgs);
@@ -36,7 +70,7 @@ export async function run({ args, io = defaultIo() }) {
36
70
  throw new Error('CODEX_HOME must resolve outside the current project for maude codex');
37
71
  }
38
72
  const executable = await resolveCodexExecutable(explicitExecutable);
39
- const synced = await syncCodexRuntime({
73
+ const synced = await sync({
40
74
  codexExecutable: executable,
41
75
  codexHome,
42
76
  home,
@@ -9,6 +9,7 @@ import {
9
9
  realpath,
10
10
  rename,
11
11
  rm,
12
+ stat,
12
13
  writeFile,
13
14
  } from 'node:fs/promises';
14
15
  import { basename, dirname, join, relative, resolve, sep } from 'node:path';
@@ -78,6 +79,36 @@ async function syncCodexRuntimeLocked({
78
79
  plugins: {},
79
80
  });
80
81
  if (prior.schemaVersion !== RUNTIME_SCHEMA_VERSION) prior.plugins = {};
82
+ const launchArguments = ['-c', 'skills.max_context_tokens=10000', ...permissionLaunch.args];
83
+ const permissionSummary = {
84
+ permissionMode: permissionLaunch.mode,
85
+ permissionProjection: permissionLaunch.reason,
86
+ };
87
+ // #226 — every input this sync projects, plus Codex's own config.toml (where the plugin CLI
88
+ // records marketplaces, plugins and MCP servers). Unchanged since the last completed sync →
89
+ // nothing to do, and no Codex plugin-CLI call (each one can take tens of seconds with many
90
+ // marketplaces). Any change, including one the person made in Codex, runs the full sync.
91
+ const fingerprintInput = {
92
+ codexExecutable,
93
+ codexHome,
94
+ projectRoot,
95
+ projectTrusted,
96
+ desiredPlugins,
97
+ home,
98
+ };
99
+ if (
100
+ prior.schemaVersion === RUNTIME_SCHEMA_VERSION &&
101
+ prior.summary &&
102
+ typeof prior.fingerprint === 'string' &&
103
+ prior.fingerprint === (await runtimeFingerprint(fingerprintInput))
104
+ ) {
105
+ return {
106
+ launchArguments,
107
+ launchEnvironment: {},
108
+ permissionMode: permissionLaunch.mode,
109
+ summary: { ...prior.summary, ...permissionSummary, upToDate: true },
110
+ };
111
+ }
81
112
  const marketplaceList = runCodexJson(
82
113
  codexExecutable,
83
114
  ['plugin', 'marketplace', 'list', '--json'],
@@ -173,23 +204,65 @@ async function syncCodexRuntimeLocked({
173
204
  prior.agents = agents.state;
174
205
  prior.mcps = mcp.state;
175
206
  prior.schemaVersion = RUNTIME_SCHEMA_VERSION;
207
+ const summary = {
208
+ marketplaces: [...marketplaceSources.keys()].sort(),
209
+ agents: [],
210
+ unsupportedAgents: 'Codex custom agents inherit the parent tool registry',
211
+ mcps: Object.keys(mcp.state).sort(),
212
+ plugins: [...desiredIds].sort(),
213
+ };
214
+ prior.summary = summary;
215
+ // Taken AFTER the sync: config.toml now holds what this sync wrote, so the next unchanged launch
216
+ // matches it.
217
+ prior.fingerprint = await runtimeFingerprint(fingerprintInput);
176
218
  await writeOwnedFile(statePath, `${JSON.stringify(prior, null, 2)}\n`, stateRoot);
177
219
  return {
178
- launchArguments: ['-c', 'skills.max_context_tokens=10000', ...permissionLaunch.args],
220
+ launchArguments,
179
221
  launchEnvironment: {},
180
222
  permissionMode: permissionLaunch.mode,
181
- summary: {
182
- marketplaces: [...marketplaceSources.keys()].sort(),
183
- agents: [],
184
- unsupportedAgents: 'Codex custom agents inherit the parent tool registry',
185
- mcps: Object.keys(mcp.state).sort(),
186
- plugins: [...desiredIds].sort(),
187
- permissionMode: permissionLaunch.mode,
188
- permissionProjection: permissionLaunch.reason,
189
- },
223
+ summary: { ...summary, ...permissionSummary },
190
224
  };
191
225
  }
192
226
 
227
+ /**
228
+ * #226 — what a sync depends on: the Codex binary (path, size, mtime), Codex's config.toml as it
229
+ * is now, the project and its trust, each projected plugin's verified source hash, and the
230
+ * person's Claude MCP definitions. Only the hash is stored.
231
+ */
232
+ async function runtimeFingerprint({
233
+ codexExecutable,
234
+ codexHome,
235
+ projectRoot,
236
+ projectTrusted,
237
+ desiredPlugins,
238
+ home,
239
+ }) {
240
+ let exe = null;
241
+ try {
242
+ const st = await stat(codexExecutable);
243
+ exe = [codexExecutable, st.size, st.mtimeMs];
244
+ } catch {
245
+ exe = [codexExecutable, null, null];
246
+ }
247
+ let config = '';
248
+ try {
249
+ config = await readFile(join(codexHome, 'config.toml'), 'utf8');
250
+ } catch {
251
+ config = '';
252
+ }
253
+ return sha256(
254
+ JSON.stringify({
255
+ v: RUNTIME_SCHEMA_VERSION,
256
+ exe,
257
+ config: sha256(config),
258
+ projectRoot,
259
+ projectTrusted,
260
+ plugins: desiredPlugins.map((item) => [item.name, item.sourceHash]),
261
+ mcp: await readClaudeMcp(home),
262
+ })
263
+ );
264
+ }
265
+
193
266
  export function buildCodexPermissionLaunch(items, projectRoot, projectTrusted) {
194
267
  if (!projectTrusted) {
195
268
  return {
@@ -673,13 +746,27 @@ function runCodexJson(executable, args, cwd, codexHome, extraEnv = {}) {
673
746
  }
674
747
  }
675
748
 
749
+ /** One Codex CLI call's limit: MAUDE_CODEX_SYNC_TIMEOUT_MS (1 s – 10 min), default 120 s. */
750
+ function codexCallTimeoutMs() {
751
+ const n = Number.parseInt(process.env.MAUDE_CODEX_SYNC_TIMEOUT_MS ?? '', 10);
752
+ return Number.isFinite(n) ? Math.min(Math.max(n, 1000), 600_000) : 120_000;
753
+ }
754
+
676
755
  function runCodex(executable, args, cwd, codexHome, extraEnv = {}) {
756
+ const timeout = codexCallTimeoutMs();
677
757
  const result = spawnSync(executable, args, {
678
758
  cwd,
679
759
  encoding: 'utf8',
680
760
  env: { ...process.env, ...extraEnv, CODEX_HOME: codexHome },
681
- timeout: 120_000,
761
+ timeout,
682
762
  });
763
+ if (result.error?.code === 'ETIMEDOUT') {
764
+ throw new Error(
765
+ `codex ${args.slice(0, 3).join(' ')} did not answer within ${Math.round(timeout / 1000)} s ` +
766
+ 'while maude synced your Claude setup into Codex. Run Codex directly ' +
767
+ `(MAUDE_CODEX_REAL=${executable}, or that binary itself), or try \`maude codex sync\` again.`
768
+ );
769
+ }
683
770
  if (result.error) throw result.error;
684
771
  if (result.status !== 0) {
685
772
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -57,6 +57,7 @@
57
57
  "test:e2e:desktop:onboarding": "pnpm --filter @maude/desktop-e2e e2e:onboarding",
58
58
  "test:e2e:desktop:acp-cold-start": "pnpm --filter @maude/desktop-e2e e2e:acp-cold-start",
59
59
  "test:e2e:desktop:acp-fake": "pnpm --filter @maude/desktop-e2e e2e:acp-fake",
60
+ "test:e2e:desktop:agents": "pnpm --filter @maude/desktop-e2e e2e:agents",
60
61
  "test:e2e:desktop:parity": "pnpm --filter @maude/desktop-e2e e2e:parity",
61
62
  "test:e2e:desktop:sidecar-respawn": "pnpm --filter @maude/desktop-e2e e2e:sidecar-respawn",
62
63
  "test:e2e:desktop:exports": "pnpm --filter @maude/desktop-e2e e2e:exports",
@@ -72,13 +73,13 @@
72
73
  "test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
73
74
  },
74
75
  "optionalDependencies": {
75
- "@1agh/maude-darwin-arm64": "2.2.0",
76
- "@1agh/maude-darwin-x64": "2.2.0",
77
- "@1agh/maude-linux-arm64": "2.2.0",
78
- "@1agh/maude-linux-arm64-musl": "2.2.0",
79
- "@1agh/maude-linux-x64": "2.2.0",
80
- "@1agh/maude-linux-x64-musl": "2.2.0",
81
- "@1agh/maude-win32-x64": "2.2.0"
76
+ "@1agh/maude-darwin-arm64": "2.3.1",
77
+ "@1agh/maude-darwin-x64": "2.3.1",
78
+ "@1agh/maude-linux-arm64": "2.3.1",
79
+ "@1agh/maude-linux-arm64-musl": "2.3.1",
80
+ "@1agh/maude-linux-x64": "2.3.1",
81
+ "@1agh/maude-linux-x64-musl": "2.3.1",
82
+ "@1agh/maude-win32-x64": "2.3.1"
82
83
  },
83
84
  "files": [
84
85
  "cli",