sparkecoder 0.1.123 → 0.1.124

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 (123) hide show
  1. package/dist/cli.js +77 -42
  2. package/dist/cli.js.map +1 -1
  3. package/dist/skills/default/recording.md +2 -2
  4. package/package.json +1 -1
  5. package/src/skills/default/recording.md +2 -2
  6. package/web/.next/BUILD_ID +1 -1
  7. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  8. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  9. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  10. package/web/.next/standalone/web/.next/server/app/(main)/agents/page_client-reference-manifest.js +1 -1
  11. package/web/.next/standalone/web/.next/server/app/(main)/page_client-reference-manifest.js +1 -1
  12. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page.js.nft.json +1 -1
  13. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  14. package/web/.next/standalone/web/.next/server/app/(main)/settings/page_client-reference-manifest.js +1 -1
  15. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  16. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  17. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  18. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  20. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  21. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  22. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  23. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
  24. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  26. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  29. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  30. package/web/.next/standalone/web/.next/server/app/agents.html +1 -1
  31. package/web/.next/standalone/web/.next/server/app/agents.rsc +3 -3
  32. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents/__PAGE__.segment.rsc +2 -2
  33. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents.segment.rsc +1 -1
  34. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p.segment.rsc +2 -2
  35. package/web/.next/standalone/web/.next/server/app/agents.segments/_full.segment.rsc +3 -3
  36. package/web/.next/standalone/web/.next/server/app/agents.segments/_head.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/agents.segments/_index.segment.rsc +1 -1
  38. package/web/.next/standalone/web/.next/server/app/agents.segments/_tree.segment.rsc +1 -1
  39. package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
  40. package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
  41. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
  42. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
  43. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
  44. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
  45. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
  46. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
  47. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
  48. package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
  49. package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
  50. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
  51. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
  52. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
  53. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
  54. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
  55. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
  56. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
  57. package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
  58. package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
  59. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
  60. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
  61. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
  62. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
  63. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
  64. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
  65. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
  66. package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
  67. package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
  68. package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
  69. package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  70. package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  71. package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  72. package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  73. package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  74. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  75. package/web/.next/standalone/web/.next/server/app/index.rsc +3 -3
  76. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +2 -2
  77. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +2 -2
  78. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
  79. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  80. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  81. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  82. package/web/.next/standalone/web/.next/server/app/settings.html +1 -1
  83. package/web/.next/standalone/web/.next/server/app/settings.rsc +3 -3
  84. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings/__PAGE__.segment.rsc +2 -2
  85. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings.segment.rsc +1 -1
  86. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p.segment.rsc +2 -2
  87. package/web/.next/standalone/web/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  88. package/web/.next/standalone/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  89. package/web/.next/standalone/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  90. package/web/.next/standalone/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  91. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_c87abaf4._.js → 2374f_12d55e68._.js} +1 -1
  92. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_1f3f2d00._.js → 2374f_1c0639c2._.js} +1 -1
  93. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_a0d5caeb._.js → 2374f_28cd6777._.js} +1 -1
  94. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_570c34dc._.js → 2374f_5f47a9b7._.js} +1 -1
  95. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_d8122230._.js → 2374f_aa218457._.js} +1 -1
  96. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_9c560f3a._.js → 2374f_f678a96f._.js} +1 -1
  97. package/web/.next/standalone/web/.next/server/chunks/ssr/{2374f_38945fd9._.js → 2374f_fac4000d._.js} +1 -1
  98. package/web/.next/standalone/web/.next/server/chunks/ssr/{[root-of-the-server]__4de426bd._.js → [root-of-the-server]__e5911ea8._.js} +4 -4
  99. package/web/.next/standalone/web/.next/server/chunks/ssr/{web_62ca4286._.js → web_2966b3a3._.js} +2 -2
  100. package/web/.next/standalone/web/.next/server/chunks/ssr/web_4fe3c244._.js +1 -1
  101. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  102. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  103. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  104. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  105. package/web/.next/standalone/web/.next/static/chunks/{91988e253d5fa420.js → 4d95c15f712c9e06.js} +5 -5
  106. package/web/.next/standalone/web/.next/static/chunks/780c93257fac7d43.js +1 -0
  107. package/web/.next/standalone/web/.next/static/static/chunks/{91988e253d5fa420.js → 4d95c15f712c9e06.js} +5 -5
  108. package/web/.next/standalone/web/.next/static/static/chunks/780c93257fac7d43.js +1 -0
  109. package/web/.next/standalone/web/src/components/chat-interface.tsx +112 -1
  110. package/web/.next/static/chunks/{91988e253d5fa420.js → 4d95c15f712c9e06.js} +5 -5
  111. package/web/.next/static/chunks/780c93257fac7d43.js +1 -0
  112. package/web/.next/standalone/web/.next/static/chunks/f0f19357f3fb7cf8.js +0 -1
  113. package/web/.next/standalone/web/.next/static/static/chunks/f0f19357f3fb7cf8.js +0 -1
  114. package/web/.next/static/chunks/f0f19357f3fb7cf8.js +0 -1
  115. /package/web/.next/standalone/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_buildManifest.js +0 -0
  116. /package/web/.next/standalone/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_clientMiddlewareManifest.json +0 -0
  117. /package/web/.next/standalone/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_ssgManifest.js +0 -0
  118. /package/web/.next/standalone/web/.next/static/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_buildManifest.js +0 -0
  119. /package/web/.next/standalone/web/.next/static/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_clientMiddlewareManifest.json +0 -0
  120. /package/web/.next/standalone/web/.next/static/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_ssgManifest.js +0 -0
  121. /package/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_buildManifest.js +0 -0
  122. /package/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_clientMiddlewareManifest.json +0 -0
  123. /package/web/.next/static/{MP4p8_EldjbZ69dONoEcM → cYXZ7UzGc5TttFIXRRcSC}/_ssgManifest.js +0 -0
