@neuralis/brain-core 0.3.2 → 0.4.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 (311) hide show
  1. package/README.md +79 -1409
  2. package/app/README.md +1 -1
  3. package/app/cards/FilesystemCardShell.tsx +42 -4
  4. package/app/cards/FilesystemChangeCard.tsx +34 -11
  5. package/app/cards/README.md +6 -5
  6. package/app/cards/diffUtils.ts +99 -1
  7. package/app/filesystem/FilesystemHost.tsx +17 -2
  8. package/app/filesystem/api/README.md +3 -3
  9. package/app/filesystem/api/index.ts +35 -11
  10. package/app/filesystem/api/projectPackages.ts +13 -102
  11. package/app/filesystem/domain/types.ts +30 -10
  12. package/app/filesystem/hooks/README.md +3 -3
  13. package/app/filesystem/hooks/useDiscoverableSources.ts +19 -30
  14. package/app/filesystem/hooks/useFilesystemSSE.ts +1 -1
  15. package/app/filesystem/host/README.md +5 -3
  16. package/app/filesystem/host/buildFilesystemHostValue.ts +19 -0
  17. package/app/filesystem/host/installFilesystemHostComponents.tsx +1 -1
  18. package/app/filesystem/lib/sourceKindForm.ts +118 -39
  19. package/app/filesystem/lib/treeVisualState.tsx +98 -4
  20. package/app/filesystem/store/README.md +1 -0
  21. package/app/filesystem/store/filesystemStore.ts +86 -5
  22. package/app/filesystem/store/gitSlice.ts +5 -0
  23. package/app/filesystem/store/helpers.ts +17 -0
  24. package/app/filesystem/store/listSlice.ts +8 -0
  25. package/app/filesystem/ui/CodeEditor.tsx +18 -3
  26. package/app/filesystem/ui/FileEditor.tsx +15 -10
  27. package/app/filesystem/ui/FileTree.tsx +41 -16
  28. package/app/filesystem/ui/FolderPicker.tsx +251 -0
  29. package/app/filesystem/ui/GitControlPanel.tsx +5 -0
  30. package/app/filesystem/ui/PackagesPanel.tsx +52 -374
  31. package/app/filesystem/ui/PolicyEditor.tsx +109 -24
  32. package/app/filesystem/ui/README.md +17 -11
  33. package/app/filesystem/ui/RawMediaPreview.tsx +58 -0
  34. package/app/filesystem/ui/SourceBranchHeader.tsx +4 -4
  35. package/app/filesystem/ui/SourcesPanel.tsx +420 -360
  36. package/app/filesystem/ui/Toolbar.tsx +1 -2
  37. package/app/shared/filesystem.png +0 -0
  38. package/dist/app/host.js +57 -49
  39. package/dist/scripts/sourceRootPairV1.d.ts +47 -0
  40. package/dist/scripts/sourceRootPairV1.d.ts.map +1 -0
  41. package/dist/scripts/sourceRootPairV1.js +147 -0
  42. package/dist/scripts/sourceRootPairV1.js.map +1 -0
  43. package/dist/scripts/sourceToFolderV1.d.ts +56 -0
  44. package/dist/scripts/sourceToFolderV1.d.ts.map +1 -0
  45. package/dist/scripts/sourceToFolderV1.js +152 -0
  46. package/dist/scripts/sourceToFolderV1.js.map +1 -0
  47. package/dist/scripts/sourceToHostV1.d.ts +56 -0
  48. package/dist/scripts/sourceToHostV1.d.ts.map +1 -0
  49. package/dist/scripts/sourceToHostV1.js +132 -0
  50. package/dist/scripts/sourceToHostV1.js.map +1 -0
  51. package/dist/src/connectors/AppSourceConfigStore.d.ts +17 -3
  52. package/dist/src/connectors/AppSourceConfigStore.d.ts.map +1 -1
  53. package/dist/src/connectors/AppSourceConfigStore.js +46 -6
  54. package/dist/src/connectors/AppSourceConfigStore.js.map +1 -1
  55. package/dist/src/connectors/HostConnector.d.ts +201 -0
  56. package/dist/src/connectors/HostConnector.d.ts.map +1 -0
  57. package/dist/src/connectors/HostConnector.js +903 -0
  58. package/dist/src/connectors/HostConnector.js.map +1 -0
  59. package/dist/src/connectors/inProcessTransport.d.ts +131 -0
  60. package/dist/src/connectors/inProcessTransport.d.ts.map +1 -0
  61. package/dist/src/connectors/inProcessTransport.js +447 -0
  62. package/dist/src/connectors/inProcessTransport.js.map +1 -0
  63. package/dist/src/domain/access/callerPermissions.d.ts +29 -0
  64. package/dist/src/domain/access/callerPermissions.d.ts.map +1 -1
  65. package/dist/src/domain/access/callerPermissions.js +85 -5
  66. package/dist/src/domain/access/callerPermissions.js.map +1 -1
  67. package/dist/src/domain/access/nativeLocalFence.d.ts +65 -0
  68. package/dist/src/domain/access/nativeLocalFence.d.ts.map +1 -0
  69. package/dist/src/domain/access/nativeLocalFence.js +171 -0
  70. package/dist/src/domain/access/nativeLocalFence.js.map +1 -0
  71. package/dist/src/domain/access/uriPermission.js +3 -3
  72. package/dist/src/domain/access/uriPermission.js.map +1 -1
  73. package/dist/src/domain/byteRange.d.ts +15 -0
  74. package/dist/src/domain/byteRange.d.ts.map +1 -0
  75. package/dist/src/domain/byteRange.js +30 -0
  76. package/dist/src/domain/byteRange.js.map +1 -0
  77. package/dist/src/domain/defaultPermissions.d.ts.map +1 -1
  78. package/dist/src/domain/defaultPermissions.js +29 -0
  79. package/dist/src/domain/defaultPermissions.js.map +1 -1
  80. package/dist/src/domain/mime.d.ts +8 -16
  81. package/dist/src/domain/mime.d.ts.map +1 -1
  82. package/dist/src/domain/mime.js +10 -99
  83. package/dist/src/domain/mime.js.map +1 -1
  84. package/dist/src/domain/paths.d.ts.map +1 -1
  85. package/dist/src/domain/paths.js +5 -3
  86. package/dist/src/domain/paths.js.map +1 -1
  87. package/dist/src/domain/sourceConfig.d.ts +52 -19
  88. package/dist/src/domain/sourceConfig.d.ts.map +1 -1
  89. package/dist/src/domain/sourceConfig.js +103 -19
  90. package/dist/src/domain/sourceConfig.js.map +1 -1
  91. package/dist/src/domain/sourcePackages.d.ts +8 -8
  92. package/dist/src/domain/sourcePackages.d.ts.map +1 -1
  93. package/dist/src/domain/sourceRootPair.d.ts +88 -0
  94. package/dist/src/domain/sourceRootPair.d.ts.map +1 -0
  95. package/dist/src/domain/sourceRootPair.js +108 -0
  96. package/dist/src/domain/sourceRootPair.js.map +1 -0
  97. package/dist/src/domain/syncTypes.d.ts +8 -1
  98. package/dist/src/domain/syncTypes.d.ts.map +1 -1
  99. package/dist/src/domain/syncTypes.js +1 -0
  100. package/dist/src/domain/syncTypes.js.map +1 -1
  101. package/dist/src/domain/types.d.ts +24 -1
  102. package/dist/src/domain/types.d.ts.map +1 -1
  103. package/dist/src/domain/uri.d.ts.map +1 -1
  104. package/dist/src/domain/uri.js +3 -2
  105. package/dist/src/domain/uri.js.map +1 -1
  106. package/dist/src/embeddings/clients/GeminiEmbedder.d.ts.map +1 -1
  107. package/dist/src/embeddings/clients/GeminiEmbedder.js +2 -5
  108. package/dist/src/embeddings/clients/GeminiEmbedder.js.map +1 -1
  109. package/dist/src/embeddings/clients/OpenAIEmbedder.d.ts.map +1 -1
  110. package/dist/src/embeddings/clients/OpenAIEmbedder.js +2 -3
  111. package/dist/src/embeddings/clients/OpenAIEmbedder.js.map +1 -1
  112. package/dist/src/embeddings/clients/QwenEmbedder.d.ts +2 -0
  113. package/dist/src/embeddings/clients/QwenEmbedder.d.ts.map +1 -1
  114. package/dist/src/embeddings/clients/QwenEmbedder.js +10 -2
  115. package/dist/src/embeddings/clients/QwenEmbedder.js.map +1 -1
  116. package/dist/src/embeddings/clients/VoyageEmbedder.d.ts +2 -0
  117. package/dist/src/embeddings/clients/VoyageEmbedder.d.ts.map +1 -1
  118. package/dist/src/embeddings/clients/VoyageEmbedder.js +8 -1
  119. package/dist/src/embeddings/clients/VoyageEmbedder.js.map +1 -1
  120. package/dist/src/embeddings/factory.d.ts +5 -3
  121. package/dist/src/embeddings/factory.d.ts.map +1 -1
  122. package/dist/src/embeddings/factory.js +7 -3
  123. package/dist/src/embeddings/factory.js.map +1 -1
  124. package/dist/src/embeddings/models.d.ts +1 -1
  125. package/dist/src/embeddings/models.d.ts.map +1 -1
  126. package/dist/src/embeddings/retry.js +1 -1
  127. package/dist/src/embeddings/retry.js.map +1 -1
  128. package/dist/src/embeddings/types.d.ts +6 -0
  129. package/dist/src/embeddings/types.d.ts.map +1 -1
  130. package/dist/src/embeddings/types.js +11 -0
  131. package/dist/src/embeddings/types.js.map +1 -1
  132. package/dist/src/git/GitRunner.d.ts +110 -30
  133. package/dist/src/git/GitRunner.d.ts.map +1 -1
  134. package/dist/src/git/GitRunner.js +511 -199
  135. package/dist/src/git/GitRunner.js.map +1 -1
  136. package/dist/src/git/GitWatchRegistry.d.ts +41 -35
  137. package/dist/src/git/GitWatchRegistry.d.ts.map +1 -1
  138. package/dist/src/git/GitWatchRegistry.js +61 -79
  139. package/dist/src/git/GitWatchRegistry.js.map +1 -1
  140. package/dist/src/git/gitPlace.d.ts +61 -0
  141. package/dist/src/git/gitPlace.d.ts.map +1 -0
  142. package/dist/src/git/gitPlace.js +74 -0
  143. package/dist/src/git/gitPlace.js.map +1 -0
  144. package/dist/src/git/sourceGitControl.d.ts +31 -19
  145. package/dist/src/git/sourceGitControl.d.ts.map +1 -1
  146. package/dist/src/git/sourceGitControl.js +208 -92
  147. package/dist/src/git/sourceGitControl.js.map +1 -1
  148. package/dist/src/git/sourceGitStatus.js +1 -1
  149. package/dist/src/git/sourceGitStatus.js.map +1 -1
  150. package/dist/src/git/untrackedStats.js +1 -1
  151. package/dist/src/git/untrackedStats.js.map +1 -1
  152. package/dist/src/index.d.ts +2 -1
  153. package/dist/src/index.d.ts.map +1 -1
  154. package/dist/src/index.js +2 -1
  155. package/dist/src/index.js.map +1 -1
  156. package/dist/src/lifecycle.d.ts +8 -11
  157. package/dist/src/lifecycle.d.ts.map +1 -1
  158. package/dist/src/lifecycle.js +2 -1
  159. package/dist/src/lifecycle.js.map +1 -1
  160. package/dist/src/routes/git.d.ts.map +1 -1
  161. package/dist/src/routes/git.js +183 -54
  162. package/dist/src/routes/git.js.map +1 -1
  163. package/dist/src/routes/helpers/uriGuard.d.ts +1 -1
  164. package/dist/src/routes/helpers/uriGuard.d.ts.map +1 -1
  165. package/dist/src/routes/helpers/uriGuard.js +3 -2
  166. package/dist/src/routes/helpers/uriGuard.js.map +1 -1
  167. package/dist/src/routes/helpers.d.ts +10 -3
  168. package/dist/src/routes/helpers.d.ts.map +1 -1
  169. package/dist/src/routes/helpers.js +12 -5
  170. package/dist/src/routes/helpers.js.map +1 -1
  171. package/dist/src/routes/list.d.ts.map +1 -1
  172. package/dist/src/routes/list.js +2 -3
  173. package/dist/src/routes/list.js.map +1 -1
  174. package/dist/src/routes/policies.d.ts +6 -4
  175. package/dist/src/routes/policies.d.ts.map +1 -1
  176. package/dist/src/routes/policies.js +22 -16
  177. package/dist/src/routes/policies.js.map +1 -1
  178. package/dist/src/routes/raw.d.ts.map +1 -1
  179. package/dist/src/routes/raw.js +65 -11
  180. package/dist/src/routes/raw.js.map +1 -1
  181. package/dist/src/routes/sources.d.ts +60 -18
  182. package/dist/src/routes/sources.d.ts.map +1 -1
  183. package/dist/src/routes/sources.js +411 -299
  184. package/dist/src/routes/sources.js.map +1 -1
  185. package/dist/src/services/BridgeService.d.ts +15 -35
  186. package/dist/src/services/BridgeService.d.ts.map +1 -1
  187. package/dist/src/services/BridgeService.js +30 -88
  188. package/dist/src/services/BridgeService.js.map +1 -1
  189. package/dist/src/services/FilesystemService.d.ts +3 -2
  190. package/dist/src/services/FilesystemService.d.ts.map +1 -1
  191. package/dist/src/services/FilesystemService.js +110 -32
  192. package/dist/src/services/FilesystemService.js.map +1 -1
  193. package/dist/src/services/FilesystemUiService.d.ts +4 -1
  194. package/dist/src/services/FilesystemUiService.d.ts.map +1 -1
  195. package/dist/src/services/FilesystemUiService.js +66 -25
  196. package/dist/src/services/FilesystemUiService.js.map +1 -1
  197. package/dist/src/services/SyncScheduler.d.ts +12 -4
  198. package/dist/src/services/SyncScheduler.d.ts.map +1 -1
  199. package/dist/src/services/SyncScheduler.js +37 -8
  200. package/dist/src/services/SyncScheduler.js.map +1 -1
  201. package/dist/src/services/baselineRepair.d.ts +13 -3
  202. package/dist/src/services/baselineRepair.d.ts.map +1 -1
  203. package/dist/src/services/baselineRepair.js +13 -3
  204. package/dist/src/services/baselineRepair.js.map +1 -1
  205. package/dist/src/services/declaredSources.d.ts +125 -42
  206. package/dist/src/services/declaredSources.d.ts.map +1 -1
  207. package/dist/src/services/declaredSources.js +117 -45
  208. package/dist/src/services/declaredSources.js.map +1 -1
  209. package/dist/src/store/dataFormats.d.ts +17 -2
  210. package/dist/src/store/dataFormats.d.ts.map +1 -1
  211. package/dist/src/store/dataFormats.js +18 -3
  212. package/dist/src/store/dataFormats.js.map +1 -1
  213. package/dist/src/sync/DeltaSyncRunner.d.ts.map +1 -1
  214. package/dist/src/sync/DeltaSyncRunner.js +144 -4
  215. package/dist/src/sync/DeltaSyncRunner.js.map +1 -1
  216. package/dist/src/sync/SyncJobQueue.d.ts +7 -2
  217. package/dist/src/sync/SyncJobQueue.d.ts.map +1 -1
  218. package/dist/src/sync/SyncJobQueue.js +16 -10
  219. package/dist/src/sync/SyncJobQueue.js.map +1 -1
  220. package/dist/src/sync/SyncWatchService.d.ts +21 -4
  221. package/dist/src/sync/SyncWatchService.d.ts.map +1 -1
  222. package/dist/src/sync/SyncWatchService.js +115 -10
  223. package/dist/src/sync/SyncWatchService.js.map +1 -1
  224. package/dist/src/sync/categoryInference.d.ts +1 -1
  225. package/dist/src/sync/categoryInference.js +1 -1
  226. package/dist/src/usecases/admitSourceRoot.d.ts +65 -0
  227. package/dist/src/usecases/admitSourceRoot.d.ts.map +1 -0
  228. package/dist/src/usecases/admitSourceRoot.js +85 -0
  229. package/dist/src/usecases/admitSourceRoot.js.map +1 -0
  230. package/dist/src/usecases/browseSourceFolders.d.ts +85 -0
  231. package/dist/src/usecases/browseSourceFolders.d.ts.map +1 -0
  232. package/dist/src/usecases/browseSourceFolders.js +210 -0
  233. package/dist/src/usecases/browseSourceFolders.js.map +1 -0
  234. package/dist/src/usecases/createDeclaredSources.d.ts +13 -2
  235. package/dist/src/usecases/createDeclaredSources.d.ts.map +1 -1
  236. package/dist/src/usecases/createDeclaredSources.js +39 -0
  237. package/dist/src/usecases/createDeclaredSources.js.map +1 -1
  238. package/dist/src/usecases/list.d.ts.map +1 -1
  239. package/dist/src/usecases/list.js +83 -26
  240. package/dist/src/usecases/list.js.map +1 -1
  241. package/dist/src/usecases/listAttachableDevices.d.ts +13 -0
  242. package/dist/src/usecases/listAttachableDevices.d.ts.map +1 -0
  243. package/dist/src/usecases/listAttachableDevices.js +10 -0
  244. package/dist/src/usecases/listAttachableDevices.js.map +1 -0
  245. package/dist/src/usecases/listSourcePackages.d.ts.map +1 -1
  246. package/dist/src/usecases/listSourcePackages.js +2 -5
  247. package/dist/src/usecases/listSourcePackages.js.map +1 -1
  248. package/dist/src/usecases/purgeExcludedPoints.d.ts.map +1 -1
  249. package/dist/src/usecases/purgeExcludedPoints.js +3 -2
  250. package/dist/src/usecases/purgeExcludedPoints.js.map +1 -1
  251. package/dist/src/usecases/readFiles.d.ts.map +1 -1
  252. package/dist/src/usecases/readFiles.js +15 -0
  253. package/dist/src/usecases/readFiles.js.map +1 -1
  254. package/dist/src/usecases/reconcileSourcePackageRoots.d.ts +1 -1
  255. package/dist/src/usecases/reconcileSourcePackageRoots.d.ts.map +1 -1
  256. package/dist/src/usecases/reconcileSourcePackageRoots.js +2 -1
  257. package/dist/src/usecases/reconcileSourcePackageRoots.js.map +1 -1
  258. package/dist/src/usecases/revokePrincipal.d.ts +7 -5
  259. package/dist/src/usecases/revokePrincipal.d.ts.map +1 -1
  260. package/dist/src/usecases/revokePrincipal.js +29 -7
  261. package/dist/src/usecases/revokePrincipal.js.map +1 -1
  262. package/dist/src/usecases/scheduleSourceSync.d.ts +7 -0
  263. package/dist/src/usecases/scheduleSourceSync.d.ts.map +1 -1
  264. package/dist/src/usecases/scheduleSourceSync.js +6 -5
  265. package/dist/src/usecases/scheduleSourceSync.js.map +1 -1
  266. package/dist/src/usecases/triggerSourceSync.d.ts +46 -0
  267. package/dist/src/usecases/triggerSourceSync.d.ts.map +1 -0
  268. package/dist/src/usecases/triggerSourceSync.js +75 -0
  269. package/dist/src/usecases/triggerSourceSync.js.map +1 -0
  270. package/dist/src/usecases/uploadBinary.d.ts +2 -1
  271. package/dist/src/usecases/uploadBinary.d.ts.map +1 -1
  272. package/dist/src/usecases/uploadBinary.js +2 -2
  273. package/dist/src/usecases/uploadBinary.js.map +1 -1
  274. package/dist/src/usecases/vector/endpointGuard.d.ts +1 -1
  275. package/dist/src/usecases/vector/endpointGuard.js +1 -1
  276. package/dist/src/vector/qdrantClient.d.ts +1 -1
  277. package/dist/src/vector/qdrantClient.js +1 -1
  278. package/dist/src/wiring.d.ts +3 -0
  279. package/dist/src/wiring.d.ts.map +1 -1
  280. package/dist/src/wiring.js +72 -6
  281. package/dist/src/wiring.js.map +1 -1
  282. package/package.json +145 -54
  283. package/skills/connect-business-data/SKILL.md +2 -2
  284. package/skills/create-package/SKILL.md +18 -18
  285. package/skills/create-package/references/config-and-credentials.md +16 -13
  286. package/skills/create-package/references/connectors-and-uri-policies.md +36 -27
  287. package/skills/create-package/references/manifest-and-discovery.md +12 -12
  288. package/skills/create-package/references/runtime-and-build.md +18 -18
  289. package/skills/create-package/references/skills-and-context.md +35 -19
  290. package/skills/create-package/references/surfaces-and-design.md +16 -16
  291. package/skills/create-package/references/team-and-workflows.md +2 -2
  292. package/skills/create-package/references/test-and-ship.md +17 -17
  293. package/skills/create-package/references/tools-and-schemas.md +5 -5
  294. package/skills/create-package/scripts/{check-package.sh → check-package.mjs} +78 -64
  295. package/skills/create-package/scripts/{verify-loaded.sh → verify-loaded.mjs} +156 -162
  296. package/skills/git/SKILL.md +31 -29
  297. package/skills/manage-files/SKILL.md +11 -14
  298. package/skills/manage-sources/SKILL.md +85 -45
  299. package/skills/manage-uri-policy/SKILL.md +9 -6
  300. package/skills/sync/SKILL.md +1 -1
  301. package/dist/src/connectors/LocalDiskConnector.d.ts +0 -171
  302. package/dist/src/connectors/LocalDiskConnector.d.ts.map +0 -1
  303. package/dist/src/connectors/LocalDiskConnector.js +0 -1233
  304. package/dist/src/connectors/LocalDiskConnector.js.map +0 -1
  305. package/skills/manage-files/scripts/copy.sh +0 -7
  306. package/skills/manage-files/scripts/create.sh +0 -7
  307. package/skills/manage-files/scripts/mkdir.sh +0 -7
  308. package/skills/manage-files/scripts/modify.sh +0 -7
  309. package/skills/manage-files/scripts/upload.sh +0 -16
  310. package/skills/manage-files/scripts/write.sh +0 -29
  311. package/skills/manage-sources/scripts/reembed.sh +0 -23
