sparkecoder 0.1.127 → 0.1.129

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 (106) hide show
  1. package/dist/cli.js +42 -4
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.js +42 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/server/index.js +42 -4
  6. package/dist/server/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/web/.next/BUILD_ID +1 -1
  9. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  10. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  11. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  12. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  13. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  14. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  15. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  16. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  17. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  21. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
  22. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  23. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  24. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  26. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/agents.html +1 -1
  29. package/web/.next/standalone/web/.next/server/app/agents.rsc +1 -1
  30. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents/__PAGE__.segment.rsc +1 -1
  31. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents.segment.rsc +1 -1
  32. package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p.segment.rsc +1 -1
  33. package/web/.next/standalone/web/.next/server/app/agents.segments/_full.segment.rsc +1 -1
  34. package/web/.next/standalone/web/.next/server/app/agents.segments/_head.segment.rsc +1 -1
  35. package/web/.next/standalone/web/.next/server/app/agents.segments/_index.segment.rsc +1 -1
  36. package/web/.next/standalone/web/.next/server/app/agents.segments/_tree.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
  38. package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
  39. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
  40. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
  41. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
  42. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
  43. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
  44. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
  45. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
  46. package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
  47. package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
  48. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
  49. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
  50. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
  51. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
  52. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
  53. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
  54. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
  55. package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
  56. package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
  57. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
  58. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
  59. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
  60. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
  61. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
  62. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
  63. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
  64. package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
  65. package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
  66. package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
  67. package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  68. package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  69. package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  70. package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
  71. package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  72. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  73. package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
  74. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
  75. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
  76. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
  77. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  78. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  79. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  80. package/web/.next/standalone/web/.next/server/app/settings.html +1 -1
  81. package/web/.next/standalone/web/.next/server/app/settings.rsc +1 -1
  82. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings/__PAGE__.segment.rsc +1 -1
  83. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings.segment.rsc +1 -1
  84. package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p.segment.rsc +1 -1
  85. package/web/.next/standalone/web/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  86. package/web/.next/standalone/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  87. package/web/.next/standalone/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  88. package/web/.next/standalone/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  89. package/web/.next/standalone/web/.next/server/chunks/ssr/[root-of-the-server]__e5911ea8._.js +1 -1
  90. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  91. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  92. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  93. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  94. package/web/.next/standalone/web/.next/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
  95. package/web/.next/standalone/web/.next/static/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
  96. package/web/.next/standalone/web/src/components/chat-interface.tsx +59 -7
  97. package/web/.next/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
  98. /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
  99. /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
  100. /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
  101. /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
  102. /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
  103. /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
  104. /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
  105. /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
  106. /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
@@ -544,6 +544,56 @@ interface QueuedMessage {
544
544
  selectedElements?: string | null;
545
545
  }
546
546
 
