@surething/cockpit 1.0.236 → 1.0.237

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 (33) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +1 -1
  3. package/.next-prod/build-manifest.json +2 -2
  4. package/.next-prod/prerender-manifest.json +3 -3
  5. package/.next-prod/server/app/_global-error.html +1 -1
  6. package/.next-prod/server/app/_global-error.rsc +1 -1
  7. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  9. package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  10. package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next-prod/server/app/_not-found.html +1 -1
  14. package/.next-prod/server/app/_not-found.rsc +1 -1
  15. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +1 -1
  16. package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
  17. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +1 -1
  18. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  20. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  21. package/.next-prod/server/app-paths-manifest.json +1 -1
  22. package/.next-prod/server/middleware-build-manifest.js +1 -1
  23. package/.next-prod/server/pages/404.html +1 -1
  24. package/.next-prod/server/pages/500.html +1 -1
  25. package/.next-prod/server/server-reference-manifest.json +1 -1
  26. package/.next-prod/trace +13 -13
  27. package/.next-prod/trace-build +1 -1
  28. package/bin/cock.mjs +26 -1
  29. package/bin/postinstall.mjs +15 -0
  30. package/package.json +2 -1
  31. package/scripts/claudeBinary.mjs +38 -0
  32. /package/.next-prod/static/{VRVzMV9rhbwaTwXonUCzN → pibOtHY_hUMQlMPI6P_Mk}/_buildManifest.js +0 -0
  33. /package/.next-prod/static/{VRVzMV9rhbwaTwXonUCzN → pibOtHY_hUMQlMPI6P_Mk}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":13094140,"timestamp":92586508,"id":14,"parentId":1,"tags":{},"startTime":1783345301168,"traceId":"32a6e89d3c090b4d"},{"name":"run-typescript","duration":10343512,"timestamp":105683410,"id":1606,"parentId":1,"tags":{},"startTime":1783345314265,"traceId":"32a6e89d3c090b4d"},{"name":"static-check","duration":664290,"timestamp":116060179,"id":1609,"parentId":1,"tags":{},"startTime":1783345324641,"traceId":"32a6e89d3c090b4d"},{"name":"static-generation","duration":3406583,"timestamp":116960668,"id":1881,"parentId":1,"tags":{},"startTime":1783345325542,"traceId":"32a6e89d3c090b4d"},{"name":"collect-build-traces","duration":10918258,"timestamp":116724991,"id":1878,"parentId":1,"tags":{},"startTime":1783345325306,"traceId":"32a6e89d3c090b4d"},{"name":"telemetry-flush","duration":33,"timestamp":127645744,"id":1890,"parentId":1,"tags":{},"startTime":1783345336227,"traceId":"32a6e89d3c090b4d"},{"name":"next-build","duration":35156409,"timestamp":92489376,"id":1,"tags":{"buildMode":"default","version":"16.2.6","bundler":"webpack","has-custom-webpack-config":"true","use-build-worker":"false"},"startTime":1783345301071,"traceId":"32a6e89d3c090b4d"}]
1
+ [{"name":"run-webpack","duration":19984693,"timestamp":161374706,"id":14,"parentId":1,"tags":{},"startTime":1783396708397,"traceId":"281b860421a58a40"},{"name":"run-typescript","duration":18381890,"timestamp":181363309,"id":1606,"parentId":1,"tags":{},"startTime":1783396728385,"traceId":"281b860421a58a40"},{"name":"static-check","duration":1188175,"timestamp":199787563,"id":1609,"parentId":1,"tags":{},"startTime":1783396746810,"traceId":"281b860421a58a40"},{"name":"static-generation","duration":6203546,"timestamp":201425767,"id":1881,"parentId":1,"tags":{},"startTime":1783396748448,"traceId":"281b860421a58a40"},{"name":"collect-build-traces","duration":20799726,"timestamp":200976359,"id":1878,"parentId":1,"tags":{},"startTime":1783396747998,"traceId":"281b860421a58a40"},{"name":"telemetry-flush","duration":50,"timestamp":221781229,"id":1890,"parentId":1,"tags":{},"startTime":1783396768803,"traceId":"281b860421a58a40"},{"name":"next-build","duration":60572981,"timestamp":161208309,"id":1,"tags":{"buildMode":"default","version":"16.2.6","bundler":"webpack","has-custom-webpack-config":"true","use-build-worker":"false"},"startTime":1783396708230,"traceId":"281b860421a58a40"}]
package/bin/cock.mjs CHANGED
@@ -3,6 +3,7 @@
3
3
  import { dirname, resolve } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { spawnSync } from 'child_process';
