@evandu/super-pi-server 0.0.0-stage → 0.1.260

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 (370) hide show
  1. package/README.md +250 -3
  2. package/agents/code-auditor.md +64 -0
  3. package/agents/code-designer.md +64 -0
  4. package/agents/coder.md +24 -0
  5. package/agents/critic.md +24 -0
  6. package/agents/document-organizer.md +48 -0
  7. package/agents/patcher.md +27 -0
  8. package/agents/planner.md +30 -0
  9. package/agents/project-leader.md +28 -0
  10. package/agents/reviewer.md +27 -0
  11. package/agents/scout.md +27 -0
  12. package/agents/solution-designer.md +62 -0
  13. package/agents/super-pi-documents/index.ts +92 -0
  14. package/agents/super-pi-feishu/index.ts +88 -0
  15. package/agents/super-pi-knowledge/index.ts +70 -0
  16. package/agents/super-pi-managed-model/index.ts +9 -0
  17. package/agents/super-pi-memory/index.ts +75 -0
  18. package/agents/super-pi-native-tools/index.ts +1 -0
  19. package/agents/super-pi-task/core.ts +2262 -0
  20. package/agents/super-pi-task/index.ts +814 -0
  21. package/agents/super-pi-task/workflow-schema.ts +34 -0
  22. package/agents/super-pi-web/index.ts +32 -0
  23. package/agents/verifier.md +25 -0
  24. package/assets/fonts/LICENSE +92 -0
  25. package/assets/fonts/NotoSansSC-Bold.otf +0 -0
  26. package/assets/fonts/NotoSansSC-Regular.otf +0 -0
  27. package/assets/knowledge-model/README.md +37 -0
  28. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/config.json +31 -0
  29. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/onnx/model_quantized.onnx +0 -0
  30. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/special_tokens_map.json +7 -0
  31. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer.json +21278 -0
  32. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer_config.json +15 -0
  33. package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/vocab.txt +21128 -0
  34. package/bin/npm-prefix.d.ts +1 -0
  35. package/bin/npm-prefix.js +10 -0
  36. package/bin/super-pi.js +349 -0
  37. package/dist/client/.super-pi-client-sources.json +82 -0
  38. package/dist/client/assets/CodeMirrorEditor-mi9rGUce.js +2 -0
  39. package/dist/client/assets/GitDiffEditor-CpoDDQrA.css +1 -0
  40. package/dist/client/assets/GitDiffEditor-FQBfGxOY.js +29 -0
  41. package/dist/client/assets/diff-ChtP43wD.js +1 -0
  42. package/dist/client/assets/dist-AW5lyI3I.js +1 -0
  43. package/dist/client/assets/dist-B3-a6uF0.js +7 -0
  44. package/dist/client/assets/dist-BGxkyh6e.js +1 -0
  45. package/dist/client/assets/dist-BJxfd7yb.js +11 -0
  46. package/dist/client/assets/dist-BRVQKlcp.js +1 -0
  47. package/dist/client/assets/dist-BV64A9Ji.js +1 -0
  48. package/dist/client/assets/dist-BXAOrsjq.js +1 -0
  49. package/dist/client/assets/dist-CKF2Jksy.js +1 -0
  50. package/dist/client/assets/dist-CX_Hm4GS.js +1 -0
  51. package/dist/client/assets/dist-Cus6_oaF.js +2 -0
  52. package/dist/client/assets/dist-Cx00EZKR.js +23 -0
  53. package/dist/client/assets/dist-D71y2EI1.js +1 -0
  54. package/dist/client/assets/dist-D978o95T.js +5 -0
  55. package/dist/client/assets/dist-Dc1MBGAG.js +1 -0
  56. package/dist/client/assets/dist-Dds-qLxY.js +9 -0
  57. package/dist/client/assets/dist-DeD9copn.js +1 -0
  58. package/dist/client/assets/dist-DuvGReu-.js +6 -0
  59. package/dist/client/assets/dist-Dvb0SqcK.js +2 -0
  60. package/dist/client/assets/dist-J6XWqRpB.js +3 -0
  61. package/dist/client/assets/dist-QzbOCAU6.js +1 -0
  62. package/dist/client/assets/dist-moiMRpw_.js +1 -0
  63. package/dist/client/assets/dist-scBkrwv-.js +2 -0
  64. package/dist/client/assets/dockerfile-BDePf5PZ.js +1 -0
  65. package/dist/client/assets/index-Cn7hdrDw.js +350 -0
  66. package/dist/client/assets/index-UfzqdECL.css +1 -0
  67. package/dist/client/assets/powershell-D8WpQPaX.js +1 -0
  68. package/dist/client/assets/properties-C357ku5U.js +1 -0
  69. package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  70. package/dist/client/assets/ruby-ChfNwlCY.js +1 -0
  71. package/dist/client/assets/shell-DwuoZtxw.js +1 -0
  72. package/dist/client/assets/swift-DKB6_1j6.js +1 -0
  73. package/dist/client/assets/toml-BPTmHmyx.js +1 -0
  74. package/dist/client/favicon.ico +0 -0
  75. package/dist/client/favicon.png +0 -0
  76. package/dist/client/favicon.svg +10 -0
  77. package/dist/client/index.html +18 -0
  78. package/dist/extension.d.ts +15 -0
  79. package/dist/extension.js +126 -0
  80. package/dist/server/active-memory.d.ts +247 -0
  81. package/dist/server/active-memory.js +669 -0
  82. package/dist/server/agents.d.ts +245 -0
  83. package/dist/server/agents.js +701 -0
  84. package/dist/server/application/catalog-service.d.ts +98 -0
  85. package/dist/server/application/catalog-service.js +245 -0
  86. package/dist/server/application/conversation-service.d.ts +245 -0
  87. package/dist/server/application/conversation-service.js +654 -0
  88. package/dist/server/application/document-service.d.ts +68 -0
  89. package/dist/server/application/document-service.js +120 -0
  90. package/dist/server/application/extension-ui-service.d.ts +44 -0
  91. package/dist/server/application/extension-ui-service.js +135 -0
  92. package/dist/server/application/feishu-service.d.ts +179 -0
  93. package/dist/server/application/feishu-service.js +358 -0
  94. package/dist/server/application/group-chat-service.d.ts +75 -0
  95. package/dist/server/application/group-chat-service.js +953 -0
  96. package/dist/server/application/group-execution.d.ts +15 -0
  97. package/dist/server/application/group-execution.js +77 -0
  98. package/dist/server/application/project-service.d.ts +464 -0
  99. package/dist/server/application/project-service.js +2523 -0
  100. package/dist/server/application/provider-service.d.ts +174 -0
  101. package/dist/server/application/provider-service.js +510 -0
  102. package/dist/server/application/run-service.d.ts +547 -0
  103. package/dist/server/application/run-service.js +2683 -0
  104. package/dist/server/application/scheduled-task-service.d.ts +184 -0
  105. package/dist/server/application/scheduled-task-service.js +391 -0
  106. package/dist/server/application/session-orchestrator-service.d.ts +388 -0
  107. package/dist/server/application/session-orchestrator-service.js +1146 -0
  108. package/dist/server/application/session-reminder-service.d.ts +59 -0
  109. package/dist/server/application/session-reminder-service.js +141 -0
  110. package/dist/server/application/session-watchdog.d.ts +171 -0
  111. package/dist/server/application/session-watchdog.js +284 -0
  112. package/dist/server/application/workspace-service.d.ts +52 -0
  113. package/dist/server/application/workspace-service.js +186 -0
  114. package/dist/server/application/worktree-service.d.ts +13 -0
  115. package/dist/server/application/worktree-service.js +76 -0
  116. package/dist/server/browser-access.d.ts +34 -0
  117. package/dist/server/browser-access.js +89 -0
  118. package/dist/server/capability.d.ts +105 -0
  119. package/dist/server/capability.js +170 -0
  120. package/dist/server/command-handler.d.ts +93 -0
  121. package/dist/server/command-handler.js +540 -0
  122. package/dist/server/content-search.d.ts +16 -0
  123. package/dist/server/content-search.js +235 -0
  124. package/dist/server/conversation-usage.d.ts +22 -0
  125. package/dist/server/conversation-usage.js +43 -0
  126. package/dist/server/documents.d.ts +152 -0
  127. package/dist/server/documents.js +998 -0
  128. package/dist/server/engineering-learning.d.ts +30 -0
  129. package/dist/server/engineering-learning.js +106 -0
  130. package/dist/server/exec-service.d.ts +45 -0
  131. package/dist/server/exec-service.js +167 -0
  132. package/dist/server/explicit-file-open.d.ts +34 -0
  133. package/dist/server/explicit-file-open.js +105 -0
  134. package/dist/server/failure-text.d.ts +18 -0
  135. package/dist/server/failure-text.js +44 -0
  136. package/dist/server/feishu-cli.d.ts +223 -0
  137. package/dist/server/feishu-cli.js +464 -0
  138. package/dist/server/file-changes.d.ts +119 -0
  139. package/dist/server/file-changes.js +280 -0
  140. package/dist/server/file-diff.d.ts +41 -0
  141. package/dist/server/file-diff.js +97 -0
  142. package/dist/server/file-index.d.ts +100 -0
  143. package/dist/server/file-index.js +296 -0
  144. package/dist/server/file-name-index.d.ts +160 -0
  145. package/dist/server/file-name-index.js +411 -0
  146. package/dist/server/files.d.ts +269 -0
  147. package/dist/server/files.js +748 -0
  148. package/dist/server/git.d.ts +245 -0
  149. package/dist/server/git.js +903 -0
  150. package/dist/server/http-server.d.ts +45 -0
  151. package/dist/server/http-server.js +3830 -0
  152. package/dist/server/index.d.ts +1 -0
  153. package/dist/server/index.js +485 -0
  154. package/dist/server/inline-thinking.d.ts +90 -0
  155. package/dist/server/inline-thinking.js +181 -0
  156. package/dist/server/json-comments.d.ts +14 -0
  157. package/dist/server/json-comments.js +71 -0
  158. package/dist/server/knowledge-embedding-worker.d.ts +1 -0
  159. package/dist/server/knowledge-embedding-worker.js +27 -0
  160. package/dist/server/knowledge-vectors.d.ts +150 -0
  161. package/dist/server/knowledge-vectors.js +385 -0
  162. package/dist/server/knowledge.d.ts +273 -0
  163. package/dist/server/knowledge.js +848 -0
  164. package/dist/server/length-continuation.d.ts +83 -0
  165. package/dist/server/length-continuation.js +118 -0
  166. package/dist/server/logging.d.ts +32 -0
  167. package/dist/server/logging.js +185 -0
  168. package/dist/server/managed-http-tunnel.d.ts +6 -0
  169. package/dist/server/managed-http-tunnel.js +85 -0
  170. package/dist/server/managed-http.d.ts +4 -0
  171. package/dist/server/managed-http.js +85 -0
  172. package/dist/server/managed-model-adapter.d.ts +17 -0
  173. package/dist/server/managed-model-adapter.js +75 -0
  174. package/dist/server/managed-model-gateway.d.ts +49 -0
  175. package/dist/server/managed-model-gateway.js +73 -0
  176. package/dist/server/managed-servers.d.ts +55 -0
  177. package/dist/server/managed-servers.js +396 -0
  178. package/dist/server/managed-ssh.d.ts +26 -0
  179. package/dist/server/managed-ssh.js +73 -0
  180. package/dist/server/manager-vault.d.ts +11 -0
  181. package/dist/server/manager-vault.js +67 -0
  182. package/dist/server/memory-recall.d.ts +25 -0
  183. package/dist/server/memory-recall.js +45 -0
  184. package/dist/server/memory.d.ts +67 -0
  185. package/dist/server/memory.js +216 -0
  186. package/dist/server/message-media.d.ts +7 -0
  187. package/dist/server/message-media.js +54 -0
  188. package/dist/server/model-context-window.d.ts +186 -0
  189. package/dist/server/model-context-window.js +444 -0
  190. package/dist/server/model-filter.d.ts +23 -0
  191. package/dist/server/model-filter.js +48 -0
  192. package/dist/server/models-store.d.ts +36 -0
  193. package/dist/server/models-store.js +132 -0
  194. package/dist/server/native-tool-settings.d.ts +25 -0
  195. package/dist/server/native-tool-settings.js +41 -0
  196. package/dist/server/native-tools-extension.d.ts +2 -0
  197. package/dist/server/native-tools-extension.js +39 -0
  198. package/dist/server/native-tools-service.d.ts +39 -0
  199. package/dist/server/native-tools-service.js +240 -0
  200. package/dist/server/persistence/app-state-repository.d.ts +65 -0
  201. package/dist/server/persistence/app-state-repository.js +1 -0
  202. package/dist/server/persistence/json-state-repository.d.ts +14 -0
  203. package/dist/server/persistence/json-state-repository.js +43 -0
  204. package/dist/server/persistence/open-state-store.d.ts +3 -0
  205. package/dist/server/persistence/open-state-store.js +35 -0
  206. package/dist/server/persistence/rename.d.ts +22 -0
  207. package/dist/server/persistence/rename.js +44 -0
  208. package/dist/server/persistence/sqlite-state-repository.d.ts +12 -0
  209. package/dist/server/persistence/sqlite-state-repository.js +264 -0
  210. package/dist/server/pi-command.d.ts +94 -0
  211. package/dist/server/pi-command.js +265 -0
  212. package/dist/server/pi-native.d.ts +12 -0
  213. package/dist/server/pi-native.js +16 -0
  214. package/dist/server/pi-session-events.d.ts +158 -0
  215. package/dist/server/pi-session-events.js +373 -0
  216. package/dist/server/pi-session-pool.d.ts +233 -0
  217. package/dist/server/pi-session-pool.js +382 -0
  218. package/dist/server/pi-session.d.ts +642 -0
  219. package/dist/server/pi-session.js +655 -0
  220. package/dist/server/presentations/schema.d.ts +120 -0
  221. package/dist/server/presentations/schema.js +128 -0
  222. package/dist/server/provider-network.d.ts +16 -0
  223. package/dist/server/provider-network.js +106 -0
  224. package/dist/server/provider-proxy.d.ts +18 -0
  225. package/dist/server/provider-proxy.js +200 -0
  226. package/dist/server/providers.d.ts +333 -0
  227. package/dist/server/providers.js +989 -0
  228. package/dist/server/remote-bootstrap.d.ts +17 -0
  229. package/dist/server/remote-bootstrap.js +119 -0
  230. package/dist/server/rpc-channel.d.ts +131 -0
  231. package/dist/server/rpc-channel.js +135 -0
  232. package/dist/server/runtime.d.ts +1393 -0
  233. package/dist/server/runtime.js +3286 -0
  234. package/dist/server/scheduled-tasks.d.ts +101 -0
  235. package/dist/server/scheduled-tasks.js +138 -0
  236. package/dist/server/server-context.d.ts +119 -0
  237. package/dist/server/server-context.js +1 -0
  238. package/dist/server/session-cwd.d.ts +19 -0
  239. package/dist/server/session-cwd.js +58 -0
  240. package/dist/server/session-ledger.d.ts +67 -0
  241. package/dist/server/session-ledger.js +76 -0
  242. package/dist/server/session-memory-scope.d.ts +4 -0
  243. package/dist/server/session-memory-scope.js +30 -0
  244. package/dist/server/session-repository.d.ts +100 -0
  245. package/dist/server/session-repository.js +246 -0
  246. package/dist/server/session-tree-scope.d.ts +125 -0
  247. package/dist/server/session-tree-scope.js +337 -0
  248. package/dist/server/skills.d.ts +23 -0
  249. package/dist/server/skills.js +190 -0
  250. package/dist/server/store.d.ts +1062 -0
  251. package/dist/server/store.js +3305 -0
  252. package/dist/server/subagent-runs.d.ts +185 -0
  253. package/dist/server/subagent-runs.js +383 -0
  254. package/dist/server/subagents.d.ts +200 -0
  255. package/dist/server/subagents.js +619 -0
  256. package/dist/server/task-tool.d.ts +282 -0
  257. package/dist/server/task-tool.js +507 -0
  258. package/dist/server/tavily.d.ts +32 -0
  259. package/dist/server/tavily.js +136 -0
  260. package/dist/server/team-context.d.ts +12 -0
  261. package/dist/server/team-context.js +180 -0
  262. package/dist/server/terminal.d.ts +163 -0
  263. package/dist/server/terminal.js +557 -0
  264. package/dist/server/thinking-level-discovery.d.ts +38 -0
  265. package/dist/server/thinking-level-discovery.js +183 -0
  266. package/dist/server/time-zone.d.ts +20 -0
  267. package/dist/server/time-zone.js +32 -0
  268. package/dist/server/tool-calls.d.ts +130 -0
  269. package/dist/server/tool-calls.js +341 -0
  270. package/dist/server/tool-llm.d.ts +72 -0
  271. package/dist/server/tool-llm.js +146 -0
  272. package/dist/server/tool-registry.d.ts +129 -0
  273. package/dist/server/tool-registry.js +249 -0
  274. package/dist/server/tool-runner.d.ts +112 -0
  275. package/dist/server/tool-runner.js +306 -0
  276. package/dist/server/turn-failure.d.ts +48 -0
  277. package/dist/server/turn-failure.js +148 -0
  278. package/dist/server/types.d.ts +2315 -0
  279. package/dist/server/types.js +11 -0
  280. package/dist/server/update-status.d.ts +14 -0
  281. package/dist/server/update-status.js +69 -0
  282. package/dist/server/update.d.ts +46 -0
  283. package/dist/server/update.js +104 -0
  284. package/dist/server/upload.d.ts +35 -0
  285. package/dist/server/upload.js +177 -0
  286. package/dist/server/version.d.ts +33 -0
  287. package/dist/server/version.js +111 -0
  288. package/dist/server/web.d.ts +27 -0
  289. package/dist/server/web.js +183 -0
  290. package/dist/server/workflow-engine.d.ts +47 -0
  291. package/dist/server/workflow-engine.js +255 -0
  292. package/dist/server/workflow.d.ts +329 -0
  293. package/dist/server/workflow.js +469 -0
  294. package/dist/server/workspace-file-indexes.d.ts +2 -0
  295. package/dist/server/workspace-file-indexes.js +61 -0
  296. package/dist/server/workspace-file-operations.d.ts +36 -0
  297. package/dist/server/workspace-file-operations.js +281 -0
  298. package/dist/server/workspace-file-response.d.ts +7 -0
  299. package/dist/server/workspace-file-response.js +79 -0
  300. package/dist/server/ws-server.d.ts +149 -0
  301. package/dist/server/ws-server.js +640 -0
  302. package/dist/shared/agent-order.d.ts +44 -0
  303. package/dist/shared/agent-order.js +50 -0
  304. package/dist/shared/archive-decisions.d.ts +44 -0
  305. package/dist/shared/archive-decisions.js +98 -0
  306. package/dist/shared/background-task.d.ts +25 -0
  307. package/dist/shared/background-task.js +183 -0
  308. package/dist/shared/child-session-lock.d.ts +37 -0
  309. package/dist/shared/child-session-lock.js +59 -0
  310. package/dist/shared/content-search.d.ts +22 -0
  311. package/dist/shared/content-search.js +1 -0
  312. package/dist/shared/conversation-title.d.ts +4 -0
  313. package/dist/shared/conversation-title.js +4 -0
  314. package/dist/shared/file-mentions.d.ts +17 -0
  315. package/dist/shared/file-mentions.js +91 -0
  316. package/dist/shared/git-commit.d.ts +11 -0
  317. package/dist/shared/git-commit.js +1 -0
  318. package/dist/shared/git-graph.d.ts +42 -0
  319. package/dist/shared/git-graph.js +30 -0
  320. package/dist/shared/group-chat.d.ts +132 -0
  321. package/dist/shared/group-chat.js +6 -0
  322. package/dist/shared/managed-servers.d.ts +36 -0
  323. package/dist/shared/managed-servers.js +1 -0
  324. package/dist/shared/message-media.d.ts +12 -0
  325. package/dist/shared/message-media.js +27 -0
  326. package/dist/shared/model-window-label.d.ts +39 -0
  327. package/dist/shared/model-window-label.js +55 -0
  328. package/dist/shared/native-tools.d.ts +43 -0
  329. package/dist/shared/native-tools.js +1 -0
  330. package/dist/shared/pi-cache-warming.d.ts +9 -0
  331. package/dist/shared/pi-cache-warming.js +4 -0
  332. package/dist/shared/project-overview.d.ts +107 -0
  333. package/dist/shared/project-overview.js +92 -0
  334. package/dist/shared/project-presentation.d.ts +55 -0
  335. package/dist/shared/project-presentation.js +111 -0
  336. package/dist/shared/provider-network.d.ts +30 -0
  337. package/dist/shared/provider-network.js +1 -0
  338. package/dist/shared/session-reporting.d.ts +40 -0
  339. package/dist/shared/session-reporting.js +97 -0
  340. package/dist/shared/session-search.d.ts +14 -0
  341. package/dist/shared/session-search.js +1 -0
  342. package/dist/shared/team-context-view.d.ts +33 -0
  343. package/dist/shared/team-context-view.js +49 -0
  344. package/dist/shared/team-context.d.ts +59 -0
  345. package/dist/shared/team-context.js +3 -0
  346. package/dist/shared/terminal-protocol.d.ts +71 -0
  347. package/dist/shared/terminal-protocol.js +1 -0
  348. package/dist/shared/thinking-levels.d.ts +53 -0
  349. package/dist/shared/thinking-levels.js +85 -0
  350. package/dist/shared/tool-glyph.d.ts +7 -0
  351. package/dist/shared/tool-glyph.js +19 -0
  352. package/dist/shared/transcript-order.d.ts +7 -0
  353. package/dist/shared/transcript-order.js +12 -0
  354. package/dist/shared/update-status.d.ts +28 -0
  355. package/dist/shared/update-status.js +1 -0
  356. package/dist/shared/workspace-file-preview.d.ts +4 -0
  357. package/dist/shared/workspace-file-preview.js +28 -0
  358. package/package.json +450 -4
  359. package/scripts/diagnose.mjs +603 -0
  360. package/scripts/patch-brace-expansion.mjs +260 -0
  361. package/scripts/restart-server.mjs +104 -0
  362. package/skills/presentation/SKILL.md +30 -0
  363. package/skills/presentation/references/data.md +10 -0
  364. package/skills/presentation/references/quality.md +12 -0
  365. package/skills/presentation/references/story.md +12 -0
  366. package/skills/presentation/references/templates-and-editing.md +11 -0
  367. package/skills/presentation/references/visual-system.md +10 -0
  368. package/skills/super-pi-agent-development/SKILL.md +25 -0
  369. package/skills/super-pi-development/SKILL.md +31 -0
  370. package/skills/super-pi-tool-development/SKILL.md +39 -0
