@intent-systems/nexus 2026.1.5-4 → 2026.1.5-8

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 (347) hide show
  1. package/dist/agents/agent-id.js +41 -0
  2. package/dist/agents/auth-profiles.js +114 -25
  3. package/dist/agents/identity-state.js +101 -0
  4. package/dist/agents/model-auth.js +1 -0
  5. package/dist/agents/model-fallback.js +15 -9
  6. package/dist/agents/model-selection.js +1 -1
  7. package/dist/agents/models-config.js +17 -11
  8. package/dist/agents/pi-embedded-runner.js +101 -9
  9. package/dist/agents/sandbox.js +12 -3
  10. package/dist/agents/skill-runner.js +41 -6
  11. package/dist/agents/skill-usage.js +117 -17
  12. package/dist/agents/skills-status.js +4 -3
  13. package/dist/agents/skills.js +38 -30
  14. package/dist/agents/subagent-registry.js +25 -11
  15. package/dist/agents/system-prompt.js +16 -0
  16. package/dist/agents/tool-policy.js +19 -3
  17. package/dist/agents/tools/browser-tool.js +5 -2
  18. package/dist/agents/tools/image-tool.js +93 -8
  19. package/dist/agents/tools/sessions-announce-target.js +5 -1
  20. package/dist/agents/workspace.js +81 -59
  21. package/dist/auto-reply/command-detection.js +2 -1
  22. package/dist/auto-reply/reply/directive-handling.js +153 -28
  23. package/dist/auto-reply/reply/directives.js +17 -2
  24. package/dist/auto-reply/reply/model-selection.js +8 -3
  25. package/dist/auto-reply/reply/queue.js +2 -2
  26. package/dist/auto-reply/reply.js +1 -1
  27. package/dist/auto-reply/thinking.js +15 -0
  28. package/dist/browser/chrome.js +1 -1
  29. package/dist/browser/client.js +2 -0
  30. package/dist/browser/config.js +6 -2
  31. package/dist/browser/pw-tools-core.js +3 -0
  32. package/dist/browser/routes/agent.js +14 -0
  33. package/dist/canvas-host/server.js +1 -1
  34. package/dist/capabilities/detector.js +46 -15
  35. package/dist/capabilities/registry.js +2 -1
  36. package/dist/cli/cloud-cli.js +70 -7
  37. package/dist/cli/credential-cli.js +214 -23
  38. package/dist/cli/gateway-cli.js +1 -1
  39. package/dist/cli/log-cli.js +25 -0
  40. package/dist/cli/pairing-cli.js +1 -1
  41. package/dist/cli/program.js +82 -8
  42. package/dist/cli/run-main.js +1 -1
  43. package/dist/cli/skills-cli.js +165 -30
  44. package/dist/cli/skills-hub-cli.js +68 -36
  45. package/dist/cli/tool-connector-cli.js +99 -24
  46. package/dist/cli/upstream-sync-cli.js +253 -96
  47. package/dist/cli/usage-cli.js +14 -0
  48. package/dist/commands/auth-choice-options.js +6 -1
  49. package/dist/commands/auth-choice.js +157 -5
  50. package/dist/commands/bootstrap-preset.js +26 -12
  51. package/dist/commands/capabilities.js +33 -6
  52. package/dist/commands/claude-md.js +3 -2
  53. package/dist/commands/config-view.js +1 -1
  54. package/dist/commands/config.js +85 -0
  55. package/dist/commands/configure.js +4 -4
  56. package/dist/commands/credential.js +497 -36
  57. package/dist/commands/cursor-hooks.js +240 -0
  58. package/dist/commands/cursor-rules.js +14 -188
  59. package/dist/commands/doctor.js +5 -4
  60. package/dist/commands/identity.js +29 -32
  61. package/dist/commands/init.js +304 -20
  62. package/dist/commands/log.js +134 -0
  63. package/dist/commands/models/fallbacks.js +1 -1
  64. package/dist/commands/models/image-fallbacks.js +1 -1
  65. package/dist/commands/models/list.js +1 -1
  66. package/dist/commands/models/scan.js +1 -1
  67. package/dist/commands/onboard-auth.js +27 -2
  68. package/dist/commands/onboard-eve-identity.js +8 -9
  69. package/dist/commands/onboard-non-interactive.js +4 -2
  70. package/dist/commands/onboard-quickstart.js +18 -11
  71. package/dist/commands/quest-state.js +271 -0
  72. package/dist/commands/quest.js +53 -13
  73. package/dist/commands/reset.js +1 -1
  74. package/dist/commands/sessions-ingest.js +5 -4
  75. package/dist/commands/setup.js +4 -2
  76. package/dist/commands/skills-manifest.js +89 -29
  77. package/dist/commands/status.js +193 -73
  78. package/dist/commands/suggestions.js +1 -1
  79. package/dist/commands/usage-tracking.js +32 -0
  80. package/dist/commands/usage-upload.js +6 -1
  81. package/dist/config/defaults.js +1 -3
  82. package/dist/config/includes.js +5 -7
  83. package/dist/config/io.js +88 -16
  84. package/dist/config/legacy.js +4 -2
  85. package/dist/config/paths.js +16 -0
  86. package/dist/config/sessions.js +9 -5
  87. package/dist/config/zod-schema.js +4 -3
  88. package/dist/control-plane/broker/broker.js +131 -78
  89. package/dist/control-plane/compaction.js +3 -5
  90. package/dist/control-plane/factory.js +2 -2
  91. package/dist/control-plane/index.js +2 -2
  92. package/dist/control-plane/odu/agents.js +28 -23
  93. package/dist/control-plane/odu/interaction-tools.js +62 -50
  94. package/dist/control-plane/odu/prompt-loader.js +8 -8
  95. package/dist/control-plane/odu/runtime.js +87 -75
  96. package/dist/control-plane/odu-control-plane.js +14 -12
  97. package/dist/control-plane/single-agent.js +13 -13
  98. package/dist/credentials/store.js +133 -7
  99. package/dist/daemon/launchd.js +14 -0
  100. package/dist/entry.js +0 -0
  101. package/dist/gateway/server-browser.js +5 -4
  102. package/dist/gateway/server-methods/cron.js +11 -1
  103. package/dist/gateway/server.js +14 -7
  104. package/dist/infra/bonjour.js +1 -1
  105. package/dist/infra/event-log.js +8 -2
  106. package/dist/infra/path-env.js +1 -2
  107. package/dist/infra/provider-usage.auth.js +5 -3
  108. package/dist/infra/provider-usage.fetch.claude.js +16 -6
  109. package/dist/infra/provider-usage.fetch.minimax.js +8 -3
  110. package/dist/infra/provider-usage.js +9 -5
  111. package/dist/infra/restart.js +2 -2
  112. package/dist/infra/usage-settings.js +78 -0
  113. package/dist/infra/usage-suggestions.js +17 -5
  114. package/dist/infra/usage-upload.js +38 -1
  115. package/dist/infra/voicewake.js +2 -2
  116. package/dist/media/image-ops.js +3 -1
  117. package/dist/memory/index.js +2 -381
  118. package/dist/native/nexus-cloud/darwin-arm64/nexus-cloud +0 -0
  119. package/dist/native/nexus-cloud/darwin-arm64/nexus-cloud-rs +0 -0
  120. package/dist/pairing/pairing-store.js +24 -0
  121. package/dist/providers/github-copilot-auth.js +1 -1
  122. package/dist/routing/resolve-route.js +6 -6
  123. package/dist/routing/session-key.js +3 -1
  124. package/dist/sessions/send-policy.js +5 -5
  125. package/dist/slack/monitor.js +22 -1
  126. package/dist/telegram/reaction-level.js +2 -1
  127. package/dist/utils.js +8 -3
  128. package/dist/wizard/onboarding.js +29 -7
  129. package/docs/AGENTS.default.md +1 -1
  130. package/docs/configuration.md +1 -1
  131. package/docs/feature-inventory/overview.md +2 -2
  132. package/docs/reference/templates/AGENTS.md +172 -109
  133. package/docs/templates/AGENTS.md +140 -199
  134. package/docs/templates/BOOTSTRAP.md +40 -20
  135. package/docs/templates/IDENTITY.md +6 -0
  136. package/docs/templates/USER.md +22 -2
  137. package/package.json +3 -1
  138. package/skills/{notion → connectors/notion}/SKILL.md +1 -1
  139. package/skills/{filesystem → guides/filesystem}/SKILL.md +1 -1
  140. package/skills/{onboarding → guides/onboarding}/SKILL.md +1 -1
  141. package/skills/{onboarding → guides/onboarding}/docs/CAPABILITY_TAXONOMY.md +5 -5
  142. package/skills/{onboarding → guides/onboarding}/docs/CLI_GRAMMAR.md +8 -8
  143. package/skills/{onboarding → guides/onboarding}/docs/CLI_GRAMMAR_ONBOARDING.md +2 -2
  144. package/skills/{onboarding → guides/onboarding}/docs/CLI_GRAMMAR_SKILLS.md +26 -20
  145. package/skills/{onboarding → guides/onboarding}/docs/GOAL_STATE_ARCHITECTURE.md +38 -43
  146. package/skills/{onboarding → guides/onboarding}/docs/NEXUS_SYSTEM_OVERVIEW.md +4 -4
  147. package/skills/{onboarding → guides/onboarding}/docs/SKILLS_HUB_SPEC.md +1 -1
  148. package/skills/{onboarding → guides/onboarding}/docs/SKILLS_SPECIFICATION.md +8 -7
  149. package/skills/{onboarding → guides/onboarding}/docs/SKILL_GATEWAY_DESIGN.md +16 -16
  150. package/skills/{onboarding → guides/onboarding}/docs/SKILL_GATEWAY_PRD.md +10 -12
  151. package/skills/guides/onboarding/docs/canonical/00_CONFLICT_ANALYSIS.md +463 -0
  152. package/skills/guides/onboarding/docs/canonical/01_NEXUS_OVERVIEW.md +167 -0
  153. package/skills/guides/onboarding/docs/canonical/02_CLI_REFERENCE.md +404 -0
  154. package/skills/guides/onboarding/docs/canonical/03_STATE_ARCHITECTURE.md +357 -0
  155. package/skills/guides/onboarding/docs/canonical/04_SKILL_SPECIFICATION.md +393 -0
  156. package/skills/guides/onboarding/docs/canonical/05_CAPABILITY_TAXONOMY.md +298 -0
  157. package/skills/guides/onboarding/docs/canonical/06_CAPABILITIES_REFERENCE.md +207 -0
  158. package/skills/guides/onboarding/docs/canonical/07_AGENT_BINDINGS.md +85 -0
  159. package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/nexus-cloud.md +2 -2
  160. package/skills/{onboarding → guides/onboarding}/scripts/ralph/progress.txt +1 -1
  161. package/skills/{nexus-cloud → tools/nexus-cloud}/SKILL.md +2 -1
  162. package/skills/{nexus-cloud → tools/nexus-cloud}/docs/setup.md +1 -1
  163. package/docs/templates/PROFILE.md +0 -14
  164. /package/skills/{brave-search → connectors/brave-search}/SKILL.md +0 -0
  165. /package/skills/{brave-search → connectors/brave-search}/docs/setup.md +0 -0
  166. /package/skills/{brave-search → connectors/brave-search}/docs/troubleshooting.md +0 -0
  167. /package/skills/{brave-search → connectors/brave-search}/docs/usage.md +0 -0
  168. /package/skills/{brave-search → connectors/brave-search}/scripts/content.mjs +0 -0
  169. /package/skills/{brave-search → connectors/brave-search}/scripts/search.mjs +0 -0
  170. /package/skills/{discord → connectors/discord}/SKILL.md +0 -0
  171. /package/skills/{gemini → connectors/gemini}/SKILL.md +0 -0
  172. /package/skills/{github → connectors/github}/SKILL.md +0 -0
  173. /package/skills/{github → connectors/github}/docs/setup.md +0 -0
  174. /package/skills/{github → connectors/github}/docs/troubleshooting.md +0 -0
  175. /package/skills/{google-oauth → connectors/google-oauth}/SKILL.md +0 -0
  176. /package/skills/{slack → connectors/slack}/SKILL.md +0 -0
  177. /package/skills/{telegram → connectors/telegram}/SKILL.md +0 -0
  178. /package/skills/{telegram → connectors/telegram}/docs/pairing.md +0 -0
  179. /package/skills/{telegram → connectors/telegram}/docs/setup.md +0 -0
  180. /package/skills/{telegram → connectors/telegram}/docs/webhook.md +0 -0
  181. /package/skills/{wacli → connectors/wacli}/SKILL.md +0 -0
  182. /package/skills/{wacli → connectors/wacli}/docs/auth.md +0 -0
  183. /package/skills/{wacli → connectors/wacli}/docs/backup.md +0 -0
  184. /package/skills/{wacli → connectors/wacli}/docs/troubleshooting.md +0 -0
  185. /package/skills/{browser-use-agent-sdk → guides/browser-use-agent-sdk}/SKILL.md +0 -0
  186. /package/skills/{json-render → guides/json-render}/SKILL.md +0 -0
  187. /package/skills/{json-render → guides/json-render}/assets/components/README.md +0 -0
  188. /package/skills/{json-render → guides/json-render}/assets/components/catalog.ts +0 -0
  189. /package/skills/{json-render → guides/json-render}/assets/components/registry.tsx +0 -0
  190. /package/skills/{json-render → guides/json-render}/assets/demo/App.css +0 -0
  191. /package/skills/{json-render → guides/json-render}/assets/demo/App.tsx +0 -0
  192. /package/skills/{json-render → guides/json-render}/assets/demo/README.md +0 -0
  193. /package/skills/{json-render → guides/json-render}/assets/demo/catalog.ts +0 -0
  194. /package/skills/{json-render → guides/json-render}/assets/demo/data/nexus-core.json +0 -0
  195. /package/skills/{json-render → guides/json-render}/assets/demo/index.css +0 -0
  196. /package/skills/{json-render → guides/json-render}/assets/demo/registry.tsx +0 -0
  197. /package/skills/{json-render → guides/json-render}/docs/nexus-state-demo.md +0 -0
  198. /package/skills/{json-render → guides/json-render}/docs/shadcn-preset.md +0 -0
  199. /package/skills/{json-render → guides/json-render}/scripts/create-vite-demo.sh +0 -0
  200. /package/skills/{json-render → guides/json-render}/scripts/llm-server/README.md +0 -0
  201. /package/skills/{json-render → guides/json-render}/scripts/llm-server/catalog.ts +0 -0
  202. /package/skills/{json-render → guides/json-render}/scripts/llm-server/package-lock.json +0 -0
  203. /package/skills/{json-render → guides/json-render}/scripts/llm-server/package.json +0 -0
  204. /package/skills/{json-render → guides/json-render}/scripts/llm-server/server.ts +0 -0
  205. /package/skills/{onboarding → guides/onboarding}/docs/CAPABILITIES.md +0 -0
  206. /package/skills/{onboarding → guides/onboarding}/docs/CLI_GRAMMAR_CREDENTIALS.md +0 -0
  207. /package/skills/{onboarding → guides/onboarding}/docs/DOCUMENTATION_OVERVIEW.md +0 -0
  208. /package/skills/{onboarding → guides/onboarding}/docs/ENTITY_MODEL.md +0 -0
  209. /package/skills/{onboarding → guides/onboarding}/docs/SKILL_INVENTORY.md +0 -0
  210. /package/skills/{onboarding → guides/onboarding}/docs/STATE_ARCHITECTURE.md +0 -0
  211. /package/skills/{onboarding → guides/onboarding}/docs/TROUBLESHOOTING.md +0 -0
  212. /package/skills/{onboarding → guides/onboarding}/docs/USER_JOURNEY.md +0 -0
  213. /package/skills/{onboarding → guides/onboarding}/docs/WOW_MOMENTS.md +0 -0
  214. /package/skills/{onboarding → guides/onboarding}/docs/agent-apple-id.md +0 -0
  215. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/1password.md +0 -0
  216. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/TEMPLATE.md +0 -0
  217. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/aix.md +0 -0
  218. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/bird.md +0 -0
  219. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/brave-search.md +0 -0
  220. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/comms.md +0 -0
  221. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/computer-use.md +0 -0
  222. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/cron-and-heartbeat.md +0 -0
  223. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/eve.md +0 -0
  224. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/github.md +0 -0
  225. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/gog.md +0 -0
  226. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/homebrew-prereqs.md +0 -0
  227. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/qmd.md +0 -0
  228. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/telegram.md +0 -0
  229. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/wacli.md +0 -0
  230. /package/skills/{onboarding → guides/onboarding}/docs/skill-deep-dives/weather.md +0 -0
  231. /package/skills/{onboarding → guides/onboarding}/scripts/ralph/prd.json +0 -0
  232. /package/skills/{onboarding → guides/onboarding}/scripts/ralph/prompt.md +0 -0
  233. /package/skills/{onboarding → guides/onboarding}/scripts/ralph/ralph.log +0 -0
  234. /package/skills/{onboarding → guides/onboarding}/scripts/ralph/ralph.sh +0 -0
  235. /package/skills/{onboarding → guides/onboarding}/scripts/setup-cursor-skills.sh +0 -0
  236. /package/skills/{1password → tools/1password}/SKILL.md +0 -0
  237. /package/skills/{1password → tools/1password}/docs/setup.md +0 -0
  238. /package/skills/{1password → tools/1password}/docs/troubleshooting.md +0 -0
  239. /package/skills/{1password → tools/1password}/references/cli-examples.md +0 -0
  240. /package/skills/{1password → tools/1password}/references/get-started.md +0 -0
  241. /package/skills/{agent-browser → tools/agent-browser}/SKILL.md +0 -0
  242. /package/skills/{agent-browser → tools/agent-browser}/docs/browser-use-eval.md +0 -0
  243. /package/skills/{agent-browser → tools/agent-browser}/docs/first-tests.md +0 -0
  244. /package/skills/{agent-browser → tools/agent-browser}/docs/wordle-nyt-eval.js +0 -0
  245. /package/skills/{aix → tools/aix}/SKILL.md +0 -0
  246. /package/skills/{aix → tools/aix}/docs/embeddings.md +0 -0
  247. /package/skills/{aix → tools/aix}/docs/setup.md +0 -0
  248. /package/skills/{aix → tools/aix}/docs/troubleshooting.md +0 -0
  249. /package/skills/{aix → tools/aix}/references/sql.md +0 -0
  250. /package/skills/{apple-notes → tools/apple-notes}/SKILL.md +0 -0
  251. /package/skills/{apple-reminders → tools/apple-reminders}/SKILL.md +0 -0
  252. /package/skills/{bear-notes → tools/bear-notes}/SKILL.md +0 -0
  253. /package/skills/{bird → tools/bird}/SKILL.md +0 -0
  254. /package/skills/{bird → tools/bird}/docs/auth.md +0 -0
  255. /package/skills/{bird → tools/bird}/docs/troubleshooting.md +0 -0
  256. /package/skills/{blogwatcher → tools/blogwatcher}/SKILL.md +0 -0
  257. /package/skills/{blucli → tools/blucli}/SKILL.md +0 -0
  258. /package/skills/{camsnap → tools/camsnap}/SKILL.md +0 -0
  259. /package/skills/{clawdhub → tools/clawdhub}/SKILL.md +0 -0
  260. /package/skills/{coding-agent → tools/coding-agent}/SKILL.md +0 -0
  261. /package/skills/{comms → tools/comms}/SKILL.md +0 -0
  262. /package/skills/{comms → tools/comms}/docs/adapters.md +0 -0
  263. /package/skills/{comms → tools/comms}/docs/setup.md +0 -0
  264. /package/skills/{comms → tools/comms}/docs/troubleshooting.md +0 -0
  265. /package/skills/{comms → tools/comms}/references/schema.md +0 -0
  266. /package/skills/{computer-use → tools/computer-use}/SKILL.md +0 -0
  267. /package/skills/{computer-use → tools/computer-use}/docs/open-interpreter.md +0 -0
  268. /package/skills/{computer-use → tools/computer-use}/docs/peekaboo.md +0 -0
  269. /package/skills/{computer-use → tools/computer-use}/docs/setup.md +0 -0
  270. /package/skills/{computer-use → tools/computer-use}/docs/troubleshooting.md +0 -0
  271. /package/skills/{eightctl → tools/eightctl}/SKILL.md +0 -0
  272. /package/skills/{eve → tools/eve}/SKILL.md +0 -0
  273. /package/skills/{eve → tools/eve}/docs/dual-account.md +0 -0
  274. /package/skills/{eve → tools/eve}/docs/intelligence.md +0 -0
  275. /package/skills/{eve → tools/eve}/docs/setup.md +0 -0
  276. /package/skills/{eve → tools/eve}/docs/troubleshooting.md +0 -0
  277. /package/skills/{eve → tools/eve}/scripts/setup-dual-account.sh +0 -0
  278. /package/skills/{food-order → tools/food-order}/SKILL.md +0 -0
  279. /package/skills/{gh → tools/gh}/SKILL.md +0 -0
  280. /package/skills/{gh → tools/gh}/docs/usage.md +0 -0
  281. /package/skills/{gifgrep → tools/gifgrep}/SKILL.md +0 -0
  282. /package/skills/{gog → tools/gog}/SKILL.md +0 -0
  283. /package/skills/{gog → tools/gog}/docs/portability.md +0 -0
  284. /package/skills/{gog → tools/gog}/docs/setup.md +0 -0
  285. /package/skills/{gog → tools/gog}/docs/troubleshooting.md +0 -0
  286. /package/skills/{gog → tools/gog}/scripts/cdp/README.md +0 -0
  287. /package/skills/{gog → tools/gog}/scripts/cdp/add_test_users.py +0 -0
  288. /package/skills/{gog → tools/gog}/scripts/cdp/auth_add_accounts.py +0 -0
  289. /package/skills/{gog → tools/gog}/scripts/cdp/auth_add_accounts_manual.py +0 -0
  290. /package/skills/{gog → tools/gog}/scripts/cdp/create_oauth_client.py +0 -0
  291. /package/skills/{gog → tools/gog}/scripts/cdp/launch_cdp_chrome.sh +0 -0
  292. /package/skills/{goplaces → tools/goplaces}/SKILL.md +0 -0
  293. /package/skills/{imsg → tools/imsg}/SKILL.md +0 -0
  294. /package/skills/{local-places → tools/local-places}/SERVER_README.md +0 -0
  295. /package/skills/{local-places → tools/local-places}/SKILL.md +0 -0
  296. /package/skills/{local-places → tools/local-places}/pyproject.toml +0 -0
  297. /package/skills/{local-places → tools/local-places}/src/local_places/__init__.py +0 -0
  298. /package/skills/{local-places → tools/local-places}/src/local_places/__pycache__/__init__.cpython-314.pyc +0 -0
  299. /package/skills/{local-places → tools/local-places}/src/local_places/__pycache__/google_places.cpython-314.pyc +0 -0
  300. /package/skills/{local-places → tools/local-places}/src/local_places/__pycache__/main.cpython-314.pyc +0 -0
  301. /package/skills/{local-places → tools/local-places}/src/local_places/__pycache__/schemas.cpython-314.pyc +0 -0
  302. /package/skills/{local-places → tools/local-places}/src/local_places/google_places.py +0 -0
  303. /package/skills/{local-places → tools/local-places}/src/local_places/main.py +0 -0
  304. /package/skills/{local-places → tools/local-places}/src/local_places/schemas.py +0 -0
  305. /package/skills/{mcporter → tools/mcporter}/SKILL.md +0 -0
  306. /package/skills/{model-usage → tools/model-usage}/SKILL.md +0 -0
  307. /package/skills/{model-usage → tools/model-usage}/references/codexbar-cli.md +0 -0
  308. /package/skills/{model-usage → tools/model-usage}/scripts/model_usage.py +0 -0
  309. /package/skills/{nano-banana-pro → tools/nano-banana-pro}/SKILL.md +0 -0
  310. /package/skills/{nano-banana-pro → tools/nano-banana-pro}/scripts/generate_image.py +0 -0
  311. /package/skills/{nano-pdf → tools/nano-pdf}/SKILL.md +0 -0
  312. /package/skills/{nexus-cloud → tools/nexus-cloud}/docs/security.md +0 -0
  313. /package/skills/{nexus-cloud → tools/nexus-cloud}/docs/troubleshooting.md +0 -0
  314. /package/skills/{obsidian → tools/obsidian}/SKILL.md +0 -0
  315. /package/skills/{openai-image-gen → tools/openai-image-gen}/SKILL.md +0 -0
  316. /package/skills/{openai-image-gen → tools/openai-image-gen}/scripts/gen.py +0 -0
  317. /package/skills/{openai-whisper → tools/openai-whisper}/SKILL.md +0 -0
  318. /package/skills/{openai-whisper-api → tools/openai-whisper-api}/SKILL.md +0 -0
  319. /package/skills/{openai-whisper-api → tools/openai-whisper-api}/scripts/transcribe.sh +0 -0
  320. /package/skills/{openhue → tools/openhue}/SKILL.md +0 -0
  321. /package/skills/{oracle → tools/oracle}/SKILL.md +0 -0
  322. /package/skills/{ordercli → tools/ordercli}/SKILL.md +0 -0
  323. /package/skills/{peekaboo → tools/peekaboo}/SKILL.md +0 -0
  324. /package/skills/{qmd → tools/qmd}/SKILL.md +0 -0
  325. /package/skills/{qmd → tools/qmd}/docs/mcp.md +0 -0
  326. /package/skills/{qmd → tools/qmd}/docs/ollama.md +0 -0
  327. /package/skills/{qmd → tools/qmd}/docs/setup.md +0 -0
  328. /package/skills/{sag → tools/sag}/SKILL.md +0 -0
  329. /package/skills/{skill-cli-template → tools/skill-cli-template}/SKILL.md +0 -0
  330. /package/skills/{songsee → tools/songsee}/SKILL.md +0 -0
  331. /package/skills/{sonoscli → tools/sonoscli}/SKILL.md +0 -0
  332. /package/skills/{spotify-player → tools/spotify-player}/SKILL.md +0 -0
  333. /package/skills/{summarize → tools/summarize}/SKILL.md +0 -0
  334. /package/skills/{things-mac → tools/things-mac}/SKILL.md +0 -0
  335. /package/skills/{tmux → tools/tmux}/SKILL.md +0 -0
  336. /package/skills/{tmux → tools/tmux}/scripts/find-sessions.sh +0 -0
  337. /package/skills/{tmux → tools/tmux}/scripts/wait-for-text.sh +0 -0
  338. /package/skills/{trello → tools/trello}/SKILL.md +0 -0
  339. /package/skills/{upstream-sync → tools/upstream-sync}/SKILL.md +0 -0
  340. /package/skills/{upstream-sync → tools/upstream-sync}/scripts/auto-port.sh +0 -0
  341. /package/skills/{upstream-sync → tools/upstream-sync}/scripts/check-all.sh +0 -0
  342. /package/skills/{upstream-sync → tools/upstream-sync}/scripts/check-nexus.sh +0 -0
  343. /package/skills/{upstream-sync → tools/upstream-sync}/scripts/check-pi-ai.sh +0 -0
  344. /package/skills/{video-frames → tools/video-frames}/SKILL.md +0 -0
  345. /package/skills/{video-frames → tools/video-frames}/scripts/frame.sh +0 -0
  346. /package/skills/{weather → tools/weather}/SKILL.md +0 -0
  347. /package/skills/{weather → tools/weather}/docs/usage.md +0 -0
