@geminilight/mindos 0.6.40 → 0.6.41

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 (287) hide show
  1. package/_standalone/.mindos-build-version +1 -1
  2. package/_standalone/.next/BUILD_ID +1 -1
  3. package/_standalone/.next/app-path-routes-manifest.json +18 -18
  4. package/_standalone/.next/build-manifest.json +3 -3
  5. package/_standalone/.next/cache/.previewinfo +1 -1
  6. package/_standalone/.next/cache/.rscinfo +1 -1
  7. package/_standalone/.next/cache/config.json +3 -3
  8. package/_standalone/.next/prerender-manifest.json +3 -3
  9. package/_standalone/.next/react-loadable-manifest.json +5 -1
  10. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  11. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/_standalone/.next/server/app/_global-error.html +2 -2
  13. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  14. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  21. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  25. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  26. package/_standalone/.next/server/app/agents/page.js +2 -2
  27. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  28. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  29. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  31. package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  32. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  37. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/ask/route.js +1 -1
  40. package/_standalone/.next/server/app/api/ask/route.js.nft.json +1 -1
  41. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  42. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  43. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  44. package/_standalone/.next/server/app/api/backlinks/route.js.nft.json +1 -1
  45. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  46. package/_standalone/.next/server/app/api/bootstrap/route.js.nft.json +1 -1
  47. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  48. package/_standalone/.next/server/app/api/changes/route.js.nft.json +1 -1
  49. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  50. package/_standalone/.next/server/app/api/export/route.js.nft.json +1 -1
  51. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  52. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/file/import/route.js.nft.json +1 -1
  54. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/file/route.js.nft.json +1 -1
  56. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  57. package/_standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  58. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  59. package/_standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  60. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  61. package/_standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
  62. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  63. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  64. package/_standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
  65. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  66. package/_standalone/.next/server/app/api/init/route.js.nft.json +1 -1
  67. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  68. package/_standalone/.next/server/app/api/mcp/agents/route.js.nft.json +1 -1
  69. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  70. package/_standalone/.next/server/app/api/mcp/install/route.js +1 -1
  71. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/mcp/install-skill/route.js.nft.json +1 -1
  73. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  75. package/_standalone/.next/server/app/api/mcp/status/route.js +1 -1
  76. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  77. package/_standalone/.next/server/app/api/monitoring/route.js.nft.json +1 -1
  78. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  79. package/_standalone/.next/server/app/api/recent-files/route.js.nft.json +1 -1
  80. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  81. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  82. package/_standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  83. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  84. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  85. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  86. package/_standalone/.next/server/app/api/settings/route.js.nft.json +1 -1
  87. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  88. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  89. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  90. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  91. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  92. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  94. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  95. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  96. package/_standalone/.next/server/app/api/tree-version/route.js.nft.json +1 -1
  97. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  98. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  99. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  100. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  101. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  102. package/_standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
  103. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  104. package/_standalone/.next/server/app/changes/page.js +1 -1
  105. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  106. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  108. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  109. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app/echo/page.js +1 -1
  111. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  112. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  113. package/_standalone/.next/server/app/explore/page.js +1 -1
  114. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  115. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  116. package/_standalone/.next/server/app/help/page.js +2 -2
  117. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  118. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  119. package/_standalone/.next/server/app/login/page.js +1 -1
  120. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  121. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  122. package/_standalone/.next/server/app/page.js +2 -2
  123. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  124. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  125. package/_standalone/.next/server/app/setup/page.js +2 -2
  126. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  127. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  128. package/_standalone/.next/server/app/trash/page.js +3 -3
  129. package/_standalone/.next/server/app/trash/page.js.nft.json +1 -1
  130. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  131. package/_standalone/.next/server/app/view/[...path]/page.js +3 -3
  132. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  133. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  134. package/_standalone/.next/server/app-paths-manifest.json +18 -18
  135. package/_standalone/.next/server/chunks/1550.js +1 -1
  136. package/_standalone/.next/server/chunks/2190.js +11 -0
  137. package/_standalone/.next/server/chunks/{6365.js → 2536.js} +2 -2
  138. package/_standalone/.next/server/chunks/5648.js +2 -0
  139. package/_standalone/.next/server/chunks/8388.js +1 -1
  140. package/_standalone/.next/server/chunks/953.js +1 -1
  141. package/_standalone/.next/server/chunks/9539.js +219 -0
  142. package/_standalone/.next/server/middleware-build-manifest.js +1 -1
  143. package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  144. package/_standalone/.next/server/next-font-manifest.js +1 -1
  145. package/_standalone/.next/server/next-font-manifest.json +1 -1
  146. package/_standalone/.next/server/pages/500.html +2 -2
  147. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  148. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  149. package/_standalone/.next/static/chunks/1053-b70535785cc5aaee.js +29 -0
  150. package/_standalone/.next/static/chunks/{8663-de911d2d395622be.js → 1880-c2a9e76201841c86.js} +1 -1
  151. package/_standalone/.next/static/chunks/3637.0541ac2d0ea7de1f.js +1 -0
  152. package/_standalone/.next/static/chunks/4563-b2a2ce80aff845af.js +6 -0
  153. package/_standalone/.next/static/chunks/6981-3d7dcac2d12a5670.js +1 -0
  154. package/_standalone/.next/static/chunks/7144-5febf62f1a79fe64.js +1 -0
  155. package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-773071a99c4daac2.js +1 -0
  156. package/_standalone/.next/static/chunks/app/agents/page-6102a884b2cb3cfe.js +5 -0
  157. package/_standalone/.next/static/chunks/app/help/page-2325d25b6846ca07.js +1 -0
  158. package/_standalone/.next/static/chunks/app/{layout-9378c1c8d3e5761b.js → layout-42cdbce19f404567.js} +34 -34
  159. package/_standalone/.next/static/chunks/app/{page-9bae420fbbdc5fff.js → page-8c9643b649e01735.js} +1 -1
  160. package/_standalone/.next/static/chunks/app/setup/page-d158b8cb533feb1e.js +1 -0
  161. package/_standalone/.next/static/chunks/app/trash/{page-b61ef2d5cd4f8d73.js → page-e9ab74ffeb96af41.js} +1 -1
  162. package/_standalone/.next/static/chunks/app/view/[...path]/page-764a69a1c8bd4eef.js +12 -0
  163. package/_standalone/.next/static/chunks/{webpack-c28c55d0a6021a6b.js → webpack-7b276daaa930d480.js} +1 -1
  164. package/_standalone/.next/static/css/bc9179074eaf65ae.css +1 -0
  165. package/_standalone/.next/trace +63 -63
  166. package/_standalone/__tests__/api/mcp-install.test.ts +23 -0
  167. package/_standalone/__tests__/cli/agent-routing.test.ts +232 -0
  168. package/_standalone/__tests__/cli/file-subcommands.test.ts +379 -0
  169. package/_standalone/__tests__/core/tools.test.ts +3 -6
  170. package/_standalone/components/FileTree.tsx +3 -2
  171. package/_standalone/components/MarkdownView.tsx +30 -15
  172. package/_standalone/components/RightAskPanel.tsx +36 -6
  173. package/_standalone/components/Sidebar.tsx +3 -3
  174. package/_standalone/components/agents/AgentsMcpSection.tsx +3 -0
  175. package/_standalone/components/settings/McpAgentInstall.tsx +94 -27
  176. package/_standalone/components/settings/McpSkillsSection.tsx +1 -1
  177. package/_standalone/components/settings/McpTab.tsx +484 -340
  178. package/_standalone/components/settings/SettingsContent.tsx +12 -6
  179. package/_standalone/components/settings/types.ts +3 -0
  180. package/_standalone/components/setup/StepAgents.tsx +113 -47
  181. package/_standalone/components/setup/StepReview.tsx +14 -27
  182. package/_standalone/components/setup/types.ts +6 -0
  183. package/_standalone/data/skills/mindos/SKILL.md +92 -92
  184. package/_standalone/data/skills/mindos/references/write-supplement.md +119 -0
  185. package/_standalone/data/skills/mindos-zh/SKILL.md +100 -104
  186. package/_standalone/data/skills/mindos-zh/references/write-supplement.md +119 -0
  187. package/_standalone/lib/i18n/modules/features.ts +4 -4
  188. package/_standalone/lib/i18n/modules/knowledge.ts +4 -0
  189. package/_standalone/lib/i18n/modules/onboarding.ts +40 -30
  190. package/_standalone/lib/i18n/modules/settings.ts +78 -6
  191. package/_standalone/lib/mcp-snippets.ts +5 -1
  192. package/_standalone/tsconfig.tsbuildinfo +1 -1
  193. package/app/app/api/ask/route.ts +3 -2
  194. package/app/app/api/mcp/install/route.ts +2 -1
  195. package/app/app/api/mcp/status/route.ts +14 -6
  196. package/app/app/view/[...path]/ViewPageClient.tsx +12 -27
  197. package/app/components/FileTree.tsx +3 -2
  198. package/app/components/MarkdownView.tsx +30 -15
  199. package/app/components/RightAskPanel.tsx +36 -6
  200. package/app/components/Sidebar.tsx +3 -3
  201. package/app/components/agents/AgentsMcpSection.tsx +3 -0
  202. package/app/components/help/HelpContent.tsx +1 -0
  203. package/app/components/settings/McpAgentInstall.tsx +94 -27
  204. package/app/components/settings/McpSkillsSection.tsx +1 -1
  205. package/app/components/settings/McpTab.tsx +484 -340
  206. package/app/components/settings/SettingsContent.tsx +12 -6
  207. package/app/components/settings/types.ts +3 -0
  208. package/app/components/setup/StepAgents.tsx +113 -47
  209. package/app/components/setup/StepReview.tsx +14 -27
  210. package/app/components/setup/index.tsx +12 -11
  211. package/app/components/setup/types.ts +6 -0
  212. package/app/data/skills/mindos/SKILL.md +92 -92
  213. package/app/data/skills/mindos/references/write-supplement.md +119 -0
  214. package/app/data/skills/mindos-zh/SKILL.md +100 -104
  215. package/app/data/skills/mindos-zh/references/write-supplement.md +119 -0
  216. package/app/lib/fs.ts +0 -6
  217. package/app/lib/i18n/modules/features.ts +4 -4
  218. package/app/lib/i18n/modules/knowledge.ts +4 -0
  219. package/app/lib/i18n/modules/onboarding.ts +40 -30
  220. package/app/lib/i18n/modules/settings.ts +78 -6
  221. package/app/lib/mcp-agents.ts +1 -2
  222. package/app/lib/mcp-snippets.ts +5 -1
  223. package/app/lib/renderers/index.ts +2 -1
  224. package/bin/cli.js +168 -1404
  225. package/bin/commands/agent.js +156 -20
  226. package/bin/commands/api.js +14 -11
  227. package/bin/commands/ask.js +79 -68
  228. package/bin/commands/build.js +26 -0
  229. package/bin/commands/config.js +170 -0
  230. package/bin/commands/dev.js +58 -0
  231. package/bin/commands/doctor.js +205 -0
  232. package/bin/commands/file.js +551 -36
  233. package/bin/commands/gateway.js +42 -0
  234. package/bin/commands/init-skills.js +56 -0
  235. package/bin/commands/logs.js +32 -0
  236. package/bin/commands/mcp-cmd.js +57 -0
  237. package/bin/commands/onboard.js +25 -0
  238. package/bin/commands/open.js +41 -0
  239. package/bin/commands/restart.js +48 -0
  240. package/bin/commands/search.js +16 -14
  241. package/bin/commands/space.js +96 -25
  242. package/bin/commands/start.js +262 -0
  243. package/bin/commands/status.js +2 -2
  244. package/bin/commands/stop.js +14 -0
  245. package/bin/commands/sync-cmd.js +134 -0
  246. package/bin/commands/token.js +98 -0
  247. package/bin/commands/uninstall.js +154 -0
  248. package/bin/commands/update.js +286 -0
  249. package/bin/lib/build.js +1 -1
  250. package/bin/lib/colors.js +8 -7
  251. package/bin/lib/command.js +37 -96
  252. package/bin/lib/config.js +5 -0
  253. package/bin/lib/csv.js +19 -0
  254. package/bin/lib/jsonc.js +12 -0
  255. package/bin/lib/markdown.js +69 -0
  256. package/bin/lib/mcp-agents.js +1 -6
  257. package/bin/lib/mcp-build.js +1 -1
  258. package/bin/lib/mcp-install.js +2 -1
  259. package/bin/lib/one-shot.js +88 -0
  260. package/bin/lib/path-expand.js +9 -0
  261. package/bin/lib/remote.js +65 -0
  262. package/bin/lib/repl.js +167 -0
  263. package/bin/lib/{utils.js → shell.js} +10 -26
  264. package/bin/lib/skill-check.js +1 -1
  265. package/bin/lib/sse-stream.js +167 -0
  266. package/package.json +2 -2
  267. package/scripts/setup.js +182 -120
  268. package/skills/mindos/SKILL.md +92 -92
  269. package/skills/mindos-zh/SKILL.md +100 -104
  270. package/_standalone/.next/server/chunks/1955.js +0 -11
  271. package/_standalone/.next/server/chunks/3680.js +0 -1
  272. package/_standalone/.next/server/chunks/4497.js +0 -219
  273. package/_standalone/.next/server/chunks/5560.js +0 -2
  274. package/_standalone/.next/static/chunks/1053-0adaccc98a752a58.js +0 -29
  275. package/_standalone/.next/static/chunks/3637.f9a42cca59fd5bb5.js +0 -1
  276. package/_standalone/.next/static/chunks/4563-c2afaeacb241d1d0.js +0 -6
  277. package/_standalone/.next/static/chunks/6090-c98268ca726a68d3.js +0 -1
  278. package/_standalone/.next/static/chunks/9371-575600301da5d6bb.js +0 -1
  279. package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-3e08abb495ecd5fd.js +0 -1
  280. package/_standalone/.next/static/chunks/app/agents/page-e7e0f87ad3d765ac.js +0 -5
  281. package/_standalone/.next/static/chunks/app/help/page-3d0e1ceaa4abc243.js +0 -1
  282. package/_standalone/.next/static/chunks/app/setup/page-99ed3d1bb6b8f4ef.js +0 -1
  283. package/_standalone/.next/static/chunks/app/view/[...path]/page-44fa78cbea613a78.js +0 -12
  284. package/_standalone/.next/static/css/d300701f384db50d.css +0 -1
  285. package/_standalone/components/renderers/agent-inspector/manifest.ts +0 -16
  286. /package/_standalone/.next/static/{rZLs1krFuduixvcVNe6q3 → Ij3PFh-a0zi5K_ANoSAW0}/_buildManifest.js +0 -0
  287. /package/_standalone/.next/static/{rZLs1krFuduixvcVNe6q3 → Ij3PFh-a0zi5K_ANoSAW0}/_ssgManifest.js +0 -0