@@ -1,59 +1,74 @@
1
- #!/usr/bin/env bash
2
- #
3
- # create-package/check-package.sh — static pre-flight for a package directory.
4
- #
5
- # It catches only what fails SILENTLY — a frontmatter key nobody parses, a
6
- # `files[]` whitelist that ships an empty tarball, a `$schema` that loads and
7
- # then breaks every call, an unreachable widget, a UI entry whose stylesheet
8
- # never loads, compiled output one directory from where the loader looks. What
9
- # the loader itself reports BY NAME at install (id charset, reserved ids,
10
- # uriPolicies, workflow templates, most manifest validation) is NOT repeated
11
- # here — install and read the load status.
12
- #
13
- # ONE class here is authoring-only by construction: what a package UI entry may
14
- # reference. The kernel validator receives the manifest OBJECT — no package root,
15
- # no filesystem — so it can never inspect a file's CONTENT, and the platform
16
- # blocks nothing at runtime. The rules INVERT with the surface's declared
17
- # `assetMode`: a SELF-CONTAINED entry (the default) must inline everything, since
18
- # its subresource request leaves an opaque origin with no session cookie and is
19
- # not served; a "bundle" entry has its siblings served, and must keep every
20
- # reference inside the two roots that lane serves. This script is where both are
21
- # enforced, before either becomes a blank surface.
22
- #
23
- # Findings here are AUTHORING findings. They never set a package's load status —
24
- # that belongs to the contribution validator, and a new ERROR there would
25
- # retroactively flip already-installed packages to `error`.
26
- #
27
- # MODE comes from disk. `package.json`#neuralis or `neuralis.package.json` =
28
- # manifest mode. NO manifest = markdown mode (the source-package / bare-skill
29
- # layout): it checks package recognition, the markdown categories and their
30
- # frontmatter, SKIPS every manifest-dependent check and PRINTS the skip — so
31
- # nothing here ever reads as verified when it was not.
32
- #
33
- # CANNOT CHECK anything needing a running platform (did it load, does a handler
34
- # work, does a feature id exist). Nor your trust tier — trust is assigned by
35
- # where the package came FROM, never declared in a manifest, so nothing here
36
- # reads `access.trust` as a grant. Load proof, after install:
37
- # bash "${SKILL_DIR}/scripts/verify-loaded.sh" <package-id>
38
- #
39
- # USAGE bash check-package.sh <package-root>
40
- # EXIT 0 = no errors (warnings may print) · 1 = ERRORs · 2 = usage / no node
41
- # https://docs.neuralisapp.com/package-system/directory-contract
42
- # https://docs.neuralisapp.com/package-system/source-packages
1
+ //
2
+ // create-package/check-package.mjs — static pre-flight for a package directory.
3
+ //
4
+ // It catches only what fails SILENTLY — a frontmatter key nobody parses, a
5
+ // `files[]` whitelist that ships an empty tarball, a `$schema` that loads and
6
+ // then breaks every call, an unreachable widget, a UI entry whose stylesheet
7
+ // never loads, compiled output one directory from where the loader looks. What
8
+ // the loader itself reports BY NAME at install (id charset, reserved ids,
9
+ // uriPolicies, workflow templates, most manifest validation) is NOT repeated
10
+ // here — install and read the load status.
11
+ //
12
+ // ONE class here is authoring-only by construction: what a package UI entry may
13
+ // reference. The kernel validator receives the manifest OBJECT — no package root,
14
+ // no filesystem — so it can never inspect a file's CONTENT, and the platform
15
+ // blocks nothing at runtime. The rules INVERT with the surface's declared
16
+ // `assetMode`: a SELF-CONTAINED entry (the default) must inline everything, since
17
+ // its subresource request leaves an opaque origin with no session cookie and is
18
+ // not served; a "bundle" entry has its siblings served, and must keep every
19
+ // reference inside the two roots that lane serves. This script is where both are
20
+ // enforced, before either becomes a blank surface.
21
+ //
22
+ // Findings here are AUTHORING findings. They never set a package's load status —
23
+ // that belongs to the contribution validator, and a new ERROR there would
24
+ // retroactively flip already-installed packages to `error`.
25
+ //
26
+ // MODE comes from disk. `package.json`#neuralis or `neuralis.package.json` =
27
+ // manifest mode. NO manifest = markdown mode (the source-package / bare-skill
28
+ // layout): it checks package recognition, the markdown categories and their
29
+ // frontmatter, SKIPS every manifest-dependent check and PRINTS the skip — so
30
+ // nothing here ever reads as verified when it was not.
31
+ //
32
+ // CANNOT CHECK anything needing a running platform (did it load, does a handler
33
+ // work, does a feature id exist). Nor your trust tier — trust is assigned by
34
+ // where the package came FROM, never declared in a manifest, so nothing here
35
+ // reads `access.trust` as a grant. Load proof, after install:
36
+ // node "${SKILL_DIR}/scripts/verify-loaded.mjs" <package-id>
37
+ //
38
+ // USAGE node check-package.mjs <package-root>
39
+ // EXIT 0 = no errors (warnings may print) · 1 = ERRORs · 2 = usage
40
+ // https://docs.neuralisapp.com/package-system/directory-contract
41
+ // https://docs.neuralisapp.com/package-system/source-packages
43
42
 