@@ -0,0 +1,240 @@
1
+ import fsp from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { resolveUserPath } from "../utils.js";
4
+ const DEFAULT_SCRIPT_NAME = "nexus-session-start.js";
5
+ const HOOK_SCRIPT = `#!/usr/bin/env node
6
+ const { execFile } = require("child_process");
7
+ const fs = require("fs");
8
+ const fsp = require("fs/promises");
9
+ const os = require("os");
10
+ const path = require("path");
11
+
12
+ const MAX_IDENTITY_CHARS = 120000;
13
+ const MAX_MEMORY_CHARS = 120000;
14
+ const MAX_DAILY_CHARS = 40000;
15
+ const MAX_BOOTSTRAP_CHARS = 80000;
16
+
17
+ function readStdin() {
18
+ return new Promise((resolve) => {
19
+ let data = "";
20
+ process.stdin.setEncoding("utf8");
21
+ process.stdin.on("data", (chunk) => {
22
+ data += chunk;
23
+ });
24
+ process.stdin.on("end", () => resolve(data));
25
+ });
26
+ }
27
+
28
+ function safeJsonParse(raw) {
29
+ if (!raw || !raw.trim()) return null;
30
+ try {
31
+ return JSON.parse(raw);
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+
37
+ function formatDate(date) {
38
+ const year = date.getFullYear();
39
+ const month = String(date.getMonth() + 1).padStart(2, "0");
40
+ const day = String(date.getDate()).padStart(2, "0");
41
+ return \`\${year}-\${month}-\${day}\`;
42
+ }
43
+
44
+ function resolveWorkspaceRoot(payload) {
45
+ const roots = payload?.workspace_roots;
46
+ if (Array.isArray(roots) && roots.length > 0 && roots[0]) {
47
+ return roots[0];
48
+ }
49
+ if (process.env.NEXUS_ROOT?.trim()) return process.env.NEXUS_ROOT.trim();
50
+ const home = os.homedir();
51
+ if (home) return path.join(home, "nexus");
52
+ return process.cwd();
53
+ }
54
+
55
+ function resolveStateDir(workspaceRoot) {
56
+ if (process.env.NEXUS_STATE_DIR?.trim()) {
57
+ return process.env.NEXUS_STATE_DIR.trim();
58
+ }
59
+ return path.join(workspaceRoot, "state");
60
+ }
61
+
62
+ function execFileAsync(command, args, options) {
63
+ return new Promise((resolve) => {
64
+ execFile(command, args, options, (error, stdout, stderr) => {
65
+ resolve({ error, stdout, stderr });
66
+ });
67
+ });
68
+ }
69
+
70
+ async function runStatus(env, cwd) {
71
+ const result = await execFileAsync("nexus", ["status", "--json"], {
72
+ env,
73
+ cwd,
74
+ });
75
+ const parsed = safeJsonParse(result.stdout);
76
+ if (parsed) return parsed;
77
+ if (result.error && result.error.stdout) {
78
+ const fallback = safeJsonParse(result.error.stdout.toString());
79
+ if (fallback) return fallback;
80
+ }
81
+ return null;
82
+ }
83
+
84
+ async function readFileSnippet(filePath, limit) {
85
+ if (!filePath) return null;
86
+ try {
87
+ const content = await fsp.readFile(filePath, "utf8");
88
+ if (!content.trim()) return null;
89
+ if (content.length <= limit) return content.trim();
90
+ const slice = content.slice(-limit).trimStart();
91
+ return \`\${slice}\\n\\n[truncated]\`;
92
+ } catch {
93
+ return null;
94
+ }
95
+ }
96
+
97
+ function addSection(sections, title, body) {
98
+ if (!body) return;
99
+ sections.push(\`## \${title}\\n\${body}\`);
100
+ }
101
+
102
+ async function main() {
103
+ const input = await readStdin();
104
+ const payload = safeJsonParse(input) || {};
105
+ const workspaceRoot = resolveWorkspaceRoot(payload);
106
+ const stateDir = resolveStateDir(workspaceRoot);
107
+ const env = {
108
+ ...process.env,
109
+ NEXUS_ROOT: workspaceRoot,
110
+ NEXUS_STATE_DIR: stateDir,
111
+ };
112
+ const status = await runStatus(env, workspaceRoot);
113
+ const identity = status?.identity || null;
114
+ const agentId = identity?.agentId || process.env.NEXUS_AGENT_ID || "default";
115
+ const agentIdentityPath =
116
+ identity?.agentIdentityPath ||
117
+ path.join(stateDir, "agents", agentId, "IDENTITY.md");
118
+ const agentSoulPath =
119
+ identity?.agentSoulPath || path.join(stateDir, "agents", agentId, "SOUL.md");
120
+ const agentMemoryPath =
121
+ identity?.agentMemoryPath ||
122
+ path.join(stateDir, "agents", agentId, "MEMORY.md");
123
+ const userIdentityPath =
124
+ identity?.userIdentityPath || path.join(stateDir, "user", "IDENTITY.md");
125
+ const userProfilePath = path.join(stateDir, "user", "PROFILE.md");
126
+ const resolvedUserPath = fs.existsSync(userIdentityPath)
127
+ ? userIdentityPath
128
+ : fs.existsSync(userProfilePath)
129
+ ? userProfilePath
130
+ : userIdentityPath;
131
+
132
+ const sections = ["# Nexus Session Bootstrap"];
133
+ if (identity) {
134
+ const summary = [
135
+ \`Agent: \${identity.agentName || "(unknown)"} (\${identity.agentId})\`,
136
+ \`User: \${identity.userName || "(unknown)"}\`,
137
+ \`Agent ID: \${identity.agentId}\`,
138
+ ];
139
+ addSection(sections, "Status", summary.join("\\n"));
140
+ }
141
+
142
+ const bootstrapPath =
143
+ status?.identity?.bootstrapPath ||
144
+ path.join(stateDir, "agents", "BOOTSTRAP.md");
145
+ const hasIdentity =
146
+ typeof identity?.hasIdentity === "boolean"
147
+ ? identity.hasIdentity
148
+ : fs.existsSync(agentIdentityPath) && fs.existsSync(resolvedUserPath);
149
+ let bootstrapPrompt = status?.bootstrap?.prompt || null;
150
+ if (!bootstrapPrompt && !hasIdentity) {
151
+ bootstrapPrompt = await readFileSnippet(
152
+ bootstrapPath,
153
+ MAX_BOOTSTRAP_CHARS,
154
+ );
155
+ }
156
+ if (bootstrapPrompt) {
157
+ addSection(sections, "Bootstrap Prompt", bootstrapPrompt.trim());
158
+ }
159
+
160
+ const agentIdentity = await readFileSnippet(
161
+ agentIdentityPath,
162
+ MAX_IDENTITY_CHARS,
163
+ );
164
+ const agentSoul = await readFileSnippet(agentSoulPath, MAX_IDENTITY_CHARS);
165
+ const agentMemory = await readFileSnippet(agentMemoryPath, MAX_MEMORY_CHARS);
166
+ const userIdentity = await readFileSnippet(
167
+ resolvedUserPath,
168
+ MAX_IDENTITY_CHARS,
169
+ );
170
+
171
+ addSection(sections, "Agent Identity", agentIdentity);
172
+ addSection(sections, "Agent Soul", agentSoul);
173
+ addSection(sections, "Agent Memory", agentMemory);
174
+ addSection(sections, "User Identity", userIdentity);
175
+
176
+ const memoryDir = path.join(workspaceRoot, "home", "memory");
177
+ const today = formatDate(new Date());
178
+ const yesterday = formatDate(new Date(Date.now() - 86400000));
179
+ const todayLog = await readFileSnippet(
180
+ path.join(memoryDir, \`\${today}.md\`),
181
+ MAX_DAILY_CHARS,
182
+ );
183
+ const yesterdayLog = await readFileSnippet(
184
+ path.join(memoryDir, \`\${yesterday}.md\`),
185
+ MAX_DAILY_CHARS,
186
+ );
187
+
188
+ addSection(sections, \`Daily Memory (\${today})\`, todayLog);
189
+ addSection(sections, \`Daily Memory (\${yesterday})\`, yesterdayLog);
190
+
191
+ const additional = sections.join("\\n\\n").trim();
192
+ const output = { continue: true, additional_context: additional };
193
+ const envOut = {};
194
+ if (!process.env.NEXUS_ROOT?.trim() && workspaceRoot) {
195
+ envOut.NEXUS_ROOT = workspaceRoot;
196
+ }
197
+ if (!process.env.NEXUS_STATE_DIR?.trim() && stateDir) {
198
+ envOut.NEXUS_STATE_DIR = stateDir;
199
+ }
200
+ if (Object.keys(envOut).length > 0) {
201
+ output.env = envOut;
202
+ }
203
+ process.stdout.write(JSON.stringify(output) + "\\n");
204
+ }
205
+
206
+ main().catch(() => {
207
+ process.stdout.write(JSON.stringify({ continue: true }) + "\\n");
208
+ });
209
+ `;
210
+ async function writeFileIfMissing(filePath, content) {
211
+ try {
212
+ await fsp.writeFile(filePath, content, { encoding: "utf-8", flag: "wx" });
213
+ return true;
214
+ }
215
+ catch (err) {
216
+ const anyErr = err;
217
+ if (anyErr.code === "EEXIST")
218
+ return false;
219
+ throw err;
220
+ }
221
+ }
222
+ export async function writeCursorHooks(options = {}) {
223
+ const workspaceDir = resolveUserPath(options.workspaceDir ?? process.cwd());
224
+ const hooksPath = options.hooksPath ?? path.join(workspaceDir, ".cursor", "hooks.json");
225
+ const scriptPath = options.scriptPath ??
226
+ path.join(workspaceDir, ".cursor", "hooks", DEFAULT_SCRIPT_NAME);
227
+ await fsp.mkdir(path.dirname(hooksPath), { recursive: true });
228
+ await fsp.mkdir(path.dirname(scriptPath), { recursive: true });
229
+ const hooksConfig = JSON.stringify({
230
+ version: 1,
231
+ hooks: {
232
+ sessionStart: [
233
+ { command: `node .cursor/hooks/${DEFAULT_SCRIPT_NAME}` },
234
+ ],
235
+ },
236
+ }, null, 2);
237
+ const hooksCreated = await writeFileIfMissing(hooksPath, `${hooksConfig}\n`);
238
+ const scriptCreated = await writeFileIfMissing(scriptPath, HOOK_SCRIPT);
239
+ return { hooksPath, scriptPath, hooksCreated, scriptCreated };
240
+ }
@@ -1,10 +1,7 @@
1
- import fs from "node:fs";
2
1
  import fsp from "node:fs/promises";
