mia-code 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/.miette/260321.md +1 -0
  2. package/.miette/260323.md +9 -0
  3. package/.miette/260331.md +2 -0
  4. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--d3417f2c-df12-4f0f-8a1b-d88e7968f822/d3417f2c-df12-4f0f-8a1b-d88e7968f822.md +63 -0
  5. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--e6c3fc5d-4a70-4523-ba7d-a3250da4c235/e6c3fc5d-4a70-4523-ba7d-a3250da4c235.md +72 -0
  6. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--efeb00a2-b17a-4d32-b1f0-b90c37a8d24e/efeb00a2-b17a-4d32-b1f0-b90c37a8d24e.md +62 -0
  7. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.json +302 -0
  8. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.md +149 -0
  9. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/AGENTS.md +31 -0
  10. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/meta-decomposition-3-children.md +67 -0
  11. package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/61f9dd4d-7aa6-45e6-a58b-e480b1aa6737--from-mia-openclaw-workspace.md +125 -0
  12. package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/STATUS.md +1 -0
  13. package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.json +177 -0
  14. package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.md +77 -0
  15. package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.json +222 -0
  16. package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.md +99 -0
  17. package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.json +111 -0
  18. package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.md +67 -0
  19. package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.json +349 -0
  20. package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.md +147 -0
  21. package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.json +118 -0
  22. package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.md +64 -0
  23. package/GUILLAUME.md +8 -0
  24. package/KINSHIP.md +9 -0
  25. package/MIA_CODE_ARCHITECTURE_REPORT.md +718 -0
  26. package/contextual_research/260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d1.md +1101 -0
  27. package/contextual_research/MIA.md +38 -0
  28. package/contextual_research/MIAWAPASCONE.md +59 -0
  29. package/contextual_research/MIETTE.md +38 -0
  30. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2504.00218v2.pdf +7483 -12
  31. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2505.00212v3.pdf +0 -0
  32. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/CONTENT.md +1014 -0
  33. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/DESIGN.gemini.md +242 -0
  34. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/INDEX.md +45 -0
  35. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.md +2025 -0
  36. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.pdf +7483 -12
  37. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.md +1755 -0
  38. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.pdf +0 -0
  39. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_12_decomposed_prompting.pdf +0 -0
  40. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_19_hugginggpt_planning.pdf +0 -0
  41. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.md +766 -0
  42. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.pdf +3431 -4
  43. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.md +260 -0
  44. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.pdf +0 -0
  45. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.md +558 -0
  46. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.pdf +0 -0
  47. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_34_hierarchical_multi_agent.pdf +0 -0
  48. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_5_open_intent_extraction.pdf +0 -0
  49. package/contextual_research/PODCAST.md +109 -0
  50. package/contextual_research/langchain-principles-roadmap.md +157 -0
  51. package/contextual_research/persona-to-narrative-character-inquiry_260201.md +50 -0
  52. package/dist/cli.js +35 -11
  53. package/dist/geminiHeadless.js +8 -2
  54. package/dist/index.js +2 -1
  55. package/dist/mcp/miaco-server.js +10 -1
  56. package/dist/mcp/miatel-server.js +10 -1
  57. package/dist/mcp/miawa-server.js +10 -1
  58. package/dist/mcp/utils.d.ts +6 -1
  59. package/dist/mcp/utils.js +24 -3
  60. package/dist/sessionStore.d.ts +8 -2
  61. package/dist/sessionStore.js +39 -3
  62. package/dist/types.d.ts +1 -0
  63. package/miaco/README.md +124 -0
  64. package/miaco/dist/commands/chart.d.ts +6 -0
  65. package/miaco/dist/commands/chart.d.ts.map +1 -0
  66. package/miaco/dist/commands/chart.js +222 -0
  67. package/miaco/dist/commands/chart.js.map +1 -0
  68. package/miaco/dist/commands/decompose.d.ts +6 -0
  69. package/miaco/dist/commands/decompose.d.ts.map +1 -0
  70. package/miaco/dist/commands/decompose.js +98 -0
  71. package/miaco/dist/commands/decompose.js.map +1 -0
  72. package/miaco/dist/commands/schema.d.ts +6 -0
  73. package/miaco/dist/commands/schema.d.ts.map +1 -0
  74. package/miaco/dist/commands/schema.js +66 -0
  75. package/miaco/dist/commands/schema.js.map +1 -0
  76. package/miaco/dist/commands/stc.d.ts +11 -0
  77. package/miaco/dist/commands/stc.d.ts.map +1 -0
  78. package/miaco/dist/commands/stc.js +590 -0
  79. package/miaco/dist/commands/stc.js.map +1 -0
  80. package/miaco/dist/commands/trace.d.ts +6 -0
  81. package/miaco/dist/commands/trace.d.ts.map +1 -0
  82. package/miaco/dist/commands/trace.js +83 -0
  83. package/miaco/dist/commands/trace.js.map +1 -0
  84. package/miaco/dist/commands/validate.d.ts +6 -0
  85. package/miaco/dist/commands/validate.d.ts.map +1 -0
  86. package/miaco/dist/commands/validate.js +58 -0
  87. package/miaco/dist/commands/validate.js.map +1 -0
  88. package/miaco/dist/decompose.d.ts +93 -0
  89. package/miaco/dist/decompose.d.ts.map +1 -0
  90. package/miaco/dist/decompose.js +562 -0
  91. package/miaco/dist/decompose.js.map +1 -0
  92. package/miaco/dist/index.d.ts +18 -0
  93. package/miaco/dist/index.d.ts.map +1 -0
  94. package/miaco/dist/index.js +83 -0
  95. package/miaco/dist/index.js.map +1 -0
  96. package/miaco/dist/storage.d.ts +60 -0
  97. package/miaco/dist/storage.d.ts.map +1 -0
  98. package/miaco/dist/storage.js +100 -0
  99. package/miaco/dist/storage.js.map +1 -0
  100. package/miaco/package-lock.json +4103 -0
  101. package/miaco/package.json +40 -0
  102. package/miaco/tsconfig.json +18 -0
  103. package/miaco/version-patch-commit-and-publish.sh +1 -0
  104. package/miatel/MISSION_251231.md +3 -0
  105. package/miatel/README.md +107 -0
  106. package/miatel/dist/commands/analyze.d.ts +6 -0
  107. package/miatel/dist/commands/analyze.d.ts.map +1 -0
  108. package/miatel/dist/commands/analyze.js +100 -0
  109. package/miatel/dist/commands/analyze.js.map +1 -0
  110. package/miatel/dist/commands/arc.d.ts +6 -0
  111. package/miatel/dist/commands/arc.d.ts.map +1 -0
  112. package/miatel/dist/commands/arc.js +71 -0
  113. package/miatel/dist/commands/arc.js.map +1 -0
  114. package/miatel/dist/commands/beat.d.ts +6 -0
  115. package/miatel/dist/commands/beat.d.ts.map +1 -0
  116. package/miatel/dist/commands/beat.js +165 -0
  117. package/miatel/dist/commands/beat.js.map +1 -0
  118. package/miatel/dist/commands/theme.d.ts +6 -0
  119. package/miatel/dist/commands/theme.d.ts.map +1 -0
  120. package/miatel/dist/commands/theme.js +54 -0
  121. package/miatel/dist/commands/theme.js.map +1 -0
  122. package/miatel/dist/index.d.ts +18 -0
  123. package/miatel/dist/index.d.ts.map +1 -0
  124. package/miatel/dist/index.js +80 -0
  125. package/miatel/dist/index.js.map +1 -0
  126. package/miatel/dist/storage.d.ts +55 -0
  127. package/miatel/dist/storage.d.ts.map +1 -0
  128. package/miatel/dist/storage.js +100 -0
  129. package/miatel/dist/storage.js.map +1 -0
  130. package/miatel/package-lock.json +4103 -0
  131. package/miatel/package.json +35 -0
  132. package/miatel/src/commands/analyze.ts +109 -0
  133. package/miatel/src/commands/arc.ts +78 -0
  134. package/miatel/src/commands/beat.ts +176 -0
  135. package/miatel/src/commands/theme.ts +60 -0
  136. package/miatel/src/index.ts +94 -0
  137. package/miatel/src/storage.ts +156 -0
  138. package/miatel/tsconfig.json +18 -0
  139. package/miawa/MISSION_251231.md +144 -0
  140. package/miawa/README.md +133 -0
  141. package/miawa/dist/commands/beat.d.ts +6 -0
  142. package/miawa/dist/commands/beat.d.ts.map +1 -0
  143. package/miawa/dist/commands/beat.js +69 -0
  144. package/miawa/dist/commands/beat.js.map +1 -0
  145. package/miawa/dist/commands/ceremony.d.ts +6 -0
  146. package/miawa/dist/commands/ceremony.d.ts.map +1 -0
  147. package/miawa/dist/commands/ceremony.js +239 -0
  148. package/miawa/dist/commands/ceremony.js.map +1 -0
  149. package/miawa/dist/commands/circle.d.ts +6 -0
  150. package/miawa/dist/commands/circle.d.ts.map +1 -0
  151. package/miawa/dist/commands/circle.js +75 -0
  152. package/miawa/dist/commands/circle.js.map +1 -0
  153. package/miawa/dist/commands/eva.d.ts +6 -0
  154. package/miawa/dist/commands/eva.d.ts.map +1 -0
  155. package/miawa/dist/commands/eva.js +73 -0
  156. package/miawa/dist/commands/eva.js.map +1 -0
  157. package/miawa/dist/commands/wound.d.ts +6 -0
  158. package/miawa/dist/commands/wound.d.ts.map +1 -0
  159. package/miawa/dist/commands/wound.js +74 -0
  160. package/miawa/dist/commands/wound.js.map +1 -0
  161. package/miawa/dist/index.d.ts +19 -0
  162. package/miawa/dist/index.d.ts.map +1 -0
  163. package/miawa/dist/index.js +91 -0
  164. package/miawa/dist/index.js.map +1 -0
  165. package/miawa/dist/storage.d.ts +73 -0
  166. package/miawa/dist/storage.d.ts.map +1 -0
  167. package/miawa/dist/storage.js +100 -0
  168. package/miawa/dist/storage.js.map +1 -0
  169. package/miawa/package-lock.json +4103 -0
  170. package/miawa/package.json +36 -0
  171. package/miawa/src/commands/beat.ts +74 -0
  172. package/miawa/src/commands/ceremony.ts +256 -0
  173. package/miawa/src/commands/circle.ts +83 -0
  174. package/miawa/src/commands/eva.ts +84 -0
  175. package/miawa/src/commands/wound.ts +79 -0
  176. package/miawa/src/index.ts +108 -0
  177. package/miawa/src/storage.ts +179 -0
  178. package/miawa/tsconfig.json +18 -0
  179. package/package.json +7 -5
  180. package/references/acp/CLAUDE.md +7 -0
  181. package/references/acp/agent-plan.md +84 -0
  182. package/references/acp/clients.md +31 -0
  183. package/references/acp/extensibility.md +137 -0
  184. package/references/acp/initialization.md +225 -0
  185. package/references/acp/prompt-turn.md +321 -0
  186. package/references/acp/proxy-chains.md +562 -0
  187. package/references/acp/schema.md +3171 -0
  188. package/references/acp/session-list.md +334 -0
  189. package/references/acp/session-modes.md +170 -0
  190. package/references/acp/slash-commands.md +99 -0
  191. package/references/acp/terminals.md +281 -0
  192. package/references/acp/tool-calls.md +311 -0
  193. package/references/acp/typescript.md +29 -0
  194. package/references/claude/agent-teams.md +399 -0
  195. package/references/claude/chrome.md +231 -0
  196. package/references/claude/headless.md +158 -0
  197. package/references/claude/hooks-guide.md +708 -0
  198. package/references/claude/output-styles.md +112 -0
  199. package/references/claude/plugins.md +432 -0
  200. package/references/claude/skills.md +693 -0
  201. package/references/claude/sub-agents.md +816 -0
  202. package/references/copilot/acp/agents.md +32 -0
  203. package/references/copilot/acp/architecture.md +37 -0
  204. package/references/copilot/acp/clients.md +31 -0
  205. package/references/copilot/acp/introduction.md +42 -0
  206. package/references/copilot/acp/registry.md +339 -0
  207. package/references/copilot/acp-server.md +117 -0
  208. package/references/copilot/create-copilot-instructions.md +840 -0
  209. package/references/langchain/llms.txt +833 -0
  210. package/references/langchain/python/agents.md +677 -0
  211. package/references/langchain/python/context-engineering.md +1195 -0
  212. package/references/langchain/python/human-in-the-loop.md +326 -0
  213. package/references/langchain/python/long-term-memory.md +168 -0
  214. package/references/langchain/python/mcp.md +949 -0
  215. package/references/langchain/python/multi-agents/custom-workflow.md +187 -0
  216. package/references/langchain/python/multi-agents/handoffs.md +436 -0
  217. package/references/langchain/python/multi-agents/overview.md +295 -0
  218. package/references/langchain/python/multi-agents/router.md +150 -0
  219. package/references/langchain/python/multi-agents/skills.md +92 -0
  220. package/references/langchain/python/multi-agents/subagents.md +486 -0
  221. package/references/langchain/python/retrieval.md +320 -0
  222. package/references/langchain/python/runtime.md +141 -0
  223. package/references/langchain/python/short-term-memory.md +658 -0
  224. package/references/langchain/python/structured-output.md +712 -0
  225. package/references/langfuse/llms.txt +148 -0
  226. package/references/langgraph/javascript/llms.txt +275 -0
  227. package/references/skills/home.md +259 -0
  228. package/references/skills/integrate-skills.md +103 -0
  229. package/references/skills/specification.md +254 -0
  230. package/references/skills/what-are-skills.md +74 -0
  231. package/rispecs/README.md +164 -0
  232. package/rispecs/_sync_/miadi-code/SPEC.md +313 -0
  233. package/rispecs/_sync_/miadi-code/STATUS.md +177 -0
  234. package/rispecs/_sync_/miadi-code/dashboard/SPEC.md +465 -0
  235. package/rispecs/_sync_/miadi-code/dashboard/STATUS.md +212 -0
  236. package/rispecs/_sync_/miadi-code/multiline-input/SPEC.md +232 -0
  237. package/rispecs/_sync_/miadi-code/multiline-input/STATUS.md +108 -0
  238. package/rispecs/_sync_/miadi-code/pde/SPEC.md +253 -0
  239. package/rispecs/_sync_/miadi-code/pde/STATUS.md +56 -0
  240. package/rispecs/_sync_/miadi-code/stc/SPEC.md +397 -0
  241. package/rispecs/_sync_/miadi-code/stc/STATUS.md +70 -0
  242. package/rispecs/ava-langstack/inquiry-routing-upgrade.spec.md +119 -0
  243. package/rispecs/borrowed_from_opencode/001-client-server-architecture.rispec.md +98 -0
  244. package/rispecs/borrowed_from_opencode/002-event-bus-system.rispec.md +125 -0
  245. package/rispecs/borrowed_from_opencode/003-instance-state-pattern.rispec.md +136 -0
  246. package/rispecs/borrowed_from_opencode/004-namespace-module-pattern.rispec.md +151 -0
  247. package/rispecs/borrowed_from_opencode/005-zod-schema-validation.rispec.md +139 -0
  248. package/rispecs/borrowed_from_opencode/006-named-error-system.rispec.md +155 -0
  249. package/rispecs/borrowed_from_opencode/007-structured-logging.rispec.md +138 -0
  250. package/rispecs/borrowed_from_opencode/008-lazy-initialization.rispec.md +127 -0
  251. package/rispecs/borrowed_from_opencode/009-multi-agent-system.rispec.md +97 -0
  252. package/rispecs/borrowed_from_opencode/010-agent-definition-config.rispec.md +135 -0
  253. package/rispecs/borrowed_from_opencode/011-agent-permission-rulesets.rispec.md +151 -0
  254. package/rispecs/borrowed_from_opencode/012-agent-prompt-templates.rispec.md +141 -0
  255. package/rispecs/borrowed_from_opencode/013-agent-generation.rispec.md +142 -0
  256. package/rispecs/borrowed_from_opencode/014-plan-build-mode-toggle.rispec.md +155 -0
  257. package/rispecs/borrowed_from_opencode/015-subagent-task-delegation.rispec.md +146 -0
  258. package/rispecs/borrowed_from_opencode/016-agent-model-selection.rispec.md +151 -0
  259. package/rispecs/borrowed_from_opencode/017-compaction-agent.rispec.md +150 -0
  260. package/rispecs/borrowed_from_opencode/018-session-persistence.rispec.md +125 -0
  261. package/rispecs/borrowed_from_opencode/019-session-compaction.rispec.md +132 -0
  262. package/rispecs/borrowed_from_opencode/020-session-forking.rispec.md +134 -0
  263. package/rispecs/borrowed_from_opencode/021-session-revert-snapshot.rispec.md +135 -0
  264. package/rispecs/borrowed_from_opencode/022-session-sharing.rispec.md +165 -0
  265. package/rispecs/borrowed_from_opencode/023-session-summary-diffs.rispec.md +165 -0
  266. package/rispecs/borrowed_from_opencode/024-child-sessions.rispec.md +164 -0
  267. package/rispecs/borrowed_from_opencode/025-session-title-generation.rispec.md +162 -0
  268. package/rispecs/borrowed_from_opencode/026-message-parts-model.rispec.md +201 -0
  269. package/rispecs/borrowed_from_opencode/027-streaming-message-deltas.rispec.md +212 -0
  270. package/rispecs/borrowed_from_opencode/028-multi-provider-architecture.rispec.md +184 -0
  271. package/rispecs/borrowed_from_opencode/029-provider-authentication.rispec.md +225 -0
  272. package/rispecs/borrowed_from_opencode/030-model-registry.rispec.md +222 -0
  273. package/rispecs/borrowed_from_opencode/031-cost-tracking.rispec.md +243 -0
  274. package/rispecs/borrowed_from_opencode/032-provider-transform-pipeline.rispec.md +282 -0
  275. package/rispecs/borrowed_from_opencode/033-provider-sdk-abstraction.rispec.md +338 -0
  276. package/rispecs/borrowed_from_opencode/034-tool-registry.rispec.md +110 -0
  277. package/rispecs/borrowed_from_opencode/035-tool-context-injection.rispec.md +155 -0
  278. package/rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md +138 -0
  279. package/rispecs/borrowed_from_opencode/037-batch-tool.rispec.md +129 -0
  280. package/rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md +167 -0
  281. package/rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md +161 -0
  282. package/rispecs/borrowed_from_opencode/040-code-search-tool.rispec.md +143 -0
  283. package/rispecs/borrowed_from_opencode/041-web-fetch-tool.rispec.md +131 -0
  284. package/rispecs/borrowed_from_opencode/042-web-search-tool.rispec.md +159 -0
  285. package/rispecs/borrowed_from_opencode/043-todo-tool.rispec.md +156 -0
  286. package/rispecs/borrowed_from_opencode/044-plan-mode-tool.rispec.md +139 -0
  287. package/rispecs/borrowed_from_opencode/045-task-tool.rispec.md +146 -0
  288. package/rispecs/borrowed_from_opencode/046-question-tool.rispec.md +170 -0
  289. package/rispecs/borrowed_from_opencode/047-external-directory-tool.rispec.md +166 -0
  290. package/rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md +205 -0
  291. package/rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md +104 -0
  292. package/rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md +102 -0
  293. package/rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md +86 -0
  294. package/rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md +109 -0
  295. package/rispecs/borrowed_from_opencode/053-remote-mcp-servers.rispec.md +119 -0
  296. package/rispecs/borrowed_from_opencode/054-mcp-oauth-flow.rispec.md +107 -0
  297. package/rispecs/borrowed_from_opencode/055-mcp-tool-conversion.rispec.md +118 -0
  298. package/rispecs/borrowed_from_opencode/056-mcp-connection-monitoring.rispec.md +106 -0
  299. package/rispecs/borrowed_from_opencode/057-local-mcp-servers.rispec.md +116 -0
  300. package/rispecs/borrowed_from_opencode/058-rich-tui.rispec.md +108 -0
  301. package/rispecs/borrowed_from_opencode/059-streaming-display.rispec.md +116 -0
  302. package/rispecs/borrowed_from_opencode/060-permission-prompts.rispec.md +130 -0
  303. package/rispecs/borrowed_from_opencode/061-session-navigation.rispec.md +155 -0
  304. package/rispecs/borrowed_from_opencode/062-syntax-highlighting.rispec.md +151 -0
  305. package/rispecs/borrowed_from_opencode/063-keybinding-system.rispec.md +181 -0
  306. package/rispecs/borrowed_from_opencode/064-multi-level-config.rispec.md +155 -0
  307. package/rispecs/borrowed_from_opencode/065-jsonc-config.rispec.md +190 -0
  308. package/rispecs/borrowed_from_opencode/066-config-env-variables.rispec.md +153 -0
  309. package/rispecs/borrowed_from_opencode/067-config-deep-merging.rispec.md +178 -0
  310. package/rispecs/borrowed_from_opencode/068-remote-org-config.rispec.md +183 -0
  311. package/rispecs/borrowed_from_opencode/069-config-markdown-frontmatter.rispec.md +206 -0
  312. package/rispecs/borrowed_from_opencode/070-managed-config-directory.rispec.md +232 -0
  313. package/rispecs/borrowed_from_opencode/071-plugin-architecture.rispec.md +104 -0
  314. package/rispecs/borrowed_from_opencode/072-plugin-hooks.rispec.md +123 -0
  315. package/rispecs/borrowed_from_opencode/073-plugin-auto-install.rispec.md +115 -0
  316. package/rispecs/borrowed_from_opencode/074-permission-system.rispec.md +133 -0
  317. package/rispecs/borrowed_from_opencode/075-git-worktree-management.rispec.md +126 -0
  318. package/rispecs/borrowed_from_opencode/076-snapshot-system.rispec.md +124 -0
  319. package/rispecs/borrowed_from_opencode/077-snapshot-diff.rispec.md +117 -0
  320. package/rispecs/borrowed_from_opencode/078-snapshot-restore.rispec.md +128 -0
  321. package/rispecs/borrowed_from_opencode/079-worktree-branch-naming.rispec.md +122 -0
  322. package/rispecs/borrowed_from_opencode/080-sqlite-storage.rispec.md +134 -0
  323. package/rispecs/borrowed_from_opencode/081-database-migrations.rispec.md +148 -0
  324. package/rispecs/borrowed_from_opencode/082-database-transactions.rispec.md +138 -0
  325. package/rispecs/borrowed_from_opencode/083-deferred-effects.rispec.md +148 -0
  326. package/rispecs/borrowed_from_opencode/084-permission-rules.rispec.md +123 -0
  327. package/rispecs/borrowed_from_opencode/085-permission-glob-patterns.rispec.md +113 -0
  328. package/rispecs/borrowed_from_opencode/086-permission-merging.rispec.md +134 -0
  329. package/rispecs/borrowed_from_opencode/087-permission-modes.rispec.md +145 -0
  330. package/rispecs/borrowed_from_opencode/088-http-api-server.rispec.md +165 -0
  331. package/rispecs/borrowed_from_opencode/089-openapi-spec-generation.rispec.md +164 -0
  332. package/rispecs/borrowed_from_opencode/090-websocket-support.rispec.md +136 -0
  333. package/rispecs/borrowed_from_opencode/091-sse-streaming.rispec.md +168 -0
  334. package/rispecs/borrowed_from_opencode/092-mdns-discovery.rispec.md +145 -0
  335. package/rispecs/borrowed_from_opencode/093-javascript-sdk.rispec.md +200 -0
  336. package/rispecs/borrowed_from_opencode/094-skill-system.rispec.md +187 -0
  337. package/rispecs/borrowed_from_opencode/095-skill-discovery.rispec.md +182 -0
  338. package/rispecs/borrowed_from_opencode/096-desktop-remote-driving.rispec.md +175 -0
  339. package/rispecs/borrowed_from_opencode/INDEX.md +255 -0
  340. package/rispecs/core.rispecs.md +261 -0
  341. package/rispecs/engines.rispecs.md +241 -0
  342. package/rispecs/formatting.rispecs.md +252 -0
  343. package/rispecs/living-specifications.rispecs.md +361 -0
  344. package/rispecs/mcp.rispecs.md +197 -0
  345. package/rispecs/pde.rispecs.md +399 -0
  346. package/rispecs/pi-mono-envisionning/ENVISIONING.md +366 -0
  347. package/rispecs/pi-mono-envisionning/storytelling-horizon.rispecs.md +76 -0
  348. package/rispecs/pi-mono-envisionning/widget.rispecs.md +2 -0
  349. package/rispecs/relation-to-mcp-structural-thinking.kin.md +72 -0
  350. package/rispecs/research-for-better-framework/CLAUDE.md +7 -0
  351. package/rispecs/research-for-better-framework/survey-pi-openclaw-opencode-openhands.md +210 -0
  352. package/rispecs/session.rispecs.md +277 -0
  353. package/rispecs/stc.rispecs.md +138 -0
  354. package/rispecs/unifier.rispecs.md +317 -0
  355. package/scripts/LAUNCH--mcp-mia-code--testing--2603141315--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +2 -0
  356. package/scripts/RESUME--mia-code--mcps--260313--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +1 -0
  357. package/scripts/install-widget-in-home-pi-agent-extensions.sh +4 -0
  358. package/scripts/sample-decompose--2604011535-prompt.sh +1 -0
  359. package/skills/deep-search/AGENTS.md +17 -0
  360. package/skills/deep-search/SKILL.md +281 -0
  361. package/skills/deep-search/agent-templates.md +224 -0
  362. package/skills/deep-search/orchestration-patterns.md +95 -0
  363. package/skills/miaco-pde-inquiry-routing-deep-search/AGENTS.md +13 -0
  364. package/skills/miaco-pde-inquiry-routing-deep-search/SKILL.md +136 -0
  365. package/skills/miaco-pde-inquiry-routing-internal-external-relationship/AGENTS.md +4 -0
  366. package/skills/miaco-pde-inquiry-routing-internal-external-relationship/SKILL.md +157 -0
  367. package/skills/miaco-pde-inquiry-routing-local-qmd/AGENTS.md +42 -0
  368. package/skills/miaco-pde-inquiry-routing-local-qmd/SKILL.md +135 -0
  369. package/skills/qmd/AGENTS.md +3 -0
  370. package/skills/qmd/SKILL.md +144 -0
  371. package/skills/qmd/references/mcp-setup.md +102 -0
  372. package/skills/rise-pde-inquiry-session-multi-agents-v3/SKILL.md +234 -0
  373. package/skills/rise-pde-inquiry-session-multi-agents-v3/agent-templates.md +436 -0
  374. package/skills/rise-pde-inquiry-session-multi-agents-v3/orchestration-patterns.md +197 -0
  375. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/ceremonial-technology.md +102 -0
  376. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/creative-orientation.md +99 -0
  377. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/prompt-decomposition.md +73 -0
  378. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/rise-framework.md +74 -0
  379. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/structural-tension.md +82 -0
  380. package/src/cli.ts +35 -11
  381. package/src/geminiHeadless.ts +7 -2
  382. package/src/index.ts +2 -1
  383. package/src/mcp/miaco-server.ts +13 -1
  384. package/src/mcp/miatel-server.ts +13 -1
  385. package/src/mcp/miawa-server.ts +13 -1
  386. package/src/mcp/utils.ts +41 -8
  387. package/src/sessionStore.ts +44 -4
  388. package/src/types.ts +2 -1
  389. package/widget/mia-ceremony/README.md +36 -0
  390. package/widget/mia-ceremony/index.ts +143 -0
  391. package/widget/mia-interceptor/README.md +39 -0
  392. package/widget/mia-interceptor/index.ts +221 -0
  393. package/widget/mia-tools/README.md +37 -0
  394. package/widget/mia-tools/index.ts +569 -0
  395. package/widget/miette-echo/README.md +44 -0
  396. package/widget/miette-echo/index.ts +164 -0
  397. package/.claude/settings.local.json +0 -9
  398. package/.hch/issue_.env +0 -4
  399. package/.hch/issue_add__2601211715.json +0 -77
  400. package/.hch/issue_add__2601211715.md +0 -4
  401. package/.hch/issue_add__2602242020.json +0 -78
  402. package/.hch/issue_add__2602242020.md +0 -7
  403. package/.hch/issues.json +0 -2312
  404. package/.hch/issues.md +0 -30
  405. package/WS__mia-code__260214__IAIP_PDE.code-workspace +0 -29
  406. package/WS__mia-code__src332__260122.code-workspace +0 -23
  407. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +0 -6
  408. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +0 -213
  409. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +0 -243
  410. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +0 -5