44
- set -euo pipefail
43
+ import fs from 'node:fs';
44
+ import { createRequire } from 'node:module';
45
+ import path from 'node:path';
46
+ import { fileURLToPath } from 'node:url';
45
47
 
46
- if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
47
- sed -n '2,35p' "$0" | sed 's/^#\{0,1\} \{0,1\}//'; exit 0
48
- fi
49
- [ "$#" -eq 1 ] || { echo "usage: bash check-package.sh <package-root>" >&2; exit 2; }
50
- [ -d "$1" ] || { echo "ERROR $1 is not a directory — pass the package ROOT folder" >&2; exit 2; }
51
- command -v node >/dev/null 2>&1 || { echo "ERROR node not on PATH (this parses JSON with node, not jq)" >&2; exit 2; }
52
-
53
- node - "$1" "$(dirname "$0")" <<'NODE_CHECK'
54
- 'use strict';
55
- const fs = require('fs'), path = require('path');
56
- const ROOT = process.argv[2], SCRIPT_DIR = process.argv[3], F = [];
48
+ // `require.resolve(spec, { paths: [from] })` walks node_modules up from each
49
+ // root, exactly as the CommonJS loader does — the platform modules below are
50
+ // found from the package, the cwd or this script's own install.
51
+ const require = createRequire(import.meta.url);
52
+ const SELF = fileURLToPath(import.meta.url);
53
+ const SCRIPT_DIR = path.dirname(SELF);
54
+ const argv = process.argv.slice(2);
55
+ if (argv[0] === '-h' || argv[0] === '--help') {
56
+ const head = fs.readFileSync(SELF, 'utf8').split('\n');
57
+ const end = head.findIndex((l) => !l.startsWith('//'));
58
+ process.stdout.write(`${head.slice(1, end).map((l) => l.replace(/^\/\/ ?/, '')).join('\n')}\n`);
59
+ process.exit(0);
60
+ }
61
+ if (argv.length !== 1) {
62
+ process.stderr.write('usage: node check-package.mjs <package-root>\n');
63
+ process.exit(2);
64
+ }
65
+ let isDirectory = false;
66
+ try { isDirectory = fs.statSync(argv[0]).isDirectory(); } catch { isDirectory = false; }
67
+ if (!isDirectory) {
68
+ process.stderr.write(`ERROR ${argv[0]} is not a directory — pass the package ROOT folder\n`);
69
+ process.exit(2);
70
+ }
71
+ const ROOT = argv[0], F = [];
57
72
  const rel = (p) => path.relative(ROOT, p) || '.';