@@ -0,0 +1,260 @@
1
+ // Repairs one vulnerable transitive dependency that Super Pi cannot fix from the outside.
2
+ //
3
+ // THE PROBLEM. Pi's package ships an `npm-shrinkwrap.json`, and a shrinkwrap pins a dependency's
4
+ // whole subtree. Pi's shrinkwrap pins `brace-expansion@5.0.9`, and npm honours a shrinkwrap over
5
+ // everything else - so neither `overrides` (in either the flat or the nested form) nor `npm audit fix`
6
+ // can move it. `npm audit` therefore reports "1 high severity vulnerability" to every person who
7
+ // installs Super Pi, and the finding is real: brace-expansion 5.0.9 is quadratic-time on `{a,b}` and
8
+ // recurses without bound on nested brace groups, so a pattern that reaches it can burn the CPU or the
9
+ // stack.
10
+ //
11
+ // THE REACHABILITY, so this is not a reflex. brace-expansion is reached through `minimatch`, and in
12
+ // Pi's tree `minimatch` is used by the package manager - to match the paths of installed extensions
13
+ // and skills. Those names come from files on disk, so a hostile workspace is enough to feed a pattern
14
+ // in. It is a denial of service, not a privilege escalation, but it is reachable by opening a
15
+ // repository, and a workspace is exactly what Super Pi is pointed at.
16
+ //
17
+ // WHY IT RUNS AT STARTUP AND NOT AT INSTALL. It was a postinstall script, and that was a mistake
18
+ // with teeth: a postinstall that fails fails the INSTALL, and on 2026-10-21 it did exactly that on
19
+ // somebody else's machine - the script was not in the extracted tree, node reported
20
+ // MODULE_NOT_FOUND, and npm refused to finish installing Super Pi at all. An install must not be
21
+ // breakable by a security patch. So the patch runs when the server starts instead: by then the tree
22
+ // is known to be there, the server has already booted, and a failure is a warning rather than a
23
+ // failed install.
24
+ //
25
+ // WHY IT DOES NOT RUN A NESTED `npm install`. The first version staged the patched package with
26
+ // `npm install` in a throwaway directory, which is a full dependency resolution - thirty seconds and
27
+ // a network round trip, inside an install. `npm pack` fetches one tarball and nothing else, and the
28
+ // tarball is read with node's own zlib, so the whole thing needs no network beyond one registry
29
+ // fetch and no tooling beyond node.
30
+ //
31
+ // WHAT IT WILL NOT DO. It never fails anything. A patched copy that cannot be fetched leaves the tree
32
+ // as it was, and the script says so in one line.
33
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, renameSync, cpSync } from "node:fs";
34
+ import { dirname, join, relative, resolve } from "node:path";
35
+ import { fileURLToPath } from "node:url";
36
+ import { gunzipSync } from "node:zlib";
37
+ import { execFileSync } from "node:child_process";
38
+ import { tmpdir } from "node:os";
39
+
40
+ /** The patched release. 5.0.9 is what Pi's shrinkwrap pins; 5.0.12 carries the fix. */
41
+ const PATCHED_VERSION = "5.0.12";
42
+ /** The first fixed version. Below this, the advisory applies. */
43
+ const VULNERABLE_BELOW = "5.0.12";
44
+
45
+ const here = dirname(fileURLToPath(import.meta.url));
46
+ const repositoryRoot = resolve(here, "..");
47
+
48
+ /** Numeric version comparison that does not care about a leading `v` or a prerelease tag. */
49
+ function compareVersions(a, b) {
50
+ const parts = (value) => String(value).replace(/^v/, "").split("-")[0].split(".").map((n) => Number.parseInt(n, 10) || 0);
51
+ const left = parts(a);
52
+ const right = parts(b);
53
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
54
+ const difference = (left[index] ?? 0) - (right[index] ?? 0);
55
+ if (difference !== 0) return difference < 0 ? -1 : 1;
56
+ }
57
+ return 0;
58
+ }
59
+
60
+ /**
61
+ * Reads a gzipped tar into a map of path -> contents.
62
+ *
63
+ * The tar format is simple enough to read here: 512-byte blocks, a name in the first hundred bytes, a
64
+ * size in the next twelve (octal), and the payload after the header. Long names arrive as their own
65
+ * entry with the type flag `L`, and the real name follows in the payload.
66
+ */
67
+ function readTarGz(buffer) {
68
+ const files = new Map();
69
+ const tar = gunzipSync(buffer);
70
+ let offset = 0;
71
+ let longName = "";
72
+ while (offset + 512 <= tar.length) {
73
+ const header = tar.subarray(offset, offset + 512);
74
+ offset += 512;
75
+ // Two consecutive zero blocks end the archive.
76
+ if (header.every((byte) => byte === 0)) break;
77
+ const name = header.subarray(0, 100).toString("utf8").replace(/\0.*$/, "");
78
+ const sizeText = header.subarray(124, 136).toString("utf8").replace(/\0.*$/, "").trim();
79
+ const size = sizeText ? Number.parseInt(sizeText, 8) : 0;
80
+ const type = String.fromCharCode(header[156]);
81
+ const prefix = header.subarray(345, 500).toString("utf8").replace(/\0.*$/, "");
82
+ const payload = tar.subarray(offset, offset + size);
83
+ offset += Math.ceil(size / 512) * 512;
84
+ if (type === "L") { longName = payload.toString("utf8").replace(/\0.*$/, ""); continue; }
85
+ if (type !== "0" && type !== "\0" && type !== "") continue;
86
+ const full = longName || (prefix ? `${prefix}/${name}` : name);
87
+ longName = "";
88
+ files.set(full, payload);
89
+ }
90
+ return files;
91
+ }
92
+
93
+ /**
94
+ * Fetches the patched package and writes it over the vulnerable copy.
95
+ *
96
+ * One registry fetch, and the tarball is read here rather than by an external `tar` - which is not the
97
+ * same tar on every platform, and whose flags differ.
98
+ */
99
+ async function patch(directory) {
100
+ const scratch = join(tmpdir(), `super-pi-brace-${process.pid}-${Date.now()}`);
101
+ try {
102
+ mkdirSync(scratch, { recursive: true });
103
+ const tarball = join(scratch, "brace.tgz");
104
+ // `npm pack` prints the filename it wrote; the URL is asked for directly so that nothing has to be
105
+ // parsed out of npm's own output format.
106
+ const url = execFileSync("npm", ["view", `brace-expansion@${PATCHED_VERSION}`, "dist.tarball", "--silent"], {
107
+ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8", shell: process.platform === "win32",
108
+ }).trim();
109
+ if (!url.startsWith("http")) throw new Error(`npm did not report a tarball URL (${url})`);
110
+ const response = await fetch(url);
111
+ if (!response.ok) throw new Error(`fetching the tarball failed with HTTP ${response.status}`);
112
+ writeFileSync(tarball, Buffer.from(await response.arrayBuffer()));
113
+ const entries = readTarGz(readFileSync(tarball));
114
+ const wanted = new Map();
115
+ for (const [path, contents] of entries) {
116
+ const relative = path.replace(/^package\//, "");
117
+ if (!relative || relative.endsWith("/")) continue;
118
+ wanted.set(relative, contents);
119
+ }
120
+ if (!wanted.has("package.json")) throw new Error("the tarball had no package.json");
121
+ // The old copy is moved aside rather than deleted first, so a failure mid-swap cannot leave the
122
+ // tree with half a package in it.
123
+ const previous = `${directory}.super-pi-backup`;
124
+ rmSync(previous, { recursive: true, force: true });
125
+ renameSync(directory, previous);
126
+ try {
127
+ for (const [relative, contents] of wanted) {
128
+ const target = join(directory, relative);
129
+ mkdirSync(dirname(target), { recursive: true });
130
+ writeFileSync(target, contents);
131
+ }
132
+ } catch (error) {
133
+ rmSync(directory, { recursive: true, force: true });
134
+ renameSync(previous, directory);
135
+ throw error;
136
+ }
137
+ rmSync(previous, { recursive: true, force: true });
138
+ return true;
139
+ } finally {
140
+ rmSync(scratch, { recursive: true, force: true });
141
+ }
142
+ }
143
+
144
+ /**
145
+ * The integrity hash npm recorded for the patched version, so a lockfile still describes a tree npm
146
+ * can verify. It comes from the registry metadata npm itself trusts.
147
+ */
148
+ function readIntegrity() {
149
+ try {
150
+ const output = execFileSync("npm", ["view", `brace-expansion@${PATCHED_VERSION}`, "dist.integrity", "--silent"], {
151
+ stdio: ["ignore", "pipe", "pipe"], shell: process.platform === "win32", encoding: "utf8",
152
+ });
153
+ return output.trim() || undefined;
154
+ } catch {
155
+ return undefined;
156
+ }
157
+ }
158
+
159
+ /**
160
+ * The lockfiles that describe the tree Super Pi is installed in.
161
+ *
162
+ * NOT Super Pi's own `package-lock.json`. A dependency is not recorded in its dependent's lockfile, so
163
+ * the entry for `brace-expansion` lives in the lockfile of whatever npm tree Super Pi is IN - which is
164
+ * a different file depending on how Super Pi was installed:
165
+ *
166
+ * - as a Pi extension: `~/.pi/agent/npm/package-lock.json` (Pi's own npm root)
167
+ * - as a global npm install: `<prefix>/node_modules/.package-lock.json` (npm's hidden lockfile)
168
+ *
169
+ * `npm audit` reads whichever one describes the tree, so both are worth updating: a tree that is
170
+ * genuinely patched but whose lockfile still says 5.0.9 keeps reporting the vulnerability, and the
171
+ * person who installed Super Pi is left looking at a warning that no amount of reinstalling clears.
172
+ */
173
+ function findDescribingLockfiles() {
174
+ const found = [];
175
+ // Super Pi's root is `<npmRoot>/node_modules/@evandu/super-pi`, so the npm root is three levels up.
176
+ let dir = repositoryRoot;
177
+ for (let depth = 0; depth < 4; depth += 1) {
178
+ const candidate = join(dir, "package-lock.json");
179
+ if (existsSync(candidate)) found.push(candidate);
180
+ const hidden = join(dir, "node_modules", ".package-lock.json");
181
+ if (existsSync(hidden)) found.push(hidden);
182
+ const parent = resolve(dir, "..");
183
+ if (parent === dir) break;
184
+ dir = parent;
185
+ }
186
+ return [...new Set(found)];
187
+ }
188
+
189
+ /**
190
+ * Rewrites a lockfile's entry for the patched package.
191
+ *
192
+ * The KEY is the path of the vulnerable copy relative to the lockfile's own tree, which is why the
193
+ * lockfile has to be found first: the same file is `node_modules/...` in one tree and a deeper path in
194
+ * another.
195
+ */
196
+ function updateLockfile(lockPath, lockKey, version, integrity) {
197
+ let lock;
198
+ try { lock = JSON.parse(readFileSync(lockPath, "utf8")); }
199
+ catch { return false; }
200
+ const entry = lock.packages?.[lockKey];
201
+ if (!entry || entry.version === version) return false;
202
+ entry.version = version;
203
+ if (integrity) entry.integrity = integrity;
204
+ if (entry.resolved) entry.resolved = entry.resolved.replace(/-\/[^/]*\.tgz$/, `-/brace-expansion-${version}.tgz`);
205
+ writeFileSync(lockPath, `${JSON.stringify(lock, null, 2)}\n`);
206
+ return true;
207
+ }
208
+
209
+ /** Where a vulnerable copy might be, relative to Super Pi's own tree. */
210
+ function findVulnerableCopies() {
211
+ const found = [];
212
+ const candidates = [
213
+ join(repositoryRoot, "node_modules", "@earendil-works", "pi-coding-agent", "node_modules", "brace-expansion"),
214
+ join(repositoryRoot, "node_modules", "brace-expansion"),
215
+ ];
216
+ for (const directory of candidates) {
217
+ const manifest = join(directory, "package.json");
218
+ if (!existsSync(manifest)) continue;
219
+ let version = "";
220
+ try { version = JSON.parse(readFileSync(manifest, "utf8")).version ?? ""; } catch { continue; }
221
+ if (!version) continue;
222
+ if (compareVersions(version, VULNERABLE_BELOW) >= 0) continue;
223
+ found.push({ directory, version });
224
+ }
225
+ return found;
226
+ }
227
+
228
+ /**
229
+ * Applies the patch, and reports what it did. Never throws: this runs beside a server that is starting,
230
+ * and a security patch is not a reason to fail a boot.
231
+ */
232
+ export async function patchBraceExpansion() {
233
+ const copies = findVulnerableCopies();
234
+ if (copies.length === 0) return { patched: 0 };
235
+ const lockfiles = findDescribingLockfiles();
236
+ const integrity = readIntegrity();
237
+ let patched = 0;
238
+ for (const copy of copies) {
239
+ try {
240
+ if (!await patch(copy.directory)) continue;
241
+ patched += 1;
242
+ console.warn(`[super-pi] patched brace-expansion ${copy.version} -> ${PATCHED_VERSION} (${copy.directory})`);
243
+ for (const lockPath of lockfiles) {
244
+ // The key is the copy's path relative to the lockfile's own tree.
245
+ const lockKey = relative(dirname(lockPath), copy.directory).split(/[\\/]/).filter(Boolean).join("/");
246
+ if (updateLockfile(lockPath, lockKey, PATCHED_VERSION, integrity)) {
247
+ console.warn(`[super-pi] ${lockPath} now records the patched version, so \`npm audit\` stops reporting it.`);
248
+ }
249
+ }
250
+ } catch (error) {
251
+ console.warn(`[super-pi] could not patch brace-expansion in ${copy.directory}: ${error instanceof Error ? error.message : String(error)}. It is Pi's own pinned dependency tree; \`npm audit\` will keep reporting it.`);
252
+ }
253
+ }
254
+ return { patched };
255
+ }
256
+
257
+ // Run directly (`node scripts/patch-brace-expansion.mjs`) rather than imported.
258
+ if (process.argv[1] && resolve(process.argv[1]) === resolve(fileURLToPath(import.meta.url))) {
259
+ await patchBraceExpansion();
260
+ }
@@ -0,0 +1,104 @@
1
+ import { spawn, execFile } from "node:child_process";
2
+ import { openSync, readFileSync } from "node:fs";
3
+ import { homedir, platform } from "node:os";
4
+ import { join, resolve } from "node:path";
5
+ import { promisify } from "node:util";
6
+
7
+ const execFileAsync = promisify(execFile);
8
+
9
+ /** The saved port, from the same settings file the CLI reads. Returns undefined when there is
10
+ * no usable value, so the caller can fall through to the default. */
11
+ function savedPort() {
12
+ try {
13
+ const dir = process.env.SUPER_PI_DATA_DIR ? resolve(process.env.SUPER_PI_DATA_DIR) : join(homedir(), ".super-pi");
14
+ const saved = JSON.parse(readFileSync(join(dir, "config.json"), "utf8"));
15
+ const value = Number(saved?.port);
16
+ return Number.isInteger(value) && value > 0 ? value : undefined;
17
+ } catch { return undefined; }
18
+ }
19
+
20
+ // THE PORT THE SERVER IS REALLY ON. The environment wins, then the saved settings, then the
21
+ // default. Reading the environment ALONE was the bug: the CLI starts the server with `--port=N`
22
+ // as an argument and never sets this variable, so the script looked at 3080 and never found the
23
+ // running server it was supposed to replace.
24
+ const port = Number(process.env.SUPER_PI_PORT ?? savedPort() ?? 3080);
25
+ const entry = "dist/server/index.js";
26
+ const allowedEntries = [entry, "src/server/index.ts"];
27
+ /** Compare paths the way Windows reports them. A command line on Windows contains BACKSLASHES
28
+ * (`dist\server\index.js`) while the entries above use forward slashes, so a plain
29
+ * `cmd.includes(candidate)` never matched and the script refused to kill its own server. */
30
+ const normalisePath = (value) => value.replace(/[\\/]+/g, "/").toLowerCase();
31
+ const waitMs = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
32
+ async function pidsOnPort() {
33
+ if (platform() === "win32") {
34
+ const { stdout } = await execFileAsync("netstat", ["-ano", "-p", "TCP"]);
35
+ return [...new Set(stdout.split(/\r?\n/).filter((line) => line.includes(`:${port}`) && /LISTENING\s+\d+/.test(line)).map((line) => line.trim().split(/\s+/).at(-1)))];
36
+ }
37
+ try { const { stdout } = await execFileAsync("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"]); return stdout.trim().split(/\s+/).filter(Boolean); }
38
+ catch { const { stdout } = await execFileAsync("sh", ["-c", `ss -lptn 'sport = :${port}' 2>/dev/null`]); return [...new Set([...stdout.matchAll(/pid=(\d+)/g)].map((match) => match[1]))]; }
39
+ }
40
+ async function commandLine(pid) {
41
+ if (platform() === "win32") { const { stdout } = await execFileAsync("powershell", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter \"ProcessId=${pid}\").CommandLine`]); return stdout.trim(); }
42
+ try { return (await import("node:fs/promises")).readFile(`/proc/${pid}/cmdline`, "utf8").then((value) => value.replaceAll("\0", " ").trim()); } catch { const { stdout } = await execFileAsync("ps", ["-p", pid, "-o", "command="]); return stdout.trim(); }
43
+ }
44
+ async function requestShutdown() {
45
+ const headers = {};
46
+ if (process.env.SUPER_PI_ACCESS_TOKEN) headers.authorization = `Bearer ${process.env.SUPER_PI_ACCESS_TOKEN}`;
47
+ try { return (await fetch(`http://127.0.0.1:${port}/api/shutdown`, { method: "POST", headers, signal: AbortSignal.timeout(2000) })).status; }
48
+ catch { return null; }
49
+ }
50
+ async function waitForPortRelease(timeoutMs) {
51
+ for (let elapsed = 0; elapsed < timeoutMs; elapsed += 100) { if (!(await pidsOnPort()).length) return true; await waitMs(100); }
52
+ return false;
53
+ }
54
+ // On Windows a detached, console-less node.exe has no window to receive WM_CLOSE, so plain
55
+ // taskkill (SIGTERM-like) always fails; /F (or SIGKILL elsewhere) is the only force option.
56
+ async function forceKill(pid) {
57
+ console.log(`Force-killing PID ${pid} (graceful shutdown unavailable or timed out)...`);
58
+ if (platform() === "win32") await execFileAsync("taskkill", ["/PID", pid, "/T", "/F"]).catch((error) => console.log(`taskkill /F warning: ${error.message}`));
59
+ else process.kill(Number(pid), "SIGKILL");
60
+ }
61
+ async function stopConflicts() {
62
+ const pids = await pidsOnPort(); if (!pids.length) { console.log(`Port ${port} is free.`); return true; }
63
+ for (const pid of pids) { const cmd = await commandLine(pid); console.log(`Port ${port} is occupied by PID ${pid}: ${cmd}`); if (!allowedEntries.some((candidate) => normalisePath(cmd).includes(normalisePath(candidate)))) { console.error(`Refusing to kill non-super-pi process on port ${port}: ${cmd}`); process.exitCode = 2; return false; } }
64
+ const status = await requestShutdown();
65
+ if (status !== null && status >= 200 && status < 300) {
66
+ console.log(`Graceful shutdown accepted (HTTP ${status}); waiting for port ${port} to release...`);
67
+ if (await waitForPortRelease(3000)) { console.log(`Port ${port} released after graceful shutdown.`); return true; }
68
+ console.log(`Graceful shutdown did not release port ${port} within 3s.`);
69
+ } else {
70
+ console.log(`Graceful shutdown unavailable (HTTP ${status ?? "no response"}); the running server may predate the shutdown endpoint.`);
71
+ }
72
+ for (const pid of await pidsOnPort()) await forceKill(pid);
73
+ if (await waitForPortRelease(2000)) { console.log(`Port ${port} released after force kill.`); return true; }
74
+ console.error(`Port ${port} is still occupied after force kill.`); process.exitCode = 1; return false;
75
+ }
76
+ if (await stopConflicts() === false) process.exit(2);
77
+ console.log(`Starting ${entry} on port ${port}...`);
78
+ const logPath = process.env.SUPER_PI_LOG ?? "restart-server.log";
79
+ const logFd = openSync(logPath, "a");
80
+ const child = spawn(process.execPath, [entry], { stdio: ["ignore", logFd, logFd], detached: true, env: process.env });
81
+ child.unref();
82
+ // HOW LONG THE NEW SERVER MAY TAKE TO BECOME REACHABLE.
83
+ //
84
+ // MEASURED 2026-11-10: right after `npm install` replaced the package, a COLD start took
85
+ // 17.1 seconds (the same server starts in ~1.2 seconds when the files are already in the page
86
+ // cache). The old budget was 10 seconds, so the script killed the new server WHILE IT WAS STILL
87
+ // STARTING - and the result was a console that was not merely stale but DEAD: the old process had
88
+ // already been shut down and the new one was killed before it ever listened.
89
+ //
90
+ // A slow start must never become a dead console. The budget is generous, and when it runs out
91
+ // the new server is LEFT RUNNING: a start that is merely slow will still come up, and a process
92
+ // that is stuck is worth more than no process at all.
93
+ const READINESS_BUDGET_MS = 120000;
94
+ const deadline = Date.now() + READINESS_BUDGET_MS;
95
+ while (Date.now() < deadline) {
96
+ try {
97
+ const response = await fetch(`http://127.0.0.1:${port}/api/health`, { signal: AbortSignal.timeout(2_000) });
98
+ const body = await response.json();
99
+ if (response.ok && body.status === "ok" && body.service === "super-pi") { console.log("Server ready: /api/health passed."); process.exit(0); }
100
+ } catch { /* The replacement is still starting. */ }
101
+ await waitMs(200);
102
+ }
103
+ console.error(`Server did not become reachable within ${READINESS_BUDGET_MS}ms. It is STILL RUNNING - do not kill it, a slow start still ends up serving. See ${logPath}:`); try { console.error(readFileSync(logPath, "utf8").slice(-8000)); } catch {}
104
+ process.exit(1);
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: presentation
3
+ description: Create, revise, or review PowerPoint presentations when the user needs a coherent story, deliberate visual design, charts or imagery, template fidelity, and a validated PPTX deliverable.
4
+ ---
5
+
6
+ # Presentation production
7
+
8
+ Treat a deck as a communication artifact, not a document split across slides. Preserve the user's audience, purpose, evidence, brand constraints, language, and requested file path.
9
+
10
+ ## Workflow
11
+
12
+ 1. Inspect supplied source material and any existing deck or template before proposing a structure.
13
+ 2. Establish the audience, decision or learning outcome, presentation setting, and approximate duration. Infer ordinary defaults when they do not materially change the result; ask only for consequential missing choices.
14
+ 3. Write a slide-level story before building. Each slide needs one job and a conclusion-oriented title.
15
+ 4. Choose a small visual system and a layout appropriate to each slide's job. Do not make every slide a title plus bullets.
16
+ 5. Build with the presentation tools available in the session. Never claim that an image, chart, template, or visual validation was applied if the available tools cannot perform it.
17
+ 6. Render or inspect the finished deck when the tools support it. Fix overflow, collisions, illegible text, weak hierarchy, misleading charts, and visual repetition before delivery.
18
+ 7. Report the output path, what was validated, and any limitation that remains observable to the user.
19
+
20
+ ## Progressive references
21
+
22
+ - Read [references/story.md](references/story.md) when developing or restructuring the narrative.
23
+ - Read [references/visual-system.md](references/visual-system.md) when choosing layouts, typography, colour, imagery, or information hierarchy.
24
+ - Read [references/data.md](references/data.md) for tables, quantitative claims, and chart selection.
25
+ - Read [references/templates-and-editing.md](references/templates-and-editing.md) when a template or existing deck must be preserved or edited.
26
+ - Read [references/quality.md](references/quality.md) before final validation and delivery.
27
+
28
+ ## Current tool boundary
29
+
30
+ The legacy `document_write` PPT path accepts Markdown and produces a clean text-first deck. It cannot faithfully implement positioned elements, images, native charts, templates, object-level edits, or visual rendering. When those capabilities are absent, produce the strongest honest text-first deck possible and state the limitation; do not simulate visual completion in prose.
@@ -0,0 +1,10 @@
1
+ # Data, tables, and charts
2
+
3
+ Use quantitative visuals to answer a question, not to decorate a slide.
4
+
5
+ - Bar: compare categories. Line: change over ordered time. Scatter: relationship or distribution. Waterfall: contributions to a change. Pie or donut: only a few parts of one whole when precise comparison is unimportant.
6
+ - Start axes honestly, disclose truncation, preserve units, and name the time period and source.
7
+ - Highlight the series or value that supports the slide's takeaway; mute supporting context.
8
+ - Direct-label when practical. Remove chart furniture that does not help interpretation.
9
+ - Use a table when exact lookup matters; use a chart when pattern or comparison matters.
10
+ - Reconcile values against the source before building and again after rendering.
@@ -0,0 +1,12 @@
1
+ # Presentation quality gate
2
+
3
+ Validate the artifact, not just the source instructions.
4
+
5
+ 1. File integrity: opens without repair, has the requested aspect ratio and slide count, and contains no missing relationships.
6
+ 2. Content: claims match sources; titles communicate takeaways; spelling, units, dates, and names are correct.
7
+ 3. Geometry: no object is outside the canvas; no accidental overlap, clipping, or text overflow; margins and alignment are consistent.
8
+ 4. Readability: type remains legible at presentation scale, contrast is adequate, and charts have readable labels.
9
+ 5. Visual rhythm: layouts vary with the story while retaining one system; no page is needlessly dense or empty.
10
+ 6. Delivery: render every slide when possible, inspect a contact sheet and full-size pages, repair defects, then rerender the affected pages.
11
+
12
+ Report exactly which checks ran. A PPTX that merely reopens and yields its text has passed structural round-trip testing, not visual QA.
@@ -0,0 +1,12 @@
1
+ # Story and slide architecture
2
+
3
+ Start from the outcome: what should the audience understand, believe, decide, or do afterward? Arrange evidence so the answer becomes inevitable rather than merely chronological.
4
+
5
+ - Give every slide one communicative job and a title that states its takeaway.
6
+ - Prefer a visible arc: context or tension, evidence, implication, recommendation, next action.
7
+ - Separate sections when the audience must reset its mental model.
8
+ - Remove slides that neither change understanding nor support a decision.
9
+ - Put detail needed only for questions in an appendix.
10
+ - For a timed talk, budget roughly one substantive slide per one to two minutes, then adjust for demos and discussion.
11
+
12
+ Before building, record for each slide: purpose, takeaway title, evidence, intended visual form, and source.
@@ -0,0 +1,11 @@
1
+ # Templates and existing decks
2
+
3
+ Inspect before editing. Preserve the existing slide size, theme, masters, layouts, placeholders, brand assets, and object relationships unless the user asks for a redesign.
4
+
5
+ - Prefer filling real placeholders over painting look-alike text boxes on top.
6
+ - Duplicate an appropriate existing layout when adding a slide.
7
+ - Make object-level changes for local requests; do not rebuild the whole deck and lose unsupported content.
8
+ - Preserve charts, notes, links, media, accessibility metadata, and animations that are outside the requested change.
9
+ - Require a fresh version token before overwriting an existing file.
10
+
11
+ If the available tools expose only extracted text, state that template-faithful editing is unavailable instead of pretending the regenerated file preserves it.
@@ -0,0 +1,10 @@
1
+ # Visual system and layout
2
+
3
+ Choose a restrained system and apply it consistently: aspect ratio, typefaces, title/body scale, margins, grid, background, primary text, muted text, accent, and semantic status colours.
4
+
5
+ - Use hierarchy, whitespace, alignment, and scale before decoration.
6
+ - Select layouts by content relationship: comparison, sequence, hierarchy, spatial relationship, evidence plus interpretation, or a single focal statement.
7
+ - Prefer diagrams, images, charts, and short labels over dense prose when they communicate the same idea more directly.
8
+ - Avoid repeated card grids, decorative gradients, arbitrary icons, excessive rounded rectangles, and tiny captions that create an automatic “AI deck” look.
9
+ - Keep body copy comfortably readable in the actual presentation setting. Split content instead of shrinking it to fit.
10
+ - Treat accessibility as a design constraint: sufficient contrast, colour-independent meaning, readable labels, and sensible reading order.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: super-pi-agent-development
3
+ description: Create or improve Super Pi agents and roles using the installed agent format and capability model.
4
+ ---
5
+
6
+ # Super Pi Agent Development
7
+
8
+ Use this skill when asked to create, modify, review, or package an agent/role for Super Pi. Identify whether the request is for a personal role, a built-in role, or a multi-agent workflow.
9
+
10
+ ## Personal role agents
11
+
12
+ - Personal role definitions live in `~/.super-pi/agents/<id>.md` and are loaded by Super Pi; do not ask the user to copy an internal prompt.
13
+ - Inspect the existing role loader and examples before writing. Preserve the frontmatter and schema that the installed version expects.
14
+ - Write a concise role prompt with its purpose, decision boundaries, tool access, expected output, and collaboration rules. Avoid duplicating system instructions or restricting a role to read-only access when it must deliver work.
15
+ - Use available filesystem tools to create the role file, then verify that the role appears in the role picker or is otherwise discoverable.
16
+
17
+ ## Built-in roles and capabilities
18
+
19
+ - Built-in role definitions are packaged under `agents/`; changes require updating the relevant registration/ordering path and documentation.
20
+ - Prefer existing Super Pi tools and services for file edits, memory, skills, Git, sessions, and tool registration. Do not create a second mechanism for a capability that already exists.
21
+ - Keep built-in roles discoverable and consistently ordered. Explain any required restart or reload behavior.
22
+
23
+ ## Delivery
24
+
25
+ Inspect the role loader, built-in role inventory, relevant schemas, and current design principles before editing. Implement the role and any registration/docs changes, then summarize file locations, capabilities, and how the user can invoke the role. Follow repository-specific validation and worktree rules when operating in a checkout.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: super-pi-development
3
+ description: Choose the existing Super Pi mechanism for a requested capability and implement it without asking the user to copy internal prompts.
4
+ ---
5
+
6
+ # Super Pi capability development
7
+
8
+ Use the smallest existing mechanism that fits the user's request. Do not ask the user to copy a prompt from settings before starting work. Super Pi already provides a registered `tool_register` capability for global sidebar tools, and the tool's own description explains the submission contract.
9
+
10
+ ## Choose the right mechanism
11
+
12
+ | Need | Use |
13
+ |---|---|
14
+ | A user-facing interactive panel that should appear in every workspace | `tool_register`; see `super-pi-tool-development` |
15
+ | A reusable role with its own system prompt, model, or tool permissions | An Agent definition; see `super-pi-agent-development` |
16
+ | Reusable procedural instructions loaded on demand | A packaged skill at `skills/<name>/SKILL.md`, or user skill storage for personal procedures |
17
+ | A new first-party tool or lifecycle hook available to Super Pi agents | Extend the relevant Pi extension under `agents/super-pi-*/` and update its server capability surface |
18
+ | A connection to an external service that already offers MCP | Configure the native MCP integration; do not build a custom client or duplicate credentials |
19
+ | Reusable user-authored text with no new executable capability | Use a prompt template |
20
+ | Read/write office documents, knowledge, memory, or web pages | Use the existing built-in capability before proposing a new tool |
21
+
22
+ For bundled capabilities, keep the user-facing skill selector and Pi's `additionalSkillPaths` in sync. A skill that exists only in source but is not discovered by the installed application is not shipped.
23
+
24
+ ## Development workflow
25
+
26
+ 1. Inspect the relevant implementation and `docs/DESIGN-PRINCIPLES.md`; identify the current supported path before adding another one.
27
+ 2. Make source changes in the task's feature worktree. Keep API schemas, runtime validation, client types, UI and import/export behavior in parity.
28
+ 3. Prefer the existing registration/runtime path. Preserve service-side authorization and validation; never put credentials in a tool page, prompt, skill, or report.
29
+ 4. Build the package and leave a concise summary of the changed capability, implementation path, and validation evidence.
30
+
31
+ When the user directly requests a tool or Agent, proceed with that request. The settings-page copy prompt is a fallback for models or environments that cannot load the built-in skill context.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: super-pi-tool-development
3
+ description: Build a global Super Pi sidebar tool and register it through the built-in tool_register capability.
4
+ ---
5
+
6
+ # Build a Super Pi sidebar tool
7
+
8
+ When the user asks for a Super Pi tool, implement it and call the built-in `tool_register` directly. Do not ask them to copy the settings prompt. A tool is global to the Super Pi server and appears in each workspace's Tools tab.
9
+
10
+ ## Tool shape
11
+
12
+ - Submit complete UTF-8 files, normally `index.html` plus local JavaScript and CSS. Keep the page self-contained and responsive.
13
+ - If local computation is needed, declare one Python script and its JSON parameter schema. It receives JSON on stdin and must print one JSON object on stdout. Pin dependencies as `package==version` in `environment.requires`.
14
+ - Load `./super-pi-tool.js` for tool-scoped Python jobs with `SuperPiTool.run`, `get`, `wait`, and `cancel`.
15
+ - For model calls, use `SuperPiTool.llm` or `llmText`; declare `permissions: { llm: true }`. Never create a model client or store a credential in the tool.
16
+ - Do not start an HTTP server, call `/api/exec`, guess a tool id, or pass shell commands and arbitrary paths.
17
+ - Use a distinctive 1–4 character `glyph`.
18
+
19
+ ## Popup size
20
+
21
+ If the tool needs more reading space, include `dialogSize: { width, height }` in `tool_register`, in CSS pixels. The width and height are requested desktop dimensions; the host clamps them to the viewport and uses a smaller responsive layout on narrow screens. Choose the smallest size that fits the actual content. A document or data workbench commonly needs around `1100 × 780`; a compact calculator can use the default.
22
+
23
+ Keep the iframe content usable when the popup is narrow: use flexible layouts, allow long tables or code to scroll inside the panel, and do not assume the requested size will fit every viewport.
24
+
25
+ ## Updating an existing tool
26
+
27
+ When replacing or rebuilding an existing tool, preserve its shortcut explicitly:
28
+
29
+ 1. Call `tool_shortcut` with `action: "get"` and the existing `slug` before removing the tool.
30
+ 2. Remove it with `tool_remove`. Removal clears its shortcut immediately, making the key available to other tools.
31
+ 3. Register the replacement with `tool_register`.
32
+ 4. If a shortcut was returned in step 1, call `tool_shortcut` with `action: "set"` and that shortcut.
33
+ 5. If setting it reports a conflict, keep the replacement registered and tell the user which tool owns the key. Do not silently change or clear the other tool's shortcut.
34
+
35
+ Never assume a shortcut survives removal or re-registration. New tools do not claim a shortcut unless the user asks for one.
36
+
37
+ ## Finish
38
+
39
+ Register only after the HTML and any script files are complete. Return the tool name, registration result, and the main interaction or calculation verified. If registration is unavailable in the current environment, report that constraint and provide the retained copy-prompt fallback only then.