@1agh/maude 1.7.1 → 1.9.0

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 (108) hide show
  1. package/apps/studio/acp/bridge.ts +15 -2
  2. package/apps/studio/acp/login-state.ts +1 -0
  3. package/apps/studio/acp/probe.ts +52 -1
  4. package/apps/studio/api.ts +431 -39
  5. package/apps/studio/asset-upload.ts +174 -0
  6. package/apps/studio/assets-s3.ts +37 -2
  7. package/apps/studio/bin/_curl-local.mjs +7 -0
  8. package/apps/studio/bin/_pdf-playwright.mjs +22 -1
  9. package/apps/studio/bin/_png-playwright.mjs +20 -1
  10. package/apps/studio/bin/_region.mjs +92 -0
  11. package/apps/studio/bin/annotate.mjs +16 -7
  12. package/apps/studio/bin/read-annotations.mjs +62 -4
  13. package/apps/studio/canvas-build.ts +59 -4
  14. package/apps/studio/canvas-lib.tsx +48 -1
  15. package/apps/studio/canvas-shell.tsx +28 -4
  16. package/apps/studio/client/app.jsx +441 -15903
  17. package/apps/studio/client/canvas-url.js +9 -0
  18. package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
  19. package/apps/studio/client/dialogs/command-palette.jsx +112 -0
  20. package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
  21. package/apps/studio/client/dialogs/help-modal.jsx +324 -0
  22. package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
  23. package/apps/studio/client/embed-view.jsx +284 -0
  24. package/apps/studio/client/embed.js +101 -0
  25. package/apps/studio/client/export-center.jsx +2 -0
  26. package/apps/studio/client/github.js +36 -3
  27. package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
  28. package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
  29. package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
  30. package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
  31. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
  32. package/apps/studio/client/hooks/use-project-data.jsx +90 -0
  33. package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
  34. package/apps/studio/client/hooks/use-tabs.jsx +723 -0
  35. package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
  36. package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
  37. package/apps/studio/client/inspector/color-picker.jsx +196 -0
  38. package/apps/studio/client/inspector/color.js +92 -0
  39. package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
  40. package/apps/studio/client/inspector/css-vocab.jsx +131 -0
  41. package/apps/studio/client/inspector/ds-tokens.js +90 -0
  42. package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
  43. package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
  44. package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
  45. package/apps/studio/client/inspector/layers.jsx +322 -0
  46. package/apps/studio/client/inspector/selection.js +65 -0
  47. package/apps/studio/client/inspector/token-popover.jsx +301 -0
  48. package/apps/studio/client/menus/menubar.jsx +856 -0
  49. package/apps/studio/client/report-bug.jsx +8 -2
  50. package/apps/studio/client/selection-scope.js +40 -0
  51. package/apps/studio/client/shell/banners.jsx +272 -0
  52. package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
  53. package/apps/studio/client/shell/comments-panel.jsx +177 -0
  54. package/apps/studio/client/shell/constants.js +60 -0
  55. package/apps/studio/client/shell/dock.jsx +131 -0
  56. package/apps/studio/client/shell/icons.jsx +370 -0
  57. package/apps/studio/client/shell/status-bar.jsx +215 -0
  58. package/apps/studio/client/shell/util.js +332 -0
  59. package/apps/studio/client/shell/viewport.jsx +254 -0
  60. package/apps/studio/client/system/system-view.jsx +255 -0
  61. package/apps/studio/client/tree/tree.jsx +1243 -0
  62. package/apps/studio/comments-overlay.tsx +6 -4
  63. package/apps/studio/config.schema.json +5 -0
  64. package/apps/studio/context.ts +20 -0
  65. package/apps/studio/dist/client.bundle.js +2728 -2728
  66. package/apps/studio/dist/comment-mount.js +2 -2
  67. package/apps/studio/embed-origins.ts +52 -0
  68. package/apps/studio/export-dialog.tsx +55 -3
  69. package/apps/studio/exporters/_browser-bundles.ts +21 -2
  70. package/apps/studio/exporters/format-scopes.ts +11 -3
  71. package/apps/studio/exporters/index.ts +17 -2
  72. package/apps/studio/exporters/jobs.ts +91 -23
  73. package/apps/studio/exporters/pdf.ts +10 -2
  74. package/apps/studio/exporters/png.ts +10 -2
  75. package/apps/studio/exporters/scope.ts +89 -15
  76. package/apps/studio/format.ts +296 -0
  77. package/apps/studio/generation/runtime-probe.ts +1 -1
  78. package/apps/studio/git/service.ts +1 -0
  79. package/apps/studio/http.ts +399 -36
  80. package/apps/studio/input-router.tsx +7 -1
  81. package/apps/studio/path-containment.ts +72 -0
  82. package/apps/studio/paths.ts +14 -1
  83. package/apps/studio/read-only-mode.ts +53 -0
  84. package/apps/studio/server.ts +123 -25
  85. package/apps/studio/sync/accepted-link.ts +6 -0
  86. package/apps/studio/sync/agent.ts +9 -1
  87. package/apps/studio/sync/cold-start-apply.ts +29 -4
  88. package/apps/studio/sync/cold-start.ts +78 -0
  89. package/apps/studio/sync/file-plane.ts +61 -1
  90. package/apps/studio/sync/format-sync.ts +160 -0
  91. package/apps/studio/sync/index.ts +208 -23
  92. package/apps/studio/sync/journal-client.ts +25 -5
  93. package/apps/studio/sync/migrate-seed.ts +8 -1
  94. package/apps/studio/sync/park.ts +39 -0
  95. package/apps/studio/sync/presentation.ts +9 -3
  96. package/apps/studio/sync/status.ts +2 -0
  97. package/apps/studio/sync/transaction-client.ts +130 -13
  98. package/apps/studio/sync/writer-registry.ts +5 -0
  99. package/apps/studio/ui-prefs.ts +95 -10
  100. package/apps/studio/use-canvas-media-drop.tsx +8 -28
  101. package/apps/studio/whats-new.json +36 -0
  102. package/apps/studio/ws.ts +19 -4
  103. package/cli/bin/claude-design-server.mjs +0 -0
  104. package/cli/commands/design.mjs +9 -2
  105. package/cli/commands/hub-workspace.mjs +25 -0
  106. package/cli/lib/workspace-plan.mjs +51 -0
  107. package/package.json +11 -9
  108. package/plugins/design/templates/_shell.html +58 -0
