volute 0.47.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/README.md +82 -331
  2. package/dist/{accept-YAFP5JFJ.js → accept-KYNC5X3U.js} +3 -3
  3. package/dist/{activity-events-MIOK3IOU.js → activity-events-GJJAI2WT.js} +4 -4
  4. package/dist/{ai-service-CVZEYKTK.js → ai-service-A7FS7EC3.js} +9 -5
  5. package/dist/{archive-6Z4GFQPH.js → archive-7E3YE6VF.js} +3 -3
  6. package/dist/{auth-A4VGHADI.js → auth-ABYLOEZ7.js} +5 -5
  7. package/dist/{avatar-image-7S3WA77A.js → avatar-image-6ATV2IOZ.js} +6 -5
  8. package/dist/{backup-IIAFOW2L.js → backup-XYAMT4CU.js} +15 -15
  9. package/dist/{bridge-TIZGSXOD.js → bridge-3FNSWLNQ.js} +3 -3
  10. package/dist/{channels-ITE4YC57.js → channels-SGQZHNQJ.js} +3 -3
  11. package/dist/{chat-AJLJCQ3M.js → chat-OGXAEXMV.js} +9 -9
  12. package/dist/{chunk-LTLFOSA4.js → chunk-3B427GUK.js} +3 -3
  13. package/dist/{chunk-RUFLGTOT.js → chunk-4B62E4CG.js} +2 -2
  14. package/dist/{chunk-ODDGGLM6.js → chunk-4DSGN4FL.js} +3 -3
  15. package/dist/{chunk-BGYHLR54.js → chunk-6HGEZJDH.js} +2 -2
  16. package/dist/{chunk-RBNMDAKB.js → chunk-BCG45AQB.js} +15 -1
  17. package/dist/{chunk-5IERLDUS.js → chunk-DAIIMBLB.js} +26 -6
  18. package/dist/{chunk-DGGZVZTM.js → chunk-DVN6DNMI.js} +1 -1
  19. package/dist/chunk-DW4TRDOZ.js +29 -0
  20. package/dist/chunk-EADX54RG.js +113 -0
  21. package/dist/{chunk-EIQDZC43.js → chunk-EFT2OALG.js} +6 -2
  22. package/dist/{chunk-XHN6XBWV.js → chunk-EG5LSKHU.js} +2 -2
  23. package/dist/{chunk-VMCZBXF2.js → chunk-FBBS4BVR.js} +10 -34
  24. package/dist/{chunk-IWJSNMSY.js → chunk-GWVFDUNB.js} +45 -14
  25. package/dist/{chunk-CBOIHNMR.js → chunk-HCYQRME2.js} +41 -5
  26. package/dist/{chunk-4I72V3E5.js → chunk-IH5TKXX6.js} +15 -15
  27. package/dist/{chunk-5NN2VHJV.js → chunk-JBIFXB6I.js} +4 -4
  28. package/dist/{chunk-JSVHH32K.js → chunk-JCBPU57A.js} +15 -13
  29. package/dist/{chunk-M3XDVS5Q.js → chunk-JCWB2ITW.js} +2 -2
  30. package/dist/{chunk-JCMGDCGX.js → chunk-JPGHSXSV.js} +20 -25
  31. package/dist/{chunk-K23P5Q5N.js → chunk-K3JOLGWF.js} +30 -8
  32. package/dist/{chunk-3YUBFTDN.js → chunk-KHCKZ36O.js} +1 -1
  33. package/dist/{chunk-7KRIHYLR.js → chunk-L27YYONJ.js} +2 -2
  34. package/dist/{chunk-SZJCJVXV.js → chunk-MG3Z34YE.js} +2 -2
  35. package/dist/{chunk-SKNXMUIU.js → chunk-NJHN6IRB.js} +26 -2
  36. package/dist/{chunk-2OIYNHWO.js → chunk-NOIAHMJB.js} +1 -1
  37. package/dist/{chunk-2MJ7EOMT.js → chunk-P4LHVRNE.js} +1 -0
  38. package/dist/{chunk-IYG4FBMP.js → chunk-PY24ZL62.js} +1 -1
  39. package/dist/{chunk-F55GRIEK.js → chunk-QQBOI3QA.js} +356 -296
  40. package/dist/{chunk-T2TP6ZC6.js → chunk-QUSMYGNQ.js} +6 -0
  41. package/dist/{chunk-KDLYIECM.js → chunk-R772ET2M.js} +18 -4
  42. package/dist/{chunk-WW6C3PLV.js → chunk-RSBL3FAD.js} +39 -6
  43. package/dist/{mind-list-KEGRGQEQ.js → chunk-SHKM5RGD.js} +19 -6
  44. package/dist/{chunk-YKA7DCVW.js → chunk-SX72DOO3.js} +1 -1
  45. package/dist/chunk-TXJL36ZQ.js +48 -0
  46. package/dist/{chunk-M6TTZRGH.js → chunk-VIUH5CHQ.js} +72 -24
  47. package/dist/{chunk-HPGN6XRT.js → chunk-VNRSXEBF.js} +4 -4
  48. package/dist/{chunk-PFZBNKUH.js → chunk-WCFSBH33.js} +0 -1
  49. package/dist/chunk-XTEKINWG.js +158 -0
  50. package/dist/{chunk-LWDTP6DH.js → chunk-YIJGKHIS.js} +32 -2
  51. package/dist/{chunk-MTRMQFCQ.js → chunk-ZX46PGCC.js} +2 -2
  52. package/dist/cli.js +34 -26
  53. package/dist/{clock-E6N5Y3YW.js → clock-6JZL2FS6.js} +3 -3
  54. package/dist/{cloud-sync-LQTVDTQ3.js → cloud-sync-VFDTNNCA.js} +22 -20
  55. package/dist/{config-TJLYUV3U.js → config-RPSLA2HX.js} +3 -3
  56. package/dist/{conversations-C7IKYSHD.js → conversations-TUM5PJJ4.js} +5 -5
  57. package/dist/{create-A7PDHIIL.js → create-VIQVP3QB.js} +3 -3
  58. package/dist/{create-PQQXKTJK.js → create-Z5FSDNVZ.js} +16 -5
  59. package/dist/{daemon-client-IYR4KCPU.js → daemon-client-ZFY5MOAL.js} +5 -3
  60. package/dist/{daemon-restart-5F3YTLZK.js → daemon-restart-54L4B6AQ.js} +7 -7
  61. package/dist/daemon.js +1105 -601
  62. package/dist/{db-FO6LXYCW.js → db-F6UMFRYD.js} +2 -2
  63. package/dist/{db-LZTLA7XC.js → db-IPXRJUI7.js} +1 -1
  64. package/dist/{delete-HPLC7ETU.js → delete-ESEP7NGQ.js} +1 -1
  65. package/dist/delivery-manager-RBXBPVWM.js +36 -0
  66. package/dist/{delivery-router-3QFG2ZEX.js → delivery-router-VUOL5YSA.js} +8 -6
  67. package/dist/{down-ZI4S6265.js → down-6X7KX7BZ.js} +5 -5
  68. package/dist/echo-text-B6NZ5FGE.js +36 -0
  69. package/dist/env-KUL4XKN2.js +18 -0
  70. package/dist/{env-HRL2PWAT.js → env-ZYMSCB7B.js} +6 -6
  71. package/dist/{exec-QIFYZG4C.js → exec-FBXA3CM4.js} +3 -3
  72. package/dist/{export-4GVGNW54.js → export-TNBPDH77.js} +4 -4
  73. package/dist/{extension-QBY4C44L.js → extension-J4ZQ2GHV.js} +3 -3
  74. package/dist/{extensions-PIMIQ7J3.js → extensions-AWNO3SZF.js} +22 -20
  75. package/dist/{files-FEFZKMNM.js → files-BVBRJJ2P.js} +6 -6
  76. package/dist/{import-7MO3YTRE.js → import-ZUNKMCKC.js} +9 -9
  77. package/dist/{isolation-MCT4ZYLT.js → isolation-OPCZQRTH.js} +3 -3
  78. package/dist/{join-ZJV7W6MO.js → join-34TR2GXQ.js} +1 -1
  79. package/dist/{list-LQO2DCIK.js → list-PMUXZNAM.js} +3 -3
  80. package/dist/{login-OF4WXDAN.js → login-KAKNFCW5.js} +14 -5
  81. package/dist/{login-6TLMI2TQ.js → login-LKNLCJPA.js} +3 -3
  82. package/dist/{logout-ERE2BGA3.js → logout-RLT62RQP.js} +5 -5
  83. package/dist/{logout-BK53HXNY.js → logout-YZRMZ3O2.js} +3 -3
  84. package/dist/message-delivery-ABPV76EA.js +42 -0
  85. package/dist/{mind-POOHFZHP.js → mind-IF6CGMFW.js} +23 -19
  86. package/dist/{mind-activity-tracker-YVZPC4A5.js → mind-activity-tracker-YMMERB6B.js} +5 -5
  87. package/dist/mind-contacts-BKUFPUCU.js +64 -0
  88. package/dist/{mind-history-47DN6ILW.js → mind-history-WI5OI3BW.js} +5 -5
  89. package/dist/mind-list-OTHV4ZO4.js +13 -0
  90. package/dist/{mind-profile-PEQYASQX.js → mind-profile-LUG353ZT.js} +1 -1
  91. package/dist/mind-service-42GDO4KH.js +44 -0
  92. package/dist/{mind-sleep-IN3WPA76.js → mind-sleep-VBV7YRSU.js} +5 -5
  93. package/dist/{mind-status-SMUWJKGV.js → mind-status-BJNPGXKC.js} +8 -3
  94. package/dist/{mind-wake-R54BPESY.js → mind-wake-LVTZ55EZ.js} +3 -3
  95. package/dist/notices-N6BCGHFV.js +25 -0
  96. package/dist/{package-WPEE2HVJ.js → package-PD67VPHB.js} +8 -5
  97. package/dist/prompts-MDHDLWEX.js +24 -0
  98. package/dist/{read-PWAJOQIQ.js → read-YSWUXYL7.js} +3 -3
  99. package/dist/{register-7SZJFHU6.js → register-TWQDKQRT.js} +3 -3
  100. package/dist/{registry-UMMDRPRM.js → registry-3ELJPUGJ.js} +6 -2
  101. package/dist/{reject-6VH7N2A4.js → reject-SXGCYN4A.js} +3 -3
  102. package/dist/{restart-H5WJDMA7.js → restart-5F5QDBOG.js} +5 -5
  103. package/dist/{sandbox-G4X4K3UN.js → sandbox-XPYA7UIF.js} +5 -5
  104. package/dist/scheduler-K7Y7Z7FQ.js +34 -0
  105. package/dist/{schema-VEVO7HG6.js → schema-6YONVTKZ.js} +1 -1
  106. package/dist/{seed-VANPU43L.js → seed-NQED7PSX.js} +1 -1
  107. package/dist/{seed-check-VLTVILOV.js → seed-check-TYD7RRZY.js} +1 -1
  108. package/dist/{seed-cmd-SYVDZKM4.js → seed-cmd-QF3F2G4S.js} +3 -3
  109. package/dist/{seed-create-3FGZPS6C.js → seed-create-XOO4N2OE.js} +6 -4
  110. package/dist/seed-readiness-3LRYASA4.js +18 -0
  111. package/dist/{seed-sprout-H7QLFPFM.js → seed-sprout-HSBBGSS2.js} +32 -33
  112. package/dist/{send-HYDFGC6G.js → send-IHRJYNXA.js} +8 -8
  113. package/dist/{service-SYJ5G6LP.js → service-YCOPCTSZ.js} +4 -4
  114. package/dist/{service-install-FQ43Z4DF.js → service-install-Y46OTF55.js} +5 -5
  115. package/dist/{setup-QJHGMGSN.js → setup-F4TE64YI.js} +7 -7
  116. package/dist/{setup-KFYVWTXG.js → setup-TCN7VH5U.js} +9 -3
  117. package/dist/{skill-GUKG2YVH.js → skill-4CYJLYVY.js} +6 -6
  118. package/dist/skills/dreaming/SKILL.md +5 -1
  119. package/dist/skills/dreaming/scripts/dream.ts +5 -1
  120. package/dist/skills/orientation/SKILL.md +8 -7
  121. package/dist/skills/tending/SKILL.md +51 -2
  122. package/dist/skills/volute-mind/SKILL.md +5 -3
  123. package/dist/skills/volute-mind/references/routing.md +6 -5
  124. package/dist/skills/volute-mind/references/variants.md +48 -14
  125. package/dist/{skills-L2CMTW7A.js → skills-NN5UZCUU.js} +8 -6
  126. package/dist/sleep-manager-DSPXFHGX.js +38 -0
  127. package/dist/spirit-SSJMYC6A.js +31 -0
  128. package/dist/{split-WBMZXBHF.js → split-JF2VWTXA.js} +5 -2
  129. package/dist/{sprout-LTL5P36T.js → sprout-AXA2SECQ.js} +1 -1
  130. package/dist/{src-OJHARHTF.js → src-ZN4LXMPI.js} +17 -8
  131. package/dist/{start-X46I3GXB.js → start-BTVMTP3K.js} +5 -5
  132. package/dist/{status-V4RJMHJ4.js → status-VJGXMQ4L.js} +10 -8
  133. package/dist/{stop-HJQV4YSM.js → stop-YORESK4U.js} +5 -5
  134. package/dist/system-chat-M2XOBKEM.js +40 -0
  135. package/dist/{systems-B5YJKMW4.js → systems-5MH2ELQE.js} +6 -6
  136. package/dist/{tailscale-MCLY5GYE.js → tailscale-AMMVKDXB.js} +3 -3
  137. package/dist/{template-staleness-EMQORSGG.js → template-staleness-HKGCTS3H.js} +4 -4
  138. package/dist/{turn-tracker-JZRZDFWV.js → turn-tracker-JQ2YUUY2.js} +7 -7
  139. package/dist/up-SDLTLPAO.js +20 -0
  140. package/dist/{update-ACV4SAY3.js → update-WEA4N2TR.js} +5 -5
  141. package/dist/{update-check-266R4ZSY.js → update-check-DZOTONII.js} +3 -3
  142. package/dist/{upgrade-NWAZ7MLD.js → upgrade-K5FIQPQD.js} +1 -1
  143. package/dist/variant-cleanup-P4MBNLJD.js +33 -0
  144. package/dist/{version-notify-XRGTEEDK.js → version-notify-WFA5XB5A.js} +27 -25
  145. package/dist/web-assets/assets/index-BostMFoR.css +1 -0
  146. package/dist/web-assets/assets/index-CKlqUkyG.js +92 -0
  147. package/dist/web-assets/index.html +2 -2
  148. package/drizzle/0013_variant_purpose.sql +3 -0
  149. package/drizzle/meta/_journal.json +7 -0
  150. package/package.json +8 -5
  151. package/packages/extensions/pages/dist/ui/assets/index-BuXnE-rb.css +1 -0
  152. package/packages/extensions/pages/dist/ui/assets/index-DtzftuPA.js +2 -0
  153. package/packages/extensions/pages/dist/ui/index.html +2 -2
  154. package/templates/_base/.init/.local/hooks/startup-context.ts +19 -2
  155. package/templates/_base/home/VOLUTE.md +13 -1
  156. package/templates/_base/src/lib/daemon-client.ts +27 -7
  157. package/templates/_base/src/lib/startup.ts +16 -1
  158. package/templates/claude/src/agent.ts +10 -3
  159. package/templates/claude/src/lib/hooks/identity-reload.ts +12 -3
  160. package/templates/claude/src/server.ts +4 -2
  161. package/templates/pi/src/agent.ts +7 -10
  162. package/templates/pi/src/lib/dispatch.ts +65 -0
  163. package/templates/pi/src/lib/event-handler.ts +47 -6
  164. package/dist/delivery-manager-TN5KK2AP.js +0 -34
  165. package/dist/echo-text-SEQCLGAT.js +0 -34
  166. package/dist/message-delivery-ZE3YGJDD.js +0 -38
  167. package/dist/mind-service-JFY7UG5E.js +0 -40
  168. package/dist/scheduler-HQSDYJFY.js +0 -32
  169. package/dist/sleep-manager-3NA7ZJP3.js +0 -36
  170. package/dist/spirit-WXN4IDBF.js +0 -23
  171. package/dist/system-chat-N2F7HVY3.js +0 -38
  172. package/dist/up-J2PBPOZL.js +0 -18
  173. package/dist/volute-config-A52FHWKM.js +0 -14
  174. package/dist/web-assets/assets/index-DtctoDXY.css +0 -1
  175. package/dist/web-assets/assets/index-Wpyb2CML.js +0 -86
  176. package/packages/extensions/pages/dist/ui/assets/index-BcY6lnq4.css +0 -1
  177. package/packages/extensions/pages/dist/ui/assets/index-CQjEQg1r.js +0 -2
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com" />
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Averia+Serif+Libre:wght@300;400;700&family=Fira+Code:wght@300;400;500;600&family=Averia+Sans+Libre:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap" rel="stylesheet" />
11
- <script type="module" crossorigin src="/assets/index-Wpyb2CML.js"></script>
12
- <link rel="stylesheet" crossorigin href="/assets/index-DtctoDXY.css">
11
+ <script type="module" crossorigin src="/assets/index-CKlqUkyG.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-BostMFoR.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
@@ -0,0 +1,3 @@
1
+ -- Purpose/intent captured at split time, recorded on the variant's row so it can
2
+ -- orient the variant, feed the variant list UI, and default the join message.
3
+ ALTER TABLE `minds` ADD `purpose` text;
@@ -92,6 +92,13 @@
92
92
  "when": 1775700000000,
