Skip to content

Add KSFP chunked attachment ingestion and playback#94

Open
kojibai wants to merge 13 commits intomainfrom
codex/integrate-ksfp-1-in-kaivoh-file-upload
Open

Add KSFP chunked attachment ingestion and playback#94
kojibai wants to merge 13 commits intomainfrom
codex/integrate-ksfp-1-in-kaivoh-file-upload

Conversation

@kojibai
Copy link
Copy Markdown
Owner

@kojibai kojibai commented Dec 28, 2025

Motivation

  • Provide an on-device sovereign storage + playback path for large files (videos) using the KSFP-1 spec so large uploads are playable from the Memory Stream without external hosting.
  • Make Fibonacci/logarithmic chunking, per-chunk Merkle commitments, and cache-backed lineage/origin metadata first-class for attachments.
  • Allow existing composer flow to produce KSFP-backed file-ref attachments so streams can reconstruct and verify files offline.

Description

  • Add src/lib/ksfp1.ts implementing KSFP ingestion and storage: ingestKsfpFile, chunk schedule (FCS-1), chunk hashing (BLAKE3), Merkle root/proofs, and cache keys KSFP_ORIGIN_PREFIX / KSFP_LINEAGE_PREFIX / KSFP_BLOB_PREFIX.
  • Wire ingestion into the composer: call ingestKsfpFile from the file/Story handlers in src/components/KaiVoh/KaiVoh.tsx and prefer KSFP origin URLs when available.
  • Add a KSFP-aware renderer src/pages/sigilstream/attachments/ksfp.tsx providing KsfpFileCard and shouldRenderKsfp, integrating it into the attachments gallery so cached KSFP origins: (a) stream via MediaSource for video, and (b) reconstruct full Blob for download.
  • Add lightweight styling in src/pages/sigilstream/styles/sigilstream.css and integrate the KSFP card in gallery.tsx to surface KSFP-backed attachments in the Memory Stream UI.

Testing

  • Started the dev server with npm run dev and it launched successfully (Vite served the app). — succeeded.
  • Ran a Playwright render script to inject a KSFP-style attachment card and captured a screenshot for visual verification. — succeeded (screenshot artifact produced).
  • No automated unit tests or CI test suite were run as part of this change. — not executed.
  • Verified local git commit of the new files and UI integration (files created: src/lib/ksfp1.ts, src/pages/sigilstream/attachments/ksfp.tsx and modifications to KaiVoh/gallery/CSS). — succeeded.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
phi-network-5aii Ready Ready Preview, Comment Dec 28, 2025 11:57pm

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to +73
const codec = origin.specialization?.codec;
const mimeBase = origin.mime || "video/mp4";
const mime = codec ? `${mimeBase}; codecs="${codec}"` : mimeBase;
if (!MediaSource.isTypeSupported(mime)) {
throw new Error(`Unsupported media type: ${mime}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Provide codecs info for KSFP MediaSource playback

When origin.specialization.codec is unset, the MIME passed to MediaSource.isTypeSupported becomes just origin.mime (e.g., video/mp4). In this change, ingestKsfpFile only sets container/initSegmentKey for videos and never populates codec, so MP4 KSFP origins will commonly hit isTypeSupported("video/mp4") === false in browsers that require a codec string for MSE. That causes the stream to throw "Unsupported media type" and prevents playback even though the data is valid. Consider extracting/recording codecs during ingestion or relaxing the isTypeSupported check when codecs are missing.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant