aegisone 1.0.64 → 1.0.65

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 (363) hide show
  1. package/README.md +1 -1
  2. package/bin/aegis.js +1 -1
  3. package/package.json +1 -1
  4. package/scripts/bump.mjs +1 -1
  5. package/scripts/bundle.js +1 -1
  6. package/scripts/postinstall.mjs +1 -1
  7. package/scripts/predist.mjs +1 -1
  8. package/src/child.js +1 -1
  9. package/src/dispatch.js +1 -1
  10. package/src/doctor.js +1 -1
  11. package/src/probes.js +1 -1
  12. package/src/productupdate.js +1 -1
  13. package/src/protocol.js +1 -1
  14. package/src/release.js +1 -1
  15. package/src/selfhost.js +1 -1
  16. package/vendor/cli/package.json +1 -1
  17. package/vendor/cli/scripts/check.mjs +1 -1
  18. package/vendor/cli/scripts/demo.mjs +1 -1
  19. package/vendor/cli/scripts/postinstall.mjs +1 -1
  20. package/vendor/cli/scripts/predist.mjs +1 -1
  21. package/vendor/cli/scripts/runtests.mjs +1 -1
  22. package/vendor/cli/src/app.js +1 -1
  23. package/vendor/cli/src/art.js +1 -1
  24. package/vendor/cli/src/chatflow.js +1 -1
  25. package/vendor/cli/src/checkpoint.js +1 -1
  26. package/vendor/cli/src/clipboard.js +1 -1
  27. package/vendor/cli/src/cloudsync.js +1 -1
  28. package/vendor/cli/src/commands.js +2 -2
  29. package/vendor/cli/src/config.js +1 -1
  30. package/vendor/cli/src/connect.js +1 -1
  31. package/vendor/cli/src/devrun.js +1 -1
  32. package/vendor/cli/src/diff.js +1 -1
  33. package/vendor/cli/src/diffview.js +1 -1
  34. package/vendor/cli/src/dream.js +1 -1
  35. package/vendor/cli/src/engine.js +1 -1
  36. package/vendor/cli/src/events.js +1 -1
  37. package/vendor/cli/src/export.js +1 -1
  38. package/vendor/cli/src/fingerprint.js +1 -1
  39. package/vendor/cli/src/format.js +1 -1
  40. package/vendor/cli/src/fuzzy.js +1 -1
  41. package/vendor/cli/src/history.js +1 -1
  42. package/vendor/cli/src/init.js +1 -1
  43. package/vendor/cli/src/markdown.js +1 -1
  44. package/vendor/cli/src/models.js +1 -1
  45. package/vendor/cli/src/overlays.js +1 -1
  46. package/vendor/cli/src/panels.js +1 -1
  47. package/vendor/cli/src/ping.js +1 -1
  48. package/vendor/cli/src/presence.js +1 -1
  49. package/vendor/cli/src/render.js +1 -1
  50. package/vendor/cli/src/screen.js +1 -1
  51. package/vendor/cli/src/screens.js +1 -1
  52. package/vendor/cli/src/secret.js +1 -1
  53. package/vendor/cli/src/securefs.js +1 -1
  54. package/vendor/cli/src/settings.js +1 -1
  55. package/vendor/cli/src/signup.js +1 -1
  56. package/vendor/cli/src/summarize.js +1 -1
  57. package/vendor/cli/src/sysdiag.js +1 -1
  58. package/vendor/cli/src/theme.js +1 -1
  59. package/vendor/cli/src/title.js +1 -1
  60. package/vendor/cli/src/todos.js +1 -1
  61. package/vendor/cli/src/tokens.js +1 -1
  62. package/vendor/cli/src/topup.js +1 -1
  63. package/vendor/cli/src/update.js +1 -1
  64. package/vendor/cli/vendor/client/aegis.js +1 -1
  65. package/vendor/cli/vendor/client/attest.js +1 -1
  66. package/vendor/cli/vendor/client/authorship-key.js +1 -1
  67. package/vendor/cli/vendor/client/auto-provision.js +1 -1
  68. package/vendor/cli/vendor/client/brain-catalog.js +1 -1
  69. package/vendor/cli/vendor/client/byok-catalog.js +1 -1
  70. package/vendor/cli/vendor/client/catalog-client.js +1 -1
  71. package/vendor/cli/vendor/client/conversation-export.js +1 -1
  72. package/vendor/cli/vendor/client/credentials.js +1 -1
  73. package/vendor/cli/vendor/client/credits.js +1 -1
  74. package/vendor/cli/vendor/client/drive-connect.js +1 -1
  75. package/vendor/cli/vendor/client/env-file.js +1 -1
  76. package/vendor/cli/vendor/client/fingerprint.js +1 -1
  77. package/vendor/cli/vendor/client/foreign-memory.js +1 -1
  78. package/vendor/cli/vendor/client/foreign-sessions.js +1 -1
  79. package/vendor/cli/vendor/client/google-signin.js +1 -1
  80. package/vendor/cli/vendor/client/hooks.js +1 -1
  81. package/vendor/cli/vendor/client/model-discovery.js +1 -1
  82. package/vendor/cli/vendor/client/model-sync.js +1 -1
  83. package/vendor/cli/vendor/client/naming.js +1 -1
  84. package/vendor/cli/vendor/client/platform.js +1 -1
  85. package/vendor/cli/vendor/client/prefs.js +1 -1
  86. package/vendor/cli/vendor/client/presence.js +1 -1
  87. package/vendor/cli/vendor/client/record-vault.js +2 -2
  88. package/vendor/cli/vendor/client/session-search.js +1 -1
  89. package/vendor/cli/vendor/client/session-store.js +1 -1
  90. package/vendor/cli/vendor/client/skills.js +1 -1
  91. package/vendor/cli/vendor/client/topup.js +1 -1
  92. package/vendor/cli/vendor/client/touch.js +1 -1
  93. package/vendor/cli/vendor/client/update.js +1 -1
  94. package/vendor/cli/vendor/client/user-models.js +1 -1
  95. package/vendor/cli/vendor/desktop/lib/local/attachments.js +1 -1
  96. package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1 -1
  97. package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
  98. package/vendor/cli/vendor/desktop/lib/local/context.js +1 -1
  99. package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -1
  100. package/vendor/cli/vendor/desktop/lib/local/entitlement.js +1 -1
  101. package/vendor/cli/vendor/desktop/lib/local/integrity.js +1 -1
  102. package/vendor/cli/vendor/desktop/lib/local/local.js +1 -1
  103. package/vendor/cli/vendor/desktop/lib/local/perm-rules.js +5 -0
  104. package/vendor/cli/vendor/desktop/lib/local/perm-store.js +5 -0
  105. package/vendor/cli/vendor/desktop/lib/local/perm-write.js +5 -0
  106. package/vendor/cli/vendor/desktop/lib/local/pro-sessions.js +3 -1
  107. package/vendor/cli/vendor/desktop/lib/local/prompt.js +1 -1
  108. package/vendor/cli/vendor/desktop/lib/local/queue.js +1 -1
  109. package/vendor/cli/vendor/desktop/lib/local/repeat-guard.js +1 -1
  110. package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
  111. package/vendor/cli/vendor/desktop/lib/local/spill.js +1 -1
  112. package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +1 -1
  113. package/vendor/cli/vendor/desktop/lib/local/verify-stop.js +1 -1
  114. package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +1 -1
  115. package/vendor/cli/vendor/desktop/lib/settings.js +1 -1
  116. package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1
  117. package/vendor/cli/vendor/hosts/install.js +1 -1
  118. package/vendor/cli/vendor/hosts/openai-shim.js +1 -1
  119. package/vendor/cli/vendor/hosts/spec.js +1 -1
  120. package/vendor/cli/vendor/hosts/targets.js +1 -1
  121. package/vendor/cli/vendor/mcp/admission.js +1 -1
  122. package/vendor/cli/vendor/mcp/server.js +1 -1
  123. package/vendor/cli/vendor/mcp/tools.js +1 -1
  124. package/vendor/cli/vendor/one/src/child.js +1 -1
  125. package/vendor/cli/vendor/one/src/protocol.js +1 -1
  126. package/vendor/cli/vendor/one/src/selfhost.js +1 -1
  127. package/vendor/desktop/bin/aegis.js +1 -1
  128. package/vendor/desktop/lib/auto.js +1 -1
  129. package/vendor/desktop/lib/avatar/companion.js +1 -1
  130. package/vendor/desktop/lib/avatar/cosmetics.js +1 -1
  131. package/vendor/desktop/lib/avatar/holder-turn.js +1 -1
  132. package/vendor/desktop/lib/avatar/holders.js +1 -1
  133. package/vendor/desktop/lib/avatar/identity.js +1 -1
  134. package/vendor/desktop/lib/avatar/level.js +1 -1
  135. package/vendor/desktop/lib/avatar/mirror.js +1 -1
  136. package/vendor/desktop/lib/avatar/persona.js +1 -1
  137. package/vendor/desktop/lib/avatar/profile.js +1 -1
  138. package/vendor/desktop/lib/avatar/register.js +1 -1
  139. package/vendor/desktop/lib/avatar/store.js +1 -1
  140. package/vendor/desktop/lib/avatar/transfer.js +1 -1
  141. package/vendor/desktop/lib/avatar/turn.js +1 -1
  142. package/vendor/desktop/lib/avatar/voice.js +1 -1
  143. package/vendor/desktop/lib/avatar/xp.js +1 -1
  144. package/vendor/desktop/lib/deep-link.js +1 -1
  145. package/vendor/desktop/lib/local/attachments.js +1 -1
  146. package/vendor/desktop/lib/local/autonomous.js +1 -1
  147. package/vendor/desktop/lib/local/claude-pro.js +1 -1
  148. package/vendor/desktop/lib/local/cli-face.js +1 -1
  149. package/vendor/desktop/lib/local/context.js +1 -1
  150. package/vendor/desktop/lib/local/engine.js +1 -1
  151. package/vendor/desktop/lib/local/entitlement.js +1 -1
  152. package/vendor/desktop/lib/local/integrity.js +1 -1
  153. package/vendor/desktop/lib/local/local.js +1 -1
  154. package/vendor/desktop/lib/local/perm-rules.js +5 -0
  155. package/vendor/desktop/lib/local/perm-store.js +5 -0
  156. package/vendor/desktop/lib/local/perm-write.js +5 -0
  157. package/vendor/desktop/lib/local/pro-sessions.js +3 -1
  158. package/vendor/desktop/lib/local/prompt.js +1 -1
  159. package/vendor/desktop/lib/local/pty-host.js +1 -1
  160. package/vendor/desktop/lib/local/queue.js +1 -1
  161. package/vendor/desktop/lib/local/repeat-guard.js +1 -1
  162. package/vendor/desktop/lib/local/session-rounds.js +1 -1
  163. package/vendor/desktop/lib/local/spill.js +1 -1
  164. package/vendor/desktop/lib/local/telemetry.js +1 -1
  165. package/vendor/desktop/lib/local/turn-guard.js +1 -1
  166. package/vendor/desktop/lib/local/verify-stop.js +1 -1
  167. package/vendor/desktop/lib/local/worktree-lock.js +1 -1
  168. package/vendor/desktop/lib/provider-key-mirror.js +1 -1
  169. package/vendor/desktop/lib/quick-launcher.js +1 -1
  170. package/vendor/desktop/lib/settings.js +1 -1
  171. package/vendor/desktop/lib/skills-host.js +1 -1
  172. package/vendor/desktop/lib/speech-host.js +1 -1
  173. package/vendor/desktop/lib/sync/memory-store.js +1 -1
  174. package/vendor/desktop/lib/sync/persist-gate.js +1 -1
  175. package/vendor/desktop/lib/window-state.js +1 -1
  176. package/vendor/desktop/package.json +1 -1
  177. package/vendor/desktop/preload.js +3 -1
  178. package/vendor/desktop/renderer/app.js +3 -3
  179. package/vendor/desktop/renderer/avatar/assemble.js +1 -1
  180. package/vendor/desktop/renderer/avatar/avatar.js +1 -1
  181. package/vendor/desktop/renderer/avatar/cards.js +1 -1
  182. package/vendor/desktop/renderer/avatar/hud.js +1 -1
  183. package/vendor/desktop/renderer/avatar/pane.js +1 -1
  184. package/vendor/desktop/renderer/avatar/parts.js +1 -1
  185. package/vendor/desktop/renderer/commands.js +1 -1
  186. package/vendor/desktop/renderer/companion.js +1 -1
  187. package/vendor/desktop/renderer/composer-triggers.js +1 -1
  188. package/vendor/desktop/renderer/dictation.js +1 -1
  189. package/vendor/desktop/renderer/diff.js +1 -1
  190. package/vendor/desktop/renderer/diffview.js +1 -1
  191. package/vendor/desktop/renderer/fingerprint.js +2 -2
  192. package/vendor/desktop/renderer/index.html +10 -4
  193. package/vendor/desktop/renderer/library.js +1 -1
  194. package/vendor/desktop/renderer/markdown.js +1 -1
  195. package/vendor/desktop/renderer/palette-filter.js +1 -1
  196. package/vendor/desktop/renderer/provider-toolbar.js +1 -1
  197. package/vendor/desktop/renderer/providers.js +1 -1
  198. package/vendor/desktop/renderer/pty-frame.css +35 -0
  199. package/vendor/desktop/renderer/pty-frame.html +47 -0
  200. package/vendor/desktop/renderer/pty-panel.js +1 -1
  201. package/vendor/desktop/renderer/quick.js +1 -1
  202. package/vendor/desktop/renderer/settings-skills.js +1 -1
  203. package/vendor/desktop/renderer/shortcuts.js +1 -1
  204. package/vendor/desktop/renderer/stream-policy.js +1 -1
  205. package/vendor/desktop/renderer/style.css +22 -0
  206. package/vendor/desktop/renderer/transcript-view.js +1 -1
  207. package/vendor/desktop/renderer/usage.js +1 -1
  208. package/vendor/desktop/renderer/welcome-rows.js +1 -1
  209. package/vendor/desktop/vendor/aegis.js +1 -1
  210. package/vendor/desktop/vendor/attest.js +1 -1
  211. package/vendor/desktop/vendor/authorship-key.js +1 -1
  212. package/vendor/desktop/vendor/auto-provision.js +1 -1
  213. package/vendor/desktop/vendor/brain-catalog.js +1 -1
  214. package/vendor/desktop/vendor/byok-catalog.js +1 -1
  215. package/vendor/desktop/vendor/catalog-client.js +1 -1
  216. package/vendor/desktop/vendor/conversation-export.js +1 -1
  217. package/vendor/desktop/vendor/credentials.js +1 -1
  218. package/vendor/desktop/vendor/credits.js +1 -1
  219. package/vendor/desktop/vendor/drive-connect.js +1 -1
  220. package/vendor/desktop/vendor/env-file.js +1 -1
  221. package/vendor/desktop/vendor/faces/cli/bin/aegiscode.js +2 -2
  222. package/vendor/desktop/vendor/faces/cli/package.json +1 -1
  223. package/vendor/desktop/vendor/faces/cli/scripts/check.mjs +1 -1
  224. package/vendor/desktop/vendor/faces/cli/scripts/demo.mjs +1 -1
  225. package/vendor/desktop/vendor/faces/cli/scripts/postinstall.mjs +1 -1
  226. package/vendor/desktop/vendor/faces/cli/scripts/predist.mjs +1 -1
  227. package/vendor/desktop/vendor/faces/cli/scripts/runtests.mjs +1 -1
  228. package/vendor/desktop/vendor/faces/cli/src/app.js +1 -1
  229. package/vendor/desktop/vendor/faces/cli/src/art.js +1 -1
  230. package/vendor/desktop/vendor/faces/cli/src/autonomous.js +1 -1
  231. package/vendor/desktop/vendor/faces/cli/src/caps.js +1 -1
  232. package/vendor/desktop/vendor/faces/cli/src/chatflow.js +1 -1
  233. package/vendor/desktop/vendor/faces/cli/src/checkpoint.js +1 -1
  234. package/vendor/desktop/vendor/faces/cli/src/clipboard.js +1 -1
  235. package/vendor/desktop/vendor/faces/cli/src/cloudsync.js +1 -1
  236. package/vendor/desktop/vendor/faces/cli/src/commands.js +2 -2
  237. package/vendor/desktop/vendor/faces/cli/src/config.js +1 -1
  238. package/vendor/desktop/vendor/faces/cli/src/connect.js +1 -1
  239. package/vendor/desktop/vendor/faces/cli/src/devrun.js +1 -1
  240. package/vendor/desktop/vendor/faces/cli/src/diff.js +1 -1
  241. package/vendor/desktop/vendor/faces/cli/src/diffview.js +1 -1
  242. package/vendor/desktop/vendor/faces/cli/src/dream.js +1 -1
  243. package/vendor/desktop/vendor/faces/cli/src/engine.js +1 -1
  244. package/vendor/desktop/vendor/faces/cli/src/events.js +1 -1
  245. package/vendor/desktop/vendor/faces/cli/src/export.js +1 -1
  246. package/vendor/desktop/vendor/faces/cli/src/fingerprint.js +1 -1
  247. package/vendor/desktop/vendor/faces/cli/src/format.js +1 -1
  248. package/vendor/desktop/vendor/faces/cli/src/fuzzy.js +1 -1
  249. package/vendor/desktop/vendor/faces/cli/src/history.js +1 -1
  250. package/vendor/desktop/vendor/faces/cli/src/init.js +1 -1
  251. package/vendor/desktop/vendor/faces/cli/src/limits.js +1 -1
  252. package/vendor/desktop/vendor/faces/cli/src/markdown.js +1 -1
  253. package/vendor/desktop/vendor/faces/cli/src/mcp.js +1 -1
  254. package/vendor/desktop/vendor/faces/cli/src/models.js +1 -1
  255. package/vendor/desktop/vendor/faces/cli/src/overlays.js +1 -1
  256. package/vendor/desktop/vendor/faces/cli/src/panels.js +1 -1
  257. package/vendor/desktop/vendor/faces/cli/src/permissions.js +1 -1
  258. package/vendor/desktop/vendor/faces/cli/src/ping.js +1 -1
  259. package/vendor/desktop/vendor/faces/cli/src/presence.js +1 -1
  260. package/vendor/desktop/vendor/faces/cli/src/provenance.js +1 -1
  261. package/vendor/desktop/vendor/faces/cli/src/render.js +1 -1
  262. package/vendor/desktop/vendor/faces/cli/src/screen.js +1 -1
  263. package/vendor/desktop/vendor/faces/cli/src/screens.js +1 -1
  264. package/vendor/desktop/vendor/faces/cli/src/secret.js +1 -1
  265. package/vendor/desktop/vendor/faces/cli/src/securefs.js +1 -1
  266. package/vendor/desktop/vendor/faces/cli/src/settings.js +1 -1
  267. package/vendor/desktop/vendor/faces/cli/src/signup.js +1 -1
  268. package/vendor/desktop/vendor/faces/cli/src/summarize.js +1 -1
  269. package/vendor/desktop/vendor/faces/cli/src/sysdiag.js +1 -1
  270. package/vendor/desktop/vendor/faces/cli/src/theme.js +1 -1
  271. package/vendor/desktop/vendor/faces/cli/src/title.js +1 -1
  272. package/vendor/desktop/vendor/faces/cli/src/todos.js +1 -1
  273. package/vendor/desktop/vendor/faces/cli/src/tokens.js +1 -1
  274. package/vendor/desktop/vendor/faces/cli/src/topup.js +1 -1
  275. package/vendor/desktop/vendor/faces/cli/src/update.js +1 -1
  276. package/vendor/desktop/vendor/faces/cli/vendor/client/aegis.js +1 -1
  277. package/vendor/desktop/vendor/faces/cli/vendor/client/attest.js +1 -1
  278. package/vendor/desktop/vendor/faces/cli/vendor/client/authorship-key.js +1 -1
  279. package/vendor/desktop/vendor/faces/cli/vendor/client/auto-provision.js +1 -1
  280. package/vendor/desktop/vendor/faces/cli/vendor/client/brain-catalog.js +1 -1
  281. package/vendor/desktop/vendor/faces/cli/vendor/client/byok-catalog.js +1 -1
  282. package/vendor/desktop/vendor/faces/cli/vendor/client/catalog-client.js +1 -1
  283. package/vendor/desktop/vendor/faces/cli/vendor/client/conversation-export.js +1 -1
  284. package/vendor/desktop/vendor/faces/cli/vendor/client/credentials.js +1 -1
  285. package/vendor/desktop/vendor/faces/cli/vendor/client/credits.js +1 -1
  286. package/vendor/desktop/vendor/faces/cli/vendor/client/drive-connect.js +1 -1
  287. package/vendor/desktop/vendor/faces/cli/vendor/client/env-file.js +1 -1
  288. package/vendor/desktop/vendor/faces/cli/vendor/client/fingerprint.js +1 -1
  289. package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-memory.js +1 -1
  290. package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-sessions.js +1 -1
  291. package/vendor/desktop/vendor/faces/cli/vendor/client/google-signin.js +1 -1
  292. package/vendor/desktop/vendor/faces/cli/vendor/client/hooks.js +1 -1
  293. package/vendor/desktop/vendor/faces/cli/vendor/client/model-discovery.js +1 -1
  294. package/vendor/desktop/vendor/faces/cli/vendor/client/model-sync.js +1 -1
  295. package/vendor/desktop/vendor/faces/cli/vendor/client/naming.js +1 -1
  296. package/vendor/desktop/vendor/faces/cli/vendor/client/platform.js +1 -1
  297. package/vendor/desktop/vendor/faces/cli/vendor/client/prefs.js +1 -1
  298. package/vendor/desktop/vendor/faces/cli/vendor/client/presence.js +1 -1
  299. package/vendor/desktop/vendor/faces/cli/vendor/client/record-vault.js +2 -2
  300. package/vendor/desktop/vendor/faces/cli/vendor/client/session-search.js +1 -1
  301. package/vendor/desktop/vendor/faces/cli/vendor/client/session-store.js +1 -1
  302. package/vendor/desktop/vendor/faces/cli/vendor/client/skills.js +1 -1
  303. package/vendor/desktop/vendor/faces/cli/vendor/client/topup.js +1 -1
  304. package/vendor/desktop/vendor/faces/cli/vendor/client/touch.js +1 -1
  305. package/vendor/desktop/vendor/faces/cli/vendor/client/update.js +1 -1
  306. package/vendor/desktop/vendor/faces/cli/vendor/client/user-models.js +1 -1
  307. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/attachments.js +1 -1
  308. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/autonomous.js +1 -1
  309. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
  310. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/context.js +1 -1
  311. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/engine.js +1 -1
  312. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/entitlement.js +1 -1
  313. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/exec-plan.js +1 -1
  314. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/integrity.js +1 -1
  315. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/local.js +1 -1
  316. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-rules.js +2 -0
  317. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-store.js +3 -1
  318. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-write.js +2 -0
  319. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/pro-sessions.js +3 -1
  320. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/prompt.js +1 -1
  321. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/queue.js +1 -1
  322. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/repeat-guard.js +1 -1
  323. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/session-rounds.js +1 -1
  324. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/shell.js +1 -1
  325. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/spill.js +1 -1
  326. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/tools.js +1 -1
  327. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/turn-guard.js +1 -1
  328. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/verify-stop.js +1 -1
  329. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/worktree-lock.js +1 -1
  330. package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/settings.js +1 -1
  331. package/vendor/desktop/vendor/faces/cli/vendor/desktop/main.js +3 -3
  332. package/vendor/desktop/vendor/faces/cli/vendor/desktop/renderer/usage.js +1 -1
  333. package/vendor/desktop/vendor/faces/cli/vendor/hosts/install.js +1 -1
  334. package/vendor/desktop/vendor/faces/cli/vendor/hosts/openai-shim.js +1 -1
  335. package/vendor/desktop/vendor/faces/cli/vendor/hosts/spec.js +1 -1
  336. package/vendor/desktop/vendor/faces/cli/vendor/hosts/targets.js +1 -1
  337. package/vendor/desktop/vendor/faces/cli/vendor/mcp/admission.js +1 -1
  338. package/vendor/desktop/vendor/faces/cli/vendor/mcp/server.js +1 -1
  339. package/vendor/desktop/vendor/faces/cli/vendor/mcp/tools.js +1 -1
  340. package/vendor/desktop/vendor/faces/cli/vendor/one/src/child.js +1 -1
  341. package/vendor/desktop/vendor/faces/cli/vendor/one/src/protocol.js +1 -1
  342. package/vendor/desktop/vendor/faces/cli/vendor/one/src/selfhost.js +1 -1
  343. package/vendor/desktop/vendor/fingerprint.js +1 -1
  344. package/vendor/desktop/vendor/foreign-memory.js +1 -1
  345. package/vendor/desktop/vendor/foreign-sessions.js +1 -1
  346. package/vendor/desktop/vendor/google-signin.js +1 -1
  347. package/vendor/desktop/vendor/hooks.js +1 -1
  348. package/vendor/desktop/vendor/model-discovery.js +1 -1
  349. package/vendor/desktop/vendor/model-sync.js +1 -1
  350. package/vendor/desktop/vendor/naming.js +1 -1
  351. package/vendor/desktop/vendor/platform.js +1 -1
  352. package/vendor/desktop/vendor/prefs.js +1 -1
  353. package/vendor/desktop/vendor/presence.js +1 -1
  354. package/vendor/desktop/vendor/protocol.js +1 -1
  355. package/vendor/desktop/vendor/record-vault.js +2 -2
  356. package/vendor/desktop/vendor/selfhost.js +1 -1
  357. package/vendor/desktop/vendor/session-search.js +1 -1
  358. package/vendor/desktop/vendor/session-store.js +1 -1
  359. package/vendor/desktop/vendor/skills.js +1 -1
  360. package/vendor/desktop/vendor/topup.js +1 -1
  361. package/vendor/desktop/vendor/touch.js +1 -1
  362. package/vendor/desktop/vendor/update.js +1 -1
  363. package/vendor/desktop/vendor/user-models.js +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AEGISONE
2
2
 
3
- Product version: **1.0.64**
3
+ Product version: **1.0.65**
4
4
 
5
5
  One product, two faces: the terminal (`aegiscode`) and the window (`aegis-desktop`),
6
6
  reached through one command — `aegis` — and released as one version.