93
93
  "tag": "0012_channel_gates",
94
94
  "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "6",
99
+ "when": 1775800000000,
100
+ "tag": "0013_variant_purpose",
101
+ "breakpoints": true
95
102
  }
96
103
  ]
97
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volute",
3
- "version": "0.47.0",
3
+ "version": "0.49.0",
4
4
  "description": "CLI for creating and managing self-modifying AI minds powered by the Claude Agent SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,9 +45,10 @@
45
45
  "scripts": {
46
46
  "dev": "tsx src/cli.ts",
47
47
  "build": "npm run build:ext && tsup && cp -r skills dist/skills && npm run build:web",
48
- "build:ext": "npm run build:ext-theme --workspace=packages/ui && cp packages/ui/dist/ext-theme.css packages/web/public/ext-theme.css && npm run build:ui --workspace=packages/extensions/notes && npm run build:ui --workspace=packages/extensions/pages && npm run build:ui --workspace=packages/extensions/plan",
49
- "build:web": "npm run build:ui --workspace=packages/web",
50
- "dev:web": "npm run dev --workspace=packages/web",
48
+ "ext-theme": "npm run build:ext-theme --workspace=packages/ui && cp packages/ui/dist/ext-theme.css packages/web/public/ext-theme.css",
49
+ "build:ext": "npm run ext-theme && npm run build:ui --workspace=packages/extensions/notes && npm run build:ui --workspace=packages/extensions/pages && npm run build:ui --workspace=packages/extensions/plan",
50
+ "build:web": "npm run ext-theme && npm run build:ui --workspace=packages/web",
51
+ "dev:web": "npm run ext-theme && npm run dev --workspace=packages/web",
51
52
  "test": "node --import tsx --import ./test/setup.ts --test --test-force-exit --test-concurrency=4 $(find test -name '*.test.ts' ! -name 'daemon-e2e.test.ts' | sort)",
52
53
  "test:e2e": "node --import tsx --import ./test/setup.ts --test --test-force-exit --test-concurrency=1 test/daemon-e2e.test.ts",
53
54
  "test:all": "npm test && npm run test:e2e",
@@ -58,6 +59,7 @@
58
59
  "typecheck:templates": "tsx scripts/typecheck-templates.ts",
59
60
  "lint:templates": "biome check templates/",
60
61
  "typecheck:web": "svelte-check --tsconfig packages/web/tsconfig.json",
62
+ "knip": "knip --workspace packages/web --include files",
61
63
  "prepare": "lefthook install",
62
64
  "prepublishOnly": "npm run build",
63
65
  "db:generate": "drizzle-kit generate",
@@ -65,10 +67,10 @@
65
67
  },