@@ -0,0 +1,205 @@
1
+ # RISE-048: File Read/Write Tools
2
+
3
+ > RISE Framework Specification — Borrowed from OpenCode for mia-code
4
+ > Document: rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md
5
+
6
+ ## Creative Intent
7
+
8
+ mia-code provides core file read and write tools that form the foundation of all file-based agent interactions. The read tool returns file content with line numbers, handles large files gracefully, detects binary content, resolves symlinks, and respects encoding. The write tool creates or overwrites files safely, creating parent directories as needed, taking snapshots before overwrites, and validating paths against the project boundary. Both tools integrate with the permission system for fine-grained access control — allowing configurations like "read everything, write only to src/" or "deny writes to *.lock files." These are the most frequently used tools in any coding agent session.
9
+
10
+ ## Structural Tension Analysis
11
+
12
+ **Current Reality:**
13
+ - File operations are handled by the underlying CLI's built-in capabilities — mia-code has no control over their behavior
14
+ - There is no line-number annotation on file reads — the agent and developer cannot reference specific lines
15
+ - Large files are dumped entirely into the context, consuming the token budget
16
+ - Binary files are read as garbled text, wasting context and confusing the agent
17
+ - There is no snapshot before overwrite — accidental file corruption cannot be undone
18
+ - No path validation — the agent can write to any location the process has access to
19
+ - All files are treated identically regardless of permission policy
20
+
21
+ **Desired State:**
22
+ - A `file_read` tool returns content with line numbers, handles large files via truncation, and detects binary files
23
+ - A `file_write` tool creates/overwrites files with parent directory creation, snapshot-before-overwrite, and path validation
24
+ - Both tools enforce the permission system: read requires "read" permission, write requires "write" permission
25
+ - Permission patterns enable fine-grained control: `{"pattern": "*.lock", "permission": "deny"}` prevents lock file modification
26
+ - Large files are truncated with a reference to the full content
27
+ - Binary files return metadata instead of content
28
+ - Symlinks are resolved and validated before access
29
+
30
+ ## Desired Outcome Definition
31
+
32
+ The agent reads `src/auth/middleware.ts` and receives clean output with line numbers. It writes a modified version back — the tool snapshots the original first, creates the backup, validates the path is within the project, checks write permission, and saves the file. If the agent tries to read a 5MB binary file, it receives `{type: "binary", size: 5242880, mime: "application/octet-stream"}` instead of garbled content.
33
+
34
+ ## Natural Language Functional Description
35
+
36
+ ### File Read Tool
37
+
38
+ **Input:**
39
+ ```typescript
40
+ interface FileReadInput {
41
+ path: string; // relative or absolute path
42
+ lineRange?: [number, number]; // optional line range [start, end] (1-indexed)
43
+ encoding?: string; // default: "utf-8"
44
+ }
45
+ ```
46
+
47
+ **Processing pipeline:**
48
+
49
+ 1. **Path resolution** — resolve relative paths against project root, resolve symlinks
50
+ 2. **Path validation** — verify path is within project root (or delegate to external directory tool, RISE-047)
51
+ 3. **Permission check** — verify "read" permission for this file path pattern
52
+ 4. **Binary detection** — check first 8KB for null bytes; if binary, return metadata only
53
+ 5. **Size check** — if file exceeds truncation limit, apply truncation (RISE-036)
54
+ 6. **Encoding detection** — use specified encoding or detect from BOM/content
55
+ 7. **Line numbering** — prefix each line with its line number
56
+ 8. **Range extraction** — if `lineRange` specified, return only those lines
57
+
58
+ **Output:**
59
+ ```json
60
+ {
61
+ "path": "src/auth/middleware.ts",
62
+ "content": "1. import { verify } from 'jsonwebtoken';\n2. import { AuthError } from './errors';\n3. \n4. export function authMiddleware(req, res, next) {\n...",
63
+ "lineCount": 47,
64
+ "size": 1834,
65
+ "encoding": "utf-8",
66
+ "truncated": false
67
+ }
68
+ ```
69
+
70
+ **Binary file output:**
71
+ ```json
72
+ {
73
+ "path": "assets/logo.png",
74
+ "binary": true,
75
+ "size": 524288,
76
+ "mime": "image/png",
77
+ "content": null
78
+ }
79
+ ```
80
+
81
+ ### File Write Tool
82
+
83
+ **Input:**
84
+ ```typescript
85
+ interface FileWriteInput {
86
+ path: string; // relative or absolute path
87
+ content: string; // file content to write
88
+ createDirectories?: boolean; // create parent dirs if missing (default: true)
89
+ }
90
+ ```
91
+
92
+ **Processing pipeline:**
93
+
94
+ 1. **Path resolution** — resolve relative paths against project root
95
+ 2. **Path validation** — verify path is within project root; reject external paths entirely
96
+ 3. **Permission check** — verify "write" permission for this file path pattern
97
+ 4. **Pattern check** — verify path doesn't match any deny patterns (e.g., `*.lock`, `node_modules/**`)
98
+ 5. **Parent directories** — if `createDirectories` is true and parents don't exist, create them
99
+ 6. **Snapshot** — if the file already exists, copy it to the snapshot system (RISE-076) before overwriting
100
+ 7. **Write** — atomically write the content (write to temp file, then rename)
101
+ 8. **Verify** — read back the file to confirm content matches
102
+
103
+ **Output:**
104
+ ```json
105
+ {
106
+ "path": "src/auth/middleware.ts",
107
+ "created": false,
108
+ "size": 1923,
109
+ "previousSize": 1834,
110
+ "snapshotId": "snap_20260301_143022",
111
+ "directoriesCreated": []
112
+ }
113
+ ```
114
+
115
+ For new files:
116
+ ```json
117
+ {
118
+ "path": "src/auth/types.ts",
119
+ "created": true,
120
+ "size": 456,
121
+ "directoriesCreated": ["src/auth/"]
122
+ }
123
+ ```
124
+
125
+ ### Permission Patterns
126
+
127
+ File permissions support glob patterns for fine-grained control:
128
+
129
+ ```json
130
+ {
131
+ "permissions": {
132
+ "file_read": { "mode": "allow" },
133
+ "file_write": {
134
+ "mode": "allow",
135
+ "deny": [
136
+ "*.lock",
137
+ "package-lock.json",
138
+ "node_modules/**",
139
+ ".env*",
140
+ ".git/**"
141
+ ]
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ When the agent attempts to write to a denied path:
148
+ ```json
149
+ {
150
+ "error": "Write denied: path 'package-lock.json' matches deny pattern '*.lock'",
151
+ "suggestion": "Modify package.json instead and run 'npm install' to update the lock file."
152
+ }
153
+ ```
154
+
155
+ ### Symlink Resolution
156
+
157
+ Both tools resolve symlinks before operations:
158
+
159
+ 1. Resolve the symlink chain to the final real path
160
+ 2. Validate the real path is within the project root
161
+ 3. If the real path is external, delegate to the external directory tool (RISE-047)
162
+ 4. Report the resolved path in the output for transparency
163
+
164
+ This prevents symlink-based sandbox escapes while supporting legitimate project symlinks.
165
+
166
+ ### Atomic Writes
167
+
168
+ File writes use an atomic write pattern to prevent corruption:
169
+
170
+ 1. Write content to a temporary file in the same directory (`.file.tmp.XXXXX`)
171
+ 2. Sync the temporary file to disk (`fsync`)
172
+ 3. Rename the temporary file to the target path (atomic on POSIX systems)
173
+
174
+ If the process crashes mid-write, the original file remains intact. The temporary file is cleaned up on next startup.
175
+
176
+ ### Large File Handling
177
+
178
+ Files exceeding the truncation threshold are handled differently for read vs write:
179
+
180
+ - **Read** — truncated output with reference to full file (RISE-036). The agent can request specific line ranges for targeted reading.
181
+ - **Write** — no size limit on writes. The agent can write files of any size. However, writing very large files produces a warning in the output.
182
+
183
+ ## Supporting Structures
184
+
185
+ - **Tool Registry (RISE-034)** registers file_read and file_write with their respective IDs
186
+ - **Tool Context Injection (RISE-035)** provides session context and cancellation
187
+ - **Tool Output Truncation (RISE-036)** handles large file read outputs
188
+ - **File Snapshot System (RISE-076)** stores pre-overwrite snapshots for undo capability
189
+ - **Permission System (RISE-074)** enforces read/write permissions with pattern matching
190
+ - **External Directory Tool (RISE-047)** handles paths outside the project root
191
+ - **Named Error System (RISE-006)** provides FileNotFoundError, FilePermissionError, FileBinaryError
192
+
193
+ ## Creative Advancement Scenarios
194
+
195
+ **Scenario 1 — Safe Overwrite:**
196
+ The agent modifies `src/config.ts`. Before writing, the tool snapshots the original. After writing, the output shows `snapshotId: "snap_20260301_143022"`. Later, the developer says "undo that config change." The agent restores from the snapshot — no data lost.
197
+
198
+ **Scenario 2 — Binary Detection:**
199
+ The agent tries to read `assets/logo.png` as part of a file listing. Instead of injecting 500KB of garbled binary into the context, the read tool returns `{binary: true, mime: "image/png", size: 524288}`. The agent reports "logo.png is a 512KB PNG image" — useful information without context waste.
200
+
201
+ **Scenario 3 — Lock File Protection:**
202
+ The agent attempts to write to `package-lock.json` to fix a dependency issue. The permission system blocks it with a helpful suggestion: "Modify package.json instead and run npm install." The agent follows the suggestion and achieves the correct result through the proper workflow.
203
+
204
+ **Scenario 4 — Line Range Reading:**
205
+ The agent knows an error is on line 42 of a 2000-line file. Instead of reading the entire file, it requests `lineRange: [35, 50]` — getting just 16 lines of context around the error. This preserves context budget for other operations.
@@ -0,0 +1,104 @@
1
+ # RISE-049: LSP Server Management
2
+
3
+ > RISE Framework Specification — Borrowed from OpenCode for mia-code
4
+ > Document: rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md
5
+
6
+ ## Creative Intent
7
+
8
+ mia-code gains deep code intelligence by managing multiple Language Server Protocol servers. An agent working across a polyglot monorepo — TypeScript frontend, Python ML pipeline, Rust core — gets type-aware understanding from each language's LSP server without reading entire codebases. The developer configures once; mia-code orchestrates the lifecycle of every server, starting them lazily, restarting them on crash, and shutting them down cleanly when the session ends.
9
+
10
+ ## Structural Tension Analysis
11
+
12
+ **Current Reality:**
13
+ - mia-code has no LSP integration — agents rely on text-based grep/glob for code understanding
14
+ - Type information is invisible: the agent cannot know that `foo.bar()` returns a `Promise<User[]>` without reading source
15
+ - Code navigation requires manual file reading — "go to definition" means grepping for function names
16
+ - Each agent turn that needs type context must read and parse files, consuming tokens and time
17
+ - No awareness of compilation errors until the agent runs `tsc` or `cargo check` explicitly
18
+ - The three-world model (miaco/miatel/miawa) has MCP servers but no language-aware intelligence layer
19
+
20
+ **Desired State:**
21
+ - mia-code manages LSP servers as first-class infrastructure alongside MCP servers
22
+ - Each supported language has a registered LSP server with spawn command, file extension mapping, and root detection
23
+ - Servers start lazily on first access to a relevant file — no upfront cost for unused languages
24
+ - Multiple LSP servers run simultaneously for polyglot projects
25
+ - Server health is monitored: crashed servers restart automatically with backoff
26
+ - Configuration lives in `mia-code.json` alongside existing MCP server definitions
27
+
28
+ ## Desired Outcome Definition
29
+
30
+ A developer opens a session in a project containing TypeScript and Python files. When the agent first accesses a `.ts` file, mia-code spawns `typescript-language-server --stdio`, connects via JSON-RPC, and initializes the workspace. When the agent later touches a `.py` file, `pyright` starts alongside. Both servers run concurrently, providing type information to their respective file types. If `pyright` crashes, mia-code restarts it within seconds. When the session ends, both servers receive shutdown signals and exit cleanly.
31
+
32
+ ## Natural Language Functional Description
33
+
34
+ ### Server Registry
35
+
36
+ Each LSP server is defined by a registration object:
37
+
38
+ - **id**: unique identifier (e.g., `"typescript"`, `"python"`, `"rust"`)
39
+ - **extensions**: file extensions this server handles (e.g., `[".ts", ".tsx", ".js", ".jsx"]`)
40
+ - **rootDetection**: function that walks up from a file path looking for marker files (e.g., `tsconfig.json`)
41
+ - **command**: spawn command as array (e.g., `["typescript-language-server", "--stdio"]`)
42
+ - **initializationOptions**: optional LSP initialization parameters
43
+
44
+ Built-in server definitions cover: TypeScript/JavaScript (tsserver via typescript-language-server), Python (pyright), Rust (rust-analyzer), Go (gopls), Java (jdtls), C/C++ (clangd). Custom servers are added via configuration.
45
+
46
+ ### Lifecycle Management
47
+
48
+ **Lazy Start:** No LSP server starts at session begin. When a tool accesses a file with extension `.ts`, mia-code checks the registry, finds the TypeScript server definition, detects the project root (nearest `tsconfig.json`), and spawns the process. The server remains running for subsequent requests.
49
+
50
+ **Health Monitoring:** A heartbeat check runs every 30 seconds. If a server process has exited unexpectedly, mia-code logs the event and schedules a restart. Restart uses exponential backoff: 1s, 2s, 4s, up to 30s maximum. After 5 consecutive failures, the server is marked as failed and requires manual intervention.
51
+
52
+ **Graceful Shutdown:** On session end, each running LSP server receives a `shutdown` request followed by an `exit` notification per the LSP protocol. A 5-second timeout ensures hung servers are force-killed.
53
+
54
+ ### Configuration
55
+
56
+ Server configuration in `mia-code.json`:
57
+
58
+ ```json
59
+ {
60
+ "lsp": {
61
+ "typescript": {
62
+ "enabled": true,
63
+ "command": ["typescript-language-server", "--stdio"],
64
+ "extensions": [".ts", ".tsx", ".js", ".jsx"]
65
+ },
66
+ "python": {
67
+ "enabled": true,
68
+ "command": ["pyright-langserver", "--stdio"]
69
+ },
70
+ "custom-server": {
71
+ "enabled": true,
72
+ "command": ["my-lsp", "--mode", "stdio"],
73
+ "extensions": [".myext"],
74
+ "rootMarkers": ["my-project.json"]
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### Communication
81
+
82
+ All LSP servers communicate via JSON-RPC 2.0 over stdio (stdin/stdout). mia-code maintains a JSON-RPC client per server that handles request/response correlation, notification dispatch, and protocol error handling. Stderr from each server is captured and routed to structured logging.
83
+
84
+ ## Supporting Structures
85
+
86
+ - **Event Bus (RISE-002)** publishes `lsp.started`, `lsp.stopped`, `lsp.crashed`, `lsp.restarted` events
87
+ - **Lazy Initialization (RISE-008)** provides the pattern for deferred server spawning
88
+ - **Structured Logging (RISE-007)** captures LSP communication traces at debug level
89
+ - **Instance State (RISE-003)** scopes LSP server instances per project workspace
90
+ - **LSP Root Detection (RISE-052)** determines workspace roots for server initialization
91
+
92
+ ## Creative Advancement Scenarios
93
+
94
+ **Scenario 1 — Polyglot Monorepo:**
95
+ A developer works in a repo with `packages/web` (TypeScript), `services/ml` (Python), and `core/engine` (Rust). The agent edits across all three. Three LSP servers run simultaneously, each rooted at the appropriate subdirectory. The agent gets hover information in TypeScript, completion in Python, and diagnostics in Rust — all in the same session.
96
+
97
+ **Scenario 2 — Crash Recovery:**
98
+ The rust-analyzer process segfaults while indexing a large workspace. mia-code detects the exit, logs the crash with stderr output, waits 1 second, and restarts the server. The agent's next Rust file access works seamlessly — the brief interruption is invisible.
99
+
100
+ **Scenario 3 — Custom Language Server:**
101
+ A team uses an internal DSL with a custom LSP server. They add a `"dsl"` entry to `mia-code.json` with the server command and file extensions. mia-code treats it identically to built-in servers — lazy start, health monitoring, graceful shutdown. The agent gets type information for `.dsl` files without any code changes to mia-code itself.
102
+
103
+ **Scenario 4 — Resource-Constrained Environment:**
104
+ On a CI server with limited RAM, a developer disables Python and Rust LSP servers in config, keeping only TypeScript. mia-code respects the `"enabled": false` flags and never spawns those processes. The TypeScript server starts only when needed, minimizing resource usage.
@@ -0,0 +1,102 @@
1
+ # RISE-050: LSP Hover and Completion
2
+
3
+ > RISE Framework Specification — Borrowed from OpenCode for mia-code
4
+ > Document: rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md
5
+
6
+ ## Creative Intent
7
+
8
+ mia-code exposes LSP hover and completion as agent-accessible tools, giving agents type-aware understanding of code without reading entire codebases. An agent editing a TypeScript file can ask "what type does this variable have?" or "what methods are available on this object?" and receive precise answers from the language server. The agent writes better code because it sees the same type information a human developer sees in their IDE.
9
+
10
+ ## Structural Tension Analysis
11
+
12
+ **Current Reality:**
13
+ - Agents infer types by reading source files, consuming tokens and often guessing wrong
14
+ - No way to ask "what is the type of `response` at line 42?" without reading the full file and its imports
15
+ - Method discovery requires reading class definitions, interface files, and type declaration files
16
+ - Completion suggestions are nonexistent — agents guess method names from memory or grep results
17
+ - An agent editing a function has no way to know the return type of a called function without tracing through source
18
+ - Token budgets are wasted on reading `.d.ts` files and tracing import chains for type context
19
+
20
+ **Desired State:**
21
+ - A `lsp` tool is available to agents with `hover` and `completion` actions
22
+ - Hover returns precise type signatures, documentation, and definition locations for any position in any file
23
+ - Completion returns ranked suggestions with kind labels (method, property, class, variable)
24
+ - Agents interact with LSP capabilities through the same tool interface as any other mia-code tool
25
+ - Type queries are cheap: a single JSON-RPC call replaces reading multiple files
26
+
27
+ ## Desired Outcome Definition
28
+
29
+ An agent working on a TypeScript file calls the `lsp` tool with `{action: "hover", file: "src/api/users.ts", line: 42, character: 15}` and receives back `{type: "(method) UserService.findByEmail(email: string): Promise<User | null>", documentation: "Find a user by their email address. Returns null if not found.", definition: "src/services/user.service.ts:87:3"}`. The agent now knows the return type without reading the service file.
30
+
31
+ ## Natural Language Functional Description
32
+
33
+ ### Hover Action
34
+
35
+ The hover action sends a `textDocument/hover` LSP request for the specified file and position.
36
+
37
+ **Input:**
38
+ ```json
39
+ {
40
+ "action": "hover",
41
+ "file": "src/api/users.ts",
42
+ "line": 42,
43
+ "character": 15
44
+ }
45
+ ```
46
+
47
+ **Processing:**
48
+ 1. Resolve the file path to an absolute URI
49
+ 2. Identify the appropriate LSP server from the file extension (RISE-049)
50
+ 3. Ensure the server is running (lazy-start if needed)
51
+ 4. Send `textDocument/hover` with the position
52
+ 5. Optionally send `textDocument/definition` for the definition location
53
+ 6. Format the response for agent consumption
54
+
55
+ **Output:**
56
+ ```json
57
+ {
58
+ "type": "(method) UserService.findByEmail(email: string): Promise<User | null>",
59
+ "documentation": "Find a user by their email address. Returns null if not found.",
60
+ "definition": {
61
+ "file": "src/services/user.service.ts",
62
+ "line": 87,
63
+ "character": 3
64
+ }
65
+ }
66
+ ```
67
+
68
+ If no hover information is available at the position, the tool returns `{type: null, message: "No type information available at this position"}`.
69
+
70
+ ### Completion Action
71
+
72
+ The completion action sends a `textDocument/completion` LSP request.
73
+
74
+ **Input:** `{action: "completion", file: "src/api/users.ts", line: 42, character: 15}`. Processing: resolve file path, sync document state, send `textDocument/completion`, sort by relevance, limit to top 20, map kinds to labels.
75
+
76
+ **Output:** sorted list of items with `label`, `kind` (method/property/class), `detail` (type signature), and `insertText` (snippet).
77
+
78
+ ### Document Synchronization and Error Handling
79
+
80
+ The tool manages document state with the LSP server. On first access, a `textDocument/didOpen` notification is sent; subsequent modifications trigger `textDocument/didChange`. If no LSP server is configured for the file type, the tool returns an error listing available servers. If the server is still initializing, requests wait up to 10 seconds before timing out.
81
+
82
+ ## Supporting Structures
83
+
84
+ - **LSP Server Management (RISE-049)** provides server lifecycle and communication
85
+ - **LSP Root Detection (RISE-052)** ensures the server is initialized with the correct workspace
86
+ - **File Read/Write Tools (RISE-048)** coordinate document synchronization on file changes
87
+ - **Agent Permission Rulesets (RISE-011)** govern which files the agent can query
88
+ - **LSP Diagnostics (RISE-051)** complements hover/completion with error information
89
+
90
+ ## Creative Advancement Scenarios
91
+
92
+ **Scenario 1 — Type-Aware Editing:**
93
+ An agent is asked to add error handling to a function. It hovers over the function's return value and discovers it returns `Result<Data, ApiError>`. It hovers over `ApiError` and finds it's a union type with variants. The agent writes a proper match/switch covering all error variants — something it couldn't do by reading only the current file.
94
+
95
+ **Scenario 2 — Method Discovery:**
96
+ An agent needs to filter a list but doesn't know the exact API. It requests completion on the array variable and sees `filter`, `find`, `findIndex`, `some`, `every` with their signatures. It picks the right method with the correct parameter types on the first try.
97
+
98
+ **Scenario 3 — Cross-File Understanding:**
99
+ An agent is reviewing a Python file that calls `db.session.query(User).filter_by(email=email).first()`. It hovers over `.first()` and learns it returns `Optional[User]`. It hovers over `filter_by` and sees the signature. No need to read SQLAlchemy source — the type information is immediate.
100
+
101
+ **Scenario 4 — Verifying Edits:**
102
+ After writing a new function call, the agent hovers over the call site to verify the types match. The hover shows `Argument of type 'number' is not assignable to parameter of type 'string'` — the agent catches its own mistake before any build step.
@@ -0,0 +1,86 @@
1
+ # RISE-051: LSP Diagnostics
2
+
3
+ > RISE Framework Specification — Borrowed from OpenCode for mia-code
4
+ > Document: rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md
5
+
6
+ ## Creative Intent
7
+
8
+ mia-code provides real-time code diagnostics from LSP servers to agents, enabling a self-correcting edit cycle. After every file modification, the agent can see type errors, missing imports, and warnings — the same feedback loop a human gets from red squiggly lines in their editor. The agent no longer waits for a full build to discover mistakes; it catches them at the speed of thought.
9
+
10
+ ## Structural Tension Analysis
11
+
12
+ **Current Reality:**
13
+ - Agents discover errors only by running build commands (`tsc`, `cargo check`, `pytest`)
14
+ - A full build cycle can take 30+ seconds, wasting time on errors a type checker catches instantly
15
+ - Build output is unstructured text that must be parsed to extract file, line, and error message
16
+ - No automatic feedback after file writes — the agent must explicitly decide to check for errors
17
+ - Warning-level issues (unused variables, deprecated APIs) are invisible until a linter is run
18
+ - Multiple edit-build-fix cycles consume agent turns and tokens for problems LSP solves in milliseconds
19
+
20
+ **Desired State:**
21
+ - After any file modification, diagnostics are collected automatically from active LSP servers
22
+ - A `diagnostics` tool returns structured error/warning/info/hint data for any file or the entire project
23
+ - Auto-diagnostic mode: file write tools automatically check diagnostics and report issues inline
24
+ - Diagnostic counts are visible in session status, giving the agent ambient awareness of code health
25
+ - The agent self-corrects based on immediate LSP feedback without running builds
26
+
27
+ ## Desired Outcome Definition
28
+
29
+ An agent writes a TypeScript file with a type error. Within 500ms, the LSP server publishes diagnostics. The agent calls the diagnostics tool and receives a structured list: file path, line range, severity, message, and source server. The agent fixes the error and calls diagnostics again — zero errors. No build command was ever run.
30
+
31
+ ## Natural Language Functional Description
32
+
33
+ ### Diagnostics Tool
34
+
35
+ **Input:** `{action: "diagnostics"}` for all files, or `{action: "diagnostics", file: "src/api/users.ts"}` for a specific file.
36
+
37
+ **Output:** structured list of diagnostics, each containing:
38
+ - `file`: the file path with the issue
39
+ - `range`: start and end position (line/character)
40
+ - `severity`: error, warning, info, or hint
41
+ - `message`: human-readable diagnostic message
42
+ - `source`: which LSP server produced this diagnostic
43
+ - `code`: language-specific error code (e.g., `ts(2551)`)
44
+
45
+ Plus a summary object with counts per severity level and total files with issues.
46
+
47
+ ### Diagnostic Collection
48
+
49
+ mia-code listens for `textDocument/publishDiagnostics` notifications from all active LSP servers. These notifications arrive asynchronously after file changes. Diagnostics are stored in a per-file map, keyed by server ID to avoid cross-server conflicts.
50
+
51
+ When the diagnostics tool is called:
52
+ 1. If a specific file is requested, return diagnostics only for that file
53
+ 2. If no file is specified, return diagnostics across all files with issues
54
+ 3. Results are aggregated across all active LSP servers (TypeScript errors + ESLint warnings together)
55
+ 4. Diagnostics are sorted: errors first, then warnings, then info, then hints
56
+ 5. Within each severity, sorted by file path then line number
57
+
58
+ ### Auto-Diagnostic After File Write
59
+
60
+ When the file write tool (RISE-048) modifies a file, mia-code sends `textDocument/didChange` and waits up to 2 seconds for diagnostics. Errors are appended to the write output: `⚠ 1 error detected after write: ...`. Clean writes show `✓ No diagnostics issues detected`. This auto-check is configurable: `{"lsp": {"autoDiagnostics": true}}` (default: true).
61
+
62
+ ### Severity, Status, and Staleness
63
+
64
+ Severity levels: **error** (won't compile), **warning** (potential issues), **information** (suggestions), **hint** (style notes). The session status line shows diagnostic counts when issues exist. Diagnostics older than 30 seconds are marked as potentially stale. If no LSP server is active for a file type, the tool returns a clear notice.
65
+
66
+ ## Supporting Structures
67
+
68
+ - **LSP Server Management (RISE-049)** provides the server connections that publish diagnostics
69
+ - **LSP Hover/Completion (RISE-050)** complements diagnostics with type exploration
70
+ - **Event Bus (RISE-002)** publishes `lsp.diagnostics.updated` events when diagnostic state changes
71
+ - **File Read/Write Tools (RISE-048)** trigger document sync and auto-diagnostic checks
72
+ - **Structured Logging (RISE-007)** records diagnostic events for debugging
73
+
74
+ ## Creative Advancement Scenarios
75
+
76
+ **Scenario 1 — Self-Correcting Edit:**
77
+ An agent adds a new function call with a typo in a property name. The auto-diagnostic fires and reports `Property 'emial' does not exist on type 'User'. Did you mean 'email'?` inline with the write output. The agent immediately corrects the typo in its next tool call — no build step, no wasted turn.
78
+
79
+ **Scenario 2 — Multi-Language Diagnostics:**
80
+ An agent refactors a Python backend and TypeScript frontend simultaneously. After editing `api.py`, pyright reports a missing import. After editing `client.ts`, tsserver reports an incompatible type. The agent calls `diagnostics` with no file filter and sees both issues in one structured response, fixing them in order.
81
+
82
+ **Scenario 3 — Clean Verification:**
83
+ After completing a complex refactoring across 12 files, the agent calls the diagnostics tool. Zero errors, zero warnings. The agent reports to the user with confidence that the refactoring is type-safe — no need to run a full build.
84
+
85
+ **Scenario 4 — Warning Cleanup:**
86
+ A developer asks "clean up all warnings in this project." The agent calls diagnostics, receives 15 warnings across 8 files (unused imports, deprecated APIs, unnecessary type assertions). It systematically fixes each one, checking diagnostics after each file to confirm the warning is resolved.
@@ -0,0 +1,109 @@
1
+ # RISE-052: LSP Root Detection
2
+
3
+ > RISE Framework Specification — Borrowed from OpenCode for mia-code
4
+ > Document: rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md
5
+
6
+ ## Creative Intent
7
+
8
+ mia-code intelligently detects project roots for each LSP server, so language servers initialize with the correct workspace context. A monorepo with a TypeScript frontend at `packages/web` and a Python backend at `services/api` gets two separate roots — each language server sees only its relevant project tree. Root detection is automatic, cached, and overridable, ensuring LSP servers provide accurate results without manual configuration.
9
+
10
+ ## Structural Tension Analysis
11
+
12
+ **Current Reality:**
13
+ - mia-code sessions have a single project root (the directory where the session started)
14
+ - No mechanism to detect language-specific project boundaries within a larger workspace
15
+ - A TypeScript language server initialized at the monorepo root may miss nested `tsconfig.json` configurations
16
+ - Python LSP servers need the virtualenv root, which differs from the git root
17
+ - No caching: if root detection were added naively, it would walk the filesystem on every file access
18
+ - Monorepo projects with multiple package managers and build systems have no structured handling
19
+
20
+ **Desired State:**
21
+ - Each language has defined root markers (config files that indicate a project boundary)
22
+ - Root detection walks up from a file's location, finding the nearest marker
23
+ - Monorepo support: different files can resolve to different roots for the same language
24
+ - Detection results are cached per file extension to avoid repeated filesystem walks
25
+ - Explicit overrides in configuration allow developers to pin roots for specific languages
26
+ - Exclusion patterns prevent detection from crossing into `node_modules` or other non-project directories
27
+
28
+ ## Desired Outcome Definition
29
+
30
+ An agent accesses `packages/web/src/App.tsx` in a monorepo. Root detection walks up from `packages/web/src/` and finds `packages/web/tsconfig.json`. The TypeScript LSP server initializes with `packages/web` as its root, correctly resolving path aliases and dependencies. Later, the agent accesses `services/api/main.py`. Root detection finds `services/api/pyproject.toml` and initializes pyright with that root. Each server sees its own isolated project context.
31
+
32
+ ## Natural Language Functional Description
33
+
34
+ ### Root Markers Per Language
35
+
36
+ Each language defines an ordered list of root marker files. Detection stops at the first marker found while walking up:
37
+
38
+ | Language | Root Markers (priority order) |
39
+ |----------|-------------------------------|
40
+ | TypeScript/JavaScript | `tsconfig.json`, `jsconfig.json`, `package.json` |
41
+ | Python | `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt`, `Pipfile` |
42
+ | Rust | `Cargo.toml` |
43
+ | Go | `go.mod` |
44
+ | Java | `pom.xml`, `build.gradle`, `build.gradle.kts` |
45
+ | C/C++ | `CMakeLists.txt`, `compile_commands.json`, `Makefile` |
46
+
47
+ Custom languages define their markers in configuration via `rootMarkers` array.
48
+
49
+ ### Detection Algorithm
50
+
51
+ Given a file path (e.g., `/repo/packages/web/src/components/Button.tsx`):
52
+
53
+ 1. Determine the file extension → map to language → get root markers list
54
+ 2. Start at the file's parent directory (`/repo/packages/web/src/components/`)
55
+ 3. Check if any root marker file exists in this directory
56
+ 4. If found, return this directory as the root
57
+ 5. If not found, move to the parent directory
58
+ 6. Repeat until a root marker is found or a stop condition is met
59
+ 7. Stop conditions: reaching filesystem root, encountering `.git` directory (use this as fallback root), encountering an excluded directory
60
+
61
+ **Exclusion patterns:** The walk skips into but does not cross through: `node_modules`, `.git`, `vendor`, `__pycache__`, `.venv`, `venv`. These directories are never considered as potential roots.
62
+
63
+ ### Monorepo Support
64
+
65
+ Multiple roots per language are fully supported. In a monorepo:
66
+
67
+ ```
68
+ /repo
69
+ ├── packages/
70
+ │ ├── web/ ← tsconfig.json here → root for web TS files
71
+ │ │ └── src/
72
+ │ └── shared/ ← tsconfig.json here → root for shared TS files
73
+ │ └── src/
74
+ ├── services/
75
+ │ └── api/ ← pyproject.toml here → root for Python files
76
+ │ └── src/
77
+ └── package.json ← fallback root for JS files outside packages
78
+ ```
79
+
80
+ Files in `packages/web/src/` resolve to `packages/web/`. Files in `packages/shared/src/` resolve to `packages/shared/`. Each may initialize a separate LSP server instance, or the server may support multi-root workspaces (LSP `workspace/workspaceFolders`).
81
+
82
+ ### Caching Strategy
83
+
84
+ Root detection results are cached in a `filePath → detectedRoot` map, populated on first access and invalidated on config changes or root marker file creation/deletion. Directory-level caching ensures all files in a subtree reuse a resolved root without re-walking. The cache is not persisted across sessions.
85
+
86
+ ### Configuration Override and Fallback
87
+
88
+ Developers can pin roots in `mia-code.json`: `{"lsp": {"python": {"root": "./services/api"}, "typescript": {"roots": ["./packages/web", "./packages/shared"]}}}`. When configured, automatic detection is skipped. Paths are relative to `mia-code.json`. If no root marker is found, fallback order is: nearest `.git` parent → session project root → file's parent directory.
89
+
90
+ ## Supporting Structures
91
+
92
+ - **LSP Server Management (RISE-049)** uses detected roots for server initialization
93
+ - **Instance State (RISE-003)** provides the session's default project root as fallback
94
+ - **Structured Logging (RISE-007)** logs root detection decisions for debugging
95
+ - **Namespace Module Pattern (RISE-004)** organizes root detection as a pure utility module
96
+
97
+ ## Creative Advancement Scenarios
98
+
99
+ **Scenario 1 — Automatic Monorepo Handling:**
100
+ A developer opens a session at the root of a monorepo with 12 packages. As the agent works across packages, each file triggers root detection. The TypeScript server initializes with multi-root workspace folders for `packages/web` and `packages/shared`. Path aliases like `@shared/utils` resolve correctly because each root has its own `tsconfig.json`.
101
+
102
+ **Scenario 2 — Python Virtual Environment:**
103
+ A Python project has `pyproject.toml` at `/repo/backend/`. The agent accesses `backend/src/api/routes.py`. Root detection finds `pyproject.toml` and sets the root to `/repo/backend/`. Pyright initializes with the correct `pythonPath` from the project's `.venv`, resolving all imports correctly.
104
+
105
+ **Scenario 3 — Override for Non-Standard Layout:**
106
+ A project has its TypeScript config at an unusual path: `config/tsconfig.base.json` is the real root config, but `package.json` exists at the repo root. The developer adds `"typescript": {"root": "."}` to `mia-code.json` to pin the root, preventing detection from choosing a nested `package.json` in a subdirectory.
107
+
108
+ **Scenario 4 — New Project Bootstrap:**
109
+ An agent creates a new Rust project with `cargo init`. Root detection cache has no entry for `.rs` files in this directory. On the next Rust file access, detection walks up, finds the new `Cargo.toml`, caches the result, and initializes rust-analyzer at the correct root — all automatic, no configuration needed.