[{"data":1,"prerenderedAt":3442},["ShallowReactive",2],{"navigation_docs":3,"-developers-processes":613,"-developers-processes-surround":3439},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":409,"body":615,"description":653,"extension":3434,"links":3435,"meta":3436,"navigation":705,"path":410,"seo":3437,"stem":411,"__hash__":3438},"docs\u002F4.developers\u002F15.processes.md",{"type":616,"value":617,"toc":3419},"minimark",[618,627,632,647,1275,1461,1465,1481,1485,1492,1606,1610,1647,2212,2361,2375,2379,2418,2644,2690,2693,2697,2707,2794,2909,2960,2964,2996,3010,3014,3036,3107,3131,3135,3310,3314,3415],[619,620,621,622,626],"p",{},"A trusted module can keep work running: a connection it holds open (a chat bot's presence, a device, a stream from a\nprovider), a loop that watches something. That is a ",[623,624,625],"strong",{},"process",". SHADE runs each one on the\nworker container role only, in a worker thread of its own with a heap limit, restarts it when it crashes and shows its\nstate on the Modules page. Untrusted modules have no processes: long-running code needs the trust of the process.",[628,629,631],"h2",{"id":630},"what-a-module-writes","What a module writes",[619,633,634,635,639,640,642,643,646],{},"Two parts of the manifest: the process itself in ",[636,637,638],"code",{},"processes",", and its parameters under the same name in the ",[636,641,625],{},"\ncapability (see ",[644,645,389],"a",{"href":390},").",[648,649,654],"pre",{"className":650,"code":651,"language":652,"meta":653,"style":653},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { defineModule, getModuleSettings, moduleKv } from '@shadestack\u002Fmodule-sdk\u002Fserver'\n\nexport default defineModule({\n  name: 'readme-cards',\n  version: '1.0.0',\n  description: 'Cards for a README, with a Discord presence.',\n  capabilities: {\n    http: {},\n    kv: { data: { purpose: 'readmeCards.keeps', personal: 'none' } },\n    process: {\n      need: 'optional',                     \u002F\u002F works without; an admin switches it on\n      processes: {\n        presence: { mode: 'singleton', memoryMb: 64, stopTimeoutMs: 10_000, maxRestarts: 10 }\n      }\n    }\n  },\n  processes: [\n    {\n      name: 'presence',\n      run: async (ctx, signal) => {\n        const { discordToken } = await getModuleSettings(ctx, 'readme-cards')\n        const socket = await connectToDiscord(discordToken, { signal })\n        socket.on('presence', status => void moduleKv(ctx).set('presence', status))\n        \u002F\u002F Run until SHADE stops it, then let go of what it holds.\n        await new Promise\u003Cvoid>(resolve => signal.addEventListener('abort', () => resolve(), { once: true }))\n        await socket.close()\n      }\n    }\n  ]\n})\n","ts","",[636,655,656,700,707,725,746,763,780,791,802,850,860,881,891,947,953,959,965,976,982,999,1031,1067,1097,1155,1161,1236,1251,1256,1261,1267],{"__ignoreMap":653},[657,658,661,665,669,673,676,679,681,684,687,690,693,697],"span",{"class":659,"line":660},"line",1,[657,662,664],{"class":663},"s7zQu","import",[657,666,668],{"class":667},"sMK4o"," {",[657,670,672],{"class":671},"sTEyZ"," defineModule",[657,674,675],{"class":667},",",[657,677,678],{"class":671}," getModuleSettings",[657,680,675],{"class":667},[657,682,683],{"class":671}," moduleKv",[657,685,686],{"class":667}," }",[657,688,689],{"class":663}," from",[657,691,692],{"class":667}," '",[657,694,696],{"class":695},"sfazB","@shadestack\u002Fmodule-sdk\u002Fserver",[657,698,699],{"class":667},"'\n",[657,701,703],{"class":659,"line":702},2,[657,704,706],{"emptyLinePlaceholder":705},true,"\n",[657,708,710,713,716,719,722],{"class":659,"line":709},3,[657,711,712],{"class":663},"export",[657,714,715],{"class":663}," default",[657,717,672],{"class":718},"s2Zo4",[657,720,721],{"class":671},"(",[657,723,724],{"class":667},"{\n",[657,726,728,732,735,737,740,743],{"class":659,"line":727},4,[657,729,731],{"class":730},"swJcz","  name",[657,733,734],{"class":667},":",[657,736,692],{"class":667},[657,738,739],{"class":695},"readme-cards",[657,741,742],{"class":667},"'",[657,744,745],{"class":667},",\n",[657,747,749,752,754,756,759,761],{"class":659,"line":748},5,[657,750,751],{"class":730},"  version",[657,753,734],{"class":667},[657,755,692],{"class":667},[657,757,758],{"class":695},"1.0.0",[657,760,742],{"class":667},[657,762,745],{"class":667},[657,764,766,769,771,773,776,778],{"class":659,"line":765},6,[657,767,768],{"class":730},"  description",[657,770,734],{"class":667},[657,772,692],{"class":667},[657,774,775],{"class":695},"Cards for a README, with a Discord presence.",[657,777,742],{"class":667},[657,779,745],{"class":667},[657,781,783,786,788],{"class":659,"line":782},7,[657,784,785],{"class":730},"  capabilities",[657,787,734],{"class":667},[657,789,790],{"class":667}," {\n",[657,792,794,797,799],{"class":659,"line":793},8,[657,795,796],{"class":730},"    http",[657,798,734],{"class":667},[657,800,801],{"class":667}," {},\n",[657,803,805,808,810,812,815,817,819,822,824,826,829,831,833,836,838,840,843,845,847],{"class":659,"line":804},9,[657,806,807],{"class":730},"    kv",[657,809,734],{"class":667},[657,811,668],{"class":667},[657,813,814],{"class":730}," data",[657,816,734],{"class":667},[657,818,668],{"class":667},[657,820,821],{"class":730}," purpose",[657,823,734],{"class":667},[657,825,692],{"class":667},[657,827,828],{"class":695},"readmeCards.keeps",[657,830,742],{"class":667},[657,832,675],{"class":667},[657,834,835],{"class":730}," personal",[657,837,734],{"class":667},[657,839,692],{"class":667},[657,841,842],{"class":695},"none",[657,844,742],{"class":667},[657,846,686],{"class":667},[657,848,849],{"class":667}," },\n",[657,851,853,856,858],{"class":659,"line":852},10,[657,854,855],{"class":730},"    process",[657,857,734],{"class":667},[657,859,790],{"class":667},[657,861,863,866,868,870,873,875,877],{"class":659,"line":862},11,[657,864,865],{"class":730},"      need",[657,867,734],{"class":667},[657,869,692],{"class":667},[657,871,872],{"class":695},"optional",[657,874,742],{"class":667},[657,876,675],{"class":667},[657,878,880],{"class":879},"sHwdD","                     \u002F\u002F works without; an admin switches it on\n",[657,882,884,887,889],{"class":659,"line":883},12,[657,885,886],{"class":730},"      processes",[657,888,734],{"class":667},[657,890,790],{"class":667},[657,892,894,897,899,901,904,906,908,911,913,915,918,920,924,926,929,931,934,936,939,941,944],{"class":659,"line":893},13,[657,895,896],{"class":730},"        presence",[657,898,734],{"class":667},[657,900,668],{"class":667},[657,902,903],{"class":730}," mode",[657,905,734],{"class":667},[657,907,692],{"class":667},[657,909,910],{"class":695},"singleton",[657,912,742],{"class":667},[657,914,675],{"class":667},[657,916,917],{"class":730}," memoryMb",[657,919,734],{"class":667},[657,921,923],{"class":922},"sbssI"," 64",[657,925,675],{"class":667},[657,927,928],{"class":730}," stopTimeoutMs",[657,930,734],{"class":667},[657,932,933],{"class":922}," 10_000",[657,935,675],{"class":667},[657,937,938],{"class":730}," maxRestarts",[657,940,734],{"class":667},[657,942,943],{"class":922}," 10",[657,945,946],{"class":667}," }\n",[657,948,950],{"class":659,"line":949},14,[657,951,952],{"class":667},"      }\n",[657,954,956],{"class":659,"line":955},15,[657,957,958],{"class":667},"    }\n",[657,960,962],{"class":659,"line":961},16,[657,963,964],{"class":667},"  },\n",[657,966,968,971,973],{"class":659,"line":967},17,[657,969,970],{"class":730},"  processes",[657,972,734],{"class":667},[657,974,975],{"class":671}," [\n",[657,977,979],{"class":659,"line":978},18,[657,980,981],{"class":667},"    {\n",[657,983,985,988,990,992,995,997],{"class":659,"line":984},19,[657,986,987],{"class":730},"      name",[657,989,734],{"class":667},[657,991,692],{"class":667},[657,993,994],{"class":695},"presence",[657,996,742],{"class":667},[657,998,745],{"class":667},[657,1000,1002,1005,1007,1011,1014,1018,1020,1023,1026,1029],{"class":659,"line":1001},20,[657,1003,1004],{"class":718},"      run",[657,1006,734],{"class":667},[657,1008,1010],{"class":1009},"spNyl"," async",[657,1012,1013],{"class":667}," (",[657,1015,1017],{"class":1016},"sHdIc","ctx",[657,1019,675],{"class":667},[657,1021,1022],{"class":1016}," signal",[657,1024,1025],{"class":667},")",[657,1027,1028],{"class":1009}," =>",[657,1030,790],{"class":667},[657,1032,1034,1037,1039,1042,1044,1047,1050,1052,1054,1056,1058,1060,1062,1064],{"class":659,"line":1033},21,[657,1035,1036],{"class":1009},"        const",[657,1038,668],{"class":667},[657,1040,1041],{"class":671}," discordToken",[657,1043,686],{"class":667},[657,1045,1046],{"class":667}," =",[657,1048,1049],{"class":663}," await",[657,1051,678],{"class":718},[657,1053,721],{"class":730},[657,1055,1017],{"class":671},[657,1057,675],{"class":667},[657,1059,692],{"class":667},[657,1061,739],{"class":695},[657,1063,742],{"class":667},[657,1065,1066],{"class":730},")\n",[657,1068,1070,1072,1075,1077,1079,1082,1084,1087,1089,1091,1093,1095],{"class":659,"line":1069},22,[657,1071,1036],{"class":1009},[657,1073,1074],{"class":671}," socket",[657,1076,1046],{"class":667},[657,1078,1049],{"class":663},[657,1080,1081],{"class":718}," connectToDiscord",[657,1083,721],{"class":730},[657,1085,1086],{"class":671},"discordToken",[657,1088,675],{"class":667},[657,1090,668],{"class":667},[657,1092,1022],{"class":671},[657,1094,686],{"class":667},[657,1096,1066],{"class":730},[657,1098,1100,1103,1106,1109,1111,1113,1115,1117,1119,1122,1124,1127,1129,1131,1133,1135,1137,1140,1142,1144,1146,1148,1150,1152],{"class":659,"line":1099},23,[657,1101,1102],{"class":671},"        socket",[657,1104,1105],{"class":667},".",[657,1107,1108],{"class":718},"on",[657,1110,721],{"class":730},[657,1112,742],{"class":667},[657,1114,994],{"class":695},[657,1116,742],{"class":667},[657,1118,675],{"class":667},[657,1120,1121],{"class":1016}," status",[657,1123,1028],{"class":1009},[657,1125,1126],{"class":667}," void",[657,1128,683],{"class":718},[657,1130,721],{"class":730},[657,1132,1017],{"class":671},[657,1134,1025],{"class":730},[657,1136,1105],{"class":667},[657,1138,1139],{"class":718},"set",[657,1141,721],{"class":730},[657,1143,742],{"class":667},[657,1145,994],{"class":695},[657,1147,742],{"class":667},[657,1149,675],{"class":667},[657,1151,1121],{"class":671},[657,1153,1154],{"class":730},"))\n",[657,1156,1158],{"class":659,"line":1157},24,[657,1159,1160],{"class":879},"        \u002F\u002F Run until SHADE stops it, then let go of what it holds.\n",[657,1162,1164,1167,1170,1174,1177,1180,1183,1185,1188,1190,1192,1194,1197,1199,1201,1204,1206,1208,1211,1213,1216,1219,1221,1223,1226,1228,1232,1234],{"class":659,"line":1163},25,[657,1165,1166],{"class":663},"        await",[657,1168,1169],{"class":667}," new",[657,1171,1173],{"class":1172},"sBMFI"," Promise",[657,1175,1176],{"class":667},"\u003C",[657,1178,1179],{"class":1172},"void",[657,1181,1182],{"class":667},">",[657,1184,721],{"class":730},[657,1186,1187],{"class":1016},"resolve",[657,1189,1028],{"class":1009},[657,1191,1022],{"class":671},[657,1193,1105],{"class":667},[657,1195,1196],{"class":718},"addEventListener",[657,1198,721],{"class":730},[657,1200,742],{"class":667},[657,1202,1203],{"class":695},"abort",[657,1205,742],{"class":667},[657,1207,675],{"class":667},[657,1209,1210],{"class":667}," ()",[657,1212,1028],{"class":1009},[657,1214,1215],{"class":718}," resolve",[657,1217,1218],{"class":730},"()",[657,1220,675],{"class":667},[657,1222,668],{"class":667},[657,1224,1225],{"class":730}," once",[657,1227,734],{"class":667},[657,1229,1231],{"class":1230},"sfNiH"," true",[657,1233,686],{"class":667},[657,1235,1154],{"class":730},[657,1237,1239,1241,1243,1245,1248],{"class":659,"line":1238},26,[657,1240,1166],{"class":663},[657,1242,1074],{"class":671},[657,1244,1105],{"class":667},[657,1246,1247],{"class":718},"close",[657,1249,1250],{"class":730},"()\n",[657,1252,1254],{"class":659,"line":1253},27,[657,1255,952],{"class":667},[657,1257,1259],{"class":659,"line":1258},28,[657,1260,958],{"class":667},[657,1262,1264],{"class":659,"line":1263},29,[657,1265,1266],{"class":671},"  ]\n",[657,1268,1270,1273],{"class":659,"line":1269},30,[657,1271,1272],{"class":667},"}",[657,1274,1066],{"class":671},[1276,1277,1278,1291,1311,1432,1450],"ul",{},[1279,1280,1281,1286,1287,1290],"li",{},[623,1282,1283],{},[636,1284,1285],{},"run(ctx, signal)"," runs until ",[636,1288,1289],{},"signal"," aborts, then returns within its stop timeout. Returning or throwing before\nthat is a crash: SHADE starts it again with backoff.",[1279,1292,1293,1298,1299,1302,1303,1306,1307,1310],{},[623,1294,1295,1297],{},[636,1296,1017],{}," is the module's own actor",", as in a schedule: it may do what the manifest's ",[636,1300,1301],{},"uses"," lists and nothing more,\nand read its own settings and kv. A singleton's context also has ",[636,1304,1305],{},"ctx.leaseToken",", which grows with\nevery new holder, also across a Redis restart: store it beside writes that must not race a takeover (as a ",[636,1308,1309],{},"bigint",":\nit has about 16 digits), and refuse a lower one.",[1279,1312,1313,1013,1316,1319,1320],{},[623,1314,1315],{},"The parameters",[636,1317,1318],{},"ProcessParams","):",[1321,1322,1323,1342],"table",{},[1324,1325,1326],"thead",{},[1327,1328,1329,1333,1336,1339],"tr",{},[1330,1331,1332],"th",{},"Parameter",[1330,1334,1335],{},"Values",[1330,1337,1338],{},"Default",[1330,1340,1341],{},"What it does",[1343,1344,1345,1372,1396,1416],"tbody",{},[1327,1346,1347,1353,1361,1364],{},[1348,1349,1350],"td",{},[636,1351,1352],{},"mode",[1348,1354,1355,1357,1358],{},[636,1356,910],{},", ",[636,1359,1360],{},"per-instance",[1348,1362,1363],{},"(required)",[1348,1365,1366,1368,1369,1371],{},[636,1367,910],{},": one copy per instance, on whichever worker holds its lease. ",[636,1370,1360],{},": one on every worker.",[1327,1373,1374,1379,1382,1385],{},[1348,1375,1376],{},[636,1377,1378],{},"memoryMb",[1348,1380,1381],{},"64–256",[1348,1383,1384],{},"64",[1348,1386,1387,1388,1391,1392,646],{},"The thread's V8 heap (",[636,1389,1390],{},"resourceLimits.maxOldGenerationSizeMb","). Less than 64 is refused (see ",[1393,1394,1395],"em",{},"Memory",[1327,1397,1398,1403,1406,1409],{},[1348,1399,1400],{},[636,1401,1402],{},"stopTimeoutMs",[1348,1404,1405],{},"1000–30000",[1348,1407,1408],{},"10000",[1348,1410,1411,1412,1415],{},"How long a stop waits for ",[636,1413,1414],{},"run"," to return before the thread is terminated.",[1327,1417,1418,1423,1426,1429],{},[1348,1419,1420],{},[636,1421,1422],{},"maxRestarts",[1348,1424,1425],{},"1–50",[1348,1427,1428],{},"10",[1348,1430,1431],{},"Crashes in a row before the process is marked failed.",[1279,1433,1434,1437,1438,1441,1442,1445,1446,1449],{},[623,1435,1436],{},"Checked when the module loads."," Each process is ",[636,1439,1440],{},"{ name, run }"," with a short name, once, and has its parameters\nin ",[636,1443,1444],{},"capabilities.process.processes",", which names no process the manifest doesn't have. ",[636,1447,1448],{},"shade-module build"," refuses a\nmanifest whose processes the declaration doesn't name, and writes the declaration into the package; the worker runs\neach process with the parameters of that signed declaration. The consent shows each process with its mode, memory\nand restarts; an update that adds a process, raises its memory or restarts, or turns a singleton into a process on\nevery worker asks again.",[1279,1451,1452,1454,1455,1457,1458,1460],{},[623,1453,337],{},": a sandbox package that requires ",[636,1456,625],{}," is refused at install (\"readme-cards requires the\nprocess capability, which needs a trusted module\"); an optional one is skipped, and its routes still work. An\nuntrusted module can't have ",[636,1459,638],{}," at all.",[1462,1463,1395],"h3",{"id":1464},"memory",[619,1466,1467,1468,1470,1471,1473,1474,1477,1478,1480],{},"A process's thread loads SHADE's server code before the module's own: about 30 MB of its heap. So\n",[636,1469,1378],{}," is at least 64, and 64 when the declaration gives none: a declaration\nbelow it is refused when the module loads and at build (\"memoryMb must be at least 64 MB: a process's thread needs\nabout 30 MB for SHADE's own code before the module's\"). A process that still runs out of its heap stops with \"The\nprocess ran out of memory (its limit is 64 MB)\" and is restarted like any crash. ",[636,1472,1378],{}," caps\nthe V8 heap only, not ArrayBuffers or native memory. The worker's budget, ",[636,1475,1476],{},"SHADE_PROCESSES_MEMORY_MB"," (192 by default),\nis the sum of the ",[636,1479,1378],{}," of the processes it runs at once.",[1462,1482,1484],{"id":1483},"testing-a-process","Testing a process",[619,1486,1487,1488,1491],{},"The testing entry runs one process once, as the worker would: as the module's own actor, with a signal that aborts after\n",[636,1489,1490],{},"forMs",", then its stop timeout.",[648,1493,1495],{"className":650,"code":1494,"language":652,"meta":653,"style":653},"import { runProcessOnce } from '@shadestack\u002Fmodule-sdk\u002Ftesting'\n\nconst result = await runProcessOnce(ctx, plugin, 'presence', { forMs: 1_000 })\nexpect(result).toEqual({ ended: 'stopped' })   \u002F\u002F or 'ended', 'threw' (with error), 'timeout'\n",[636,1496,1497,1517,1521,1568],{"__ignoreMap":653},[657,1498,1499,1501,1503,1506,1508,1510,1512,1515],{"class":659,"line":660},[657,1500,664],{"class":663},[657,1502,668],{"class":667},[657,1504,1505],{"class":671}," runProcessOnce",[657,1507,686],{"class":667},[657,1509,689],{"class":663},[657,1511,692],{"class":667},[657,1513,1514],{"class":695},"@shadestack\u002Fmodule-sdk\u002Ftesting",[657,1516,699],{"class":667},[657,1518,1519],{"class":659,"line":702},[657,1520,706],{"emptyLinePlaceholder":705},[657,1522,1523,1526,1529,1532,1534,1536,1539,1541,1544,1546,1548,1550,1552,1554,1556,1559,1561,1564,1566],{"class":659,"line":709},[657,1524,1525],{"class":1009},"const",[657,1527,1528],{"class":671}," result ",[657,1530,1531],{"class":667},"=",[657,1533,1049],{"class":663},[657,1535,1505],{"class":718},[657,1537,1538],{"class":671},"(ctx",[657,1540,675],{"class":667},[657,1542,1543],{"class":671}," plugin",[657,1545,675],{"class":667},[657,1547,692],{"class":667},[657,1549,994],{"class":695},[657,1551,742],{"class":667},[657,1553,675],{"class":667},[657,1555,668],{"class":667},[657,1557,1558],{"class":730}," forMs",[657,1560,734],{"class":667},[657,1562,1563],{"class":922}," 1_000",[657,1565,686],{"class":667},[657,1567,1066],{"class":671},[657,1569,1570,1573,1576,1578,1581,1583,1586,1589,1591,1593,1596,1598,1600,1603],{"class":659,"line":727},[657,1571,1572],{"class":718},"expect",[657,1574,1575],{"class":671},"(result)",[657,1577,1105],{"class":667},[657,1579,1580],{"class":718},"toEqual",[657,1582,721],{"class":671},[657,1584,1585],{"class":667},"{",[657,1587,1588],{"class":730}," ended",[657,1590,734],{"class":667},[657,1592,692],{"class":667},[657,1594,1595],{"class":695},"stopped",[657,1597,742],{"class":667},[657,1599,686],{"class":667},[657,1601,1602],{"class":671},")   ",[657,1604,1605],{"class":879},"\u002F\u002F or 'ended', 'threw' (with error), 'timeout'\n",[628,1607,1609],{"id":1608},"long-lived-connections","Long-lived connections",[619,1611,1612,1613,1616,1617,1620,1621,1624,1625,1628,1629,1632,1633,1635,1636,1639,1640,1642,1643,1646],{},"A process can hold a connection open: a broker or device feed over WebSocket, an exchange's price stream, a chat\nservice, an event stream (",[636,1614,1615],{},"text\u002Fevent-stream",") that runs for hours. They don't fit ",[636,1618,1619],{},"moduleFetch",", which answers in 10\nseconds with at most 5 MB. A trusted module opens them through ",[636,1622,1623],{},"ctx.connections",", under the ",[636,1626,1627],{},"streams"," of its ",[636,1630,1631],{},"network","\ncapability (",[644,1634,389],{"href":390},"), with the address rules of ",[644,1637,1638],{"href":414},"Network",": a stream does not pass by the\ngate that every other call out of SHADE passes. Only a process's ",[636,1641,1017],{}," has ",[636,1644,1645],{},"connections","; routes, schedules, thread\ntasks and the sandbox don't, and an untrusted module keeps request-and-answer calls only.",[648,1648,1650],{"className":650,"code":1649,"language":652,"meta":653,"style":653},"export default defineModule({\n  name: 'prices',\n  \u002F\u002F …\n  capabilities: {\n    process: { processes: { feed: { mode: 'singleton' } } },\n    network: { streams: ['wss:\u002F\u002Fstream.exchange.example', 'https:\u002F\u002Fevents.exchange.example'] }\n  },\n  processes: [\n    {\n      name: 'feed',\n      run: async (ctx, signal) => {\n        const feed = await ctx.connections!.open('wss:\u002F\u002Fstream.exchange.example\u002Fv1', {\n          headers: { authorization: `Bearer ${await apiKey(ctx)}` },\n          open: () => void feed.send(JSON.stringify({ subscribe: 'eur-usd' })),\n          message: async message => void await moduleKv(ctx).set('eur-usd', JSON.parse(String(message))),\n          closed: ({ reason, willReconnect }) => ctx.log.info('the feed closed', { reason, willReconnect }),\n          failed: ({ error }) => ctx.log.warn('the feed could not connect', { error })\n        })\n        await new Promise\u003Cvoid>(resolve => signal.addEventListener('abort', () => resolve(), { once: true }))\n        await feed.close()\n      }\n    }\n  ]\n})\n",[636,1651,1652,1664,1679,1684,1692,1730,1769,1773,1781,1785,1800,1822,1858,1895,1948,2011,2071,2117,2124,2182,2194,2198,2202,2206],{"__ignoreMap":653},[657,1653,1654,1656,1658,1660,1662],{"class":659,"line":660},[657,1655,712],{"class":663},[657,1657,715],{"class":663},[657,1659,672],{"class":718},[657,1661,721],{"class":671},[657,1663,724],{"class":667},[657,1665,1666,1668,1670,1672,1675,1677],{"class":659,"line":702},[657,1667,731],{"class":730},[657,1669,734],{"class":667},[657,1671,692],{"class":667},[657,1673,1674],{"class":695},"prices",[657,1676,742],{"class":667},[657,1678,745],{"class":667},[657,1680,1681],{"class":659,"line":709},[657,1682,1683],{"class":879},"  \u002F\u002F …\n",[657,1685,1686,1688,1690],{"class":659,"line":727},[657,1687,785],{"class":730},[657,1689,734],{"class":667},[657,1691,790],{"class":667},[657,1693,1694,1696,1698,1700,1703,1705,1707,1710,1712,1714,1716,1718,1720,1722,1724,1726,1728],{"class":659,"line":748},[657,1695,855],{"class":730},[657,1697,734],{"class":667},[657,1699,668],{"class":667},[657,1701,1702],{"class":730}," processes",[657,1704,734],{"class":667},[657,1706,668],{"class":667},[657,1708,1709],{"class":730}," feed",[657,1711,734],{"class":667},[657,1713,668],{"class":667},[657,1715,903],{"class":730},[657,1717,734],{"class":667},[657,1719,692],{"class":667},[657,1721,910],{"class":695},[657,1723,742],{"class":667},[657,1725,686],{"class":667},[657,1727,686],{"class":667},[657,1729,849],{"class":667},[657,1731,1732,1735,1737,1739,1742,1744,1747,1749,1752,1754,1756,1758,1761,1763,1766],{"class":659,"line":765},[657,1733,1734],{"class":730},"    network",[657,1736,734],{"class":667},[657,1738,668],{"class":667},[657,1740,1741],{"class":730}," streams",[657,1743,734],{"class":667},[657,1745,1746],{"class":671}," [",[657,1748,742],{"class":667},[657,1750,1751],{"class":695},"wss:\u002F\u002Fstream.exchange.example",[657,1753,742],{"class":667},[657,1755,675],{"class":667},[657,1757,692],{"class":667},[657,1759,1760],{"class":695},"https:\u002F\u002Fevents.exchange.example",[657,1762,742],{"class":667},[657,1764,1765],{"class":671},"] ",[657,1767,1768],{"class":667},"}\n",[657,1770,1771],{"class":659,"line":782},[657,1772,964],{"class":667},[657,1774,1775,1777,1779],{"class":659,"line":793},[657,1776,970],{"class":730},[657,1778,734],{"class":667},[657,1780,975],{"class":671},[657,1782,1783],{"class":659,"line":804},[657,1784,981],{"class":667},[657,1786,1787,1789,1791,1793,1796,1798],{"class":659,"line":852},[657,1788,987],{"class":730},[657,1790,734],{"class":667},[657,1792,692],{"class":667},[657,1794,1795],{"class":695},"feed",[657,1797,742],{"class":667},[657,1799,745],{"class":667},[657,1801,1802,1804,1806,1808,1810,1812,1814,1816,1818,1820],{"class":659,"line":862},[657,1803,1004],{"class":718},[657,1805,734],{"class":667},[657,1807,1010],{"class":1009},[657,1809,1013],{"class":667},[657,1811,1017],{"class":1016},[657,1813,675],{"class":667},[657,1815,1022],{"class":1016},[657,1817,1025],{"class":667},[657,1819,1028],{"class":1009},[657,1821,790],{"class":667},[657,1823,1824,1826,1828,1830,1832,1835,1837,1839,1842,1845,1847,1849,1852,1854,1856],{"class":659,"line":883},[657,1825,1036],{"class":1009},[657,1827,1709],{"class":671},[657,1829,1046],{"class":667},[657,1831,1049],{"class":663},[657,1833,1834],{"class":671}," ctx",[657,1836,1105],{"class":667},[657,1838,1645],{"class":671},[657,1840,1841],{"class":667},"!.",[657,1843,1844],{"class":718},"open",[657,1846,721],{"class":730},[657,1848,742],{"class":667},[657,1850,1851],{"class":695},"wss:\u002F\u002Fstream.exchange.example\u002Fv1",[657,1853,742],{"class":667},[657,1855,675],{"class":667},[657,1857,790],{"class":667},[657,1859,1860,1863,1865,1867,1870,1872,1875,1878,1881,1884,1887,1890,1893],{"class":659,"line":893},[657,1861,1862],{"class":730},"          headers",[657,1864,734],{"class":667},[657,1866,668],{"class":667},[657,1868,1869],{"class":730}," authorization",[657,1871,734],{"class":667},[657,1873,1874],{"class":667}," `",[657,1876,1877],{"class":695},"Bearer ",[657,1879,1880],{"class":667},"${",[657,1882,1883],{"class":663},"await",[657,1885,1886],{"class":718}," apiKey",[657,1888,1889],{"class":671},"(ctx)",[657,1891,1892],{"class":667},"}`",[657,1894,849],{"class":667},[657,1896,1897,1900,1902,1904,1906,1908,1910,1912,1915,1917,1920,1922,1925,1927,1929,1932,1934,1936,1939,1941,1943,1946],{"class":659,"line":949},[657,1898,1899],{"class":718},"          open",[657,1901,734],{"class":667},[657,1903,1210],{"class":667},[657,1905,1028],{"class":1009},[657,1907,1126],{"class":667},[657,1909,1709],{"class":671},[657,1911,1105],{"class":667},[657,1913,1914],{"class":718},"send",[657,1916,721],{"class":730},[657,1918,1919],{"class":671},"JSON",[657,1921,1105],{"class":667},[657,1923,1924],{"class":718},"stringify",[657,1926,721],{"class":730},[657,1928,1585],{"class":667},[657,1930,1931],{"class":730}," subscribe",[657,1933,734],{"class":667},[657,1935,692],{"class":667},[657,1937,1938],{"class":695},"eur-usd",[657,1940,742],{"class":667},[657,1942,686],{"class":667},[657,1944,1945],{"class":730},"))",[657,1947,745],{"class":667},[657,1949,1950,1953,1955,1957,1960,1962,1964,1966,1968,1970,1972,1974,1976,1978,1980,1982,1984,1986,1988,1991,1993,1996,1998,2001,2003,2006,2009],{"class":659,"line":955},[657,1951,1952],{"class":718},"          message",[657,1954,734],{"class":667},[657,1956,1010],{"class":1009},[657,1958,1959],{"class":1016}," message",[657,1961,1028],{"class":1009},[657,1963,1126],{"class":667},[657,1965,1049],{"class":663},[657,1967,683],{"class":718},[657,1969,721],{"class":730},[657,1971,1017],{"class":671},[657,1973,1025],{"class":730},[657,1975,1105],{"class":667},[657,1977,1139],{"class":718},[657,1979,721],{"class":730},[657,1981,742],{"class":667},[657,1983,1938],{"class":695},[657,1985,742],{"class":667},[657,1987,675],{"class":667},[657,1989,1990],{"class":671}," JSON",[657,1992,1105],{"class":667},[657,1994,1995],{"class":718},"parse",[657,1997,721],{"class":730},[657,1999,2000],{"class":718},"String",[657,2002,721],{"class":730},[657,2004,2005],{"class":671},"message",[657,2007,2008],{"class":730},")))",[657,2010,745],{"class":667},[657,2012,2013,2016,2018,2021,2024,2026,2029,2032,2034,2036,2038,2041,2043,2046,2048,2050,2053,2055,2057,2059,2061,2063,2065,2067,2069],{"class":659,"line":961},[657,2014,2015],{"class":718},"          closed",[657,2017,734],{"class":667},[657,2019,2020],{"class":667}," ({",[657,2022,2023],{"class":1016}," reason",[657,2025,675],{"class":667},[657,2027,2028],{"class":1016}," willReconnect",[657,2030,2031],{"class":667}," })",[657,2033,1028],{"class":1009},[657,2035,1834],{"class":671},[657,2037,1105],{"class":667},[657,2039,2040],{"class":671},"log",[657,2042,1105],{"class":667},[657,2044,2045],{"class":718},"info",[657,2047,721],{"class":730},[657,2049,742],{"class":667},[657,2051,2052],{"class":695},"the feed closed",[657,2054,742],{"class":667},[657,2056,675],{"class":667},[657,2058,668],{"class":667},[657,2060,2023],{"class":671},[657,2062,675],{"class":667},[657,2064,2028],{"class":671},[657,2066,686],{"class":667},[657,2068,1025],{"class":730},[657,2070,745],{"class":667},[657,2072,2073,2076,2078,2080,2083,2085,2087,2089,2091,2093,2095,2098,2100,2102,2105,2107,2109,2111,2113,2115],{"class":659,"line":967},[657,2074,2075],{"class":718},"          failed",[657,2077,734],{"class":667},[657,2079,2020],{"class":667},[657,2081,2082],{"class":1016}," error",[657,2084,2031],{"class":667},[657,2086,1028],{"class":1009},[657,2088,1834],{"class":671},[657,2090,1105],{"class":667},[657,2092,2040],{"class":671},[657,2094,1105],{"class":667},[657,2096,2097],{"class":718},"warn",[657,2099,721],{"class":730},[657,2101,742],{"class":667},[657,2103,2104],{"class":695},"the feed could not connect",[657,2106,742],{"class":667},[657,2108,675],{"class":667},[657,2110,668],{"class":667},[657,2112,2082],{"class":671},[657,2114,686],{"class":667},[657,2116,1066],{"class":730},[657,2118,2119,2122],{"class":659,"line":978},[657,2120,2121],{"class":667},"        }",[657,2123,1066],{"class":730},[657,2125,2126,2128,2130,2132,2134,2136,2138,2140,2142,2144,2146,2148,2150,2152,2154,2156,2158,2160,2162,2164,2166,2168,2170,2172,2174,2176,2178,2180],{"class":659,"line":984},[657,2127,1166],{"class":663},[657,2129,1169],{"class":667},[657,2131,1173],{"class":1172},[657,2133,1176],{"class":667},[657,2135,1179],{"class":1172},[657,2137,1182],{"class":667},[657,2139,721],{"class":730},[657,2141,1187],{"class":1016},[657,2143,1028],{"class":1009},[657,2145,1022],{"class":671},[657,2147,1105],{"class":667},[657,2149,1196],{"class":718},[657,2151,721],{"class":730},[657,2153,742],{"class":667},[657,2155,1203],{"class":695},[657,2157,742],{"class":667},[657,2159,675],{"class":667},[657,2161,1210],{"class":667},[657,2163,1028],{"class":1009},[657,2165,1215],{"class":718},[657,2167,1218],{"class":730},[657,2169,675],{"class":667},[657,2171,668],{"class":667},[657,2173,1225],{"class":730},[657,2175,734],{"class":667},[657,2177,1231],{"class":1230},[657,2179,686],{"class":667},[657,2181,1154],{"class":730},[657,2183,2184,2186,2188,2190,2192],{"class":659,"line":1001},[657,2185,1166],{"class":663},[657,2187,1709],{"class":671},[657,2189,1105],{"class":667},[657,2191,1247],{"class":718},[657,2193,1250],{"class":730},[657,2195,2196],{"class":659,"line":1033},[657,2197,952],{"class":667},[657,2199,2200],{"class":659,"line":1069},[657,2201,958],{"class":667},[657,2203,2204],{"class":659,"line":1099},[657,2205,1266],{"class":671},[657,2207,2208,2210],{"class":659,"line":1157},[657,2209,1272],{"class":667},[657,2211,1066],{"class":671},[1276,2213,2214,2248,2260,2318,2330,2343,2352],{},[1279,2215,2216,2219,2220,2223,2224,2227,2228,2231,2232,2235,2236,2239,2240,2243,2244,2247],{},[623,2217,2218],{},"Declared streams."," ",[636,2221,2222],{},"network.streams"," lists each host with its protocol: ",[636,2225,2226],{},"wss:\u002F\u002Fhost"," for a WebSocket,\n",[636,2229,2230],{},"https:\u002F\u002Fhost"," for a stream (a long response read as it comes). ",[636,2233,2234],{},"*.example.com"," covers the names under it. Only the\ndefault port, and no IP addresses or local names. Each is a ",[636,2237,2238],{},"stream …"," line on the consent screen and the Modules page, and a\nnew one asks again. ",[636,2241,2242],{},"ws:\u002F\u002F"," and ",[636,2245,2246],{},"http:\u002F\u002F"," do not exist here.",[1279,2249,2250,2255,2256,2259],{},[623,2251,2252],{},[636,2253,2254],{},"open(url, options)"," resolves as the first attempt starts, and refuses at once (FORBIDDEN, counted for the module)\nan address the capability does not name, an address that points into the server's own network, a name with a user name\nor password, and a ninth connection. It never follows a redirect: a WebSocket upgrade or a stream answered with one is\nrefused, so the ",[636,2257,2258],{},"headers"," you give (an authorization header) only ever reach the origin they were given for.",[1279,2261,2262,2219,2265,2267,2268,2270,2271,1013,2274,2277,2278,1357,2281,1357,2283,1357,2286,1357,2289,2292,2293,1357,2296,1357,2298,2301,2302,1013,2305,1357,2308,2310,2311,2313,2314,2317],{},[623,2263,2264],{},"The handlers.",[636,2266,1844],{}," (the first time and after each reconnect), ",[636,2269,2005],{}," (a WebSocket's text as a string and its\nbinary as bytes; a stream's chunk as bytes), ",[636,2272,2273],{},"closed",[636,2275,2276],{},"reason",": ",[636,2279,2280],{},"server",[636,2282,2273],{},[636,2284,2285],{},"idle",[636,2287,2288],{},"too-large",[636,2290,2291],{},"too-slow"," or\n",[636,2294,2295],{},"protocol",[636,2297,636],{},[636,2299,2300],{},"willReconnect",") and ",[636,2303,2304],{},"failed",[636,2306,2307],{},"error",[636,2309,2300],{},"). ",[636,2312,2005],{}," gets one message at a time, in\norder: the next waits until it returns. A handler that throws is logged under the module and the connection goes on.\n",[636,2315,2316],{},"connection.send(data)"," (WebSocket only) returns false when the connection is not open.",[1279,2319,2320,2323,2324,2326,2327,2329],{},[623,2321,2322],{},"Limits",", set by SHADE: a message or chunk of at most 1 MB; a process that falls a megabyte behind for 10 seconds\nhas the connection closed (",[636,2325,2291],{},"); 2 minutes without data close it (",[636,2328,2285],{},"; SHADE pings a WebSocket every 30\nseconds, so a quiet but healthy one stays open); at most 8 open per module on a worker.",[1279,2331,2332,2335,2336,2338,2339,2342],{},[623,2333,2334],{},"Reconnecting is SHADE's."," A dropped connection is opened again with the backoff of a crashed process (1 second\ndoubling to 5 minutes, plus jitter), the capability and the address checked again at each attempt; one that held for a\nminute starts from the beginning. If the rules no longer allow it (the capability or the host was withdrawn) it stops,\nand ",[636,2337,2304],{}," says ",[636,2340,2341],{},"willReconnect: false",". Each connection's state (connecting, open, reconnecting, closed, refused)\nshows on the Modules page under its process, with the scheme and host only: the path and query can hold a token.",[1279,2344,2345,2348,2349,2351],{},[623,2346,2347],{},"Stopping."," When the process's ",[636,2350,1289],{}," aborts, SHADE closes every connection (a close frame, then the socket) and\nrefuses new ones, so the process has its whole stop timeout to end.",[1279,2353,2354,2357,2358,1105],{},[623,2355,2356],{},"Not covered."," Raw TCP, SMTP, FTP and database protocols stay out. A client program on shade-programs can hold a\nlong-lived connection over port 443 in a language of its own, and a trusted module reaches it with ",[636,2359,2360],{},"callProgram",[619,2362,2363,2364,2367,2368,2370,2371,2374],{},"In tests, ",[636,2365,2366],{},"runProcessOnce"," gives the process the same ",[636,2369,1623],{}," (streams only: the WebSocket client is the API's), and ",[636,2372,2373],{},"stubModuleNetwork({ resolve, dial, ca })","\n(the testing entry) puts a local server in place of the internet.",[1462,2376,2378],{"id":2377},"a-standard-socket","A standard socket",[619,2380,2381,2382,2385,2386,2388,2389,2392,2393,1357,2396,1357,2398,1357,2401,745,2404,1357,2407,1357,2410,1357,2413,2243,2416,1105],{},"Libraries that speak a protocol over WebSocket (a gateway client, a message broker's) expect the standard ",[636,2383,2384],{},"WebSocket",", not\n",[636,2387,1623],{},". ",[636,2390,2391],{},"moduleSocket(ctx, url, options)"," gives them one. It is the same connection, with the same\ndeclaration, address checks and limits, in the shape of the standard: ",[636,2394,2395],{},"readyState",[636,2397,1914],{},[636,2399,2400],{},"close(code)",[636,2402,2403],{},"binaryType",[636,2405,2406],{},"onopen",[636,2408,2409],{},"onmessage",[636,2411,2412],{},"onerror",[636,2414,2415],{},"onclose",[636,2417,1196],{},[648,2419,2421],{"className":650,"code":2420,"language":652,"meta":653,"style":653},"import { moduleSocket } from '@shadestack\u002Fmodule-sdk\u002Fserver'\n\nrun: async (ctx, signal) => {\n  const socket = await moduleSocket(ctx, 'wss:\u002F\u002Fgateway.example.com\u002F?v=10')\n  socket.binaryType = 'arraybuffer'\n  socket.onmessage = event => handle(event.data)\n  socket.onclose = event => ctx.log.info('closed', { code: event.code })\n  signal.addEventListener('abort', () => socket.close(), { once: true })\n}\n",[636,2422,2423,2442,2446,2468,2496,2514,2544,2595,2640],{"__ignoreMap":653},[657,2424,2425,2427,2429,2432,2434,2436,2438,2440],{"class":659,"line":660},[657,2426,664],{"class":663},[657,2428,668],{"class":667},[657,2430,2431],{"class":671}," moduleSocket",[657,2433,686],{"class":667},[657,2435,689],{"class":663},[657,2437,692],{"class":667},[657,2439,696],{"class":695},[657,2441,699],{"class":667},[657,2443,2444],{"class":659,"line":702},[657,2445,706],{"emptyLinePlaceholder":705},[657,2447,2448,2450,2452,2454,2456,2458,2460,2462,2464,2466],{"class":659,"line":709},[657,2449,1414],{"class":1172},[657,2451,734],{"class":667},[657,2453,1010],{"class":1009},[657,2455,1013],{"class":667},[657,2457,1017],{"class":1016},[657,2459,675],{"class":667},[657,2461,1022],{"class":1016},[657,2463,1025],{"class":667},[657,2465,1028],{"class":1009},[657,2467,790],{"class":667},[657,2469,2470,2473,2475,2477,2479,2481,2483,2485,2487,2489,2492,2494],{"class":659,"line":727},[657,2471,2472],{"class":1009},"  const",[657,2474,1074],{"class":671},[657,2476,1046],{"class":667},[657,2478,1049],{"class":663},[657,2480,2431],{"class":718},[657,2482,721],{"class":730},[657,2484,1017],{"class":671},[657,2486,675],{"class":667},[657,2488,692],{"class":667},[657,2490,2491],{"class":695},"wss:\u002F\u002Fgateway.example.com\u002F?v=10",[657,2493,742],{"class":667},[657,2495,1066],{"class":730},[657,2497,2498,2501,2503,2505,2507,2509,2512],{"class":659,"line":748},[657,2499,2500],{"class":671},"  socket",[657,2502,1105],{"class":667},[657,2504,2403],{"class":671},[657,2506,1046],{"class":667},[657,2508,692],{"class":667},[657,2510,2511],{"class":695},"arraybuffer",[657,2513,699],{"class":667},[657,2515,2516,2518,2520,2522,2524,2527,2529,2532,2534,2537,2539,2542],{"class":659,"line":765},[657,2517,2500],{"class":671},[657,2519,1105],{"class":667},[657,2521,2409],{"class":718},[657,2523,1046],{"class":667},[657,2525,2526],{"class":1016}," event",[657,2528,1028],{"class":1009},[657,2530,2531],{"class":718}," handle",[657,2533,721],{"class":730},[657,2535,2536],{"class":671},"event",[657,2538,1105],{"class":667},[657,2540,2541],{"class":671},"data",[657,2543,1066],{"class":730},[657,2545,2546,2548,2550,2552,2554,2556,2558,2560,2562,2564,2566,2568,2570,2572,2574,2576,2578,2580,2583,2585,2587,2589,2591,2593],{"class":659,"line":782},[657,2547,2500],{"class":671},[657,2549,1105],{"class":667},[657,2551,2415],{"class":718},[657,2553,1046],{"class":667},[657,2555,2526],{"class":1016},[657,2557,1028],{"class":1009},[657,2559,1834],{"class":671},[657,2561,1105],{"class":667},[657,2563,2040],{"class":671},[657,2565,1105],{"class":667},[657,2567,2045],{"class":718},[657,2569,721],{"class":730},[657,2571,742],{"class":667},[657,2573,2273],{"class":695},[657,2575,742],{"class":667},[657,2577,675],{"class":667},[657,2579,668],{"class":667},[657,2581,2582],{"class":730}," code",[657,2584,734],{"class":667},[657,2586,2526],{"class":671},[657,2588,1105],{"class":667},[657,2590,636],{"class":671},[657,2592,686],{"class":667},[657,2594,1066],{"class":730},[657,2596,2597,2600,2602,2604,2606,2608,2610,2612,2614,2616,2618,2620,2622,2624,2626,2628,2630,2632,2634,2636,2638],{"class":659,"line":793},[657,2598,2599],{"class":671},"  signal",[657,2601,1105],{"class":667},[657,2603,1196],{"class":718},[657,2605,721],{"class":730},[657,2607,742],{"class":667},[657,2609,1203],{"class":695},[657,2611,742],{"class":667},[657,2613,675],{"class":667},[657,2615,1210],{"class":667},[657,2617,1028],{"class":1009},[657,2619,1074],{"class":671},[657,2621,1105],{"class":667},[657,2623,1247],{"class":718},[657,2625,1218],{"class":730},[657,2627,675],{"class":667},[657,2629,668],{"class":667},[657,2631,1225],{"class":730},[657,2633,734],{"class":667},[657,2635,1231],{"class":1230},[657,2637,686],{"class":667},[657,2639,1066],{"class":730},[657,2641,2642],{"class":659,"line":804},[657,2643,1768],{"class":667},[1276,2645,2646,2659,2678,2684],{},[1279,2647,2648,2651,2652,2655,2656,2658],{},[623,2649,2650],{},"It does not reconnect."," A dropped socket ends with a close event, and the code that wants another calls\n",[636,2653,2654],{},"moduleSocket"," again, which checks the rules again. A failed attempt is an ",[636,2657,2307],{}," event and a close event with code\n1006, as in a browser.",[1279,2660,2661,2664,2665,2667,2668,2670,2671,2674,2675,646],{},[623,2662,2663],{},"Refusals throw before a socket exists",": a host the ",[636,2666,1627],{}," do not name, ",[636,2669,2242],{},", another port, an address inside\nthe network (FORBIDDEN, counted for the module), a module that already holds as many connections as it may, and a module\nover its limit for the host (",[636,2672,2673],{},"OutboundFailure"," with reason ",[636,2676,2677],{},"throttled",[1279,2679,2680,2683],{},[623,2681,2682],{},"Every attempt counts"," against the module's 120 calls a minute to the host, the first and each reconnect, so a loop\nthat keeps reconnecting is refused at once and nothing is sent.",[1279,2685,2686,2689],{},[623,2687,2688],{},"The close code"," is yours: 1000, or 3000 to 4999. Some services keep a session open for resuming after any other\ncode than 1000.",[619,2691,2692],{},"Experimental until a second module uses sockets.",[628,2694,2696],{"id":2695},"how-shade-runs-them","How SHADE runs them",[619,2698,2699,2700,1013,2703,2706],{},"The kernel's ",[636,2701,2702],{},"ProcessSupervisor",[636,2704,2705],{},"shade\u002Fkernel\u002Fprocesses\u002Fsupervisor.ts",") runs the processes of one worker. Per module,\nprocess and worker:",[648,2708,2712],{"className":2709,"code":2710,"language":2711,"meta":653,"style":653},"language-mermaid shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","stateDiagram-v2\n  accTitle: The states of a process\n  accDescr: A process starts stopped. Once wanted it is starting, and on 'ready' or a heartbeat it is running. On an exit, a throw, a return or no heartbeat for 15 seconds, a starting or running process goes to backoff and its restarts go up by one. When the wait is over, backoff goes to starting; when restarts exceed maxRestarts it goes to failed, until an admin's Restart, a switch on, or an update. After 10 minutes running, its restarts go back to 0. From any state, when it is no longer wanted or the lease is lost, it goes to stopping and then stopped. A singleton whose lease another worker holds stays stopped, shown as standby on that worker, and tries again every 10 seconds.\n  [*] --> stopped\n  stopped --> starting: wanted\n  starting --> running: 'ready' or a heartbeat\n  starting --> backoff: exit, throw, return, no heartbeat for 15 s (restarts + 1)\n  running --> backoff: exit, throw, return, no heartbeat for 15 s (restarts + 1)\n  backoff --> starting: the wait is over\n  backoff --> failed: restarts #gt; maxRestarts\n  running --> running: 10 minutes (restarts back to 0)\n  any --> stopping: no longer wanted, or the lease lost\n  stopping --> stopped\n  state \"any state\" as any\n  note right of failed: until an admin's Restart, a switch on, or an update\n  note left of stopped: singleton, lease held by another worker - stopped, \"standby on #lt;worker#gt;\", tries again every 10 s\n","mermaid",[636,2713,2714,2719,2724,2729,2734,2739,2744,2749,2754,2759,2764,2769,2774,2779,2784,2789],{"__ignoreMap":653},[657,2715,2716],{"class":659,"line":660},[657,2717,2718],{},"stateDiagram-v2\n",[657,2720,2721],{"class":659,"line":702},[657,2722,2723],{},"  accTitle: The states of a process\n",[657,2725,2726],{"class":659,"line":709},[657,2727,2728],{},"  accDescr: A process starts stopped. Once wanted it is starting, and on 'ready' or a heartbeat it is running. On an exit, a throw, a return or no heartbeat for 15 seconds, a starting or running process goes to backoff and its restarts go up by one. When the wait is over, backoff goes to starting; when restarts exceed maxRestarts it goes to failed, until an admin's Restart, a switch on, or an update. After 10 minutes running, its restarts go back to 0. From any state, when it is no longer wanted or the lease is lost, it goes to stopping and then stopped. A singleton whose lease another worker holds stays stopped, shown as standby on that worker, and tries again every 10 seconds.\n",[657,2730,2731],{"class":659,"line":727},[657,2732,2733],{},"  [*] --> stopped\n",[657,2735,2736],{"class":659,"line":748},[657,2737,2738],{},"  stopped --> starting: wanted\n",[657,2740,2741],{"class":659,"line":765},[657,2742,2743],{},"  starting --> running: 'ready' or a heartbeat\n",[657,2745,2746],{"class":659,"line":782},[657,2747,2748],{},"  starting --> backoff: exit, throw, return, no heartbeat for 15 s (restarts + 1)\n",[657,2750,2751],{"class":659,"line":793},[657,2752,2753],{},"  running --> backoff: exit, throw, return, no heartbeat for 15 s (restarts + 1)\n",[657,2755,2756],{"class":659,"line":804},[657,2757,2758],{},"  backoff --> starting: the wait is over\n",[657,2760,2761],{"class":659,"line":852},[657,2762,2763],{},"  backoff --> failed: restarts #gt; maxRestarts\n",[657,2765,2766],{"class":659,"line":862},[657,2767,2768],{},"  running --> running: 10 minutes (restarts back to 0)\n",[657,2770,2771],{"class":659,"line":883},[657,2772,2773],{},"  any --> stopping: no longer wanted, or the lease lost\n",[657,2775,2776],{"class":659,"line":893},[657,2777,2778],{},"  stopping --> stopped\n",[657,2780,2781],{"class":659,"line":949},[657,2782,2783],{},"  state \"any state\" as any\n",[657,2785,2786],{"class":659,"line":955},[657,2787,2788],{},"  note right of failed: until an admin's Restart, a switch on, or an update\n",[657,2790,2791],{"class":659,"line":961},[657,2792,2793],{},"  note left of stopped: singleton, lease held by another worker - stopped, \"standby on #lt;worker#gt;\", tries again every 10 s\n",[1321,2795,2796,2806],{},[1324,2797,2798],{},[1327,2799,2800,2803],{},[1330,2801,2802],{},"What",[1330,2804,2805],{},"Number",[1343,2807,2808,2828,2840,2848,2856,2882,2898],{},[1327,2809,2810,2816],{},[1348,2811,2812,2813],{},"Backoff before restart ",[1393,2814,2815],{},"n",[1348,2817,2818,2821,2822,1357,2825,1025],{},[636,2819,2820],{},"min(1 s × 2^(n−1), 5 min)"," plus 0–20 % jitter: 1, 2, 4, 8, 16, 32, 64, 128, 256, then 300 s (",[636,2823,2824],{},"backoffDelay",[636,2826,2827],{},"shade\u002Fkernel\u002Fbackoff.ts",[1327,2829,2830,2835],{},[1348,2831,2832,2833],{},"Restarts before ",[636,2834,2304],{},[1348,2836,2837,2839],{},[636,2838,1422],{},", default 10",[1327,2841,2842,2845],{},[1348,2843,2844],{},"Stable",[1348,2846,2847],{},"after 10 minutes of running, its restarts go back to 0",[1327,2849,2850,2853],{},[1348,2851,2852],{},"Heartbeat",[1348,2854,2855],{},"every 5 s from the thread; none for 15 s (three missed) and the thread is terminated, a crash (\"The process stopped answering\")",[1327,2857,2858,2861],{},[1348,2859,2860],{},"Stop",[1348,2862,2863,2864,2867,2868,2870,2871,2873,2874,2877,2878,2881],{},"posts ",[636,2865,2866],{},"stop"," (the thread aborts ",[636,2869,1289],{},"), waits ",[636,2872,1402],{},", then ",[636,2875,2876],{},"terminate()","; the template's ",[636,2879,2880],{},"stop_grace_period"," is 40 s, above the longest stop timeout",[1327,2883,2884,2886],{},[1348,2885,1395],{},[1348,2887,2888,2889,2891,2892,2894,2895,2897],{},"a process whose ",[636,2890,1378],{}," exceeds what is left of ",[636,2893,1476],{}," is not started: ",[636,2896,2304],{},", \"No memory left on this worker: needs 64 MB, 32 MB free\"",[1327,2899,2900,2903],{},[1348,2901,2902],{},"Singleton lease",[1348,2904,2905,2908],{},[636,2906,2907],{},"process:\u003Cplugin>:\u003Cprocess>",", 30 s, renewed every 10 s; a lost renewal stops the process at once (at most one TTL of overlap); held through backoff, given up when it fails, stops or the worker stops",[1276,2910,2911,2926,2944,2950],{},[1279,2912,2913,1013,2916,1357,2919,2922,2923,2925],{},[623,2914,2915],{},"What should run",[636,2917,2918],{},"wantedProcesses",[636,2920,2921],{},"apps\u002Fapi\u002Fsrc\u002Fbootstrap\u002Fprocesses.ts","): the processes of the trusted modules\nthe worker loaded at start that are switched on, whose ",[636,2924,625],{}," capability is active, with the parameters of\ntheir signed (or loaded, for a development folder) declaration.",[1279,2927,2928,2931,2932,2935,2936,2940,2941,2943],{},[623,2929,2930],{},"Following changes."," The worker follows the ",[636,2933,2934],{},"plugins"," channel (",[644,2937,2939],{"href":2938},"\u002Fdevelopers\u002Fredis#messages-replacing-polling","Messages replacing\npolling","): a module switched on starts its processes, one switched off, or\nwhose optional ",[636,2942,625],{}," capability is switched off, stops them. The 60-second safety re-read catches a lost\nmessage. An update takes effect after the restart it needs: the worker stops every process gracefully and exits,\nand its host starts it again.",[1279,2945,2946,2949],{},[623,2947,2948],{},"Blue-green."," While an old and a new worker both run, the new one waits in standby until the old one gives the\nlease up on its graceful stop, or until the lease lapses when the old one died.",[1279,2951,2952,2955,2956,2959],{},[623,2953,2954],{},"Never outside the worker."," Only the worker container role (and ",[636,2957,2958],{},"all",": development and the small profile) starts the supervisor.",[1462,2961,2963],{"id":2962},"the-worker-thread","The worker thread",[619,2965,2966,2969,2970,2973,2974,1013,2977,2980,2981,2984,2985,2987,2988,2991,2992,2995],{},[636,2967,2968],{},"apps\u002Fapi\u002Fsrc\u002Fthreads\u002Fprocess-thread.ts",", built as ",[636,2971,2972],{},"dist\u002Fprocess-thread.mjs"," beside the server, is each process's thread.\n",[636,2975,2976],{},"nodeThreadFactory",[636,2978,2979],{},"apps\u002Fapi\u002Fsrc\u002Fthreads\u002Fthread-factory.ts",") starts it with ",[636,2982,2983],{},"new Worker(entry, { workerData, resourceLimits, env: {} })",": the heap is the process's ",[636,2986,1378],{},", the young generation at most 16 MB, the stack 4 MB, and the thread\ngets no environment. ",[636,2989,2990],{},"config.ts"," stays the only reader of the environment; the thread gets the worker's config values\nin ",[636,2993,2994],{},"workerData",", with a database pool of its own of 2 connections.",[619,2997,2998,2999,3001,3002,3005,3006,3009],{},"The thread registers the module module hooks (so a package's imports get the API's own SDK, zod and drizzle), imports\nthe process's module and the modules it requires from those the worker loaded, loads them as the worker did (actions,\nthe module actor's ",[636,3000,1301],{},", collections; no migrations), finds the process and runs it with a context made for\nthe module (",[636,3003,3004],{},"asModule","). It posts ",[636,3007,3008],{},"ready",", then a heartbeat every 5 seconds. A process that throws or returns on\nits own ends the thread with code 1 and its error; one that returns after the stop, with code 0. The events what a\nprocess does writes are delivered from the outbox like any other (decision 0014), to every module that hears them.",[1462,3011,3013],{"id":3012},"status","Status",[619,3015,3016,3017,3020,3021],{},"Each change is written to ",[636,3018,3019],{},"module_process_status"," (one row per module, process and worker: mode, status, restarts,\nlast error scrubbed and cut to 500 characters, its time, when it started, a note such as \"standby on ",[3022,3023,3024,3025,3028,3029,3032,3033,646],"worker",{},"\"). The\nworker touches its rows every minute, so a worker that is gone shows as not seen, and the core schedule\n",[636,3026,3027],{},"processes.purge-status"," deletes rows of workers not seen for a day. Each crash is also in the error log, as the\nmodule's (",[636,3030,3031],{},"package:\u003Cname>","), with the process as its scope (",[636,3034,3035],{},"process:\u003Cprocess>",[1321,3037,3038,3050],{},[1324,3039,3040],{},[1327,3041,3042,3045,3048],{},[1330,3043,3044],{},"Route",[1330,3046,3047],{},"Who",[1330,3049,2802],{},[1343,3051,3052,3077],{},[1327,3053,3054,3062,3067],{},[1348,3055,3056,1013,3059,1025],{},[636,3057,3058],{},"GET \u002Fapi\u002Fpackages\u002Fprocesses",[636,3060,3061],{},"?plugin=",[1348,3063,3064],{},[636,3065,3066],{},"packages.read",[1348,3068,3069,3070,3073,3074],{},"Every process on every worker (",[636,3071,3072],{},"listProcessStatus","), with ",[636,3075,3076],{},"seen",[1327,3078,3079,3084,3089],{},[1348,3080,3081],{},[636,3082,3083],{},"POST \u002Fapi\u002Fpackages\u002Fprocesses\u002F:name\u002F:process\u002Frestart",[1348,3085,3086],{},[636,3087,3088],{},"packages.manage",[1348,3090,3091,3092,3095,3096,3099,3100,3103,3104,3106],{},"An admin's Restart (",[636,3093,3094],{},"requestProcessRestart","): asked for in Postgres (",[636,3097,3098],{},"restart_requested_at","), audited ",[636,3101,3102],{},"packages.process-restart",", announced on ",[636,3105,2934],{},"; every worker that has the process restarts it, a failed one with its restarts at 0. 404 when no worker has it",[619,3108,3109,3111,3112,3115,3116,3119,3120,3123,3124,3126,3127,3130],{},[636,3110,638],{}," is a reserved module name, so these never meet a module's own routes. A module's measured health\n(see ",[636,3113,3114],{},"shade\u002Ffeatures\u002Fpackages\u002FREADME.md"," in the ",[636,3117,3118],{},"shade"," repository) takes its processes from ",[636,3121,3122],{},"processHealthOf",": a\nprocess in ",[636,3125,2304],{}," or ",[636,3128,3129],{},"backoff"," on a current worker counts as unhealthy.",[628,3132,3134],{"id":3133},"where-it-is","Where it is",[1321,3136,3137,3146],{},[1324,3138,3139],{},[1327,3140,3141,3144],{},[1330,3142,3143],{},"Part",[1330,3145,2802],{},[1343,3147,3148,3165,3181,3194,3222,3238,3261,3279,3290,3300],{},[1327,3149,3150,3155],{},[1348,3151,3152],{},[636,3153,3154],{},"shade\u002Fkernel\u002Fmodules\u002Fdefine.ts",[1348,3156,3157,3160,3161,3164],{},[636,3158,3159],{},"ShadeModule.processes"," (a core part), ",[636,3162,3163],{},"ModuleProcess"," from the supervisor",[1327,3166,3167,3172],{},[1348,3168,3169],{},[636,3170,3171],{},"shade\u002Fkernel\u002Fmodules\u002Floader.ts",[1348,3173,3174,3177,3178,3180],{},[636,3175,3176],{},"processProblems",": trusted modules only, ",[636,3179,1440],{},", parameters in the declaration",[1327,3182,3183,3188],{},[1348,3184,3185],{},[636,3186,3187],{},"shade\u002Ffeatures\u002Fpackages\u002Fserver\u002Fcapability-definitions.ts",[1348,3189,3190,3191,3193],{},"The ",[636,3192,625],{}," capability: trusted, its lines, its words, what asks again",[1327,3195,3196,3203],{},[1348,3197,3198,1357,3200],{},[636,3199,2705],{},[636,3201,3202],{},"backoff.ts",[1348,3204,3205,1013,3207,1357,3210,1357,3213,1357,3216,3219,3220],{},[636,3206,2702],{},[636,3208,3209],{},"sync",[636,3211,3212],{},"restart",[636,3214,3215],{},"stopAll",[636,3217,3218],{},"summary","), the numbers, ",[636,3221,2824],{},[1327,3223,3224,3235],{},[1348,3225,3226,1357,3229,1357,3232],{},[636,3227,3228],{},"shade\u002Ffeatures\u002Fpackages\u002Fserver\u002Fprocess-status.ts",[636,3230,3231],{},"process-status.sql.ts",[636,3233,3234],{},"shared\u002Fprocesses.ts",[1348,3236,3237],{},"The status table and its services (with the connections' states), the view the admin reads",[1327,3239,3240,3251],{},[1348,3241,3242,1357,3245,1357,3248],{},[636,3243,3244],{},"shade\u002Fkernel\u002Fconnections.ts",[636,3246,3247],{},"shade\u002Ffeatures\u002Fpackages\u002Fserver\u002Fconnections.ts",[636,3249,3250],{},"apps\u002Fapi\u002Fsrc\u002Fthreads\u002Fwebsocket-client.ts",[1348,3252,3253,3254,3256,3257,3260],{},"Long-lived connections: the transports, limits and reconnecting, ",[636,3255,1623],{}," with the declared hosts, and the WebSocket client (",[636,3258,3259],{},"ws",", imported only there)",[1327,3262,3263,3267],{},[1348,3264,3265],{},[636,3266,2921],{},[1348,3268,3269,3272,3273,3276,3277],{},[636,3270,3271],{},"startProcesses"," (on the worker's ",[636,3274,3275],{},"startBackground","), ",[636,3278,2918],{},[1327,3280,3281,3287],{},[1348,3282,3283,1357,3285],{},[636,3284,2979],{},[636,3286,2968],{},[1348,3288,3289],{},"The thread factory and the thread entry",[1327,3291,3292,3297],{},[1348,3293,3294],{},[636,3295,3296],{},"apps\u002Fapi\u002Fsrc\u002Fhttp\u002Fcontrollers\u002Fmodule-processes.ts",[1348,3298,3299],{},"The routes above",[1327,3301,3302,3307],{},[1348,3303,3304],{},[636,3305,3306],{},"shade\u002Ffeatures\u002Fpackages\u002Fadmin\u002Fcomponents\u002FModuleProcessesTable.vue",[1348,3308,3309],{},"The Modules page's table, on each module's card",[628,3311,3313],{"id":3312},"tests","Tests",[1276,3315,3316,3322,3336,3342,3355,3370,3376,3382,3391,3398,3409],{},[1279,3317,3318,3321],{},[636,3319,3320],{},"shade\u002Ftest\u002Fkernel\u002Fprocesses\u002Fsupervisor.test.ts"," (fake threads, test clock): \"starts a process and records starting, then\nrunning at its first heartbeat\", \"restarts a crashed process with exponential backoff and records backoff between\nstarts\", \"resets the restart count after ten minutes of running\", \"marks a process failed after its maximum restarts\nand starts it no more until an admin restarts it\", \"stops gracefully: aborts the signal, waits the stop timeout, then\nterminates\", \"terminates a process whose heartbeat stops for 15 seconds, and counts it as a crash\", \"refuses to start\na process beyond the worker's memory budget, with the reason as its status\", \"starts processes when their module is\nswitched on and stops them when it is switched off or its capability is skipped\", \"records each status change in\norder\"; singletons on leases: \"runs a singleton process on one worker only\", \"starts it on another worker once the\nfirst one's lease expires\", \"lets a new worker wait while the old one still holds the lease (blue-green), and take\nover when it releases\", \"stops a singleton at once when its lease is lost\".",[1279,3323,3324,3327,3328,3331,3332,3335],{},[636,3325,3326],{},"shade\u002Ftest\u002Fkernel\u002Fconnections.test.ts"," (a local https server): refusals and the stream, no redirects; ",[636,3329,3330],{},"apps\u002Fapi\u002Ftest\u002Fthreads\u002Fwebsocket-client.test.ts",": the WebSocket, limits, reconnecting with the rules asked again, shutdown; ",[636,3333,3334],{},"shade\u002Ftest\u002Ffeatures\u002Fpackages\u002Fserver\u002Fconnections.test.ts"," (Postgres): the declared hosts, refusals counted, only a process's context.",[1279,3337,3338,3341],{},[636,3339,3340],{},"shade\u002Ftest\u002Fkernel\u002Fbackoff.test.ts",": \"waits 1, 2, 4 … seconds, capped at five minutes, with at most 20 % jitter\".",[1279,3343,3344,3347,3348,3351,3352,3354],{},[636,3345,3346],{},"shade\u002Ftest\u002Fkernel\u002Fmodules\u002Floader.test.ts",": \"loads a trusted module's processes with their parameters, and refuses a\nprocess without them\", \"refuses a process with less than 64 MB, and gives one without\nmemoryMb 64\", \"refuses processes in an untrusted module, as a part and as a\ncapability\"; ",[636,3349,3350],{},"capabilities.test.ts",": the ",[636,3353,625],{}," capability offered to trusted modules.",[1279,3356,3357,3360,3361,3363,3364,3366,3367,3369],{},[636,3358,3359],{},"shade\u002Ftest\u002Ffeatures\u002Fpackages\u002Fserver\u002Fprocess-status.test.ts"," (Postgres): each worker's status with its error\nscrubbed, the list for ",[636,3362,3066],{}," and the Restart for ",[636,3365,3088],{}," through the ",[636,3368,2934],{}," message, the purge.",[1279,3371,3372,3375],{},[636,3373,3374],{},"apps\u002Fapi\u002Ftest\u002Fthreads\u002Fthread-factory.test.ts",": the heap limit, no environment, heartbeats, the graceful stop, terminate, and\na thread that runs out of memory.",[1279,3377,3378,3381],{},[636,3379,3380],{},"apps\u002Fapi\u002Ftest\u002Fthreads\u002Fprocess-thread.test.ts"," (Postgres): \"runs a trusted module's process as the module's own actor until it\nis stopped, then ends with code 0\", and the error when it throws or the module has no such process.",[1279,3383,3384,3387,3388,3390],{},[636,3385,3386],{},"apps\u002Fapi\u002Ftest\u002Fbootstrap\u002Fprocesses.test.ts"," (Postgres): the switch, the optional capability and an admin's Restart on\nevery worker through the ",[636,3389,2934],{}," message, a crash in the error log, and \"never runs a process on the admin or public\ncontainer role\".",[1279,3392,3393,2277,3396,1105],{},[636,3394,3395],{},"shade\u002Fmodule-sdk\u002Ftest\u002Ftesting.processes.test.ts",[636,3397,2366],{},[1279,3399,3400,3401,3404,3405,3408],{},"e2e ",[636,3402,3403],{},"plugins-processes.spec.ts",", with core's ",[636,3406,3407],{},"process-probe"," fixture (a server package, installed switched off): an\nadmin sees a running process and a failed one with its last error, restarts the failed one, and switching the module\noff stops them; the processes run in worker threads of the built API.",[1279,3410,3411,3414],{},[636,3412,3413],{},"pnpm deploy:smoke",": the worker starts its supervisor, and the thread entry loads in a thread within 64 MB with the\ntemplate's settings.",[3416,3417,3418],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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);}",{"title":653,"searchDepth":702,"depth":702,"links":3420},[3421,3425,3428,3432,3433],{"id":630,"depth":702,"text":631,"children":3422},[3423,3424],{"id":1464,"depth":709,"text":1395},{"id":1483,"depth":709,"text":1484},{"id":1608,"depth":702,"text":1609,"children":3426},[3427],{"id":2377,"depth":709,"text":2378},{"id":2695,"depth":702,"text":2696,"children":3429},[3430,3431],{"id":2962,"depth":709,"text":2963},{"id":3012,"depth":709,"text":3013},{"id":3133,"depth":702,"text":3134},{"id":3312,"depth":702,"text":3313},"md",null,{},{"title":409,"description":653},"c6psTuoZ_bJqrPtHx1QRIWzVRhQRqwaS72z6WKBPgSc",[3440,3441],{"title":405,"path":406,"stem":407,"description":653,"children":-1},{"title":413,"path":414,"stem":415,"description":653,"children":-1},1796500154782]