package/bin/aegis.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- "use strict";const fs=require("node:fs"),path=require("node:path"),{spawnSync:spawnSync,spawn:spawn}=require("node:child_process"),{decide:decide,FACE:FACE}=require("../src/dispatch.js"),WIN=require("../src/iface/window.js"),probes=require("../src/probes.js"),release=require("../src/release.js"),productHelp=require("../src/producthelp.js"),productUpdate=require("../src/productupdate.js"),EXIT_USAGE=2,PRODUCT=require("../package.json");function faceManifestPaths(e,t){const r=t||__dirname;return[path.join(r,"..","vendor",e.dir,"package.json"),path.join(r,"..","..",e.dir,"package.json")]}function readFaceVersions(e){return release.FACE_LINES.map((t=>{for(const r of faceManifestPaths(t,e))try{return{package:t.package,version:JSON.parse(fs.readFileSync(r,"utf8")).version,source:r}}catch{}return{package:t.package,version:null,source:null}}))}function write(e,t){try{e.write(t.endsWith("\n")?t:t+"\n")}catch{}}function runUpdate(e,t,r){const n=t||{},{stdout:s,stderr:i,input:o}=r,a=void 0!==n.installed?n.installed:isInstalledLayout(n.binDir),c=n.updatePlan?n.updatePlan():productUpdate.plan({installed:a,env:o&&o.env||{}});if(!c.ok)return write(i,`aegis: ${c.msg}`),EXIT_USAGE;const d=n.fetchLatest||defaultFetchLatest(n.binDir);return productUpdate.check({current:PRODUCT.version,action:e.action},{fetchImpl:d}).then((t=>{for(const e of t.lines)write(s,e);if("apply"!==e.action)return!0===t.upToDate?0:1;const r=productUpdate.apply(c,t,{runImpl:n.runInstall||defaultRunInstall,spawnSpec:n.spawnSpec||defaultSpawnSpec(n.binDir)});if(r.ok){write(s,r.lines?r.lines[0]:"Installed.");for(const e of String(r.output||"").split("\n").slice(-6))e.trim()&&write(s,` ${e}`);return 0}return r.skipped?(write(s,` ${r.msg}`),!0===t.upToDate?0:1):(write(i,`aegis: ${r.msg||"the install failed"}`),r.error&&write(i,`aegis: ${r.error}`),r.command&&write(i,`aegis: run it yourself: ${r.command}`),3)}))}function isInstalledLayout(e){const t=e||__dirname,r=path.join(t,"..");try{return!fs.existsSync(path.join(r,"..","one","package.json"))}catch{return!0}}function defaultFetchLatest(e){const t=e||__dirname,r=path.join(t,".."),n=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")];for(const e of n)try{const t=require(e);if("function"==typeof t.fetchLatestDetailed)return e=>t.fetchLatestDetailed({...e||{},pkg:productUpdate.PRODUCT_PKG});if("function"==typeof t.fetchLatest)return e=>t.fetchLatest({...e||{},pkg:productUpdate.PRODUCT_PKG})}catch{}return null}function defaultSpawnSpec(e){const t=e||__dirname,r=path.join(t,".."),n=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")],s={command:"npm",args:["i","-g",`${productUpdate.PRODUCT_PKG}@latest`]};for(const e of n)try{const t=require(e);if("function"==typeof t.installSpawn){const e=t.installSpawn(s,{env:process.env});if(e&&e.command)return e}}catch{}return null}function defaultRunInstall(e){try{const t=spawnSync(e.command,e.args,{encoding:"utf8",timeout:18e4,stdio:["ignore","pipe","pipe"],shell:!0===e.shell,windowsHide:!0});return t.error?{ok:!1,error:String(t.error.message||t.error)}:0!==t.status?{ok:!1,error:String((t.stderr||t.stdout||"").trim()||`exited ${t.status}`)}:{ok:!0,output:String(t.stdout||"")}}catch(e){return{ok:!1,error:String(e&&e.message||e)}}}const WINDOW_STDERR_NOISE=[/libva (error|warning)/i,/^libva:/i,/vaGetDriverNameByIndex|vaInitialize/,/gpu_init\.cc.*Passthrough is not supported/i,/gpu_persistent_cache\.cc.*Persistent cache error/i,/ERROR:gpu\/command_buffer\/service\/gles2_cmd_decoder/,/swiftshader|llvmpipe|MESA-LOADER|libGL error|DRI3|MESA-VULKAN/i,/^MESA-(VOID|DRI|LOADER)/,/vulkan.*(incomplete|not supported|failed)/i];function forwardWindowStderr(e,t){let r="";e.setEncoding("utf8"),e.on("data",(e=>{r+=e;const n=r.split("\n");r=n.pop()||"";for(const e of n)e.trim()&&(WINDOW_STDERR_NOISE.some((t=>t.test(e)))||write(t,e))}));const n=()=>{r.trim()&&!WINDOW_STDERR_NOISE.some((e=>e.test(r)))&&write(t,r),r=""};e.on("end",n),e.on("close",n),e.on("error",(()=>{}))}function statusOf(e){return"number"==typeof e.status?e.status:"SIGINT"===e.signal?130:"SIGTERM"===e.signal?143:1}function run(e,t){const r=t||{},n=r.stderr||process.stderr,s=r.stdout||process.stdout,i=r.input||probes.collect({argv:e}),o=Array.isArray(e)?{...i,argv:e}:i,a=release.versionRequest(o.argv);if(a){const e=a.verbose?r.readFaceVersions?r.readFaceVersions():readFaceVersions(r.binDir):null;return write(s,release.renderVersion({product:{name:PRODUCT.name,version:PRODUCT.version},faces:e})),0}if((r.helpRequest||productHelp.helpRequest)(o.argv))return write(s,productHelp.renderHelp({version:PRODUCT.version})),0;const c=(r.updateRequest||productUpdate.updateRequest)(o.argv);if(c&&"help"===c.action)return write(s,productUpdate.renderUsage(PRODUCT.version)),0;if(c)return runUpdate(c,r,{stdout:s,stderr:n,input:o});const d=(o.argv||[]).indexOf("doctor");if(-1!==d&&!(o.argv||[]).slice(0,d).some((e=>!e.startsWith("-")))){const e=r.doctor||require("../src/doctor.js"),t=Object.assign({env:o.env,stdout:s,electron:o._electron||r.electron||null},r.doctorDeps||{}),n=e.main((o.argv||[]).slice(d+1),t);return"number"==typeof n?n:EXIT_USAGE}const u=decide(o),p=r.permissions||require("../src/permissions.js"),l=(o.argv||[]).indexOf(p.SKIP_FLAG||"--dangerously-skip-permissions"),f=Boolean(o.tty&&o.tty.stdin&&o.tty.stdout),g=f?"interactive":"headless",m=r.stored||p.storedPermissionFacts(r.storedOpts||{}),h=p.resolvePosture({rules:void 0!==r.rules?r.rules:m.rules,gate:void 0!==r.gate?r.gate:m.confirmationsOn,permissionMode:void 0!==r.permissionMode?r.permissionMode:m.permissionMode,flag:-1!==l,env:o.env,interactive:f,childKind:g});h.warning&&write(n,`aegis: ${h.warning}`),h.skip&&h.skipFromFlag&&write(n,p.skipReport(h));const w=-1===l?u.args:u.args.filter((e=>e!==(p.SKIP_FLAG||"--dangerously-skip-permissions"))),v=h.skipFromFlag?{AEGISONE_SKIP_PERMISSIONS:"1"}:{},S={AEGIS_INSTALL_METHOD:"npm"};if("1"===(o.env||{}).AEGISONE_PRINT_DECISION&&write(n,"aegis: decision "+JSON.stringify({face:u.face,kind:u.kind,reason:u.reason,args:w,skip:h.skip})),null===u.face)return write(n,`aegis: ${u.error}`),u.hint&&write(n,`aegis: ${u.hint}`),u.code||EXIT_USAGE;u.notice&&write(n,`aegis: ${u.notice} — running the terminal face.`);const I=r.spawnSync||spawnSync,E=r.spawn||spawn,_=Object.assign({},process.env,r.env||{});if(u.face===FACE.TUI){const e=o._cliBin||r.cliBin;return e?statusOf(I(process.execPath,[e,...w],{stdio:"inherit",env:Object.assign({},_,v,S),argv0:"aegiscode"})||{}):(write(n,"aegis: the terminal face is not installed beside aegisone."),write(n,"aegis: reinstall aegisone, or set AEGISONE_CLI_BIN to bin/aegiscode.js."),127)}const O=o._electron||r.electron,y=o._desktopMain||r.desktopMain,k=WIN.plan({decision:u,electron:Boolean(O),target:r.target||o.target});if(!k||!y)return write(n,"aegis: cannot open the window — Electron or the desktop entry point went missing after the check."),write(n,"aegis: Use --tui for the terminal face."),EXIT_USAGE;delete _.ELECTRON_RUN_AS_NODE;const R=WIN.open(k,{main:y,args:w,env:Object.assign({},_,v,S)},{openElectron:e=>{const t=E(process.execPath,[e.main,...e.args],{stdio:["ignore","ignore","pipe"],env:e.env,detached:!1});return t&&t.stderr&&forwardWindowStderr(t.stderr,n),t}});if(!R||!R.ok)return write(n,`aegis: cannot open the window — ${R&&R.msg||"no usable window plan"}.`),write(n,"aegis: Use --tui for the terminal face."),EXIT_USAGE;const U=R.handle;return new Promise((e=>{U.on("error",(t=>{write(n,`aegis: could not start the window: ${t&&t.message}`),e(1)})),U.on("exit",((t,r)=>e(statusOf({status:t,signal:r}))))}))}function main(e){const t=run(e);return"number"==typeof t?(process.exitCode=t,t):t.then((e=>(process.exitCode=e,e)))}if(module.exports={main:main,run:run,statusOf:statusOf,EXIT_USAGE:EXIT_USAGE,isInstalledLayout:isInstalledLayout,defaultFetchLatest:defaultFetchLatest},require.main===module){const e=main(process.argv.slice(2));e&&"function"==typeof e.then&&e.catch((e=>{write(process.stderr,`aegis: ${e&&e.stack||e}`),process.exitCode=1}))}
4
+ "use strict";const fs=require("node:fs"),path=require("node:path"),{spawnSync:spawnSync,spawn:spawn}=require("node:child_process"),{decide:decide,FACE:FACE}=require("../src/dispatch.js"),WIN=require("../src/iface/window.js"),probes=require("../src/probes.js"),release=require("../src/release.js"),productHelp=require("../src/producthelp.js"),productUpdate=require("../src/productupdate.js"),EXIT_USAGE=2,PRODUCT=require("../package.json");function faceManifestPaths(e,t){const r=t||__dirname;return[path.join(r,"..","vendor",e.dir,"package.json"),path.join(r,"..","..",e.dir,"package.json")]}function readFaceVersions(e){return release.FACE_LINES.map(t=>{for(const r of faceManifestPaths(t,e))try{return{package:t.package,version:JSON.parse(fs.readFileSync(r,"utf8")).version,source:r}}catch{}return{package:t.package,version:null,source:null}})}function write(e,t){try{e.write(t.endsWith("\n")?t:t+"\n")}catch{}}function runUpdate(e,t,r){const n=t||{},{stdout:s,stderr:i,input:o}=r,a=void 0!==n.installed?n.installed:isInstalledLayout(n.binDir),c=n.updatePlan?n.updatePlan():productUpdate.plan({installed:a,env:o&&o.env||{}});if(!c.ok)return write(i,`aegis: ${c.msg}`),2;const d=n.fetchLatest||defaultFetchLatest(n.binDir);return productUpdate.check({current:PRODUCT.version,action:e.action},{fetchImpl:d}).then(t=>{for(const e of t.lines)write(s,e);if("apply"!==e.action)return!0===t.upToDate?0:1;const r=productUpdate.apply(c,t,{runImpl:n.runInstall||defaultRunInstall,spawnSpec:n.spawnSpec||defaultSpawnSpec(n.binDir)});if(r.ok){write(s,r.lines?r.lines[0]:"Installed.");for(const e of String(r.output||"").split("\n").slice(-6))e.trim()&&write(s,` ${e}`);return 0}return r.skipped?(write(s,` ${r.msg}`),!0===t.upToDate?0:1):(write(i,`aegis: ${r.msg||"the install failed"}`),r.error&&write(i,`aegis: ${r.error}`),r.command&&write(i,`aegis: run it yourself: ${r.command}`),3)})}function isInstalledLayout(e){const t=e||__dirname,r=path.join(t,"..");try{return!fs.existsSync(path.join(r,"..","one","package.json"))}catch{return!0}}function defaultFetchLatest(e){const t=e||__dirname,r=path.join(t,".."),n=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")];for(const e of n)try{const t=require(e);if("function"==typeof t.fetchLatestDetailed)return e=>t.fetchLatestDetailed({...e||{},pkg:productUpdate.PRODUCT_PKG});if("function"==typeof t.fetchLatest)return e=>t.fetchLatest({...e||{},pkg:productUpdate.PRODUCT_PKG})}catch{}return null}function defaultSpawnSpec(e){const t=e||__dirname,r=path.join(t,".."),n=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")],s={command:"npm",args:["i","-g",`${productUpdate.PRODUCT_PKG}@latest`]};for(const e of n)try{const t=require(e);if("function"==typeof t.installSpawn){const e=t.installSpawn(s,{env:process.env});if(e&&e.command)return e}}catch{}return null}function defaultRunInstall(e){try{const t=spawnSync(e.command,e.args,{encoding:"utf8",timeout:18e4,stdio:["ignore","pipe","pipe"],shell:!0===e.shell,windowsHide:!0});return t.error?{ok:!1,error:String(t.error.message||t.error)}:0!==t.status?{ok:!1,error:String((t.stderr||t.stdout||"").trim()||`exited ${t.status}`)}:{ok:!0,output:String(t.stdout||"")}}catch(e){return{ok:!1,error:String(e&&e.message||e)}}}const WINDOW_STDERR_NOISE=[/libva (error|warning)/i,/^libva:/i,/vaGetDriverNameByIndex|vaInitialize/,/gpu_init\.cc.*Passthrough is not supported/i,/gpu_persistent_cache\.cc.*Persistent cache error/i,/ERROR:gpu\/command_buffer\/service\/gles2_cmd_decoder/,/swiftshader|llvmpipe|MESA-LOADER|libGL error|DRI3|MESA-VULKAN/i,/^MESA-(VOID|DRI|LOADER)/,/vulkan.*(incomplete|not supported|failed)/i];function forwardWindowStderr(e,t){let r="";e.setEncoding("utf8"),e.on("data",e=>{r+=e;const n=r.split("\n");r=n.pop()||"";for(const e of n)e.trim()&&(WINDOW_STDERR_NOISE.some(t=>t.test(e))||write(t,e))});const n=()=>{r.trim()&&!WINDOW_STDERR_NOISE.some(e=>e.test(r))&&write(t,r),r=""};e.on("end",n),e.on("close",n),e.on("error",()=>{})}function statusOf(e){return"number"==typeof e.status?e.status:"SIGINT"===e.signal?130:"SIGTERM"===e.signal?143:1}function run(e,t){const r=t||{},n=r.stderr||process.stderr,s=r.stdout||process.stdout,i=r.input||probes.collect({argv:e}),o=Array.isArray(e)?{...i,argv:e}:i,a=release.versionRequest(o.argv);if(a){const e=a.verbose?r.readFaceVersions?r.readFaceVersions():readFaceVersions(r.binDir):null;return write(s,release.renderVersion({product:{name:PRODUCT.name,version:PRODUCT.version},faces:e})),0}if((r.helpRequest||productHelp.helpRequest)(o.argv))return write(s,productHelp.renderHelp({version:PRODUCT.version})),0;const c=(r.updateRequest||productUpdate.updateRequest)(o.argv);if(c&&"help"===c.action)return write(s,productUpdate.renderUsage(PRODUCT.version)),0;if(c)return runUpdate(c,r,{stdout:s,stderr:n,input:o});const d=(o.argv||[]).indexOf("doctor");if(-1!==d&&!(o.argv||[]).slice(0,d).some(e=>!e.startsWith("-"))){const e=r.doctor||require("../src/doctor.js"),t=Object.assign({env:o.env,stdout:s,electron:o._electron||r.electron||null},r.doctorDeps||{}),n=e.main((o.argv||[]).slice(d+1),t);return"number"==typeof n?n:2}const u=decide(o),p=r.permissions||require("../src/permissions.js"),l=(o.argv||[]).indexOf(p.SKIP_FLAG||"--dangerously-skip-permissions"),f=Boolean(o.tty&&o.tty.stdin&&o.tty.stdout),g=f?"interactive":"headless",m=r.stored||p.storedPermissionFacts(r.storedOpts||{}),h=p.resolvePosture({rules:void 0!==r.rules?r.rules:m.rules,gate:void 0!==r.gate?r.gate:m.confirmationsOn,permissionMode:void 0!==r.permissionMode?r.permissionMode:m.permissionMode,flag:-1!==l,env:o.env,interactive:f,childKind:g});h.warning&&write(n,`aegis: ${h.warning}`),h.skip&&h.skipFromFlag&&write(n,p.skipReport(h));const w=-1===l?u.args:u.args.filter(e=>e!==(p.SKIP_FLAG||"--dangerously-skip-permissions")),v=h.skipFromFlag?{AEGISONE_SKIP_PERMISSIONS:"1"}:{},S={AEGIS_INSTALL_METHOD:"npm"};if("1"===(o.env||{}).AEGISONE_PRINT_DECISION&&write(n,"aegis: decision "+JSON.stringify({face:u.face,kind:u.kind,reason:u.reason,args:w,skip:h.skip})),null===u.face)return write(n,`aegis: ${u.error}`),u.hint&&write(n,`aegis: ${u.hint}`),u.code||2;u.notice&&write(n,`aegis: ${u.notice} — running the terminal face.`);const I=r.spawnSync||spawnSync,_=r.spawn||spawn,O=Object.assign({},process.env,r.env||{});if(u.face===FACE.TUI){const e=o._cliBin||r.cliBin;return e?statusOf(I(process.execPath,[e,...w],{stdio:"inherit",env:Object.assign({},O,v,S),argv0:"aegiscode"})||{}):(write(n,"aegis: the terminal face is not installed beside aegisone."),write(n,"aegis: reinstall aegisone, or set AEGISONE_CLI_BIN to bin/aegiscode.js."),127)}const E=o._electron||r.electron,y=o._desktopMain||r.desktopMain,k=WIN.plan({decision:u,electron:Boolean(E),target:r.target||o.target});if(!k||!y)return write(n,"aegis: cannot open the window — Electron or the desktop entry point went missing after the check."),write(n,"aegis: Use --tui for the terminal face."),2;delete O.ELECTRON_RUN_AS_NODE;const R=WIN.open(k,{main:y,args:w,env:Object.assign({},O,v,S)},{openElectron:e=>{const t=_(process.execPath,[e.main,...e.args],{stdio:["ignore","ignore","pipe"],env:e.env,detached:!1});return t&&t.stderr&&forwardWindowStderr(t.stderr,n),t}});if(!R||!R.ok)return write(n,`aegis: cannot open the window — ${R&&R.msg||"no usable window plan"}.`),write(n,"aegis: Use --tui for the terminal face."),2;const D=R.handle;return new Promise(e=>{D.on("error",t=>{write(n,`aegis: could not start the window: ${t&&t.message}`),e(1)}),D.on("exit",(t,r)=>e(statusOf({status:t,signal:r})))})}function main(e){const t=run(e);return"number"==typeof t?(process.exitCode=t,t):t.then(e=>(process.exitCode=e,e))}if(module.exports={main:main,run:run,statusOf:statusOf,EXIT_USAGE:2,isInstalledLayout:isInstalledLayout,defaultFetchLatest:defaultFetchLatest},require.main===module){const e=main(process.argv.slice(2));e&&"function"==typeof e.then&&e.catch(e=>{write(process.stderr,`aegis: ${e&&e.stack||e}`),process.exitCode=1})}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegisone",
3
3
  "productName": "AEGISONE",
4
- "version": "1.0.64",
4
+ "version": "1.0.65",
5
5
  "description": "AEGISONE — one product, two faces. `aegis` opens the window when there is nothing else to do and runs the terminal otherwise; `aegiscode` keeps behaving exactly as it always has.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
