[{"data":1,"prerenderedAt":1684},["ShallowReactive",2],{"navigation":3,"\u002Fguides\u002Fextension-authoring":222,"\u002Fguides\u002Fextension-authoring-surround":1679},[4,8,168,206,210,214,218],{"title":5,"path":6,"stem":7},"Quickstart","\u002Fquickstart","01.quickstart",{"title":9,"path":10,"stem":11,"children":12},"Concepts","\u002Fconcepts","20.concepts",[13,15,19,23,84,88,92,96,100],{"title":9,"path":10,"stem":14},"20.concepts\u002Findex",{"title":16,"path":17,"stem":18},"Preprocessing Graph","\u002Fconcepts\u002Fppg","20.concepts\u002F2.ppg",{"title":20,"path":21,"stem":22},"Plane decomposition","\u002Fconcepts\u002Fplanes","20.concepts\u002F3.planes",{"title":24,"path":25,"stem":26,"children":27},"Codecs","\u002Fconcepts\u002Fcodecs","20.concepts\u002F4.codecs",[28,32,36,40,44,48,52,56,60,64,68,72,76,80],{"title":29,"path":30,"stem":31},"Arithmetic","\u002Fconcepts\u002Fcodecs\u002Farithmetic","20.concepts\u002Fcodecs\u002Farithmetic",{"title":33,"path":34,"stem":35},"Context Mixing Lite","\u002Fconcepts\u002Fcodecs\u002Fcontext-mixing-lite","20.concepts\u002Fcodecs\u002Fcontext-mixing-lite",{"title":37,"path":38,"stem":39},"FPC","\u002Fconcepts\u002Fcodecs\u002Ffpc","20.concepts\u002Fcodecs\u002Ffpc",{"title":41,"path":42,"stem":43},"Huffman LLM 5-Bit","\u002Fconcepts\u002Fcodecs\u002Fhuff-llm","20.concepts\u002Fcodecs\u002Fhuff-llm",{"title":45,"path":46,"stem":47},"Huffman","\u002Fconcepts\u002Fcodecs\u002Fhuffman","20.concepts\u002Fcodecs\u002Fhuffman",{"title":49,"path":50,"stem":51},"Identity","\u002Fconcepts\u002Fcodecs\u002Fidentity","20.concepts\u002Fcodecs\u002Fidentity",{"title":53,"path":54,"stem":55},"Neural Predictor","\u002Fconcepts\u002Fcodecs\u002Fneural-predictor","20.concepts\u002Fcodecs\u002Fneural-predictor",{"title":57,"path":58,"stem":59},"Order-1 Arithmetic","\u002Fconcepts\u002Fcodecs\u002Forder1-arithmetic","20.concepts\u002Fcodecs\u002Forder1-arithmetic",{"title":61,"path":62,"stem":63},"Order-1 Scale AC","\u002Fconcepts\u002Fcodecs\u002Forder1-scale-ac","20.concepts\u002Fcodecs\u002Forder1-scale-ac",{"title":65,"path":66,"stem":67},"Per-Group Codebook","\u002Fconcepts\u002Fcodecs\u002Fper-group-codebook","20.concepts\u002Fcodecs\u002Fper-group-codebook",{"title":69,"path":70,"stem":71},"rANS","\u002Fconcepts\u002Fcodecs\u002Frans","20.concepts\u002Fcodecs\u002Frans",{"title":73,"path":74,"stem":75},"tANS","\u002Fconcepts\u002Fcodecs\u002Ftans","20.concepts\u002Fcodecs\u002Ftans",{"title":77,"path":78,"stem":79},"Zstd","\u002Fconcepts\u002Fcodecs\u002Fzstd","20.concepts\u002Fcodecs\u002Fzstd",{"title":81,"path":82,"stem":83},"Zstd Dictionary","\u002Fconcepts\u002Fcodecs\u002Fzstd-dict","20.concepts\u002Fcodecs\u002Fzstd-dict",{"title":85,"path":86,"stem":87},"Container format","\u002Fconcepts\u002Fcontainer","20.concepts\u002F5.container",{"title":89,"path":90,"stem":91},"Delta compression","\u002Fconcepts\u002Fdelta","20.concepts\u002F6.delta",{"title":93,"path":94,"stem":95},"Extensibility","\u002Fconcepts\u002Fextensibility","20.concepts\u002F7.extensibility",{"title":24,"path":25,"stem":97,"children":98},"20.concepts\u002Fcodecs\u002Findex",[99],{"title":24,"path":25,"stem":97},{"title":101,"path":102,"stem":103,"children":104},"Transforms","\u002Fconcepts\u002Ftransforms","20.concepts\u002Ftransforms\u002Findex",[105,106,110,114,118,122,126,130,134,140,144,148,152,156,160,164],{"title":101,"path":102,"stem":103},{"title":107,"path":108,"stem":109},"Alpha-Stable Normalize","\u002Fconcepts\u002Ftransforms\u002Falpha-stable-normalize","20.concepts\u002Ftransforms\u002Falpha-stable-normalize",{"title":111,"path":112,"stem":113},"Bit Reorder","\u002Fconcepts\u002Ftransforms\u002Fbit-reorder","20.concepts\u002Ftransforms\u002Fbit-reorder",{"title":115,"path":116,"stem":117},"Block Microscaling Repack","\u002Fconcepts\u002Ftransforms\u002Fblock-microscaling-repack","20.concepts\u002Ftransforms\u002Fblock-microscaling-repack",{"title":119,"path":120,"stem":121},"Burrows-Wheeler","\u002Fconcepts\u002Ftransforms\u002Fburrows-wheeler","20.concepts\u002Ftransforms\u002Fburrows-wheeler",{"title":123,"path":124,"stem":125},"Byte Split & Nibble Split","\u002Fconcepts\u002Ftransforms\u002Fbyte-split","20.concepts\u002Ftransforms\u002Fbyte-split",{"title":127,"path":128,"stem":129},"Concat","\u002Fconcepts\u002Ftransforms\u002Fconcat","20.concepts\u002Ftransforms\u002Fconcat",{"title":131,"path":132,"stem":133},"Delta","\u002Fconcepts\u002Ftransforms\u002Fdelta","20.concepts\u002Ftransforms\u002Fdelta",{"title":135,"path":136,"stem":137,"children":138},"Index Bitwidth Pack","\u002Fconcepts\u002Ftransforms\u002Findex-bitwidth-pack","20.concepts\u002Ftransforms\u002Findex-bitwidth-pack",[139],{"title":135,"path":136,"stem":137},{"title":141,"path":142,"stem":143},"IntDelta","\u002Fconcepts\u002Ftransforms\u002Fint-delta","20.concepts\u002Ftransforms\u002Fint-delta",{"title":145,"path":146,"stem":147},"Mantissa Zero Strip","\u002Fconcepts\u002Ftransforms\u002Fmantissa-zero-strip","20.concepts\u002Ftransforms\u002Fmantissa-zero-strip",{"title":149,"path":150,"stem":151},"Move to Front","\u002Fconcepts\u002Ftransforms\u002Fmove-to-front","20.concepts\u002Ftransforms\u002Fmove-to-front",{"title":153,"path":154,"stem":155},"MxFp4 Deinterleave","\u002Fconcepts\u002Ftransforms\u002Fmxfp4-deinterleave","20.concepts\u002Ftransforms\u002Fmxfp4-deinterleave",{"title":157,"path":158,"stem":159},"Predictor XOR","\u002Fconcepts\u002Ftransforms\u002Fpredictor-xor","20.concepts\u002Ftransforms\u002Fpredictor-xor",{"title":161,"path":162,"stem":163},"Reshape","\u002Fconcepts\u002Ftransforms\u002Freshape","20.concepts\u002Ftransforms\u002Freshape",{"title":165,"path":166,"stem":167},"Spherical Normalize","\u002Fconcepts\u002Ftransforms\u002Fspherical-normalize","20.concepts\u002Ftransforms\u002Fspherical-normalize",{"title":169,"path":170,"stem":171,"children":172},"Guides","\u002Fguides","30.guides\u002F00.index",[173,174,178,182,186,190,194,198,202],{"title":169,"path":170,"stem":171},{"title":175,"path":176,"stem":177},"CLI usage","\u002Fguides\u002Fcli","30.guides\u002F01.cli",{"title":179,"path":180,"stem":181},"Python API","\u002Fguides\u002Fpython-api","30.guides\u002F02.python-api",{"title":183,"path":184,"stem":185},"Writing your first extension","\u002Fguides\u002Fextension-authoring","30.guides\u002F03.extension-authoring",{"title":187,"path":188,"stem":189},"Trust and security","\u002Fguides\u002Ftrust-and-security","30.guides\u002F04.trust-and-security",{"title":191,"path":192,"stem":193},"Random access","\u002Fguides\u002Frandom-access","30.guides\u002F10.random-access",{"title":195,"path":196,"stem":197},"Tuning","\u002Fguides\u002Ftuning","30.guides\u002F11.tuning",{"title":199,"path":200,"stem":201},"Safetensors","\u002Fguides\u002Fsafetensors","30.guides\u002F50.safetensors",{"title":203,"path":204,"stem":205},"Transformers","\u002Fguides\u002Ftransformers","30.guides\u002F51.transformers",{"title":207,"path":208,"stem":209},"API reference","\u002Fapi","40.api",{"title":211,"path":212,"stem":213},"Benchmarks","\u002Fbenchmarks","50.benchmarks",{"title":215,"path":216,"stem":217},"Extensions","\u002Fextensions","60.extensions",{"title":219,"path":220,"stem":221},"Contributing","\u002Fcontributing","90.contributing",{"id":223,"title":183,"body":224,"description":1673,"extension":1674,"kind":1675,"language":1675,"links":1675,"meta":1676,"navigation":1675,"path":184,"seo":1677,"stem":185,"summary":1675,"__hash__":1678},"docs\u002F30.guides\u002F03.extension-authoring.md",{"type":225,"value":226,"toc":1662},"minimark",[227,231,239,286,291,338,341,349,371,388,728,740,746,749,1094,1109,1113,1127,1138,1144,1148,1167,1209,1212,1231,1240,1274,1277,1281,1293,1405,1416,1420,1436,1443,1450,1535,1565,1569,1597,1601,1658],[228,229,230],"p",{},"This guide walks through publishing a tiny plane codec end-to-end:\nscaffold the project, write the encode\u002Fdecode functions, sign the\nbundle, install it, and verify PTWM picks it up at runtime.",[228,232,233,234,238],{},"Total time: ~15 minutes. You'll need a Rust toolchain with the\n",[235,236,237],"code",{},"wasm32-wasip1"," target, plus the extension-author extras:",[240,241,246],"pre",{"className":242,"code":243,"language":244,"meta":245,"style":245},"language-sh shiki shiki-themes material-theme-lighter github-light github-dark","rustup target add wasm32-wasip1\npip install 'ptwm[ext-dev]'\n","sh","",[235,247,248,267],{"__ignoreMap":245},[249,250,253,257,261,264],"span",{"class":251,"line":252},"line",1,[249,254,256],{"class":255},"sbgvK","rustup",[249,258,260],{"class":259},"s_sjI"," target",[249,262,263],{"class":259}," add",[249,265,266],{"class":259}," wasm32-wasip1\n",[249,268,270,273,276,280,283],{"class":251,"line":269},2,[249,271,272],{"class":255},"pip",[249,274,275],{"class":259}," install",[249,277,279],{"class":278},"sjJ54"," '",[249,281,282],{"class":259},"ptwm[ext-dev]",[249,284,285],{"class":278},"'\n",[287,288,290],"h2",{"id":289},"_1-scaffold","1. Scaffold",[240,292,294],{"className":242,"code":293,"language":244,"meta":245,"style":245},"ptwm ext init xor-codec --lang rust --kind plane_codec\ncd xor-codec\nls\n",[235,295,296,323,332],{"__ignoreMap":245},[249,297,298,301,304,307,310,314,317,320],{"class":251,"line":252},[249,299,300],{"class":255},"ptwm",[249,302,303],{"class":259}," ext",[249,305,306],{"class":259}," init",[249,308,309],{"class":259}," xor-codec",[249,311,313],{"class":312},"stzsN"," --lang",[249,315,316],{"class":259}," rust",[249,318,319],{"class":312}," --kind",[249,321,322],{"class":259}," plane_codec\n",[249,324,325,329],{"class":251,"line":269},[249,326,328],{"class":327},"sptTA","cd",[249,330,331],{"class":259}," xor-codec\n",[249,333,335],{"class":251,"line":334},3,[249,336,337],{"class":255},"ls\n",[228,339,340],{},"You get:",[240,342,347],{"className":343,"code":345,"language":346},[344],"language-text","Cargo.toml          manifest.toml       src\u002Flib.rs\n","text",[235,348,345],{"__ignoreMap":245},[228,350,351,352,355,356,358,359,362,363,366,367,370],{},"The Rust crate is configured as a ",[235,353,354],{},"cdylib"," targeting\n",[235,357,237],{},". ",[235,360,361],{},"manifest.toml"," declares one ",[235,364,365],{},"plane_codec","\ncontribution with a placeholder canonical id (rewritten at ",[235,368,369],{},"sign","\ntime).",[228,372,373,376,377,384,385,387],{},[235,374,375],{},"src\u002Flib.rs"," exports the byte-buffer ABI symbols\n(see ",[378,379,383],"a",{"href":380,"rel":381},"https:\u002F\u002Fgithub.com\u002Fkhwstolle\u002Fptwm\u002Fblob\u002Fmaster\u002Fdocs\u002Farchitecture\u002Fextension-system.md",[382],"nofollow","the extension system doc"," for the full ",[235,386,365],{}," signature):",[240,389,393],{"className":390,"code":391,"language":392,"meta":245,"style":245},"language-rust shiki shiki-themes material-theme-lighter github-light github-dark","#[unsafe(no_mangle)]\npub extern \"C\" fn ptwm_plane_codec_v1_init() -> u32 { 0 }\n\n#[unsafe(no_mangle)]\npub extern \"C\" fn ptwm_plane_codec_v1_cleanup(_state: u32) {}\n\n#[unsafe(no_mangle)]\npub extern \"C\" fn ptwm_plane_codec_v1_encode(\n    _state: u32,\n    in_ptr: u32, in_len: u32,\n    out_ptr: u32, out_len: u32,\n) -> i64 { \u002F* copy input → output *\u002F }\n\n#[unsafe(no_mangle)]\npub extern \"C\" fn ptwm_plane_codec_v1_decode(\n    _state: u32,\n    in_ptr: u32, in_len: u32,\n    out_ptr: u32, out_len: u32,\n) -> i64 { \u002F* copy input → output *\u002F }\n","rust",[235,394,395,415,460,466,479,513,518,531,552,565,587,608,626,631,644,664,675,694,713],{"__ignoreMap":245},[249,396,397,401,405,408,412],{"class":251,"line":252},[249,398,400],{"class":399},"sP7_E","#[",[249,402,404],{"class":403},"sw1J6","unsafe",[249,406,407],{"class":399},"(",[249,409,411],{"class":410},"su5hD","no_mangle",[249,413,414],{"class":399},")]\n",[249,416,417,420,424,427,430,433,436,440,443,447,450,453,457],{"class":251,"line":269},[249,418,419],{"class":403},"pub",[249,421,423],{"class":422},"sbsja"," extern",[249,425,426],{"class":278}," \"",[249,428,429],{"class":259},"C",[249,431,432],{"class":278},"\"",[249,434,435],{"class":403}," fn",[249,437,439],{"class":438},"sGLFI"," ptwm_plane_codec_v1_init",[249,441,442],{"class":399},"()",[249,444,446],{"class":445},"smGrS"," ->",[249,448,449],{"class":255}," u32",[249,451,452],{"class":399}," {",[249,454,456],{"class":455},"srdBf"," 0",[249,458,459],{"class":399}," }\n",[249,461,462],{"class":251,"line":334},[249,463,465],{"emptyLinePlaceholder":464},true,"\n",[249,467,469,471,473,475,477],{"class":251,"line":468},4,[249,470,400],{"class":399},[249,472,404],{"class":403},[249,474,407],{"class":399},[249,476,411],{"class":410},[249,478,414],{"class":399},[249,480,482,484,486,488,490,492,494,497,499,502,505,507,510],{"class":251,"line":481},5,[249,483,419],{"class":403},[249,485,423],{"class":422},[249,487,426],{"class":278},[249,489,429],{"class":259},[249,491,432],{"class":278},[249,493,435],{"class":403},[249,495,496],{"class":438}," ptwm_plane_codec_v1_cleanup",[249,498,407],{"class":399},[249,500,501],{"class":410},"_state",[249,503,504],{"class":445},":",[249,506,449],{"class":255},[249,508,509],{"class":399},")",[249,511,512],{"class":399}," {}\n",[249,514,516],{"class":251,"line":515},6,[249,517,465],{"emptyLinePlaceholder":464},[249,519,521,523,525,527,529],{"class":251,"line":520},7,[249,522,400],{"class":399},[249,524,404],{"class":403},[249,526,407],{"class":399},[249,528,411],{"class":410},[249,530,414],{"class":399},[249,532,534,536,538,540,542,544,546,549],{"class":251,"line":533},8,[249,535,419],{"class":403},[249,537,423],{"class":422},[249,539,426],{"class":278},[249,541,429],{"class":259},[249,543,432],{"class":278},[249,545,435],{"class":403},[249,547,548],{"class":438}," ptwm_plane_codec_v1_encode",[249,550,551],{"class":399},"(\n",[249,553,555,558,560,562],{"class":251,"line":554},9,[249,556,557],{"class":410},"    _state",[249,559,504],{"class":445},[249,561,449],{"class":255},[249,563,564],{"class":399},",\n",[249,566,568,571,573,575,578,581,583,585],{"class":251,"line":567},10,[249,569,570],{"class":410},"    in_ptr",[249,572,504],{"class":445},[249,574,449],{"class":255},[249,576,577],{"class":399},",",[249,579,580],{"class":410}," in_len",[249,582,504],{"class":445},[249,584,449],{"class":255},[249,586,564],{"class":399},[249,588,590,593,595,597,599,602,604,606],{"class":251,"line":589},11,[249,591,592],{"class":410},"    out_ptr",[249,594,504],{"class":445},[249,596,449],{"class":255},[249,598,577],{"class":399},[249,600,601],{"class":410}," out_len",[249,603,504],{"class":445},[249,605,449],{"class":255},[249,607,564],{"class":399},[249,609,611,613,615,618,620,624],{"class":251,"line":610},12,[249,612,509],{"class":399},[249,614,446],{"class":445},[249,616,617],{"class":255}," i64",[249,619,452],{"class":399},[249,621,623],{"class":622},"sutJx"," \u002F* copy input → output *\u002F",[249,625,459],{"class":399},[249,627,629],{"class":251,"line":628},13,[249,630,465],{"emptyLinePlaceholder":464},[249,632,634,636,638,640,642],{"class":251,"line":633},14,[249,635,400],{"class":399},[249,637,404],{"class":403},[249,639,407],{"class":399},[249,641,411],{"class":410},[249,643,414],{"class":399},[249,645,647,649,651,653,655,657,659,662],{"class":251,"line":646},15,[249,648,419],{"class":403},[249,650,423],{"class":422},[249,652,426],{"class":278},[249,654,429],{"class":259},[249,656,432],{"class":278},[249,658,435],{"class":403},[249,660,661],{"class":438}," ptwm_plane_codec_v1_decode",[249,663,551],{"class":399},[249,665,667,669,671,673],{"class":251,"line":666},16,[249,668,557],{"class":410},[249,670,504],{"class":445},[249,672,449],{"class":255},[249,674,564],{"class":399},[249,676,678,680,682,684,686,688,690,692],{"class":251,"line":677},17,[249,679,570],{"class":410},[249,681,504],{"class":445},[249,683,449],{"class":255},[249,685,577],{"class":399},[249,687,580],{"class":410},[249,689,504],{"class":445},[249,691,449],{"class":255},[249,693,564],{"class":399},[249,695,697,699,701,703,705,707,709,711],{"class":251,"line":696},18,[249,698,592],{"class":410},[249,700,504],{"class":445},[249,702,449],{"class":255},[249,704,577],{"class":399},[249,706,601],{"class":410},[249,708,504],{"class":445},[249,710,449],{"class":255},[249,712,564],{"class":399},[249,714,716,718,720,722,724,726],{"class":251,"line":715},19,[249,717,509],{"class":399},[249,719,446],{"class":445},[249,721,617],{"class":255},[249,723,452],{"class":399},[249,725,623],{"class":622},[249,727,459],{"class":399},[228,729,730,731,735,736,739],{},"The generated stub is a ",[732,733,734],"em",{},"passthrough"," — input bytes flow out unchanged.\nA real codec replaces the bodies with entropy coding; for the tutorial\nwe'll XOR every byte with ",[235,737,738],{},"0x5A",".",[287,741,743,744],{"id":742},"_2-edit-srclibrs","2. Edit ",[235,745,375],{},[228,747,748],{},"Replace the encode and decode bodies:",[240,750,752],{"className":390,"code":751,"language":392,"meta":245,"style":245},"const KEY: u8 = 0x5A;\n\n#[unsafe(no_mangle)]\npub extern \"C\" fn ptwm_plane_codec_v1_encode(\n    _state: u32,\n    in_ptr: u32, in_len: u32,\n    out_ptr: u32, out_len: u32,\n) -> i64 {\n    if out_len \u003C in_len { return -2; }\n    let input = unsafe { std::slice::from_raw_parts(in_ptr as *const u8, in_len as usize) };\n    let output = unsafe { std::slice::from_raw_parts_mut(out_ptr as *mut u8, out_len as usize) };\n    for (i, b) in input.iter().enumerate() {\n        output[i] = b ^ KEY;\n    }\n    in_len as i64\n}\n",[235,753,754,777,781,793,811,821,839,857,868,900,959,1009,1049,1074,1079,1089],{"__ignoreMap":245},[249,755,756,759,763,765,768,771,774],{"class":251,"line":252},[249,757,758],{"class":422},"const",[249,760,762],{"class":761},"s_hVV"," KEY",[249,764,504],{"class":445},[249,766,767],{"class":255}," u8",[249,769,770],{"class":445}," =",[249,772,773],{"class":455}," 0x5A",[249,775,776],{"class":399},";\n",[249,778,779],{"class":251,"line":269},[249,780,465],{"emptyLinePlaceholder":464},[249,782,783,785,787,789,791],{"class":251,"line":334},[249,784,400],{"class":399},[249,786,404],{"class":403},[249,788,407],{"class":399},[249,790,411],{"class":410},[249,792,414],{"class":399},[249,794,795,797,799,801,803,805,807,809],{"class":251,"line":468},[249,796,419],{"class":403},[249,798,423],{"class":422},[249,800,426],{"class":278},[249,802,429],{"class":259},[249,804,432],{"class":278},[249,806,435],{"class":403},[249,808,548],{"class":438},[249,810,551],{"class":399},[249,812,813,815,817,819],{"class":251,"line":481},[249,814,557],{"class":410},[249,816,504],{"class":445},[249,818,449],{"class":255},[249,820,564],{"class":399},[249,822,823,825,827,829,831,833,835,837],{"class":251,"line":515},[249,824,570],{"class":410},[249,826,504],{"class":445},[249,828,449],{"class":255},[249,830,577],{"class":399},[249,832,580],{"class":410},[249,834,504],{"class":445},[249,836,449],{"class":255},[249,838,564],{"class":399},[249,840,841,843,845,847,849,851,853,855],{"class":251,"line":520},[249,842,592],{"class":410},[249,844,504],{"class":445},[249,846,449],{"class":255},[249,848,577],{"class":399},[249,850,601],{"class":410},[249,852,504],{"class":445},[249,854,449],{"class":255},[249,856,564],{"class":399},[249,858,859,861,863,865],{"class":251,"line":533},[249,860,509],{"class":399},[249,862,446],{"class":445},[249,864,617],{"class":255},[249,866,867],{"class":399}," {\n",[249,869,870,874,877,880,883,886,889,892,895,898],{"class":251,"line":554},[249,871,873],{"class":872},"sVHd0","    if",[249,875,876],{"class":410}," out_len ",[249,878,879],{"class":445},"\u003C",[249,881,882],{"class":410}," in_len ",[249,884,885],{"class":399},"{",[249,887,888],{"class":872}," return",[249,890,891],{"class":445}," -",[249,893,894],{"class":455},"2",[249,896,897],{"class":399},";",[249,899,459],{"class":399},[249,901,902,905,908,911,914,916,919,922,925,927,930,932,935,938,941,943,945,947,949,951,954,956],{"class":251,"line":567},[249,903,904],{"class":422},"    let",[249,906,907],{"class":410}," input ",[249,909,910],{"class":445},"=",[249,912,913],{"class":403}," unsafe",[249,915,452],{"class":399},[249,917,918],{"class":255}," std",[249,920,921],{"class":445},"::",[249,923,924],{"class":255},"slice",[249,926,921],{"class":445},[249,928,929],{"class":438},"from_raw_parts",[249,931,407],{"class":399},[249,933,934],{"class":410},"in_ptr ",[249,936,937],{"class":403},"as",[249,939,940],{"class":445}," *",[249,942,758],{"class":422},[249,944,767],{"class":255},[249,946,577],{"class":399},[249,948,882],{"class":410},[249,950,937],{"class":403},[249,952,953],{"class":255}," usize",[249,955,509],{"class":399},[249,957,958],{"class":399}," };\n",[249,960,961,963,966,968,970,972,974,976,978,980,983,985,988,990,992,995,997,999,1001,1003,1005,1007],{"class":251,"line":589},[249,962,904],{"class":422},[249,964,965],{"class":410}," output ",[249,967,910],{"class":445},[249,969,913],{"class":403},[249,971,452],{"class":399},[249,973,918],{"class":255},[249,975,921],{"class":445},[249,977,924],{"class":255},[249,979,921],{"class":445},[249,981,982],{"class":438},"from_raw_parts_mut",[249,984,407],{"class":399},[249,986,987],{"class":410},"out_ptr ",[249,989,937],{"class":403},[249,991,940],{"class":445},[249,993,994],{"class":422},"mut",[249,996,767],{"class":255},[249,998,577],{"class":399},[249,1000,876],{"class":410},[249,1002,937],{"class":403},[249,1004,953],{"class":255},[249,1006,509],{"class":399},[249,1008,958],{"class":399},[249,1010,1011,1014,1017,1020,1022,1025,1027,1030,1033,1035,1038,1040,1042,1045,1047],{"class":251,"line":610},[249,1012,1013],{"class":872},"    for",[249,1015,1016],{"class":399}," (",[249,1018,1019],{"class":410},"i",[249,1021,577],{"class":399},[249,1023,1024],{"class":410}," b",[249,1026,509],{"class":399},[249,1028,1029],{"class":403}," in",[249,1031,1032],{"class":410}," input",[249,1034,739],{"class":445},[249,1036,1037],{"class":438},"iter",[249,1039,442],{"class":399},[249,1041,739],{"class":445},[249,1043,1044],{"class":438},"enumerate",[249,1046,442],{"class":399},[249,1048,867],{"class":399},[249,1050,1051,1054,1057,1059,1062,1064,1067,1070,1072],{"class":251,"line":628},[249,1052,1053],{"class":410},"        output",[249,1055,1056],{"class":399},"[",[249,1058,1019],{"class":410},[249,1060,1061],{"class":399},"]",[249,1063,770],{"class":445},[249,1065,1066],{"class":410}," b ",[249,1068,1069],{"class":445},"^",[249,1071,762],{"class":761},[249,1073,776],{"class":399},[249,1075,1076],{"class":251,"line":633},[249,1077,1078],{"class":399},"    }\n",[249,1080,1081,1084,1086],{"class":251,"line":646},[249,1082,1083],{"class":410},"    in_len ",[249,1085,937],{"class":403},[249,1087,1088],{"class":255}," i64\n",[249,1090,1091],{"class":251,"line":666},[249,1092,1093],{"class":399},"}\n",[228,1095,1096,1097,1100,1101,1104,1105,1108],{},"Decode is identical (XOR is self-inverse). Keep ",[235,1098,1099],{},"init"," returning ",[235,1102,1103],{},"0","\nand ",[235,1106,1107],{},"cleanup"," empty — this codec has no per-call state.",[287,1110,1112],{"id":1111},"_3-build","3. Build",[240,1114,1116],{"className":242,"code":1115,"language":244,"meta":245,"style":245},"ptwm ext build\n",[235,1117,1118],{"__ignoreMap":245},[249,1119,1120,1122,1124],{"class":251,"line":252},[249,1121,300],{"class":255},[249,1123,303],{"class":259},[249,1125,1126],{"class":259}," build\n",[228,1128,1129,1130,1133,1134,1137],{},"Behind the scenes this runs ",[235,1131,1132],{},"cargo build --target wasm32-wasip1 --release"," and copies the resulting ",[235,1135,1136],{},".wasm"," to the bundle root. The\noutput:",[240,1139,1142],{"className":1140,"code":1141,"language":346},[344],"target\u002Fwasm32-wasip1\u002Frelease\u002Fxor_codec.wasm    [intermediate]\nxor-codec.wasm                                  [bundle artifact]\n",[235,1143,1141],{"__ignoreMap":245},[287,1145,1147],{"id":1146},"_4-sign","4. Sign",[228,1149,1150,1153,1154,1158,1159,1162,1163,1166],{},[235,1151,1152],{},"ptwm ext sign --key \u003Cpath>"," takes a ",[1155,1156,1157],"strong",{},"32-byte raw Ed25519 seed file",".\nThe v1 CLI doesn't ship a ",[235,1160,1161],{},"gen-key"," helper, so generate one with\n",[235,1164,1165],{},"openssl"," (or any source of 32 random bytes):",[240,1168,1170],{"className":242,"code":1169,"language":244,"meta":245,"style":245},"mkdir -p ~\u002F.ptwm\u002Fkeys\nopenssl rand 32 > ~\u002F.ptwm\u002Fkeys\u002Fdev.priv\nchmod 600 ~\u002F.ptwm\u002Fkeys\u002Fdev.priv\n",[235,1171,1172,1183,1199],{"__ignoreMap":245},[249,1173,1174,1177,1180],{"class":251,"line":252},[249,1175,1176],{"class":255},"mkdir",[249,1178,1179],{"class":312}," -p",[249,1181,1182],{"class":259}," ~\u002F.ptwm\u002Fkeys\n",[249,1184,1185,1187,1190,1193,1196],{"class":251,"line":269},[249,1186,1165],{"class":255},[249,1188,1189],{"class":259}," rand",[249,1191,1192],{"class":455}," 32",[249,1194,1195],{"class":445}," >",[249,1197,1198],{"class":259}," ~\u002F.ptwm\u002Fkeys\u002Fdev.priv\n",[249,1200,1201,1204,1207],{"class":251,"line":334},[249,1202,1203],{"class":255},"chmod",[249,1205,1206],{"class":455}," 600",[249,1208,1198],{"class":259},[228,1210,1211],{},"Then sign the bundle:",[240,1213,1215],{"className":242,"code":1214,"language":244,"meta":245,"style":245},"ptwm ext sign --key ~\u002F.ptwm\u002Fkeys\u002Fdev.priv\n",[235,1216,1217],{"__ignoreMap":245},[249,1218,1219,1221,1223,1226,1229],{"class":251,"line":252},[249,1220,300],{"class":255},[249,1222,303],{"class":259},[249,1224,1225],{"class":259}," sign",[249,1227,1228],{"class":312}," --key",[249,1230,1198],{"class":259},[228,1232,1233,1236,1237,1239],{},[235,1234,1235],{},"ext sign"," rewrites ",[235,1238,361],{}," so that:",[1241,1242,1243,1254,1265],"ul",{},[1244,1245,1246,1249,1250,1253],"li",{},[235,1247,1248],{},"[bundle].author_pubkey"," becomes the real ",[235,1251,1252],{},"ed25519:\u003Chex>"," of the key.",[1244,1255,1256,1257,1260,1261,1264],{},"Every ",[235,1258,1259],{},"[[contributions]].id"," becomes the real\n",[235,1262,1263],{},"blake3:\u003Chex>"," canonical id (derived from your pubkey + name +\nversion).",[1244,1266,1267,1270,1271,739],{},[235,1268,1269],{},"signature.bin"," is written next to the manifest: a 64-byte Ed25519\nsignature over ",[235,1272,1273],{},"blake3(manifest_bytes ‖ xor-codec.wasm)",[228,1275,1276],{},"Tampering with either the manifest or the binary after this step\ninvalidates the signature; the container reader will reject the\nbundle.",[287,1278,1280],{"id":1279},"_5-pack-install","5. Pack & install",[228,1282,1283,1284,1286,1287,1289,1290,1292],{},"After signing, ",[235,1285,361],{}," carries your ",[235,1288,1252],{}," public key\nunder ",[235,1291,1248],{},". Read it out and add it to your\nkeyring before installing:",[240,1294,1296],{"className":242,"code":1295,"language":244,"meta":245,"style":245},"ptwm ext pack       # produces xor-codec-0.1.0.tar.zst\n\n# Pull the public key from the signed manifest and trust it locally.\nPUBKEY=$(python -c \\\n    'import tomllib, pathlib; \\\n     print(tomllib.loads(pathlib.Path(\"manifest.toml\").read_text())[\"bundle\"][\"author_pubkey\"])')\nptwm trust add --key \"$PUBKEY\" --label dev\n\nptwm ext install .\u002Fxor-codec-0.1.0.tar.zst\nptwm ext list\n",[235,1297,1298,1310,1314,1319,1338,1346,1357,1381,1385,1396],{"__ignoreMap":245},[249,1299,1300,1302,1304,1307],{"class":251,"line":252},[249,1301,300],{"class":255},[249,1303,303],{"class":259},[249,1305,1306],{"class":259}," pack",[249,1308,1309],{"class":622},"       # produces xor-codec-0.1.0.tar.zst\n",[249,1311,1312],{"class":251,"line":269},[249,1313,465],{"emptyLinePlaceholder":464},[249,1315,1316],{"class":251,"line":334},[249,1317,1318],{"class":622},"# Pull the public key from the signed manifest and trust it locally.\n",[249,1320,1321,1324,1326,1329,1332,1335],{"class":251,"line":468},[249,1322,1323],{"class":410},"PUBKEY",[249,1325,910],{"class":445},[249,1327,1328],{"class":399},"$(",[249,1330,1331],{"class":255},"python",[249,1333,1334],{"class":312}," -c",[249,1336,1337],{"class":761}," \\\n",[249,1339,1340,1343],{"class":251,"line":481},[249,1341,1342],{"class":278},"    '",[249,1344,1345],{"class":259},"import tomllib, pathlib; \\\n",[249,1347,1348,1351,1354],{"class":251,"line":515},[249,1349,1350],{"class":259},"     print(tomllib.loads(pathlib.Path(\"manifest.toml\").read_text())[\"bundle\"][\"author_pubkey\"])",[249,1352,1353],{"class":278},"'",[249,1355,1356],{"class":399},")\n",[249,1358,1359,1361,1364,1366,1368,1370,1373,1375,1378],{"class":251,"line":520},[249,1360,300],{"class":255},[249,1362,1363],{"class":259}," trust",[249,1365,263],{"class":259},[249,1367,1228],{"class":312},[249,1369,426],{"class":278},[249,1371,1372],{"class":410},"$PUBKEY",[249,1374,432],{"class":278},[249,1376,1377],{"class":312}," --label",[249,1379,1380],{"class":259}," dev\n",[249,1382,1383],{"class":251,"line":533},[249,1384,465],{"emptyLinePlaceholder":464},[249,1386,1387,1389,1391,1393],{"class":251,"line":554},[249,1388,300],{"class":255},[249,1390,303],{"class":259},[249,1392,275],{"class":259},[249,1394,1395],{"class":259}," .\u002Fxor-codec-0.1.0.tar.zst\n",[249,1397,1398,1400,1402],{"class":251,"line":567},[249,1399,300],{"class":255},[249,1401,303],{"class":259},[249,1403,1404],{"class":259}," list\n",[228,1406,1407,1408,1411,1412,1415],{},"The ",[235,1409,1410],{},"trust add --key"," step tells the user keyring to accept any\ncontribution signed by this author. Without it, ",[235,1413,1414],{},"ext install"," would\nrefuse the bundle as untrusted.",[287,1417,1419],{"id":1418},"_6-confirm-it-loads","6. Confirm it loads",[240,1421,1423],{"className":242,"code":1422,"language":244,"meta":245,"style":245},"ptwm ext show xor-codec\n",[235,1424,1425],{"__ignoreMap":245},[249,1426,1427,1429,1431,1434],{"class":251,"line":252},[249,1428,300],{"class":255},[249,1430,303],{"class":259},[249,1432,1433],{"class":259}," show",[249,1435,331],{"class":259},[228,1437,1438,1439,1442],{},"Look for ",[235,1440,1441],{},"pubkey: ed25519:\u003Cyour-hex>"," — that's the keyring matching\nthe bundle's author. The contribution count, canonical id, and\ninstalled flavors are also reported.",[228,1444,1445,1446,1449],{},"To exercise the new codec end-to-end, run the ablation harness so a\npolicy variant can target it. Write a policy that allows just your\nnew codec, then run ",[235,1447,1448],{},"ptwm bench compress"," so the dispatcher attempts\nit against the built-ins:",[240,1451,1453],{"className":242,"code":1452,"language":244,"meta":245,"style":245},"python -c 'print(\"Hello, \" * 50, end=\"\")' > sample.bin\n\ncat > policy.toml \u003C\u003CEOF\n[allow]\nextra = [\"blake3:\u003Ccanonical-id-from-show>\"]\nEOF\n\nptwm bench compress sample.bin --variant policy.toml --out bench-out\u002F\n",[235,1454,1455,1473,1477,1493,1498,1503,1507,1511],{"__ignoreMap":245},[249,1456,1457,1459,1461,1463,1466,1468,1470],{"class":251,"line":252},[249,1458,1331],{"class":255},[249,1460,1334],{"class":312},[249,1462,279],{"class":278},[249,1464,1465],{"class":259},"print(\"Hello, \" * 50, end=\"\")",[249,1467,1353],{"class":278},[249,1469,1195],{"class":445},[249,1471,1472],{"class":259}," sample.bin\n",[249,1474,1475],{"class":251,"line":269},[249,1476,465],{"emptyLinePlaceholder":464},[249,1478,1479,1482,1484,1487,1490],{"class":251,"line":334},[249,1480,1481],{"class":255},"cat",[249,1483,1195],{"class":445},[249,1485,1486],{"class":259}," policy.toml",[249,1488,1489],{"class":445}," \u003C\u003C",[249,1491,1492],{"class":278},"EOF\n",[249,1494,1495],{"class":251,"line":468},[249,1496,1497],{"class":259},"[allow]\n",[249,1499,1500],{"class":251,"line":481},[249,1501,1502],{"class":259},"extra = [\"blake3:\u003Ccanonical-id-from-show>\"]\n",[249,1504,1505],{"class":251,"line":515},[249,1506,1492],{"class":278},[249,1508,1509],{"class":251,"line":520},[249,1510,465],{"emptyLinePlaceholder":464},[249,1512,1513,1515,1518,1521,1524,1527,1529,1532],{"class":251,"line":533},[249,1514,300],{"class":255},[249,1516,1517],{"class":259}," bench",[249,1519,1520],{"class":259}," compress",[249,1522,1523],{"class":259}," sample.bin",[249,1525,1526],{"class":312}," --variant",[249,1528,1486],{"class":259},[249,1530,1531],{"class":312}," --out",[249,1533,1534],{"class":259}," bench-out\u002F\n",[228,1536,1537,1540,1541,1544,1545,1548,1549,1552,1553,1556,1557,1560,1561,1564],{},[235,1538,1539],{},"bench compress"," writes a CSV under ",[235,1542,1543],{},"bench-out\u002F",". The\n",[235,1546,1547],{},"resolved_policy_toml"," column records exactly which codecs were\neligible per row; the ",[235,1550,1551],{},"compressed_bytes"," and ",[235,1554,1555],{},"ratio"," columns reflect\nthe dispatcher's choice. Since XOR is roughly identity for cost\n(",[235,1558,1559],{},"ratio ≈ 1.0","), Huffman typically wins on a real model — but the\n",[732,1562,1563],{},"attempt"," proves the bundle loaded, verified, and ran.",[287,1566,1568],{"id":1567},"where-to-go-from-here","Where to go from here",[1241,1570,1571,1578,1586,1591],{},[1244,1572,1573,1577],{},[378,1574,1576],{"href":380,"rel":1575},[382],"Extension system design"," —\nfull design rationale and per-kind ABI signatures.",[1244,1579,1580,1585],{},[378,1581,1584],{"href":1582,"rel":1583},"https:\u002F\u002Fgithub.com\u002Fkhwstolle\u002Fptwm\u002Ftree\u002Fmaster\u002Fextensions",[382],"Reference extensions"," —\none passthrough per kind, in either Rust or Python.",[1244,1587,1588,1590],{},[378,1589,187],{"href":188}," — how to harden\nyour keyring before shipping to others.",[1244,1592,1593,1596],{},[378,1594,1595],{"href":94},"Extensibility concept"," — the wider design.",[287,1598,1600],{"id":1599},"common-pitfalls","Common pitfalls",[1241,1602,1603,1622,1636,1646],{},[1244,1604,1605,1610,1611,1614,1615,1618,1619,739],{},[1155,1606,1607,1608],{},"Forgot to add ",[235,1609,237],{}," — ",[235,1612,1613],{},"ptwm ext build"," will report\n",[235,1616,1617],{},"linker error: …unknown target",". Fix:\n",[235,1620,1621],{},"rustup target add wasm32-wasip1",[1244,1623,1624,1627,1628,1631,1632,1635],{},[1155,1625,1626],{},"Tampered with binary after sign"," — install will fail with\n",[235,1629,1630],{},"ContributionUntrusted",". Re-run ",[235,1633,1634],{},"ptwm ext sign"," to refresh the\nsignature.",[1244,1637,1638,1641,1642,1645],{},[1155,1639,1640],{},"Author key not in keyring"," — same error. Run ",[235,1643,1644],{},"ptwm trust add --key …"," first.",[1244,1647,1648,1653,1654,1657],{},[1155,1649,1650],{},[235,1651,1652],{},"out_len \u003C in_len"," — return ",[235,1655,1656],{},"-2"," (BufferTooSmall). The\ndispatcher will then skip your codec and pick a different one.",[1659,1660,1661],"style",{},"html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .stzsN, html code.shiki .stzsN{--shiki-light:#91B859;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}",{"title":245,"searchDepth":334,"depth":334,"links":1663},[1664,1665,1667,1668,1669,1670,1671,1672],{"id":289,"depth":269,"text":290},{"id":742,"depth":269,"text":1666},"2. Edit src\u002Flib.rs",{"id":1111,"depth":269,"text":1112},{"id":1146,"depth":269,"text":1147},{"id":1279,"depth":269,"text":1280},{"id":1418,"depth":269,"text":1419},{"id":1567,"depth":269,"text":1568},{"id":1599,"depth":269,"text":1600},"Step-by-step walkthrough from `ptwm ext init` to a signed, installed plane codec.","md",null,{},{"title":183,"description":1673},"DvUDrUEjxDnSSSPZaQTNOdZIvtWPdGZ8wvSYZxPU9RA",[1680,1682],{"title":179,"path":180,"stem":181,"description":1681,"children":-1},"Use the Compressor and Decompressor classes directly from Python.",{"title":187,"path":188,"stem":189,"description":1683,"children":-1},"How PTWM decides whether to load an extension — keyring, capabilities, and the threat model.",1784796353818]