58
73
  const err = (f, m) => F.push({ lvl: 'ERROR', f, m });
59
74
  const warn = (f, m) => F.push({ lvl: 'WARN', f, m });
@@ -63,7 +78,7 @@ const json = (p) => JSON.parse(fs.readFileSync(p, 'utf8'));
63
78
  const at = (...p) => path.join(ROOT, ...p);
64
79
 
65
80
  const SKIP = new Set(['node_modules', '.git', 'dist', 'build', 'coverage', 'scripts', 'references', 'assets']);
66
- const DOTS = new Set(['.claude', '.agents', '.cursor', '.codex', '.gemini', '.windsurf', '.github', '.opencode', '.kilo', '.roo']);
81
+ const DOTS = new Set(['.claude', '.agents', '.cursor', '.codex', '.gemini', '.windsurf', '.devin', '.github', '.opencode', '.kilo', '.roo']);
67
82
  const CATS = ['skills', 'instructions', 'rules', 'agents', 'docs', 'commands'];
68
83
 
69
84
  function walk(d, out = [], depth = 0) {
@@ -214,7 +229,7 @@ if (man) {
214
229
 
215
230
  // tools — the silent traps only.
216
231
  const D7 = 'http://json-schema.org/draft-07/schema#';
217
- const IDENT = /^(user|project|agent|conversation|request|toolUse)Id$|^(role|priority|grantedFeatures|spendLimits|dailyLimits|llmRateLimitRpm|agentAccess|agentOwnership|session)$/;
232
+ const IDENT = /^(user|project|agent|conversation|request|toolUse|delegateRun)Id$|^(delegateMode|role|priority|rolePriorities|grantedFeatures|spendLimits|dailyLimits|llmRateLimitRpm|agentAccess|agentOwnership|displayName|session)$/;
218
233
  const toolCardTypes = [];
219
234
  for (const n of dir(at('tools')) ? fs.readdirSync(at('tools')).filter((x) => x.endsWith('.json')) : []) {
220
235
  const f = `tools/${n}`;
@@ -276,7 +291,7 @@ if (man) {
276
291
  }
277
292
 
278
293
  // --- cards + the surface asset contract ------------------------------------
279
- // TWO renderers exist: `direct` (first-party compiled React, registered by the
294
+ // TWO renderers exist: `direct` (native compiled React, registered by the
280
295
  // package's OWN host entrypoint) and `iframe` (every sandboxed path). An
281
296
  // asset-backed iframe entry lives under its own canonical
282
297
  // `app/surfaces/{kind}/{surfaceId}/` root — widget `{surfaceId}` is its `type`,
@@ -477,14 +492,14 @@ if (man) {
477
492
  return;
478
493
  }
479
494
  if (renderer === 'direct') {
480
- warn(MF, `${L} renderer "direct" renders only under an ASSIGNED first-party tier — a dropped package must use "iframe"`);
495
+ warn(MF, `${L} renderer "direct" renders only under an ASSIGNED native tier — a dropped package must use "iframe"`);
481
496
  return;
482
497
  }
483
498
  if (renderer !== 'iframe') return;
484
499
  const url = typeof render.url === 'string' ? render.url.trim() : '';
485
500
  if (!url) { err(MF, `${L} renderer "iframe" with no "url" — nothing to load`); return; }
486
501
  if (isAbsUrl(url)) {
487
- warn(MF, `${L} absolute iframe url "${url}" loads only under an ASSIGNED trusted/first-party tier — the tier comes from where the package was installed FROM, never from access.trust; an untrusted package's absolute surface is dropped from the snapshot fail-closed`);
502
+ warn(MF, `${L} absolute iframe url "${url}" loads only under an ASSIGNED trusted/native tier — the tier comes from where the package was installed FROM, never from access.trust; an untrusted package's absolute surface is dropped from the snapshot fail-closed`);
488
503
  if (declaredMode === 'bundle') {
489
504
  warn(MF, `${label}: "assetMode":"bundle" is IGNORED on an absolute url — the platform serves bundle subresources only for an entry under the surface's own asset root.`);
490
505
  }
@@ -661,8 +676,8 @@ if (man) {
661
676
  if (rt.skillScripts !== undefined && rt.skillScripts !== 'none') need.push(`runtime.skillScripts "${rt.skillScripts}" (validation fails below trusted — declare "none" or omit)`);
662
677
  if (pm.exec === true || pm.net === 'full' || pm.fs === 'full') need.push('runtime.permissions exec / net:"full" / fs:"full" (rejected outright when untrusted)');
663
678
  if (need.length) warn(MF, `${need.join(' · ')} — ${TIER}`);
664
- if (rt.type === 'node') warn(MF, `runtime.type "node" runs IN-PROCESS and needs an ASSIGNED first-party tier — elsewhere it loads PARTIAL ("untrusted-node") and every handler errors. Use "wasm"`);
665
- if (rt.type === 'mcp') warn(MF, `runtime.type "mcp" spawns a subprocess as the HOST USER and needs an ASSIGNED first-party tier — elsewhere it loads PARTIAL ("untrusted-mcp"), nothing spawns and every handler errors. "wasm" is the only code runtime below first-party. Use "wasm"`);
679
+ if (rt.type === 'node') warn(MF, `runtime.type "node" runs IN-PROCESS and needs an ASSIGNED native tier — elsewhere it loads PARTIAL ("untrusted-node") and every handler errors. Use "wasm"`);
680
+ if (rt.type === 'mcp') warn(MF, `runtime.type "mcp" spawns a subprocess as the HOST USER and needs an ASSIGNED native tier — elsewhere it loads PARTIAL ("untrusted-mcp"), nothing spawns and every handler errors. "wasm" is the only code runtime below native. Use "wasm"`);
666
681
  if (rt.type === 'mcp' && !(rt.entry && rt.entry.command)) warn(MF, 'runtime.type "mcp" without runtime.entry.command — nothing spawns, so it loads PARTIAL ("runtime-unavailable")');
667
682
 
668
683
  // compiled output — the loader looks ONLY under dist/src/**.
@@ -689,7 +704,6 @@ const e = F.filter((x) => x.lvl === 'ERROR').length;
689
704
  const sk = F.filter((x) => x.lvl === 'SKIP').length;
690
705
  out.write(`\n${e} error(s), ${F.length - e - sk} warning(s)${sk ? `, ${sk} check(s) SKIPPED` : ''} — ${path.basename(ROOT)}\n`);
691
706
  if (e === 0) out.write(MODE === 'manifest'
692
- ? 'Static checks pass — that proves NOTHING about loading. Install, then verify-loaded.sh.\n'
693
- : 'Static checks pass for what markdown can carry — that proves NOTHING about discovery.\nThe files must be indexed by a sync first, then: verify-loaded.sh "<slug>://<path>?project=<p>&scope=…".\n');
707
+ ? 'Static checks pass — that proves NOTHING about loading. Install, then verify-loaded.mjs.\n'
708
+ : 'Static checks pass for what markdown can carry — that proves NOTHING about discovery.\nThe files must be indexed by a sync first, then: verify-loaded.mjs "<slug>://<path>?project=<p>&scope=…".\n');
694
709
  process.exit(e > 0 ? 1 : 0);
695
- NODE_CHECK
@@ -1,84 +1,94 @@
1
- #!/usr/bin/env bash
2
- #
3
- # create-package/verify-loaded.sh — runtime proof that a package actually loaded.
4
- #
5
- # "It built clean" is not "it loaded". A package can compile, install, appear on
6
- # disk, and still register NOTHING — one bad tool schema aborts the whole load,
7
- # a missing build makes it declarative-only, an untrusted node runtime leaves
8
- # every handler returning an error. This script asks the platform, and reports
9
- # only what the platform said.
10
- #
11
- # WHAT IT CHECKS
12
- # Reads the agent-core package diagnostics and overview surfaces as YOU through
13
- # `neuralis request` (the session ticket inside an activated skill, your
14
- # `neuralis login` on your own machine), and reports one of:
15
- # loaded — registered and operational
16
- # partial — declarative contributions registered, no code runtime; prints
17
- # the reason (build-missing | runtime-unavailable |
18
- # untrusted-node | untrusted-mcp)
19
- # error — validation or init crash; prints the recorded message
20
- # missing — installed but never reached the loader (manifest read failed)
21
- # absent — the platform does not list it for you at all; the verdict then
22
- # prints every installed AND source package id it DOES list, so
23
- # you can find the right one without guessing
24
- # On a clean load it also prints the surface the platform registered FOR YOU:
25
- # tools, skills, instructions, rules, agents, docs, commands, workflows,
26
- # connectors, hooks, policies, app surfaces, team members, active file count.
27
- # The `connectors` row counts DECLARATIONS the loader accepted from the
28
- # manifest — not live outbound instances. An outbound (mcp/openapi/http)
29
- # connector is registered into ONE tenant, and into NO tenant at all when the
30
- # package is neither first-party nor owned by a resolvable project, so this
31
- # count can be non-zero while the connector exists nowhere.
32
- # A source package (markdown discovered in an indexed source) has no loader
33
- # status at all — it is reported separately, with its recognition reason.
34
- #
35
- # WHAT IT CANNOT CHECK
36
- # That a surface WORKS. A loaded package with a broken handler still says
37
- # `loaded`. Run the tool, open the widget, call the route — as the LEAST
38
- # privileged role that is supposed to have access, because feature-gated
39
- # contributions are hidden, so testing as the owner hides every gate bug.
40
- # It also cannot see what your identity may not see: these surfaces are
41
- # scoped, so `absent` can mean "correctly hidden from you", not "broken".
42
- # For a source package `absent` also covers "the files exist on disk but no
43
- # sync has indexed them yet" — discovery reads the index, never the live tree.
44
- # For the static half run, before you install:
45
- # bash "${SKILL_DIR}/scripts/check-package.sh" <package-root>
46
- #
47
- # USAGE bash verify-loaded.sh <package-id> [--raw]
48
- # <package-id> the manifest id, e.g. "@acme/reports" or "reports".
49
- # A drop or source package: its instance URI, quoted.
50
- # --raw dump both untouched JSON responses before the verdict,
51
- # so you can self-diagnose if the shape ever drifts.
52
- # EXIT 0 = loaded
53
- # 1 = partial (reason printed)
54
- # 2 = absent — not listed for this caller
55
- # 3 = error / missing (recorded message printed)
56
- # 4 = could not reach the diagnostics surface (no `neuralis` CLI or login, no
57
- # network, HTTP failure, or the caller lacks the `core.observe`
58
- # feature). NOTHING is claimed about the package in this state.
59
- #
60
- # This script never accepts, prints or persists a token.
61
- #
62
- # Testing reference: https://docs.neuralisapp.com/package-system/testing
1
+ //
2
+ // create-package/verify-loaded.mjs — runtime proof that a package actually loaded.
3
+ //
4
+ // "It built clean" is not "it loaded". A package can compile, install, appear on
5
+ // disk, and still register NOTHING — one bad tool schema aborts the whole load,
6
+ // a missing build makes it declarative-only, an untrusted node runtime leaves
7
+ // every handler returning an error. This script asks the platform, and reports
8
+ // only what the platform said.
9
+ //
10
+ // WHAT IT CHECKS
11
+ // Reads the agent-core package diagnostics and overview surfaces as YOU through
12
+ // `neuralis request` (the session ticket inside an activated skill, your
13
+ // `neuralis login` on your own machine), and reports one of:
14
+ // loaded — registered and operational
15
+ // partial — declarative contributions registered, no code runtime; prints
16
+ // the reason (build-missing | runtime-unavailable |
17
+ // untrusted-node | untrusted-mcp)
18
+ // error — validation or init crash; prints the recorded message
19
+ // missing — installed but never reached the loader (manifest read failed)
20
+ // absent — the platform does not list it for you at all; the verdict then
21
+ // prints every installed AND source package id it DOES list, so
22
+ // you can find the right one without guessing
23
+ // On a clean load it also prints the surface the platform registered FOR YOU:
24
+ // tools, skills, instructions, rules, agents, docs, commands, workflows,
25
+ // connectors, hooks, policies, app surfaces, team members, active file count.
26
+ // The `connectors` row counts DECLARATIONS the loader accepted from the
27
+ // manifest — not live outbound instances. An outbound (mcp/openapi/http)
28
+ // connector is registered into ONE tenant, and into NO tenant at all when the
29
+ // package is neither native nor owned by a resolvable project, so this
30
+ // count can be non-zero while the connector exists nowhere.
31
+ // A source package (markdown discovered in an indexed source) has no loader
32
+ // status at all — it is reported separately, with its recognition reason.
33
+ //
34
+ // WHAT IT CANNOT CHECK
35
+ // That a surface WORKS. A loaded package with a broken handler still says
36
+ // `loaded`. Run the tool, open the widget, call the route — as the LEAST
37
+ // privileged role that is supposed to have access, because feature-gated
38
+ // contributions are hidden, so testing as the owner hides every gate bug.
39
+ // It also cannot see what your identity may not see: these surfaces are
40
+ // scoped, so `absent` can mean "correctly hidden from you", not "broken".
41
+ // For a source package `absent` also covers "the files exist on disk but no
42
+ // sync has indexed them yet" — discovery reads the index, never the live tree.
43
+ // For the static half run, before you install:
44
+ // node "${SKILL_DIR}/scripts/check-package.mjs" <package-root>
45
+ //
46
+ // USAGE node verify-loaded.mjs <package-id> [--raw]
47
+ // <package-id> the manifest id, e.g. "@acme/reports" or "reports".
48
+ // A drop or source package: its instance URI, quoted.
49
+ // --raw dump both untouched JSON responses before the verdict,
50
+ // so you can self-diagnose if the shape ever drifts.
51
+ // EXIT 0 = loaded
52
+ // 1 = partial (reason printed)
53
+ // 2 = absent — not listed for this caller
54
+ // 3 = error / missing (recorded message printed)
55
+ // 4 = could not reach the diagnostics surface (no `neuralis` CLI or login, no
56
+ // network, HTTP failure, or the caller lacks the `core.observe`
57
+ // feature). NOTHING is claimed about the package in this state.
58
+ //
59
+ // The CLI runs as `node <NEURALIS_CLI_ENTRY> request …` — the entry every
60
+ // Neuralis runner exports — and never through a shell. With the variable
61
+ // absent, Linux and macOS start `neuralis` from PATH; Windows stops by name.
62
+ //
63
+ // This script never accepts, prints or persists a token.
64
+ //
65
+ // Testing reference: https://docs.neuralisapp.com/package-system/testing
63
66
 
64
- set -euo pipefail
67
+ import { execFileSync } from 'node:child_process';
68
+ import { readFileSync } from 'node:fs';
69
+ import { fileURLToPath } from 'node:url';
65
70
 
66
- RAW=0
67
- PKG_ID=""
68
- for arg in "$@"; do
69
- case "$arg" in
70
- --raw) RAW=1 ;;
71
- -h|--help) sed -n '2,60p' "$0" | sed 's/^#\{0,1\} \{0,1\}//'; exit 0 ;;
72
- -*) echo "unknown flag: $arg" >&2; exit 4 ;;
73
- *) if [ -z "$PKG_ID" ]; then PKG_ID="$arg"; else echo "unexpected argument: $arg" >&2; exit 4; fi ;;
74
- esac
75
- done
76
-
77
- manual_fallback() {
78
- case "$PKG_ID" in
79
- *://*)
80
- cat >&2 <<'SRCFALLBACK'
71
+ const SELF = fileURLToPath(import.meta.url);
72
+ let RAW = false;
73
+ let pkgId = '';
74
+ for (const arg of process.argv.slice(2)) {
75
+ if (arg === '--raw') RAW = true;
76
+ else if (arg === '-h' || arg === '--help') {
77
+ const head = readFileSync(SELF, 'utf8').split('\n');
78
+ const end = head.findIndex((l) => !l.startsWith('//'));
79
+ process.stdout.write(`${head.slice(1, end).map((l) => l.replace(/^\/\/ ?/, '')).join('\n')}\n`);
80
+ process.exit(0);
81
+ } else if (arg.startsWith('-')) {
82
+ process.stderr.write(`unknown flag: ${arg}\n`);
83
+ process.exit(4);
84
+ } else if (!pkgId) pkgId = arg;
85
+ else {
86
+ process.stderr.write(`unexpected argument: ${arg}\n`);
87
+ process.exit(4);
88
+ }
89
+ }
81
90
 
91
+ const SOURCE_FALLBACK = `
82
92
  Cannot verify programmatically. Do NOT record this package as working.
83
93
 
84
94
  A SOURCE package never passes through the loader, so there is NO load line
@@ -99,12 +109,8 @@ Verify a source package this way instead:
99
109
  SKILL.md, a marker dot-dir, or a usable manifest), and inside skills/
100
110
  only a file named SKILL.md counts.
101
111
 
102
- SRCFALLBACK
103
- return
104
- ;;
105
- esac
106
- cat >&2 <<FALLBACK
107
-
112
+ `;
113
+ const LOG_FALLBACK = `
108
114
  Cannot verify programmatically. Do NOT record this package as working.
109
115
  Fall back to the server log — the loader writes one line per package:
110
116
 
@@ -121,85 +127,76 @@ Fall back to the server log — the loader writes one line per package:
121
127
  Search the platform logs for your package id and read which of those five
122
128
  lines names it. No line at all means the loader never saw it: the install
123
129
  did not land, or the manifest could not be read.
124
- FALLBACK
125
- }
126
-
127
- if [ -z "$PKG_ID" ]; then
128
- echo "usage: bash verify-loaded.sh <package-id> [--raw]" >&2
129
- exit 4
130
- fi
131
- if ! command -v neuralis >/dev/null 2>&1; then
132
- echo "ERROR neuralis (the CLI) not found on PATH" >&2
133
- manual_fallback
134
- exit 4
135
- fi
136
- if ! command -v node >/dev/null 2>&1; then
137
- echo "ERROR node not found on PATH — this script parses JSON with node, not jq" >&2
138
- manual_fallback
139
- exit 4
140
- fi
141
- BASE_ROUTE="@neuralis/agent-core/packages"
142
-
143
- WORK="$(mktemp -d)"
144
- trap 'rm -rf "$WORK"' EXIT
130
+ `;
131
+ const manualFallback = () => process.stderr.write(pkgId.includes('://') ? SOURCE_FALLBACK : LOG_FALLBACK);
132
+ const fail = (message) => {
133
+ process.stderr.write(`${message}\n`);
134
+ manualFallback();
135
+ process.exit(4);
136
+ };
145
137
 
146
- # `neuralis request` prints a 2xx body on stdout (exit 0); a non-2xx body goes to
147
- # stderr with an `HTTP <code>` line (exit 1). No such line = no answer
148
- # at all (no CLI login, no network) — "000". Its error text stays in request.err.
149
- fetch() { # fetch <route> <outfile> -> echoes the HTTP status ("000" = no response)
150
- local rc=0 code
151
- neuralis request GET "$1" >"$2" 2>"$WORK/request.err" || rc=$?
152
- if [ "$rc" -eq 0 ]; then echo 200; return; fi
153
- code="$(sed -n '/^HTTP [0-9][0-9][0-9]$/{s/^HTTP //p;q;}' "$WORK/request.err")"
154
- if [ -n "$code" ]; then awk '!d && /^HTTP [0-9][0-9][0-9]$/ {d=1; next} {print}' "$WORK/request.err" > "$2"; else code="000"; fi
155
- echo "$code"
138
+ if (!pkgId) {
139
+ process.stderr.write('usage: node verify-loaded.mjs <package-id> [--raw]\n');
140
+ process.exit(4);
156
141
  }
142
+ const BASE_ROUTE = '@neuralis/agent-core/packages';
157
143
 
158
- DIAG_CODE="$(fetch "${BASE_ROUTE}/diagnostics" "$WORK/diag.json")"
159
-
160
- if [ "$DIAG_CODE" = "403" ]; then
161
- echo "FORBIDDEN the package diagnostics surface requires the 'core.observe' feature, and your identity does not hold it." >&2
162
- echo " This is a capability you are missing, not a broken package — say so instead of retrying." >&2
163
- manual_fallback
164
- exit 4
165
- fi
166
- if [ "$DIAG_CODE" != "200" ]; then
167
- echo "ERROR GET ${BASE_ROUTE}/diagnostics returned HTTP ${DIAG_CODE}" >&2
168
- [ -s "$WORK/request.err" ] && sed 's/^/ /' "$WORK/request.err" >&2
169
- [ -s "$WORK/diag.json" ] && head -c 600 "$WORK/diag.json" >&2 && echo >&2
170
- manual_fallback
171
- exit 4
172
- fi
173
-
174
- OVER_CODE="$(fetch "${BASE_ROUTE}/overview" "$WORK/overview.json")"
175
- [ "$OVER_CODE" = "200" ] || : > "$WORK/overview.json"
144
+ // `neuralis request` prints a 2xx body on stdout (exit 0); a non-2xx body goes to
145
+ // stderr after an `HTTP <code>` line (exit 1). No such line = no answer at all
146
+ // (no CLI login, no network) — "000"; its error text stays in `err`.
147
+ function fetchRoute(route) {
148
+ const args = ['request', 'GET', route];
149
+ const opts = { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], maxBuffer: 256 * 1024 * 1024 };
150
+ const entry = process.env.NEURALIS_CLI_ENTRY;
151
+ if (entry === undefined && process.platform === 'win32') {
152
+ fail('ERROR set NEURALIS_CLI_ENTRY to the neuralis CLI entry (…/dist/neuralis.mjs) — on Windows this script starts the CLI through node, never a shell');
153
+ }
154
+ try {
155
+ const body = entry !== undefined ? execFileSync(process.execPath, [entry, ...args], opts) : execFileSync('neuralis', args, opts);
156
+ return { code: '200', body, err: '' };
157
+ } catch (e) {
158
+ if (e.code === 'ENOENT') fail('ERROR neuralis (the CLI) not found on PATH');
159
+ const err = typeof e.stderr === 'string' ? e.stderr : '';
160
+ const lines = err.split('\n');
161
+ const at = lines.findIndex((l) => /^HTTP [0-9]{3}$/.test(l));
162
+ if (at < 0) return { code: '000', body: '', err };
163
+ return { code: lines[at].slice(5), body: lines.slice(at + 1).join('\n'), err };
164
+ }
165
+ }
176
166
 
177
- if [ "$RAW" = "1" ]; then
178
- echo "--- diagnostics (HTTP ${DIAG_CODE}) ---"
179
- cat "$WORK/diag.json"; echo
180
- echo "--- overview (HTTP ${OVER_CODE}) ---"
181
- cat "$WORK/overview.json"; echo
182
- echo "--- verdict ---"
183
- fi
167
+ const diagRes = fetchRoute(`${BASE_ROUTE}/diagnostics`);
168
+ if (diagRes.code === '403') {
169
+ fail("FORBIDDEN the package diagnostics surface requires the 'core.observe' feature, and your identity does not hold it.\n"
170
+ + ' This is a capability you are missing, not a broken package — say so instead of retrying.');
171
+ }
172
+ if (diagRes.code !== '200') {
173
+ let detail = `ERROR GET ${BASE_ROUTE}/diagnostics returned HTTP ${diagRes.code}`;
174
+ if (diagRes.err) detail += `\n${diagRes.err.replace(/\n$/, '').split('\n').map((l) => ` ${l}`).join('\n')}`;
175
+ if (diagRes.body) detail += `\n${diagRes.body.slice(0, 600)}`;
176
+ fail(detail);
177
+ }
178
+ const overRes = fetchRoute(`${BASE_ROUTE}/overview`);
179
+ const overCode = overRes.code;
180
+ if (overCode !== '200') overRes.body = '';
184
181
 
185
- set +e
186
- node - "$PKG_ID" "$WORK/diag.json" "$WORK/overview.json" "$OVER_CODE" <<'NODE_VERIFY'
187
- 'use strict';
188
- const fs = require('fs');
189
- const [, , pkgId, diagPath, overPath, overCode] = process.argv;
182
+ if (RAW) {
183
+ process.stdout.write(`--- diagnostics (HTTP ${diagRes.code}) ---\n${diagRes.body}\n`);
184
+ process.stdout.write(`--- overview (HTTP ${overCode}) ---\n${overRes.body}\n`);
185
+ process.stdout.write('--- verdict ---\n');
186
+ }
190
187
 
191
- const readMaybe = (p) => {
192
- try { const t = fs.readFileSync(p, 'utf8'); return t.trim() ? JSON.parse(t) : null; }
188
+ const readMaybe = (t) => {
189
+ try { return t.trim() ? JSON.parse(t) : null; }
193
190
  catch { return null; }
194
191
  };
195
192
 
196
- const diag = readMaybe(diagPath);
193
+ const diag = readMaybe(diagRes.body);
197
194
  if (!diag || !Array.isArray(diag.entries)) {
198
195
  process.stderr.write('ERROR the diagnostics response did not carry an "entries" array — the response shape drifted.\n');
199
196
  process.stderr.write(' Re-run with --raw and read the payload before trusting any verdict.\n');
200
197
  process.exit(4);
201
198
  }
202
- const over = readMaybe(overPath);
199
+ const over = readMaybe(overRes.body);
203
200
  const overPackages = over && Array.isArray(over.packages) ? over.packages : [];
204
201
  const overSource = over && Array.isArray(over.sourcePackages) ? over.sourcePackages : [];
205
202
 
@@ -309,9 +306,9 @@ const counts = () => {
309
306
  // an outbound connector is registered into ONE tenant, or into none.
310
307
  process.stdout.write(' NOTE: connectors are DECLARATIONS, not live instances. An outbound\n');
311
308
  process.stdout.write(' (mcp/openapi/http) connector registers into exactly one tenant — the\n');
312
- process.stdout.write(' platform lane for a first-party install, the owning project for a\n');
309
+ process.stdout.write(' platform lane for a native install, the owning project for a\n');
313
310
  process.stdout.write(' drop — and into NO tenant at all when the package is neither\n');
314
- process.stdout.write(' first-party nor owned by a resolvable project, which is silent\n');
311
+ process.stdout.write(' native nor owned by a resolvable project, which is silent\n');
315
312
  process.stdout.write(' apart from one server log line. Prove the instance exists with\n');
316
313
  process.stdout.write(' neuralis request GET @neuralis/agent-core/connectors; that list is\n');
317
314
  process.stdout.write(' the platform lane plus your own project, and nothing else.\n');
@@ -325,8 +322,8 @@ const counts = () => {
325
322
  const REASONS = {
326
323
  'build-missing': 'the sandbox artifact was never built. Build the package, then reinstall.',
327
324
  'runtime-unavailable': 'the declared runtime could not start (a subprocess that failed to spawn, or a code runtime that crashed). Check the entry command and the runtime type.',
328
- 'untrusted-node': 'the manifest declares the in-process "node" runtime, which requires first-party trust. Declare "wasm" to run code on any other tier.',
329
- 'untrusted-mcp': 'the manifest declares the "mcp" runtime, which spawns a subprocess as the host user and requires first-party trust, so nothing was spawned. Declare "wasm" — it is the only code runtime available below first-party.',
325
+ 'untrusted-node': 'the manifest declares the in-process "node" runtime, which requires native trust. Declare "wasm" to run code on any other tier.',
326
+ 'untrusted-mcp': 'the manifest declares the "mcp" runtime, which spawns a subprocess as the host user and requires native trust, so nothing was spawned. Declare "wasm" — it is the only code runtime available below native.',
330
327
  };
331
328
 
332
329
  if (status === 'loaded') {
@@ -343,10 +340,11 @@ if (status === 'loaded') {
343
340
  process.stdout.write('If a skill of this package still answers "Skill not found" in the conversation\n');
344
341
  process.stdout.write('that just enabled, trusted or installed it: those changes apply from the NEXT\n');
345
342
  process.stdout.write('stream (a new user message, a workflow run, or a fresh conversation), never\n');
346
- process.stdout.write('mid-turn. A delegate spawned after the change sees its <packages> entry,\n');
347
- process.stdout.write('injected rules/instructions and agent resolution fresh, but its tool catalog\n');
348
- process.stdout.write('and skill activation still use the parent stream\'s gate. Retry from a fresh\n');
349
- process.stdout.write('stream before re-diagnosing.\n');
343
+ process.stdout.write('mid-turn. A FOREGROUND delegate spawned after the change sees its <packages>\n');
344
+ process.stdout.write('entry, injected rules/instructions and agent resolution fresh, but its tool\n');
345
+ process.stdout.write('catalog and skill activation still use the parent stream\'s gate; a background\n');
346
+ process.stdout.write('delegate re-reads all of them at its wake. Retry from a fresh stream before\n');
347
+ process.stdout.write('re-diagnosing.\n');
350
348
  process.exit(0);
351
349
  }
352
350
 
@@ -369,7 +367,7 @@ if (status === 'error' || status === 'missing') {
369
367
  if (entry.sourceRoot) line('sourceRoot', entry.sourceRoot);
370
368
  process.stdout.write(status === 'missing'
371
369
  ? '\nInstalled but it never reached the loader — the manifest could not be read.\n Check that package.json exists at the install root, parses, and carries a\n "neuralis" block with an id.\n'
372
- : '\nValidation or init crashed and NOTHING registered. The message above is the\n loader\'s own; a tool-schema error names the file that aborted the load.\n Fix it, then run check-package.sh on the package root before reinstalling.\n');
370
+ : '\nValidation or init crashed and NOTHING registered. The message above is the\n loader\'s own; a tool-schema error names the file that aborted the load.\n Fix it, then run check-package.mjs on the package root before reinstalling.\n');
373
371
  process.exit(3);
374
372
  }
375
373
 
@@ -377,7 +375,3 @@ process.stdout.write(`UNKNOWN STATUS ${pkgId} -> "${status}"\n`);
377
375
  process.stdout.write('The status vocabulary is loaded | partial | error | missing. Anything else\n');
378
376
  process.stdout.write('means the response shape drifted — re-run with --raw and read the payload.\n');
379
377
  process.exit(4);
380
- NODE_VERIFY
381
- NODE_STATUS=$?
382
- set -e
383
- exit "$NODE_STATUS"