3
2
  import path from "node:path";
4
- import { flattenManifest, generateSkillManifest, readSkillManifest, } from "./skills-manifest.js";
5
- import { resolveStateDir } from "../config/paths.js";
6
- import { MANAGED_SKILLS_DIR, NEXUS_ROOT, resolveUserPath } from "../utils.js";
7
3
  import { defaultRuntime } from "../runtime.js";
4
+ import { NEXUS_ROOT, SKILLS_STATE_DIR, WORKSPACE_SKILLS_DIR, resolveUserPath, } from "../utils.js";
8
5
  /**
9
6
  * Generate and write `.cursor/rules` for a given workspace.
10
7
  *
@@ -12,8 +9,7 @@ import { defaultRuntime } from "../runtime.js";
12
9
  * nexus cursor-rules [--workspace <path>]
13
10
  */
14
11
  export async function cursorRulesCommand(opts, runtime = defaultRuntime) {
15
- const workspaceDir = opts?.workspace?.trim() ||
16
- path.join(process.env.HOME || "~", "nexus", "home");
12
+ const workspaceDir = opts?.workspace?.trim() || NEXUS_ROOT;
17
13
  const resolvedWorkspace = resolveUserPath(workspaceDir);
18
14
  runtime.log(`Generating .cursor/rules for workspace: ${resolvedWorkspace}`);
19
15
  const outputPath = await writeCursorRules({
@@ -24,196 +20,26 @@ export async function cursorRulesCommand(opts, runtime = defaultRuntime) {
24
20
  });
25
21
  runtime.log(`✓ Wrote ${outputPath}`);
26
22
  }
27
- /**
28
- * Group skills by category based on their description/name
29
- */
30
- function categorizeSkills(skills) {
31
- const categories = {
32
- "Communication & Messaging": [],
33
- "Productivity & Notes": [],
34
- "Google & Cloud Services": [],
35
- "Media & Content": [],
36
- "Smart Home & Devices": [],
37
- "Development & Tools": [],
38
- "Other": [],
39
- };
40
- const categoryPatterns = [
41
- ["Communication & Messaging", [/imsg|imessage|whatsapp|discord|slack|telegram|sms|message|chat/i]],
42
- ["Productivity & Notes", [/note|reminder|bear|obsidian|notion|things|trello|task|todo/i]],
43
- ["Google & Cloud Services", [/google|gmail|calendar|drive|sheets|docs|gemini|gog|places/i]],
44
- ["Media & Content", [/image|video|audio|camera|gif|pdf|whisper|speech|photo|screenshot/i]],
45
- ["Smart Home & Devices", [/hue|sonos|spotify|eight|sleep|smart|home|light|speaker/i]],
46
- ["Development & Tools", [/github|git|code|coding|terminal|bash|cli|api|mcp|1password|search/i]],
47
- ];
48
- for (const skill of skills) {
49
- const text = `${skill.name} ${skill.description || ""}`;
50
- let matched = false;
51
- for (const [category, patterns] of categoryPatterns) {
52
- if (patterns.some(p => p.test(text))) {
53
- categories[category].push(skill);
54
- matched = true;
55
- break;
56
- }
57
- }
58
- if (!matched) {
59
- categories["Other"].push(skill);
60
- }
61
- }
62
- return categories;
63
- }
64
- /**
65
- * Format skill entries for the rules file
66
- */
67
- function formatSkillsSection(skills) {
68
- const categories = categorizeSkills(skills);
69
- const lines = [];
70
- for (const [category, categorySkills] of Object.entries(categories)) {
71
- if (categorySkills.length === 0)
72
- continue;
73
- lines.push(`### ${category}`);
74
- for (const skill of categorySkills.sort((a, b) => a.name.localeCompare(b.name))) {
75
- const desc = skill.description
76
- ? skill.description.slice(0, 80) + (skill.description.length > 80 ? "..." : "")
77
- : "(no description)";
78
- lines.push(`- **${skill.name}**: ${desc}`);
79
- }
80
- lines.push("");
81
- }
82
- return lines.join("\n");
83
- }
84
- /**
85
- * Load AGENTS.md from the Nexus root
86
- */
87
- async function loadAgentsMd(workspaceDir) {
88
- const candidates = [
89
- path.join(NEXUS_ROOT, "AGENTS.md"),
90
- path.join(workspaceDir, "AGENTS.md"),
91
- path.join(workspaceDir, ".intent", "AGENTS.md"),
92
- ];
93
- for (const candidate of candidates) {
94
- try {
95
- if (fs.existsSync(candidate)) {
96
- return await fsp.readFile(candidate, "utf-8");
97
- }
98
- }
99
- catch {
100
- // continue
101
- }
102
- }
103
- return undefined;
104
- }
105
- /**
106
- * Load bootstrap files (IDENTITY.md, PROFILE.md, SOUL.md) if they exist
107
- */
108
- async function loadBootstrapFiles(workspaceDir) {
109
- const files = {};
110
- const agentId = process.env.NEXUS_AGENT_ID?.trim() || "default";
111
- const stateDir = resolveStateDir();
112
- const agentIdentityDir = path.join(stateDir, "agents", agentId, "identity");
113
- const userIdentityDir = path.join(stateDir, "user", "identity");
114
- const bootstrapFiles = ["IDENTITY.md", "PROFILE.md", "SOUL.md"];
115
- for (const filename of bootstrapFiles) {
116
- const candidates = filename === "PROFILE.md"
117
- ? [path.join(userIdentityDir, filename)]
118
- : [path.join(agentIdentityDir, filename)];
119
- for (const candidate of candidates) {
120
- try {
121
- if (fs.existsSync(candidate)) {
122
- files[filename] = await fsp.readFile(candidate, "utf-8");
123
- break;
124
- }
125
- }
126
- catch {
127
- // continue
128
- }
129
- }
130
- }
131
- return files;
132
- }
133
23
  /**
134
24
  * Generate .cursor/rules content from Nexus skills and config
135
25
  */
136
26
  export async function generateCursorRules(options = {}) {
137
- const workspaceDir = options.workspaceDir || process.cwd();
138
- const skillsDir = options.skillsDir || MANAGED_SKILLS_DIR;
139
- const userSkillsDir = options.userSkillsDir || path.join(NEXUS_ROOT, "home", "skills");
140
- // Try to read existing manifest, or generate one
141
- let manifest = await readSkillManifest();
142
- if (!manifest) {
143
- manifest = await generateSkillManifest(skillsDir, userSkillsDir);
144
- }
145
- const skills = flattenManifest(manifest);
146
- const skillsSection = formatSkillsSection(skills);
147
- // Load AGENTS.md if requested
148
- let agentsMdSection = "";
149
- if (options.includeAgentsMd !== false) {
150
- const agentsMd = await loadAgentsMd(workspaceDir);
151
- if (agentsMd) {
152
- agentsMdSection = `
153
- ## Project Guidelines (from AGENTS.md)
154
-
155
- ${agentsMd}
156
- `;
157
- }
158
- }
159
- // Load bootstrap files if requested
160
- let bootstrapSection = "";
161
- if (options.includeBootstrap) {
162
- const bootstrapFiles = await loadBootstrapFiles(workspaceDir);
163
- if (Object.keys(bootstrapFiles).length > 0) {
164
- const parts = [];
165
- for (const [filename, content] of Object.entries(bootstrapFiles)) {
166
- parts.push(`### ${filename}\n\n${content}`);
167
- }
168
- bootstrapSection = `
169
- ## User Context
170
-
171
- ${parts.join("\n\n")}
172
- `;
173
- }
174
- }
175
- const rules = `# Nexus Workspace Rules
176
-
177
- This file is auto-generated by \`nexus cursor-rules\`. Regenerate with:
178
- \`\`\`bash
179
- nexus cursor-rules --output .cursor/rules
180
- \`\`\`
181
-
182
- ## Available Skills (${skills.length} total)
183
-
184
- The following skills are available in \`~/nexus/skills/\`. Read the full \`SKILL.md\` when you need detailed usage instructions.
185
-
186
- ${skillsSection}
187
- ## How to Use Skills
188
-
189
- 1. **When a user's request relates to a skill**, read the corresponding SKILL.md:
190
- \`\`\`bash
191
- cat ~/nexus/skills/<skill>/SKILL.md
192
- \`\`\`
193
-
194
- 2. **Skills provide CLI tools** - use bash to run them:
195
- \`\`\`bash
196
- eve db query --sql "SELECT * FROM messages LIMIT 5"
197
- imsg chats --limit 10 --json
198
- gog gmail search "is:unread" --max 5
199
- \`\`\`
200
-
201
- 3. **Most tools support \`--json\`** for structured output.
27
+ const skillsDir = options.skillsDir || WORKSPACE_SKILLS_DIR;
28
+ const agentsPath = path.join(NEXUS_ROOT, "AGENTS.md");
29
+ const rules = `# Nexus Workspace - Cursor Configuration
202
30
 
203
- 4. **Check if a tool is installed** before using:
204
- \`\`\`bash
205
- which eve imsg gog
206
- \`\`\`
207
- ${agentsMdSection}${bootstrapSection}
208
- ## Skill Directory Structure
31
+ This workspace uses Nexus. Follow the root \`AGENTS.md\` file for all protocols.
209
32
 
210
- - **Bundled**: \`~/nexus/skills/\` (${manifest.bundled.count} skills)
211
- - **Managed**: \`~/nexus/skills/managed/\` (${manifest.managed.count} skills)
212
- - **User**: \`~/nexus/home/skills/\` (${manifest.user.count} skills)
33
+ ## Cursor-Specific
213
34
 
214
- Precedence: User > Managed > Bundled
35
+ - Run \`nexus status\` first
36
+ - Cursor sessionStart hook injects identity context (see \`.cursor/hooks.json\`)
37
+ - Use the Shell tool for \`nexus\` commands
38
+ - Skill definitions live in \`${skillsDir}\`
39
+ - Skill state and usage logs live in \`${SKILLS_STATE_DIR}\`
40
+ - Read \`${agentsPath}\` for full instructions
215
41
  `;
216
- return rules.trim() + "\n";
42
+ return `${rules.trim()}\n`;
217
43
  }
218
44
  /**
219
45
  * Write cursor rules to the specified output path
@@ -24,7 +24,7 @@ import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
24
24
  function resolveMode(cfg) {
25
25
  return cfg.gateway?.mode === "remote" ? "remote" : "local";
26
26
  }
27
- function resolveLegacyConfigPath(env) {
27
+ function resolveLegacyConfigPath(_env) {
28
28
  return path.join(os.homedir(), ".nexus", "nexus.json");
29
29
  }
30
30
  async function noteSecurityWarnings(cfg) {
@@ -438,8 +438,7 @@ async function maybeMigrateLegacyConfigFile(runtime) {
438
438
  const gatewayBind = typeof legacySnapshot.parsed?.gateway?.bind === "string"
439
439
  ? legacySnapshot.parsed.gateway?.bind
440
440
  : undefined;
441
- const agentWorkspace = typeof legacySnapshot.parsed?.agent?.workspace ===
442
- "string"
441
+ const agentWorkspace = typeof legacySnapshot.parsed?.agent?.workspace === "string"
443
442
  ? legacySnapshot.parsed.agent?.workspace
444
443
  : undefined;
445
444
  note([
@@ -471,7 +470,9 @@ async function maybeMigrateLegacyGatewayService(cfg, runtime) {
471
470
  const legacyServices = await findLegacyGatewayServices(process.env);
472
471
  if (legacyServices.length === 0)
473
472
  return;
474
- note(legacyServices.map((svc) => `- ${svc.label} (${svc.platform}, ${svc.detail})`).join("\n"), "Legacy Nexus services detected");
473
+ note(legacyServices
474
+ .map((svc) => `- ${svc.label} (${svc.platform}, ${svc.detail})`)
475
+ .join("\n"), "Legacy Nexus services detected");
475
476
  const migrate = guardCancel(await confirm({
476
477
  message: "Migrate legacy Nexus services to Nexus now?",
477
478
  initialValue: true,
@@ -1,40 +1,37 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { resolveStateDir } from "../config/paths.js";
1
+ import { resolveIdentitySnapshot } from "../agents/identity-state.js";
4
2
  import { defaultRuntime } from "../runtime.js";
5
- function readField(pathname, label) {
6
- try {
7
- const raw = fs.readFileSync(pathname, "utf-8");
8
- const regex = new RegExp(`^[-*]?\\s*${label}\\s*:\\s*(.+)$`, "im");
9
- const match = raw.match(regex);
10
- return match?.[1]?.trim();
11
- }
12
- catch {
13
- return undefined;
14
- }
15
- }
16
3
  export async function identityCommand(opts, runtime = defaultRuntime) {
17
- const stateDir = resolveStateDir();
18
- const agentId = process.env.NEXUS_AGENT_ID?.trim() || "default";
19
- const agentIdentityDir = path.join(stateDir, "agents", agentId, "identity");
20
- const userIdentityDir = path.join(stateDir, "user", "identity");
21
- const agentIdentityPath = path.join(agentIdentityDir, "IDENTITY.md");
22
- const agentSoulPath = path.join(agentIdentityDir, "SOUL.md");
23
- const agentMemoryPath = path.join(agentIdentityDir, "MEMORY.md");
24
- const userProfilePath = path.join(userIdentityDir, "PROFILE.md");
4
+ const resolution = resolveIdentitySnapshot();
5
+ if (!resolution.ok) {
6
+ const payload = {
7
+ ok: false,
8
+ error: "multiple_agents",
9
+ agents: resolution.agentOptions,
10
+ };
11
+ if (opts.json) {
12
+ runtime.log(JSON.stringify(payload, null, 2));
13
+ }
14
+ else {
15
+ runtime.error("Multiple agents detected in state/agents.");
16
+ runtime.error(`Set NEXUS_AGENT_ID to one of: ${payload.agents.join(", ")}`);
17
+ }
18
+ runtime.exit(2);
19
+ return;
20
+ }
21
+ const identity = resolution.snapshot;
25
22
  const payload = {
26
23
  agent: {
27
- id: agentId,
28
- name: readField(agentIdentityPath, "Name"),
29
- identityPath: agentIdentityPath,
30
- soulPath: agentSoulPath,
31
- memoryPath: agentMemoryPath,
32
- exists: fs.existsSync(agentIdentityPath),
24
+ id: identity.agentId,
25
+ name: identity.agentName,
26
+ identityPath: identity.agentIdentityPath,
27
+ soulPath: identity.agentSoulPath,
28
+ memoryPath: identity.agentMemoryPath,
29
+ exists: identity.agentIdentityExists,
33
30
  },
34
31
  user: {
35
- name: readField(userProfilePath, "Name"),
36
- profilePath: userProfilePath,
37
- exists: fs.existsSync(userProfilePath),
32
+ name: identity.userName,
33
+ identityPath: identity.userIdentityPath,
34
+ exists: identity.userIdentityExists,
38
35
  },
39
36
  };
40
37
  if (opts.json) {
@@ -43,7 +40,7 @@ export async function identityCommand(opts, runtime = defaultRuntime) {
43
40
  }
44
41
  if (!opts.target || opts.target === "user") {
45
42
  runtime.log(`User: ${payload.user.name ?? "(unknown)"}`);
46
- runtime.log(` ${payload.user.profilePath}`);
43
+ runtime.log(` ${payload.user.identityPath}`);
47
44
  }
48
45
  if (!opts.target || opts.target === "agent") {
49
46
  runtime.log(`Agent: ${payload.agent.name ?? "(unknown)"} (${payload.agent.id})`);