@@ -30,7 +30,12 @@ import {
30
30
 
31
31
  import { scrubAgentEnv } from './env.ts';
32
32
  import type { SdkPluginConfig } from './plugin-bootstrap.ts';
33
- import { resolveAdapterEntry, resolveAgentRuntime, resolveClaudePath } from './probe.ts';
33
+ import {
34
+ resolveAdapterEntry,
35
+ resolveAgentClaudeExecutable,
36
+ resolveAgentRuntime,
37
+ resolveClaudePath,
38
+ } from './probe.ts';
34
39
  import { countTranscriptLinesAt, stripInlineBlobs } from './transcript-io.ts';
35
40
  import {
36
41
  isWriteToolName,
@@ -1056,6 +1061,13 @@ export class AcpBridge {
1056
1061
  if (!claudePath) {
1057
1062
  throw new Error("Claude Code isn't connected — run `claude` in a terminal and `/login`.");
1058
1063
  }
1064
+ // #148 — a Windows npm `claude.cmd` shim can't be spawned by Node without a shell.
1065
+ const agentClaude = resolveAgentClaudeExecutable(claudePath);
1066
+ if (!agentClaude) {
1067
+ throw new Error(
1068
+ 'Claude Code is installed as an npm `claude.cmd` shim the chat cannot start — reinstall it with the native installer.'
1069
+ );
1070
+ }
1059
1071
 
1060
1072
  // DDR-123 guardrail #1 — strip ANTHROPIC_API_KEY so the child stays on the
1061
1073
  // user's subscription. This is the whole compliance story; do not weaken it.
@@ -1069,7 +1081,7 @@ export class AcpBridge {
1069
1081
  // this pin the packaged adapter would throw "native binary not found". Driving
1070
1082
  // the user's installed CLI is also the documented intent: it keeps the turn on
1071
1083
  // their subscription rather than the SDK's embedded runtime.
1072
- env.CLAUDE_CODE_EXECUTABLE = claudePath;
1084
+ env.CLAUDE_CODE_EXECUTABLE = agentClaude;
1073
1085
  // Least-privilege: the adapter child never talks to the dev-server's GitHub
1074
1086
  // token bridge (only apps/studio/github/token.ts does), so drop the loopback
1075
1087
  // keychain-bridge handle from its env. Keeps a hijacked-PATH `claude` (which
@@ -1092,6 +1104,7 @@ export class AcpBridge {
1092
1104
  if (runtime.bunBeBun) env.BUN_BE_BUN = '1';
1093
1105
  const proc = Bun.spawn([runtime.bin, adapterEntry], {
1094
1106
  cwd: this.opts.repoRoot,
1107
+ windowsHide: true, // #141 — never a console window for the adapter on Windows
1095
1108
  env,
1096
1109
  stdin: 'pipe',
1097
1110
  stdout: 'pipe',
@@ -47,6 +47,7 @@ export function startSignin(): { ok: boolean; reason?: string } {
47
47
  if (!bin) return { ok: false, reason: 'Claude Code is not installed.' };
48
48
  const child = Bun.spawn([bin, 'auth', 'login', '--claudeai'], {
49
49
  env: scrubAgentEnv(),
50
+ windowsHide: true, // #141
50
51
  stdout: 'ignore',
51
52
  stderr: 'ignore',
52
53
  });
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { createHash } from 'node:crypto';
10
10
  import { existsSync, readFileSync, realpathSync } from 'node:fs';
11
- import { dirname, join } from 'node:path';
11
+ import { dirname, join, win32 } from 'node:path';
12
12
 
13
13
  import { DEV_SERVER_ROOT, IS_COMPILED_BINARY } from '../paths.ts';
14
14
  import { scrubAgentEnv } from './env.ts';
@@ -154,6 +154,47 @@ export function resolveClaudePath(): string | null {
154
154
  return Bun.which('claude');
155
155
  }
156
156
 
157
+ /**
158
+ * #148 — the path the ADAPTER can spawn as `CLAUDE_CODE_EXECUTABLE`.
159
+ *
160
+ * The adapter runs under Node (#141), and the SDK spawns this path with
161
+ * `child_process.spawn` and no shell. Since CVE-2024-27980 Node refuses to
162
+ * spawn a `.cmd`/`.bat` that way (EINVAL), and an npm-installed Claude Code on
163
+ * Windows resolves to exactly that: `%APPDATA%\npm\claude.cmd`. `Bun.spawn`
164
+ * (readiness, auth status, sign-in) launches the shim fine, which is why the
165
+ * header said Ready while every session failed with "Internal error".
166
+ *
167
+ * So on win32 a shim is followed to its real target: the target the npm
168
+ * cmd-shim itself names (`"%dp0%\node_modules\...\cli.js"`), else the
169
+ * package entry beside the shim, else a native `claude.exe` next to it. The SDK
170
+ * runs a `.js` executable through its own JS runtime. Returns null when no
171
+ * spawnable target exists — callers report that, never spawn the shim.
172
+ */
173
+ export function resolveAgentClaudeExecutable(
174
+ claudePath: string,
175
+ platform: NodeJS.Platform = process.platform,
176
+ exists: (p: string) => boolean = existsSync,
177
+ readText: (p: string) => string = (p) => readFileSync(p, 'utf8')
178
+ ): string | null {
179
+ if (platform !== 'win32' || !/\.(cmd|bat)$/i.test(claudePath)) return claudePath;
180
+ const shimDir = win32.dirname(claudePath);
181
+ const candidates: string[] = [];
182
+ try {
183
+ for (const m of readText(claudePath).matchAll(
184
+ /%~?dp0%?\\([^"%\r\n]+?\.(?:js|mjs|cjs|exe))/gi
185
+ )) {
186
+ candidates.push(win32.join(shimDir, m[1]));
187
+ }
188
+ } catch {
189
+ /* unreadable shim — fall through to the conventional layout */
190
+ }
191
+ candidates.push(
192
+ win32.join(shimDir, 'node_modules', '@anthropic-ai', 'claude-code', 'cli.js'),
193
+ win32.join(shimDir, 'claude.exe')
194
+ );
195
+ return candidates.find((c) => exists(c)) ?? null;
196
+ }
197
+
157
198
  /**
158
199
  * The JS runtime used to launch the adapter, plus whether it must be spawned
159
200
  * with `BUN_BE_BUN=1`. Ladder: explicit `MAUDE_ACP_RUNTIME` override → a real
@@ -212,6 +253,15 @@ export function probeAcpAvailability(): AcpAvailability {
212
253
  claudePath: null,
213
254
  };
214
255
  }
256
+ if (!resolveAgentClaudeExecutable(claudePath)) {
257
+ return {
258
+ available: false,
259
+ reason:
260
+ 'Claude Code was found only as an npm `claude.cmd` shim the chat cannot start. Reinstall it with the native installer (`irm https://claude.ai/install.ps1 | iex`).',
261
+ adapterEntry,
262
+ claudePath,
263
+ };
264
+ }
215
265
  return { available: true, adapterEntry, claudePath };
216
266
  }
217
267
 
@@ -481,6 +531,7 @@ export async function getClaudeAuthStatus(): Promise<ClaudeAuthStatus | null> {
481
531
  async function readAuthStatusStdout(bin: string): Promise<string> {
482
532
  const proc = Bun.spawn([bin, 'auth', 'status', '--json'], {
483
533
  env: scrubAgentEnv(),
534
+ windowsHide: true, // #141
484
535
  // A wrapper that prompts would otherwise block forever on a tty-less read.
485
536
  stdin: 'ignore',
486
537
  stdout: 'pipe',