@surething/cockpit 1.0.189 → 1.0.191

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 (31) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +12 -12
  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 +2 -2
  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 +2 -2
  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 +12 -12
  22. package/.next-prod/server/pages/404.html +2 -2
  23. package/.next-prod/server/pages/500.html +2 -2
  24. package/.next-prod/server/server-reference-manifest.json +1 -1
  25. package/.next-prod/trace +13 -13
  26. package/.next-prod/trace-build +1 -1
  27. package/bin/cock-browser.mjs +26 -0
  28. package/bin/cock.mjs +20 -2
  29. package/package.json +1 -1
  30. /package/.next-prod/static/{KErTlLLQlubS82IizAx-5 → s6yDo5HSYaSgHWRvF1qFE}/_buildManifest.js +0 -0
  31. /package/.next-prod/static/{KErTlLLQlubS82IizAx-5 → s6yDo5HSYaSgHWRvF1qFE}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":14324238,"timestamp":499618723,"id":17,"parentId":1,"tags":{},"startTime":1776939666272,"traceId":"08253691ab17f82f"},{"name":"run-typescript","duration":14964445,"timestamp":513946659,"id":1516,"parentId":1,"tags":{},"startTime":1776939680600,"traceId":"08253691ab17f82f"},{"name":"static-check","duration":812694,"timestamp":528925508,"id":1519,"parentId":1,"tags":{},"startTime":1776939695579,"traceId":"08253691ab17f82f"},{"name":"static-generation","duration":5983032,"timestamp":530042221,"id":1743,"parentId":1,"tags":{},"startTime":1776939696695,"traceId":"08253691ab17f82f"},{"name":"collect-build-traces","duration":18081020,"timestamp":529738896,"id":1740,"parentId":1,"tags":{},"startTime":1776939696392,"traceId":"08253691ab17f82f"},{"name":"telemetry-flush","duration":52,"timestamp":547823054,"id":1752,"parentId":1,"tags":{},"startTime":1776939714476,"traceId":"08253691ab17f82f"},{"name":"next-build","duration":48350299,"timestamp":499472818,"id":1,"tags":{"buildMode":"default","version":"16.1.6","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1776939666126,"traceId":"08253691ab17f82f"}]
1
+ [{"name":"run-webpack","duration":12469889,"timestamp":258042084,"id":17,"parentId":1,"tags":{},"startTime":1776946064942,"traceId":"7edc58480cce636d"},{"name":"run-typescript","duration":14950615,"timestamp":270517130,"id":1516,"parentId":1,"tags":{},"startTime":1776946077417,"traceId":"7edc58480cce636d"},{"name":"static-check","duration":851998,"timestamp":285483513,"id":1519,"parentId":1,"tags":{},"startTime":1776946092384,"traceId":"7edc58480cce636d"},{"name":"static-generation","duration":6156212,"timestamp":286689558,"id":1743,"parentId":1,"tags":{},"startTime":1776946093590,"traceId":"7edc58480cce636d"},{"name":"collect-build-traces","duration":18913013,"timestamp":286338915,"id":1740,"parentId":1,"tags":{},"startTime":1776946093239,"traceId":"7edc58480cce636d"},{"name":"telemetry-flush","duration":58,"timestamp":305255163,"id":1752,"parentId":1,"tags":{},"startTime":1776946112155,"traceId":"7edc58480cce636d"},{"name":"next-build","duration":47383414,"timestamp":257871819,"id":1,"tags":{"buildMode":"default","version":"16.1.6","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1776946064772,"traceId":"7edc58480cce636d"}]
@@ -353,6 +353,32 @@ async function run() {
353
353
 
354
354
  async function formatOutput(action, data) {
355
355
  if (data === undefined || data === null) {
356
+ // evaluate-family silently returning undefined/null is a major source of
357
+ // confusion for LLM callers — they can't tell "code ran but produced no
358
+ // value" from "something broke". Write a concrete hint to stderr so the
359
+ // Bash tool's empty-stdout annotation surfaces it alongside the
360
+ // "(exit 0 — empty stdout)" note instead of guessing causes.
361
+ if (action === 'evaluate' || action === 'evaluate_chunk') {
362
+ process.stderr.write(
363
+ `(evaluate returned ${data === null ? 'null' : 'undefined'} — nothing to print.\n` +
364
+ ` Common causes:\n` +
365
+ ` (a) bare arrow function: \`() => x\` defines but does not invoke — wrap as \`(() => x)()\` or \`(async()=>{...})()\`.\n` +
366
+ ` (b) a .then(...) callback didn't return the value — add an explicit \`return\` in each step of the chain.\n` +
367
+ ` (c) accessed a missing property — e.g. \`d.chat.x\` when response has no \`chat\` field, yielding undefined.\n` +
368
+ ` To force output: wrap the final value with \`JSON.stringify(...)\`, or return a short scalar.\n`
369
+ );
370
+ }
371
+ return;
372
+ }
373
+ if (typeof data === 'function') {
374
+ // Structured clone usually drops functions into undefined before this
375
+ // point, but if one slips through (e.g. from a custom bridge), surface
376
+ // it explicitly instead of swallowing.
377
+ process.stderr.write(
378
+ `(evaluate returned a function reference, which cannot be serialized.\n` +
379
+ ` If you defined an arrow function, invoke it: \`(async()=>{...})()\`.\n` +
380
+ ` To return the function's *result*, call it; to inspect the source, use \`fn.toString()\`.\n`
381
+ );
356
382
  return;
357
383
  }
358
384
 
package/bin/cock.mjs CHANGED
@@ -59,18 +59,36 @@ if (!process.env.COCKPIT_PORT) {
59
59
  }
60
60
 
61
61
  // Subcommand routing
62
+
63
+ // Flush stdout/stderr before exit. process.exit() does NOT wait for
64
+ // async pipe writes to drain — for large outputs (> 16 KiB Node stream
65
+ // highWaterMark) this truncates at exactly 16384 bytes on macOS pipes.
66
+ // Without this, an ollama agent capturing our stdout via execAsync
67
+ // receives a cleanly cut mid-string blob and then misdiagnoses it as
68
+ // "output truncated" (reproduced in sessions 6910d071 & 22727dd4).
69
+ async function flushAndExit(code) {
70
+ const drain = (stream) => new Promise((resolve) => {
71
+ if (!stream.writableLength) { resolve(); return; }
72
+ // Writing an empty string returns false iff the stream is backpressured;
73
+ // the callback then fires once the kernel has actually accepted the data.
74
+ stream.write('', 'utf8', () => resolve());
75
+ });
76
+ try { await Promise.all([drain(process.stdout), drain(process.stderr)]); } catch { /* ignore */ }
77
+ process.exit(code);
78
+ }
79
+
62
80
  if (process.argv[2] === 'browser') {
63
81
  process.argv.splice(2, 1);
64
82
  const mod = await import('./cock-browser.mjs');
65
83
  await mod.done;
66
- process.exit(0);
84
+ await flushAndExit(0);
67
85
  }
68
86
 
69
87
  if (process.argv[2] === 'terminal') {
70
88
  process.argv.splice(2, 1);
71
89
  const mod = await import('./cock-terminal.mjs');
72
90
  await mod.done;
73
- process.exit(0);
91
+ await flushAndExit(0);
74
92
  }
75
93
 
76
94
  if (process.argv[2] === 'update') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surething/cockpit",
3
- "version": "1.0.189",
3
+ "version": "1.0.191",
4
4
  "description": "The Cockpit That Drives AI",
5
5
  "author": "Robert",
6
6
  "license": "MIT",