package/dist/cli.js CHANGED
@@ -17024,7 +17024,7 @@ function generateOpenAPISpec() {
17024
17024
  init_config();
17025
17025
  init_semantic();
17026
17026
  init_db();
17027
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync8, readFileSync as readFileSync11, existsSync as existsSync23, statSync as statSync4 } from "fs";
17027
+ import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync8, readFileSync as readFileSync11, existsSync as existsSync23, statSync as statSync4, unlinkSync as unlinkSync3 } from "fs";
17028
17028
  import { resolve as resolve13, join as join18 } from "path";
17029
17029
  function getCliVersion() {
17030
17030
  const here = dirname11(fileURLToPath5(import.meta.url));
@@ -18634,7 +18634,9 @@ program.command("request-permissions").description("Open System Settings to the
18634
18634
  console.log();
18635
18635
  });
18636
18636
  {
18637
- let stateFilePath = function() {
18637
+ let shellEscape2 = function(str) {
18638
+ return `'${str.replace(/'/g, "'\\''")}'`;
18639
+ }, stateFilePath = function() {
18638
18640
  return join18(ensureAppDataDirectory(), "recordings.json");
18639
18641
  }, readState = function() {
18640
18642
  const p = stateFilePath();
@@ -18656,21 +18658,81 @@ program.command("request-permissions").description("Open System Settings to the
18656
18658
  }, pruneDead = function(rows) {
18657
18659
  return rows.filter((r) => isAlive(r.pid));
18658
18660
  };
18659
- stateFilePath2 = stateFilePath, readState2 = readState, writeState2 = writeState, isAlive2 = isAlive, pruneDead2 = pruneDead;
18661
+ shellEscape3 = shellEscape2, stateFilePath2 = stateFilePath, readState2 = readState, writeState2 = writeState, isAlive2 = isAlive, pruneDead2 = pruneDead;
18662
+ async function stopRecorderPid(pid) {
18663
+ if (!isAlive(pid)) return;
18664
+ try {
18665
+ process.kill(pid, "SIGINT");
18666
+ } catch {
18667
+ return;
18668
+ }
18669
+ for (let i = 0; i < 40; i++) {
18670
+ if (!isAlive(pid)) break;
18671
+ await new Promise((r) => setTimeout(r, 200));
18672
+ }
18673
+ if (isAlive(pid)) {
18674
+ try {
18675
+ process.kill(pid, "SIGTERM");
18676
+ } catch {
18677
+ }
18678
+ }
18679
+ }
18680
+ async function convertCaptureToMp4(capturePath, mp4Path) {
18681
+ try {
18682
+ const { exec: exec8 } = await import("child_process");
18683
+ const { promisify: promisify8 } = await import("util");
18684
+ const execAsync8 = promisify8(exec8);
18685
+ await execAsync8(
18686
+ `ffmpeg -y -i ${shellEscape2(capturePath)} -c:v libx264 -pix_fmt yuv420p -preset fast -crf 23 -movflags +faststart ${shellEscape2(mp4Path)}`,
18687
+ { timeout: 12e4, maxBuffer: 10 * 1024 * 1024 }
18688
+ );
18689
+ return existsSync23(mp4Path) && statSync4(mp4Path).size > 0;
18690
+ } catch {
18691
+ return false;
18692
+ }
18693
+ }
18694
+ async function finalizeRecording(row) {
18695
+ await stopRecorderPid(row.pid);
18696
+ let finalPath = row.path;
18697
+ let warning;
18698
+ if (row.capturePath) {
18699
+ for (let i = 0; i < 20; i++) {
18700
+ if (existsSync23(row.capturePath) && statSync4(row.capturePath).size > 0) break;
18701
+ await new Promise((r) => setTimeout(r, 200));
18702
+ }
18703
+ if (existsSync23(row.capturePath)) {
18704
+ const converted = await convertCaptureToMp4(row.capturePath, row.path);
18705
+ if (converted) {
18706
+ try {
18707
+ unlinkSync3(row.capturePath);
18708
+ } catch {
18709
+ }
18710
+ } else {
18711
+ finalPath = row.capturePath;
18712
+ warning = "ffmpeg conversion to mp4 failed; kept .mov capture file";
18713
+ }
18714
+ }
18715
+ }
18716
+ const ok = existsSync23(finalPath);
18717
+ const sizeMb = ok ? Math.round(statSync4(finalPath).size / (1024 * 1024) * 10) / 10 : 0;
18718
+ return { path: finalPath, ok, sizeMb, warning };
18719
+ }
18660
18720
  const record = program.command("record").description("Start/stop screen recordings");
18661
18721
  record.command("start").description("Start a screen recording (returns id, path, pid as JSON)").option("--name <slug>", "Optional human-readable label for the recording").option("--dir <path>", "Output directory (default: ~/recordings)").action(async (opts) => {
18662
18722
  const { homedir: homedir2, platform: osPlatform } = await import("os");
18663
18723
  const outDir = opts.dir ? resolve13(opts.dir.replace(/^~/, homedir2())) : join18(homedir2(), "recordings");
18664
18724
  mkdirSync11(outDir, { recursive: true });
18665
18725
  const id = `rec-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
18666
- const ext = osPlatform() === "darwin" ? "mov" : "mp4";
18726
+ const ext = "mp4";
18667
18727
  const filename = `${id}${opts.name ? `-${String(opts.name).replace(/[^a-z0-9-]+/gi, "-").toLowerCase()}` : ""}.${ext}`;
18668
18728
  const path = join18(outDir, filename);
18669
18729
  let cmd;
18670
18730
  let args;
18731
+ let capturePath;
18671
18732
  if (osPlatform() === "darwin") {
18733
+ capturePath = path.replace(/\.mp4$/i, ".mov");
18672
18734
  cmd = existsSync23("/usr/sbin/screencapture") ? "/usr/sbin/screencapture" : "screencapture";
18673
- args = ["-v", "-C", "-k", path];
18735
+ args = ["-v", "-C", "-k", capturePath];
18674
18736
  } else if (osPlatform() === "linux") {
18675
18737
  const display = process.env.DISPLAY || ":0.0";
18676
18738
  const size = process.env.SPARKECODER_RECORD_SIZE || "1920x1080";
@@ -18715,6 +18777,7 @@ program.command("request-permissions").description("Open System Settings to the
18715
18777
  });
18716
18778
  await new Promise((r) => setTimeout(r, 600));
18717
18779
  if (spawnError || exited || !child.pid) {
18780
+ child.stderr?.destroy();
18718
18781
  const diagnosis = [
18719
18782
  spawnError && `spawn error: ${spawnError}`,
18720
18783
  exited && `recorder exited code=${exitCode} within 600ms`,
@@ -18733,11 +18796,13 @@ program.command("request-permissions").description("Open System Settings to the
18733
18796
  }));
18734
18797
  process.exit(1);
18735
18798
  }
18799
+ child.stderr?.destroy();
18736
18800
  child.unref();
18737
18801
  const row = {
18738
18802
  id,
18739
18803
  name: opts.name,
18740
18804
  path,
18805
+ capturePath,
18741
18806
  pid: child.pid,
18742
18807
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
18743
18808
  platform: osPlatform()
@@ -18755,31 +18820,15 @@ program.command("request-permissions").description("Open System Settings to the
18755
18820
  process.exit(1);
18756
18821
  }
18757
18822
  const startedAt = new Date(row.startedAt).getTime();
18758
- if (isAlive(row.pid)) {
18759
- try {
18760
- process.kill(row.pid, "SIGINT");
18761
- } catch {
18762
- }
18763
- for (let i = 0; i < 40; i++) {
18764
- if (!isAlive(row.pid)) break;
18765
- await new Promise((r) => setTimeout(r, 200));
18766
- }
18767
- if (isAlive(row.pid)) {
18768
- try {
18769
- process.kill(row.pid, "SIGTERM");
18770
- } catch {
18771
- }
18772
- }
18773
- }
18823
+ const { path: finalPath, ok, sizeMb, warning } = await finalizeRecording(row);
18774
18824
  writeState(rows.filter((r) => r.id !== id));
18775
- const fileExists = existsSync23(row.path);
18776
- const sizeMb = fileExists ? Math.round(statSync4(row.path).size / (1024 * 1024) * 10) / 10 : 0;
18777
18825
  console.log(JSON.stringify({
18778
18826
  id,
18779
- path: row.path,
18827
+ path: finalPath,
18780
18828
  durationSec: Math.round((Date.now() - startedAt) / 1e3),
18781
18829
  sizeMb,
18782
- ok: fileExists
18830
+ ok,
18831
+ ...warning ? { warning } : {}
18783
18832
  }));
18784
18833
  });
18785
18834
  record.command("list").description("List active recordings").action(() => {
@@ -18791,28 +18840,14 @@ program.command("request-permissions").description("Open System Settings to the
18791
18840
  const rows = readState();
18792
18841
  const stopped = [];
18793
18842
  for (const r of rows) {
18794
- if (isAlive(r.pid)) {
18795
- try {
18796
- process.kill(r.pid, "SIGINT");
18797
- } catch {
18798
- }
18799
- for (let i = 0; i < 30; i++) {
18800
- if (!isAlive(r.pid)) break;
18801
- await new Promise((res) => setTimeout(res, 200));
18802
- }
18803
- if (isAlive(r.pid)) {
18804
- try {
18805
- process.kill(r.pid, "SIGTERM");
18806
- } catch {
18807
- }
18808
- }
18809
- }
18810
- stopped.push({ id: r.id, path: r.path, ok: existsSync23(r.path) });
18843
+ const { path: finalPath, ok, warning } = await finalizeRecording(r);
18844
+ stopped.push({ id: r.id, path: finalPath, ok, ...warning ? { warning } : {} });
18811
18845
  }
18812
18846
  writeState([]);
18813
18847
  console.log(JSON.stringify({ stopped }));
18814
18848
  });
18815
18849
  }
18850
+ var shellEscape3;
18816
18851
  var stateFilePath2;
18817
18852
  var readState2;
18818
18853
  var writeState2;