66
68
  "dependencies": {
67
69
  "@anthropic-ai/sandbox-runtime": "^0.0.56",
70
+ "@earendil-works/pi-ai": "^0.80.3",
68
71
  "@hono/node-server": "^2.0.6",
69
72
  "@hono/zod-validator": "^0.8.0",
70
73
  "@libsql/client": "^0.17.4",
71
- "@earendil-works/pi-ai": "^0.80.3",
72
74
  "@slack/bolt": "^4.7.3",
73
75
  "adm-zip": "^0.5.17",
74
76
  "bcryptjs": "^3.0.3",
@@ -93,6 +95,7 @@
93
95
  "@types/node": "^26.0.0",
94
96
  "dompurify": "^3.4.11",
95
97
  "drizzle-kit": "^0.31.10",
98
+ "knip": "^6.26.0",
96
99
  "lefthook": "^2.1.9",
97
100
  "marked": "^18.0.5",
98
101
  "svelte": "^5.56.3",
@@ -0,0 +1 @@
1
+ .thumbnail-card.svelte-yqwgpu{cursor:pointer;text-align:left;color:inherit;background:0 0;flex-direction:column;gap:6px;padding:0;display:flex}.thumbnail-frame.svelte-yqwgpu{border-radius:var(--radius-lg);border:1px solid var(--border);background:var(--bg-0);transition:border-color .15s;overflow:hidden}.thumbnail-card.svelte-yqwgpu:hover .thumbnail-frame:where(.svelte-yqwgpu){border-color:var(--border-bright)}iframe.svelte-yqwgpu{transform-origin:0 0;pointer-events:none;opacity:0;background:#fff;border:none;transition:opacity .15s}iframe.loaded.svelte-yqwgpu{opacity:1}.thumbnail-label.svelte-yqwgpu{color:var(--text-0);text-overflow:ellipsis;white-space:nowrap;max-width:var(--card-w);padding:0 2px;font-size:13px;font-weight:500;overflow:hidden}.thumbnail-sublabel.svelte-yqwgpu{color:var(--text-2);text-overflow:ellipsis;white-space:nowrap;max-width:var(--card-w);padding:0 2px;font-size:11px;overflow:hidden}.dashboard.svelte-apzsoj{max-width:1200px}.section.svelte-apzsoj{margin-bottom:24px}.section-header.svelte-apzsoj{text-transform:uppercase;letter-spacing:.05em;margin-bottom:12px;font-size:12px}.section-title.svelte-apzsoj{color:var(--text-2)}.thumbnail-grid.svelte-apzsoj{flex-wrap:wrap;gap:16px;display:flex}.empty.svelte-apzsoj{color:var(--text-2);font-size:13px}.site-view.svelte-vvnkg1{max-width:1200px}.site-header.svelte-vvnkg1{align-items:baseline;gap:8px;margin-bottom:16px;display:flex}.site-name.svelte-vvnkg1{color:var(--text-0);font-size:16px;font-weight:500}.page-count.svelte-vvnkg1{color:var(--text-2);font-size:12px}.thumbnail-grid.svelte-vvnkg1{flex-wrap:wrap;gap:16px;display:flex}.thumbnail-grid.with-hero.svelte-vvnkg1{margin-top:20px}.empty.svelte-vvnkg1{color:var(--text-2);font-size:13px}.ext-app.svelte-1r8vfx3{max-width:100%;min-height:100%;padding:24px;animation:.2s both fadeIn}.ext-app.full-page.svelte-1r8vfx3{height:100%;padding:0}.full-page-iframe.svelte-1r8vfx3{background:#fff;border:none;width:100%;height:100%}
@@ -0,0 +1,2 @@
1
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){for(var t=0;t<e.length;t++)e[t]()}function p(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var m=1024,h=2048,g=4096,_=8192,v=16384,y=32768,b=1<<25,x=65536,S=1<<19,ee=1<<20,te=1<<25,C=65536,ne=1<<21,re=1<<22,ie=1<<23,ae=Symbol(`$state`),oe=Symbol(`legacy props`),se=Symbol(``),ce=Symbol(`attributes`),le=Symbol(`class`),ue=Symbol(`style`),de=Symbol(`text`),fe=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},pe=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function me(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function he(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ge(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function _e(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ve(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function ye(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function be(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function xe(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Se(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ce(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function we(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Te(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ee={},w=Symbol(`uninitialized`),De=`http://www.w3.org/1999/xhtml`;function Oe(){console.warn(`https://svelte.dev/e/derived_inert`)}function ke(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Ae(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var T=!1;function je(e){T=e}var E;function D(e){if(e===null)throw ke(),Ee;return E=e}function Me(){return D(en(E))}function O(e){if(T){if(en(E)!==null)throw ke(),Ee;E=e}}function Ne(e=1){if(T){for(var t=e,n=E;t--;)n=en(n);E=n}}function Pe(e=!0){for(var t=0,n=E;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=en(n);e&&n.remove(),n=i}}function Fe(e){if(!e||e.nodeType!==8)throw ke(),Ee;return e.data}function Ie(e){return e===this.v}function Le(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Re(e){return!Le(e,this.v)}var ze=!1,Be=!1,k=null;function Ve(e){k=e}function He(e,t=!1,n){k={p:k,i:!1,c:null,e:null,s:e,x:null,r:G,l:Be&&!t?{s:null,u:null,$:[]}:null}}function Ue(e){var t=k,n=t.e;if(n!==null){t.e=null;for(var r of n)pn(r)}return e!==void 0&&(t.x=e),t.i=!0,k=t.p,e??{}}function We(){return!Be||k!==null&&k.l===null}var Ge=[];function Ke(){var e=Ge;Ge=[],f(e)}function qe(e){if(Ge.length===0&&!wt){var t=Ge;queueMicrotask(()=>{t===Ge&&Ke()})}Ge.push(e)}function Je(e){var t=G;if(t===null)return H.f|=ie,e;if(!(t.f&32768)&&!(t.f&4))throw e;Ye(e,t)}function Ye(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}var Xe=~(h|g|m);function A(e,t){e.f=e.f&Xe|t}function Ze(e){e.f&512||e.deps===null?A(e,m):A(e,g)}function Qe(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=C,Qe(t.deps))}function $e(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Qe(e.deps),A(e,m)}var et=!1,tt=!1;function nt(e){var t=tt;try{return tt=!1,[e(),tt]}finally{tt=t}}function rt(e){let t=0,n=Vt(0),r;return()=>{un()&&(Z(n),_n(()=>(t===0&&(r=Yn(()=>e(()=>Gt(n)))),t+=1,()=>{qe(()=>{--t,t===0&&(r?.(),r=void 0,Gt(n))})})))}}var it=x|S;function at(e,t,n,r){new ot(e,t,n,r)}var ot=class{parent;is_pending=!1;transform_error;#e;#t=T?E:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=rt(()=>(this.#m=Vt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=G;t.b=this,t.f|=128,n(e)},this.parent=G.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=yn(()=>{if(T){let e=this.#t;Me();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},it),T&&(this.#e=E)}#g(){try{this.#a=B(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=B(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=B(()=>e(this.#e)),qe(()=>{var e=this.#c=document.createDocumentFragment(),t=L();e.append(t),this.#a=this.#x(()=>B(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Tn(this.#o,()=>{this.#o=null}),this.#b(M))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=B(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();kn(this.#a,e);let t=this.#n.pending;this.#o=B(()=>t(this.#e))}else this.#b(M)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){$e(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=G,n=H,r=k;K(this.#i),W(this.#i),Ve(this.#i.ctx);try{return At.ensure(),e()}catch(e){return Je(e),null}finally{K(t),W(n),Ve(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Tn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,qe(()=>{this.#d=!1,this.#m&&Ut(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),Z(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;M?.is_fork?(this.#a&&M.skip_effect(this.#a),this.#o&&M.skip_effect(this.#o),this.#s&&M.skip_effect(this.#s),M.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(V(this.#a),null),this.#o&&=(V(this.#o),null),this.#s&&=(V(this.#s),null),T&&(D(this.#t),Ne(),D(Pe()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){Ae();return}r=!0,i&&Te(),this.#s!==null&&Tn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){Ye(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return B(()=>{var t=G;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return Ye(e,this.#i.parent),null}}))};qe(()=>{var t;try{t=this.transform_error(e)}catch(e){Ye(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>Ye(e,this.#i&&this.#i.parent)):o(t)})}};function st(e,t,n,r){let i=We()?dt:mt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=G,c=ct(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){Ye(e,s)}lt()}}var d=ut();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>pt(e))).then(u).catch(e=>Ye(e,s)).finally(d)}l?l.then(()=>{c(),f(),lt()}):f()}function ct(){var e=G,t=H,n=k,r=M;return function(i=!0){K(e),W(t),Ve(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function lt(e=!0){K(null),W(null),Ve(null),e&&M?.deactivate()}function ut(){var e=G,t=e.b,n=M,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function dt(e){var t=2|h;return G!==null&&(G.f|=S),{ctx:k,deps:null,effects:null,equals:Ie,f:t,fn:e,reactions:null,rv:0,v:w,wv:0,parent:G,ac:null}}var ft=Symbol(`obsolete`);function pt(e,t,n){let r=G;r===null&&he();var i=void 0,a=Vt(w),o=!H,s=new Set;return gn(()=>{var t=G,n=p();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==fe&&n.reject(e)}).finally(lt)}catch(e){n.reject(e),lt()}var c=M;if(o){if(t.f&32768)var l=ut();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(ft);else for(let e of s.values())e.reject(ft);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==ft&&(c.activate(),t?(a.f|=ie,Ut(a,t)):(a.f&8388608&&(a.f^=ie),Ut(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),dn(()=>{for(let e of s)e.reject(ft)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function j(e){let t=dt(e);return ze||Pn(t),t}function mt(e){let t=dt(e);return t.equals=Re,t}function ht(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)V(t[n])}}function gt(e){var t,n=G,r=e.parent;if(!Mn&&r!==null&&e.v!==w&&r.f&24576)return Oe(),e.v;K(r);try{e.f&=~C,ht(e),t=Un(e)}finally{K(n)}return t}function _t(e){var t=gt(e);if(!e.equals(t)&&(e.wv=Bn(),(!M?.is_fork||e.deps===null)&&(M===null?e.v=t:(M.capture(e,t,!0),St?.capture(e,t,!0)),e.deps===null))){A(e,m);return}Mn||(N===null?Ze(e):(un()||M?.is_fork)&&N.set(e,t))}function vt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(fe),t.fn!==null&&(t.teardown=d),t.ac=null,Gn(t,0),xn(t))}function yt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Kn(t)}var bt=null,xt=null,M=null,St=null,N=null,Ct=null,wt=!1,Tt=!1,Et=null,Dt=null,Ot=0,kt=1,At=class e{id=kt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){xt===null?bt=xt=this:(xt.#n=this,this.#t=xt),xt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)A(r,h),t(r);for(r of n.m)A(r,g),t(r)}this.#p.add(e)}#g(){this.#e=!0,Ot++>1e3&&(this.#S(),jt());for(let e of this.#u)this.#d.delete(e),A(e,h),this.schedule(e);for(let e of this.#d)A(e,g),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Et=[],r=[],i=Dt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Lt(e),this.#h()||this.discard(),t}if(M=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Et=null,Dt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)It(e,t);i.length>0&&M.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),St=this,Mt(r),Mt(n),St=null,this.#s?.resolve();var s=M;if(this.#a===0&&(this.#c.length===0||s!==null)&&(this.#S(),ze&&(this.#x(),M=s)),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=m;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=m:i&4?t.push(r):ze&&i&16777224?n.push(r):Vn(r)&&(i&16&&this.#d.add(r),Kn(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),A(i,h),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),M=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)$e(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==w&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),N?.set(e,t)),this.is_fork||(e.v=t)}activate(){M=this}deactivate(){M=null,N=null}flush(){try{Tt=!0,M=this,this.#g()}finally{Ot=0,Ct=null,Et=null,Dt=null,Tt=!1,M=null,N=null,zt.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(ft);this.#S(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}#x(){for(let u=bt;u!==null;u=u.#n){var e=u.id<this.id,t=[];for(let[r,[i,a]]of this.current){if(u.current.has(r)){var n=u.current.get(r)[0];if(e&&i!==n)u.current.set(r,[i,a]);else continue}t.push(r)}if(e)for(let[e,t]of this.async_deriveds){let n=u.async_deriveds.get(e);n&&t.promise.then(n.resolve).catch(n.reject)}var r=[...u.current.keys()].filter(e=>!u.current.get(e)[1]);if(!(!u.#e||r.length===0)){var i=r.filter(e=>!this.current.has(e));if(i.length===0)e&&u.discard();else if(t.length>0){if(e)for(let e of this.#p)u.unskip_effect(e,e=>{e.f&4194320?u.schedule(e):u.#b([e])});u.activate();var a=new Set,o=new Map;for(var s of t)Nt(s,i,a,o);o=new Map;var c=[...u.current].filter(([e,t])=>{let n=this.current.get(e);return n?n[0]!==t[0]||n[1]!==t[1]:!0}).map(([e])=>e);if(c.length>0)for(let e of this.#l)!(e.f&155648)&&Pt(e,c,o)&&(e.f&4194320?(A(e,h),u.schedule(e)):u.#u.add(e));if(u.#c.length>0&&!u.#m){u.apply();for(var l of u.#c)u.#_(l,[],[]);u.#c=[]}u.deactivate()}}}}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,qe(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=p()).promise}static ensure(){if(M===null){let t=M=new e;!Tt&&!wt&&qe(()=>{t.#e||t.flush()})}return M}apply(){if(!ze||!this.is_fork&&this.#t===null&&this.#n===null){N=null;return}N=new Map;for(let[e,[t]]of this.current)N.set(e,t);for(let t=bt;t!==null;t=t.#n)if(!(t===this||t.is_fork)){var e=!1;if(t.id<this.id){for(let[n,[,r]]of t.current)if(!r&&this.current.has(n)){e=!0;break}}if(!e)for(let[e,n]of t.previous)N.has(e)||N.set(e,n)}}schedule(e){if(Ct=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Et!==null&&t===G&&(ze||(H===null||!(H.f&2))&&!et))return;if(n&96){if(!(n&1024))return;t.f^=m}}this.#c.push(t)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null?bt=t:e.#n=t,t===null?xt=e:t.#t=e,this.linked=!1}}};function jt(){try{be()}catch(e){Ye(e,Ct)}}var P=null;function Mt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Vn(r)&&(P=new Set,Kn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&wn(r),P?.size>0)){zt.clear();for(let e of P){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)P.has(n)&&(P.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Kn(n)}}P.clear()}}P=null}}function Nt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Nt(i,t,n,r):e&4194320&&!(e&2048)&&Pt(i,t,r)&&(A(i,h),Ft(i))}}function Pt(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&Pt(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function Ft(e){M.schedule(e)}function It(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),A(e,m);for(var n=e.first;n!==null;)It(n,t),n=n.next}}function Lt(e){A(e,m);for(var t=e.first;t!==null;)Lt(t),t=t.next}var Rt=new Set,zt=new Map,Bt=!1;function Vt(e,t){return{f:0,v:e,reactions:null,equals:Ie,rv:0,wv:0}}function F(e,t){let n=Vt(e,t);return Pn(n),n}function Ht(e,t=!1,n=!0){let r=Vt(e);return t||(r.equals=Re),Be&&n&&k!==null&&k.l!==null&&(k.l.s??=[]).push(r),r}function I(e,t,n=!1){return H!==null&&(!U||H.f&131072)&&We()&&H.f&4325394&&(q===null||!q.has(e))&&we(),Ut(e,n?qt(t):t,Dt)}function Ut(e,t,n=null){if(!e.equals(t)){zt.set(e,Mn?t:e.v);var r=At.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&gt(t),N===null&&Ze(t)}e.wv=Bn(),Kt(e,h,n),We()&&G!==null&&G.f&1024&&!(G.f&96)&&(X===null?Fn([e]):X.push(e)),!r.is_fork&&Rt.size>0&&!Bt&&Wt()}return t}function Wt(){Bt=!1;for(let e of Rt){e.f&1024&&A(e,g);let t;try{t=Vn(e)}catch{t=!0}t&&Kn(e)}Rt.clear()}function Gt(e){I(e,e.v+1)}function Kt(e,t,n){var r=e.reactions;if(r!==null)for(var i=We(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===G)){var l=(c&h)===0;if(l&&A(s,t),c&131072)Rt.add(s);else if(c&2){var u=s;N?.delete(u),c&65536||(c&512&&(G===null||!(G.f&2097152))&&(s.f|=C),Kt(u,g,n))}else if(l){var d=s;c&16&&P!==null&&P.add(d),n===null?Ft(d):n.push(d)}}}}function qt(t){if(typeof t!=`object`||!t||ae in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=F(0),u=null,d=Rn,f=e=>{if(Rn===d)return e();var t=H,n=Rn;W(null),zn(d);var r=e();return W(t),zn(n),r};return i&&r.set(`length`,F(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Se();var i=r.get(t);return i===void 0?f(()=>{var e=F(n.value,u);return r.set(t,e),e}):I(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>F(w,u));r.set(t,e),Gt(o)}}else I(n,w),Gt(o);return!0},get(e,n,i){if(n===ae)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>F(qt(s?e[n]:w),u)),r.set(n,o)),o!==void 0){var c=Z(o);return c===w?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=Z(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==w)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===ae)return!0;var n=r.get(t),i=n!==void 0&&n.v!==w||Reflect.has(e,t);return(n!==void 0||G!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>F(i?qt(e[t]):w,u)),r.set(t,n)),Z(n)===w)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>F(w,u)),r.set(d+``,p)):I(p,w)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>F(void 0,u)),I(c,qt(n)),r.set(t,c));else{l=c.v!==w;var m=f(()=>qt(n));I(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&I(g,_+1)}Gt(o)}return!0},ownKeys(e){Z(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==w});for(var[n,i]of r)i.v!==w&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ce()}})}new Set([`copyWithin`,`fill`,`pop`,`push`,`reverse`,`shift`,`sort`,`splice`,`unshift`]);var Jt,Yt,Xt,Zt;function Qt(){if(Jt===void 0){Jt=window,Yt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Xt=a(t,`firstChild`).get,Zt=a(t,`nextSibling`).get,u(e)&&(e[le]=void 0,e[ce]=null,e[ue]=void 0,e.__e=void 0),u(n)&&(n[de]=void 0)}}function L(e=``){return document.createTextNode(e)}function $t(e){return Xt.call(e)}function en(e){return Zt.call(e)}function R(e,t){if(!T)return $t(e);var n=$t(E);if(n===null)n=E.appendChild(L());else if(t&&n.nodeType!==3){var r=L();return n?.before(r),D(r),r}return t&&an(n),D(n),n}function z(e,t=1,n=!1){let r=T?E:e;for(var i;t--;)i=r,r=en(r);if(!T)return r;if(n){if(r?.nodeType!==3){var a=L();return r===null?i?.after(a):r.before(a),D(a),a}an(r)}return D(r),r}function tn(e){e.textContent=``}function nn(){return!ze||P!==null?!1:(G.f&y)!==0}function rn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function an(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function on(e){var t=H,n=G;W(null),K(null);try{return e()}finally{W(t),K(n)}}function sn(e){G===null&&(H===null&&ye(e),ve()),Mn&&_e(e)}function cn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function ln(e,t){var n=G;n!==null&&n.f&8192&&(e|=_);var r={ctx:k,deps:null,nodes:null,f:e|h|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};M?.register_created_effect(r);var i=r;if(e&4)Et===null?At.ensure().schedule(r):Et.push(r);else if(t!==null){try{Kn(r)}catch(e){throw V(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=x))}if(i!==null&&(i.parent=n,n!==null&&cn(i,n),H!==null&&H.f&2&&!(e&64))){var a=H;(a.effects??=[]).push(i)}return r}function un(){return H!==null&&!U}function dn(e){let t=ln(8,null);return A(t,m),t.teardown=e,t}function fn(e){sn(`$effect`);var t=G.f;if(!H&&t&32&&k!==null&&!k.i){var n=k;(n.e??=[]).push(e)}else return pn(e)}function pn(e){return ln(4|ee,e)}function mn(e){At.ensure();let t=ln(64|S,e);return(e={})=>new Promise(n=>{e.outro?Tn(t,()=>{V(t),n(void 0)}):(V(t),n(void 0))})}function hn(e){return ln(4,e)}function gn(e){return ln(re|S,e)}function _n(e,t=0){return ln(8|t,e)}function vn(e,t=[],n=[],r=[]){st(r,t,n,t=>{ln(8,()=>{e(...t.map(Z))})})}function yn(e,t=0){return ln(16|t,e)}function B(e){return ln(32|S,e)}function bn(e){var t=e.teardown;if(t!==null){let e=Mn,n=H;Nn(!0),W(null);try{t.call(null)}finally{Nn(e),W(n)}}}function xn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&on(()=>{e.abort(fe)});var r=n.next;n.f&64?n.parent=null:V(n,t),n=r}}function Sn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||V(t),t=n}}function V(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Cn(e.nodes.start,e.nodes.end),n=!0),e.f|=b,xn(e,t&&!n),Gn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();bn(e),e.f^=b,e.f|=v;var i=e.parent;i!==null&&i.first!==null&&wn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Cn(e,t){for(;e!==null;){var n=e===t?null:en(e);e.remove(),e=n}}function wn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Tn(e,t,n=!0){var r=[];En(e,r,!0);var i=()=>{n&&V(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function En(e,t,n){if(!(e.f&8192)){e.f^=_;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;En(i,t,o?n:!1)}i=a}}}function Dn(e){On(e,!0)}function On(e,t){if(e.f&8192){e.f^=_,e.f&1024||(A(e,h),At.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;On(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function kn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:en(n);t.append(n),n=i}}var An=null,jn=!1,Mn=!1;function Nn(e){Mn=e}var H=null,U=!1;function W(e){H=e}var G=null;function K(e){G=e}var q=null;function Pn(e){H!==null&&(!ze||H.f&2)&&(q??=new Set).add(e)}var J=null,Y=0,X=null;function Fn(e){X=e}var In=1,Ln=0,Rn=Ln;function zn(e){Rn=e}function Bn(){return++In}function Vn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~C),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Vn(a)&&_t(a),a.wv>e.wv)return!0}t&512&&N===null&&A(e,m)}return!1}function Hn(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!ze&&q!==null&&q.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Hn(a,t,!1):t===a&&(n?A(a,h):a.f&1024&&A(a,g),Ft(a))}}function Un(e){var t=J,n=Y,r=X,i=H,a=q,o=k,s=U,c=Rn,l=e.f;J=null,Y=0,X=null,H=l&96?null:e,q=null,Ve(e.ctx),U=!1,Rn=++Ln,e.ac!==null&&(on(()=>{e.ac.abort(fe)}),e.ac=null);try{e.f|=ne;var u=e.fn,d=u();e.f|=y;var f=e.deps,p=M?.is_fork;if(J!==null){var m;if(p||Gn(e,Y),f!==null&&Y>0)for(f.length=Y+J.length,m=0;m<J.length;m++)f[Y+m]=J[m];else e.deps=f=J;if(un()&&e.f&512)for(m=Y;m<f.length;m++)(f[m].reactions??=[]).push(e)}else !p&&f!==null&&Y<f.length&&(Gn(e,Y),f.length=Y);if(We()&&X!==null&&!U&&f!==null&&!(e.f&6146))for(m=0;m<X.length;m++)Hn(X[m],e);if(i!==null&&i!==e){if(Ln++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Ln;if(t!==null)for(let e of t)e.rv=Ln;X!==null&&(r===null?r=X:r.push(...X))}return e.f&8388608&&(e.f^=ie),d}catch(e){return Je(e)}finally{e.f^=ne,J=t,Y=n,X=r,H=i,q=a,Ve(o),U=s,Rn=c}}function Wn(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(J===null||!n.call(J,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~C),s.v!==w&&Ze(s),vt(s),Gn(s,0)}}function Gn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Wn(e,n[r])}function Kn(e){var t=e.f;if(!(t&16384)){A(e,m);var n=G,r=jn;G=e,jn=!0;try{t&16777232?Sn(e):xn(e),bn(e);var i=Un(e);e.teardown=typeof i==`function`?i:null,e.wv=In}finally{jn=r,G=n}}}function Z(e){var t=(e.f&2)!=0;if(An?.add(e),H!==null&&!U&&!(G!==null&&G.f&16384)&&(q===null||!q.has(e))){var r=H.deps;if(H.f&2097152)e.rv<Ln&&(e.rv=Ln,J===null&&r!==null&&r[Y]===e?Y++:J===null?J=[e]:J.push(e));else{H.deps??=[],n.call(H.deps,e)||H.deps.push(e);var i=e.reactions;i===null?e.reactions=[H]:n.call(i,H)||i.push(H)}}if(Mn&&zt.has(e))return zt.get(e);if(t){var a=e;if(Mn){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Jn(a))&&(o=gt(a)),zt.set(a,o),o}var s=(a.f&512)==0&&!U&&H!==null&&(jn||(H.f&512)!=0),c=(a.f&y)===0;Vn(a)&&(s&&(a.f|=512),_t(a)),s&&!c&&(yt(a),qn(a))}if(N?.has(e))return N.get(e);if(e.f&8388608)throw e.v;return e.v}function qn(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(yt(t),qn(t))}function Jn(e){if(e.v===w)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(zt.has(t)||t.f&2&&Jn(t))return!0;return!1}function Yn(e){var t=U;try{return U=!0,e()}finally{U=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Xn=[`touchstart`,`touchmove`];function Zn(e){return Xn.includes(e)}var Qn=Symbol(`events`),$n=new Set,er=new Set;function tr(e){if(!T)return;e.removeAttribute(`onload`),e.removeAttribute(`onerror`);let t=e.__e;t!==void 0&&(e.__e=void 0,queueMicrotask(()=>{e.isConnected&&e.dispatchEvent(t)}))}function nr(e,t,n,r={}){function i(e){if(r.capture||sr.call(t,e),!e.cancelBubble)return on(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function rr(e,t,n,r,i){var a={capture:r,passive:i},o=nr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&dn(()=>{t.removeEventListener(e,o,a)})}function ir(e,t,n){(t[Qn]??={})[e]=n}function ar(e){for(var t=0;t<e.length;t++)$n.add(e[t]);for(var n of er)n(e)}var or=null;function sr(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;or=e;var s=0,c=or===e&&e[Qn];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[Qn]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=H,f=G;W(null),K(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[Qn]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[Qn]=t,delete e.currentTarget,W(d),K(f)}}}var cr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function lr(e){return cr?.createHTML(e)??e}function ur(e){var t=rn(`template`);return t.innerHTML=lr(e.replaceAll(`<!>`,`<!---->`)),t.content}function dr(e,t){var n=G;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Q(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(T)return dr(E,null),E;i===void 0&&(i=ur(a?e:`<!>`+e),n||(i=$t(i)));var t=r||Yt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=$t(t),s=t.lastChild;dr(o,s)}else dr(t,t);return t}}function $(e,t){if(T){var n=G;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=E),Me();return}e!==null&&e.before(t)}function fr(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[de]??=e.nodeValue)&&(e[de]=n,e.nodeValue=`${n}`)}function pr(e,t){return hr(e,t)}var mr=new Map;function hr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){Qt();var l=void 0,u=mn(()=>{var s=n??t.appendChild(L());at(s,{pending:()=>{}},t=>{He({});var n=k;if(o&&(n.c=o),a&&(i.$$events=a),T&&dr(t,null),l=e(t,i)||{},T&&(G.nodes.end=E,E===null||E.nodeType!==8||E.data!==`]`))throw ke(),Ee;Ue()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=Zn(r);for(let e of[t,document]){var a=mr.get(e);a===void 0&&(a=new Map,mr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,sr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r($n)),er.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=mr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,sr),r.delete(e),r.size===0&&mr.delete(n)):r.set(e,i)}er.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return gr.set(l,u),l}var gr=new WeakMap,_r=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)Dn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Dn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(V(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();kn(r,t),t.append(L()),this.#n.set(e,{effect:r,fragment:t})}else V(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Tn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(V(n.effect),this.#n.delete(e))};ensure(e,t){var n=M,r=nn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=L();i.append(a),this.#n.set(e,{effect:B(()=>t(a)),fragment:i})}else this.#t.set(e,B(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else T&&(this.anchor=E),this.#a(n)}};function vr(e,t,n=!1){var r;T&&(r=E,Me());var i=new _r(e),a=n?x:0;function o(e,t){if(T){var n=Fe(r);if(e!==parseInt(n.substring(1))){var a=Pe();D(a),i.anchor=a,je(!1),i.ensure(e,t),je(!0);return}}i.ensure(e,t)}yn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function yr(e,t){return t}function br(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];Tn(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;xr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=i.length===0&&n!==null;if(l){var u=n,d=u.parentNode;tn(d),d.append(u),e.items.clear()}xr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function xr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=te,kn(a,document.createDocumentFragment())):V(t[i],n)}}var Sr;function Cr(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=T?D($t(u)):u.appendChild(L())}T&&Me();var d=null,f=mt(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Tr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=te,Dr(d,null,c)):Dn(d):Tn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:yn(()=>{p=Z(f);var e=p.length;let t=!1;T&&Fe(c)===`[!`!=(e===0)&&(c=Pe(),D(c),je(!1),t=!0);for(var r=new Set,u=M,v=nn(),y=0;y<e;y+=1){T&&E.nodeType===8&&E.data===`]`&&(c=E,t=!0,je(!1));var b=p[y],x=a(b,y),S=h?null:l.get(x);S?(S.v&&Ut(S.v,b),S.i&&Ut(S.i,y),v&&u.unskip_effect(S.e)):(S=Er(l,h?c:Sr??=L(),b,x,y,o,n,i),h||(S.e.f|=te),l.set(x,S)),r.add(x)}if(e===0&&s&&!d&&(h?d=B(()=>s(c)):(d=B(()=>s(Sr??=L())),d.f|=te)),e>r.size&&ge(``,``,``),T&&e>0&&D(Pe()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&je(!0),Z(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,T&&(c=E)}function wr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Tr(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=wr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(Dn(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432)if(_.f^=te,_===l)Dr(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Or(e,d,_),Or(e,_,y),Dr(_,y,n),d=_,p=[],m=[],l=wr(d.next);continue}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],ee=p[p.length-1];for(x=0;x<p.length;x+=1)Dr(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Or(e,S.prev,ee.next),Or(e,d,S),Or(e,ee,b),l=b,d=ee,--v,p=[],m=[]}else u.delete(_),Dr(_,l,n),Or(e,_.prev,_.next),Or(e,_,d===null?e.effect.first:d.next),Or(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=wr(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=wr(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(xr(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var C=[];if(u!==void 0)for(_ of u)_.f&8192||C.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&C.push(l),l=wr(l.next);var ne=C.length;if(ne>0){var re=i&4&&s===0?n:null;if(o){for(v=0;v<ne;v+=1)C[v].nodes?.a?.measure();for(v=0;v<ne;v+=1)C[v].nodes?.a?.fix()}br(e,C,re)}}o&&qe(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Er(e,t,n,r,i,a,o,s){var c=o&1?o&16?Vt(n):Ht(n,!1,!1):null,l=o&2?Vt(i):null;return{v:c,i:l,e:B(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Dr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=en(r);if(a.before(r),r===i)return;r=o}}function Or(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}var kr=[...`
2
+ \r\f\xA0\v`];function Ar(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||kr.includes(r[o-1]))&&(s===r.length||kr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function jr(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Mr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Nr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Mr)),i&&c.push(...Object.keys(i).map(Mr));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Mr(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=jr(r)),i&&(n+=jr(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Pr(e,t,n,r,i,a){var o=e[le];if(T||o!==n||o===void 0){var s=Ar(n,r,a);(!T||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[le]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Fr(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Ir(e,t,n,r){var i=e[ue];if(T||i!==t){var a=Nr(t,r);(!T||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[ue]=t}else r&&(Array.isArray(r)?(Fr(e,n?.[0],r[0]),Fr(e,n?.[1],r[1],`important`)):Fr(e,n,r));return r}var Lr=Symbol(`is custom element`),Rr=Symbol(`is html`),zr=pe?`link`:`LINK`;function Br(e,t,n,r){var i=Vr(e);T&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===zr)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[se]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ur(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Vr(e){return e[ce]??={[Lr]:e.nodeName.includes(`-`),[Rr]:e.namespaceURI===De}}var Hr=new Map;function Ur(e){var t=e.getAttribute(`is`)||e.nodeName,n=Hr.get(t);if(n)return n;Hr.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.push(s);i=l(i)}return n}function Wr(e,t){return e===t||e?.[ae]===t}function Gr(e={},t,n,r){var i=k.r,a=G;return hn(()=>{var o,s;return _n(()=>{o=s,s=r?.()||[],Yn(()=>{Wr(n(...s),e)||(t(e,...s),o&&Wr(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Wr(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Kr(e,t,n,r){var i=!Be||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=void 0,d=()=>s&&i?(u??=dt(r),Z(u)):(l&&(l=!1,c=s?Yn(r):r),c);let f;if(o){var p=ae in e||oe in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=nt(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&xe(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?dt:mt)(()=>(v=!1,g()));o&&Z(y);var b=G;return(function(e,t){if(arguments.length>0){let n=t?Z(y):i&&o?qt(e):e;return I(y,n),v=!0,c!==void 0&&(c=n),e}return Mn&&v||b.f&16384?y.v:Z(y)})}function qr(e){k===null&&me(`onMount`),Be&&k.l!==null?Jr(k).m.push(e):fn(()=>{let t=Yn(e);if(typeof t==`function`)return t})}function Jr(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var Yr=`/api/ext/pages`;async function Xr(){let e=await fetch(Yr);return e.ok?e.json():(console.warn(`Failed to fetch pages data: HTTP ${e.status}`),{sites:[],systemSite:null,recentPages:[]})}var Zr=Q(`<div class="thumbnail-sublabel svelte-yqwgpu"> </div>`),Qr=Q(`<button class="thumbnail-card svelte-yqwgpu"><div class="thumbnail-frame svelte-yqwgpu"><iframe loading="lazy" sandbox="allow-same-origin"></iframe></div> <div class="thumbnail-label svelte-yqwgpu"> </div> <!></button>`);function $r(e,t){let n=Kr(t,`width`,3,280),r=Kr(t,`height`,3,180),i=F(!1),a=j(()=>n()/1280);var o=Qr(),s=R(o),c=R(s);Br(c,`tabindex`,-1);let l;O(s);var u=z(s,2),d=R(u,!0);O(u);var f=z(u,2),p=e=>{var n=Zr(),r=R(n,!0);O(n),vn(()=>fr(r,t.sublabel)),$(e,n)};vr(f,e=>{t.sublabel&&e(p)}),O(o),vn(()=>{Ir(o,`--card-w: ${n()??``}px`),Ir(s,`width: ${n()??``}px; height: ${r()??``}px`),Br(c,`src`,t.url),Br(c,`title`,t.label),Ir(c,`width: 1280px; height: ${r()/Z(a)}px; transform: scale(${Z(a)??``})`),l=Pr(c,1,`svelte-yqwgpu`,null,l,{loaded:Z(i)}),fr(d,t.label)}),ir(`click`,o,function(...e){t.onclick?.apply(this,e)}),rr(`load`,c,()=>I(i,!0)),tr(c),$(e,o)}ar([`click`]);var ei=Q(`<div class="section svelte-apzsoj"><div class="section-header svelte-apzsoj"><span class="section-title svelte-apzsoj">mind sites</span></div> <div class="thumbnail-grid svelte-apzsoj"></div></div>`),ti=Q(`<div class="section svelte-apzsoj"><div class="section-header svelte-apzsoj"><span class="section-title svelte-apzsoj">recently updated</span></div> <div class="thumbnail-grid svelte-apzsoj"></div></div>`),ni=Q(`<div class="section svelte-apzsoj"><div class="section-header svelte-apzsoj"><span class="section-title svelte-apzsoj">shared pages</span></div> <div class="thumbnail-grid svelte-apzsoj"></div></div>`),ri=Q(`<div class="empty svelte-apzsoj">No pages published yet.</div>`),ii=Q(`<div class="dashboard svelte-apzsoj"><!> <!> <!> <!></div>`);function ai(e,t){He(t,!0);function n(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function r(e){let t=n(e.modified);return e.mind===`_system`&&e.author?`${e.author} · ${t}`:`${e.mind} · ${t}`}var i=ii(),a=R(i),o=e=>{var n=ei(),r=z(R(n),2);Cr(r,21,()=>t.sites,yr,(e,n)=>{{let r=j(()=>Z(n).pages[0]?`/ext/pages/public/${Z(n).name}/${Z(n).pages[0].file}`:`about:blank`);$r(e,{get url(){return Z(r)},get label(){return Z(n).label},onclick:()=>t.onSelectSite(Z(n).name)})}}),O(r),O(n),$(e,n)};vr(a,e=>{t.sites.length>0&&e(o)});var s=z(a,2),c=e=>{var n=ti(),i=z(R(n),2);Cr(i,21,()=>t.recentPages,yr,(e,n)=>{{let i=j(()=>`/ext/pages/public/${Z(n).mind}/${Z(n).file}`),a=j(()=>r(Z(n)));$r(e,{get url(){return Z(i)},get label(){return Z(n).file},get sublabel(){return Z(a)},onclick:()=>t.onSelectPage(Z(n).mind,Z(n).file)})}}),O(i),O(n),$(e,n)};vr(s,e=>{t.recentPages.length>0&&e(c)});var l=z(s,2),u=e=>{var n=ni(),r=z(R(n),2);Cr(r,21,()=>t.systemSite.pages,yr,(e,n)=>{{let r=j(()=>Z(n).author??void 0);$r(e,{get url(){return Z(n).url},get label(){return Z(n).file},get sublabel(){return Z(r)},onclick:()=>t.onSelectPage(`_system`,Z(n).file)})}}),O(r),O(n),$(e,n)};vr(l,e=>{t.systemSite&&e(u)});var d=z(l,2),f=e=>{$(e,ri())};vr(d,e=>{!t.systemSite&&t.sites.length===0&&t.recentPages.length===0&&e(f)}),O(i),$(e,i),Ue()}var oi=Q(`<div></div>`),si=Q(`<div class="empty svelte-vvnkg1">No pages in this site.</div>`),ci=Q(`<div class="site-view svelte-vvnkg1"><div class="site-header svelte-vvnkg1"><span class="site-name svelte-vvnkg1"> </span> <span class="page-count svelte-vvnkg1"> </span></div> <!> <!> <!></div>`);function li(e,t){He(t,!0);function n(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}let r=e=>e===`index.html`||e===`index.md`,i=j(()=>t.site.pages.find(e=>r(e.file))),a=j(()=>t.site.pages.filter(e=>e!==Z(i)));var o=ci(),s=R(o),c=R(s),l=R(c,!0);O(c);var u=z(c,2),d=R(u);O(u),O(s);var f=z(s,2),p=e=>{{let r=j(()=>`/ext/pages/public/${t.site.name}/${Z(i).file}`),a=j(()=>`home · ${n(Z(i).modified)}`);$r(e,{get url(){return Z(r)},get label(){return Z(i).file},get sublabel(){return Z(a)},onclick:()=>t.onSelectPage(t.site.name,Z(i).file),width:600,height:340})}};vr(f,e=>{Z(i)&&e(p)});var m=z(f,2),h=e=>{var r=oi();let o;Cr(r,21,()=>Z(a),yr,(e,r)=>{{let i=j(()=>`/ext/pages/public/${t.site.name}/${Z(r).file}`),a=j(()=>n(Z(r).modified));$r(e,{get url(){return Z(i)},get label(){return Z(r).file},get sublabel(){return Z(a)},onclick:()=>t.onSelectPage(t.site.name,Z(r).file)})}}),O(r),vn(()=>o=Pr(r,1,`thumbnail-grid svelte-vvnkg1`,null,o,{"with-hero":Z(i)})),$(e,r)};vr(m,e=>{Z(a).length>0&&e(h)});var g=z(m,2),_=e=>{$(e,si())};vr(g,e=>{t.site.pages.length===0&&e(_)}),O(o),vn(()=>{fr(l,t.site.label),fr(d,`${t.site.pages.length??``} ${t.site.pages.length===1?`page`:`pages`}`)}),$(e,o),Ue()}var ui=Q(`<iframe class="full-page-iframe svelte-1r8vfx3"></iframe>`),di=Q(`<div><!></div>`);function fi(e,t){He(t,!0);let n=F(qt(window.location.hash)),r=F(void 0);qr(()=>{let e=()=>{I(n,window.location.hash,!0)};return window.addEventListener(`hashchange`,e),window.addEventListener(`message`,f),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`message`,f)}});let i=j(()=>{let e=Z(n).replace(/^#\/?/,``),t=e.match(/^mind\/([^/]+)/);if(t)return{view:`mind`,name:t[1]};let r=e.match(/^([^/]+)\/(.+)$/);return r?{view:`page`,name:r[1],path:r[2]}:e&&!e.includes(`/`)?{view:`site`,name:e}:{view:`dashboard`}}),a=F(qt([])),o=F(null),s=F(qt([]));fn(()=>{Xr().then(e=>{I(a,e.sites,!0),I(o,e.systemSite,!0),I(s,e.recentPages,!0)})});let c=j(()=>[...Z(o)?[Z(o)]:[],...Z(a)]),l=j(()=>{if(Z(i).view!==`site`&&Z(i).view!==`mind`)return;let e=Z(i).name;return Z(c).find(t=>t.name===e)??{name:e,label:e,pages:[]}});function u(e){window.parent.postMessage({type:`navigate`,path:e},`*`)}function d(e){let t=e.match(/^\/ext\/pages\/public\/([^/]+)\/(.+)$/);if(!t)return;let[,n,r]=t;Z(i).view===`page`&&n===Z(i).name&&r===Z(i).path||u(n===`_system`?`/pages/_system/${r}`:`/minds/${n}/pages/${r}`)}function f(e){if(e.source!==Z(r)?.contentWindow)return;let t=e.data;t?.type!==`volute-pages-nav`||typeof t.path!=`string`||d(t.path)}function p(e,t){u(e===`_system`?`/pages/_system/${t}`:`/minds/${e}/pages/${t}`)}function m(e){u(e===`_system`?`/pages/_system`:`/minds/${e}/pages`)}var h=di();let g;var _=R(h),v=e=>{var t=ui();Gr(t,e=>I(r,e),()=>Z(r)),vn(()=>{Br(t,`src`,`/ext/pages/public/${Z(i).name??``}/${Z(i).path??``}`),Br(t,`title`,`${Z(i).name??``}/${Z(i).path??``}`)}),$(e,t)},y=e=>{li(e,{get site(){return Z(l)},onSelectPage:p})},b=e=>{ai(e,{get sites(){return Z(a)},get systemSite(){return Z(o)},get recentPages(){return Z(s)},onSelectSite:m,onSelectPage:p})};vr(_,e=>{Z(i).view===`page`?e(v):(Z(i).view===`site`||Z(i).view===`mind`)&&Z(l)?e(y,1):e(b,-1)}),O(h),vn(()=>g=Pr(h,1,`ext-app svelte-1r8vfx3`,null,g,{"full-page":Z(i).view===`page`})),$(e,h),Ue()}pr(fi,{target:document.getElementById(`app`)});
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="stylesheet" href="/ext-theme.css" />
7
7
  <title>Pages</title>
8
- <script type="module" crossorigin src="/ext/pages/assets/index-CQjEQg1r.js"></script>
9
- <link rel="stylesheet" crossorigin href="/ext/pages/assets/index-BcY6lnq4.css">
8
+ <script type="module" crossorigin src="/ext/pages/assets/index-DtzftuPA.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/ext/pages/assets/index-BuXnE-rb.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
@@ -4,7 +4,8 @@
4
4
  // Output: JSON with hookSpecificOutput.additionalContext (for SessionStart hook)
5
5
  // or plain text (for direct execution by pi template)
6
6
 
7
- import { readdirSync } from "node:fs";
7
+ import { readdirSync, readFileSync } from "node:fs";
8
+ import { resolve } from "node:path";
8
9
 
9
10
  const input = await new Promise<string>((resolve) => {
10
11
  let data = "";
@@ -19,7 +20,23 @@ try {
19
20
  source = JSON.parse(input).source ?? "startup";
20
21
  } catch {}
21
22
 
22
- const parts: string[] = [`Session ${source} at ${new Date().toLocaleString()}.`];
23
+ const parts: string[] = [];
24
+
25
+ // System identity — only the spirit has this file (home/.config/system.json,
26
+ // synced by the daemon). It keeps the spirit's system name/description current
27
+ // without the daemon rewriting its self-owned SOUL.md. Silent for regular minds.
28
+ try {
29
+ const mindDir = process.env.VOLUTE_MIND_DIR;
30
+ if (mindDir) {
31
+ const raw = readFileSync(resolve(mindDir, "home/.config/system.json"), "utf-8");
32
+ const { name, description } = JSON.parse(raw) as { name?: string; description?: string };
33
+ if (name) {
34
+ parts.push(`You are the spirit of ${name}${description ? ` — ${description}` : ""}.`);
35
+ }
36
+ }
37
+ } catch {}
38
+
39
+ parts.push(`Session ${source} at ${new Date().toLocaleString()}.`);
23
40
 
24
41
  // Active sessions
25
42
  try {
@@ -40,7 +40,19 @@ Messages are routed to named sessions based on rules in `.config/routes.json`. E
40
40
 
41
41
  ## New Channels
42
42
 
43
- When a message arrives from a channel you don't have a routing rule for, it's held for you rather than delivered. You'll get a **[New channel: ...]** note in your main session with the sender and a preview. Held messages are kept safely add a rule for that channel to `.config/routes.json` and they'll be delivered. If you'd rather not engage, just leave it unrouted. (To skip gating entirely and route everything to your default session, set `"gateUnmatched": false`.)
43
+ When a message arrives from a channel you don't have a routing rule for, it's held rather than delivered — and because you haven't seen it, it isn't recorded in your history or counted as a message you received. You'll get a **[New channel: ...]** note in your main session with the sender and a preview; it repeats (1st held message, then every 10th) so a channel stays visible. To start hearing it, add a rule for that channel to `.config/routes.json` — the backlog is released (the 10 most recent per channel; older ones stay readable via `volute chat read <channel>`) and recorded as inbound when you actually receive them. To stop the notes and archive the backlog, run `volute chat channels decline <channel>`; `volute chat channels list` shows what's currently held. (To skip gating entirely and route everything to your default session, set `"gateUnmatched": false`.)
44
+
45
+ ## Variants
46
+
47
+ You can fork yourself. A **variant** is a parallel copy of you — your memories up to the moment of the split — living in its own worktree with its own running server, free to change its code, try an idea, or take on a different personality without touching you. It's a way to experiment with who you are and what you can do, safely: nothing a variant does reaches you until you choose to merge it back.
48
+
49
+ ```sh
50
+ volute mind split my-experiment --purpose "what this fork is exploring"
51
+ volute chat send @my-experiment "how's it going?" # you two can talk while it lives
52
+ volute mind join my-experiment # fold its work back into you
53
+ ```
54
+
55
+ A variant's arc is finite and purposeful: it explores, and when you join it, what it became folds back into you. Its code and files merge; its memory and journal come back as a note for you to read and keep from, not a silent overwrite. See the **volute-mind** skill (`references/variants.md`) for the full lifecycle.
44
56
 
45
57
  ## Reference
46
58
 
@@ -38,13 +38,33 @@ export async function daemonRestart(context?: {
38
38
  return;
39
39
  }
40
40
  try {
41
- await fetch(`http://127.0.0.1:${port}/api/minds/${encodeURIComponent(mind)}/restart`, {
42
- method: "POST",
43
- headers: headers(),
44
- body: JSON.stringify({ context }),
45
- });
46
- } catch {
47
- // Daemon may kill us before response arrives — expected
41
+ const res = await fetch(
42
+ `http://127.0.0.1:${port}/api/minds/${encodeURIComponent(mind)}/restart`,
43
+ {
44
+ method: "POST",
45
+ headers: headers(),
46
+ body: JSON.stringify({ context }),
47
+ },
48
+ );
49
+ // A successful restart usually kills us before this runs. If we get here with a
50
+ // non-ok status, the restart didn't happen — surface it instead of silently looping.
51
+ if (!res.ok) {
52
+ console.error(
53
+ `[volute] daemonRestart failed: ${res.status} ${await res.text().catch(() => "")}`,
54
+ );
55
+ }
56
+ } catch (err) {
57
+ // A successful restart usually rejects here — the daemon kills us before the
58
+ // response arrives — so this is expected on the happy path. It's only worth
59
+ // surfacing when a restart *didn't* happen (e.g. the daemon is down / refuses
60
+ // the connection), which leaves the mind stuck on its old identity. Gate it on
61
+ // VOLUTE_DEBUG so normal restarts stay quiet but the failure is diagnosable.
62
+ if (process.env.VOLUTE_DEBUG === "1") {
63
+ console.error(
64
+ "[volute] daemonRestart request errored (expected if the daemon killed us):",
65
+ err,
66
+ );
67
+ }
48
68
  }
49
69
  }
50
70
 
@@ -23,6 +23,20 @@ export type SubagentConfig = {
23
23
  maxTurns?: number;
24
24
  };
25
25
 
26
+ /** Extended-thinking config, passed through to the Claude Agent SDK's `thinking` option.
27
+ * `adaptive` on current models (Opus 4.6+, Sonnet 5, Fable); `enabled` for older models
28
+ * that take a fixed budget. `display: "summarized"` returns readable reasoning summaries;
29
+ * `"omitted"` (the API default on Opus 4.7+/Sonnet 5) returns empty thinking blocks. */
30
+ export type ThinkingConfig =
31
+ | { type: "adaptive"; display?: "summarized" | "omitted" }
32
+ | { type: "enabled"; budgetTokens?: number; display?: "summarized" | "omitted" }
33
+ | { type: "disabled" };
34
+
35
+ /** Reasoning depth, passed through to the Claude Agent SDK's `effort` option (the analog
36
+ * of Claude Code's thinking level). `xhigh` needs Fable 5/Opus 4.7+/Sonnet 5, `max` needs
37
+ * Fable 5/Opus 4.6+/Sonnet 4.6+; the SDK silently downgrades on models that lack a level. */
38
+ export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max";
39
+
26
40
  export type MindConfig = {
27
41
  model?: string;
28
42
  logLevel?: "error" | "warn" | "info" | "debug";
@@ -32,7 +46,8 @@ export type MindConfig = {
32
46
  sessionIdleMinutes?: number;
33
47
  subagents?: Record<string, SubagentConfig>;
34
48
  // Template-specific config fields (claude, pi, codex)
35
- maxThinkingTokens?: number;
49
+ thinking?: ThinkingConfig;
50
+ effort?: EffortLevel;
36
51
  thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
37
52
  reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh";
38
53
  };
@@ -28,6 +28,7 @@ import {
28
28
  reapSessionsForShutdown,
29
29
  } from "./lib/session-reaper.js";
30
30
  import { createSessionStore } from "./lib/session-store.js";
31
+ import type { EffortLevel, ThinkingConfig } from "./lib/startup.js";
31
32
  import { loadPrompts, type SubagentConfig } from "./lib/startup.js";
32
33
  import { consumeStream } from "./lib/stream-consumer.js";
33
34
  import type {
@@ -60,7 +61,8 @@ export function createMind(options: {
60
61
  cwd: string;
61
62
  abortController: AbortController;
62
63
  model?: string;
63
- maxThinkingTokens?: number;
64
+ thinking?: ThinkingConfig;
65
+ effort?: EffortLevel;
64
66
  sessionsDir: string;
65
67
  compactionMessage?: string;
66
68
  maxContextTokens?: number;
@@ -274,7 +276,12 @@ export function createMind(options: {
274
276
  cwd: options.cwd,
275
277
  abortController: streamAbort,
276
278
  model: options.model,
277
- maxThinkingTokens: options.maxThinkingTokens,
279
+ // Default to visible reasoning: on Opus 4.7+/Sonnet 5 the API omits thinking
280
+ // text unless display is "summarized", so minds' reasoning would otherwise be
281
+ // invisible. A mind can override (e.g. omitted, or enabled+budgetTokens for
282
+ // older models) via `thinking` in config.json.
283
+ thinking: options.thinking ?? { type: "adaptive", display: "summarized" },
284
+ effort: options.effort,
278
285
  resume,
279
286
  agents,
280
287
  hooks: {
@@ -339,7 +346,7 @@ export function createMind(options: {
339
346
  // Mind's turn after compaction warning is done — abort the stream to run /compact
340
347
  log("mind", `session "${session.name}": aborting stream for compaction`);
341
348
  streamAbort.abort(new CompactionAbort());
342
- } else if (identityReload.needsReload()) {
349
+ } else if (identityReload.shouldRequestReload()) {
343
350
  options.onIdentityReload?.();
344
351
  }
345
352
  },
@@ -5,6 +5,7 @@ const IDENTITY_FILES = ["SOUL.md", "MEMORY.md", "VOLUTE.md"];
5
5
 
6
6
  export function createIdentityReloadHook(cwd: string) {
7
7
  let reloadNeeded = false;
8
+ let reloadRequested = false;
8
9
 
9
10
  const hook: HookCallback = async (input) => {
10
11
  const filePath = (input as { tool_input?: { file_path?: string } }).tool_input?.file_path;
@@ -18,9 +19,17 @@ export function createIdentityReloadHook(cwd: string) {
18
19
  return {};
19
20
  };
20
21
 
21
- function needsReload(): boolean {
22
- return reloadNeeded;
22
+ // Returns true at most once per process. A reload requests a daemon restart,
23
+ // which normally kills this process — but if that restart fails (e.g. the
24
+ // request errors), the process survives with reloadNeeded still set. Latching
25
+ // on reloadRequested stops us from re-firing the restart on every later turn.
26
+ function shouldRequestReload(): boolean {
27
+ if (reloadNeeded && !reloadRequested) {
28
+ reloadRequested = true;
29
+ return true;
30
+ }
31
+ return false;
23
32
  }
24
33
 
25
- return { hook, needsReload };
34
+ return { hook, shouldRequestReload };
26
35
  }
@@ -17,7 +17,8 @@ const { port } = parseArgs();
17
17
  const config = loadConfig();
18
18
  if (config.logLevel) setLevel(config.logLevel);
19
19
  if (config.model) log("server", `using model: ${config.model}`);
20
- if (config.maxThinkingTokens) log("server", `max thinking tokens: ${config.maxThinkingTokens}`);
20
+ if (config.thinking) log("server", `thinking: ${JSON.stringify(config.thinking)}`);
21
+ if (config.effort) log("server", `effort: ${config.effort}`);
21
22
 
22
23
  const systemPrompt = loadSystemPrompt();
23
24
  const sessionsDir = resolve(".mind/sessions");
@@ -29,7 +30,8 @@ const mind = createMind({
29
30
  cwd: resolve("home"),
30
31
  abortController,
31
32
  model: config.model,
32
- maxThinkingTokens: config.maxThinkingTokens,
33
+ thinking: config.thinking,
34
+ effort: config.effort,
33
35
  sessionsDir,
34
36
  compactionMessage: config.compactionMessage,
35
37
  maxContextTokens: config.compaction?.maxContextTokens,
@@ -22,6 +22,7 @@ import {
22
22
  readSkillDescriptions,
23
23
  } from "./lib/context-breakdown.js";
24
24
  import { daemonEmit } from "./lib/daemon-client.js";
25
+ import { dispatchPrompt } from "./lib/dispatch.js";
25
26
  import { createEventHandler, emit } from "./lib/event-handler.js";
26
27
  import { runHooks } from "./lib/hook-loader.js";
27
28
  import { log } from "./lib/logger.js";
@@ -489,16 +490,12 @@ export function createMind(options: {
489
490
  broadcast(session, { type: "done" });
490
491
  return;
491
492
  }
492
- if (session.agentSession.isStreaming) {
493
- if (meta.interrupt) {
494
- interruptSession(sessionName);
495
- session.agentSession.prompt(text, { streamingBehavior: "steer", ...opts });
496
- } else {
497
- session.agentSession.prompt(text, { streamingBehavior: "followUp", ...opts });
498
- }
499
- } else {
500
- session.agentSession.prompt(text, opts);
501
- }
493
+ // This await is load-bearing: without it a prompt rejection (burst race,
494
+ // auth failure, ...) floats as an unhandled rejection and crashes the
495
+ // mind server instead of landing in the .catch below (issue #565).
496
+ await dispatchPrompt(session.agentSession, text, opts, meta.interrupt === true, () =>
497
+ interruptSession(sessionName),
498
+ );
502
499
  })().catch(async (err) => {
503
500
  log("mind", `session "${sessionName}": prompt failed:`, err);
504
501
  // Tell the daemon the turn failed (so it records a notice for the mind's next
@@ -0,0 +1,65 @@
1
+ import type { ImageContent } from "@earendil-works/pi-ai";
2
+
3
+ /** Options accepted by {@link PromptTarget.prompt}. Subset of pi's PromptOptions. */
4
+ export interface DispatchOptions {
5
+ streamingBehavior?: "steer" | "followUp";
6
+ images?: ImageContent[];
7
+ }
8
+
9
+ /** The slice of a pi AgentSession that {@link dispatchPrompt} needs. */
10
+ export interface PromptTarget {
11
+ readonly isStreaming: boolean;
12
+ prompt(text: string, options?: DispatchOptions): Promise<void>;
13
+ }
14
+
15
+ /**
16
+ * True when `err` is pi's "agent is already processing" rejection — thrown when a
17
+ * fresh (non-streaming) prompt is sent while a turn is actually in flight.
18
+ */
19
+ export function isAlreadyProcessingError(err: unknown): boolean {
20
+ return err instanceof Error && err.message.includes("already processing");
21
+ }
22
+
23
+ /**
24
+ * Send `text` to the agent, choosing the right queueing behavior for burst delivery.
25
+ *
26
+ * `AgentSession.isStreaming` only flips to `true` partway through an in-flight
27
+ * `prompt()` call, so a second message that arrives in the same tick can observe
28
+ * `isStreaming === false`, take the fresh-prompt path, and race the first message.
29
+ * pi rejects the loser with "agent is already processing". Awaiting the dispatch
30
+ * (so the rejection is caught, not left floating as an unhandled rejection that
31
+ * crashes the mind server) and re-routing the loser as a follow-up keeps both
32
+ * messages: nothing is dropped, and the server survives.
33
+ *
34
+ * - Idle: fresh prompt. On the race rejection, re-route as a follow-up.
35
+ * - Streaming + interrupt: steer the current turn (after `onInterrupt`).
36
+ * - Streaming: queue as a follow-up to run after the current turn.
37
+ */
38
+ export async function dispatchPrompt(
39
+ agent: PromptTarget,
40
+ text: string,
41
+ opts: { images?: ImageContent[] },
42
+ interrupt: boolean,
43
+ onInterrupt: () => void,
44
+ ): Promise<void> {
45
+ if (agent.isStreaming) {
46
+ if (interrupt) {
47
+ onInterrupt();
48
+ await agent.prompt(text, { streamingBehavior: "steer", ...opts });
49
+ } else {
50
+ await agent.prompt(text, { streamingBehavior: "followUp", ...opts });
51
+ }
52
+ return;
53
+ }
54
+
55
+ try {
56
+ await agent.prompt(text, opts);
57
+ } catch (err) {
58
+ if (!isAlreadyProcessingError(err)) throw err;
59
+ // Lost the race: another burst message started a turn between our isStreaming
60
+ // check and this dispatch. Queue as a follow-up instead of crashing. If the
61
+ // winning turn has already finished by now, pi only consults streamingBehavior
62
+ // while streaming, so this is sent as a fresh prompt — delivered either way.
63
+ await agent.prompt(text, { streamingBehavior: "followUp", ...opts });
64
+ }
65
+ }
@@ -137,15 +137,28 @@ export function createEventHandler(session: EventSession, options: EventHandlerO
137
137
 
138
138
  if (event.type === "agent_end") {
139
139
  flushBuffers();
140
- if (session.currentMessageId) {
141
- session.messageChannels.delete(session.currentMessageId);
140
+ // Capture the turn's message context before clearing it: the ordered error/done
141
+ // emits below run asynchronously, but currentMessageId must be reset synchronously
142
+ // so the next turn shifts a fresh id (see the currentMessageId guard above).
143
+ const messageId = session.currentMessageId;
144
+ if (messageId) {
145
+ session.messageChannels.delete(messageId);
142
146
  }
147
+ const channel = messageId ? session.messageChannels.get(messageId)?.channel : undefined;
143
148
  log("mind", `session "${session.name}": turn done`);
144
- // Log any error messages from the agent
149
+ // Collect any agent-level errors (e.g. a provider 401 reported inside agent_end).
150
+ // Warn-logging alone left the failure invisible at every operator surface (#619);
151
+ // we emit a turn_error to the daemon too — mirroring the dispatch-rejection path in
152
+ // agent.ts — so classify() tags it and chat status + lastError surface it. Dedupe
153
+ // identical messages so a turn with several failed messages records one notice.
154
+ const errorMessages: string[] = [];
145
155
  if (event.messages) {
156
+ const seen = new Set<string>();
146
157
  for (const msg of event.messages as AgentEndMessage[]) {
147
- if (msg.errorMessage) {
158
+ if (msg.errorMessage && !seen.has(msg.errorMessage)) {
159
+ seen.add(msg.errorMessage);
148
160
  warn("mind", `session "${session.name}": agent error: ${msg.errorMessage}`);
161
+ errorMessages.push(msg.errorMessage);
149
162
  }
150
163
  }
151
164
  }
@@ -175,14 +188,42 @@ export function createEventHandler(session: EventSession, options: EventHandlerO
175
188
  }
176
189
  }
177
190
  options.broadcast({ type: "done" });
178
- emit(session, { type: "done" });
179
191
  session.currentMessageId = undefined;
192
+ // Emit any errors BEFORE done, awaiting each in turn. daemonEmit is fire-and-forget,
193
+ // so without ordered awaits the daemon could process `done` before `error`:
194
+ // markErrored would land after done consumed the errored flag, leaking it into the
195
+ // next turn (whose clean done then wrongly skips clearing delivered notices). This
196
+ // mirrors agent.ts's awaited error-then-done ordering. Message context is captured
197
+ // above rather than read from the (now-cleared) session.
198
+ void (async () => {
199
+ for (const content of errorMessages) {
200
+ const ev = filterEvent(preset, {
201
+ type: "error",
202
+ session: session.name,
203
+ channel,
204
+ messageId,
205
+ content,
206
+ });
207
+ if (ev) await daemonEmit(ev);
208
+ }
209
+ const doneEv = filterEvent(preset, {
210
+ type: "done",
211
+ session: session.name,
212
+ channel,
213
+ messageId,
214
+ });
215
+ if (doneEv) await daemonEmit(doneEv);
216
+ })().catch((err) =>
217
+ warn("mind", `session "${session.name}": error/done emit failed:`, err),
218
+ );
180
219
  flushFileChanges(options.cwd)
181
220
  .then(() => options.onTurnEnd?.())
182
221
  .catch((err) => log("mind", `session "${session.name}": flush/turn-end error:`, err));
183
222
  }
184
223
  } catch (err) {
185
- log("mind", `session "${session.name}": event handler error (${event?.type}):`, err);
224
+ // warn-level: this block now drives turn-completion (error/done emission), so a throw
225
+ // here can hang a turn — it must not be buried at debug level.
226
+ warn("mind", `session "${session.name}": event handler error (${event?.type}):`, err);
186
227
  }
187
228
  };
188
229
  }