@@ -0,0 +1,88 @@
1
+ /**
2
+ * One-shot (non-interactive) execution for CLI agent/chat commands.
3
+ *
4
+ * Counterpart to lib/repl.js (interactive mode).
5
+ * Shared between `mindos agent -p` and `mindos ask -p`.
6
+ */
7
+
8
+ import { dim, red } from './colors.js';
9
+ import { streamSSE, postAsk, checkHealth } from './sse-stream.js';
10
+ import { EXIT } from './command.js';
11
+
12
+ /**
13
+ * Execute a single AI request, stream the response, and exit.
14
+ *
15
+ * @param {object} opts
16
+ * @param {string} opts.baseUrl - e.g. http://localhost:3456
17
+ * @param {string} opts.token - auth token
18
+ * @param {string} opts.message - user message / task
19
+ * @param {'agent'|'chat'} opts.mode
20
+ * @param {boolean} [opts.showTools=false] - show tool calls in output
21
+ * @param {number} [opts.maxSteps] - max agent steps
22
+ * @param {string[]} [opts.attachedFiles] - file attachments
23
+ * @param {boolean} [opts.json=false] - output as JSON
24
+ */
25
+ export async function executeOneShot(opts) {
26
+ const {
27
+ baseUrl, token, message, mode,
28
+ showTools = false,
29
+ maxSteps,
30
+ attachedFiles,
31
+ json = false,
32
+ } = opts;
33
+
34
+ const healthy = await checkHealth(baseUrl);
35
+ if (!healthy) {
36
+ console.error(red('MindOS is not running. Start it with: mindos start'));
37
+ process.exit(EXIT.CONNECT);
38
+ }
39
+
40
+ if (!json) {
41
+ process.stdout.write(dim('Thinking...'));
42
+ }
43
+
44
+ const body = {
45
+ messages: [{ role: 'user', content: message, timestamp: Date.now() }],
46
+ mode,
47
+ };
48
+ if (attachedFiles) body.attachedFiles = attachedFiles;
49
+ if (maxSteps) body.maxSteps = maxSteps;
50
+
51
+ try {
52
+ const res = await postAsk(baseUrl, body, token);
53
+
54
+ if (!res.ok) {
55
+ const errText = await res.text();
56
+ if (!json) process.stdout.write('\r\x1b[K');
57
+ console.error(red(`API error (${res.status}): ${errText}`));
58
+ process.exit(EXIT.ERROR);
59
+ }
60
+
61
+ const contentType = res.headers.get('content-type') || '';
62
+
63
+ if (contentType.includes('text/event-stream')) {
64
+ const result = await streamSSE(res, { showTools, json });
65
+
66
+ if (json) {
67
+ const out = { answer: result.text, error: result.error || undefined };
68
+ if (showTools) out.toolCalls = result.toolCalls;
69
+ console.log(JSON.stringify(out, null, 2));
70
+ }
71
+
72
+ if (result.error) process.exit(EXIT.ERROR);
73
+ } else {
74
+ const data = await res.json();
75
+ if (!json) process.stdout.write('\r\x1b[K');
76
+
77
+ if (json) {
78
+ console.log(JSON.stringify(data, null, 2));
79
+ } else {
80
+ console.log(data.answer || data.text || JSON.stringify(data, null, 2));
81
+ }
82
+ }
83
+ } catch (err) {
84
+ if (!json) process.stdout.write('\r\x1b[K');
85
+ console.error(red(err.message));
86
+ process.exit(EXIT.ERROR);
87
+ }
88
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Path expansion — resolve `~/...` to absolute paths.
3
+ */
4
+
5
+ import { resolve } from 'node:path';
6
+ import { homedir } from 'node:os';
7
+
8
+ export const expandHome = (p) =>
9
+ p.startsWith('~/') ? resolve(homedir(), p.slice(2)) : p;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Remote-mode HTTP helpers for MindOS CLI.
3
+ *
4
+ * When MINDOS_URL is set to a non-localhost address, CLI commands should
5
+ * use these helpers to make HTTP API calls instead of direct fs operations.
6
+ */
7
+
8
+ /**
9
+ * Check if CLI is operating in remote mode.
10
+ * Remote = MINDOS_URL is set and not pointing to localhost/127.0.0.1.
11
+ */
12
+ export function isRemoteMode() {
13
+ const url = process.env.MINDOS_URL;
14
+ if (!url) return false;
15
+ try {
16
+ const parsed = new URL(url);
17
+ const host = parsed.hostname;
18
+ return host !== 'localhost' && host !== '127.0.0.1' && host !== '::1' && host !== '0.0.0.0';
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Get the base URL for API calls.
26
+ * In remote mode: MINDOS_URL
27
+ * In local mode: http://localhost:<MINDOS_WEB_PORT || 3456>
28
+ */
29
+ export function getBaseUrl() {
30
+ if (process.env.MINDOS_URL) return process.env.MINDOS_URL.replace(/\/$/, '');
31
+ const port = process.env.MINDOS_WEB_PORT || '3456';
32
+ return `http://localhost:${port}`;
33
+ }
34
+
35
+ /**
36
+ * Build headers with auth token if available.
37
+ */
38
+ export function getAuthHeaders() {
39
+ const headers = { 'Content-Type': 'application/json' };
40
+ const token = process.env.AUTH_TOKEN || process.env.MINDOS_AUTH_TOKEN;
41
+ if (token) headers['Authorization'] = `Bearer ${token}`;
42
+ return headers;
43
+ }
44
+
45
+ /**
46
+ * Make an authenticated API call to the MindOS backend.
47
+ * @param {string} path - API path (e.g. '/api/file')
48
+ * @param {object} [options] - fetch options (method, body, etc.)
49
+ * @returns {Promise<Response>}
50
+ */
51
+ export async function apiCall(path, options = {}) {
52
+ const url = `${getBaseUrl()}${path}`;
53
+ const headers = { ...getAuthHeaders(), ...options.headers };
54
+ const res = await fetch(url, { ...options, headers });
55
+ if (!res.ok) {
56
+ const text = await res.text().catch(() => '');
57
+ const hint = res.status === 401
58
+ ? ' (check AUTH_TOKEN — run `mindos token` on the server)'
59
+ : res.status === 404
60
+ ? ' (is MindOS running? try `mindos start`)'
61
+ : '';
62
+ throw new Error(`API ${res.status}: ${text || res.statusText}${hint}`);
63
+ }
64
+ return res;
65
+ }
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Interactive REPL for CLI agent/chat sessions.
3
+ *
4
+ * Provides a multi-turn conversation loop with SSE streaming.
5
+ * Shared between `mindos agent` and `mindos ask` commands.
6
+ */
7
+
8
+ import * as readline from 'node:readline';
9
+ import { bold, dim, cyan, red } from './colors.js';
10
+ import { streamSSE, postAsk, checkHealth } from './sse-stream.js';
11
+ import { EXIT } from './command.js';
12
+
13
+ /**
14
+ * @param {object} opts
15
+ * @param {string} opts.baseUrl - e.g. http://localhost:3456
16
+ * @param {string} opts.token - auth token
17
+ * @param {'agent'|'chat'} opts.mode
18
+ * @param {string} opts.prompt - readline prompt string (e.g. "agent> ")
19
+ * @param {string} opts.welcome - welcome message shown on start
20
+ * @param {boolean} opts.showTools - show tool calls in output
21
+ * @param {string[]} [opts.attachedFiles] - initial file attachments
22
+ * @param {number} [opts.maxSteps] - max agent steps per turn
23
+ */
24
+ export async function startRepl(opts) {
25
+ const {
26
+ baseUrl, token, mode, prompt, welcome,
27
+ showTools = true,
28
+ attachedFiles,
29
+ maxSteps,
30
+ } = opts;
31
+
32
+ const healthy = await checkHealth(baseUrl);
33
+ if (!healthy) {
34
+ console.error(red('\n MindOS is not running. Start it with: mindos start\n'));
35
+ process.exit(EXIT.CONNECT);
36
+ }
37
+
38
+ console.log(`\n ${welcome}`);
39
+ console.log(` ${dim('Type "exit" or press Ctrl+C to quit.')}\n`);
40
+
41
+ const messages = [];
42
+ let busy = false;
43
+ let exiting = false;
44
+
45
+ const rl = readline.createInterface({
46
+ input: process.stdin,
47
+ output: process.stdout,
48
+ prompt: cyan(prompt),
49
+ terminal: true,
50
+ });
51
+
52
+ rl.prompt();
53
+
54
+ rl.on('line', async (line) => {
55
+ const input = line.trim();
56
+
57
+ if (!input) {
58
+ rl.prompt();
59
+ return;
60
+ }
61
+
62
+ if (input === 'exit' || input === 'quit' || input === '/exit' || input === '/quit') {
63
+ exitGracefully();
64
+ return;
65
+ }
66
+
67
+ if (input === '/clear') {
68
+ messages.length = 0;
69
+ console.log(dim(' Conversation cleared.\n'));
70
+ rl.prompt();
71
+ return;
72
+ }
73
+
74
+ // Prevent concurrent requests — queue is dropped, user gets feedback
75
+ if (busy) {
76
+ console.log(dim(' Still processing previous message. Please wait.\n'));
77
+ return;
78
+ }
79
+
80
+ busy = true;
81
+ messages.push({ role: 'user', content: input, timestamp: Date.now() });
82
+
83
+ // Keep last 40 messages to prevent unbounded payload growth
84
+ const MAX_CONTEXT = 40;
85
+ const contextMessages = messages.length > MAX_CONTEXT
86
+ ? messages.slice(-MAX_CONTEXT)
87
+ : [...messages];
88
+
89
+ const body = { messages: contextMessages, mode };
90
+ if (attachedFiles) body.attachedFiles = attachedFiles;
91
+ if (maxSteps) body.maxSteps = maxSteps;
92
+
93
+ process.stdout.write('\n');
94
+
95
+ try {
96
+ const res = await postAsk(baseUrl, body, token);
97
+
98
+ if (!res.ok) {
99
+ const errText = await res.text();
100
+ console.error(red(` API error (${res.status}): ${errText}\n`));
101
+ messages.pop();
102
+ busy = false;
103
+ rl.prompt();
104
+ return;
105
+ }
106
+
107
+ const contentType = res.headers.get('content-type') || '';
108
+
109
+ if (contentType.includes('text/event-stream')) {
110
+ const result = await streamSSE(res, { showTools, json: false });
111
+
112
+ if (result.error) {
113
+ console.error(red(' Error in this turn. You can retry.\n'));
114
+ messages.pop();
115
+ busy = false;
116
+ rl.prompt();
117
+ return;
118
+ }
119
+
120
+ if (result.text) {
121
+ messages.push({
122
+ role: 'assistant',
123
+ content: result.text,
124
+ timestamp: Date.now(),
125
+ });
126
+ }
127
+ } else {
128
+ const data = await res.json();
129
+ const answer = data.answer || data.text || JSON.stringify(data, null, 2);
130
+ console.log(answer);
131
+
132
+ messages.push({
133
+ role: 'assistant',
134
+ content: answer,
135
+ timestamp: Date.now(),
136
+ });
137
+ }
138
+ } catch (err) {
139
+ console.error(red(` ${err.message}\n`));
140
+ messages.pop();
141
+ }
142
+
143
+ busy = false;
144
+ console.log();
145
+ rl.prompt();
146
+ });
147
+
148
+ rl.on('close', () => {
149
+ exitGracefully();
150
+ });
151
+
152
+ rl.on('SIGINT', () => {
153
+ console.log(dim('\n (Press Ctrl+C again or type "exit" to quit)'));
154
+ rl.once('SIGINT', () => {
155
+ exitGracefully();
156
+ });
157
+ rl.prompt();
158
+ });
159
+
160
+ function exitGracefully() {
161
+ if (exiting) return;
162
+ exiting = true;
163
+ console.log(dim('\n Goodbye.\n'));
164
+ rl.close();
165
+ process.exit(0);
166
+ }
167
+ }
@@ -1,33 +1,33 @@
1
+ /**
2
+ * Shell execution helpers — inheriting stdio.
3
+ */
4
+
1
5
  import { execSync } from 'node:child_process';
2
- import { resolve } from 'node:path';
3
- import { homedir } from 'node:os';
4
6
  import { ROOT } from './constants.js';
5
7
 
6
8
  /**
9
+ * @param {string} command
10
+ * @param {string} [cwd]
7
11
  * @param {Record<string, string | undefined>} [envPatch] merged into process.env (for child only)
8
12
  */
9
- export function run(command, cwd = ROOT, envPatch) {
13
+ export const execInherited = (command, cwd = ROOT, envPatch) => {
10
14
  try {
11
15
  const env = envPatch ? { ...process.env, ...envPatch } : process.env;
12
16
  execSync(command, { cwd, stdio: 'inherit', env });
13
17
  } catch (err) {
14
18
  process.exit(err.status || 1);
15
19
  }
16
- }
20
+ };
17
21
 
18
22
  /**
19
23
  * Run `npm install` with --prefer-offline for speed, auto-fallback to online
20
24
  * if the local cache is stale or missing a required package version.
21
- *
22
- * @param {string} cwd - Directory to run in
23
- * @param {string} [extraFlags=''] - Additional npm flags (e.g. '--no-workspaces')
24
25
  */
25
- export function npmInstall(cwd, extraFlags = '') {
26
+ export const npmInstall = (cwd, extraFlags = '') => {
26
27
  const base = `npm install ${extraFlags}`.trim();
27
28
  try {
28
29
  execSync(`${base} --prefer-offline`, { cwd, stdio: 'inherit', env: process.env });
29
30
  } catch {
30
- // Cache miss or stale packument — retry online
31
31
  try {
32
32
  execSync(base, { cwd, stdio: 'inherit', env: process.env });
33
33
  } catch (err) {
@@ -36,20 +36,4 @@ export function npmInstall(cwd, extraFlags = '') {
36
36
  process.exit(err.status || 1);
37
37
  }
38
38
  }
39
- }
40
-
41
- export function expandHome(p) {
42
- return p.startsWith('~/') ? resolve(homedir(), p.slice(2)) : p;
43
- }
44
-
45
- /**
46
- * Parse JSONC — strips single-line and block comments before JSON.parse.
47
- * VS Code-based editors (Cursor, Windsurf, Cline) use JSONC for config files.
48
- */
49
- export function parseJsonc(text) {
50
- // Strip single-line comments (not inside quoted strings)
51
- let stripped = text.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*$)/gm, (m, g) => g ? '' : m);
52
- // Strip block comments
53
- stripped = stripped.replace(/\/\*[\s\S]*?\*\//g, '');
54
- return JSON.parse(stripped);
55
- }
39
+ };
@@ -87,7 +87,7 @@ export async function promptSkillUpdate(mismatches) {
87
87
  }
88
88
 
89
89
  // Non-interactive mode: just print hint
90
- if (!isTTY || process.env.LAUNCHED_BY_LAUNCHD === '1' || process.env.INVOCATION_ID) {
90
+ if (!isTTY() || process.env.LAUNCHED_BY_LAUNCHD === '1' || process.env.INVOCATION_ID) {
91
91
  console.log(` ${dim('Run `mindos start` in a terminal to update interactively.')}`);
92
92
  return;
93
93
  }
@@ -0,0 +1,167 @@
1
+ /**
2
+ * SSE streaming client for CLI → /api/ask
3
+ *
4
+ * Handles the text/event-stream protocol emitted by the MindOS Ask API.
5
+ * Supports text_delta, thinking_delta, tool_start, tool_end, done, error, status events.
6
+ */
7
+
8
+ import { dim, cyan, red } from './colors.js';
9
+
10
+ /**
11
+ * Stream an SSE response from /api/ask and print to stdout.
12
+ *
13
+ * @param {Response} res - fetch Response with Content-Type: text/event-stream
14
+ * @param {object} opts
15
+ * @param {boolean} [opts.showTools=true] - Show tool call / result lines
16
+ * @param {boolean} [opts.json=false] - Collect full output and return as object instead of printing
17
+ * @returns {Promise<{ text: string, toolCalls: string[], error?: string }>}
18
+ */
19
+ export async function streamSSE(res, opts = {}) {
20
+ const { showTools = true, json = false } = opts;
21
+ const decoder = new TextDecoder();
22
+ if (!res.body) {
23
+ return { text: '', toolCalls: [], error: 'Empty response body' };
24
+ }
25
+ const reader = res.body.getReader();
26
+
27
+ let textBuffer = '';
28
+ const toolCalls = [];
29
+ let error = null;
30
+ let buffer = '';
31
+ let firstTextPrinted = false;
32
+
33
+ try {
34
+ while (true) {
35
+ const { done, value } = await reader.read();
36
+ if (done) break;
37
+
38
+ buffer += decoder.decode(value, { stream: true });
39
+
40
+ const lines = buffer.split('\n');
41
+ // Keep the last incomplete line in buffer
42
+ buffer = lines.pop() || '';
43
+
44
+ for (const line of lines) {
45
+ if (!line.startsWith('data:')) continue;
46
+ const payload = line.slice(5);
47
+ if (!payload) continue;
48
+
49
+ let event;
50
+ try {
51
+ event = JSON.parse(payload);
52
+ } catch {
53
+ continue;
54
+ }
55
+
56
+ if (event.type === 'text_delta') {
57
+ if (!firstTextPrinted && !json) {
58
+ // Clear "Thinking..." spinner
59
+ process.stdout.write('\r\x1b[K');
60
+ firstTextPrinted = true;
61
+ }
62
+ textBuffer += event.text;
63
+ if (!json) process.stdout.write(event.text);
64
+ }
65
+
66
+ if (event.type === 'thinking_delta') {
67
+ // Suppress thinking in CLI output (it's internal reasoning)
68
+ }
69
+
70
+ if (event.type === 'tool_start' && showTools && !json) {
71
+ if (!firstTextPrinted) {
72
+ process.stdout.write('\r\x1b[K');
73
+ firstTextPrinted = true;
74
+ }
75
+ const name = event.name || 'unknown';
76
+ const inputSnippet = event.input
77
+ ? JSON.stringify(event.input).slice(0, 80)
78
+ : '';
79
+ const toolLine = `\n ${dim('[')}${cyan('tool')}${dim(']')} ${name}${inputSnippet ? dim(': ' + inputSnippet) : ''}`;
80
+ process.stdout.write(toolLine);
81
+ toolCalls.push(name);
82
+ }
83
+
84
+ if (event.type === 'tool_end' && showTools && !json) {
85
+ const result = event.result || '';
86
+ const preview = typeof result === 'string'
87
+ ? result.slice(0, 120)
88
+ : JSON.stringify(result).slice(0, 120);
89
+ if (preview) {
90
+ process.stdout.write(dim(' → ' + preview));
91
+ }
92
+ process.stdout.write('\n');
93
+ }
94
+
95
+ if (event.type === 'status' && !json) {
96
+ if (!firstTextPrinted) {
97
+ process.stdout.write('\r\x1b[K');
98
+ firstTextPrinted = true;
99
+ }
100
+ process.stdout.write(dim(` [${event.message || 'processing'}]\n`));
101
+ }
102
+
103
+ if (event.type === 'error') {
104
+ error = event.message || event.error || 'Unknown error';
105
+ if (!json) {
106
+ if (!firstTextPrinted) {
107
+ process.stdout.write('\r\x1b[K');
108
+ }
109
+ process.stderr.write('\n' + red('Error: ' + error) + '\n');
110
+ }
111
+ }
112
+
113
+ if (event.type === 'done') {
114
+ // Stream complete
115
+ }
116
+ }
117
+ }
118
+ } catch (err) {
119
+ if (!json && !firstTextPrinted) {
120
+ process.stdout.write('\r\x1b[K');
121
+ }
122
+ error = err.message || 'Stream interrupted';
123
+ if (!json) {
124
+ if (textBuffer) process.stdout.write('\n');
125
+ process.stderr.write(red('Error: ' + error) + '\n');
126
+ }
127
+ }
128
+
129
+ if (!json && textBuffer && !textBuffer.endsWith('\n')) {
130
+ process.stdout.write('\n');
131
+ }
132
+
133
+ return { text: textBuffer, toolCalls, error };
134
+ }
135
+
136
+ /**
137
+ * POST to /api/ask with proper headers and message format.
138
+ *
139
+ * @param {string} baseUrl - e.g. http://localhost:3456
140
+ * @param {object} body - { messages, mode, attachedFiles, maxSteps, ... }
141
+ * @param {string} [token] - Auth token
142
+ * @returns {Promise<Response>}
143
+ */
144
+ export async function postAsk(baseUrl, body, token) {
145
+ const headers = { 'Content-Type': 'application/json' };
146
+ if (token) headers['Authorization'] = `Bearer ${token}`;
147
+
148
+ return fetch(`${baseUrl}/api/ask`, {
149
+ method: 'POST',
150
+ headers,
151
+ body: JSON.stringify(body),
152
+ });
153
+ }
154
+
155
+ /**
156
+ * Check if MindOS is running by hitting /api/health.
157
+ * @param {string} baseUrl
158
+ * @returns {Promise<boolean>}
159
+ */
160
+ export async function checkHealth(baseUrl) {
161
+ try {
162
+ const res = await fetch(`${baseUrl}/api/health`);
163
+ return res.ok;
164
+ } catch {
165
+ return false;
166
+ }
167
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geminilight/mindos",
3
- "version": "0.6.40",
3
+ "version": "0.6.41",
4
4
  "description": "MindOS — Human-Agent Collaborative Mind System. Local-first knowledge base that syncs your mind to all AI Agents via MCP.",
5
5
  "keywords": [
6
6
  "mindos",
@@ -19,7 +19,7 @@
19
19
  "type": "git",
20
20
  "url": "https://github.com/GeminiLight/MindOS"
21
21
  },
22
- "homepage": "https://mindos.app",
22
+ "homepage": "https://mindos.you",
23
23
  "bugs": {
24
24
  "url": "https://github.com/GeminiLight/MindOS/issues"
25
25
  },