6
+ import { hasClaudeBinary } from '../scripts/claudeBinary.mjs';
6
7
 
7
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
9
  const PROJECT_ROOT = resolve(__dirname, '..');
@@ -124,11 +125,27 @@ if (process.argv[2] === 'connection') {
124
125
 
125
126
  if (process.argv[2] === 'update') {
126
127
  console.log('Updating @surething/cockpit...');
127
- const result = spawnSync('npm', ['install', '-g', '@surething/cockpit@latest'], { stdio: 'inherit' });
128
+ const installArgs = ['install', '-g', '@surething/cockpit@latest', '--include=optional'];
129
+ let result = spawnSync('npm', installArgs, { stdio: 'inherit' });
130
+
131
+ // An in-place `npm i -g` can drop the SDK's platform-specific native binary
132
+ // (an optional dependency) when the SDK version bumps — see
133
+ // scripts/claudeBinary.mjs. A clean uninstall + reinstall reliably refetches
134
+ // it. Guard here so `cockpit update` never leaves chat silently broken.
135
+ if (result.status === 0 && !hasClaudeBinary()) {
136
+ console.log('Native Claude binary missing after update — reinstalling to repair...');
137
+ spawnSync('npm', ['uninstall', '-g', '@surething/cockpit'], { stdio: 'inherit' });
138
+ result = spawnSync('npm', installArgs, { stdio: 'inherit' });
139
+ }
140
+
128
141
  if (result.status === 0) {
129
142
  const { readFileSync } = await import('fs');
130
143
  const pkg = JSON.parse(readFileSync(resolve(PROJECT_ROOT, 'package.json'), 'utf8'));
131
144
  console.log(`\nUpdated to v${pkg.version}`);
145
+ if (!hasClaudeBinary()) {
146
+ console.error('\nWarning: the native Claude CLI binary is still missing; chat will not work.');
147
+ console.error('Fix manually: npm uninstall -g @surething/cockpit && npm install -g @surething/cockpit');
148
+ }
132
149
  }
133
150
  process.exit(result.status ?? 1);
134
151
  }
@@ -194,6 +211,14 @@ if (!isDev && !existsSync(resolve(PROJECT_ROOT, '.next-prod', 'BUILD_ID'))) {
194
211
  process.exit(1);
195
212
  }
196
213
 
214
+ // Warn (don't block) if the SDK's native binary is missing — every panel but
215
+ // the Claude chat still works, but chat would otherwise fail with a cryptic
216
+ // runtime error only once the user sends a message. See scripts/claudeBinary.mjs.
217
+ if (!hasClaudeBinary()) {
218
+ console.error('Warning: the native Claude CLI binary is missing; chat may not work.');
219
+ console.error('Fix: npm uninstall -g @surething/cockpit && npm install -g @surething/cockpit\n');
220
+ }
221
+
197
222
  // Hand the project directory to server.mjs so it opens the right URL
198
223
  if (projectDir) {
199
224
  process.env.COCKPIT_OPEN_PROJECT = projectDir;
@@ -7,6 +7,7 @@ import { execSync } from 'child_process';
7
7
  import { homedir } from 'os';
8
8
  import { copyTreeSitterWasms } from '../scripts/copy-tree-sitter-wasms.mjs';
9
9
  import { copyPdfjsWorker } from '../scripts/copy-pdfjs-worker.mjs';
10
+ import { hasClaudeBinary } from '../scripts/claudeBinary.mjs';
10
11
 
11
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
13
  const projectRoot = join(__dirname, '..');
@@ -28,6 +29,20 @@ try {
28
29
  console.warn('[postinstall] pdf.js worker copy failed:', err?.message ?? err);
29
30
  }
30
31
 
32
+ // Warn (don't fail) if the Claude Agent SDK's native binary didn't land — the
33
+ // chat engine needs it. npm can skip this optional platform sub-package during
34
+ // an in-place `npm i -g` upgrade; catching it here turns a mid-chat runtime
35
+ // error into an install-time hint. See scripts/claudeBinary.mjs.
36
+ try {
37
+ if (!hasClaudeBinary()) {
38
+ const plat = `${process.platform}-${process.arch}`;
39
+ console.warn(`[postinstall] Warning: Claude native binary (${plat}) is missing — chat will not work.`);
40
+ console.warn('[postinstall] Fix: npm uninstall -g @surething/cockpit && npm install -g @surething/cockpit');
41
+ }
42
+ } catch (err) {
43
+ console.warn('[postinstall] Claude binary check failed:', err?.message ?? err);
44
+ }
45
+
31
46
  if (process.platform !== 'win32') {
32
47
  // node-pty: spawn-helper needs the executable bit
33
48
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surething/cockpit",
3
- "version": "1.0.236",
3
+ "version": "1.0.237",
4
4
  "description": "The open-source Claude Code GUI — an IDE-like workbench for parallel AI coding. Drive Claude (default), Codex, DeepSeek, Kimi, or local Ollama in tabs. Terminal, browser & DB bubbles, code review. Self-host on a shared dev box — a seat for every teammate. Local-first, MIT.",
5
5
  "author": "Robert",
6
6
  "license": "MIT",
@@ -75,6 +75,7 @@
75
75
  "next.config.mjs",
76
76
  "scripts/copy-tree-sitter-wasms.mjs",
77
77
  "scripts/copy-pdfjs-worker.mjs",
78
+ "scripts/claudeBinary.mjs",
78
79
  "LICENSE",
79
80
  "README.md"
80
81
  ],
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Detect whether the Claude Agent SDK's platform-specific native `claude`
3
+ * binary is actually installed for the current platform.
4
+ *
5
+ * The binary ships as an OPTIONAL dependency of `@anthropic-ai/claude-agent-sdk`
6
+ * (one sub-package per platform, e.g. `-darwin-arm64`). npm can silently skip it
7
+ * during an in-place `npm i -g` upgrade when the SDK version bumps via its caret
8
+ * range, leaving the SDK unable to spawn `claude` at runtime with:
9
+ * "Native CLI binary for <platform>-<arch> not found. Reinstall
10
+ * @anthropic-ai/claude-agent-sdk without --omit=optional, ..."
11
+ *
12
+ * `cockpit update`, postinstall, and CLI startup all call this so the problem is
13
+ * surfaced (and repaired) BEFORE the user hits the runtime error mid-chat.
14
+ */
15
+ import { createRequire } from 'module';
16
+ import { existsSync } from 'fs';
17
+ import { join, dirname } from 'path';
18
+
19
+ const require = createRequire(import.meta.url);
20
+
21
+ /** @returns {boolean} true if the current platform's `claude` binary resolves. */
22
+ export function hasClaudeBinary() {
23
+ const base = `${process.platform}-${process.arch}`;
24
+ // linux ships glibc and musl variants under distinct package names.
25
+ const variants = process.platform === 'linux' ? [base, `${base}-musl`] : [base];
26
+ for (const variant of variants) {
27
+ try {
28
+ const pkgJson = require.resolve(
29
+ `@anthropic-ai/claude-agent-sdk-${variant}/package.json`,
30
+ );
31
+ const bin = join(dirname(pkgJson), 'claude');
32
+ if (existsSync(bin) || existsSync(`${bin}.exe`)) return true;
33
+ } catch {
34
+ // Not resolvable → this variant's sub-package isn't installed.
35
+ }
36
+ }
37
+ return false;
38
+ }