repo stringclasses 20
values | path stringlengths 6 94 | lang stringclasses 5
values | n_chars int64 81 200k | sha256 stringlengths 64 64 | content stringlengths 81 200k |
|---|---|---|---|---|---|
eren23/synapse | synapse/examples/bench_code_wm.rs | rs | 3,684 | bef995e8f0559ce65dc83fa375d1cc35b5e2ed047a42edf70c1a288c660fda39 | //! Code WM latency + throughput benchmark.
//!
//! Measures encoder / action / predictor latencies at multiple sequence lengths.
//! Reports p50 / p95 / mean per stage.
//!
//! Usage:
//! cargo run --release --example bench_code_wm -- \
//! models/code_wm/g8.safetensors \
//! configs/code_wm_g8.json \
//... |
eren23/synapse | synapse/examples/text_classification.rs | rs | 9,592 | 9099d2053bdbf20a82382b0752ffe8e609ab7a6f2edcf22184a0161ef3112e3d | //! Text classification: Transformer encoder on synthetic binary classification.
//!
//! Pipeline: Embedding β SinusoidalPositionalEncoding β TransformerEncoder(2 layers,
//! d_model=64, 4 heads, d_ff=256) β MeanPool1d β Linear β cross-entropy loss
//! Optimizer: Adam with linear warmup.
//! Demonstrates the ... |
eren23/synapse | synapse/examples/vit_classify.rs | rs | 5,762 | f41c40911dd0cd72438257e8e0a27b98a7b2878373c9c1c2c159f70f95381b84 | //! Classify an image using HuggingFace ViT-base weights.
//!
//! Usage:
//! cargo run --release --example vit_classify -- --model-dir /tmp/vit-base
//!
//! The model directory must contain `config.json` and `model.safetensors`
//! from `google/vit-base-patch16-224`.
use std::path::PathBuf;
use synapse_inference::m... |
eren23/synapse | synapse/benchmarks/lewm_speed_of_light.py | py | 8,034 | 1740fcc3029cca59d55c4cd12aa9fbc9c315c08b88622bec13293292e475897e | """
LEWM Speed-of-Light Comparison
==============================
Compares Synapse vs PyTorch across all optimization levels:
1. PyTorch eager (standard)
2. PyTorch torch.compile
3. PyTorch fully-fused (hand-optimized, minimal allocations)
4. PyTorch MPS (Apple GPU)
The fully-fused kernel is the theoretical floor β i... |
eren23/synapse | synapse/benchmarks/lewm_profile.rs | rs | 4,281 | 92f0fc880b870d5edbe207fb3c8ad978902d4127288b72506694f1839f7a8733 | use std::time::Instant;
use synapse_inference::models::vision::lewm::{LeWMConfig, LeWorldModel};
fn main() {
let config = LeWMConfig::pusht();
let weights_path = "/tmp/lewm-pusht/pusht/lejepa_weights.safetensors";
let weights = synapse_inference::weight_loading::load_safetensors(
std::path::Path::n... |
eren23/synapse | synapse/benchmarks/model_benchmark.rs | rs | 12,310 | ba230a532230d0e358fab50bc17d310714e580b39b5a17181357bd471ca02c03 | //! Benchmark any model via config.
//!
//! Usage:
//! cargo run --example model_benchmark --release
//! cargo run --example model_benchmark --release -- --config configs/llama3.2_1b.json
//!
//! Runs prefill and decode benchmarks, reporting throughput in tok/s.
//! Uses random weights (replace with real checkpoint... |
eren23/synapse | synapse/benchmarks/lewm_quant_bench.rs | rs | 8,021 | cb154cc925685de55a084f1e43003883a019603bda117f1425aa4c99480bbb82 | use std::time::Instant;
use synapse_inference::models::vision::lewm::{LeWMBuffers, LeWMConfig, LeWorldModel};
use synapse_inference::quantization::{quantize_lewm, quantize_lewm_q4, cached_q4_lewm};
fn main() {
let config = LeWMConfig::pusht();
// Load real model
let weights_path = "/tmp/lewm-pusht/pus... |
eren23/synapse | synapse/scripts/export_unixcoder_reference.py | py | 17,890 | 7c8f50bf82936ea317c20117fa30bc4055a1d914df0e60ce6ddd323bf7a6806f | #!/usr/bin/env python3
"""Export HuggingFace UniXcoder reference activations + CDT checkpoint conversion.
Two sub-commands:
export
Run microsoft/unixcoder-base on a small, deterministic code corpus
and dump (input_ids, attention_mask, last_hidden_state[:,0,:]) plus
per-layer intermediates ... |
eren23/synapse | synapse/scripts/tokenize_snippets.py | py | 6,499 | 85bb7b6fa04961a3c4956e9723962aefc38345d6051b996537d34fc2183408ae | #!/usr/bin/env python3
"""Curated semantic similarity test for Code WM.
Hand-picked Python snippets with known semantic relationships. Encode each,
compute pairwise cosine, check whether semantically-similar pairs cluster.
Categories:
sort β sorting algorithms (expect high intra-cluster cosine)
str β string ... |
eren23/synapse | synapse/scripts/build_commitpack_index.py | py | 3,476 | 090570339ead4102c3af007c7dfe012a114409c8aeda702ef0c5708c21f4fed5 | #!/usr/bin/env python3
"""Build a retrieval index from CommitPackFT Python.
Streams the CommitPackFT dataset, extracts N before-state snippets, tokenizes
each with the FNV tokenizer, and saves tokens + metadata for Rust-side retrieval.
Dataset: bigcode/commitpackft (https://huggingface.co/datasets/bigcode/commitpackf... |
eren23/synapse | synapse/scripts/lfm25_generate.py | py | 1,556 | 980fd6b98c205b24e8cb63afc692df199d0f8f6437612a51a91f0398bcf20ba3 | #!/usr/bin/env python3
"""Generate text with LFM2.5-350M via HuggingFace transformers.
Usage:
python3 scripts/lfm25_generate.py "What is the capital of France?"
python3 scripts/lfm25_generate.py # interactive mode
"""
import sys
def main():
from transformers import AutoModelForCausalLM, AutoTokenizer, Te... |
eren23/synapse | synapse/scripts/verify_logits.py | py | 1,333 | ac75ac29712090a064efae8da2415ffa011795ad3c2795930245ea37d201eaea | #!/usr/bin/env python3
"""Compare Synapse logits against HuggingFace transformers reference.
Usage:
pip install transformers torch
python scripts/verify_logits.py /tmp/qwen3-0.6b
Then compare the output against:
cargo run --example qwen3_chat --release -- --model-dir /tmp/qwen3-0.6b --verify
"""
import sys
impo... |
eren23/synapse | synapse/scripts/sync_public_status.py | py | 8,533 | 44243949604182fe1f4aaf96c5fca75a9f41e60f7ea5ad21fe72c634fade8fc1 | #!/usr/bin/env python3
"""Render shared public status blocks from a single manifest."""
from __future__ import annotations
import argparse
import json
import re
import sys
from pathlib import Path
from typing import Any
from _shared import format_label
ROOT = Path(__file__).resolve().parents[1]
MANIFEST_PATH = ROO... |
eren23/synapse | synapse/scripts/convert_lewm_ckpt.py | py | 21,279 | 24b1d838ab8b36530c3e3ebdcc1cd964401a2e16d4b58e29e355ccb80e8c74f6 | #!/usr/bin/env python3
"""Convert crucible LEWM .ckpt object files to safetensors + config.json.
Handles PyTorch pickled model objects without requiring the `jepa` or `module`
packages by using a stub unpickler. Auto-detects model config from weight shapes.
NOTE: This script uses pickle to load PyTorch checkpoint fil... |
eren23/synapse | synapse/scripts/_shared.py | py | 937 | 68f0a42d339c28eb8ce18c32e1ad3d13832ffd2ceaa3fe2f068f466252a7236e | """Shared utilities for synapse scripts."""
from __future__ import annotations
import importlib.util
def load_tokenizer_func(module_path: str, module_name: str, func_name: str):
"""Dynamically load a tokenizer function from a Python module.
Args:
module_path: Filesystem path to the .py file.
... |
eren23/synapse | synapse/scripts/tokenize_code_dir.py | py | 2,955 | a5c94c50eb5bec51b62cba38c875bc1c85b97b76436f7a2cf230db442b700819 | #!/usr/bin/env python3
"""Tokenize a directory of Python files for Code WM retrieval demo.
Walks a directory, tokenizes each .py file via the AST tokenizer, and saves
the batch as a single .safetensors file (tokens as f32 because Synapse's
loader doesn't handle i64). File paths are stored in a sidecar .json.
Usage:
... |
eren23/synapse | synapse/scripts/convert_code_wm_ckpt.py | py | 10,235 | c7523344bcf70d52d0619b7007701195274d561837c193dcded8b921dc2d6a3d | #!/usr/bin/env python3
"""Convert Code WM .pt checkpoint to safetensors + config.json for Synapse.
Filters out training-only tensors (target_encoder, pred_projector, target_projector)
and keeps: state_encoder.*, action_encoder.*, predictor.*. The sinusoidal PE
buffer (state_encoder.pos_enc.pe) is included by default s... |
eren23/synapse | synapse/scripts/lfm25_baseline_comparison.py | py | 3,640 | 96f438fc29be22244ae151a986e763ebc463058993c308a4a8303cbc073da042 | #!/usr/bin/env python3
"""Compare LFM2.5-350M logits: Synapse (GGUF) vs HuggingFace (reference).
Usage:
python3 scripts/lfm25_baseline_comparison.py
Requires: transformers, torch, accelerate
"""
import subprocess, sys, time
import numpy as np
def get_hf_logits(token_ids: list[int]) -> np.ndarray:
"""Get refe... |
eren23/synapse | synapse/scripts/debug_rwkv_baseline.py | py | 2,087 | e3d3e6f241d632b3ce674e3782a943fa81feb2b4c5acd2ed901f41b37c199558 | #!/usr/bin/env python3
"""HF baseline for RWKV logit / tokenizer comparison (pair with rwkv_logit_probe).
python -m venv .venv && source .venv/bin/activate
pip install torch transformers safetensors
# From HuggingFace (needs modeling_rwkv7.py + configuration_rwkv7.py β use hub id):
HF_HOME=$PWD/.hf-cache pyth... |
eren23/synapse | synapse/scripts/tokenize_refactor_pairs.py | py | 4,439 | dc18516f25f5f6d7848ca660ef1932533f8e3f35ab32bc8fe8f544ba566ab55f | #!/usr/bin/env python3
"""Refactor-pair corpus: semantically identical, syntactically different.
The pairs preserve behavior exactly but change surface syntax:
- Pure renames (variables, functions)
- Idiom swaps (for loop β comprehension, if/else β ternary)
- Equivalent formulations (a+b+c β sum([a,b,c]), str() β f-st... |
eren23/synapse | synapse/scripts/tokenize_edit_pairs.py | py | 6,844 | 4376465080b995d9a9468e3b87e8a6db13a67ff574a9fa3d2eb8b8c861054cda | #!/usr/bin/env python3
"""Edit-pair corpus: before/after Python snippets mimicking real commits.
The Code WM was trained on CommitPackFT edits (before β after + action).
For each pair, we encode both snippets and measure cosine similarity.
Expected: high cosine (>0.9) because the edits are small, structure-preserving.... |
eren23/synapse | synapse/scripts/ast_tokenizer_fnv.py | py | 5,196 | 0b8b0a2c38e536e95a477786a0975a113f86eb9b7cc6423724961407016e637e | #!/usr/bin/env python3
"""Python AST tokenizer with FNV-1a hash β matches synapse-code-tokenizer (Rust).
This is a deterministic variant of the training tokenizer. Uses FNV-1a instead
of Python's PYTHONHASHSEED-randomized hash() so tokens are stable across
processes AND match the Rust port byte-for-byte.
Usage:
f... |
eren23/synapse | synapse/scripts/benchmark_matrix.py | py | 28,194 | 3affba7a8042f5ce855ba42fb0996409d55d23bec72bb6e449b3523f773fe087 | #!/usr/bin/env python3
"""Run the Synapse validation matrix and publish a tiered benchmark artifact."""
from __future__ import annotations
import argparse
import json
import platform
import re
import shlex
import subprocess
import sys
import time
from dataclasses import dataclass
from datetime import datetime, timezo... |
eren23/synapse | synapse/scripts/build_file_index.py | py | 3,492 | 8d4f80e3102f8901c8a7556e8155238d8b63e0f3c01082a563158a81862b997d | #!/usr/bin/env python3
"""Build a retrieval index by walking a directory tree of .py files.
For real-world validation: encode 500+ diverse Python files (from site-packages,
stdlib, or any corpus) and measure retrieval quality on actual code.
Usage:
python3 scripts/build_file_index.py --dir .venv-rwkv-debug/lib/pyth... |
eren23/synapse | synapse/scripts/reference/generate_rwkv_reference.py | py | 3,369 | fa1f6115fed6f2ce923b52be53a764a1ce0b66bb4fa03e8066cf27a0059f5192 | #!/usr/bin/env python3
"""Generate reference logits for RWKV-7 validation.
Downloads the RWKV-7 Goose 0.1B model from HuggingFace, runs a forward pass,
and saves the logits as JSON for Rust integration tests.
Usage:
pip install -r requirements.txt
python generate_rwkv_reference.py
Output: ../../tests/fixture... |
eren23/synapse | synapse/scripts/reference/generate_mamba_reference.py | py | 4,297 | 07fed4f63038be2f497dd4ab325b164d8700161da1da40d5ea7bf55abe63b52a | #!/usr/bin/env python3
"""Generate reference logits for Mamba-130M validation.
Usage:
pip install -r requirements.txt
python generate_mamba_reference.py
Output: ../../tests/fixtures/mamba_130m_reference.json
"""
import json
import os
import torch
from transformers import MambaConfig, MambaForCausalLM, AutoTo... |
eren23/synapse | synapse/scripts/reference/generate_reference.py | py | 2,827 | d5e45d5113535fcc9f80b93e588d5603e5e41a2a2fc497e2655f895c877c1c19 | #!/usr/bin/env python3
"""Generate reference logits from a HuggingFace model for Synapse validation.
Usage:
python generate_reference.py --model state-spaces/mamba-130m \
--prompt "The capital of France is" \
--output ../../tests/fixtures/mamba_130m_reference.json
The output JSON contains:
- m... |
eren23/synapse | synapse/scripts/reference/inspect_checkpoint.py | py | 2,594 | 1decbcc2738fda5f3b063f6154f82902652e5ccc96ca88a4a3870caff2138339 | #!/usr/bin/env python3
"""Inspect a HuggingFace checkpoint's weight names and shapes.
Usage:
python inspect_checkpoint.py /path/to/model_dir
Prints all tensor names, shapes, dtypes, and total parameter count.
Useful for verifying weight naming conventions match our from_weights() code.
"""
import argparse
import ... |
eren23/synapse | synapse/scripts/reference/lewm_pytorch_baseline.py | py | 9,604 | 14db3048e20e51bd0e0e72f9cd474fb2b7dc0276a59ec14b05063b28debf400b | #!/usr/bin/env python3
"""LeWM PyTorch baseline benchmark.
Measures f32/bf16 inference speed and model size for comparison against Synapse.
Uses the same test image + action sequence as lewm_compress.rs.
Usage:
pip install torch safetensors
python scripts/reference/lewm_pytorch_baseline.py [checkpoint_path]
"... |
eren23/synapse | synapse/scripts/reference/convert_rwkv_checkpoint.py | py | 9,249 | 52fe7f45edd39eac91ecac2d0bf6b8373c3be6386f23d89b6e093b91e9f14388 | #!/usr/bin/env python3
"""Convert official RWKV-7 HF checkpoint to Synapse-compatible format.
Handles:
1. bf16 β f32 conversion
2. LoRA-style names β flat names (w_lora.lora.{0,2} β w0/w1/w2)
3. Squeeze [1,1,h] lerp shapes to [h]
4. Add num_heads to config if missing
Usage:
python convert_rwkv_checkpoint.py model... |
eren23/synapse | synapse/scripts/reference/code_wm_pytorch_baseline.py | py | 10,874 | 41d90640fd57eea072b822ea91023b0941896993b88dcfda08859461e484556f | #!/usr/bin/env python3
"""PyTorch reference dump for Code WM zero-drift validation.
Runs the PyTorch CodeWorldModel forward pass with a shadow implementation
that captures every intermediate activation (per encoder loop, per predictor
block/loop). Saves all activations + inputs as a single safetensors file so
the Rust... |
eren23/synapse | synapse/synapse-wasm/src/lib.rs | rs | 164,663 | aae5c96e41a7196fa17a3edad53e9f89596f611a99a969af2902f65ce470d466 | //! Synapse WASM: Real LeWorldModel inference in the browser.
//!
//! Loads the actual LeWM checkpoint (69MB f32 binary) and runs:
//! - ViT encoder (12 layers, 192 hidden, 3 heads)
//! - DiT predictor with adaLN modulation (6 layers, 16 heads, 1024 inner_dim)
//! - Action encoder (conv1d + MLP)
//! - Projector and pre... |
eren23/synapse | synapse/src/lib.rs | rs | 190 | 5f2221364038ece0527cbfbb01d2ffb870745222350d4d9d52b34bf39eac21f3 | pub use synapse_autograd as autograd;
pub use synapse_data as data;
pub use synapse_graph as graph;
pub use synapse_nn as nn;
pub use synapse_optim as optim;
pub use synapse_train as train;
|
eren23/non_linear_ai_chat | landing/next.config.ts | ts | 129 | 496898063c834c666510bdb5bb472bcf08e01ca8eef297da101ad12680c8fc93 | import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
};
export default nextConfig;
|
eren23/non_linear_ai_chat | landing/src/app/layout.tsx | tsx | 1,819 | 16d66dc5578da3ac621f7c8f2e0647fc8687b658909e230a18b60b0153dcf4a8 | import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Met... |
eren23/non_linear_ai_chat | landing/src/app/page.tsx | tsx | 627 | 64abec36d85755c5c34030c8b6fcbba3f13b00b26b68ac23889026d9aeb39760 | import { Navbar } from "@/components/sections/Navbar";
import { Hero } from "@/components/sections/Hero";
import { DemoShowcaseSection } from "@/components/demo/DemoShowcaseSection";
import { Features } from "@/components/sections/Features";
import { Pricing } from "@/components/sections/Pricing";
import { CallToAction... |
eren23/non_linear_ai_chat | landing/src/app/privacy/page.tsx | tsx | 3,725 | 0d19697f38a7ac5e9847c7d5e024f636fb64a8772adeaab19a0c1f005632c9f2 | import { Navbar } from "@/components/sections/Navbar";
import { Footer } from "@/components/sections/Footer";
import type { Metadata } from "next";
export const metadata: Metadata = {
title: "Privacy Policy β Spider Chat",
description: "Spider Chat privacy policy.",
};
export default function PrivacyPage() {
re... |
eren23/non_linear_ai_chat | landing/src/app/terms/page.tsx | tsx | 4,666 | f730c648ccb54f031b8d1d6945c498e7f4b0cbf5b51006bea7bbecc0beb282ac | import { Navbar } from "@/components/sections/Navbar";
import { Footer } from "@/components/sections/Footer";
import type { Metadata } from "next";
export const metadata: Metadata = {
title: "Terms of Service β Spider Chat",
description: "Spider Chat terms of service.",
};
export default function TermsPage() {
... |
eren23/non_linear_ai_chat | landing/src/components/LenisProvider.tsx | tsx | 517 | 2cbcb53403ccda22795817aec3d8dd85a31f0c713a2f9b4d7c65fa3b469a06da | "use client";
import { useEffect } from "react";
import Lenis from "lenis";
export function LenisProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
});
function raf(time... |
eren23/non_linear_ai_chat | landing/src/components/demo/kgDemoData.ts | ts | 5,109 | 1b482d4b2cd149ee2366268cdb225efd85c0cb7d5d50a964fea1e63f823e8195 | export type KGNodeType = "topic" | "tool" | "skill" | "concept";
export interface KGDemoNode {
id: string;
label: string;
type: KGNodeType;
importance: number; // 1-5, affects radius
/** Pre-calculated position (centered at 0,0) */
x: number;
y: number;
/** Which demo branch reveals this node. Hub node... |
eren23/non_linear_ai_chat | landing/src/components/demo/KnowledgeGraphPeek.tsx | tsx | 3,474 | d3ef43eb9ceec948fe6d5f73d5e598d976545917a168f1d33521a911c486052f | "use client";
import { useRef, useEffect, useState, useMemo } from "react";
import { useInView } from "motion/react";
import { kgNodes, kgEdges, type KGDemoNode } from "./kgDemoData";
import { KGNode } from "./KGNode";
import { KGEdge } from "./KGEdge";
import { useDemoContext } from "./DemoContext";
const SVG_WIDTH ... |
eren23/non_linear_ai_chat | landing/src/components/demo/DemoNode.tsx | tsx | 4,430 | 2b4ef020be066fda683ca68582961c4f804b512635511c66ee24bdcd18bad07b | "use client";
import { motion, useReducedMotion } from "motion/react";
import { User, Sparkles } from "lucide-react";
import type { DemoNode as DemoNodeData } from "./demoData";
interface DemoNodeProps {
node: DemoNodeData;
state: "hidden" | "entering" | "visible" | "selected" | "dimmed" | "stacked";
onClick?: ... |
eren23/non_linear_ai_chat | landing/src/components/demo/DemoShowcaseSection.tsx | tsx | 7,597 | 4e376e9203f6977556acd17655ed68efb96c7be39b16359c1ba34c122d3626ca | "use client";
import dynamic from "next/dynamic";
import { motion, AnimatePresence } from "motion/react";
import { DemoProvider } from "./DemoContext";
import { KG_LEGEND, KG_COLORS } from "./kgDemoData";
import { useDemoContext } from "./DemoContext";
const InteractiveDemo = dynamic(
() => import("./InteractiveDem... |
eren23/non_linear_ai_chat | landing/src/components/demo/useDemoState.ts | ts | 4,312 | ce7c9a5e2dfb619e7ec02ce353c2b6d390c65bd7c11330ccf91e9a4c43bc05d8 | "use client";
import { useState, useCallback, useEffect, useRef } from "react";
import type { Branch } from "./demoData";
export type DemoPhase =
| "idle"
| "intro" // Root node animating in
| "branching" // L1 nodes appearing
| "awaiting-l1" // Waiting for user to click an L1 branch
| "exploring... |
eren23/non_linear_ai_chat | landing/src/components/demo/KnowledgeGraphSection.tsx | tsx | 2,717 | 423fcb0649c7052b10e8f0859771233ad77e01abd0d3c4e159bfda6aa526620e | "use client";
import dynamic from "next/dynamic";
import { motion } from "motion/react";
import { KG_LEGEND, KG_COLORS } from "./kgDemoData";
const KnowledgeGraphPeek = dynamic(
() => import("./KnowledgeGraphPeek").then((mod) => mod.KnowledgeGraphPeek),
{
ssr: false,
loading: () => (
<div
cl... |
eren23/non_linear_ai_chat | landing/src/components/demo/KGNode.tsx | tsx | 2,810 | 37fb8f5ab61aee3dc06281ac54a3169902bf974698f73f94b6887f0415b65081 | "use client";
import { motion, useReducedMotion } from "motion/react";
import { useState } from "react";
import { KG_COLORS, type KGDemoNode } from "./kgDemoData";
type KGNodeState = "hidden" | "dim" | "active";
interface KGNodeProps {
node: KGDemoNode;
state: KGNodeState;
delay?: number;
}
export function KG... |
eren23/non_linear_ai_chat | landing/src/components/demo/InteractiveDemoSection.tsx | tsx | 1,677 | 7ce992c6f2fac19f12c284c08a8b4c83f3871a8a16e9388a81bb0dc82a45b93a | "use client";
import dynamic from "next/dynamic";
import { motion } from "motion/react";
const InteractiveDemo = dynamic(
() => import("./InteractiveDemo").then((mod) => mod.InteractiveDemo),
{
ssr: false,
loading: () => (
<div className="h-96 max-w-5xl mx-auto bg-dark-bg-2 animate-pulse rounded-xl ... |
eren23/non_linear_ai_chat | landing/src/components/demo/DemoEdge.tsx | tsx | 1,449 | 0294db8a8f212e2800354654fd79645d78b57e05c163c1324d48e45f5e519bbd | "use client";
import { motion, useReducedMotion } from "motion/react";
interface DemoEdgeProps {
fromX: number;
fromY: number;
toX: number;
toY: number;
state: "hidden" | "drawing" | "visible" | "dimmed";
delay?: number;
color?: string;
}
/**
* Animated SVG edge between two nodes.
* Uses a vertical s... |
eren23/non_linear_ai_chat | landing/src/components/demo/InteractiveDemo.tsx | tsx | 16,320 | dbbb7f7ca0964e6f5059bd9c1645fce202c68cf5ac1d16f672fb6e637dcc42e5 | "use client";
import { useRef, useMemo, useCallback, useEffect, useState } from "react";
import { motion, useInView } from "motion/react";
import { nodes, edges } from "./demoData";
import type { Branch } from "./demoData";
import { DemoNode } from "./DemoNode";
import { DemoEdge } from "./DemoEdge";
import { DemoInsi... |
eren23/non_linear_ai_chat | landing/src/components/demo/demoData.ts | ts | 6,614 | d434730211bce751ce47ac4978250e966b9624b0c2dbabfa055f63367f2ffda0 | export interface DemoNode {
id: string;
type: "user" | "ai";
label?: string; // e.g. "Learn to Code"
content: string;
accentColor: string;
parentId: string | null;
level: number;
/** Which L1 branch this belongs to (for showing/hiding subtrees) */
branch?: "A" | "B" | "C";
/** Position on desktop (a... |
eren23/non_linear_ai_chat | landing/src/components/demo/KGEdge.tsx | tsx | 1,072 | 6754238e9bc97cb32c4ce8b8ef0b532f65297ce7ceb9e4de51b80487cf594188 | "use client";
import { motion, useReducedMotion } from "motion/react";
import { KG_COLORS } from "./kgDemoData";
import type { KGDemoNode, KGDemoEdge } from "./kgDemoData";
interface KGEdgeProps {
edge: KGDemoEdge;
fromNode: KGDemoNode;
toNode: KGDemoNode;
delay?: number;
}
export function KGEdge({ edge, fro... |
eren23/non_linear_ai_chat | landing/src/components/demo/DemoInsightPanel.tsx | tsx | 2,320 | 32e15e884ec7dee96a47fd1b67326d6088debbda4d07d8f006300040939e68a7 | "use client";
import { motion } from "motion/react";
const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "https://app.spiderchat.ai";
interface DemoInsightPanelProps {
visible: boolean;
}
export function DemoInsightPanel({ visible }: DemoInsightPanelProps) {
if (!visible) return null;
return (
<motion.div... |
eren23/non_linear_ai_chat | landing/src/components/demo/DemoContext.tsx | tsx | 1,087 | efd416b6984e288a7d0cafd516949988ebae9e7f909a72e8e48ab474796e4332 | "use client";
import { createContext, useContext, useState, useCallback, type ReactNode } from "react";
import type { Branch } from "./demoData";
interface DemoContextValue {
visitedBranches: Set<Branch>;
selectedBranch: Branch | null;
addBranch: (branch: Branch) => void;
}
const DemoContext = createContext<De... |
eren23/non_linear_ai_chat | landing/src/components/ui/button.tsx | tsx | 3,191 | 6fb3384d8c8a5e4e60c0c69bcbad7e2c5dff6749fb2553e3cd254a0b7dc42470 | "use client"
import { Button as ButtonPrimitive } from "@base-ui/react/button"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-p... |
eren23/non_linear_ai_chat | landing/src/components/sections/Hero.tsx | tsx | 4,126 | 4a000e4f9430b2c38c135029a58e17812e5b1afed22f00878b017f1fac0fb5d0 | "use client";
import { useCallback } from "react";
import { motion } from "motion/react";
import Image from "next/image";
import { EditorialTextFlow } from "@/components/text/EditorialTextFlow";
const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "https://app.spiderchat.ai";
const HEADLINE_FONT =
'300 clamp(40px, 6... |
eren23/non_linear_ai_chat | landing/src/components/sections/Navbar.tsx | tsx | 10,212 | 916f076ec5bdc3707747b25cf6f4453528c21738e5628df30d774417011f24e5 | "use client";
import { useState, useEffect, useRef, useCallback } from "react";
import { Menu, X } from "lucide-react";
const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "https://app.spiderchat.ai";
const JUNCTIONS = [
{ x: 18, y: 11, angle: -120 },
{ x: 42, y: 15, angle: -40 },
{ x: 44, y: 36, angle: 30 },
... |
eren23/non_linear_ai_chat | landing/src/components/sections/Pricing.tsx | tsx | 3,695 | 7092168005d4d738d951f7ae15fcdaa272983b69be75cd38dbb6aa23ebaa5795 | "use client";
import { Check } from "lucide-react";
const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "https://app.spiderchat.ai";
const tiers = [
{
name: "Free",
price: "$0",
period: "/month",
description: "Get started with AI branching",
features: [
"$1 monthly API allowance",
"F... |
eren23/non_linear_ai_chat | landing/src/components/sections/Features.tsx | tsx | 7,203 | 82d0c17637dd4e7399c1315b62a31672b9da4d9d66b941cdbb277efe388bb11f | "use client";
import { motion } from "motion/react";
import {
GitBranch,
Brain,
Users,
Cpu,
FileText,
Globe,
Mic,
Network,
History,
Merge,
BookOpen,
Bot,
Plug,
} from "lucide-react";
const heroFeatures = [
{
icon: GitBranch,
title: "DAG Branching",
description:
"Explore m... |
eren23/non_linear_ai_chat | landing/src/components/sections/Footer.tsx | tsx | 1,013 | 84a9da08af19233d1f04fdc288bc6117014fc19dddef5121da9aa0585ce575a6 | export function Footer() {
return (
<footer className="bg-[#050505] border-t border-white/[0.06] py-8 px-6">
<div className="max-w-6xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4">
<p className="text-white/30 text-sm">
© {new Date().getFullYear()} Spider Chat
... |
eren23/non_linear_ai_chat | landing/src/components/sections/CallToAction.tsx | tsx | 1,020 | 8dc4f4c2f640a9ca98d55b0398408b4ef3ab48f51e9347464d2f4b56a0a419a0 | "use client";
const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "https://app.spiderchat.ai";
export function CallToAction() {
return (
<section className="relative bg-gradient-to-b from-dark-bg to-dark-bg-2 py-16 sm:py-20 px-6 overflow-hidden">
{/* Light-to-dark gradient transition at top */}
<div ... |
eren23/non_linear_ai_chat | landing/src/components/text/TaglineMorpher.tsx | tsx | 10,295 | a4a0fd9ceda0d983e67b7593bafe8fed7cde48c1065f207973c3dc13daf9fe91 | "use client";
import { useRef, useState, useEffect, useCallback } from "react";
import { useReducedMotion } from "motion/react";
import { prepare, layout } from "@chenglou/pretext";
type Tagline = {
text: string;
tealRange: [number, number];
};
type CharState = {
char: string;
cx: number;
cy: number;
tx:... |
eren23/non_linear_ai_chat | landing/src/components/text/EditorialTextFlow.tsx | tsx | 8,298 | b307a396dd3ca46d06dabaa85993c17d0b75666f5295fcc9f468158cf235d3b1 | "use client";
import {
useRef,
useState,
useEffect,
useCallback,
type ReactNode,
} from "react";
import { useReducedMotion } from "motion/react";
import {
prepareWithSegments,
layoutNextLine,
type PreparedTextWithSegments,
type LayoutCursor,
} from "@chenglou/pretext";
type TextBlock = {
text: str... |
eren23/non_linear_ai_chat | landing/src/lib/utils.ts | ts | 166 | 7c8c3dfc0cdd370d44932828eb067ef771c8fe7996693221d5d4b90af6d54f2d | import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
|
eren23/non_linear_ai_chat | video/playwright.video.config.ts | ts | 3,376 | 5a6910dc570f7fd4e67ff7479c51d0788d6903e297d6cb196935530553a2194c | import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
import fs from 'fs';
dotenv.config({ path: path.resolve(import.meta.dirname, '.env') });
/** Parse a .env file into a key-value object (handles spaces around =, quoted values) */
function loadDotenv(envPath... |
eren23/non_linear_ai_chat | video/scripts/auth-setup.ts | ts | 1,917 | 25e4d0e718a157a9428616dcff37f986888fcd5401e40d85fafeac2a8587c2a5 | /**
* Interactive auth setup for production video recording.
*
* Opens a headed browser β user completes Google OAuth manually β
* saves session cookies to .auth/prod-session.json.
*
* Session is valid for 30 days. Run monthly:
* npx tsx scripts/auth-setup.ts
*/
import { chromium } from '@playwright/test';
im... |
eren23/non_linear_ai_chat | video/scripts/stitch.ts | ts | 4,087 | ac2ee370eada481c171b9ab31bf5aadf53f2934e7ed720748f31c66e78977386 | /**
* Standalone script to stitch recorded clips + rendered compositions into final video.
*
* Usage:
* npx tsx scripts/stitch.ts
* npx tsx scripts/stitch.ts --no-audio
*/
import { execFileSync } from 'child_process';
import path from 'path';
import fs from 'fs';
import { productDemo } from '../manifests/prod... |
eren23/non_linear_ai_chat | video/scripts/pipeline.ts | ts | 7,156 | 107d7ea505426ad3b88221ca2a42952301ba486a60c139d94ff5dbbd8e345f86 | /**
* Video pipeline orchestrator.
*
* Usage:
* npx tsx scripts/pipeline.ts record # Record all scenarios
* npx tsx scripts/pipeline.ts record --scenario 01 # Record specific scenario
* npx tsx scripts/pipeline.ts render # Render HyperFrames compositions
* npx tsx scripts/pipel... |
eren23/non_linear_ai_chat | video/scripts/local-auth.setup.ts | ts | 1,329 | 3c66025c05ca5aaa9067b0f23f6b06282908b2b295f9d1303d8b4f3ded557702 | /**
* Local auth setup for video recording in local dev mode.
* Mirrors e2e/auth/test-auth.setup.ts but saves to video/.auth/
*/
import { test as setup } from '@playwright/test';
import path from 'path';
import fs from 'fs';
const AUTH_DIR = path.resolve(import.meta.dirname, '../.auth');
const SESSION_PATH = path.j... |
eren23/non_linear_ai_chat | video/scripts/render-motion.ts | ts | 1,680 | 778e6aed97f8c21442f597fa1269eb9a85c8a584213a0f7a0dfef0b8e082d233 | /**
* Standalone script to render all HyperFrames compositions.
*
* Usage:
* npx tsx scripts/render-motion.ts
* npx tsx scripts/render-motion.ts --composition intro
*/
import { execFileSync } from 'child_process';
import path from 'path';
import fs from 'fs';
import { productDemo } from '../manifests/product-... |
eren23/non_linear_ai_chat | video/scenarios/02-branching.video.ts | ts | 1,959 | 50dee615e48eb3ac3c6e694612fa8c52e069c2b112dd22c0d5ea1facaffafcb1 | /**
* Scenario 2: Branch a Conversation
*
* Starting from a flow with an existing response,
* create a branch by asking a follow-up from a different angle.
*
* Expected clip: ~15s
*/
import { test, expect, getChatInput, getSendButton, getNodes, waitForNodeCount } from '../fixtures/video-test.js';
test('branch a... |
eren23/non_linear_ai_chat | video/scenarios/01-create-flow.video.ts | ts | 1,824 | 0a27099da0f3edadcb70f965dc3a41220c13a43ab69aaf60f783310888e9fcc7 | /**
* Scenario 1: Create a Flow
*
* Empty state β type a prompt β send β watch LLM streaming response.
* The hero "first impression" clip.
*
* Expected clip: ~15-20s
*/
import { test, expect, getChatInput } from '../fixtures/video-test.js';
test('create a flow and get a streaming response', async ({ readyPage: ... |
eren23/non_linear_ai_chat | video/scenarios/08-full-journey.video.ts | ts | 3,979 | 013516d04a73659bf078d19bbf72abe24882aa229e4637c8aa70243789863d04 | /**
* Scenario 8: Full Journey (Hero Video)
*
* Complete product walkthrough in one continuous recording:
* Empty state β first message β branches β tree overview β
* knowledge graph β back to canvas.
*
* Expected clip: ~60-90s
*
* This is the long-form hero video that can be used standalone
* on YouTube or t... |
eren23/non_linear_ai_chat | video/scenarios/03-tree-growing.video.ts | ts | 1,782 | 682ea3c2710dfd66779490baf41154a85aec343de63ec8a76dcbf75ac12f6dc2 | /**
* Scenario 3: Tree Growing
*
* Rapidly create multiple branches to show the DAG growing.
* Focuses on the visual impact of the graph structure expanding.
*
* Expected clip: ~15-20s
*/
import { test, getChatInput, getSendButton, getNodes, waitForNodeCount } from '../fixtures/video-test.js';
const BRANCH_PROM... |
eren23/non_linear_ai_chat | video/scenarios/07-collaboration.video.ts | ts | 2,751 | 781739515b786a060f499ef819e1d0fb93144198bb8b5ae78bd7cb15e4df3b48 | /**
* Scenario 7: Real-Time Collaboration
*
* Two browser contexts on the same flow.
* Shows presence indicators and real-time node creation.
*
* Expected clip: ~12-15s
*
* NOTE: This scenario only works in local dev mode with test-login
* since it needs two authenticated sessions.
*/
import { test, expect, g... |
eren23/non_linear_ai_chat | video/scenarios/04-knowledge-graph.video.ts | ts | 2,201 | 088b2906f17e6276c3e5d35923560b9b4fed10516caaddacab48fa7f9c01d3b1 | /**
* Scenario 4: Knowledge Graph
*
* Navigate to the 3D knowledge graph visualization.
* Show orbital rotation and node clusters.
*
* Expected clip: ~10-15s
*/
import { test, expect } from '../fixtures/video-test.js';
test('explore the 3D knowledge graph', async ({ readyPage: page, cinema, camera }) => {
awa... |
eren23/non_linear_ai_chat | video/scenarios/06-image-gen.video.ts | ts | 2,213 | 1fab11b26e131bfc87efbd3366dfee377c451e540f46f71a1ee2c1c0b4db2e6d | /**
* Scenario 6: Image Generation
*
* Create a media generation node and generate images from a prompt.
*
* Expected clip: ~12-15s
*/
import { test, expect } from '../fixtures/video-test.js';
test('generate images from a prompt', async ({ readyPage: page, cinema, camera }) => {
await cinema.pause(800);
// ... |
eren23/non_linear_ai_chat | video/scenarios/05-memory.video.ts | ts | 1,672 | c9db63d1fafed46b733aba122ae3d93c41315ba3edae6d6085fd5f00a013b85a | /**
* Scenario 5: Memory Extraction
*
* Show the memory panel with extracted facts from conversations.
* Demonstrate search and memory recall.
*
* Expected clip: ~10-12s
*/
import { test, expect } from '../fixtures/video-test.js';
test('show memory extraction and search', async ({ readyPage: page, cinema }) => ... |
eren23/non_linear_ai_chat | video/fixtures/camera.ts | ts | 6,259 | 8df5e1ebac874cd28857d003c97de8c92e4c842c9d79bb37cc2ba634bfe74859 | /**
* Camera/viewport orchestration helpers for cinematic canvas recording.
*
* Provides smooth zoom, pan-to-node, fit-view, and overview sweep
* operations on the ReactFlow canvas.
*/
import type { Page } from '@playwright/test';
// ββ Types ββ
export interface SmoothZoomOptions {
/** Total duration in millis... |
eren23/non_linear_ai_chat | video/fixtures/video-test.ts | ts | 3,529 | 2aa3e4f9a5d62aca9673ed63abed9b3e7877d09ad8d3faf184088f39710225fb | /**
* Main test fixture for video recording scenarios.
*
* Provides authenticated page, cinematic helpers, camera helpers,
* and reusable flow/canvas utilities.
*/
import { test as base, type Page } from '@playwright/test';
import { CinematicHelper } from './cinematic.js';
import { CameraHelper } from './camera.js... |
eren23/non_linear_ai_chat | video/fixtures/prod-auth.ts | ts | 1,240 | dc47022de1e34e4d33b825ad32d8acb49ab7d82601e8d70e14ffc3bc5794b824 | /**
* Auth fixture that works for both prod and local video recording.
*
* - VIDEO_MODE=prod β loads .auth/prod-session.json (from auth-setup.ts)
* - VIDEO_MODE=local β loads .auth/local-session.json (from local-auth.setup.ts)
*/
import path from 'path';
import fs from 'fs';
const AUTH_DIR = path.resolve(import.m... |
eren23/non_linear_ai_chat | video/fixtures/cinematic.ts | ts | 6,132 | 10278ada5adc09e8d5d9d82340dd2baeedd759c8527e6f903d8279353ce8850c | /**
* Cinematic action helpers for product video recording.
*
* Wraps Playwright actions to produce natural, watchable motion
* instead of instant test-speed actions.
*/
import type { Page, Locator } from '@playwright/test';
// ββ Easing functions ββ
function easeInOut(t: number): number {
return t < 0.5 ? 2 *... |
eren23/non_linear_ai_chat | video/manifests/product-demo.ts | ts | 3,910 | 0e73432d20e6ac98eda90b7da2cae4660dbfe61211711f71494f1520200cf27a | /**
* Video manifest for the main product demo video.
*
* Defines scene order, composition parameters, and audio config.
* Maps to the walkthrough sections in docs/landing-page-visual-content-todo.md
*/
export interface Scene {
/** Scene type */
type: 'composition' | 'scenario' | 'title-card' | 'transition';
... |
eren23/non_linear_ai_chat | extension/wxt.config.ts | ts | 1,109 | 50852685a1d8a8bcd5fd20739169404eca6aacc9fff8bdd647a0401b06e22413 | import { defineConfig } from 'wxt';
import { loadEnv } from 'vite';
// Load .env into a plain object so VITE_API_HOST is available for the manifest.
// Vite does NOT populate process.env in config files β only import.meta.env in app code.
const env = loadEnv('production', process.cwd(), 'VITE_');
export default defin... |
eren23/non_linear_ai_chat | extension/vitest.config.ts | ts | 219 | 48e988a4a59f2cc0248fac15931f382ad0a88d2567824fcfb20a072a9072ac7c | import { defineConfig } from 'vitest/config';
import path from 'path';
export default defineConfig({
test: {
globals: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
});
|
eren23/non_linear_ai_chat | extension/storybook/fixtures.ts | ts | 6,983 | 5ea67bba610473d13905cbe4a09eeb7e4d39b3c63a19580b30d4905e125291cf | import type { CaptureResult, PageInfo } from '@/components/uiTypes';
import type { CaptureSystemState, QueueListItem } from '@/lib/captureSystem/types';
type DeepPartial<T> = {
[K in keyof T]?: T[K] extends Array<infer U>
? Array<DeepPartial<U>>
: T[K] extends object
? DeepPartial<T[K]>
: T[K];
}... |
eren23/non_linear_ai_chat | extension/.storybook/main.ts | ts | 650 | 28d6fd7140d7456f2d046885db21cb3ddd206a2e6ab0f668c2e6180c74ed00f5 | import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';
import path from 'path';
const config: StorybookConfig = {
stories: [
'../**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../**/*.mdx',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
... |
eren23/non_linear_ai_chat | extension/.storybook/preview.tsx | tsx | 899 | 6fff517df44f46fecf82b7583cae037be68b549e5a1bc33bd9ef2116ff5896e5 | import React from 'react';
import type { Preview } from '@storybook/react';
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
backgrounds: {
default: 'extension',
values: [
{
name... |
eren23/non_linear_ai_chat | extension/components/uiTypes.ts | ts | 963 | cd5fed17a8fa3d17ff4831e936cf8bd4ce83041060908361cd1ca95419c74efa | import type { CaptureSettings } from '@/lib/api/client';
import type { CaptureSyncStatus } from '@/lib/storage/indexeddb';
export interface PageInfo {
url: string;
title: string;
domain: string;
hasContent: boolean;
isPdf?: boolean;
}
export interface CaptureResult {
success?: boolean;
error?: string;
... |
eren23/non_linear_ai_chat | extension/components/popup/PopupView.stories.tsx | tsx | 10,261 | 9a91048b7603277c65b4ebb88d82ed6f8c0c124d550d6524f324ea045a7212cd | import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
import { PopupView } from './PopupView';
import { makeCaptureResult, makeCaptureSystemState, makePageInfo } from '@/storybook/fixtures';
function makeActions() {
return {
onTagsChange: fn(),
onCapture: fn(),
on... |
eren23/non_linear_ai_chat | extension/components/popup/PopupView.tsx | tsx | 22,681 | 1d43375a32497249e6f5425d01205b52c654f23e680835a4990b6e607b8dbd7e | import React, { useMemo } from 'react';
import { formatBytes, formatTimeAgo, formatStatusLabel, statusColor, trimText } from '@/lib/captureSystem/formatters';
import type { CaptureSystemState, QueueListItem } from '@/lib/captureSystem/types';
import type {
AlwaysOnSettingsUpdates,
CaptureResult,
CaptureState,
... |
eren23/non_linear_ai_chat | extension/components/dashboard/DashboardView.tsx | tsx | 21,895 | 7b0f22193076137646fea1036ce8904bc43f1e6b44d99501956648f5e69d7ec3 | import React, { useMemo } from 'react';
import { formatBytes, formatFailureCategory, formatStatusLabel, formatTimeAgo, statusColor, trimText } from '@/lib/captureSystem/formatters';
import type { CaptureSystemState, QueueListItem } from '@/lib/captureSystem/types';
import type { AlwaysOnSettingsUpdates, DashboardStat... |
eren23/non_linear_ai_chat | extension/components/dashboard/DashboardView.stories.tsx | tsx | 11,478 | c0888b3679dd240505aaf2e0e317f31fbdc735ae408660150b2d6f2dafc46c3c | import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
import { DashboardView } from './DashboardView';
import { makeCaptureSystemState, makeQueueItem } from '@/storybook/fixtures';
function makeActions() {
return {
onOpenCaptures: fn(),
onExportDebugSnapshot: fn(),
... |
eren23/non_linear_ai_chat | extension/lib/security/urlCanonicalizer.ts | ts | 1,008 | 825ef7d873bd491577d18580b48d577d890b740328c7a568eda134107fa5396a | const TRACKING_QUERY_PARAMS = new Set([
'fbclid',
'gclid',
'igshid',
'mc_cid',
'mc_eid',
'mkt_tok',
'msclkid',
'ref',
'ref_src',
'si',
'spm',
]);
function isTrackingParam(key: string): boolean {
const lower = key.toLowerCase();
return lower.startsWith('utm_') || TRACKING_QUERY_PARAMS.has(lowe... |
eren23/non_linear_ai_chat | extension/lib/security/domainFilter.ts | ts | 3,120 | b28071ab84277718740ac58fc947c4f6f9a0db212f1d19ec5e71979634656107 | /**
* Domain filtering for capture safety.
* Prevents capturing from sensitive domains (banking, auth, email, etc.).
*/
/**
* Hardcoded blacklist of sensitive domains that should NEVER be captured.
* These are checked by domain suffix matching.
*/
const HARDCODED_BLACKLIST: string[] = [
// Banking & Finance
... |
eren23/non_linear_ai_chat | extension/lib/security/sanitizer.ts | ts | 1,931 | 95a9b6ce1caf0a6bf080ec92647e147e3e11684cdb34bb7f58f20e129d6fcb50 | /**
* Content sanitization for captured HTML.
* Strips XSS vectors, form data, and PII.
*/
import DOMPurify from 'dompurify';
/**
* Sanitize captured HTML content to remove XSS vectors.
*/
export function sanitizeHtml(html: string): string {
return DOMPurify.sanitize(html, {
ALLOWED_TAGS: [
'h1', 'h2... |
eren23/non_linear_ai_chat | extension/lib/security/__tests__/urlCanonicalizer.test.ts | ts | 7,151 | 02ea64c827faa05d015ffc975959fc2be0fb5abc36c022fd0f4c4f9c494bc2eb | import { describe, it, expect } from 'vitest';
import { canonicalizeUrl } from '../urlCanonicalizer';
describe('canonicalizeUrl', () => {
// -------------------------------------------------------------------------
// Protocol normalization
// ---------------------------------------------------------------------... |
eren23/non_linear_ai_chat | extension/lib/security/__tests__/sanitizer.test.ts | ts | 10,172 | dbfd04d0e3e36c15b1cea4ade46dd780d4c0f57dcbd9dfc343226bf2d0cdc524 | import { describe, it, expect, vi } from 'vitest';
/**
* Mock DOMPurify since it requires a DOM environment.
* The mock strips script tags and inline event handlers to simulate
* the core sanitization behavior without needing jsdom.
*/
vi.mock('dompurify', () => ({
default: {
sanitize: vi.fn((html: string, _... |
eren23/non_linear_ai_chat | extension/lib/security/__tests__/domainFilter.test.ts | ts | 13,749 | 42a16cbf8b9a8b3f1726aaf021110083ab8bb86a2ecedb910396ad2bed4a68f7 | import { describe, it, expect } from 'vitest';
import { shouldCaptureDomain, HARDCODED_BLACKLIST } from '../domainFilter';
describe('domainFilter', () => {
// ---------------------------------------------------------------------------
// HARDCODED_BLACKLIST export
// ---------------------------------------------... |
eren23/non_linear_ai_chat | extension/lib/extractor/htmlToMarkdown.ts | ts | 2,159 | 4e018c2f13a801faf744966a87a02ca0fb8a25ed5b2a4351ca4347c3362672cf | /**
* HTML-to-Markdown converter using Turndown.
* Converts Readability HTML output to Markdown with inline images preserved.
*/
import TurndownService from 'turndown';
const MAX_OUTPUT_CHARS = 200000;
/**
* Convert HTML content to Markdown, preserving inline image positions.
* Resolves relative image URLs to a... |
eren23/non_linear_ai_chat | extension/lib/extractor/images.ts | ts | 10,709 | 0771fcf39a40896417cffda0d7d6243a7550442946f4438a990931d7b1891771 | /**
* Image extraction from page DOM.
* Extracts meaningful content images, filtering out ads, icons, and trackers.
* Runs in the content script context (has access to `document`).
*/
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// Types
// ββββββββββββββββββββββββββββββββββββββ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.