547
+ /**
548
+ * Walk an arbitrary JSON-ish value and replace base64 image / binary
549
+ * blobs with a short placeholder. Without this, dumping a session that
550
+ * read several screenshots produces a multi-MB file that crashes the
551
+ * clipboard / chokes the IDE when you paste it back in.
552
+ *
553
+ * Heuristics for "this is binary I should strip":
554
+ * - parts whose `.type` is `'image-data'`, `'image'`, `'file'`
555
+ * - any string field named `data` / `image` / `base64` whose length is large
556
+ * - any string > 8 KB that looks like base64 (long, no spaces)
557
+ */
558
+ function stripBinaryBlobs(value: unknown, depth = 0): unknown {
559
+ if (depth > 100) return '[max depth]'; // belt-and-suspenders against cycles
560
+ if (value == null) return value;
561
+ if (typeof value === 'string') {
562
+ // Strip data: URIs and very long base64-looking blobs.
563
+ if (value.length > 8 * 1024 && /^(data:[^;]+;base64,)?[A-Za-z0-9+/=]{1000,}$/.test(value)) {
564
+ return `[stripped: ~${(value.length / 1024).toFixed(1)}KB base64]`;
565
+ }
566
+ return value;
567
+ }
568
+ if (Array.isArray(value)) return value.map((v) => stripBinaryBlobs(v, depth + 1));
569
+ if (typeof value === 'object') {
570
+ const obj = value as Record<string, unknown>;
571
+ // Whole-part replacement for known binary part types.
572
+ const type = obj.type;
573
+ if (type === 'image-data' || type === 'image' || type === 'file') {
574
+ const dataLen = typeof obj.data === 'string' ? obj.data.length : 0;
575
+ const imageLen = typeof obj.image === 'string' ? obj.image.length : 0;
576
+ return {
577
+ type,
578
+ mediaType: obj.mediaType,
579
+ filename: obj.filename,
580
+ __strippedBytes: dataLen || imageLen || 0,
581
+ };
582
+ }
583
+ const out: Record<string, unknown> = {};
584
+ for (const [k, v] of Object.entries(obj)) {
585
+ // Aggressive strip for fields that almost always carry binary payloads.
586
+ if ((k === 'data' || k === 'image' || k === 'base64') && typeof v === 'string' && v.length > 4 * 1024) {
587
+ out[k] = `[stripped: ~${(v.length / 1024).toFixed(1)}KB]`;
588
+ continue;
589
+ }
590
+ out[k] = stripBinaryBlobs(v, depth + 1);
591
+ }
592
+ return out;
593
+ }
594
+ return value;
595
+ }
596
+
547
597
  /**
548
598
  * Gather EVERYTHING a developer might want to debug a session and return it
549
599
  * as a single pretty-printed JSON blob suitable for pasting into a bug
@@ -551,10 +601,11 @@ interface QueuedMessage {
551
601
  * recorded as `{ __error: '...' }` in its slot so the rest of the dump
552
602
  * still arrives.
553
603
  *
554
- * Intentionally chunky: messages include full model-message content,
555
- * tool inputs/outputs, attachments, todos, plans, checkpoints, working-
556
- * directory diff, pending approvals, browser recordings, etc. The whole
557
- * point is "everything we could possibly need."
604
+ * Intentionally chunky for code / config / message text, but binary blobs
605
+ * (screenshots, file uploads, image attachments) are stripped down to a
606
+ * `{__strippedBytes: N}` marker the model already saw them at the time,
607
+ * and including a 1.3 MB base64 PNG per screenshot makes the dump
608
+ * unusable (we hit 4.5 MB in practice before stripping).
558
609
  */
559
610
  async function buildSessionDebugDump(sessionId: string): Promise<string> {
560
611
  const safe = async <T,>(label: string, fn: () => Promise<T>): Promise<T | { __error: string }> => {
@@ -593,14 +644,15 @@ async function buildSessionDebugDump(sessionId: string): Promise<string> {
593
644
  safe('browserRecordings', () => getBrowserRecordings(sessionId)),
594
645
  ]);
595
646
 
596
- const dump = {
647
+ const dump = stripBinaryBlobs({
597
648
  __meta: {
598
649
  kind: 'sparkecoder-session-debug-dump',
599
- version: 1,
650
+ version: 2,
600
651
  capturedAt: new Date().toISOString(),
601
652
  sessionId,
602
653
  origin: typeof window !== 'undefined' ? window.location.origin : null,
603
654
  userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : null,
655
+ stripping: 'binary blobs (images, file uploads, base64 > 8KB) are replaced with size markers',
604
656
  },
605
657
  session,
606
658
  messages,
@@ -614,7 +666,7 @@ async function buildSessionDebugDump(sessionId: string): Promise<string> {
614
666
  pendingInput,
615
667
  browserStream,
616
668
  browserRecordings,
617
- };
669
+ });
618
670
  return JSON.stringify(dump, null, 2);
619
671
  }
620
672