package/scripts/bump.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import e from"node:fs";import r from"node:path";import{fileURLToPath as n}from"node:url";import{createRequire as o}from"node:module";const s=r.dirname(n(import.meta.url)),i=o(import.meta.url)("../src/release.js");export const ROOT=r.join(s,"..","..");export function bumpTargets(e){const n=e||ROOT;return[{file:"one/package.json",kind:"json",abs:r.join(n,"one","package.json")},{file:"one/README.md",kind:"readme",abs:r.join(n,"one","README.md")},{file:"cli/package.json",kind:"json",abs:r.join(n,"cli","package.json")},{file:"desktop/package.json",kind:"json",abs:r.join(n,"desktop","package.json")}]}export function plan(r){const n=r||{},o=n.root||ROOT,s=n.read||(r=>e.readFileSync(r,"utf8")),t=i.parseVersion(n.version).text,a=!0===n.repair,c=bumpTargets(o),p=i.deriveFaceVersions(t),d=e=>{if("one/package.json"===e||"one/README.md"===e)return t;if("cli/package.json"===e)return p.aegiscode.version;if("desktop/package.json"===e)return p["aegis-desktop"].version;throw new Error(`no version rule for ${e}`)},f=c.map((e=>({file:e.file,kind:e.kind,content:s(e.abs),version:d(e.file)}))),l=JSON.parse(f[0].content).version,u=i.deriveFaceVersions(l);for(const e of f.slice(2)){const r=JSON.parse(e.content).name,n=u[r];if(!n)throw new Error(`${e.file}: unexpected package name ${JSON.stringify(r)}`);const o=JSON.parse(e.content).version;if(o!==n.version&&!a)throw new Error(`${e.file} carries ${r} ${o}, but product ${l} derives ${n.version} — the tree is already inconsistent; run \`node test/one-version.test.mjs\` to see all of it, then bump from a clean state`);if(a){const e=i.deriveFaceVersion(t,i.FACE_LINES.find((e=>e.package===r))),n=i.releaseCounter(o);if(i.releaseCounter(e)<n)throw new Error(`repair would move ${r} backwards: ${o} -> ${e} — a published version is never re-cut`)}}const m=i.planBump({version:t,documents:f});return{version:t,from:l,faces:p,files:m,changed:m.filter((e=>!e.unchanged)).length}}export function main(n,o){const s=o||{},t=s.stdout||process.stdout,a=s.stderr||process.stderr,c=(Array.isArray(n)?n:[]).map(String),p=c.includes("--dry-run"),d=c.includes("--repair"),f=c.filter((e=>!e.startsWith("--")));if(1!==f.length)return a.write("usage: node one/scripts/bump.mjs <major|minor|patch|X.Y.Z> [--dry-run] [--repair]\n"),2;let l;try{const n=JSON.parse(e.readFileSync(r.join(ROOT,"one","package.json"),"utf8")).version;l=plan({root:ROOT,version:i.nextVersion(n,f[0]),repair:d})}catch(e){return a.write(`bump: ${e&&e.message||e}\n`),1}let u=0;for(const n of l.files)n.unchanged||(p?t.write(i.unifiedDiff(n.before,n.content,n.file)):(e.writeFileSync(r.join(ROOT,n.file),n.content),u++));return p?t.write(`bump: dry run — ${l.from} -> ${l.version}; aegiscode ${l.faces.aegiscode.version}, aegis-desktop ${l.faces["aegis-desktop"].version}; nothing written\n`):t.write(`bump: ${l.from} -> ${l.version} (aegiscode ${l.faces.aegiscode.version}, aegis-desktop ${l.faces["aegis-desktop"].version}) — ${u} file(s) written\n`),0}!function(){const e=process.argv[1];let o=!1;if(e)try{o=r.resolve(e)===n(import.meta.url)}catch{o=!1}o&&(process.exitCode=main(process.argv.slice(2)))}();
4
+ import e from"node:fs";import r from"node:path";import{fileURLToPath as n}from"node:url";import{createRequire as o}from"node:module";const s=r.dirname(n(import.meta.url)),i=o(import.meta.url)("../src/release.js");export const ROOT=r.join(s,"..","..");export function bumpTargets(e){const n=e||ROOT;return[{file:"one/package.json",kind:"json",abs:r.join(n,"one","package.json")},{file:"one/README.md",kind:"readme",abs:r.join(n,"one","README.md")},{file:"cli/package.json",kind:"json",abs:r.join(n,"cli","package.json")},{file:"desktop/package.json",kind:"json",abs:r.join(n,"desktop","package.json")}]}export function plan(r){const n=r||{},o=n.root||ROOT,s=n.read||(r=>e.readFileSync(r,"utf8")),t=i.parseVersion(n.version).text,a=!0===n.repair,c=bumpTargets(o),p=i.deriveFaceVersions(t),d=e=>{if("one/package.json"===e||"one/README.md"===e)return t;if("cli/package.json"===e)return p.aegiscode.version;if("desktop/package.json"===e)return p["aegis-desktop"].version;throw new Error(`no version rule for ${e}`)},f=c.map(e=>({file:e.file,kind:e.kind,content:s(e.abs),version:d(e.file)})),l=JSON.parse(f[0].content).version,u=i.deriveFaceVersions(l);for(const e of f.slice(2)){const r=JSON.parse(e.content).name,n=u[r];if(!n)throw new Error(`${e.file}: unexpected package name ${JSON.stringify(r)}`);const o=JSON.parse(e.content).version;if(o!==n.version&&!a)throw new Error(`${e.file} carries ${r} ${o}, but product ${l} derives ${n.version} — the tree is already inconsistent; run \`node test/one-version.test.mjs\` to see all of it, then bump from a clean state`);if(a){const e=i.deriveFaceVersion(t,i.FACE_LINES.find(e=>e.package===r)),n=i.releaseCounter(o);if(i.releaseCounter(e)<n)throw new Error(`repair would move ${r} backwards: ${o} -> ${e} — a published version is never re-cut`)}}const m=i.planBump({version:t,documents:f});return{version:t,from:l,faces:p,files:m,changed:m.filter(e=>!e.unchanged).length}}export function main(n,o){const s=o||{},t=s.stdout||process.stdout,a=s.stderr||process.stderr,c=(Array.isArray(n)?n:[]).map(String),p=c.includes("--dry-run"),d=c.includes("--repair"),f=c.filter(e=>!e.startsWith("--"));if(1!==f.length)return a.write("usage: node one/scripts/bump.mjs <major|minor|patch|X.Y.Z> [--dry-run] [--repair]\n"),2;let l;try{const n=JSON.parse(e.readFileSync(r.join(ROOT,"one","package.json"),"utf8")).version;l=plan({root:ROOT,version:i.nextVersion(n,f[0]),repair:d})}catch(e){return a.write(`bump: ${e&&e.message||e}\n`),1}let u=0;for(const n of l.files)n.unchanged||(p?t.write(i.unifiedDiff(n.before,n.content,n.file)):(e.writeFileSync(r.join(ROOT,n.file),n.content),u++));return p?t.write(`bump: dry run — ${l.from} -> ${l.version}; aegiscode ${l.faces.aegiscode.version}, aegis-desktop ${l.faces["aegis-desktop"].version}; nothing written\n`):t.write(`bump: ${l.from} -> ${l.version} (aegiscode ${l.faces.aegiscode.version}, aegis-desktop ${l.faces["aegis-desktop"].version}) — ${u} file(s) written\n`),0}!function(){const e=process.argv[1];let o=!1;if(e)try{o=r.resolve(e)===n(import.meta.url)}catch{o=!1}o&&(process.exitCode=main(process.argv.slice(2)))}();
package/scripts/bundle.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const fs=require("node:fs"),path=require("node:path"),host=require("../src/host.js"),release=require("../src/release.js"),RELEASES="https://github.com/aegiscloud-devs/aegiscode-plugin/releases";function bundleFor(e){const s=e||{};return s.win32?{os:"win",ext:"exe",bundle:"NSIS installer"}:"darwin"===s.platform?{os:"mac",ext:"dmg",bundle:"disk image"}:"linux"===s.platform?{os:"linux",ext:"AppImage",bundle:"AppImage"}:{os:s.platform||"unknown",ext:null,bundle:null}}function desktopVersion(e){for(const s of e||[])try{return JSON.parse(fs.readFileSync(path.join(s,"package.json"),"utf8")).version}catch{}const s=release.FACE_LINES.find((e=>"desktop"===e.dir));return release.deriveFaceVersion(require("../package.json").version,s)}function faceDirs(){return[path.join(__dirname,"..","vendor","desktop"),path.join(__dirname,"..","..","desktop")]}function describe(e){const s=e||{},r=s.facts||host.hostSeams({platform:s.platform}),o=s.product||require("../package.json").version,t=s.faceVersion||desktopVersion(s.dirs||faceDirs()),n=bundleFor(r),i=release.tagFor(o);return n.ext?`AEGIS Desktop ${t} for ${n.os} (${n.bundle}) — ${RELEASES}/tag/${i} (asset: aegis-desktop-${t}-${n.os}-*.${n.ext})`:`AEGIS Desktop: no prebuilt bundle for ${n.os} — ${RELEASES}/tag/${i}`}function main(e){const s=e||[];let r,o=!1;for(let e=0;e<s.length;e++)"--platform"===s[e]?r=s[++e]:"--json"===s[e]&&(o=!0);const t=host.hostSeams({platform:r}),n=require("../package.json").version,i=desktopVersion(faceDirs()),a=bundleFor(t);return o?process.stdout.write(JSON.stringify({platform:t.platform,product:n,faceVersion:i,tag:release.tagFor(n),os:a.os,ext:a.ext},null,2)+"\n"):process.stdout.write(describe({facts:t,product:n,faceVersion:i})+"\n"),0}module.exports={bundleFor:bundleFor,describe:describe,desktopVersion:desktopVersion,faceDirs:faceDirs,main:main,RELEASES:RELEASES},require.main===module&&(process.exitCode=main(process.argv.slice(2)));
3
+ "use strict";const fs=require("node:fs"),path=require("node:path"),host=require("../src/host.js"),release=require("../src/release.js"),RELEASES="https://github.com/aegiscloud-devs/aegiscode-plugin/releases";function bundleFor(e){const s=e||{};return s.win32?{os:"win",ext:"exe",bundle:"NSIS installer"}:"darwin"===s.platform?{os:"mac",ext:"dmg",bundle:"disk image"}:"linux"===s.platform?{os:"linux",ext:"AppImage",bundle:"AppImage"}:{os:s.platform||"unknown",ext:null,bundle:null}}function desktopVersion(e){for(const s of e||[])try{return JSON.parse(fs.readFileSync(path.join(s,"package.json"),"utf8")).version}catch{}const s=release.FACE_LINES.find(e=>"desktop"===e.dir);return release.deriveFaceVersion(require("../package.json").version,s)}function faceDirs(){return[path.join(__dirname,"..","vendor","desktop"),path.join(__dirname,"..","..","desktop")]}function describe(e){const s=e||{},r=s.facts||host.hostSeams({platform:s.platform}),o=s.product||require("../package.json").version,t=s.faceVersion||desktopVersion(s.dirs||faceDirs()),n=bundleFor(r),i=release.tagFor(o);return n.ext?`AEGIS Desktop ${t} for ${n.os} (${n.bundle}) — ${RELEASES}/tag/${i} (asset: aegis-desktop-${t}-${n.os}-*.${n.ext})`:`AEGIS Desktop: no prebuilt bundle for ${n.os} — ${RELEASES}/tag/${i}`}function main(e){const s=e||[];let r,o=!1;for(let e=0;e<s.length;e++)"--platform"===s[e]?r=s[++e]:"--json"===s[e]&&(o=!0);const t=host.hostSeams({platform:r}),n=require("../package.json").version,i=desktopVersion(faceDirs()),a=bundleFor(t);return o?process.stdout.write(JSON.stringify({platform:t.platform,product:n,faceVersion:i,tag:release.tagFor(n),os:a.os,ext:a.ext},null,2)+"\n"):process.stdout.write(describe({facts:t,product:n,faceVersion:i})+"\n"),0}module.exports={bundleFor:bundleFor,describe:describe,desktopVersion:desktopVersion,faceDirs:faceDirs,main:main,RELEASES:RELEASES},require.main===module&&(process.exitCode=main(process.argv.slice(2)));
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import{existsSync as t}from"node:fs";import{createRequire as n}from"node:module";import{dirname as r,join as o}from"node:path";import{fileURLToPath as i}from"node:url";const e=r(i(import.meta.url));(async function(){const r=function(){const n=[o(e,"..","vendor","cli","vendor","client","install-register.js"),o(e,"..","vendor","client","install-register.js"),o(e,"..","..","client","install-register.js")];for(const r of n)if(t(r))return r;return null}();if(!r)return;const i=n(import.meta.url)(r);await i.runPostinstall({app:"npm-postinstall"})})().catch((()=>{}));
4
+ import{existsSync as t}from"node:fs";import{createRequire as n}from"node:module";import{dirname as r,join as o}from"node:path";import{fileURLToPath as i}from"node:url";const e=r(i(import.meta.url));(async function(){const r=function(){const n=[o(e,"..","vendor","cli","vendor","client","install-register.js"),o(e,"..","vendor","client","install-register.js"),o(e,"..","..","client","install-register.js")];for(const r of n)if(t(r))return r;return null}();if(!r)return;const i=n(import.meta.url)(r);await i.runPostinstall({app:"npm-postinstall"})})().catch(()=>{});
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import e from"node:fs";import s from"node:path";import{spawnSync as r}from"node:child_process";import{fileURLToPath as t,pathToFileURL as o}from"node:url";import{createRequire as n}from"node:module";const i=s.dirname(t(import.meta.url)),a=n(import.meta.url);export const ONE_DIR=s.join(i,"..");export const REPO_DIR=s.join(ONE_DIR,"..");export const CLI_DIR=s.join(REPO_DIR,"cli");export const DESKTOP_DIR=s.join(REPO_DIR,"desktop");export const CLI_VENDOR=s.join(CLI_DIR,"vendor");export const DESKTOP_VENDOR=s.join(DESKTOP_DIR,"vendor");export const ONE_VENDOR=s.join(ONE_DIR,"vendor");export const MANIFEST=[{src:"client/aegis.js",shapes:["mirror","flat"],note:"the thin transport — the one implementation of the wire format"},{src:"client/update.js",shapes:["mirror","flat"],note:"the npm update checker (the desktop own update path)"},{src:"client/foreign-memory.js",shapes:["mirror","flat"],note:"required by mcp/tools.js as ../client/foreign-memory.js"},{src:"client/foreign-sessions.js",shapes:["mirror","flat"],note:"required by desktop/main.js as ./vendor/foreign-sessions.js"},{src:"client/credentials.js",shapes:["mirror","flat"],note:"the account credential store, shared by all three hosts"},{src:"client/session-store.js",shapes:["mirror","flat"],note:"the unified session store — one list in every host"},{src:"client/session-search.js",shapes:["mirror","flat"],note:"the SESSION search ranking: the desktop sheet (Cmd/Ctrl+K) and the terminal /resume picker filter with this one module, pure and fs-free"},{src:"client/credits.js",shapes:["mirror","flat"],note:"the licence/attribution payload: parses LICENSING.md and the two NOTICE files for Help > Credits & licence and /license + /credits"},{src:"client/naming.js",shapes:["mirror","flat"],note:"the conversation-naming ladder — ONE implementation for the terminal and the window (cli/src/naming.js re-exports it)"},{src:"client/prefs.js",shapes:["mirror","flat"],note:"the shared non-secret preference store (D5) — the CLI and the desktop store both read/write it"},{src:"client/env-file.js",shapes:["mirror","flat"],note:"the shared ~/.aegiscode/.env loader, resolved before any key is read"},{src:"client/auto-provision.js",shapes:["mirror","flat"],note:"free device key on first launch; requires ./device-fingerprint.js"},{src:"client/device-fingerprint.js",shapes:["mirror","flat"],note:"the machine identity auto-provision.js and presence.js require"},{src:"client/install-register.js",shapes:["mirror","flat"],note:"register-at-install; the shared body behind both postinstall hooks"},{src:"client/presence.js",shapes:["mirror","flat"],note:"the heartbeat beacon; requires ./presence-constants.js and ./device-fingerprint.js"},{src:"client/presence-constants.js",shapes:["mirror","flat"],note:"the beacon constants — a package without them loses the beacon silently"},{src:"client/touch.js",shapes:["mirror","flat"],note:"phi(alpha): the digest module fingerprint.js requires as ./touch.js"},{src:"client/fingerprint.js",shapes:["mirror","flat"],note:"phi(alpha): the sealed session record, resolved by src/fingerprint.js"},{src:"client/authorship-key.js",shapes:["mirror","flat"],note:"phi(alpha): the authorship key, required by ./attest.js and ./record-vault.js"},{src:"client/attest.js",shapes:["mirror","flat"],note:"phi(alpha): attestation, requires ./fingerprint.js and ./authorship-key.js"},{src:"client/record-vault.js",shapes:["mirror","flat"],note:"the vault, and its refusal to copy the key with the record"},{src:"client/brain-catalog.js",shapes:["mirror","flat"],note:"the pooled-brain rule, required at load time by the engine and src/models.js"},{src:"client/byok-catalog.js",shapes:["mirror","flat"],note:"the BYOK model additions the server catalog does not name"},{src:"client/catalog-client.js",shapes:["mirror","flat"],note:"the server's cached catalog, layered between the shipped additions and the user's own models"},{src:"client/user-models.js",shapes:["mirror","flat"],note:"the models the USER declares, in one file both hosts read (requires ./credentials.js)"},{src:"client/model-discovery.js",shapes:["mirror","flat"],note:"asks the vendor what it serves, so adding a new model is not a memory test (requires ./user-models.js)"},{src:"client/model-sync.js",shapes:["mirror","flat"],note:"reconciles the ids AEGIS promotes against the ids each vendor issues, and writes the difference through ./user-models.js (requires ./model-discovery.js)"},{src:"client/model-autosync.js",shapes:["mirror","flat"],note:"the scheduler that turns the modelAutoSync preference into work: runs ./model-sync.js on a cadence in whichever host is open (requires ./model-sync.js)"},{src:"client/hooks.js",shapes:["mirror","flat"],note:"the shared hook layer behind /hooks and the repo guard installer"},{src:"client/skills.js",shapes:["mirror","flat"],note:"the ONE skill registry: /skills lists and creates through it and the window's Settings > Skills card reads the same scan, so a packaged CLI that loses this row and the desktop that keeps it would disagree about which skills exist"},{src:"client/speech.js",shapes:["mirror","flat"],note:"the pure dictation decision (may we dictate, with what argv) behind the composer mic; desktop/lib/speech-resolve.js requires it as ../vendor/speech.js in a packaged build"},{src:"client/platform.js",shapes:["mirror","flat"],note:"the ONE place that decides which OS this is (Phase 30.1)"},{src:"client/topup.js",shapes:["mirror","flat"],note:"the token-bank top-up: amount bounds, the balance reading, and the credit watch every host drives"},{src:"client/google-signin.js",shapes:["mirror","flat"],note:"the localhost half of aegis1's desktop Google OAuth round-trip; `connect --google` drives it"},{src:"client/drive-connect.js",shapes:["mirror","flat"],note:"the desktop half of aegis1's Drive OAuth (/connect/drive, /api/drive/token); requires ./aegis.js only via the caller"},{src:"client/drive-upload.js",shapes:["mirror","flat"],note:"the Drive v3 REST wrapper that uploads the memory backup and one conversation per save"},{src:"client/conversation-export.js",shapes:["mirror","flat"],note:"the authorship stamp at the top of every uploaded file, and the two backup scope names"},{src:"mcp/tools.js",shapes:["mirror"],note:"the shared tool registry; requires ../client/foreign-memory.js"},{src:"mcp/server.js",shapes:["mirror"],note:"the stdio MCP server every installed editor config names (compiled, never required)"},{src:"mcp/admission.js",shapes:["mirror"],note:"the admission gate server.js requires at load (`./admission.js`): which harness may call the bridge, and what it may run — omitted from the manifest when 2066f82 added it, so both staged trees shipped a server that could not load"},{src:"hosts/spec.js",shapes:["mirror"],note:"the canonical server spec, staged under its own directory so it finds vendor/mcp/server.js"},{src:"hosts/targets.js",shapes:["mirror"],note:"the editor target registry"},{src:"hosts/install.js",shapes:["mirror"],note:"the merge-only installer behind aegiscode mcp install"},{src:"hosts/openai-shim.js",shapes:["mirror"],note:"the loopback OpenAI-compatible shim"},{src:"desktop/renderer/usage.js",shapes:["mirror"],note:"the pure usage mapping shared by the window and the terminal"},{src:"desktop/lib/local/engine.js",shapes:["mirror"],note:"the agent loop, reused as-is (one loop, not a second one drifting)"},{src:"desktop/lib/local/claude-pro.js",shapes:["mirror"],note:"the Claude Code Pro transport; requires ./../../one/src/child.js at call time"},{src:"one/src/child.js",shapes:["mirror"],note:"the ONE claude-child argv builder (rule 4); resolved by claude-pro.js at call time"},{src:"one/src/permissions.js",shapes:["mirror"],note:"resolvePosture() — the permission half of the argv, resolved at call time"},{src:"desktop/lib/local/local.js",shapes:["mirror"],note:"the local model transport and its fail-closed base-URL check"},{src:"desktop/lib/local/context.js",shapes:["mirror"],note:"the token-budget trimmer local.js requires at load"},{src:"desktop/lib/local/attachments.js",shapes:["mirror"],note:"content-part builder for dropped files; required at load by engine.js and local.js"},{src:"desktop/lib/local/session-rounds.js",shapes:["mirror"],note:"interrupted-turn bookkeeping; required at load by engine.js"},{src:"desktop/lib/local/pro-sessions.js",shapes:["mirror"],note:"durable Claude-Pro conversation session ids; required at load by engine.js"},{src:"desktop/lib/local/tools.js",shapes:["mirror"],note:"the tool implementations (persistent shell, editFile, grep, exec)"},{src:"desktop/lib/local/shell.js",shapes:["mirror"],note:"the persistent shell, required by tools.js"},{src:"desktop/lib/local/sandbox.js",shapes:["mirror"],note:"the outcome bound (agent-safety-plan §1b), required by shell.js + tools.js"},{src:"desktop/lib/local/sandbox-bwrap.js",shapes:["mirror"],note:"bubblewrap mechanism behind sandbox.js (agent-safety-plan §1d)"},{src:"desktop/lib/local/sandbox-seatbelt.js",shapes:["mirror"],note:"Seatbelt mechanism behind sandbox.js (agent-safety-plan §1d)"},{src:"desktop/lib/local/sandbox-appcontainer.js",shapes:["mirror"],note:"AppContainer mechanism behind sandbox.js (agent-safety-plan §1e)"},{src:"desktop/lib/local/perm-rules.js",shapes:["mirror"],note:"stored /permissions rules for the desktop gate (agent-safety-plan §2), required by engine.js"},{src:"desktop/lib/local/perm-write.js",shapes:["mirror"],note:'the durable "always allow this command" answer (agent-safety-plan §3), required by main.js'},{src:"desktop/lib/local/perm-store.js",shapes:["mirror"],note:"the Settings rules editor (agent-safety-plan §4), required by main.js"},{src:"desktop/lib/local/integrity.js",shapes:["mirror"],note:"the desktop second gate; required at load by shell.js and tools.js, and the seal over its own four units"},{src:"desktop/main.js",shapes:["mirror"],bytesOnly:!0,note:"seal unit d1 — hashed by integrity.js as BYTES and never required from the mirror, so its own requires (the whole Electron main-process closure) are not staged behind it"},{src:"desktop/lib/local/spill.js",shapes:["mirror"],note:"oversized-output spill, required at load by tools.js and shell.js"},{src:"desktop/lib/local/exec-plan.js",shapes:["mirror"],note:"exec one-shot eligibility classifier, required at load by engine.js"},{src:"desktop/lib/local/agents.js",shapes:["mirror"],note:"Task subagents"},{src:"desktop/lib/local/prompt.js",shapes:["mirror"],note:"the system prompt builder"},{src:"desktop/lib/settings.js",shapes:["mirror"],note:"the provider-config store (base URL + key per provider)"},{src:"desktop/lib/local/turn-guard.js",shapes:["mirror"],note:"engine.js requires it at load; it requires ./git-scope.js"},{src:"desktop/lib/local/repeat-guard.js",shapes:["mirror"],note:"engine.js requires it at load — identical-call detection, no deps of its own"},{src:"desktop/lib/local/verify-stop.js",shapes:["mirror"],note:"engine.js requires it at load — edited-but-unchecked nudge, no deps of its own"},{src:"desktop/lib/local/check-command.js",shapes:["mirror"],note:"verify-stop.js requires it lazily — which command would check this repo; no deps"},{src:"desktop/lib/local/worktree-lock.js",shapes:["mirror"],note:"engine.js requires it at load"},{src:"desktop/lib/local/git-scope.js",shapes:["mirror"],note:"the write-scope rule turn-guard.js and the queues share"},{src:"desktop/lib/local/queue.js",shapes:["mirror"],note:"the autonomous work queue"},{src:"desktop/lib/local/autonomous.js",shapes:["mirror"],note:"the unattended worker; requires ./queue.js and ./git-scope.js"},{src:"desktop/lib/local/entitlement.js",shapes:["mirror"],note:"the shared Pro gate (account probe injected by the caller)"},{src:"desktop/lib/local/covenant.js",shapes:["mirror"],note:"the pre-action gate engine.js requires unconditionally at load"},{src:"desktop/lib/local/aegis-seal.mjs",shapes:["mirror"],note:"the codec covenant.js requires the first time it decodes"},{src:"covenant/aegis.seal",shapes:["mirror","nested"],note:"the sealed covenant (AES/1 container) — path shape is load-bearing"},{src:"covenant/README.md",shapes:["mirror","nested"],note:"the decode notice shipped beside the artifact"},{src:"tools/agent-gate.mjs",shapes:["mirror","flat"],note:"the in-process half of the lock; without it a packaged app had NO gate"},{src:"one/src/selfhost.js",shapes:["mirror","flat"],note:"the packaged launcher decision — which face this artifact was asked for"},{src:"one/src/protocol.js",shapes:["mirror","flat"],note:"the core/frontend seam; desktop/lib/local/pty-host.js speaks it over Electron IPC"},{src:"one/src/iface/pty.js",shapes:["mirror","flat"],note:"plans pty|refuse and spawns the native pty; required by desktop/lib/local/pty-host.js at call time"}];export function entriesFor(e){const r=[];for(const t of MANIFEST){if(!t.shapes.includes(e))continue;let o;if("mirror"===e)o=s.join(CLI_VENDOR,t.src);else if("flat"===e)o=s.join(DESKTOP_VENDOR,s.basename(t.src));else{if("nested"!==e)throw new Error(`predist: unknown shape ${e}`);o=s.join(DESKTOP_VENDOR,t.src)}r.push({src:t.src,dest:o,from:s.join(REPO_DIR,t.src)})}return r}export const SHAPES=["mirror","flat","nested"];const c=[["cli",CLI_DIR,["bin","src","vendor","scripts","package.json","README.md","LICENSE"]],["desktop",DESKTOP_DIR,["main.js","preload.js","lib","renderer","bin","vendor","package.json","README.md"]]],l=new Set(["node_modules","release",".git",".cache","out"]),d=new Map([["desktop/vendor",new Set(["faces","sandbox"])]]);function h(r,t,o){const n=o||new Set,i=(e,s)=>l.has(e)||e.endsWith(".log")||n.has(s),a=(r,t)=>{if(e.mkdirSync(s.dirname(t),{recursive:!0}),e.copyFileSync(r,t),!e.readFileSync(r).equals(e.readFileSync(t)))throw new Error(`predist: bundle copy differs from source: ${s.relative(REPO_DIR,r)}`)},c=(r,o)=>{const n=e.lstatSync(r);if(!n.isSymbolicLink())if(n.isFile())a(r,s.join(t,o));else for(const t of e.readdirSync(r)){const e=o?s.join(o,t):t;i(t,e)||c(s.join(r,t),e)}};e.lstatSync(r).isFile()?a(r,t):c(r,"")}const p=12e4,u=6e5,m=50,f="AEGISONE_PREDIST_LOCK_TOKEN";let g=null,j=!1,y=0;function b(e){try{return process.kill(e,0),!0}catch(e){return Boolean(e)&&"EPERM"===e.code}}const w=e=>new Promise((s=>setTimeout(s,e)));function v(){if(y>0)return void y--;const s=g,r=j,t=process.env[f];if(g=null,j=!1,s&&r){t&&delete process.env[f];try{e.unlinkSync(s)}catch{}}}export async function acquireStageLock(r){if(g)return y++,v;const t=r&&r.stdout||process.stdout;return await async function(r){const t=function(){const r=s.join(REPO_DIR,".git");let t=r;try{if(!e.lstatSync(r).isDirectory()){const o=/^gitdir:\s*(.+)$/m.exec(e.readFileSync(r,"utf8"));o&&(t=s.resolve(REPO_DIR,o[1].trim()))}}catch{t=r}return s.join(t,"aegisone-predist.lock")}(),o=Date.now()+p,n=process.env[f]||null;let i=null,a=!1;for(;;){if(n)try{const s=String(e.readFileSync(t,"utf8")).split("\n")[1];if(s&&s.trim()===n)return g=t,void(j=!1)}catch{}try{i=`${Date.now().toString(36)}-${process.pid}-${Math.random().toString(36).slice(2,10)}`;const s=e.openSync(t,"wx");return e.writeSync(s,`${process.pid}\n${i}\n`),e.closeSync(s),g=t,j=!0,void(process.env[f]=i)}catch(e){if(!e||"EEXIST"!==e.code)throw e}let s=null,c=0;try{s=e.statSync(t),c=Number(String(e.readFileSync(t,"utf8")).split("\n")[0].trim())}catch{continue}if(Date.now()-s.mtimeMs>u||Number.isFinite(c)&&c>0&&!b(c)){r(`predist: breaking an abandoned staging lock (pid ${c||"unknown"})`);try{e.unlinkSync(t)}catch{}}else{if(Date.now()>o)throw new Error(`predist: another stager (pid ${c||"unknown"}) has held ${t} for over ${Math.round(p/1e3)}s. Staging is destructive — it removes and rewrites cli/vendor, desktop/vendor and one/vendor — so it will not run concurrently with a peer. Wait for it, or delete the lock if that process is gone.`);a||(a=!0,r(`predist: another stager (pid ${c||"unknown"}) is running — waiting for it (concurrent staging would read a vendor tree the peer is rewriting)`)),await w(m+Math.floor(Math.random()*m))}}}((e=>t.write(`${e}\n`))),v}function k(r,t){const o=[];for(const s of r){if(!e.existsSync(s.from))throw new Error(`predist: missing shared module: ${s.src} (expected at ${s.from})`);if(E(s.from,s.dest),!e.readFileSync(s.from).equals(e.readFileSync(s.dest)))throw new Error(`predist: staged copy differs from source: ${s.src}`);o.push(s)}return t&&function(r,t){if(!e.existsSync(r))return 0;const o=r=>{for(const n of e.readdirSync(r,{withFileTypes:!0})){const i=s.join(r,n.name);if(n.isDirectory()){o(i);try{e.rmdirSync(i)}catch{}}else t.has(i)||(e.unlinkSync(i))}};o(r)}(t,new Set(o.map((e=>e.dest)))),o}function E(r,t){e.mkdirSync(s.dirname(t),{recursive:!0});const o=`${t}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;e.copyFileSync(r,o);try{e.renameSync(o,t)}catch(s){try{e.unlinkSync(o)}catch{}throw s}}export async function stage(t){const n=t||{},i=n.io||{},l=i.stdout||process.stdout,p=(i.stderr||process.stderr,Array.isArray(n.shapes)?n.shapes:[...SHAPES,"bundle"]),u=e=>p.includes(e),m=e=>l.write(`${e}\n`),f=await acquireStageLock(i);try{return await async function({want:t,log:n}){const i={mirror:null,flat:null,nested:null,bundle:null};if(t("mirror")){const e=k(entriesFor("mirror"),CLI_VENDOR);n(`predist: staged ${e.length} shared modules into cli/vendor/`);for(const s of e)n(` ${s.src} -> vendor/${s.src}`);i.mirror={staged:e.length}}if(t("nested")&&(i.nested={staged:k(entriesFor("nested"),null).length}),t("flat")){const e=k(entriesFor("flat"),null);for(const s of e)n(`staged ${s.dest}`);i.flat={staged:e.length}}if(t("mirror")&&t("flat"))for(const r of MANIFEST){if(!r.shapes.includes("mirror")||!r.shapes.includes("flat"))continue;const t=s.join(CLI_VENDOR,r.src),o=s.join(DESKTOP_VENDOR,s.basename(r.src));if(!e.readFileSync(t).equals(e.readFileSync(o)))throw new Error(`predist: the two shapes disagree for ${r.src}`)}if(t("mirror")){const r=function(r){const t=s.join(CLI_VENDOR,"mcp","tools.js");delete a.cache[a.resolve(t)];const{createTools:o}=a(t),n=o({apiBase:"http://127.0.0.1",apiKey:"predist-probe",randomUUID:()=>"id"}).toolList().length;if(0===n)throw new Error("predist: staged registry exposes no tools");const i=a("node:vm"),c=s.join(CLI_VENDOR,"mcp","server.js");new i.Script(e.readFileSync(c,"utf8"),{filename:c});const l=s.join(CLI_VENDOR,"hosts"),d=a(s.join(l,"spec.js")),h=a(s.join(l,"install.js")),p=a(s.join(l,"targets.js")),u=d.resolveServer({AEGIS_MCP_SERVER:""});if(!u.exists||u.path!==c)throw new Error(`predist: staged hosts/spec.js resolves the server as ${u.path} (exists: ${u.exists}), expected ${c}. An installed aegiscode would write editor configs pointing at a file the package never shipped. Candidates were:\n ${u.candidates.join("\n ")}`);const m=p.getTarget("vscode"),f=h.planTarget(m,"user",{ctx:h.hostCtx({home:s.join(CLI_VENDOR,".predist-home"),env:{},cwd:REPO_DIR}),specOpts:{env:{AEGIS_MCP_SERVER:""}}}),g=[];!function e(s){"string"==typeof s?g.push(s):Array.isArray(s)?s.forEach(e):s&&"object"==typeof s&&Object.values(s).forEach(e)}(f.after?JSON.parse(f.after):{});const j=g.some((e=>e===c));if(f.error||!f.changed||!j)throw new Error(`predist: a planned vscode install does not name the staged server (error: ${f.error&&f.error.message}, changed: ${f.changed})`);if("function"!=typeof a(s.join(l,"openai-shim.js")).createShimServer)throw new Error("predist: staged hosts/openai-shim.js exposes no createShimServer");return{count:n,targets:p.targetIds().length,staged:r.length}}(entriesFor("mirror"));n(`predist: staged registry loads standalone (${r.count} tools)`),n(`predist: editor layer verified (${r.targets} host targets, server resolves to vendor/mcp/server.js, shim loads)`);const t=await async function(){const e=s.join(CLI_VENDOR,"tools","agent-gate.mjs");if("function"!=typeof(await import(o(e).href)).run)throw new Error("predist: staged tools/agent-gate.mjs exposes no run()");return e}();n(`predist: ${s.relative(REPO_DIR,t)} loads standalone and exposes run()`),i.mirror.proof=r}if(t("flat")){const r=function(r){const t=new Set(r.map((e=>s.basename(e.dest))));for(const o of r){const r=e.readFileSync(o.dest,"utf8").replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1");for(const e of r.matchAll(/require\(\s*'((?:\.\.?\/)[^']+)'\s*\)/g)){const r=e[1];if(s.basename(r).replace(/\.[cm]?js$/,""),r.replace(/^\.\//,"").startsWith("../"))throw new Error(`predist: flat-staged ${s.basename(o.dest)} requires '${r}', which escapes vendor/ — flattening only works for same-directory requires (add the target to the manifest, or stop staging this file flat)`);const n=r.replace(/^\.\//,"");if(!t.has(n))throw new Error(`predist: flat-staged ${s.basename(o.dest)} requires '${r}', which is not staged into desktop/vendor/ — the packaged app would throw MODULE_NOT_FOUND before the window could open`)}}const o=a(s.join(DESKTOP_VENDOR,"aegis.js"));if(!o||0===Object.keys(o).length)throw new Error("predist: staged desktop/vendor/aegis.js loads but exports nothing");return{files:r.length,exports:Object.keys(o).length}}(entriesFor("flat"));n(`predist: flattened tree is self-contained (${r.files} files, ${r.exports} transport exports) — no staged module escapes vendor/`),i.flat.proof=r}if(t("bundle")){for(const[r,t,o]of c){const i=s.join(ONE_VENDOR,r);e.rmSync(i,{recursive:!0,force:!0});for(const n of o){const o=s.join(t,n);if(!e.existsSync(o)){if("LICENSE"===n||"README.md"===n)continue;throw new Error(`predist: bundle source missing: ${s.relative(REPO_DIR,o)}`)}h(o,s.join(i,n),d.get(`${r}/${n}`))}n(`staged the ${r} face into one/vendor/${r}/`)}const t=function(){const t=s.join(ONE_VENDOR,"cli"),o=s.join(t,"src","deps.js"),n=r(process.execPath,["-e","const d=require(process.argv[1]);console.log(JSON.stringify(d.paths))",o],{cwd:t,encoding:"utf8"});if(0!==n.status)throw new Error(`predist: the bundled CLI does not load: ${n.stderr||n.stdout}`);const i=JSON.parse(n.stdout),a=[];let l=0;for(const[e,r]of Object.entries(i)){const t=s.relative(ONE_VENDOR,r);t.startsWith("..")||s.isAbsolute(t)?a.push(`${e} -> ${r}`):"cli"!==t.split(s.sep)[0]&&l++}if(a.length)throw new Error(`predist: the bundled CLI resolves these shared modules OUTSIDE the bundle (${ONE_VENDOR}) — the product tarball would depend on a repo checkout:\n `+a.join("\n "));if(!e.existsSync(s.join(t,"bin","aegiscode.js")))throw new Error("predist: the bundle has no cli/bin/aegiscode.js");const d=[];for(const[r,t,o]of c)for(const n of o){const o=s.join(ONE_VENDOR,r,n);let i=null,a=null;try{i=e.lstatSync(s.join(t,n))}catch{continue}try{a=e.lstatSync(o)}catch{d.push(`${r}/${n} -> missing`);continue}i.isFile()&&!a.isFile()&&d.push(`${r}/${n} -> not a regular file`),i.isDirectory()&&!a.isDirectory()&&d.push(`${r}/${n} -> not a directory`)}if(d.length)throw new Error(`predist: the bundle staged these in the wrong shape:\n ${d.join("\n ")}`);return{modules:Object.keys(i).length,inSiblingFace:l}}();n(`predist: the bundled CLI resolves ${t.modules} shared modules from inside one/vendor/ (${t.inSiblingFace} through the bundled desktop face) — no repo checkout needed`),i.bundle=t;const o=s.join(DESKTOP_VENDOR,"faces");e.rmSync(o,{recursive:!0,force:!0}),h(s.join(ONE_VENDOR,"cli"),s.join(o,"cli"));const a=s.join(o,"cli","bin","aegiscode.js");if(!e.existsSync(a))throw new Error(`predist: the packaged terminal face has no entry point at ${s.relative(REPO_DIR,a)} — the artifact would open a window for every \`aegiscode\`/\`--tui\` invocation`);n(`staged the terminal face into desktop/vendor/faces/cli/ (${s.basename(a)})`),i.faces={entry:s.relative(REPO_DIR,a)}}return i}({want:u,log:m})}finally{f()}}export async function main(e,s){const r=s||{},t=Array.isArray(e)?e:[],o=t.includes("--quiet")?{write:()=>!0}:r.stdout||process.stdout,n=r.stderr||process.stderr;let i;t.includes("--mirror-only")?i=["mirror"]:t.includes("--flat-only")?i=["flat","nested"]:t.includes("--bundle-only")&&(i=["bundle"]);try{return await stage({shapes:i,io:{stdout:o,stderr:n}}),0}catch(e){return n.write(`${e&&e.message}\n`),1}}!function(){const e=process.argv[1];let r=!1;if(e)try{r=s.resolve(e)===t(import.meta.url)}catch{r=!1}r&&main(process.argv.slice(2)).then((e=>{process.exitCode=e}))}();
4
+ import e from"node:fs";import s from"node:path";import{spawnSync as r}from"node:child_process";import{fileURLToPath as t,pathToFileURL as o}from"node:url";import{createRequire as n}from"node:module";const i=s.dirname(t(import.meta.url)),a=n(import.meta.url);export const ONE_DIR=s.join(i,"..");export const REPO_DIR=s.join(ONE_DIR,"..");export const CLI_DIR=s.join(REPO_DIR,"cli");export const DESKTOP_DIR=s.join(REPO_DIR,"desktop");export const CLI_VENDOR=s.join(CLI_DIR,"vendor");export const DESKTOP_VENDOR=s.join(DESKTOP_DIR,"vendor");export const ONE_VENDOR=s.join(ONE_DIR,"vendor");export const MANIFEST=[{src:"client/aegis.js",shapes:["mirror","flat"],note:"the thin transport — the one implementation of the wire format"},{src:"client/update.js",shapes:["mirror","flat"],note:"the npm update checker (the desktop own update path)"},{src:"client/foreign-memory.js",shapes:["mirror","flat"],note:"required by mcp/tools.js as ../client/foreign-memory.js"},{src:"client/foreign-sessions.js",shapes:["mirror","flat"],note:"required by desktop/main.js as ./vendor/foreign-sessions.js"},{src:"client/credentials.js",shapes:["mirror","flat"],note:"the account credential store, shared by all three hosts"},{src:"client/session-store.js",shapes:["mirror","flat"],note:"the unified session store — one list in every host"},{src:"client/session-search.js",shapes:["mirror","flat"],note:"the SESSION search ranking: the desktop sheet (Cmd/Ctrl+K) and the terminal /resume picker filter with this one module, pure and fs-free"},{src:"client/credits.js",shapes:["mirror","flat"],note:"the licence/attribution payload: parses LICENSING.md and the two NOTICE files for Help > Credits & licence and /license + /credits"},{src:"client/naming.js",shapes:["mirror","flat"],note:"the conversation-naming ladder — ONE implementation for the terminal and the window (cli/src/naming.js re-exports it)"},{src:"client/prefs.js",shapes:["mirror","flat"],note:"the shared non-secret preference store (D5) — the CLI and the desktop store both read/write it"},{src:"client/env-file.js",shapes:["mirror","flat"],note:"the shared ~/.aegiscode/.env loader, resolved before any key is read"},{src:"client/auto-provision.js",shapes:["mirror","flat"],note:"free device key on first launch; requires ./device-fingerprint.js"},{src:"client/device-fingerprint.js",shapes:["mirror","flat"],note:"the machine identity auto-provision.js and presence.js require"},{src:"client/install-register.js",shapes:["mirror","flat"],note:"register-at-install; the shared body behind both postinstall hooks"},{src:"client/presence.js",shapes:["mirror","flat"],note:"the heartbeat beacon; requires ./presence-constants.js and ./device-fingerprint.js"},{src:"client/presence-constants.js",shapes:["mirror","flat"],note:"the beacon constants — a package without them loses the beacon silently"},{src:"client/touch.js",shapes:["mirror","flat"],note:"phi(alpha): the digest module fingerprint.js requires as ./touch.js"},{src:"client/fingerprint.js",shapes:["mirror","flat"],note:"phi(alpha): the sealed session record, resolved by src/fingerprint.js"},{src:"client/authorship-key.js",shapes:["mirror","flat"],note:"phi(alpha): the authorship key, required by ./attest.js and ./record-vault.js"},{src:"client/attest.js",shapes:["mirror","flat"],note:"phi(alpha): attestation, requires ./fingerprint.js and ./authorship-key.js"},{src:"client/record-vault.js",shapes:["mirror","flat"],note:"the vault, and its refusal to copy the key with the record"},{src:"client/brain-catalog.js",shapes:["mirror","flat"],note:"the pooled-brain rule, required at load time by the engine and src/models.js"},{src:"client/byok-catalog.js",shapes:["mirror","flat"],note:"the BYOK model additions the server catalog does not name"},{src:"client/catalog-client.js",shapes:["mirror","flat"],note:"the server's cached catalog, layered between the shipped additions and the user's own models"},{src:"client/user-models.js",shapes:["mirror","flat"],note:"the models the USER declares, in one file both hosts read (requires ./credentials.js)"},{src:"client/model-discovery.js",shapes:["mirror","flat"],note:"asks the vendor what it serves, so adding a new model is not a memory test (requires ./user-models.js)"},{src:"client/model-sync.js",shapes:["mirror","flat"],note:"reconciles the ids AEGIS promotes against the ids each vendor issues, and writes the difference through ./user-models.js (requires ./model-discovery.js)"},{src:"client/model-autosync.js",shapes:["mirror","flat"],note:"the scheduler that turns the modelAutoSync preference into work: runs ./model-sync.js on a cadence in whichever host is open (requires ./model-sync.js)"},{src:"client/hooks.js",shapes:["mirror","flat"],note:"the shared hook layer behind /hooks and the repo guard installer"},{src:"client/skills.js",shapes:["mirror","flat"],note:"the ONE skill registry: /skills lists and creates through it and the window's Settings > Skills card reads the same scan, so a packaged CLI that loses this row and the desktop that keeps it would disagree about which skills exist"},{src:"client/speech.js",shapes:["mirror","flat"],note:"the pure dictation decision (may we dictate, with what argv) behind the composer mic; desktop/lib/speech-resolve.js requires it as ../vendor/speech.js in a packaged build"},{src:"client/platform.js",shapes:["mirror","flat"],note:"the ONE place that decides which OS this is (Phase 30.1)"},{src:"client/topup.js",shapes:["mirror","flat"],note:"the token-bank top-up: amount bounds, the balance reading, and the credit watch every host drives"},{src:"client/google-signin.js",shapes:["mirror","flat"],note:"the localhost half of aegis1's desktop Google OAuth round-trip; `connect --google` drives it"},{src:"client/drive-connect.js",shapes:["mirror","flat"],note:"the desktop half of aegis1's Drive OAuth (/connect/drive, /api/drive/token); requires ./aegis.js only via the caller"},{src:"client/drive-upload.js",shapes:["mirror","flat"],note:"the Drive v3 REST wrapper that uploads the memory backup and one conversation per save"},{src:"client/conversation-export.js",shapes:["mirror","flat"],note:"the authorship stamp at the top of every uploaded file, and the two backup scope names"},{src:"mcp/tools.js",shapes:["mirror"],note:"the shared tool registry; requires ../client/foreign-memory.js"},{src:"mcp/server.js",shapes:["mirror"],note:"the stdio MCP server every installed editor config names (compiled, never required)"},{src:"mcp/admission.js",shapes:["mirror"],note:"the admission gate server.js requires at load (`./admission.js`): which harness may call the bridge, and what it may run — omitted from the manifest when 2066f82 added it, so both staged trees shipped a server that could not load"},{src:"hosts/spec.js",shapes:["mirror"],note:"the canonical server spec, staged under its own directory so it finds vendor/mcp/server.js"},{src:"hosts/targets.js",shapes:["mirror"],note:"the editor target registry"},{src:"hosts/install.js",shapes:["mirror"],note:"the merge-only installer behind aegiscode mcp install"},{src:"hosts/openai-shim.js",shapes:["mirror"],note:"the loopback OpenAI-compatible shim"},{src:"desktop/renderer/usage.js",shapes:["mirror"],note:"the pure usage mapping shared by the window and the terminal"},{src:"desktop/lib/local/engine.js",shapes:["mirror"],note:"the agent loop, reused as-is (one loop, not a second one drifting)"},{src:"desktop/lib/local/claude-pro.js",shapes:["mirror"],note:"the Claude Code Pro transport; requires ./../../one/src/child.js at call time"},{src:"one/src/child.js",shapes:["mirror"],note:"the ONE claude-child argv builder (rule 4); resolved by claude-pro.js at call time"},{src:"one/src/permissions.js",shapes:["mirror"],note:"resolvePosture() — the permission half of the argv, resolved at call time"},{src:"desktop/lib/local/local.js",shapes:["mirror"],note:"the local model transport and its fail-closed base-URL check"},{src:"desktop/lib/local/context.js",shapes:["mirror"],note:"the token-budget trimmer local.js requires at load"},{src:"desktop/lib/local/attachments.js",shapes:["mirror"],note:"content-part builder for dropped files; required at load by engine.js and local.js"},{src:"desktop/lib/local/session-rounds.js",shapes:["mirror"],note:"interrupted-turn bookkeeping; required at load by engine.js"},{src:"desktop/lib/local/pro-sessions.js",shapes:["mirror"],note:"durable Claude-Pro conversation session ids; required at load by engine.js"},{src:"desktop/lib/local/tools.js",shapes:["mirror"],note:"the tool implementations (persistent shell, editFile, grep, exec)"},{src:"desktop/lib/local/shell.js",shapes:["mirror"],note:"the persistent shell, required by tools.js"},{src:"desktop/lib/local/sandbox.js",shapes:["mirror"],note:"the outcome bound (agent-safety-plan §1b), required by shell.js + tools.js"},{src:"desktop/lib/local/sandbox-bwrap.js",shapes:["mirror"],note:"bubblewrap mechanism behind sandbox.js (agent-safety-plan §1d)"},{src:"desktop/lib/local/sandbox-seatbelt.js",shapes:["mirror"],note:"Seatbelt mechanism behind sandbox.js (agent-safety-plan §1d)"},{src:"desktop/lib/local/sandbox-appcontainer.js",shapes:["mirror"],note:"AppContainer mechanism behind sandbox.js (agent-safety-plan §1e)"},{src:"desktop/lib/local/perm-rules.js",shapes:["mirror"],note:"stored /permissions rules for the desktop gate (agent-safety-plan §2), required by engine.js"},{src:"desktop/lib/local/perm-write.js",shapes:["mirror"],note:'the durable "always allow this command" answer (agent-safety-plan §3), required by main.js'},{src:"desktop/lib/local/perm-store.js",shapes:["mirror"],note:"the Settings rules editor (agent-safety-plan §4), required by main.js"},{src:"desktop/lib/local/integrity.js",shapes:["mirror"],note:"the desktop second gate; required at load by shell.js and tools.js, and the seal over its own four units"},{src:"desktop/main.js",shapes:["mirror"],bytesOnly:!0,note:"seal unit d1 — hashed by integrity.js as BYTES and never required from the mirror, so its own requires (the whole Electron main-process closure) are not staged behind it"},{src:"desktop/lib/local/spill.js",shapes:["mirror"],note:"oversized-output spill, required at load by tools.js and shell.js"},{src:"desktop/lib/local/exec-plan.js",shapes:["mirror"],note:"exec one-shot eligibility classifier, required at load by engine.js"},{src:"desktop/lib/local/agents.js",shapes:["mirror"],note:"Task subagents"},{src:"desktop/lib/local/prompt.js",shapes:["mirror"],note:"the system prompt builder"},{src:"desktop/lib/settings.js",shapes:["mirror"],note:"the provider-config store (base URL + key per provider)"},{src:"desktop/lib/local/turn-guard.js",shapes:["mirror"],note:"engine.js requires it at load; it requires ./git-scope.js"},{src:"desktop/lib/local/repeat-guard.js",shapes:["mirror"],note:"engine.js requires it at load — identical-call detection, no deps of its own"},{src:"desktop/lib/local/verify-stop.js",shapes:["mirror"],note:"engine.js requires it at load — edited-but-unchecked nudge, no deps of its own"},{src:"desktop/lib/local/check-command.js",shapes:["mirror"],note:"verify-stop.js requires it lazily — which command would check this repo; no deps"},{src:"desktop/lib/local/worktree-lock.js",shapes:["mirror"],note:"engine.js requires it at load"},{src:"desktop/lib/local/git-scope.js",shapes:["mirror"],note:"the write-scope rule turn-guard.js and the queues share"},{src:"desktop/lib/local/queue.js",shapes:["mirror"],note:"the autonomous work queue"},{src:"desktop/lib/local/autonomous.js",shapes:["mirror"],note:"the unattended worker; requires ./queue.js and ./git-scope.js"},{src:"desktop/lib/local/entitlement.js",shapes:["mirror"],note:"the shared Pro gate (account probe injected by the caller)"},{src:"desktop/lib/local/covenant.js",shapes:["mirror"],note:"the pre-action gate engine.js requires unconditionally at load"},{src:"desktop/lib/local/aegis-seal.mjs",shapes:["mirror"],note:"the codec covenant.js requires the first time it decodes"},{src:"covenant/aegis.seal",shapes:["mirror","nested"],note:"the sealed covenant (AES/1 container) — path shape is load-bearing"},{src:"covenant/README.md",shapes:["mirror","nested"],note:"the decode notice shipped beside the artifact"},{src:"tools/agent-gate.mjs",shapes:["mirror","flat"],note:"the in-process half of the lock; without it a packaged app had NO gate"},{src:"one/src/selfhost.js",shapes:["mirror","flat"],note:"the packaged launcher decision — which face this artifact was asked for"},{src:"one/src/protocol.js",shapes:["mirror","flat"],note:"the core/frontend seam; desktop/lib/local/pty-host.js speaks it over Electron IPC"},{src:"one/src/iface/pty.js",shapes:["mirror","flat"],note:"plans pty|refuse and spawns the native pty; required by desktop/lib/local/pty-host.js at call time"}];export function entriesFor(e){const r=[];for(const t of MANIFEST){if(!t.shapes.includes(e))continue;let o;if("mirror"===e)o=s.join(CLI_VENDOR,t.src);else if("flat"===e)o=s.join(DESKTOP_VENDOR,s.basename(t.src));else{if("nested"!==e)throw new Error(`predist: unknown shape ${e}`);o=s.join(DESKTOP_VENDOR,t.src)}r.push({src:t.src,dest:o,from:s.join(REPO_DIR,t.src)})}return r}export const SHAPES=["mirror","flat","nested"];const c=[["cli",CLI_DIR,["bin","src","vendor","scripts","package.json","README.md","LICENSE"]],["desktop",DESKTOP_DIR,["main.js","preload.js","lib","renderer","bin","vendor","package.json","README.md"]]],l=new Set(["node_modules","release",".git",".cache","out"]),d=new Map([["desktop/vendor",new Set(["faces","sandbox"])]]);function h(r,t,o){const n=o||new Set,i=(e,s)=>l.has(e)||e.endsWith(".log")||n.has(s),a=(r,t)=>{if(e.mkdirSync(s.dirname(t),{recursive:!0}),e.copyFileSync(r,t),!e.readFileSync(r).equals(e.readFileSync(t)))throw new Error(`predist: bundle copy differs from source: ${s.relative(REPO_DIR,r)}`)},c=(r,o)=>{const n=e.lstatSync(r);if(!n.isSymbolicLink())if(n.isFile())a(r,s.join(t,o));else for(const t of e.readdirSync(r)){const e=o?s.join(o,t):t;i(t,e)||c(s.join(r,t),e)}};e.lstatSync(r).isFile()?a(r,t):c(r,"")}const p="AEGISONE_PREDIST_LOCK_TOKEN";let u=null,m=!1,f=0;function g(e){try{return process.kill(e,0),!0}catch(e){return Boolean(e)&&"EPERM"===e.code}}const j=e=>new Promise(s=>setTimeout(s,e));function y(){if(f>0)return void f--;const s=u,r=m,t=process.env[p];if(u=null,m=!1,s&&r){t&&delete process.env[p];try{e.unlinkSync(s)}catch{}}}export async function acquireStageLock(r){if(u)return f++,y;const t=r&&r.stdout||process.stdout;return await async function(r){const t=function(){const r=s.join(REPO_DIR,".git");let t=r;try{if(!e.lstatSync(r).isDirectory()){const o=/^gitdir:\s*(.+)$/m.exec(e.readFileSync(r,"utf8"));o&&(t=s.resolve(REPO_DIR,o[1].trim()))}}catch{t=r}return s.join(t,"aegisone-predist.lock")}(),o=Date.now()+12e4,n=process.env[p]||null;let i=null,a=!1;for(;;){if(n)try{const s=String(e.readFileSync(t,"utf8")).split("\n")[1];if(s&&s.trim()===n)return u=t,void(m=!1)}catch{}try{i=`${Date.now().toString(36)}-${process.pid}-${Math.random().toString(36).slice(2,10)}`;const s=e.openSync(t,"wx");return e.writeSync(s,`${process.pid}\n${i}\n`),e.closeSync(s),u=t,m=!0,void(process.env[p]=i)}catch(e){if(!e||"EEXIST"!==e.code)throw e}let s=null,c=0;try{s=e.statSync(t),c=Number(String(e.readFileSync(t,"utf8")).split("\n")[0].trim())}catch{continue}if(Date.now()-s.mtimeMs>6e5||Number.isFinite(c)&&c>0&&!g(c)){r(`predist: breaking an abandoned staging lock (pid ${c||"unknown"})`);try{e.unlinkSync(t)}catch{}}else{if(Date.now()>o)throw new Error(`predist: another stager (pid ${c||"unknown"}) has held ${t} for over ${Math.round(120)}s. Staging is destructive — it removes and rewrites cli/vendor, desktop/vendor and one/vendor — so it will not run concurrently with a peer. Wait for it, or delete the lock if that process is gone.`);a||(a=!0,r(`predist: another stager (pid ${c||"unknown"}) is running — waiting for it (concurrent staging would read a vendor tree the peer is rewriting)`)),await j(50+Math.floor(50*Math.random()))}}}(e=>t.write(`${e}\n`)),y}function b(r,t){const o=[];for(const s of r){if(!e.existsSync(s.from))throw new Error(`predist: missing shared module: ${s.src} (expected at ${s.from})`);if(w(s.from,s.dest),!e.readFileSync(s.from).equals(e.readFileSync(s.dest)))throw new Error(`predist: staged copy differs from source: ${s.src}`);o.push(s)}return t&&function(r,t){if(!e.existsSync(r))return 0;const o=r=>{for(const n of e.readdirSync(r,{withFileTypes:!0})){const i=s.join(r,n.name);if(n.isDirectory()){o(i);try{e.rmdirSync(i)}catch{}}else t.has(i)||e.unlinkSync(i)}};o(r)}(t,new Set(o.map(e=>e.dest))),o}function w(r,t){e.mkdirSync(s.dirname(t),{recursive:!0});const o=`${t}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;e.copyFileSync(r,o);try{e.renameSync(o,t)}catch(s){try{e.unlinkSync(o)}catch{}throw s}}function v(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1")}export async function stage(t){const n=t||{},i=n.io||{},l=i.stdout||process.stdout,p=(i.stderr||process.stderr,Array.isArray(n.shapes)?n.shapes:[...SHAPES,"bundle"]),u=e=>p.includes(e),m=e=>l.write(`${e}\n`),f=await acquireStageLock(i);try{return await async function({want:t,log:n}){const i={mirror:null,flat:null,nested:null,bundle:null};if(t("mirror")){const e=b(entriesFor("mirror"),CLI_VENDOR);n(`predist: staged ${e.length} shared modules into cli/vendor/`);for(const s of e)n(` ${s.src} -> vendor/${s.src}`);i.mirror={staged:e.length}}if(t("nested")&&(i.nested={staged:b(entriesFor("nested"),null).length}),t("flat")){const e=b(entriesFor("flat"),null);for(const s of e)n(`staged ${s.dest}`);i.flat={staged:e.length}}if(t("mirror")&&t("flat"))for(const r of MANIFEST){if(!r.shapes.includes("mirror")||!r.shapes.includes("flat"))continue;const t=s.join(CLI_VENDOR,r.src),o=s.join(DESKTOP_VENDOR,s.basename(r.src));if(!e.readFileSync(t).equals(e.readFileSync(o)))throw new Error(`predist: the two shapes disagree for ${r.src}`)}if(t("mirror")){const r=function(r){const t=s.join(CLI_VENDOR,"mcp","tools.js");delete a.cache[a.resolve(t)];const{createTools:o}=a(t),n=o({apiBase:"http://127.0.0.1",apiKey:"predist-probe",randomUUID:()=>"id"}).toolList().length;if(0===n)throw new Error("predist: staged registry exposes no tools");const i=a("node:vm"),c=s.join(CLI_VENDOR,"mcp","server.js");new i.Script(e.readFileSync(c,"utf8"),{filename:c});const l=s.join(CLI_VENDOR,"hosts"),d=a(s.join(l,"spec.js")),h=a(s.join(l,"install.js")),p=a(s.join(l,"targets.js")),u=d.resolveServer({AEGIS_MCP_SERVER:""});if(!u.exists||u.path!==c)throw new Error(`predist: staged hosts/spec.js resolves the server as ${u.path} (exists: ${u.exists}), expected ${c}. An installed aegiscode would write editor configs pointing at a file the package never shipped. Candidates were:\n ${u.candidates.join("\n ")}`);const m=p.getTarget("vscode"),f=h.planTarget(m,"user",{ctx:h.hostCtx({home:s.join(CLI_VENDOR,".predist-home"),env:{},cwd:REPO_DIR}),specOpts:{env:{AEGIS_MCP_SERVER:""}}}),g=[];!function e(s){"string"==typeof s?g.push(s):Array.isArray(s)?s.forEach(e):s&&"object"==typeof s&&Object.values(s).forEach(e)}(f.after?JSON.parse(f.after):{});const j=g.some(e=>e===c);if(f.error||!f.changed||!j)throw new Error(`predist: a planned vscode install does not name the staged server (error: ${f.error&&f.error.message}, changed: ${f.changed})`);if("function"!=typeof a(s.join(l,"openai-shim.js")).createShimServer)throw new Error("predist: staged hosts/openai-shim.js exposes no createShimServer");return{count:n,targets:p.targetIds().length,staged:r.length}}(entriesFor("mirror"));n(`predist: staged registry loads standalone (${r.count} tools)`),n(`predist: editor layer verified (${r.targets} host targets, server resolves to vendor/mcp/server.js, shim loads)`);const t=await async function(){const e=s.join(CLI_VENDOR,"tools","agent-gate.mjs");if("function"!=typeof(await(import(o(e).href))).run)throw new Error("predist: staged tools/agent-gate.mjs exposes no run()");return e}();n(`predist: ${s.relative(REPO_DIR,t)} loads standalone and exposes run()`),i.mirror.proof=r}if(t("flat")){const r=function(r){const t=new Set(r.map(e=>s.basename(e.dest)));for(const o of r){const r=v(e.readFileSync(o.dest,"utf8"));for(const e of r.matchAll(/require\(\s*'((?:\.\.?\/)[^']+)'\s*\)/g)){const r=e[1];if(s.basename(r).replace(/\.[cm]?js$/,""),r.replace(/^\.\//,"").startsWith("../"))throw new Error(`predist: flat-staged ${s.basename(o.dest)} requires '${r}', which escapes vendor/ — flattening only works for same-directory requires (add the target to the manifest, or stop staging this file flat)`);const n=r.replace(/^\.\//,"");if(!t.has(n))throw new Error(`predist: flat-staged ${s.basename(o.dest)} requires '${r}', which is not staged into desktop/vendor/ — the packaged app would throw MODULE_NOT_FOUND before the window could open`)}}const o=a(s.join(DESKTOP_VENDOR,"aegis.js"));if(!o||0===Object.keys(o).length)throw new Error("predist: staged desktop/vendor/aegis.js loads but exports nothing");return{files:r.length,exports:Object.keys(o).length}}(entriesFor("flat"));n(`predist: flattened tree is self-contained (${r.files} files, ${r.exports} transport exports) — no staged module escapes vendor/`),i.flat.proof=r}if(t("bundle")){for(const[r,t,o]of c){const i=s.join(ONE_VENDOR,r);e.rmSync(i,{recursive:!0,force:!0});for(const n of o){const o=s.join(t,n);if(!e.existsSync(o)){if("LICENSE"===n||"README.md"===n)continue;throw new Error(`predist: bundle source missing: ${s.relative(REPO_DIR,o)}`)}h(o,s.join(i,n),d.get(`${r}/${n}`))}n(`staged the ${r} face into one/vendor/${r}/`)}const t=function(){const t=s.join(ONE_VENDOR,"cli"),o=s.join(t,"src","deps.js"),n=r(process.execPath,["-e","const d=require(process.argv[1]);console.log(JSON.stringify(d.paths))",o],{cwd:t,encoding:"utf8"});if(0!==n.status)throw new Error(`predist: the bundled CLI does not load: ${n.stderr||n.stdout}`);const i=JSON.parse(n.stdout),a=[];let l=0;for(const[e,r]of Object.entries(i)){const t=s.relative(ONE_VENDOR,r);t.startsWith("..")||s.isAbsolute(t)?a.push(`${e} -> ${r}`):"cli"!==t.split(s.sep)[0]&&l++}if(a.length)throw new Error(`predist: the bundled CLI resolves these shared modules OUTSIDE the bundle (${ONE_VENDOR}) — the product tarball would depend on a repo checkout:\n `+a.join("\n "));if(!e.existsSync(s.join(t,"bin","aegiscode.js")))throw new Error("predist: the bundle has no cli/bin/aegiscode.js");const d=[];for(const[r,t,o]of c)for(const n of o){const o=s.join(ONE_VENDOR,r,n);let i=null,a=null;try{i=e.lstatSync(s.join(t,n))}catch{continue}try{a=e.lstatSync(o)}catch{d.push(`${r}/${n} -> missing`);continue}i.isFile()&&!a.isFile()&&d.push(`${r}/${n} -> not a regular file`),i.isDirectory()&&!a.isDirectory()&&d.push(`${r}/${n} -> not a directory`)}if(d.length)throw new Error(`predist: the bundle staged these in the wrong shape:\n ${d.join("\n ")}`);return{modules:Object.keys(i).length,inSiblingFace:l}}();n(`predist: the bundled CLI resolves ${t.modules} shared modules from inside one/vendor/ (${t.inSiblingFace} through the bundled desktop face) — no repo checkout needed`),i.bundle=t;const o=s.join(DESKTOP_VENDOR,"faces");e.rmSync(o,{recursive:!0,force:!0}),h(s.join(ONE_VENDOR,"cli"),s.join(o,"cli"));const a=s.join(o,"cli","bin","aegiscode.js");if(!e.existsSync(a))throw new Error(`predist: the packaged terminal face has no entry point at ${s.relative(REPO_DIR,a)} — the artifact would open a window for every \`aegiscode\`/\`--tui\` invocation`);n(`staged the terminal face into desktop/vendor/faces/cli/ (${s.basename(a)})`),i.faces={entry:s.relative(REPO_DIR,a)}}return i}({want:u,log:m})}finally{f()}}export async function main(e,s){const r=s||{},t=Array.isArray(e)?e:[],o=t.includes("--quiet")?{write:()=>!0}:r.stdout||process.stdout,n=r.stderr||process.stderr;let i;t.includes("--mirror-only")?i=["mirror"]:t.includes("--flat-only")?i=["flat","nested"]:t.includes("--bundle-only")&&(i=["bundle"]);try{return await stage({shapes:i,io:{stdout:o,stderr:n}}),0}catch(e){return n.write(`${e&&e.message}\n`),1}}!function(){const e=process.argv[1];let r=!1;if(e)try{r=s.resolve(e)===t(import.meta.url)}catch{r=!1}r&&main(process.argv.slice(2)).then(e=>{process.exitCode=e})}();
package/src/child.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const FLAGS=Object.freeze({headlessSkip:"--dangerously-skip-permissions",interactiveSkip:"--allow-dangerously-skip-permissions",permissionMode:"--permission-mode",allowedTools:"--allowedTools",disallowedTools:"--disallowedTools",print:"-p",outputFormat:"--output-format",model:"--model",sessionId:"--session-id",resume:"--resume",inputFormat:"--input-format",permissionPromptTool:"--permission-prompt-tool",addDir:"--add-dir"});function addDirArgs(e){const s=[];for(const o of unique(e))s.push(`${FLAGS.addDir}=${o}`);return s}const UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,DEFAULT_OUTPUT_FORMAT="stream-json";function unique(e){const s=new Set,o=[];for(const i of Array.isArray(e)?e:[]){const e=String(i).trim();e&&!s.has(e)&&(s.add(e),o.push(e))}return o}function claudeArgv(e={}){const s=e.posture;if(!s||"object"!=typeof s)throw new Error("claudeArgv requires a resolved posture record (one/src/permissions.js resolvePosture)");const o=s.childKind,i="interactive"!==o,{PERMISSION_MODES:r}=require("./permissions.js"),n=s.child&&"string"==typeof s.child.permissionMode?s.child.permissionMode:null,d=void 0!==e.permissionMode&&null!==e.permissionMode?String(e.permissionMode):null,t=null!==d||null!==n,l=null!==d?d:n;if(t&&!r.includes(l))throw new Error(`--permission-mode ${JSON.stringify(l)} is not one of ${r.join("|")} — refusing to pass (or to silently drop) a mode the child does not accept.`);const a=s.rules||{},p=unique(a.allow),u=unique(a.deny),c=unique(a.ask),m=e.resumeSessionId?String(e.resumeSessionId).trim():"",h=e.sessionId?String(e.sessionId).trim():"",g=m||null,f=!g&&h?h:null;for(const[e,s]of[["resumeSessionId",g],["sessionId",f]])if(s&&!UUID_RE.test(s))throw new Error(`${e} ${JSON.stringify(s)} is not a UUID — refusing to pass it to --resume/--session-id, which the child rejects after the spawn (turning a continuity bug into an opaque failed turn).`);const S=!0===e.askBridge&&!(s.child&&s.child.skip),A=[];i&&A.push(FLAGS.print,FLAGS.outputFormat,String(e.outputFormat||"stream-json")),e.model&&A.push(FLAGS.model,String(e.model));const F=addDirArgs(e.addDir);A.push(...F),p.length&&A.push(FLAGS.allowedTools,p.join(",")),u.length&&A.push(FLAGS.disallowedTools,u.join(",")),t&&A.push(FLAGS.permissionMode,l),s.child&&s.child.flag&&A.push(s.child.flag),S&&A.push(FLAGS.inputFormat,"stream-json",FLAGS.permissionPromptTool,"stdio"),g?A.push(FLAGS.resume,g):f&&A.push(FLAGS.sessionId,f),Array.isArray(e.extra)&&A.push(...e.extra.map(String)),S||void 0===e.prompt||null===e.prompt||A.push(String(e.prompt));const w=Object.freeze({kind:o,permissionMode:l,permissionModePassed:t,permissionModeSource:t?null!==d?"descriptor":"posture":null,permissionModeDropped:s&&s.permissionModeDropped||null,skip:Boolean(s.child&&s.child.skip),skipFlag:s.child&&s.child.flag||null,allowedTools:Object.freeze(p),disallowedTools:Object.freeze(u),unmappedAsk:Object.freeze(c),addDir:Object.freeze(F.map((e=>e.slice(FLAGS.addDir.length+1)))),resumeSessionId:g,sessionId:f,askBridge:S,argv:Object.freeze(A.slice())});return{argv:w.argv,record:w}}function childRecordLine(e){if(!e||"object"!=typeof e)return null;const s=e.permissionModePassed?`${FLAGS.permissionMode}=${e.permissionMode}`:e.permissionModeDropped?`no --permission-mode (asked for one, dropped: ${e.permissionModeDropped})`:"no --permission-mode (none was set)";return`aegis: claude child [${e.kind}] ${e.skipFlag||"no permission flag"} · ${s} · allowedTools=[${e.allowedTools.join(", ")}] disallowedTools=[${e.disallowedTools.join(", ")}]`+(e.unmappedAsk.length?` (ask rules recorded, unmapped: ${e.unmappedAsk.join(", ")})`:"")+(e.addDir&&e.addDir.length?` · addDir=[${e.addDir.join(", ")}]`:"")+(e.resumeSessionId?` · resumed session ${e.resumeSessionId}`:e.sessionId?` · new session ${e.sessionId}`:" · no session id (each turn is a new conversation)")+(e.askBridge?" · ask bridge (the child can raise approval cards)":" · no ask bridge (headless: unapproved tools auto-deny)")}module.exports={FLAGS:FLAGS,DEFAULT_OUTPUT_FORMAT:"stream-json",claudeArgv:claudeArgv,addDirArgs:addDirArgs,childRecordLine:childRecordLine};
3
+ "use strict";const FLAGS=Object.freeze({headlessSkip:"--dangerously-skip-permissions",interactiveSkip:"--allow-dangerously-skip-permissions",permissionMode:"--permission-mode",allowedTools:"--allowedTools",disallowedTools:"--disallowedTools",print:"-p",outputFormat:"--output-format",model:"--model",sessionId:"--session-id",resume:"--resume",inputFormat:"--input-format",permissionPromptTool:"--permission-prompt-tool",addDir:"--add-dir"});function addDirArgs(e){const s=[];for(const o of unique(e))s.push(`${FLAGS.addDir}=${o}`);return s}const UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,DEFAULT_OUTPUT_FORMAT="stream-json";function unique(e){const s=new Set,o=[];for(const i of Array.isArray(e)?e:[]){const e=String(i).trim();e&&!s.has(e)&&(s.add(e),o.push(e))}return o}function claudeArgv(e={}){const s=e.posture;if(!s||"object"!=typeof s)throw new Error("claudeArgv requires a resolved posture record (one/src/permissions.js resolvePosture)");const o=s.childKind,i="interactive"!==o,{PERMISSION_MODES:r}=require("./permissions.js"),n=s.child&&"string"==typeof s.child.permissionMode?s.child.permissionMode:null,d=void 0!==e.permissionMode&&null!==e.permissionMode?String(e.permissionMode):null,t=null!==d||null!==n,l=null!==d?d:n;if(t&&!r.includes(l))throw new Error(`--permission-mode ${JSON.stringify(l)} is not one of ${r.join("|")} — refusing to pass (or to silently drop) a mode the child does not accept.`);const a=s.rules||{},p=unique(a.allow),u=unique(a.deny),c=unique(a.ask),m=e.resumeSessionId?String(e.resumeSessionId).trim():"",h=e.sessionId?String(e.sessionId).trim():"",g=m||null,f=!g&&h?h:null;for(const[e,s]of[["resumeSessionId",g],["sessionId",f]])if(s&&!UUID_RE.test(s))throw new Error(`${e} ${JSON.stringify(s)} is not a UUID — refusing to pass it to --resume/--session-id, which the child rejects after the spawn (turning a continuity bug into an opaque failed turn).`);const S=!0===e.askBridge&&!(s.child&&s.child.skip),A=[];i&&A.push(FLAGS.print,FLAGS.outputFormat,String(e.outputFormat||"stream-json")),e.model&&A.push(FLAGS.model,String(e.model));const F=addDirArgs(e.addDir);A.push(...F),p.length&&A.push(FLAGS.allowedTools,p.join(",")),u.length&&A.push(FLAGS.disallowedTools,u.join(",")),t&&A.push(FLAGS.permissionMode,l),s.child&&s.child.flag&&A.push(s.child.flag),S&&A.push(FLAGS.inputFormat,"stream-json",FLAGS.permissionPromptTool,"stdio"),g?A.push(FLAGS.resume,g):f&&A.push(FLAGS.sessionId,f),Array.isArray(e.extra)&&A.push(...e.extra.map(String)),S||void 0===e.prompt||null===e.prompt||A.push(String(e.prompt));const w=Object.freeze({kind:o,permissionMode:l,permissionModePassed:t,permissionModeSource:t?null!==d?"descriptor":"posture":null,permissionModeDropped:s&&s.permissionModeDropped||null,skip:Boolean(s.child&&s.child.skip),skipFlag:s.child&&s.child.flag||null,allowedTools:Object.freeze(p),disallowedTools:Object.freeze(u),unmappedAsk:Object.freeze(c),addDir:Object.freeze(F.map(e=>e.slice(FLAGS.addDir.length+1))),resumeSessionId:g,sessionId:f,askBridge:S,argv:Object.freeze(A.slice())});return{argv:w.argv,record:w}}function childRecordLine(e){if(!e||"object"!=typeof e)return null;const s=e.permissionModePassed?`${FLAGS.permissionMode}=${e.permissionMode}`:e.permissionModeDropped?`no --permission-mode (asked for one, dropped: ${e.permissionModeDropped})`:"no --permission-mode (none was set)";return`aegis: claude child [${e.kind}] ${e.skipFlag||"no permission flag"} · ${s} · allowedTools=[${e.allowedTools.join(", ")}] disallowedTools=[${e.disallowedTools.join(", ")}]`+(e.unmappedAsk.length?` (ask rules recorded, unmapped: ${e.unmappedAsk.join(", ")})`:"")+(e.addDir&&e.addDir.length?` · addDir=[${e.addDir.join(", ")}]`:"")+(e.resumeSessionId?` · resumed session ${e.resumeSessionId}`:e.sessionId?` · new session ${e.sessionId}`:" · no session id (each turn is a new conversation)")+(e.askBridge?" · ask bridge (the child can raise approval cards)":" · no ask bridge (headless: unapproved tools auto-deny)")}module.exports={FLAGS:FLAGS,DEFAULT_OUTPUT_FORMAT:"stream-json",claudeArgv:claudeArgv,addDirArgs:addDirArgs,childRecordLine:childRecordLine};
package/src/dispatch.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const FACE=Object.freeze({TUI:"tui",GUI:"gui"}),FACE_ENV="AEGISONE_FACE",TUI_VERBS=new Set(["login","connect","logout","key","mcp","fingerprint","gate","autonomous","permissions","doctor","update","models","config","init","signup","help","version","status","resume"]),SCRIPT_FLAGS=new Set(["-p","--print","--json"]),FORCE_GUI_FLAGS=["--gui"],FORCE_TUI_FLAGS=["--tui"],SPELLING_GUI="desktop",SPELLING_TUI="code";function flagIndex(e,t){for(let n=0;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function without(e,t){return e.filter((e=>!t.includes(e)))}function has(e,t){return e.some((e=>t.includes(e)))}function guiBlockers(e,t){const n=[];return e||n.push("no display (DISPLAY / WAYLAND_DISPLAY are unset)"),t||n.push("Electron is not installed beside this package"),n}function decide(e){const t=e||{},n=Array.isArray(t.argv)?t.argv.map(String):[],i=t.env||{},s=t.tty||{},o=Boolean(t.hasDisplay),r=Boolean(t.electronResolvable),a=String(t.invokedAs||"aegis").replace(/\.js$/,""),l=guiBlockers(o,r),c=0===l.length,u=(e,t,n)=>({face:FACE.GUI,kind:e,reason:t,args:n,notice:null}),d=(e,t,n,i)=>({face:FACE.TUI,kind:e,reason:t,args:n,notice:i||null}),g=e=>({face:null,kind:"error",code:2,reason:`${e} cannot open the window`,error:`${e}: cannot open the window — ${l.join(", ")}.`,hint:"Use --tui for the terminal face.",args:[],notice:null});if("aegiscode"===a)return d("compat","aegiscode is the compatibility bin",n);const E=String(null==i[FACE_ENV]?"":i[FACE_ENV]).trim().toLowerCase();if(E)return E===FACE.GUI?c?u("forced",`${FACE_ENV}=gui`,n):g(`${FACE_ENV}=gui`):"cli"===E||E===FACE.TUI?d("forced",`${FACE_ENV}=${E}`,n):{face:null,kind:"error",code:2,reason:`${FACE_ENV}=${E} is not a face`,error:`${FACE_ENV}=${E} is not a face. Set cli or gui.`,hint:"Unset it to let aegis decide from the arguments.",args:[],notice:null};if(has(n,FORCE_GUI_FLAGS)){const e=without(n,FORCE_GUI_FLAGS);return c?u("explicit","--gui was passed",e):g("--gui")}if(has(n,FORCE_TUI_FLAGS))return d("explicit","--tui was passed",without(n,FORCE_TUI_FLAGS));const f=n.filter((e=>!e.startsWith("-"))),p=f.length?f[0]:null;if("desktop"===p){const e=n.filter((e=>"desktop"!==e));return c?u("spelling","aegis desktop",e):g("aegis desktop")}if("code"===p)return d("spelling","aegis code",n.filter((e=>"code"!==e)));const A=n.find((e=>SCRIPT_FLAGS.has(e)));return A?d("script",`${A} means this call is a script`,n):p?d("argument",TUI_VERBS.has(p)?`'${p}' is a terminal verb`:`'${p}' is a prompt, not a window request`,n):n.length?d("flags","options were passed; the window takes none",n):!1===s.stdin||!1===s.stdout?d("default","stdio is not a terminal",[],"stdio is not a terminal"):l.length?d("default",l[0],[],l[0]):u("default","nothing else was asked for",[])}module.exports={decide:decide,FACE:FACE,FACE_ENV:FACE_ENV,TUI_VERBS:TUI_VERBS};
3
+ "use strict";const FACE=Object.freeze({TUI:"tui",GUI:"gui"}),FACE_ENV="AEGISONE_FACE",TUI_VERBS=new Set(["login","connect","logout","key","mcp","fingerprint","gate","autonomous","permissions","doctor","update","models","config","init","signup","help","version","status","resume"]),SCRIPT_FLAGS=new Set(["-p","--print","--json"]),FORCE_GUI_FLAGS=["--gui"],FORCE_TUI_FLAGS=["--tui"],SPELLING_GUI="desktop",SPELLING_TUI="code";function flagIndex(e,t){for(let n=0;n<e.length;n++)if(t.includes(e[n]))return n;return-1}function without(e,t){return e.filter(e=>!t.includes(e))}function has(e,t){return e.some(e=>t.includes(e))}function guiBlockers(e,t){const n=[];return e||n.push("no display (DISPLAY / WAYLAND_DISPLAY are unset)"),t||n.push("Electron is not installed beside this package"),n}function decide(e){const t=e||{},n=Array.isArray(t.argv)?t.argv.map(String):[],i=t.env||{},s=t.tty||{},o=Boolean(t.hasDisplay),r=Boolean(t.electronResolvable),a=String(t.invokedAs||"aegis").replace(/\.js$/,""),l=guiBlockers(o,r),c=0===l.length,u=(e,t,n)=>({face:FACE.GUI,kind:e,reason:t,args:n,notice:null}),d=(e,t,n,i)=>({face:FACE.TUI,kind:e,reason:t,args:n,notice:i||null}),g=e=>({face:null,kind:"error",code:2,reason:`${e} cannot open the window`,error:`${e}: cannot open the window — ${l.join(", ")}.`,hint:"Use --tui for the terminal face.",args:[],notice:null});if("aegiscode"===a)return d("compat","aegiscode is the compatibility bin",n);const E=String(null==i[FACE_ENV]?"":i[FACE_ENV]).trim().toLowerCase();if(E)return E===FACE.GUI?c?u("forced",`${FACE_ENV}=gui`,n):g(`${FACE_ENV}=gui`):"cli"===E||E===FACE.TUI?d("forced",`${FACE_ENV}=${E}`,n):{face:null,kind:"error",code:2,reason:`${FACE_ENV}=${E} is not a face`,error:`${FACE_ENV}=${E} is not a face. Set cli or gui.`,hint:"Unset it to let aegis decide from the arguments.",args:[],notice:null};if(has(n,FORCE_GUI_FLAGS)){const e=without(n,FORCE_GUI_FLAGS);return c?u("explicit","--gui was passed",e):g("--gui")}if(has(n,FORCE_TUI_FLAGS))return d("explicit","--tui was passed",without(n,FORCE_TUI_FLAGS));const f=n.filter(e=>!e.startsWith("-")),p=f.length?f[0]:null;if("desktop"===p){const e=n.filter(e=>"desktop"!==e);return c?u("spelling","aegis desktop",e):g("aegis desktop")}if("code"===p)return d("spelling","aegis code",n.filter(e=>"code"!==e));const A=n.find(e=>SCRIPT_FLAGS.has(e));return A?d("script",`${A} means this call is a script`,n):p?d("argument",TUI_VERBS.has(p)?`'${p}' is a terminal verb`:`'${p}' is a prompt, not a window request`,n):n.length?d("flags","options were passed; the window takes none",n):!1===s.stdin||!1===s.stdout?d("default","stdio is not a terminal",[],"stdio is not a terminal"):l.length?d("default",l[0],[],l[0]):u("default","nothing else was asked for",[])}module.exports={decide:decide,FACE:FACE,FACE_ENV:FACE_ENV,TUI_VERBS:TUI_VERBS};
package/src/doctor.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const path=require("node:path"),fs=require("node:fs"),crypto=require("node:crypto"),EXIT=Object.freeze({OK:0,WARN:1,BROKEN:2}),FACE_PACKAGES=Object.freeze([Object.freeze({dir:"cli",package:"aegiscode"}),Object.freeze({dir:"desktop",package:"aegis-desktop"})]),BUNDLE_FACES=Object.freeze([Object.freeze({face:"cli",root:"cli",staged:"one/vendor/cli"}),Object.freeze({face:"desktop",root:"desktop",staged:"one/vendor/desktop"})]);function oneDir(){return path.resolve(__dirname,"..")}function repoDir(){return path.resolve(__dirname,"..","..")}function layoutOf(e,t){const n=t=>{try{return Boolean(e.exists(t))}catch{return!1}};if(t){const e=!n(path.join(t,"one","package.json"));return{root:t,installed:e,facePrefix:e?["vendor"]:[]}}const r=repoDir(),o=!n(path.join(r,"one","package.json"));return{root:o?oneDir():r,installed:o,facePrefix:o?["vendor"]:[]}}function inLayout(e,t){if(!e.installed)return t;const n=t.split("/");if("one"===n[0]){const e=n.slice(1).join("/");return"src/selfhost.js"===e?"vendor/desktop/vendor/selfhost.js":("vendor/cli"===e||e.startsWith("vendor/"),e)}return"cli"===n[0]||"desktop"===n[0]?path.posix.join("vendor",t).split(path.sep).join("/"):path.posix.join("vendor","cli","vendor",t).split(path.sep).join("/")}function homeHint(e){const t=e||{};return t.AEGISCODE_HOME||t.AEGIS_HOME||null}function homeDir(e){try{return require("./host.js").hostHome(e||{})}catch{const t=e||{},n=t.USERPROFILE||t.HOME;return n?String(n).trim():""}}function defaultFs(){return{exists:e=>{try{return fs.existsSync(e)}catch{return!1}},readFile:e=>{try{return fs.readFileSync(e,"utf8")}catch(e){if(e&&("ENOENT"===e.code||"EISDIR"===e.code))return null;throw e}},hashFile:e=>crypto.createHash("sha256").update(fs.readFileSync(e)).digest("hex"),listFiles:(e,t)=>listFiles(e,void 0===t?e:t)}}function listFiles(e,t){const n=[],r=e=>{let o;try{o=fs.readdirSync(e,{withFileTypes:!0})}catch{return}for(const s of o){if("node_modules"===s.name||".git"===s.name)continue;const o=path.join(e,s.name);s.isDirectory()?r(o):n.push(path.relative(t,o).split(path.sep).join("/"))}};return r(e),n.sort()}function defaultElectronPaths(e,t){const n=t||{},r=homeHint(e)||path.join(homeDir(e),".aegiscode");return{electron:void 0!==n.electron?n.electron:null,desktopMain:void 0!==n.desktopMain?n.desktopMain:null,userData:void 0!==n.userData?n.userData:r,keychain:void 0!==n.keychain?n.keychain:path.join(r,"settings.json")}}function defaultRegistry(e){let t=null;const n=()=>{if(t)return t;const n=e&&e.layout?e.layout:{root:repoDir(),installed:!1},r=[path.join(n.root,"client","update.js"),path.join(n.root,"vendor","cli","vendor","client","update.js")];for(const e of r)try{t=require(e);break}catch{}return t};return{check(e){const t=n();return t&&"function"==typeof t.updateNotice?t.updateNotice(e||{}):{latest:null,behind:!1,reason:"unavailable"}},plan(e){const t=n();return t&&"function"==typeof t.updatePlan?t.updatePlan(e||{}):null}}}function clientModuleCandidates(e){return[path.join(e.root,"client"),path.join(e.root,"vendor","cli","vendor","client")]}function loadClientModule(e,t){const n=e&&e.layout?e.layout:{root:repoDir(),installed:!1};for(const e of clientModuleCandidates(n))try{return require(path.join(e,t))}catch{}return null}function defaultStorePath(e,t){try{const n=loadClientModule(t,"prefs.js");if(n&&"function"==typeof n.prefsFile)return n.prefsFile(e)}catch{}const n=homeHint(e)||path.join(homeDir(e),".aegiscode");return path.join(n,"preferences.json")}function defaultCredentials(e){let t=null,n=!1;return{resolve(r){if(n||(n=!0,t=loadClientModule(e,"credentials.js")),!t||"function"!=typeof t.resolveApiKey)return{key:"",source:"none",from:""};try{return t.resolveApiKey(r||{})}catch{return{key:"",source:"none",from:""}}}}}function vendorPairs(e){const{exists:t}=e,n=[];if((e.layout||{installed:!1,facePrefix:[]}).installed)return n;for(const{face:r,root:o,staged:s}of BUNDLE_FACES){const a=path.join(e.root,s),i=e.listFiles(a,a);for(const a of i){const i=[];if(a.startsWith("vendor/")){const e=a.slice(7);if(i.push(e),i.push(path.join(o,e)),"selfhost.js"===e&&i.push(path.join("one","src","selfhost.js")),"protocol.js"===e&&i.push(path.join("one","src","protocol.js")),"pty.js"===e&&i.push(path.join("one","src","iface","pty.js")),"desktop"===r){const t=path.basename(e);for(const e of["client","mcp","covenant","commands","skills","tools","hosts"])i.push(path.join(e,t));i.push(t)}}else i.push(path.join(o,a)),i.push(a);const l=i.find((n=>t(path.join(e.root,n))))||null;n.push({face:r,staged:path.join(s,a),source:l,candidates:i})}}return n}function layoutsInstalled(e){return Boolean(e&&e.installed)}function checkVendor(e,t){const n=t||vendorPairs(e),r=[],o=[];let s=0,a=0;const i=e.layout||{installed:!1,facePrefix:[]};if(layoutsInstalled(i)){for(const t of BUNDLE_FACES){const n=path.join(e.root,inLayout(i,t.staged));e.exists(n)&&(a+=e.listFiles(n,n).length)}return{staged:a,matched:0,mismatch:o,missingSource:r,stale:0===a,checked:0}}for(const t of n){if(!e.exists(path.join(e.root,t.staged)))continue;if(a+=1,!t.source){r.push(t.staged);continue}let n,i;try{n=e.hashFile(path.join(e.root,t.source)),i=e.hashFile(path.join(e.root,t.staged))}catch(e){o.push({staged:t.staged,source:t.source,error:String(e&&e.message||e)});continue}n===i?s+=1:o.push({staged:t.staged,source:t.source})}return{staged:a,matched:s,mismatch:o,missingSource:r,stale:n.length>0&&0===a,checked:n.length}}function readJson(e,t){const n=path.join(e.root,t);if(!e.exists(n))return{ok:!1,missing:!0,value:null,path:t};let r;try{r=e.readFile(n)}catch(e){return{ok:!1,unreadable:!0,value:null,path:t,error:String(e&&e.message||e)}}if(null==r)return{ok:!1,missing:!0,value:null,path:t};try{return{ok:!0,value:JSON.parse(r),path:t}}catch(e){return{ok:!1,unreadable:!0,value:null,path:t,error:String(e&&e.message||e)}}}function resolveSeams(e){const t=e||{},n=t.env||{},r=defaultFs(),o=t||{},s=o.exists||r.exists,a=t.layout||layoutOf({exists:s,root:t.root},t.root),i=t.root||a.root,l={root:i,layout:Object.assign({},a,{root:i}),platform:t.platform||"linux",env:n,exists:s,readFile:o.readFile||r.readFile,hashFile:o.hashFile||r.hashFile,listFiles:o.listFiles||r.listFiles,electronPaths:t.electronPaths||defaultElectronPaths(n,t),updateCache:t.updateCache,saveUpdateCache:t.saveUpdateCache,now:"number"==typeof t.now?t.now:0,guiRequested:Boolean(t.guiRequested),guiImplied:t.guiImplied,vendorPairs:t.vendorPairs};return l.credentials=t.credentials||defaultCredentials(l),l.storePath=t.storePath||defaultStorePath(n,l),l.registry=t.registry||defaultRegistry(l),l}function diagnose(e){const t=resolveSeams(e),n=[],r=(e,t)=>n.push({level:"broken",code:e,detail:t}),o=(e,t)=>n.push({level:"warn",code:e,detail:t}),s=t.layout,a=inLayout(s,"one/package.json"),i=readJson(t,a),l=i.ok?{name:i.value.name||"aegisone",version:String(i.value.version||"")}:{name:"aegisone",version:""};i.ok||r("product-unreadable",`${a} ${i.unreadable?"is unreadable":"is missing"}`);let c=null;try{c=require("./release.js").deriveFaceVersions(l.version)}catch(e){c=null,i.ok&&r("product-version-invalid",`${l.version}: ${String(e&&e.message||e)}`)}const u={};for(const{dir:e,package:n}of FACE_PACKAGES){const o=inLayout(s,`${e}/package.json`),a=readJson(t,o),i=a.ok?String(a.value.version||""):"",d=c&&c[n]?c[n].version:null;a.ok?d&&i!==d&&r("version-mismatch",`${n} is ${i}, product ${l.version} derives ${d}`):r("face-unreadable",`${o} ${a.unreadable?"is unreadable":"is missing"}`),u[n]={dir:e,version:i,expected:d,ok:Boolean(d&&i===d)}}let d={key:"",source:"none",from:""};try{d=t.credentials.resolve({env:t.env})||d}catch{d={key:"",source:"none",from:""}}const h=t.electronPaths||{};let p=d.key?"env"===d.source?"env":(d.source,"env-file"):"none";if(!d.key&&h.keychain&&t.exists(h.keychain)){const e=(()=>{try{return t.readFile(h.keychain)}catch{return null}})();e&&/encrypt|safeStorage/i.test(e)&&(p="keychain")}"none"===p&&o("no-credential","no credential found (env, credentials.json, or the OS keychain)");const f={path:t.storePath,exists:!1,readable:null,legacy:null};try{f.exists=t.exists(t.storePath)}catch{f.exists=!1}let g,v=f.path;if(f.exists){let e=null;try{e=t.readFile(f.path)}catch(e){f.readable=!1,r("store-unreadable",`${f.path}: ${String(e&&e.message||e)}`)}if(null===f.readable)if(null==e)f.readable=!1,r("store-unreadable",`${f.path} exists but could not be read`);else try{const t=JSON.parse(e);f.readable=!0,f.legacy=t&&t.version||null}catch(e){f.readable=!1,r("store-unreadable",`${f.path} is not valid JSON: ${String(e&&e.message||e)}`)}v=path.basename(f.path)}f.display=v;try{g=checkVendor(t,t.vendorPairs)}catch(e){g={staged:0,matched:0,mismatch:[],missingSource:[],stale:!1,checked:0,error:String(e&&e.message||e)},r("vendor-unreadable",g.error)}for(const e of g.mismatch)r("vendor-hash-mismatch",`${e.staged} differs from ${e.source||"its source"}`);for(const e of g.missingSource)r("vendor-source-missing",`${e} has no source to be re-derived from`);g.stale&&(s.installed?r("vendor-missing","the ONE bundle is empty — reinstall aegisone"):o("vendor-stale","the ONE bundle has never been staged (one/vendor is empty) — run `npm run predist`"));const m={channel:"npm",current:l.version,latest:null,behind:!1,reason:null,checkedAt:null,cached:!0,action:"none",applier:"npm",instruction:null};try{const e=t.registry.check({current:l.version,cache:t.updateCache,save:t.saveUpdateCache,now:t.now})||{};m.latest=e.latest||null,m.behind=Boolean(e.behind),m.reason=e.reason||null}catch(e){m.reason="unavailable",m.error=String(e&&e.message||e)}try{const e=t.registry.plan({current:l.version,latest:m.latest,behind:m.behind});e&&(m.action=e.action,m.applier=e.applier,m.instruction=e.instruction)}catch{}m.behind&&o("update-available",`${m.current} → ${m.latest} (${m.instruction||"run the channel updater"})`);const y=h&&h.electron||null;t.guiRequested&&!y&&r("gui-without-electron","--gui was requested but Electron is not installed — use --tui");const b=n.filter((e=>"broken"===e.level)).length,j=n.filter((e=>"warn"===e.level)).length,k=b?EXIT.BROKEN:j?EXIT.WARN:EXIT.OK;return{report:{aegis:"one",status:b?"broken":j?"warn":"healthy",exitCode:k,product:l,faces:u,credential:{source:p,found:Boolean(d.key),from:d.key?d.from:""},store:{path:f.path,exists:f.exists,readable:f.exists?!0===f.readable:null},vendor:{staged:g.staged,matched:g.matched,mismatched:g.mismatch.length,missingSource:g.missingSource.length,stale:g.stale,verifiable:!s.installed},update:m,gui:{requested:Boolean(t.guiRequested),electron:y||null,usable:Boolean(y)&&(!t.guiImplied||t.guiImplied)},problems:n},code:k}}function render(e){const t=[];t.push(`aegis doctor — ${e.status} (exit ${e.exitCode})`),t.push(` product ${e.product.name} ${e.product.version}`);for(const[r,o]of Object.entries(e.faces)){const e=o.ok?"":` (expected ${o.expected||"unknown"})`;t.push(` ${n=r,14,String(n)+" ".repeat(Math.max(0,14-String(n).length))} ${o.version||"unknown"}${e}`)}var n;t.push(` credential ${e.credential.source}`),t.push(` shared store ${e.store.path} ${e.store.exists?e.store.readable?"(readable)":"(unreadable)":"(absent)"}`),t.push(!1===e.vendor.verifiable?` vendor ${e.vendor.staged} staged (sources not shipped — not re-derivable here)`:` vendor ${e.vendor.staged} staged, ${e.vendor.matched} matching, ${e.vendor.mismatched} mismatched, ${e.vendor.missingSource} without a source`+(e.vendor.stale?" (never staged)":""));const r=e.update;if(t.push(" update "+(r.behind?`${r.current} → ${r.latest}`:`${r.current} is current`)+` (next: ${r.action}${r.instruction?` — ${r.instruction}`:""})`),t.push(" window face "+(e.gui.electron?`Electron at ${e.gui.electron}`:"not installed")),e.problems.length){t.push(" problems:");for(const n of e.problems)t.push(` ${"broken"===n.level?"✗":"!"} ${n.code}: ${n.detail}`)}return t.join("\n")+"\n"}function wantsGui(e,t){return!!(Array.isArray(e)?e:[]).includes("--gui")||"gui"===(t||{}).AEGISONE_FACE}function main(e,t){const n=t||{},r=Array.isArray(e)?e:[],o=n.stdout||process.stdout,s=n.env||process.env||{},a=Object.assign({},n,{env:s,guiRequested:wantsGui(r,s)}),{report:i,code:l}=diagnose(a),c=r.includes("--json")?JSON.stringify(i)+"\n":render(i);try{o.write(c)}catch{}return l}module.exports={EXIT:EXIT,FACE_PACKAGES:FACE_PACKAGES,wantsGui:wantsGui,diagnose:diagnose,render:render,main:main,vendorPairs:vendorPairs,resolveSeams:resolveSeams},require.main===module&&(process.exitCode=main(process.argv.slice(2)));
3
+ "use strict";const path=require("node:path"),fs=require("node:fs"),crypto=require("node:crypto"),EXIT=Object.freeze({OK:0,WARN:1,BROKEN:2}),FACE_PACKAGES=Object.freeze([Object.freeze({dir:"cli",package:"aegiscode"}),Object.freeze({dir:"desktop",package:"aegis-desktop"})]),BUNDLE_FACES=Object.freeze([Object.freeze({face:"cli",root:"cli",staged:"one/vendor/cli"}),Object.freeze({face:"desktop",root:"desktop",staged:"one/vendor/desktop"})]);function oneDir(){return path.resolve(__dirname,"..")}function repoDir(){return path.resolve(__dirname,"..","..")}function layoutOf(e,t){const n=t=>{try{return Boolean(e.exists(t))}catch{return!1}};if(t){const e=!n(path.join(t,"one","package.json"));return{root:t,installed:e,facePrefix:e?["vendor"]:[]}}const r=repoDir(),o=!n(path.join(r,"one","package.json"));return{root:o?oneDir():r,installed:o,facePrefix:o?["vendor"]:[]}}function inLayout(e,t){if(!e.installed)return t;const n=t.split("/");if("one"===n[0]){const e=n.slice(1).join("/");return"src/selfhost.js"===e?"vendor/desktop/vendor/selfhost.js":("vendor/cli"===e||e.startsWith("vendor/"),e)}return"cli"===n[0]||"desktop"===n[0]?path.posix.join("vendor",t).split(path.sep).join("/"):path.posix.join("vendor","cli","vendor",t).split(path.sep).join("/")}function homeHint(e){const t=e||{};return t.AEGISCODE_HOME||t.AEGIS_HOME||null}function homeDir(e){try{return require("./host.js").hostHome(e||{})}catch{const t=e||{},n=t.USERPROFILE||t.HOME;return n?String(n).trim():""}}function defaultFs(){return{exists:e=>{try{return fs.existsSync(e)}catch{return!1}},readFile:e=>{try{return fs.readFileSync(e,"utf8")}catch(e){if(e&&("ENOENT"===e.code||"EISDIR"===e.code))return null;throw e}},hashFile:e=>crypto.createHash("sha256").update(fs.readFileSync(e)).digest("hex"),listFiles:(e,t)=>listFiles(e,void 0===t?e:t)}}function listFiles(e,t){const n=[],r=e=>{let o;try{o=fs.readdirSync(e,{withFileTypes:!0})}catch{return}for(const s of o){if("node_modules"===s.name||".git"===s.name)continue;const o=path.join(e,s.name);s.isDirectory()?r(o):n.push(path.relative(t,o).split(path.sep).join("/"))}};return r(e),n.sort()}function defaultElectronPaths(e,t){const n=t||{},r=homeHint(e)||path.join(homeDir(e),".aegiscode");return{electron:void 0!==n.electron?n.electron:null,desktopMain:void 0!==n.desktopMain?n.desktopMain:null,userData:void 0!==n.userData?n.userData:r,keychain:void 0!==n.keychain?n.keychain:path.join(r,"settings.json")}}function defaultRegistry(e){let t=null;const n=()=>{if(t)return t;const n=e&&e.layout?e.layout:{root:repoDir(),installed:!1},r=[path.join(n.root,"client","update.js"),path.join(n.root,"vendor","cli","vendor","client","update.js")];for(const e of r)try{t=require(e);break}catch{}return t};return{check(e){const t=n();return t&&"function"==typeof t.updateNotice?t.updateNotice(e||{}):{latest:null,behind:!1,reason:"unavailable"}},plan(e){const t=n();return t&&"function"==typeof t.updatePlan?t.updatePlan(e||{}):null}}}function clientModuleCandidates(e){return[path.join(e.root,"client"),path.join(e.root,"vendor","cli","vendor","client")]}function loadClientModule(e,t){const n=e&&e.layout?e.layout:{root:repoDir(),installed:!1};for(const e of clientModuleCandidates(n))try{return require(path.join(e,t))}catch{}return null}function defaultStorePath(e,t){try{const n=loadClientModule(t,"prefs.js");if(n&&"function"==typeof n.prefsFile)return n.prefsFile(e)}catch{}const n=homeHint(e)||path.join(homeDir(e),".aegiscode");return path.join(n,"preferences.json")}function defaultCredentials(e){let t=null,n=!1;return{resolve(r){if(n||(n=!0,t=loadClientModule(e,"credentials.js")),!t||"function"!=typeof t.resolveApiKey)return{key:"",source:"none",from:""};try{return t.resolveApiKey(r||{})}catch{return{key:"",source:"none",from:""}}}}}function vendorPairs(e){const{exists:t}=e,n=[];if((e.layout||{installed:!1,facePrefix:[]}).installed)return n;for(const{face:r,root:o,staged:s}of BUNDLE_FACES){const a=path.join(e.root,s),i=e.listFiles(a,a);for(const a of i){const i=[];if(a.startsWith("vendor/")){const e=a.slice(7);if(i.push(e),i.push(path.join(o,e)),"selfhost.js"===e&&i.push(path.join("one","src","selfhost.js")),"protocol.js"===e&&i.push(path.join("one","src","protocol.js")),"pty.js"===e&&i.push(path.join("one","src","iface","pty.js")),"desktop"===r){const t=path.basename(e);for(const e of["client","mcp","covenant","commands","skills","tools","hosts"])i.push(path.join(e,t));i.push(t)}}else i.push(path.join(o,a)),i.push(a);const l=i.find(n=>t(path.join(e.root,n)))||null;n.push({face:r,staged:path.join(s,a),source:l,candidates:i})}}return n}function layoutsInstalled(e){return Boolean(e&&e.installed)}function checkVendor(e,t){const n=t||vendorPairs(e),r=[],o=[];let s=0,a=0;const i=e.layout||{installed:!1,facePrefix:[]};if(layoutsInstalled(i)){for(const t of BUNDLE_FACES){const n=path.join(e.root,inLayout(i,t.staged));e.exists(n)&&(a+=e.listFiles(n,n).length)}return{staged:a,matched:0,mismatch:o,missingSource:r,stale:0===a,checked:0}}for(const t of n){if(!e.exists(path.join(e.root,t.staged)))continue;if(a+=1,!t.source){r.push(t.staged);continue}let n,i;try{n=e.hashFile(path.join(e.root,t.source)),i=e.hashFile(path.join(e.root,t.staged))}catch(e){o.push({staged:t.staged,source:t.source,error:String(e&&e.message||e)});continue}n===i?s+=1:o.push({staged:t.staged,source:t.source})}return{staged:a,matched:s,mismatch:o,missingSource:r,stale:n.length>0&&0===a,checked:n.length}}function readJson(e,t){const n=path.join(e.root,t);if(!e.exists(n))return{ok:!1,missing:!0,value:null,path:t};let r;try{r=e.readFile(n)}catch(e){return{ok:!1,unreadable:!0,value:null,path:t,error:String(e&&e.message||e)}}if(null==r)return{ok:!1,missing:!0,value:null,path:t};try{return{ok:!0,value:JSON.parse(r),path:t}}catch(e){return{ok:!1,unreadable:!0,value:null,path:t,error:String(e&&e.message||e)}}}function resolveSeams(e){const t=e||{},n=t.env||{},r=defaultFs(),o=t||{},s=o.exists||r.exists,a=t.layout||layoutOf({exists:s,root:t.root},t.root),i=t.root||a.root,l={root:i,layout:Object.assign({},a,{root:i}),platform:t.platform||"linux",env:n,exists:s,readFile:o.readFile||r.readFile,hashFile:o.hashFile||r.hashFile,listFiles:o.listFiles||r.listFiles,electronPaths:t.electronPaths||defaultElectronPaths(n,t),updateCache:t.updateCache,saveUpdateCache:t.saveUpdateCache,now:"number"==typeof t.now?t.now:0,guiRequested:Boolean(t.guiRequested),guiImplied:t.guiImplied,vendorPairs:t.vendorPairs};return l.credentials=t.credentials||defaultCredentials(l),l.storePath=t.storePath||defaultStorePath(n,l),l.registry=t.registry||defaultRegistry(l),l}function diagnose(e){const t=resolveSeams(e),n=[],r=(e,t)=>n.push({level:"broken",code:e,detail:t}),o=(e,t)=>n.push({level:"warn",code:e,detail:t}),s=t.layout,a=inLayout(s,"one/package.json"),i=readJson(t,a),l=i.ok?{name:i.value.name||"aegisone",version:String(i.value.version||"")}:{name:"aegisone",version:""};i.ok||r("product-unreadable",`${a} ${i.unreadable?"is unreadable":"is missing"}`);let c=null;try{c=require("./release.js").deriveFaceVersions(l.version)}catch(e){c=null,i.ok&&r("product-version-invalid",`${l.version}: ${String(e&&e.message||e)}`)}const u={};for(const{dir:e,package:n}of FACE_PACKAGES){const o=inLayout(s,`${e}/package.json`),a=readJson(t,o),i=a.ok?String(a.value.version||""):"",d=c&&c[n]?c[n].version:null;a.ok?d&&i!==d&&r("version-mismatch",`${n} is ${i}, product ${l.version} derives ${d}`):r("face-unreadable",`${o} ${a.unreadable?"is unreadable":"is missing"}`),u[n]={dir:e,version:i,expected:d,ok:Boolean(d&&i===d)}}let d={key:"",source:"none",from:""};try{d=t.credentials.resolve({env:t.env})||d}catch{d={key:"",source:"none",from:""}}const h=t.electronPaths||{};let p=d.key?"env"===d.source?"env":(d.source,"env-file"):"none";if(!d.key&&h.keychain&&t.exists(h.keychain)){const e=(()=>{try{return t.readFile(h.keychain)}catch{return null}})();e&&/encrypt|safeStorage/i.test(e)&&(p="keychain")}"none"===p&&o("no-credential","no credential found (env, credentials.json, or the OS keychain)");const f={path:t.storePath,exists:!1,readable:null,legacy:null};try{f.exists=t.exists(t.storePath)}catch{f.exists=!1}let g,v=f.path;if(f.exists){let e=null;try{e=t.readFile(f.path)}catch(e){f.readable=!1,r("store-unreadable",`${f.path}: ${String(e&&e.message||e)}`)}if(null===f.readable)if(null==e)f.readable=!1,r("store-unreadable",`${f.path} exists but could not be read`);else try{const t=JSON.parse(e);f.readable=!0,f.legacy=t&&t.version||null}catch(e){f.readable=!1,r("store-unreadable",`${f.path} is not valid JSON: ${String(e&&e.message||e)}`)}v=path.basename(f.path)}f.display=v;try{g=checkVendor(t,t.vendorPairs)}catch(e){g={staged:0,matched:0,mismatch:[],missingSource:[],stale:!1,checked:0,error:String(e&&e.message||e)},r("vendor-unreadable",g.error)}for(const e of g.mismatch)r("vendor-hash-mismatch",`${e.staged} differs from ${e.source||"its source"}`);for(const e of g.missingSource)r("vendor-source-missing",`${e} has no source to be re-derived from`);g.stale&&(s.installed?r("vendor-missing","the ONE bundle is empty — reinstall aegisone"):o("vendor-stale","the ONE bundle has never been staged (one/vendor is empty) — run `npm run predist`"));const m={channel:"npm",current:l.version,latest:null,behind:!1,reason:null,checkedAt:null,cached:!0,action:"none",applier:"npm",instruction:null};try{const e=t.registry.check({current:l.version,cache:t.updateCache,save:t.saveUpdateCache,now:t.now})||{};m.latest=e.latest||null,m.behind=Boolean(e.behind),m.reason=e.reason||null}catch(e){m.reason="unavailable",m.error=String(e&&e.message||e)}try{const e=t.registry.plan({current:l.version,latest:m.latest,behind:m.behind});e&&(m.action=e.action,m.applier=e.applier,m.instruction=e.instruction)}catch{}m.behind&&o("update-available",`${m.current} → ${m.latest} (${m.instruction||"run the channel updater"})`);const y=h&&h.electron||null;t.guiRequested&&!y&&r("gui-without-electron","--gui was requested but Electron is not installed — use --tui");const b=n.filter(e=>"broken"===e.level).length,j=n.filter(e=>"warn"===e.level).length,k=b?EXIT.BROKEN:j?EXIT.WARN:EXIT.OK;return{report:{aegis:"one",status:b?"broken":j?"warn":"healthy",exitCode:k,product:l,faces:u,credential:{source:p,found:Boolean(d.key),from:d.key?d.from:""},store:{path:f.path,exists:f.exists,readable:f.exists?!0===f.readable:null},vendor:{staged:g.staged,matched:g.matched,mismatched:g.mismatch.length,missingSource:g.missingSource.length,stale:g.stale,verifiable:!s.installed},update:m,gui:{requested:Boolean(t.guiRequested),electron:y||null,usable:Boolean(y)&&(!t.guiImplied||t.guiImplied)},problems:n},code:k}}function render(e){const t=[],n=(e,t)=>String(e)+" ".repeat(Math.max(0,t-String(e).length));t.push(`aegis doctor — ${e.status} (exit ${e.exitCode})`),t.push(` product ${e.product.name} ${e.product.version}`);for(const[r,o]of Object.entries(e.faces)){const e=o.ok?"":` (expected ${o.expected||"unknown"})`;t.push(` ${n(r,14)} ${o.version||"unknown"}${e}`)}t.push(` credential ${e.credential.source}`),t.push(` shared store ${e.store.path} ${e.store.exists?e.store.readable?"(readable)":"(unreadable)":"(absent)"}`),t.push(!1===e.vendor.verifiable?` vendor ${e.vendor.staged} staged (sources not shipped — not re-derivable here)`:` vendor ${e.vendor.staged} staged, ${e.vendor.matched} matching, ${e.vendor.mismatched} mismatched, ${e.vendor.missingSource} without a source`+(e.vendor.stale?" (never staged)":""));const r=e.update;if(t.push(" update "+(r.behind?`${r.current} → ${r.latest}`:`${r.current} is current`)+` (next: ${r.action}${r.instruction?` — ${r.instruction}`:""})`),t.push(" window face "+(e.gui.electron?`Electron at ${e.gui.electron}`:"not installed")),e.problems.length){t.push(" problems:");for(const n of e.problems)t.push(` ${"broken"===n.level?"✗":"!"} ${n.code}: ${n.detail}`)}return t.join("\n")+"\n"}function wantsGui(e,t){return!!(Array.isArray(e)?e:[]).includes("--gui")||"gui"===(t||{}).AEGISONE_FACE}function main(e,t){const n=t||{},r=Array.isArray(e)?e:[],o=n.stdout||process.stdout,s=n.env||process.env||{},a=Object.assign({},n,{env:s,guiRequested:wantsGui(r,s)}),{report:i,code:l}=diagnose(a),c=r.includes("--json")?JSON.stringify(i)+"\n":render(i);try{o.write(c)}catch{}return l}module.exports={EXIT:EXIT,FACE_PACKAGES:FACE_PACKAGES,wantsGui:wantsGui,diagnose:diagnose,render:render,main:main,vendorPairs:vendorPairs,resolveSeams:resolveSeams},require.main===module&&(process.exitCode=main(process.argv.slice(2)));
package/src/probes.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const fs=require("node:fs"),path=require("node:path"),{createRequire:createRequire}=require("node:module"),host=require("./host.js");function hasDisplay(e,t){const r=e||{},o=t||host.hostPlatform();return"darwin"===o||"win32"===o||Boolean(r.DISPLAY||r.WAYLAND_DISPLAY||r.MIR_SERVER_SOCKET)}function resolveFrom(e,t){if(!e)return null;try{return createRequire(path.join(e,"package.json")).resolve(t)}catch{return null}}function electronExecutable(e){const t=Array.isArray(e)?e:[e];for(const e of t)if(resolveFrom(e,"electron"))try{const t=createRequire(path.join(e,"package.json"))("electron");if("string"==typeof t&&t)return t;if(t&&"string"==typeof t.path&&t.path)return t.path;if(t&&"string"==typeof t.default&&t.default)return t.default}catch{}return null}function stdioTty(e,t){const r=e=>{try{return Boolean(e&&e.isTTY)}catch{return!1}};return{stdin:r(void 0===e?process.stdin:e),stdout:r(void 0===t?process.stdout:t)}}function packageDirs(e,t){const r=[path.join(e,"..",t)],o=path.join(e,"vendor",t);return fs.existsSync(o)&&r.push(o),r}function firstFile(e){for(const t of e)if(t&&fs.existsSync(t))return t;return null}function collect(e){const t=e||{},r=t.oneDir||path.resolve(__dirname,".."),o=t.env||process.env,s=t.platform||host.hostPlatform(),n=t.invokedAs||path.basename(process.argv[1]||"aegis"),i=o.AEGISONE_CLI_BIN||firstFile(packageDirs(r,"cli").map((e=>path.join(e,"bin","aegiscode.js")))),a=o.AEGISONE_DESKTOP_BIN||firstFile(packageDirs(r,"desktop").map((e=>path.join(e,"bin","aegis.js")))),c=void 0!==t.electron?t.electron:electronExecutable(packageDirs(r,"desktop"));return{argv:t.argv||process.argv.slice(2),env:o,platform:s,tty:t.tty||stdioTty(process.stdin,process.stdout),hasDisplay:void 0!==t.hasDisplay?Boolean(t.hasDisplay):hasDisplay(o,s),electronResolvable:Boolean(c),invokedAs:n,_cliBin:i,_desktopMain:a,_electron:c}}module.exports={hasDisplay:hasDisplay,resolveFrom:resolveFrom,electronExecutable:electronExecutable,stdioTty:stdioTty,packageDirs:packageDirs,firstFile:firstFile,collect:collect};
3
+ "use strict";const fs=require("node:fs"),path=require("node:path"),{createRequire:createRequire}=require("node:module"),host=require("./host.js");function hasDisplay(e,t){const r=e||{},o=t||host.hostPlatform();return"darwin"===o||"win32"===o||Boolean(r.DISPLAY||r.WAYLAND_DISPLAY||r.MIR_SERVER_SOCKET)}function resolveFrom(e,t){if(!e)return null;try{return createRequire(path.join(e,"package.json")).resolve(t)}catch{return null}}function electronExecutable(e){const t=Array.isArray(e)?e:[e];for(const e of t)if(resolveFrom(e,"electron"))try{const t=createRequire(path.join(e,"package.json"))("electron");if("string"==typeof t&&t)return t;if(t&&"string"==typeof t.path&&t.path)return t.path;if(t&&"string"==typeof t.default&&t.default)return t.default}catch{}return null}function stdioTty(e,t){const r=e=>{try{return Boolean(e&&e.isTTY)}catch{return!1}};return{stdin:r(void 0===e?process.stdin:e),stdout:r(void 0===t?process.stdout:t)}}function packageDirs(e,t){const r=[path.join(e,"..",t)],o=path.join(e,"vendor",t);return fs.existsSync(o)&&r.push(o),r}function firstFile(e){for(const t of e)if(t&&fs.existsSync(t))return t;return null}function collect(e){const t=e||{},r=t.oneDir||path.resolve(__dirname,".."),o=t.env||process.env,s=t.platform||host.hostPlatform(),n=t.invokedAs||path.basename(process.argv[1]||"aegis"),i=o.AEGISONE_CLI_BIN||firstFile(packageDirs(r,"cli").map(e=>path.join(e,"bin","aegiscode.js"))),a=o.AEGISONE_DESKTOP_BIN||firstFile(packageDirs(r,"desktop").map(e=>path.join(e,"bin","aegis.js"))),c=void 0!==t.electron?t.electron:electronExecutable(packageDirs(r,"desktop"));return{argv:t.argv||process.argv.slice(2),env:o,platform:s,tty:t.tty||stdioTty(process.stdin,process.stdout),hasDisplay:void 0!==t.hasDisplay?Boolean(t.hasDisplay):hasDisplay(o,s),electronResolvable:Boolean(c),invokedAs:n,_cliBin:i,_desktopMain:a,_electron:c}}module.exports={hasDisplay:hasDisplay,resolveFrom:resolveFrom,electronExecutable:electronExecutable,stdioTty:stdioTty,packageDirs:packageDirs,firstFile:firstFile,collect:collect};
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const PRODUCT_PKG="aegisone",ACTION=Object.freeze({CHECK:"check",APPLY:"apply"}),CODE=Object.freeze({BAD_INPUT:"bad_input",NO_CHANNEL:"no_channel",NO_APPROACH:"no_approach",NOTHING:"nothing_to_apply",INSTALL_FAILED:"install_failed",SOURCE_LIKE:"source_like"}),HELP_WORDS=new Set(["--help","-h","help"]),ACTIONS=Object.freeze({"":ACTION.CHECK,check:ACTION.CHECK,status:ACTION.CHECK,apply:ACTION.APPLY,install:ACTION.APPLY});function updateRequest(e){const t=(Array.isArray(e)?e:[]).map(String);if(0===t.length)return null;if("update"!==t[0])return null;if(1===t.length)return{action:ACTION.CHECK};if(2!==t.length)return null;const n=t[1].trim().toLowerCase();return HELP_WORDS.has(n)?{action:"help"}:Object.prototype.hasOwnProperty.call(ACTIONS,n)&&n?{action:ACTIONS[n]}:null}function compareVersions(e,t){const n=e=>String(null==e?"0":e).trim().replace(/^v/,"").split("-")[0].split(".").map((e=>Number.parseInt(e,10)||0)),r=n(e),o=n(t);for(let e=0;e<Math.max(r.length,o.length);e++){const t=(r[e]||0)-(o[e]||0);if(t)return t>0?1:-1}return 0}function plan(e){const t=e||{},n=t.env||{};return"source"===String(n.AEGIS_INSTALL_METHOD||"").trim().toLowerCase()||!1===t.installed?{ok:!1,code:CODE.SOURCE_LIKE,msg:"this copy is a source checkout: updating it means `git pull && npm ci`, not a self-update"}:{ok:!0,channel:"npm",selfUpdate:!0,reason:`installed from npm, so \`npm i -g ${PRODUCT_PKG}@latest\` owns this copy`}}function advice(e){const t=e||{},n=String(null==t.current?"":t.current),r=`npm i -g ${t.pkg||PRODUCT_PKG}@latest`;if(!t.latest)return{upToDate:null,command:null,lines:[` Installed: ${n}`," Published: (could not read the npm registry)",` Upgrade: ${r} — run it yourself; this check needs the registry`]};const o=String(t.latest);return compareVersions(o,n)>0?{upToDate:!1,command:r,lines:[` Installed: ${n}`,` Published: ${o}`,` Upgrade: ${r}`," (or run `aegis update apply` to do it here)"]}:{upToDate:!0,command:null,lines:[` Installed ${n} is the published ${o} — nothing to upgrade.`]}}async function check(e,t){const n=e||{},r=t||{},o=String(null==n.current?"":n.current),a=n.pkg||PRODUCT_PKG,s=r.fetchImpl;let l=null,i=null;if("function"==typeof s)try{const e=await s({pkg:a});e&&"object"==typeof e?(l=e.latest?String(e.latest):null,i=e.reason?String(e.reason):null):e&&(l=String(e))}catch{l=null,i="network"}else i="no_approach";const c=advice({current:o,latest:l,pkg:a,action:n.action});return{ok:Boolean(l),current:o,latest:l,upToDate:c.upToDate,command:c.command,lines:c.lines,reason:i}}function apply(e,t,n){const r=n||{};if(!e||!e.ok)return{ok:!1,code:e&&e.code||CODE.BAD_INPUT,msg:e&&e.msg||"no usable update plan"};if(!e.selfUpdate)return{ok:!1,code:CODE.NO_CHANNEL,msg:`the ${e.channel} channel is not self-updating: ${e.reason}`};if(!t||!0!==t.ok||!1!==t.upToDate||!t.command){const e=t?!0===t.upToDate?"nothing to apply: this copy is already the published version":"nothing to apply: the registry could not be read, so no newer version was established":"nothing to apply: no newer version was established";return{ok:!1,code:CODE.NOTHING,skipped:!0,msg:e}}const o=r.runImpl;if("function"!=typeof o)return{ok:!1,code:CODE.NO_APPROACH,msg:"no install step was injected",instruction:t.command};const a=r.spawnSpec||{command:"npm",args:["i","-g",`${r.pkg||PRODUCT_PKG}@latest`],shell:!1};let s;try{s=o(a)}catch(e){return{ok:!1,code:CODE.INSTALL_FAILED,command:t.command,error:String(e&&(e.stderr||e.message)||e).trim()}}return s&&!0===s.ok?{ok:!0,command:t.command,output:String(s&&s.output||"").trim(),lines:[`Installed ${t.latest}. Restart \`aegis\` to use it.`]}:{ok:!1,code:CODE.INSTALL_FAILED,command:t.command,error:String(s&&(s.error||s.stderr)||"the installer exited non-zero").trim()}}function renderUsage(e){return["aegis update — check for, or install, a newer published AEGISONE","","Usage:"," aegis update report the installed and published versions"," aegis update check the same report"," aegis update apply install the newer release, if there is one","",` Package: ${PRODUCT_PKG}${e?` Installed: ${e}`:""}`," A source checkout is refused: there, updating means `git pull && npm ci`."].join("\n")+"\n"}module.exports={PRODUCT_PKG:PRODUCT_PKG,ACTION:ACTION,ACTIONS:ACTIONS,HELP_WORDS:HELP_WORDS,CODE:CODE,updateRequest:updateRequest,compareVersions:compareVersions,plan:plan,advice:advice,check:check,apply:apply,renderUsage:renderUsage};
3
+ "use strict";const PRODUCT_PKG="aegisone",ACTION=Object.freeze({CHECK:"check",APPLY:"apply"}),CODE=Object.freeze({BAD_INPUT:"bad_input",NO_CHANNEL:"no_channel",NO_APPROACH:"no_approach",NOTHING:"nothing_to_apply",INSTALL_FAILED:"install_failed",SOURCE_LIKE:"source_like"}),HELP_WORDS=new Set(["--help","-h","help"]),ACTIONS=Object.freeze({"":ACTION.CHECK,check:ACTION.CHECK,status:ACTION.CHECK,apply:ACTION.APPLY,install:ACTION.APPLY});function updateRequest(e){const t=(Array.isArray(e)?e:[]).map(String);if(0===t.length)return null;if("update"!==t[0])return null;if(1===t.length)return{action:ACTION.CHECK};if(2!==t.length)return null;const n=t[1].trim().toLowerCase();return HELP_WORDS.has(n)?{action:"help"}:Object.prototype.hasOwnProperty.call(ACTIONS,n)&&n?{action:ACTIONS[n]}:null}function compareVersions(e,t){const n=e=>String(null==e?"0":e).trim().replace(/^v/,"").split("-")[0].split(".").map(e=>Number.parseInt(e,10)||0),o=n(e),a=n(t);for(let e=0;e<Math.max(o.length,a.length);e++){const t=(o[e]||0)-(a[e]||0);if(t)return t>0?1:-1}return 0}function plan(e){const t=e||{},n=t.env||{};return"source"===String(n.AEGIS_INSTALL_METHOD||"").trim().toLowerCase()||!1===t.installed?{ok:!1,code:CODE.SOURCE_LIKE,msg:"this copy is a source checkout: updating it means `git pull && npm ci`, not a self-update"}:{ok:!0,channel:"npm",selfUpdate:!0,reason:"installed from npm, so `npm i -g aegisone@latest` owns this copy"}}function advice(e){const t=e||{},n=String(null==t.current?"":t.current),o=`npm i -g ${t.pkg||"aegisone"}@latest`;if(!t.latest)return{upToDate:null,command:null,lines:[` Installed: ${n}`," Published: (could not read the npm registry)",` Upgrade: ${o} — run it yourself; this check needs the registry`]};const a=String(t.latest);return compareVersions(a,n)>0?{upToDate:!1,command:o,lines:[` Installed: ${n}`,` Published: ${a}`,` Upgrade: ${o}`," (or run `aegis update apply` to do it here)"]}:{upToDate:!0,command:null,lines:[` Installed ${n} is the published ${a} — nothing to upgrade.`]}}async function check(e,t){const n=e||{},o=t||{},a=String(null==n.current?"":n.current),r=n.pkg||"aegisone",s=o.fetchImpl;let l=null,i=null;if("function"==typeof s)try{const e=await s({pkg:r});e&&"object"==typeof e?(l=e.latest?String(e.latest):null,i=e.reason?String(e.reason):null):e&&(l=String(e))}catch{l=null,i="network"}else i="no_approach";const c=advice({current:a,latest:l,pkg:r,action:n.action});return{ok:Boolean(l),current:a,latest:l,upToDate:c.upToDate,command:c.command,lines:c.lines,reason:i}}function apply(e,t,n){const o=n||{};if(!e||!e.ok)return{ok:!1,code:e&&e.code||CODE.BAD_INPUT,msg:e&&e.msg||"no usable update plan"};if(!e.selfUpdate)return{ok:!1,code:CODE.NO_CHANNEL,msg:`the ${e.channel} channel is not self-updating: ${e.reason}`};if(!t||!0!==t.ok||!1!==t.upToDate||!t.command){const e=t?!0===t.upToDate?"nothing to apply: this copy is already the published version":"nothing to apply: the registry could not be read, so no newer version was established":"nothing to apply: no newer version was established";return{ok:!1,code:CODE.NOTHING,skipped:!0,msg:e}}const a=o.runImpl;if("function"!=typeof a)return{ok:!1,code:CODE.NO_APPROACH,msg:"no install step was injected",instruction:t.command};const r=o.spawnSpec||{command:"npm",args:["i","-g",`${o.pkg||"aegisone"}@latest`],shell:!1};let s;try{s=a(r)}catch(e){return{ok:!1,code:CODE.INSTALL_FAILED,command:t.command,error:String(e&&(e.stderr||e.message)||e).trim()}}return s&&!0===s.ok?{ok:!0,command:t.command,output:String(s&&s.output||"").trim(),lines:[`Installed ${t.latest}. Restart \`aegis\` to use it.`]}:{ok:!1,code:CODE.INSTALL_FAILED,command:t.command,error:String(s&&(s.error||s.stderr)||"the installer exited non-zero").trim()}}function renderUsage(e){return["aegis update — check for, or install, a newer published AEGISONE","","Usage:"," aegis update report the installed and published versions"," aegis update check the same report"," aegis update apply install the newer release, if there is one",""," Package: aegisone"+(e?` Installed: ${e}`:"")," A source checkout is refused: there, updating means `git pull && npm ci`."].join("\n")+"\n"}module.exports={PRODUCT_PKG:"aegisone",ACTION:ACTION,ACTIONS:ACTIONS,HELP_WORDS:HELP_WORDS,CODE:CODE,updateRequest:updateRequest,compareVersions:compareVersions,plan:plan,advice:advice,check:check,apply:apply,renderUsage:renderUsage};
package/src/protocol.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const PROTO=1,METHODS=Object.freeze(["hello","exec","event","cancel"]),CAPS=Object.freeze({EXEC:"exec",EVENT:"event",CANCEL:"cancel",PTY:"pty"}),CODE=Object.freeze({BAD_JSON:"bad_json",BAD_FRAME:"bad_frame",UNKNOWN_METHOD:"unknown_method",PROTO_MISMATCH:"proto_mismatch",HELLO_REQUIRED:"hello_required",CAPABILITY_MISSING:"capability_missing",UNSUPPORTED:"unsupported"});function request(e,o,t){return{id:e,m:String(o),p:t&&"object"==typeof t?t:{}}}function ok(e,o){return{id:e,ok:!0,r:o&&"object"==typeof o?o:{}}}function err(e,o,t){return{id:e,ok:!1,e:{code:String(o||CODE.UNSUPPORTED),msg:String(t||"")}}}function isObject(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}function validate(e){return isObject(e)?void 0===e.id||null===e.id?{ok:!1,code:CODE.BAD_FRAME,msg:"frame has no id"}:void 0!==e.ok?!0===e.ok?void 0!==e.e?{ok:!1,code:CODE.BAD_FRAME,msg:"reply carries both r and e"}:{ok:!0}:!1===e.ok?isObject(e.e)&&e.e.code?{ok:!0}:{ok:!1,code:CODE.BAD_FRAME,msg:"a failed reply must name a code"}:{ok:!1,code:CODE.BAD_FRAME,msg:"ok must be true or false"}:"string"==typeof e.m&&METHODS.includes(e.m)?void 0===e.p||isObject(e.p)?{ok:!0}:{ok:!1,code:CODE.BAD_FRAME,msg:"params must be an object"}:{ok:!1,code:CODE.UNKNOWN_METHOD,msg:`unknown method: ${String(e.m)}`}:{ok:!1,code:CODE.BAD_FRAME,msg:"frame must be an object"}}function negotiate(e,o){const t=o||{},r=validate(e);if(!r.ok)return{ok:!1,code:r.code,msg:r.msg};if("hello"!==e.m)return{ok:!1,code:CODE.HELLO_REQUIRED,msg:`the first frame must be hello, got ${String(e.m)}`};const n=e.p||{};if(1!==n.proto)return{ok:!1,code:CODE.PROTO_MISMATCH,msg:`peer speaks protocol ${String(n.proto)}, this build speaks 1`};const i=Array.isArray(n.caps)?n.caps.map(String):[],s=(Array.isArray(t.requireCaps)?t.requireCaps.map(String):[]).filter((e=>!i.includes(e)));return s.length?{ok:!1,code:CODE.CAPABILITY_MISSING,msg:`peer does not offer: ${s.join(", ")}`}:{ok:!0,proto:1,caps:i}}function hello(e){return request(void 0===e?0:e,"hello",{proto:1,caps:[CAPS.EXEC,CAPS.EVENT,CAPS.CANCEL]})}function encode(e){return`${JSON.stringify(e)}\n`}function decodeLine(e){const o=String(null==e?"":e).trim();if(!o)return{ok:!1,id:null,code:CODE.BAD_JSON,msg:"empty line"};let t;try{t=JSON.parse(o)}catch(e){return{ok:!1,id:null,code:CODE.BAD_JSON,msg:`not JSON: ${e.message}`}}const r=validate(t);return r.ok?{ok:!0,frame:t}:{ok:!1,id:isObject(t)&&void 0!==t.id?t.id:null,code:r.code,msg:r.msg}}function splitLines(e){const o=String(null==e?"":e).split("\n"),t=o.pop();return{lines:o.filter((e=>""!==e.trim())),rest:void 0===t?"":t}}module.exports={PROTO:1,METHODS:METHODS,CAPS:CAPS,CODE:CODE,request:request,ok:ok,err:err,hello:hello,validate:validate,negotiate:negotiate,encode:encode,decodeLine:decodeLine,splitLines:splitLines};
3
+ "use strict";const PROTO=1,METHODS=Object.freeze(["hello","exec","event","cancel"]),CAPS=Object.freeze({EXEC:"exec",EVENT:"event",CANCEL:"cancel",PTY:"pty"}),CODE=Object.freeze({BAD_JSON:"bad_json",BAD_FRAME:"bad_frame",UNKNOWN_METHOD:"unknown_method",PROTO_MISMATCH:"proto_mismatch",HELLO_REQUIRED:"hello_required",CAPABILITY_MISSING:"capability_missing",UNSUPPORTED:"unsupported"});function request(e,o,t){return{id:e,m:String(o),p:t&&"object"==typeof t?t:{}}}function ok(e,o){return{id:e,ok:!0,r:o&&"object"==typeof o?o:{}}}function err(e,o,t){return{id:e,ok:!1,e:{code:String(o||CODE.UNSUPPORTED),msg:String(t||"")}}}function isObject(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}function validate(e){return isObject(e)?void 0===e.id||null===e.id?{ok:!1,code:CODE.BAD_FRAME,msg:"frame has no id"}:void 0!==e.ok?!0===e.ok?void 0!==e.e?{ok:!1,code:CODE.BAD_FRAME,msg:"reply carries both r and e"}:{ok:!0}:!1===e.ok?isObject(e.e)&&e.e.code?{ok:!0}:{ok:!1,code:CODE.BAD_FRAME,msg:"a failed reply must name a code"}:{ok:!1,code:CODE.BAD_FRAME,msg:"ok must be true or false"}:"string"==typeof e.m&&METHODS.includes(e.m)?void 0===e.p||isObject(e.p)?{ok:!0}:{ok:!1,code:CODE.BAD_FRAME,msg:"params must be an object"}:{ok:!1,code:CODE.UNKNOWN_METHOD,msg:`unknown method: ${String(e.m)}`}:{ok:!1,code:CODE.BAD_FRAME,msg:"frame must be an object"}}function negotiate(e,o){const t=o||{},r=validate(e);if(!r.ok)return{ok:!1,code:r.code,msg:r.msg};if("hello"!==e.m)return{ok:!1,code:CODE.HELLO_REQUIRED,msg:`the first frame must be hello, got ${String(e.m)}`};const n=e.p||{};if(1!==n.proto)return{ok:!1,code:CODE.PROTO_MISMATCH,msg:`peer speaks protocol ${String(n.proto)}, this build speaks 1`};const i=Array.isArray(n.caps)?n.caps.map(String):[],s=(Array.isArray(t.requireCaps)?t.requireCaps.map(String):[]).filter(e=>!i.includes(e));return s.length?{ok:!1,code:CODE.CAPABILITY_MISSING,msg:`peer does not offer: ${s.join(", ")}`}:{ok:!0,proto:1,caps:i}}function hello(e){return request(void 0===e?0:e,"hello",{proto:1,caps:[CAPS.EXEC,CAPS.EVENT,CAPS.CANCEL]})}function encode(e){return`${JSON.stringify(e)}\n`}function decodeLine(e){const o=String(null==e?"":e).trim();if(!o)return{ok:!1,id:null,code:CODE.BAD_JSON,msg:"empty line"};let t;try{t=JSON.parse(o)}catch(e){return{ok:!1,id:null,code:CODE.BAD_JSON,msg:`not JSON: ${e.message}`}}const r=validate(t);return r.ok?{ok:!0,frame:t}:{ok:!1,id:isObject(t)&&void 0!==t.id?t.id:null,code:r.code,msg:r.msg}}function splitLines(e){const o=String(null==e?"":e).split("\n"),t=o.pop();return{lines:o.filter(e=>""!==e.trim()),rest:void 0===t?"":t}}module.exports={PROTO:1,METHODS:METHODS,CAPS:CAPS,CODE:CODE,request:request,ok:ok,err:err,hello:hello,validate:validate,negotiate:negotiate,encode:encode,decodeLine:decodeLine,splitLines:splitLines};
package/src/release.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const FACE_LINES=Object.freeze([Object.freeze({dir:"cli",package:"aegiscode",line:Object.freeze([7,0]),anchor:0}),Object.freeze({dir:"desktop",package:"aegis-desktop",line:Object.freeze([1,0]),anchor:0})]),ANCHOR_PRODUCT="1.0.8",MINOR_STRIDE=100,MAJOR_STRIDE=1e4,VERSION_RE=/^(\d+)\.(\d+)\.(\d+)$/;function parseVersion(e){const n=String(null==e?"":e).trim(),r=VERSION_RE.exec(n);if(!r)throw new Error(`${JSON.stringify(String(e))} is not a strict MAJOR.MINOR.PATCH version (prereleases and ranges are refused on purpose — see release.js)`);const t={major:Number(r[1]),minor:Number(r[2]),patch:Number(r[3]),text:n};if(t.minor>=MINOR_STRIDE||t.patch>=MINOR_STRIDE)throw new Error(`${n}: minor and patch must stay under ${MINOR_STRIDE} for the face derivation to stay injective`);return t}function isVersion(e){return VERSION_RE.test(String(null==e?"":e).trim())}function releaseCounter(e){const n="string"==typeof e?parseVersion(e):e;return n.major*MAJOR_STRIDE+n.minor*MINOR_STRIDE+n.patch}const ANCHOR_COUNTER=releaseCounter("1.0.8");function deriveFaceVersion(e,n){const r=releaseCounter(e)-ANCHOR_COUNTER,t=n.anchor+r;if(t<n.anchor)throw new Error(`product ${e} would move ${n.package} backwards (${n.line.join(".")}.${t} < published ${n.line.join(".")}.${n.anchor})`);if(!Number.isSafeInteger(t))throw new Error(`product ${e} overflows the ${n.package} patch counter`);return`${n.line[0]}.${n.line[1]}.${t}`}function deriveFaceVersions(e){const n={};for(const r of FACE_LINES)n[r.package]=Object.freeze({package:r.package,dir:r.dir,version:deriveFaceVersion(e,r)});return n}function tagFor(e){return"v"+parseVersion(e).text}function parseTag(e){const n=String(null==e?"":e).trim(),r=n.startsWith("refs/tags/")?n.slice(10):n;if(!r.startsWith("v"))throw new Error(`${JSON.stringify(n)} is not a release tag — expected vMAJOR.MINOR.PATCH`);return parseVersion(r.slice(1)).text}function nextVersion(e,n){const r=parseVersion(e),t=String(null==n?"":n).trim();if("major"===t)return`${r.major+1}.0.0`;if("minor"===t)return`${r.major}.${r.minor+1}.0`;if("patch"===t)return`${r.major}.${r.minor}.${r.patch+1}`;const o=parseVersion(t).text;if(releaseCounter(o)<=releaseCounter(r))throw new Error(`${o} is not newer than ${r.text} — a released version is never rewritten`);return o}function versionRequest(e){const n=(Array.isArray(e)?e:[]).map(String);if(0===n.length)return null;const r=new Set(["--version","-v","--verbose"]);return n.some((e=>!r.has(e)))?null:n.includes("--version")||n.includes("-v")?{verbose:n.includes("--verbose")}:null}function renderVersion(e){const n=e||{},r=[parseVersion((n.product||{}).version).text];for(const e of n.faces||[])r.push(e&&e.version?`${e.package} ${e.version}`:`${e&&e.package} unknown (no manifest beside this package)`);return r.join("\n")+"\n"}const README_VERSION_RE=/^(Product version: \*\*)(\d+\.\d+\.\d+)(\*\*.*)$/m;function setManifestVersion(e,n){const r=JSON.parse(e);if("string"!=typeof r.version||!isVersion(r.version))throw new Error("that package.json has no usable `version` field");return r.version=parseVersion(n).text,JSON.stringify(r,null,2)+"\n"}function setReadmeVersion(e,n){if(!README_VERSION_RE.test(e))throw new Error('the product README has no "Product version: **X.Y.Z**" line for the bump to maintain');return e.replace(README_VERSION_RE,((e,r,t,o)=>r+parseVersion(n).text+o))}function planBump(e){const n=e||{},r=parseVersion(n.version).text;return(n.documents||[]).map((e=>{const n=parseVersion(e.version||r).text,t=e.content;let o;if("json"===e.kind){const r=JSON.parse(t).version;return r===n?{file:e.file,kind:e.kind,from:r,to:n,before:t,content:t,unchanged:!0}:(o=setManifestVersion(t,n),{file:e.file,kind:e.kind,from:r,to:n,before:t,content:o,unchanged:!1})}if("readme"===e.kind){const r=README_VERSION_RE.exec(t);if(!r)throw new Error(`${e.file} has no version line for the bump to maintain`);const o=r[2];return o===n?{file:e.file,kind:e.kind,from:o,to:n,before:t,content:t,unchanged:!0}:{file:e.file,kind:e.kind,from:o,to:n,before:t,content:setReadmeVersion(t,n),unchanged:!1}}throw new Error(`${e.file}: unknown document kind ${JSON.stringify(e.kind)}`)}))}function unifiedDiff(e,n,r){if(e===n)return"";const t=e.split("\n"),o=n.split("\n");let i=0;for(;i<t.length&&i<o.length&&t[i]===o[i];)i++;let s=0;for(;s<t.length-i&&s<o.length-i&&t[t.length-1-s]===o[o.length-1-s];)s++;const a=t.slice(i,t.length-s),c=o.slice(i,o.length-s),f=Math.max(0,i-3),u=Math.min(t.length,t.length-s+3),l=Math.min(o.length,o.length-s+3),d=t.slice(f,u),p=(o.slice(f,l),[`--- a/${r}`,`+++ b/${r}`,`@@ -${f+1},${u-f} +${f+1},${l-f} @@`]);for(const e of d.slice(0,i-f))p.push(" "+e);for(const e of a)p.push("-"+e);for(const e of c)p.push("+"+e);const R=d.slice(i-f+a.length);for(const e of R)p.push(" "+e);return p.join("\n")+"\n"}module.exports={FACE_LINES:FACE_LINES,ANCHOR_PRODUCT:"1.0.8",MINOR_STRIDE:MINOR_STRIDE,MAJOR_STRIDE:MAJOR_STRIDE,parseVersion:parseVersion,isVersion:isVersion,releaseCounter:releaseCounter,deriveFaceVersion:deriveFaceVersion,deriveFaceVersions:deriveFaceVersions,tagFor:tagFor,parseTag:parseTag,nextVersion:nextVersion,versionRequest:versionRequest,renderVersion:renderVersion,planBump:planBump,setManifestVersion:setManifestVersion,setReadmeVersion:setReadmeVersion,unifiedDiff:unifiedDiff,README_VERSION_RE:README_VERSION_RE};
3
+ "use strict";const FACE_LINES=Object.freeze([Object.freeze({dir:"cli",package:"aegiscode",line:Object.freeze([7,0]),anchor:0}),Object.freeze({dir:"desktop",package:"aegis-desktop",line:Object.freeze([1,0]),anchor:0})]),ANCHOR_PRODUCT="1.0.8",MINOR_STRIDE=100,MAJOR_STRIDE=1e4,VERSION_RE=/^(\d+)\.(\d+)\.(\d+)$/;function parseVersion(e){const n=String(null==e?"":e).trim(),r=VERSION_RE.exec(n);if(!r)throw new Error(`${JSON.stringify(String(e))} is not a strict MAJOR.MINOR.PATCH version (prereleases and ranges are refused on purpose — see release.js)`);const t={major:Number(r[1]),minor:Number(r[2]),patch:Number(r[3]),text:n};if(t.minor>=100||t.patch>=100)throw new Error(`${n}: minor and patch must stay under 100 for the face derivation to stay injective`);return t}function isVersion(e){return VERSION_RE.test(String(null==e?"":e).trim())}function releaseCounter(e){const n="string"==typeof e?parseVersion(e):e;return 1e4*n.major+100*n.minor+n.patch}const ANCHOR_COUNTER=releaseCounter("1.0.8");function deriveFaceVersion(e,n){const r=releaseCounter(e)-ANCHOR_COUNTER,t=n.anchor+r;if(t<n.anchor)throw new Error(`product ${e} would move ${n.package} backwards (${n.line.join(".")}.${t} < published ${n.line.join(".")}.${n.anchor})`);if(!Number.isSafeInteger(t))throw new Error(`product ${e} overflows the ${n.package} patch counter`);return`${n.line[0]}.${n.line[1]}.${t}`}function deriveFaceVersions(e){const n={};for(const r of FACE_LINES)n[r.package]=Object.freeze({package:r.package,dir:r.dir,version:deriveFaceVersion(e,r)});return n}function tagFor(e){return"v"+parseVersion(e).text}function parseTag(e){const n=String(null==e?"":e).trim(),r=n.startsWith("refs/tags/")?n.slice(10):n;if(!r.startsWith("v"))throw new Error(`${JSON.stringify(n)} is not a release tag — expected vMAJOR.MINOR.PATCH`);return parseVersion(r.slice(1)).text}function nextVersion(e,n){const r=parseVersion(e),t=String(null==n?"":n).trim();if("major"===t)return`${r.major+1}.0.0`;if("minor"===t)return`${r.major}.${r.minor+1}.0`;if("patch"===t)return`${r.major}.${r.minor}.${r.patch+1}`;const o=parseVersion(t).text;if(releaseCounter(o)<=releaseCounter(r))throw new Error(`${o} is not newer than ${r.text} — a released version is never rewritten`);return o}function versionRequest(e){const n=(Array.isArray(e)?e:[]).map(String);if(0===n.length)return null;const r=new Set(["--version","-v","--verbose"]);return n.some(e=>!r.has(e))?null:n.includes("--version")||n.includes("-v")?{verbose:n.includes("--verbose")}:null}function renderVersion(e){const n=e||{},r=[parseVersion((n.product||{}).version).text];for(const e of n.faces||[])r.push(e&&e.version?`${e.package} ${e.version}`:`${e&&e.package} unknown (no manifest beside this package)`);return r.join("\n")+"\n"}const README_VERSION_RE=/^(Product version: \*\*)(\d+\.\d+\.\d+)(\*\*.*)$/m;function setManifestVersion(e,n){const r=JSON.parse(e);if("string"!=typeof r.version||!isVersion(r.version))throw new Error("that package.json has no usable `version` field");return r.version=parseVersion(n).text,JSON.stringify(r,null,2)+"\n"}function setReadmeVersion(e,n){if(!README_VERSION_RE.test(e))throw new Error('the product README has no "Product version: **X.Y.Z**" line for the bump to maintain');return e.replace(README_VERSION_RE,(e,r,t,o)=>r+parseVersion(n).text+o)}function planBump(e){const n=e||{},r=parseVersion(n.version).text;return(n.documents||[]).map(e=>{const n=parseVersion(e.version||r).text,t=e.content;let o;if("json"===e.kind){const r=JSON.parse(t).version;return r===n?{file:e.file,kind:e.kind,from:r,to:n,before:t,content:t,unchanged:!0}:(o=setManifestVersion(t,n),{file:e.file,kind:e.kind,from:r,to:n,before:t,content:o,unchanged:!1})}if("readme"===e.kind){const r=README_VERSION_RE.exec(t);if(!r)throw new Error(`${e.file} has no version line for the bump to maintain`);const o=r[2];return o===n?{file:e.file,kind:e.kind,from:o,to:n,before:t,content:t,unchanged:!0}:{file:e.file,kind:e.kind,from:o,to:n,before:t,content:setReadmeVersion(t,n),unchanged:!1}}throw new Error(`${e.file}: unknown document kind ${JSON.stringify(e.kind)}`)})}function unifiedDiff(e,n,r){if(e===n)return"";const t=e.split("\n"),o=n.split("\n");let i=0;for(;i<t.length&&i<o.length&&t[i]===o[i];)i++;let s=0;for(;s<t.length-i&&s<o.length-i&&t[t.length-1-s]===o[o.length-1-s];)s++;const a=t.slice(i,t.length-s),c=o.slice(i,o.length-s),f=Math.max(0,i-3),u=Math.min(t.length,t.length-s+3),l=Math.min(o.length,o.length-s+3),d=t.slice(f,u),p=(o.slice(f,l),[`--- a/${r}`,`+++ b/${r}`,`@@ -${f+1},${u-f} +${f+1},${l-f} @@`]);for(const e of d.slice(0,i-f))p.push(" "+e);for(const e of a)p.push("-"+e);for(const e of c)p.push("+"+e);const h=d.slice(i-f+a.length);for(const e of h)p.push(" "+e);return p.join("\n")+"\n"}module.exports={FACE_LINES:FACE_LINES,ANCHOR_PRODUCT:"1.0.8",MINOR_STRIDE:100,MAJOR_STRIDE:1e4,parseVersion:parseVersion,isVersion:isVersion,releaseCounter:releaseCounter,deriveFaceVersion:deriveFaceVersion,deriveFaceVersions:deriveFaceVersions,tagFor:tagFor,parseTag:parseTag,nextVersion:nextVersion,versionRequest:versionRequest,renderVersion:renderVersion,planBump:planBump,setManifestVersion:setManifestVersion,setReadmeVersion:setReadmeVersion,unifiedDiff:unifiedDiff,README_VERSION_RE:README_VERSION_RE};
package/src/selfhost.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
- "use strict";const path=require("node:path"),FACE=Object.freeze({TUI:"tui",GUI:"gui"}),RUN_AS_NODE="ELECTRON_RUN_AS_NODE",FORCE_TUI=["--tui","code"],COMPAT_BIN="aegiscode";function faceRoot(e,n){return path.join(e,"faces",n)}function cliEntry(e){return path.join(faceRoot(e,"cli"),"bin","aegiscode.js")}function binName(e){return path.basename(String(e||"aegis")).replace(/\.(exe|cmd|bat|AppImage)$/i,"").replace(/\.js$/,"")}function plan(e){const n=e||{};if(!n.packaged)return null;const t=n.execPath,a=n.resourcesPath,i=Array.isArray(n.argv)?n.argv.map(String):[];if(!t||!a)return null;const r=(e,n)=>({face:FACE.TUI,exec:t,args:[cliEntry(a),...e],env:{[RUN_AS_NODE]:"1"},reason:n});if(binName(n.invokedAs)===COMPAT_BIN)return r(i,"aegiscode is the compatibility bin");const c=i.find((e=>FORCE_TUI.includes(e)));return c?r(i.filter((e=>e!==c)),`${c} asks for the terminal face`):null}function spawnOptions(e,n){return e?{exec:e.exec,args:e.args,env:Object.assign({},n||{},e.env)}:null}module.exports={plan:plan,spawnOptions:spawnOptions,FACE:FACE,RUN_AS_NODE:RUN_AS_NODE,COMPAT_BIN:COMPAT_BIN,FORCE_TUI:FORCE_TUI,cliEntry:cliEntry,faceRoot:faceRoot,binName:binName};
3
+ "use strict";const path=require("node:path"),FACE=Object.freeze({TUI:"tui",GUI:"gui"}),RUN_AS_NODE="ELECTRON_RUN_AS_NODE",FORCE_TUI=["--tui","code"],COMPAT_BIN="aegiscode";function faceRoot(e,n){return path.join(e,"faces",n)}function cliEntry(e){return path.join(faceRoot(e,"cli"),"bin","aegiscode.js")}function binName(e){return path.basename(String(e||"aegis")).replace(/\.(exe|cmd|bat|AppImage)$/i,"").replace(/\.js$/,"")}function plan(e){const n=e||{};if(!n.packaged)return null;const t=n.execPath,a=n.resourcesPath,i=Array.isArray(n.argv)?n.argv.map(String):[];if(!t||!a)return null;const r=(e,n)=>({face:FACE.TUI,exec:t,args:[cliEntry(a),...e],env:{[RUN_AS_NODE]:"1"},reason:n});if(binName(n.invokedAs)===COMPAT_BIN)return r(i,"aegiscode is the compatibility bin");const c=i.find(e=>FORCE_TUI.includes(e));return c?r(i.filter(e=>e!==c),`${c} asks for the terminal face`):null}function spawnOptions(e,n){return e?{exec:e.exec,args:e.args,env:Object.assign({},n||{},e.env)}:null}module.exports={plan:plan,spawnOptions:spawnOptions,FACE:FACE,RUN_AS_NODE:RUN_AS_NODE,COMPAT_BIN:COMPAT_BIN,FORCE_TUI:FORCE_TUI,cliEntry:cliEntry,faceRoot:faceRoot,binName:binName};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "7.0.56",
4
+ "version": "7.0.57",
5
5
  "description": "aegiscode — the command-line version of AEGIS One. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import{readdirSync as s}from"node:fs";import{spawnSync as e}from"node:child_process";import{dirname as t,join as o,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";const c=t(i(import.meta.url)),n=r(c,".."),a=o(n,"src"),p=[o(n,"bin","aegiscode.js"),...s(a).filter((s=>s.endsWith(".js"))).sort().map((s=>o(a,s))),o(c,"predist.mjs")];0===p.length&&(process.stderr.write("check: no files to check\n"),process.exit(1));const d=[];for(const s of p){const t=e(process.execPath,["--check",s],{stdio:"inherit"});0!==t.status&&d.push({file:s,status:t.status})}if(d.length){process.stderr.write(`\ncheck failed (${d.length}):\n`);for(const{file:s,status:e}of d)process.stderr.write(` ✗ ${s} (exit ${e})\n`);process.exit(1)}process.stdout.write(`check ok: ${p.length} files\n`);
4
+ import{readdirSync as s}from"node:fs";import{spawnSync as e}from"node:child_process";import{dirname as t,join as o,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";const c=t(i(import.meta.url)),n=r(c,".."),a=o(n,"src"),p=[o(n,"bin","aegiscode.js"),...s(a).filter(s=>s.endsWith(".js")).sort().map(s=>o(a,s)),o(c,"predist.mjs")];0===p.length&&(process.stderr.write("check: no files to check\n"),process.exit(1));const d=[];for(const s of p){const t=e(process.execPath,["--check",s],{stdio:"inherit"});0!==t.status&&d.push({file:s,status:t.status})}if(d.length){process.stderr.write(`\ncheck failed (${d.length}):\n`);for(const{file:s,status:e}of d)process.stderr.write(` ✗ ${s} (exit ${e})\n`);process.exit(1)}process.stdout.write(`check ok: ${p.length} files\n`);
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import{createRequire as e}from"node:module";import n from"node:path";import{fileURLToPath as r}from"node:url";const t=e(import.meta.url),s=n.dirname(r(import.meta.url)),o=n.join(s,"..","src"),i=t(n.join(o,"render.js")),{stripAnsi:a}=t(n.join(o,"screen.js")),d=t(n.join(o,"art.js")),{version:u}=t(n.join(s,"..","package.json")),l=process.argv.slice(2),m=Number(((e,n)=>{const r=l.indexOf("--width");return-1===r?0:l[r+1]})())||Math.min(96,Math.max(48,process.stdout.columns||84)),c={light:l.includes("--light")},g=l.includes("--plain"),p=[],h=e=>p.push(...Array.isArray(e)?e:[e]);h(i.renderBanner(c,{width:m,version:u,model:"nexus-brain",base:"https://aegiscloud.org",key:"aegis_••••4f2a",stream:!0})),h(""),h(i.renderTurn(c,{role:"user",text:"summarise what changed in the token accounting"},m)),h(i.renderTurn(c,{role:"assistant",text:["Three things changed, and one of them was costing you money:","","- the pool **merges** worker usage instead of overwriting it","- cache reads and writes are billed, not ignored","- a zero-token call no longer refunds its reservation","","```","merge_usage({input_tokens: 1250}, {output_tokens: 312})","=> 1562 total","```","","Use `/balance` to see tokens beside € on every row."].join("\n"),meta:{model:"nexus-brain",tokens:1562,usage:{input:1250,output:312},eur:7e-4,ms:4200,calls:4}},m)),h(""),h(i.renderWorking(c,{tick:3,verb:"Consulting",elapsedMs:2100})),h(i.renderStatus(c,{model:"nexus-brain",tokens:1562,spend:7e-4,mode:"stream"},m)),process.stdout.write((g?p.map(a):p).join("\n")+"\n\n"),g||process.stdout.write(a(`${d.WELCOME_TITLE} — ${p.length} lines rendered at ${m} cols${c.light?" (light)":""}\n`));
4
+ import{createRequire as e}from"node:module";import n from"node:path";import{fileURLToPath as r}from"node:url";const t=e(import.meta.url),s=n.dirname(r(import.meta.url)),o=n.join(s,"..","src"),i=t(n.join(o,"render.js")),{stripAnsi:a}=t(n.join(o,"screen.js")),d=t(n.join(o,"art.js")),{version:u}=t(n.join(s,"..","package.json")),l=process.argv.slice(2),m=Number((()=>{const e=l.indexOf("--width");return-1===e?0:l[e+1]})())||Math.min(96,Math.max(48,process.stdout.columns||84)),c={light:l.includes("--light")},g=l.includes("--plain"),p=[],h=e=>p.push(...Array.isArray(e)?e:[e]);h(i.renderBanner(c,{width:m,version:u,model:"nexus-brain",base:"https://aegiscloud.org",key:"aegis_••••4f2a",stream:!0})),h(""),h(i.renderTurn(c,{role:"user",text:"summarise what changed in the token accounting"},m)),h(i.renderTurn(c,{role:"assistant",text:["Three things changed, and one of them was costing you money:","","- the pool **merges** worker usage instead of overwriting it","- cache reads and writes are billed, not ignored","- a zero-token call no longer refunds its reservation","","```","merge_usage({input_tokens: 1250}, {output_tokens: 312})","=> 1562 total","```","","Use `/balance` to see tokens beside € on every row."].join("\n"),meta:{model:"nexus-brain",tokens:1562,usage:{input:1250,output:312},eur:7e-4,ms:4200,calls:4}},m)),h(""),h(i.renderWorking(c,{tick:3,verb:"Consulting",elapsedMs:2100})),h(i.renderStatus(c,{model:"nexus-brain",tokens:1562,spend:7e-4,mode:"stream"},m)),process.stdout.write((g?p.map(a):p).join("\n")+"\n\n"),g||process.stdout.write(a(`${d.WELCOME_TITLE} — ${p.length} lines rendered at ${m} cols${c.light?" (light)":""}\n`));
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import{existsSync as t}from"node:fs";import{createRequire as n}from"node:module";import{dirname as r,join as o}from"node:path";import{fileURLToPath as e}from"node:url";const i=r(e(import.meta.url));(async function(){const r=function(){const n=[o(i,"..","vendor","client","install-register.js"),o(i,"..","..","client","install-register.js"),o(i,"..","vendor","client","install-register.js")];for(const r of n)if(t(r))return r;return null}();if(!r)return;const e=n(import.meta.url)(r);await e.runPostinstall({app:"npm-postinstall"})})().catch((()=>{}));
4
+ import{existsSync as t}from"node:fs";import{createRequire as n}from"node:module";import{dirname as r,join as o}from"node:path";import{fileURLToPath as e}from"node:url";const i=r(e(import.meta.url));(async function(){const r=function(){const n=[o(i,"..","vendor","client","install-register.js"),o(i,"..","..","client","install-register.js"),o(i,"..","vendor","client","install-register.js")];for(const r of n)if(t(r))return r;return null}();if(!r)return;const e=n(import.meta.url)(r);await e.runPostinstall({app:"npm-postinstall"})})().catch(()=>{});
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import e from"node:path";import{fileURLToPath as t,pathToFileURL as r}from"node:url";import{sealGate as s}from"./seal-gate.mjs";const a=e.dirname(t(import.meta.url)),i=e.join(a,"..","..","one","scripts","predist.mjs");async function o(e){const t=(Array.isArray(e)?e:process.argv.slice(2)).includes("--quiet")?["--quiet"]:[],a=s();if(!a.ok&&!process.env.AEGIS_ALLOW_UNSEALED)return process.stderr.write(`${a.line}\ncut: refusing to stage a package from it. Reseal the tree deliberately, or set AEGIS_ALLOW_UNSEALED=1 to stage a build that is known not to be the published one.\n`),1;let o;process.stderr.write(a.ok?`${a.line}\n`:`${a.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will not match the published manifest.\n`);try{o=await import(r(i).href)}catch(e){return process.stderr.write(`predist: the shared stager is not reachable at ${i}.\npredist: it lives in the repo (one/scripts/predist.mjs) and is not shipped inside the aegiscode tarball — a built package already carries its vendor tree.\n${e&&e.message||e}\n`),1}return o.main(["--mirror-only",...t])}process.argv[1]&&e.resolve(process.argv[1])===t(import.meta.url)&&(process.exitCode=await o(process.argv.slice(2)));export{o as main,s as sealGate};
4
+ import e from"node:path";import{fileURLToPath as t,pathToFileURL as r}from"node:url";import{sealGate as s}from"./seal-gate.mjs";const a=e.dirname(t(import.meta.url)),i=e.join(a,"..","..","one","scripts","predist.mjs");async function o(e){const t=(Array.isArray(e)?e:process.argv.slice(2)).includes("--quiet")?["--quiet"]:[],a=s();if(!a.ok&&!process.env.AEGIS_ALLOW_UNSEALED)return process.stderr.write(`${a.line}\ncut: refusing to stage a package from it. Reseal the tree deliberately, or set AEGIS_ALLOW_UNSEALED=1 to stage a build that is known not to be the published one.\n`),1;let o;process.stderr.write(a.ok?`${a.line}\n`:`${a.line}\ncut: AEGIS_ALLOW_UNSEALED is set — staging anyway; this artifact will not match the published manifest.\n`);try{o=await(import(r(i).href))}catch(e){return process.stderr.write(`predist: the shared stager is not reachable at ${i}.\npredist: it lives in the repo (one/scripts/predist.mjs) and is not shipped inside the aegiscode tarball — a built package already carries its vendor tree.\n${e&&e.message||e}\n`),1}return o.main(["--mirror-only",...t])}process.argv[1]&&e.resolve(process.argv[1])===t(import.meta.url)&&(process.exitCode=await o(process.argv.slice(2)));export{o as main,s as sealGate};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // SPDX-License-Identifier: AGPL-3.0-or-later
3
3
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
4
- import{readdirSync as s}from"node:fs";import{spawnSync as t}from"node:child_process";import{dirname as e,join as o,resolve as r}from"node:path";import{fileURLToPath as n}from"node:url";const i=r(e(n(import.meta.url)),"..","..","test"),a=s(i).filter((s=>/^cli-.*\.test\.mjs$/.test(s))).sort();0===a.length&&(process.stderr.write(`no cli-*.test.mjs found in ${i}\n`),process.exit(1));const c=[],p=[],l=["AEGIS_REDUCED_MODE","AEGIS_SKIP_PERMISSIONS","AEGISONE_SKIP_PERMISSIONS","AEGIS_NO_PROVENANCE_CHECK","AEGIS_SKIP_PROVENANCE","AEGIS_NO_INTERLOCK"],E={...process.env};for(const s of l)delete E[s];for(const s of a){const e=o(i,s);process.stdout.write(`\n── ${s} ${"─".repeat(Math.max(0,60-s.length))}\n`);const r=t(process.execPath,[e],{stdio:"inherit",env:E});0===r.status?p.push(s):c.push({f:s,status:r.status,signal:r.signal})}if(process.stdout.write(`\n${"═".repeat(64)}\n`),process.stdout.write(`cli suite: ${p.length}/${a.length} files passed\n`),c.length){process.stdout.write(`\nFAILED (${c.length}):\n`);for(const{f:s,status:t,signal:e}of c)process.stdout.write(` ✗ ${s}${e?` (signal ${e})`:` (exit ${t})`}\n`);process.exit(1)}
4
+ import{readdirSync as s}from"node:fs";import{spawnSync as t}from"node:child_process";import{dirname as e,join as o,resolve as r}from"node:path";import{fileURLToPath as n}from"node:url";const i=r(e(n(import.meta.url)),"..","..","test"),a=s(i).filter(s=>/^cli-.*\.test\.mjs$/.test(s)).sort();0===a.length&&(process.stderr.write(`no cli-*.test.mjs found in ${i}\n`),process.exit(1));const c=[],p=[],l=["AEGIS_REDUCED_MODE","AEGIS_SKIP_PERMISSIONS","AEGISONE_SKIP_PERMISSIONS","AEGIS_NO_PROVENANCE_CHECK","AEGIS_SKIP_PROVENANCE","AEGIS_NO_INTERLOCK"],E={...process.env};for(const s of l)delete E[s];for(const s of a){const e=o(i,s);process.stdout.write(`\n── ${s} ${"─".repeat(Math.max(0,60-s.length))}\n`);const r=t(process.execPath,[e],{stdio:"inherit",env:E});0===r.status?p.push(s):c.push({f:s,status:r.status,signal:r.signal})}if(process.stdout.write(`\n${"═".repeat(64)}\n`),process.stdout.write(`cli suite: ${p.length}/${a.length} files passed\n`),c.length){process.stdout.write(`\nFAILED (${c.length}):\n`);for(const{f:s,status:t,signal:e}of c)process.stdout.write(` ✗ ${s}${e?` (signal ${e})`:` (exit ${t})`}\n`);process.exit(1)}