[{"data":1,"prerenderedAt":456},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fdot-cognet":3},{"id":4,"title":5,"body":6,"description":449,"extension":450,"meta":451,"navigation":243,"path":452,"seo":453,"stem":454,"__hash__":455},"docs\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fdot-cognet.md",".cognet",{"type":7,"value":8,"toc":444},"minimark",[9,13,58,66,82,93,98,118,124,390,405,409,416,422,426,440],[10,11,5],"h1",{"id":12},"cognet",[14,15,20],"pre",{"className":16,"code":17,"language":18,"meta":19,"style":19},"language-bash shiki shiki-themes dark-plus",".cognet\u002F\n├── globals.d.ts     # ambient globals, typed for the editor\n└── tsconfig.json    # the canonical config for cognet source\n","bash","",[21,22,23,32,46],"code",{"__ignoreMap":19},[24,25,28],"span",{"class":26,"line":27},"line",1,[24,29,31],{"class":30},"sCudf",".cognet\u002F\n",[24,33,35,38,42],{"class":26,"line":34},2,[24,36,37],{"class":30},"├──",[24,39,41],{"class":40},"sKc5r"," globals.d.ts",[24,43,45],{"class":44},"sOLPB","     # ambient globals, typed for the editor\n",[24,47,49,52,55],{"class":26,"line":48},3,[24,50,51],{"class":30},"└──",[24,53,54],{"class":40}," tsconfig.json",[24,56,57],{"class":44},"    # the canonical config for cognet source\n",[59,60,61,62,65],"p",{},"Both files are generated. ",[21,63,64],{},"axon prepare"," writes them, and the first line of each says so.",[14,67,69],{"className":16,"code":68,"language":18,"meta":19,"style":19},"axon cognet prepare\n",[21,70,71],{"__ignoreMap":19},[24,72,73,76,79],{"class":26,"line":27},[24,74,75],{"class":30},"axon",[24,77,78],{"class":40}," cognet",[24,80,81],{"class":40}," prepare\n",[59,83,84,85,88,89,92],{},"Run it after scaffolding, after upgrading Axon, or any time your editor stops recognising\n",[21,86,87],{},"loop"," and ",[21,90,91],{},"kernel",".",[94,95,97],"h2",{"id":96},"why-globals-need-declaring","Why globals need declaring",[59,99,100,101,103,104,103,106,109,110,113,114,117],{},"The ambient globals are installed at runtime by the compile host — importing that module\nis what puts ",[21,102,87],{},", ",[21,105,91],{},[21,107,108],{},"phase",", and ",[21,111,112],{},"system"," on ",[21,115,116],{},"globalThis",". That works, but your\neditor has no way to know it happened.",[59,119,120,123],{},[21,121,122],{},"globals.d.ts"," is the declaration that closes the gap:",[14,125,129],{"className":126,"code":127,"language":128,"meta":19,"style":19},"language-ts shiki shiki-themes dark-plus","declare global {\n    \u002F** THE entry point — declare the tick pipeline once, in src\u002Fmain.ts. *\u002F\n    function loop(body: (ctx: {\n        stimuli: readonly AxonStimulusEntry[]\n        signal: AbortSignal\n        stop(): void\n    }) => Promise\u003Cvoid>): void\n\n    \u002F** the syscall table — live from load() onward *\u002F\n    const kernel: KernelAbi\n\n    \u002F** a named stage within a tick — cognet:phase:* telemetry *\u002F\n    function phase\u003CT>(name: string, fn: () => Promise\u003CT>): Promise\u003CT>\n\n    \u002F** a unit of work within a phase — timed for the flame graph *\u002F\n    function system\u003CT>(name: string, fn: () => Promise\u003CT>): Promise\u003CT>\n}\n","ts",[21,130,131,145,150,173,192,203,215,238,245,251,266,271,277,329,334,340,384],{"__ignoreMap":19},[24,132,133,137,141],{"class":26,"line":27},[24,134,136],{"class":135},"scz_3","declare",[24,138,140],{"class":139},"s3F5K"," global",[24,142,144],{"class":143},"sTNBD"," {\n",[24,146,147],{"class":26,"line":34},[24,148,149],{"class":44},"    \u002F** THE entry point — declare the tick pipeline once, in src\u002Fmain.ts. *\u002F\n",[24,151,152,155,158,161,164,167,170],{"class":26,"line":48},[24,153,154],{"class":135},"    function",[24,156,157],{"class":30}," loop",[24,159,160],{"class":143},"(",[24,162,163],{"class":30},"body",[24,165,166],{"class":143},": (",[24,168,169],{"class":139},"ctx",[24,171,172],{"class":143},": {\n",[24,174,176,179,182,185,189],{"class":26,"line":175},4,[24,177,178],{"class":139},"        stimuli",[24,180,181],{"class":143},": ",[24,183,184],{"class":135},"readonly",[24,186,188],{"class":187},"sNl3T"," AxonStimulusEntry",[24,190,191],{"class":143},"[]\n",[24,193,195,198,200],{"class":26,"line":194},5,[24,196,197],{"class":139},"        signal",[24,199,181],{"class":143},[24,201,202],{"class":187},"AbortSignal\n",[24,204,206,209,212],{"class":26,"line":205},6,[24,207,208],{"class":30},"        stop",[24,210,211],{"class":143},"(): ",[24,213,214],{"class":187},"void\n",[24,216,218,221,224,227,230,233,236],{"class":26,"line":217},7,[24,219,220],{"class":143},"    }) ",[24,222,223],{"class":135},"=>",[24,225,226],{"class":187}," Promise",[24,228,229],{"class":143},"\u003C",[24,231,232],{"class":187},"void",[24,234,235],{"class":143},">): ",[24,237,214],{"class":187},[24,239,241],{"class":26,"line":240},8,[24,242,244],{"emptyLinePlaceholder":243},true,"\n",[24,246,248],{"class":26,"line":247},9,[24,249,250],{"class":44},"    \u002F** the syscall table — live from load() onward *\u002F\n",[24,252,254,257,261,263],{"class":26,"line":253},10,[24,255,256],{"class":135},"    const",[24,258,260],{"class":259},"s9McN"," kernel",[24,262,181],{"class":143},[24,264,265],{"class":187},"KernelAbi\n",[24,267,269],{"class":26,"line":268},11,[24,270,244],{"emptyLinePlaceholder":243},[24,272,274],{"class":26,"line":273},12,[24,275,276],{"class":44},"    \u002F** a named stage within a tick — cognet:phase:* telemetry *\u002F\n",[24,278,280,282,285,287,290,293,296,298,301,303,306,309,311,313,315,317,319,322,324,326],{"class":26,"line":279},13,[24,281,154],{"class":135},[24,283,284],{"class":30}," phase",[24,286,229],{"class":143},[24,288,289],{"class":187},"T",[24,291,292],{"class":143},">(",[24,294,295],{"class":139},"name",[24,297,181],{"class":143},[24,299,300],{"class":187},"string",[24,302,103],{"class":143},[24,304,305],{"class":30},"fn",[24,307,308],{"class":143},": () ",[24,310,223],{"class":135},[24,312,226],{"class":187},[24,314,229],{"class":143},[24,316,289],{"class":187},[24,318,235],{"class":143},[24,320,321],{"class":187},"Promise",[24,323,229],{"class":143},[24,325,289],{"class":187},[24,327,328],{"class":143},">\n",[24,330,332],{"class":26,"line":331},14,[24,333,244],{"emptyLinePlaceholder":243},[24,335,337],{"class":26,"line":336},15,[24,338,339],{"class":44},"    \u002F** a unit of work within a phase — timed for the flame graph *\u002F\n",[24,341,343,345,348,350,352,354,356,358,360,362,364,366,368,370,372,374,376,378,380,382],{"class":26,"line":342},16,[24,344,154],{"class":135},[24,346,347],{"class":30}," system",[24,349,229],{"class":143},[24,351,289],{"class":187},[24,353,292],{"class":143},[24,355,295],{"class":139},[24,357,181],{"class":143},[24,359,300],{"class":187},[24,361,103],{"class":143},[24,363,305],{"class":30},[24,365,308],{"class":143},[24,367,223],{"class":135},[24,369,226],{"class":187},[24,371,229],{"class":143},[24,373,289],{"class":187},[24,375,235],{"class":143},[24,377,321],{"class":187},[24,379,229],{"class":143},[24,381,289],{"class":187},[24,383,328],{"class":143},[24,385,387],{"class":26,"line":386},17,[24,388,389],{"class":143},"}\n",[59,391,392,393,396,397,400,401,404],{},"The types come from ",[21,394,395],{},"@arcforge\u002Ftypes",", so ",[21,398,399],{},"kernel.store.get(\"checkpoint\")"," is typed\nagainst your own ",[21,402,403],{},"CognetStoreSchema"," declaration and a syscall you got wrong is a red\nsquiggle rather than a runtime failure.",[94,406,408],{"id":407},"commit-it","Commit it",[59,410,411,412,415],{},"Unlike ",[21,413,414],{},"node_modules",", this belongs in version control. It's small, it's deterministic,\nand committing it means a fresh clone type-checks before anyone runs a build.",[59,417,418,419,421],{},"Don't edit it. ",[21,420,64],{}," overwrites the file wholesale, and any change you make will\ndisappear the next time anyone runs it. If a global is wrong, the fix is in the generator,\nnot here.",[94,423,425],{"id":424},"the-scaffold-and-prepare-agree","The scaffold and prepare agree",[59,427,428,431,432,436,437,439],{},[21,429,430],{},"axon cognet init"," writes this frame using the ",[433,434,435],"em",{},"same"," generators ",[21,438,64],{}," runs. That\nisn't a detail — it's why a freshly scaffolded cognet and a repaired old one end up\nidentical. There is no second template to drift.",[441,442,443],"style",{},"html pre.shiki code .sCudf, html code.shiki .sCudf{--shiki-default:#DCDCAA}html pre.shiki code .sKc5r, html code.shiki .sKc5r{--shiki-default:#CE9178}html pre.shiki code .sOLPB, html code.shiki .sOLPB{--shiki-default:#6A9955}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 pre.shiki code .scz_3, html code.shiki .scz_3{--shiki-default:#569CD6}html pre.shiki code .s3F5K, html code.shiki .s3F5K{--shiki-default:#9CDCFE}html pre.shiki code .sTNBD, html code.shiki .sTNBD{--shiki-default:#D4D4D4}html pre.shiki code .sNl3T, html code.shiki .sNl3T{--shiki-default:#4EC9B0}html pre.shiki code .s9McN, html code.shiki .s9McN{--shiki-default:#4FC1FF}",{"title":19,"searchDepth":34,"depth":34,"links":445},[446,447,448],{"id":96,"depth":34,"text":97},{"id":407,"depth":34,"text":408},{"id":424,"depth":34,"text":425},"Generated type declarations — commit them, don't edit them.","md",{},"\u002Fdocs\u002Fv2\u002Fcognets\u002Ffolder\u002Fdot-cognet",{"title":5,"description":449},"docs\u002Fv2\u002Fcognets\u002Ffolder\u002Fdot-cognet","VSKnQwtExVsIe-hT9Sb_Pszjg3LlU966N1U5EduF1Vc",1785156432119]