@synopackageland/cli 0.4.0 → 0.4.1

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 (438) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/build-spk/generator.js +3 -0
  4. package/dist/build-spk/notices.d.ts +5 -0
  5. package/dist/build-spk/notices.js +60 -0
  6. package/dist/cli.js +9 -2
  7. package/dist/error-registry.js +20 -0
  8. package/dist/init.d.ts +4 -0
  9. package/dist/init.js +20 -12
  10. package/dist/standalone/build.js +3 -1
  11. package/dist/standalone/daemon.d.ts +23 -0
  12. package/dist/standalone/daemon.js +114 -0
  13. package/dist/standalone/dsm-window.d.ts +1 -1
  14. package/dist/standalone/dsm-window.js +50 -10
  15. package/dist/standalone/helper-inventory.d.ts +16 -0
  16. package/dist/standalone/helper-inventory.js +2 -0
  17. package/dist/standalone/helper.d.ts +2 -12
  18. package/dist/standalone/helper.js +8 -7
  19. package/dist/standalone/host-adapter.d.ts +5 -0
  20. package/dist/standalone/host-adapter.js +148 -0
  21. package/dist/standalone/host-platform.d.ts +13 -0
  22. package/dist/standalone/host-platform.js +42 -0
  23. package/dist/standalone/host-types.d.ts +49 -0
  24. package/dist/standalone/host-types.js +1 -0
  25. package/dist/standalone/inspect-helper.d.ts +6 -0
  26. package/dist/standalone/inspect-helper.js +88 -0
  27. package/dist/standalone/inspect-spk.d.ts +2 -0
  28. package/dist/standalone/inspect-spk.js +49 -0
  29. package/dist/standalone/lifecycle-helper.d.ts +2 -0
  30. package/dist/standalone/lifecycle-helper.js +12 -0
  31. package/dist/standalone/lifecycle.d.ts +3 -0
  32. package/dist/standalone/lifecycle.js +53 -0
  33. package/dist/standalone/manifest.d.ts +2 -0
  34. package/dist/standalone/manifest.js +4 -1
  35. package/dist/standalone/reopen-events.d.ts +2 -0
  36. package/dist/standalone/reopen-events.js +28 -0
  37. package/dist/standalone/root-messages.js +9 -0
  38. package/dist/standalone/root-window.d.ts +4 -3
  39. package/dist/standalone/root-window.js +17 -5
  40. package/dist/standalone/spk.d.ts +4 -3
  41. package/dist/standalone/spk.js +20 -33
  42. package/dist/template-paths.d.ts +2 -0
  43. package/dist/template-paths.js +9 -0
  44. package/dist/templates/_daemon/fixture_linux_test.go +15 -0
  45. package/dist/templates/_daemon/fixture_other_test.go +7 -0
  46. package/dist/templates/_daemon/go.mod +3 -0
  47. package/dist/templates/_daemon/main.go +608 -0
  48. package/dist/templates/_daemon/main_test.go +242 -0
  49. package/dist/templates/_daemon/process_linux.go +55 -0
  50. package/dist/templates/_daemon/process_linux_test.go +161 -0
  51. package/dist/templates/_daemon/process_other.go +14 -0
  52. package/dist/templates/_daemon/testdata/child.go +41 -0
  53. package/dist/templates/_shared/GO-LICENSE +27 -0
  54. package/dist/templates/_shared/GO-PATENTS +22 -0
  55. package/dist/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
  56. package/dist/templates/_shared/notice-overrides/index.json +14 -0
  57. package/dist/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
  58. package/dist/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
  59. package/dist/templates/_shared/third-party-notices.mjs +51 -0
  60. package/dist/templates/native-go/README.md +57 -1
  61. package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
  62. package/dist/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
  63. package/dist/templates/native-go/backend/go.mod +4 -0
  64. package/dist/templates/native-go/backend/go.sum +4 -0
  65. package/dist/templates/native-go/backend/internal/api/binary.go +154 -0
  66. package/dist/templates/native-go/backend/internal/api/binary_test.go +165 -0
  67. package/dist/templates/native-go/backend/internal/api/registry.go +14 -4
  68. package/dist/templates/native-go/backend/internal/api/server.go +4 -0
  69. package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
  70. package/dist/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
  71. package/dist/templates/native-go/backend/internal/app/routes.go +11 -0
  72. package/dist/templates/native-go/backend/internal/app/routes_test.go +10 -5
  73. package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
  74. package/dist/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
  75. package/dist/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
  76. package/dist/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
  77. package/dist/templates/native-go/backend/internal/helper/cohort.go +393 -0
  78. package/dist/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
  79. package/dist/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
  80. package/dist/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
  81. package/dist/templates/native-go/backend/internal/helper/control.go +226 -21
  82. package/dist/templates/native-go/backend/internal/helper/control_test.go +10 -2
  83. package/dist/templates/native-go/backend/internal/helper/data_contract.go +242 -0
  84. package/dist/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
  85. package/dist/templates/native-go/backend/internal/helper/data_decode.go +184 -0
  86. package/dist/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
  87. package/dist/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
  88. package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
  89. package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
  90. package/dist/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
  91. package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
  92. package/dist/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
  93. package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
  94. package/dist/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
  95. package/dist/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
  96. package/dist/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
  97. package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
  98. package/dist/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
  99. package/dist/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
  100. package/dist/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
  101. package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
  102. package/dist/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
  103. package/dist/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
  104. package/dist/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
  105. package/dist/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
  106. package/dist/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
  107. package/dist/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
  108. package/dist/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
  109. package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
  110. package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
  111. package/dist/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
  112. package/dist/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
  113. package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
  114. package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
  115. package/dist/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
  116. package/dist/templates/native-go/backend/internal/helper/lease.go +112 -0
  117. package/dist/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
  118. package/dist/templates/native-go/backend/internal/helper/lease_other.go +8 -0
  119. package/dist/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
  120. package/dist/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
  121. package/dist/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
  122. package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
  123. package/dist/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
  124. package/dist/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
  125. package/dist/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
  126. package/dist/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
  127. package/dist/templates/native-go/backend/internal/helper/native_identity.go +89 -0
  128. package/dist/templates/native-go/backend/internal/helper/native_provider.go +159 -0
  129. package/dist/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
  130. package/dist/templates/native-go/backend/internal/helper/observation.go +204 -0
  131. package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
  132. package/dist/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
  133. package/dist/templates/native-go/backend/internal/helper/observation_test.go +196 -0
  134. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
  135. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
  136. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
  137. package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
  138. package/dist/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
  139. package/dist/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
  140. package/dist/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
  141. package/dist/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
  142. package/dist/templates/native-go/backend/internal/helper/process_linux.go +11 -1
  143. package/dist/templates/native-go/backend/internal/helper/publication_test.go +178 -0
  144. package/dist/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
  145. package/dist/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
  146. package/dist/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
  147. package/dist/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
  148. package/dist/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
  149. package/dist/templates/native-go/backend/internal/helper/readonly.go +105 -0
  150. package/dist/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
  151. package/dist/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
  152. package/dist/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
  153. package/dist/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
  154. package/dist/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
  155. package/dist/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
  156. package/dist/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
  157. package/dist/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
  158. package/dist/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
  159. package/dist/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
  160. package/dist/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
  161. package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
  162. package/dist/templates/native-go/backend/internal/helper/repair.go +132 -0
  163. package/dist/templates/native-go/backend/internal/helper/repair_test.go +271 -0
  164. package/dist/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
  165. package/dist/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
  166. package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
  167. package/dist/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
  168. package/dist/templates/native-go/backend/internal/helper/server_linux.go +44 -3
  169. package/dist/templates/native-go/backend/internal/helper/status.go +74 -11
  170. package/dist/templates/native-go/backend/internal/helper/status_test.go +83 -0
  171. package/dist/templates/native-go/backend/internal/helper/supervision.go +28 -5
  172. package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
  173. package/dist/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
  174. package/dist/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
  175. package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +187 -16
  176. package/dist/templates/native-go/backend/internal/helper/supervisor_linux_test.go +618 -7
  177. package/dist/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
  178. package/dist/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
  179. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
  180. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
  181. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
  182. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
  183. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
  184. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
  185. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
  186. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
  187. package/dist/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
  188. package/dist/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
  189. package/dist/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
  190. package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
  191. package/dist/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
  192. package/dist/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
  193. package/dist/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
  194. package/dist/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
  195. package/dist/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
  196. package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
  197. package/dist/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
  198. package/dist/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
  199. package/dist/templates/native-go/backend/internal/helper/write.go +77 -0
  200. package/dist/templates/native-go/backend/internal/helper/write_admission.go +260 -0
  201. package/dist/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
  202. package/dist/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
  203. package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
  204. package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
  205. package/dist/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
  206. package/dist/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
  207. package/dist/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
  208. package/dist/templates/native-go/backend/internal/helper/write_test.go +53 -0
  209. package/dist/templates/native-go/ui/app.js +8 -1
  210. package/dist/templates/native-go-better-auth/node/build.mjs +2 -0
  211. package/dist/templates/native-go-vue/README.md +115 -1
  212. package/dist/templates/native-go-vue/frontend/DESIGN.md +1 -1
  213. package/dist/templates/native-go-vue/frontend/package-lock.json +132 -229
  214. package/dist/templates/native-go-vue/frontend/package.json +1 -1
  215. package/dist/templates/native-go-vue/frontend/src/App.vue +33 -6
  216. package/dist/templates/native-go-vue/frontend/src/context.ts +41 -2
  217. package/dist/templates/native-go-vue/frontend/src/main.ts +4 -1
  218. package/dist/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
  219. package/dist/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
  220. package/dist/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
  221. package/dist/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
  222. package/dist/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
  223. package/dist/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
  224. package/dist/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
  225. package/dist/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
  226. package/dist/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
  227. package/dist/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
  228. package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
  229. package/dist/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
  230. package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
  231. package/dist/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
  232. package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
  233. package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
  234. package/dist/templates/native-go-vue/frontend/src/style.css +17 -0
  235. package/dist/templates/native-go-vue/frontend/test/apps.test.ts +44 -2
  236. package/dist/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
  237. package/dist/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
  238. package/dist/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
  239. package/dist/templates/native-go-vue/frontend/tsconfig.json +1 -1
  240. package/dist/templates/native-go-vue/frontend/vite.config.ts +6 -4
  241. package/package.json +3 -2
  242. package/templates/_daemon/fixture_linux_test.go +15 -0
  243. package/templates/_daemon/fixture_other_test.go +7 -0
  244. package/templates/_daemon/go.mod +3 -0
  245. package/templates/_daemon/main.go +608 -0
  246. package/templates/_daemon/main_test.go +242 -0
  247. package/templates/_daemon/process_linux.go +55 -0
  248. package/templates/_daemon/process_linux_test.go +161 -0
  249. package/templates/_daemon/process_other.go +14 -0
  250. package/templates/_daemon/testdata/child.go +41 -0
  251. package/templates/_shared/GO-LICENSE +27 -0
  252. package/templates/_shared/GO-PATENTS +22 -0
  253. package/templates/_shared/LICENSES/TEMPLATE.txt +21 -0
  254. package/templates/_shared/notice-overrides/index.json +14 -0
  255. package/templates/_shared/notice-overrides/utils-0.4.2-LICENSE +21 -0
  256. package/templates/_shared/notice-overrides/utils-0.5.0-LICENSE +21 -0
  257. package/templates/_shared/third-party-notices.mjs +51 -0
  258. package/templates/native-go/README.md +57 -1
  259. package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +59 -0
  260. package/templates/native-go/backend/cmd/dsm-readonly-probe/main_linux.go +46 -0
  261. package/templates/native-go/backend/go.mod +4 -0
  262. package/templates/native-go/backend/go.sum +4 -0
  263. package/templates/native-go/backend/internal/api/binary.go +154 -0
  264. package/templates/native-go/backend/internal/api/binary_test.go +165 -0
  265. package/templates/native-go/backend/internal/api/registry.go +14 -4
  266. package/templates/native-go/backend/internal/api/server.go +4 -0
  267. package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +121 -0
  268. package/templates/native-go/backend/internal/app/nas_refusal_test.go +46 -0
  269. package/templates/native-go/backend/internal/app/routes.go +11 -0
  270. package/templates/native-go/backend/internal/app/routes_test.go +10 -5
  271. package/templates/native-go/backend/internal/dsmprobe/collector_linux.go +335 -0
  272. package/templates/native-go/backend/internal/dsmprobe/collector_linux_test.go +41 -0
  273. package/templates/native-go/backend/internal/dsmprobe/protocol.go +179 -0
  274. package/templates/native-go/backend/internal/dsmprobe/protocol_test.go +29 -0
  275. package/templates/native-go/backend/internal/helper/cohort.go +393 -0
  276. package/templates/native-go/backend/internal/helper/cohort_publication.go +18 -0
  277. package/templates/native-go/backend/internal/helper/cohort_publication_test.go +105 -0
  278. package/templates/native-go/backend/internal/helper/cohort_test.go +372 -0
  279. package/templates/native-go/backend/internal/helper/control.go +226 -21
  280. package/templates/native-go/backend/internal/helper/control_test.go +10 -2
  281. package/templates/native-go/backend/internal/helper/data_contract.go +242 -0
  282. package/templates/native-go/backend/internal/helper/data_contract_test.go +51 -0
  283. package/templates/native-go/backend/internal/helper/data_decode.go +184 -0
  284. package/templates/native-go/backend/internal/helper/data_decode_pointer_test.go +30 -0
  285. package/templates/native-go/backend/internal/helper/data_protocol.go +416 -0
  286. package/templates/native-go/backend/internal/helper/data_protocol_test.go +449 -0
  287. package/templates/native-go/backend/internal/helper/dsm_acl_linux.go +139 -0
  288. package/templates/native-go/backend/internal/helper/dsm_acl_linux_test.go +121 -0
  289. package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux.go +95 -0
  290. package/templates/native-go/backend/internal/helper/dsm_acl_syscall_linux_test.go +56 -0
  291. package/templates/native-go/backend/internal/helper/dsm_bridge_linux.go +144 -0
  292. package/templates/native-go/backend/internal/helper/dsm_bridge_linux_test.go +89 -0
  293. package/templates/native-go/backend/internal/helper/dsm_home_linux.go +107 -0
  294. package/templates/native-go/backend/internal/helper/dsm_home_linux_test.go +82 -0
  295. package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux.go +151 -0
  296. package/templates/native-go/backend/internal/helper/dsm_probe_transport_linux_test.go +66 -0
  297. package/templates/native-go/backend/internal/helper/grant_authority.go +516 -0
  298. package/templates/native-go/backend/internal/helper/grant_authority_contract.go +88 -0
  299. package/templates/native-go/backend/internal/helper/grant_authority_test.go +510 -0
  300. package/templates/native-go/backend/internal/helper/grant_cohort.go +389 -0
  301. package/templates/native-go/backend/internal/helper/grant_cohort_test.go +239 -0
  302. package/templates/native-go/backend/internal/helper/grant_delivery.go +49 -0
  303. package/templates/native-go/backend/internal/helper/grant_delivery_methods.go +273 -0
  304. package/templates/native-go/backend/internal/helper/grant_delivery_test.go +322 -0
  305. package/templates/native-go/backend/internal/helper/grant_operation_contract.go +47 -0
  306. package/templates/native-go/backend/internal/helper/grant_readonly_test.go +180 -0
  307. package/templates/native-go/backend/internal/helper/grant_repository_linux.go +415 -0
  308. package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +468 -0
  309. package/templates/native-go/backend/internal/helper/grant_rpc.go +147 -0
  310. package/templates/native-go/backend/internal/helper/grant_rpc_test.go +51 -0
  311. package/templates/native-go/backend/internal/helper/grant_snapshot.go +75 -0
  312. package/templates/native-go/backend/internal/helper/grant_supervisor_linux.go +134 -0
  313. package/templates/native-go/backend/internal/helper/grant_supervisor_linux_test.go +254 -0
  314. package/templates/native-go/backend/internal/helper/lease.go +112 -0
  315. package/templates/native-go/backend/internal/helper/lease_linux.go +44 -0
  316. package/templates/native-go/backend/internal/helper/lease_other.go +8 -0
  317. package/templates/native-go/backend/internal/helper/lifecycle.go +234 -0
  318. package/templates/native-go/backend/internal/helper/lifecycle_test.go +473 -0
  319. package/templates/native-go/backend/internal/helper/managed_pilot.go +284 -0
  320. package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux.go +74 -0
  321. package/templates/native-go/backend/internal/helper/managed_pilot_repository_linux_test.go +40 -0
  322. package/templates/native-go/backend/internal/helper/managed_pilot_test.go +210 -0
  323. package/templates/native-go/backend/internal/helper/nas_shipped_refusal_linux_test.go +97 -0
  324. package/templates/native-go/backend/internal/helper/native_discovery.go +79 -0
  325. package/templates/native-go/backend/internal/helper/native_identity.go +89 -0
  326. package/templates/native-go/backend/internal/helper/native_provider.go +159 -0
  327. package/templates/native-go/backend/internal/helper/native_provider_test.go +421 -0
  328. package/templates/native-go/backend/internal/helper/observation.go +204 -0
  329. package/templates/native-go/backend/internal/helper/observation_health_test.go +115 -0
  330. package/templates/native-go/backend/internal/helper/observation_reload_budget_test.go +117 -0
  331. package/templates/native-go/backend/internal/helper/observation_test.go +196 -0
  332. package/templates/native-go/backend/internal/helper/observer_diagnostic.go +109 -0
  333. package/templates/native-go/backend/internal/helper/observer_diagnostic_linux.go +76 -0
  334. package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +124 -0
  335. package/templates/native-go/backend/internal/helper/observer_diagnostic_test.go +98 -0
  336. package/templates/native-go/backend/internal/helper/operation_bootstrap_linux.go +193 -0
  337. package/templates/native-go/backend/internal/helper/operation_credentials_linux.go +56 -0
  338. package/templates/native-go/backend/internal/helper/operation_linux.go +480 -0
  339. package/templates/native-go/backend/internal/helper/operation_linux_test.go +528 -0
  340. package/templates/native-go/backend/internal/helper/process_linux.go +11 -1
  341. package/templates/native-go/backend/internal/helper/publication_test.go +178 -0
  342. package/templates/native-go/backend/internal/helper/read_stream_cohort_linux_test.go +156 -0
  343. package/templates/native-go/backend/internal/helper/read_transfer.go +40 -0
  344. package/templates/native-go/backend/internal/helper/read_transfer_linux.go +109 -0
  345. package/templates/native-go/backend/internal/helper/read_transfer_linux_test.go +118 -0
  346. package/templates/native-go/backend/internal/helper/read_transfer_test.go +177 -0
  347. package/templates/native-go/backend/internal/helper/readonly.go +105 -0
  348. package/templates/native-go/backend/internal/helper/readonly_admission.go +85 -0
  349. package/templates/native-go/backend/internal/helper/readonly_cohort_linux_test.go +253 -0
  350. package/templates/native-go/backend/internal/helper/readonly_linux_test.go +378 -0
  351. package/templates/native-go/backend/internal/helper/readonly_mount_linux.go +65 -0
  352. package/templates/native-go/backend/internal/helper/readonly_mount_proxy_linux.go +113 -0
  353. package/templates/native-go/backend/internal/helper/readonly_operations_linux.go +168 -0
  354. package/templates/native-go/backend/internal/helper/readonly_resolver_linux.go +241 -0
  355. package/templates/native-go/backend/internal/helper/readonly_test.go +40 -0
  356. package/templates/native-go/backend/internal/helper/relaxed_identity.go +252 -0
  357. package/templates/native-go/backend/internal/helper/relaxed_identity_contract.go +105 -0
  358. package/templates/native-go/backend/internal/helper/relaxed_identity_test.go +406 -0
  359. package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +200 -0
  360. package/templates/native-go/backend/internal/helper/repair.go +132 -0
  361. package/templates/native-go/backend/internal/helper/repair_test.go +271 -0
  362. package/templates/native-go/backend/internal/helper/s1r_actor_acl_linux_test.go +303 -0
  363. package/templates/native-go/backend/internal/helper/s1r_actor_fixture_linux_test.go +184 -0
  364. package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +231 -0
  365. package/templates/native-go/backend/internal/helper/s1r_fixture_contract_linux_test.go +18 -0
  366. package/templates/native-go/backend/internal/helper/server_linux.go +44 -3
  367. package/templates/native-go/backend/internal/helper/status.go +74 -11
  368. package/templates/native-go/backend/internal/helper/status_test.go +83 -0
  369. package/templates/native-go/backend/internal/helper/supervision.go +28 -5
  370. package/templates/native-go/backend/internal/helper/supervisor_frame.go +76 -0
  371. package/templates/native-go/backend/internal/helper/supervisor_frame_linux_test.go +69 -0
  372. package/templates/native-go/backend/internal/helper/supervisor_frame_test.go +107 -0
  373. package/templates/native-go/backend/internal/helper/supervisor_linux.go +187 -16
  374. package/templates/native-go/backend/internal/helper/supervisor_linux_test.go +618 -7
  375. package/templates/native-go/backend/internal/helper/supervisor_socket_eof_test.go +74 -0
  376. package/templates/native-go/backend/internal/helper/supervisor_socket_test.go +45 -0
  377. package/templates/native-go/backend/internal/helper/testdata/protocol2/create.json +23 -0
  378. package/templates/native-go/backend/internal/helper/testdata/protocol2/frames.json +67 -0
  379. package/templates/native-go/backend/internal/helper/testdata/protocol2/grant-store.json +52 -0
  380. package/templates/native-go/backend/internal/helper/testdata/protocol2/intent.json +20 -0
  381. package/templates/native-go/backend/internal/helper/testdata/protocol2/list.json +20 -0
  382. package/templates/native-go/backend/internal/helper/testdata/protocol2/publish.json +20 -0
  383. package/templates/native-go/backend/internal/helper/testdata/protocol2/read.json +22 -0
  384. package/templates/native-go/backend/internal/helper/testdata/protocol2/stat.json +22 -0
  385. package/templates/native-go/backend/internal/helper/testdata/protocol2/write-stream.json +22 -0
  386. package/templates/native-go/backend/internal/helper/unit_connection.go +75 -0
  387. package/templates/native-go/backend/internal/helper/unit_connection_linux_test.go +135 -0
  388. package/templates/native-go/backend/internal/helper/unit_connection_test.go +133 -0
  389. package/templates/native-go/backend/internal/helper/unit_frame_test.go +32 -0
  390. package/templates/native-go/backend/internal/helper/unit_linux.go +364 -0
  391. package/templates/native-go/backend/internal/helper/unit_linux_test.go +46 -0
  392. package/templates/native-go/backend/internal/helper/unit_mechanisms_linux_test.go +217 -0
  393. package/templates/native-go/backend/internal/helper/unit_padding_linux_test.go +178 -0
  394. package/templates/native-go/backend/internal/helper/unit_query_linux.go +111 -0
  395. package/templates/native-go/backend/internal/helper/unit_reload_linux_test.go +372 -0
  396. package/templates/native-go/backend/internal/helper/unit_reload_sequence_linux_test.go +232 -0
  397. package/templates/native-go/backend/internal/helper/write.go +77 -0
  398. package/templates/native-go/backend/internal/helper/write_admission.go +260 -0
  399. package/templates/native-go/backend/internal/helper/write_admission_test.go +135 -0
  400. package/templates/native-go/backend/internal/helper/write_cohort_linux_test.go +218 -0
  401. package/templates/native-go/backend/internal/helper/write_files_linux.go +202 -0
  402. package/templates/native-go/backend/internal/helper/write_files_linux_test.go +199 -0
  403. package/templates/native-go/backend/internal/helper/write_intent_linux.go +116 -0
  404. package/templates/native-go/backend/internal/helper/write_intent_linux_test.go +74 -0
  405. package/templates/native-go/backend/internal/helper/write_operation_linux.go +245 -0
  406. package/templates/native-go/backend/internal/helper/write_test.go +53 -0
  407. package/templates/native-go/ui/app.js +8 -1
  408. package/templates/native-go-better-auth/node/build.mjs +2 -0
  409. package/templates/native-go-vue/README.md +115 -1
  410. package/templates/native-go-vue/frontend/DESIGN.md +1 -1
  411. package/templates/native-go-vue/frontend/package-lock.json +132 -229
  412. package/templates/native-go-vue/frontend/package.json +1 -1
  413. package/templates/native-go-vue/frontend/src/App.vue +33 -6
  414. package/templates/native-go-vue/frontend/src/context.ts +41 -2
  415. package/templates/native-go-vue/frontend/src/main.ts +4 -1
  416. package/templates/native-go-vue/frontend/src/nas/NasGrantSettings.vue +74 -0
  417. package/templates/native-go-vue/frontend/src/nas/NasPathPicker.vue +106 -0
  418. package/templates/native-go-vue/frontend/src/nas/NasUnavailable.vue +20 -0
  419. package/templates/native-go-vue/frontend/src/nas/i18n/de.json +74 -0
  420. package/templates/native-go-vue/frontend/src/nas/i18n/en.json +74 -0
  421. package/templates/native-go-vue/frontend/src/nas/i18n/es.json +74 -0
  422. package/templates/native-go-vue/frontend/src/nas/i18n/fr.json +74 -0
  423. package/templates/native-go-vue/frontend/src/nas/i18n/it.json +74 -0
  424. package/templates/native-go-vue/frontend/src/nas/i18n/ja.json +74 -0
  425. package/templates/native-go-vue/frontend/src/nas/i18n/ko.json +74 -0
  426. package/templates/native-go-vue/frontend/src/nas/i18n/zh-CN.json +74 -0
  427. package/templates/native-go-vue/frontend/src/nas/i18n/zh-TW.json +74 -0
  428. package/templates/native-go-vue/frontend/src/nas/i18n.ts +38 -0
  429. package/templates/native-go-vue/frontend/src/nas/mock-provider.ts +119 -0
  430. package/templates/native-go-vue/frontend/src/nas/provider.ts +59 -0
  431. package/templates/native-go-vue/frontend/src/nas/use-request.ts +27 -0
  432. package/templates/native-go-vue/frontend/src/style.css +17 -0
  433. package/templates/native-go-vue/frontend/test/apps.test.ts +44 -2
  434. package/templates/native-go-vue/frontend/test/nas-provider.test.ts +81 -0
  435. package/templates/native-go-vue/frontend/test/nas-request.test.ts +21 -0
  436. package/templates/native-go-vue/frontend/test/nas-ui.test.ts +261 -0
  437. package/templates/native-go-vue/frontend/tsconfig.json +1 -1
  438. package/templates/native-go-vue/frontend/vite.config.ts +6 -4
@@ -0,0 +1,245 @@
1
+ package helper
2
+
3
+ import (
4
+ "context"
5
+ "io"
6
+ "net"
7
+ "os"
8
+ "time"
9
+ )
10
+
11
+ type linuxWriteOperation struct {
12
+ *linuxOperation
13
+ writeWork writeWork
14
+ receipt MutationReceipt
15
+ resultCode Code
16
+ ready bool
17
+ resultReleased bool
18
+ }
19
+
20
+ func startLinuxWriteOperation(c Client, binary string, a NativeActor, b operationBinding, pin *pinnedReadOnlyRoot, w writeWork, input net.Conn) (operationProcess, error) {
21
+ if w.validate() != "" || pin == nil || pin.path != w.RootPath {
22
+ return nil, ErrDenied
23
+ }
24
+ w.Segments = append([]string{}, w.Segments...)
25
+ return startLinuxOperationWork(c, binary, a, b, input, pin, nil, &w)
26
+ }
27
+ func (p *linuxWriteOperation) idle() (bool, error) {
28
+ idle, e := p.linuxOperation.idle()
29
+ if p.result != nil && p.result.Mutation != nil {
30
+ p.receipt = *p.result.Mutation
31
+ p.resultCode = p.result.Code
32
+ p.ready = true
33
+ p.result = nil
34
+ }
35
+ return idle, e
36
+ }
37
+ func (p *linuxWriteOperation) mutationResult() (MutationReceipt, Code, bool) {
38
+ idle, e := p.idle()
39
+ if e != nil {
40
+ return p.receipt, ErrCleanupRequired, false
41
+ }
42
+ return p.receipt, p.resultCode, p.ready && idle
43
+ }
44
+ func (p *linuxWriteOperation) chunk(n uint32) error { return p.chunkWithActor(n, NativeActor{}) }
45
+ func (p *linuxWriteOperation) chunkWithActor(n uint32, a NativeActor) error {
46
+ if !a.valid || !nativeFresh(a.account.CheckedAt, time.Now()) {
47
+ return ErrStale
48
+ }
49
+ return p.beginWrite(a, n, false)
50
+ }
51
+ func (p *linuxWriteOperation) commitWithActor(a NativeActor) error { return p.beginWrite(a, 0, true) }
52
+ func (p *linuxWriteOperation) beginWrite(a NativeActor, n uint32, commit bool) error {
53
+ idle, e := p.idle()
54
+ if e != nil {
55
+ return e
56
+ }
57
+ if !idle || p.closed || !p.ready || p.resultCode != "" || p.finishSent || !a.valid || !nativeFresh(a.account.CheckedAt, time.Now()) || !commit && (n == 0 || n > MaxChunkBytes) {
58
+ return errTrust
59
+ }
60
+ p.proofDeadline = a.account.CheckedAt.Add(NativeProofFreshness)
61
+ p.sequence++
62
+ lease := operationLease{Token: p.token, Sequence: p.sequence, Bytes: n, SubjectRef: a.Principal().SubjectRef, SessionRef: a.SessionRef(), ProofDeadline: p.proofDeadline.UnixNano(), Commit: commit}
63
+ info, e := openOperationFDInfo(p.process.Pid)
64
+ if e != nil {
65
+ return e
66
+ }
67
+ done := make(chan operationRelayOutcome, 1)
68
+ p.pending = done
69
+ p.ready = false
70
+ control, data, input := p.control, p.data, p.output
71
+ boot, w := p.bootstrap, p.writeWork
72
+ sequence, mounts, deadline := p.sequence, p.mountSequence, p.proofDeadline
73
+ previous := p.receipt
74
+ results := make(chan readOnlyPacketOutcome, 1)
75
+ p.resultPending = results
76
+ // One outstanding lease. Read only the admitted bytes from the fixed binary
77
+ // input, then hand them to the actor. No bytes or file descriptors enter JSON.
78
+ go func() {
79
+ var e error
80
+ if !commit {
81
+ e = input.SetReadDeadline(deadline)
82
+ buffer := make([]byte, n)
83
+ if e == nil {
84
+ _, e = io.ReadFull(input, buffer)
85
+ }
86
+ if e == nil {
87
+ e = writeOperationPacket(control, lease)
88
+ }
89
+ if e == nil {
90
+ var written int
91
+ written, e = data.Write(buffer)
92
+ if e == nil && written != len(buffer) {
93
+ e = io.ErrShortWrite
94
+ }
95
+ }
96
+ } else {
97
+ e = writeOperationPacket(control, lease)
98
+ }
99
+ outcome := readOnlyPacketOutcome{}
100
+ if e == nil {
101
+ outcome = receiveWriteProof(control, info, boot, w, p.process.Pid, mounts, sequence, time.Until(deadline))
102
+ e = outcome.err
103
+ if e == nil {
104
+ m := outcome.result.Mutation
105
+ upper := previous.BytesWritten + uint64(n)
106
+ if commit {
107
+ upper = previous.BytesWritten
108
+ }
109
+ if m.BytesWritten < previous.BytesWritten || m.BytesWritten > upper || outcome.result.Code == "" && m.BytesWritten != upper || !commit && (m.Published || m.Committed) {
110
+ e = errTrust
111
+ }
112
+ }
113
+ }
114
+ if closeErr := info.Close(); e == nil {
115
+ e = closeErr
116
+ }
117
+ outcome.err = e
118
+ results <- outcome
119
+ done <- operationRelayOutcome{err: e, mountSequence: outcome.mountSequence}
120
+ }()
121
+ if commit {
122
+ p.finishSent = true
123
+ }
124
+ return nil
125
+ }
126
+ func receiveWriteProof(control *net.UnixConn, info *os.File, boot operationBootstrap, w writeWork, pid int, mounts, sequence uint64, timeout time.Duration) readOnlyPacketOutcome {
127
+ deadline := time.Now().Add(timeout)
128
+ for {
129
+ var packet readOnlyPacket
130
+ cred, e := readOperationPacketBound(control, &packet, MaxControlBytes, time.Until(deadline))
131
+ if e != nil {
132
+ return readOnlyPacketOutcome{err: e}
133
+ }
134
+ if cred == nil || int(cred.Pid) != pid || cred.Uid != boot.UID || cred.Gid != boot.GID || packet.Binding != boot.Binding || packet.Token != boot.Token {
135
+ return readOnlyPacketOutcome{err: errTrust}
136
+ }
137
+ if packet.Result != nil {
138
+ r := packet.Result
139
+ m := r.Mutation
140
+ if packet.MountFD != nil || packet.MountSequence != 0 || packet.ChunkSequence != sequence || m == nil || m.EffectsUnknown || m.BytesWritten > w.MaxBytes || m.Committed && !m.Published || m.Published && !m.Created || r.Bytes != 0 || r.Entry != nil || r.List != nil || r.Code != "" && !r.Code.Valid() {
141
+ return readOnlyPacketOutcome{err: errTrust}
142
+ }
143
+ return readOnlyPacketOutcome{result: r, mountSequence: mounts}
144
+ }
145
+ if packet.MountFD == nil || packet.ChunkSequence != 0 || packet.MountSequence != mounts+1 || mounts >= maxReadOnlyMountQueries {
146
+ return readOnlyPacketOutcome{err: errTrust}
147
+ }
148
+ mounts++
149
+ id, c := operationFDInfoMount(info, *packet.MountFD)
150
+ if e := writeOperationPacket(control, readOnlyMountReply{Token: boot.Token, Sequence: mounts, Mount: id, Code: c}); e != nil {
151
+ return readOnlyPacketOutcome{err: e}
152
+ }
153
+ }
154
+ }
155
+ func operationWriteChild(ctx context.Context, control *net.UnixConn, boot operationBootstrap) error {
156
+ w := *boot.Write
157
+ witness := os.NewFile(6, "write-root-witness")
158
+ if witness == nil {
159
+ return errTrust
160
+ }
161
+ defer witness.Close()
162
+ input := os.NewFile(5, "write-input")
163
+ if input == nil {
164
+ return errTrust
165
+ }
166
+ defer input.Close()
167
+ operationMountIDFallback = operationMountIDProxy(control, boot)
168
+ pin := &pinnedReadOnlyRoot{path: w.RootPath, file: witness}
169
+ x, c := openActorWriteTransfer(ctx, pin, w, operationReadOnlyACL)
170
+ receipt := MutationReceipt{}
171
+ if x != nil {
172
+ defer x.Close()
173
+ receipt = x.Receipt()
174
+ }
175
+ send := func(sequence uint64, r MutationReceipt, c Code) error {
176
+ return writeOperationPacketBound(control, readOnlyPacket{Binding: boot.Binding, Token: boot.Token, ChunkSequence: sequence, Result: &readOnlyResult{Code: c, Mutation: &r}}, MaxControlBytes)
177
+ }
178
+ if e := send(0, receipt, c); e != nil {
179
+ return e
180
+ }
181
+ if c != "" {
182
+ return awaitReadOnlyFinish(control, boot.Token)
183
+ }
184
+ var sequence, total uint64
185
+ for {
186
+ var lease operationLease
187
+ timeout := BoundedTimeout
188
+ if w.Staged {
189
+ timeout = StreamIdleTimeout
190
+ }
191
+ if deadline, ok := ctx.Deadline(); ok && time.Until(deadline) < timeout {
192
+ timeout = time.Until(deadline)
193
+ }
194
+ if _, e := readOperationPacketBound(control, &lease, MaxHealthBytes, timeout); e != nil {
195
+ return e
196
+ }
197
+ if lease.Token != boot.Token || lease.Sequence != sequence+1 || lease.SubjectRef != boot.SubjectRef || lease.SessionRef != boot.SessionRef || lease.ProofDeadline == 0 {
198
+ return errTrust
199
+ }
200
+ proofDeadline := time.Unix(0, lease.ProofDeadline)
201
+ if !time.Now().Before(proofDeadline) || time.Until(proofDeadline) > NativeProofFreshness {
202
+ return ErrStale
203
+ }
204
+ proofCtx, cancel := context.WithDeadline(ctx, proofDeadline)
205
+ sequence++
206
+ var r MutationReceipt
207
+ if lease.Commit {
208
+ if lease.Bytes != 0 {
209
+ cancel()
210
+ return errTrust
211
+ }
212
+ r, c = x.Commit(proofCtx)
213
+ } else {
214
+ if lease.Bytes == 0 || lease.Bytes > MaxChunkBytes || total+uint64(lease.Bytes) > w.MaxBytes {
215
+ cancel()
216
+ return errTrust
217
+ }
218
+ b := make([]byte, lease.Bytes)
219
+ input.SetReadDeadline(proofDeadline)
220
+ if _, e := io.ReadFull(input, b); e != nil {
221
+ cancel()
222
+ return e
223
+ }
224
+ total += uint64(lease.Bytes)
225
+ r, c = x.WriteChunk(proofCtx, b)
226
+ }
227
+ cancel()
228
+ if e := send(sequence, r, c); e != nil {
229
+ return e
230
+ }
231
+ // Retain lifetime/FDs until parent acknowledges or drains; receipt available
232
+ // even for partial effects. No named file is automatically cleaned up.
233
+ if lease.Commit || c != "" {
234
+ return awaitReadOnlyFinish(control, boot.Token)
235
+ }
236
+ }
237
+ }
238
+
239
+ func (p *linuxWriteOperation) releaseWriteResult() error {
240
+ if p.resultReleased {
241
+ return nil
242
+ }
243
+ p.resultReleased = true
244
+ return writeOperationPacket(p.control, operationReadOnlyFinish{Token: p.token})
245
+ }
@@ -0,0 +1,53 @@
1
+ package helper
2
+
3
+ import "testing"
4
+
5
+ func TestWriteGatesDefaultDenyAndPublishIsIndependent(t *testing.T) {
6
+ for _, tc := range []struct {
7
+ gates writeGates
8
+ action Action
9
+ allowed bool
10
+ }{
11
+ {writeGates{}, ActionCreate, false}, {writeGates{}, ActionWriteStream, false},
12
+ {writeGates{Create: true}, ActionCreate, true}, {writeGates{Create: true}, ActionWriteStream, false},
13
+ {writeGates{Stream: true}, ActionWriteStream, false}, {writeGates{Create: true, Stream: true}, ActionWriteStream, false},
14
+ {writeGates{Create: true, Stream: true, Publish: true}, ActionWriteStream, true},
15
+ {writeGates{Publish: true}, ActionPublish, false}, {writeGates{Create: true, Publish: true}, ActionPublish, true},
16
+ } {
17
+ if tc.gates.allows(tc.action) != tc.allowed {
18
+ t.Fatal(tc)
19
+ }
20
+ }
21
+ }
22
+ func TestWriteWorkRejectsPathsLimitsAndUngatedStage(t *testing.T) {
23
+ valid := writeWork{RootPath: "/trusted/root", Action: ActionCreate, Segments: []string{"file"}, MaxBytes: MaxBoundedBytes}
24
+ if c := valid.validate(); c != "" {
25
+ t.Fatal(c)
26
+ }
27
+ for _, kind := range []string{"root", "escape", "zero", "limit", "action", "stage"} {
28
+ w := valid
29
+ switch kind {
30
+ case "root":
31
+ w.RootPath = "/"
32
+ case "escape":
33
+ w.Segments = []string{"..", "file"}
34
+ case "zero":
35
+ w.MaxBytes = 0
36
+ case "limit":
37
+ w.MaxBytes++
38
+ case "action":
39
+ w.Action = ActionRead
40
+ case "stage":
41
+ w.Staged = true
42
+ }
43
+ if c := w.validate(); c == "" {
44
+ t.Fatal("accepted", kind)
45
+ }
46
+ }
47
+ }
48
+
49
+ func TestWriteProofPacketDoesNotBecomeReadMetadata(t *testing.T) {
50
+ if (readOnlyResult{Mutation: &MutationReceipt{Created: true}}).validFor(readOnlyWork{Action: ActionRead, MaxBytes: 10}) {
51
+ t.Fatal("write receipt accepted as read metadata")
52
+ }
53
+ }
@@ -7,7 +7,14 @@
7
7
  // language ({name} placeholders, key.one/.other
8
8
  // plurals with { count }), English as fallback
9
9
  // ctx.locale -> "en", "zh-TW", … (use it for Intl formatting)
10
- // ctx.reopen(fn) -> fn runs each time DSM re-shows the window
10
+ // ctx.reopen(fn) -> idempotent unsubscribe; fn runs on re-show
11
+ // ctx.host.platform() -> read-only host/launch mode/language/version snapshot
12
+ // ctx.host.setTitle(text) -> encoded DSM title or standalone document.title;
13
+ // inspect the returned status, not host authority
14
+ // ctx.host.subscribe(event, fn) -> status + dispose for window-resize;
15
+ // host-theme/language-change unsupported
16
+ // ctx.host.openFileManager(path) / revealFile(path) -> File Station virtual path
17
+ // request only; preview/details/settings return unsupported, never a grant
11
18
  // Replace everything below with your own UI (plain JS, or a bundle you build
12
19
  // with Vite/Vue into this folder -- see README.md).
13
20
  (function () {
@@ -1,2 +1,4 @@
1
1
  import {build} from 'esbuild';
2
+ import {writeThirdPartyNotices} from './third-party-notices.mjs';
2
3
  await build({entryPoints:['app.mjs'],bundle:true,platform:'node',format:'esm',target:'node22',outfile:'dist/app.mjs',banner:{js:"import {createRequire} from 'node:module'; const require = createRequire(import.meta.url);"}});
4
+ writeThirdPartyNotices(process.cwd(), 'dist/LICENSES');
@@ -19,6 +19,15 @@ The pinned `@synopackageland/ui@0.4.0` dependency is public on
19
19
  or credentials are required. Dependencies are installed and UI bundled on the
20
20
  build machine; the NAS never downloads npm packages. Commit your lockfiles.
21
21
 
22
+ Vitest is pinned to **4.1.11** to fix CVE-2026-47429 and CVE-2026-84373.
23
+ It and `@vitest/mocker` are development-only tools, excluded from the shipped
24
+ browser bundle and SPK. Run `npm audit` separately to check the full lockfile;
25
+ `npm audit --omit=dev` checks only production dependencies. These checks are
26
+ snapshots of the advisory database, not a guarantee against future advisories.
27
+ Keep the `--ignore-scripts` install above: npm install-script policy warnings
28
+ are separate from vulnerability findings and do not require approving scripts
29
+ for this template's test/build workflow.
30
+
22
31
  ## Optional integration (experimental)
23
32
 
24
33
  **Experimental integration — DSM 7.4 known limitation:** DSM ignores a
@@ -35,7 +44,7 @@ integration uses Go **1.25+** for fd-rooted atomic storage updates.
35
44
 
36
45
  Open the app as a DSM administrator. **Approve and activate** uses the existing
37
46
  DSM PasswordConfirm and exact-task readback, then `helper_enable`. Recover,
38
- Teardown and Disable call the other fixed public operations. Status always
47
+ Teardown, Disable and Repair cleanup call the other fixed public operations. Status always
39
48
  comes from `integration.status`; scheduler approval is not helper readiness.
40
49
  Package running is `unknown`, scheduler `not-probed`: this backend has no fresh
41
50
  Package Center/scheduler probe. Use Package Center separately to read that state.
@@ -55,6 +64,53 @@ unsafe file metadata, serialize CGI readers/writers, and limit UTF-8 input to
55
64
  4096 bytes. Failed writes must be inspected/retried; no multi-file transaction,
56
65
  version history or general filesystem permission is implied.
57
66
 
67
+ ## NAS picker and grants (S4 mock preview)
68
+
69
+ The Vue template includes `NasPathPicker` and `NasGrantSettings`, built from UI
70
+ 0.4.0's Dialog, TreeView, DataGrid, Button and SettingsSection. The existing
71
+ browser `FilePicker` still represents local `File[]`; NAS selections return
72
+ opaque directory grant handles. The new UI has catalogs for en, zh-TW, zh-CN,
73
+ ja, ko, de, fr, es and it, selected from `ctx.locale` with English fallback.
74
+
75
+ There is **no default NAS provider** and no new CGI/helper route. The existing
76
+ DSM loader's two-argument mount remains unchanged and hides the NAS section.
77
+ A development host can explicitly inject an in-memory fixture:
78
+
79
+ ```ts
80
+ import {mount} from './src/main'
81
+ import {createMockNasService} from './src/nas/mock-provider'
82
+
83
+ const fixtures = createMockNasService({appName: 'My package', drained: false})
84
+ const app = mount(root, ctx, {nasProvider: fixtures.connect('normal1')})
85
+ // Another window can use fixtures.connect('normal2'); private grants stay separate.
86
+ // Call app.unmount() when its window closes or its native subject changes.
87
+ ```
88
+
89
+ Only `normal1`, `normal2` and `admin` are synthetic fixture subjects. The service
90
+ uses S0 protocol-2 display projections and S1 discovery-anchor shape, not native
91
+ identity proofs or filesystem authority. Candidate contexts expire in 60 seconds;
92
+ one-use review intents expire in 30 seconds. Picker cancellation invalidates that
93
+ context and creates no grant. Read-only actions are fixed; shared consent and
94
+ shared revoke require the fixture's current administrator role. Fixture references
95
+ and digest-shaped summary tokens are random; these are **not** S3 authenticated
96
+ digests, durable storage, DSM ACL validation, or transferable grants.
97
+
98
+ Grant state is separate from helper readiness. Revocation shows R (new access
99
+ refused) separately from Q (transfers drained), including pending cleanup from a
100
+ provider snapshot. It does not undo sent/written data. All fixture state disappears
101
+ when this service instance is discarded. Neither mock success nor abort/timeout
102
+ proves a NAS operation stopped. Each UI request is bounded to five seconds;
103
+ close/unmount aborts pending work and ignores late results. A package/account
104
+ change reported by app status discards the injected UI until the host remounts
105
+ with a new per-session provider. Real adapters must validate the current session, local UID/username, enabled
106
+ account, complete groups and App privilege on every call. Session switches
107
+ require a new provider; relaxed mode accepts same-UID/same-name recreation.
108
+
109
+ The mock is imported only by tests/development hosts and is not activated or
110
+ bundled by the default entry point. Later S3/S5/S8 work must supply production
111
+ adapters, durable/fence/ACL proofs and capability integration before connecting
112
+ NAS data. Go-only and the existing protocol-1 manifest remain unchanged.
113
+
58
114
  ## Optional Better Auth
59
115
 
60
116
  Generate with `--ui vue --integration better-auth`. This is the only option that
@@ -108,3 +164,61 @@ reused before reaping. Startup still requires a live handshake within two second
108
164
  Lost supervisors preserve failed/cleanup-required; the controller never signals a
109
165
  recorded PID. Rebuild after M1d and approve the new payload digest before use.
110
166
  Uninstall retains disabled gate/cache/history by policy.
167
+
168
+
169
+ ## Repair after supervisor loss (R2)
170
+
171
+ An administrator can choose **Repair cleanup** through the existing DSM
172
+ PasswordConfirm and exact `helper_repair` task. Every Repair run asks for fresh
173
+ password confirmation and rechecks the task afterward; cancellation runs nothing. A protected epoch lifetime lock,
174
+ held by both the supervisor and its child until kernel exit, must be obtainable
175
+ before cleanup. Repair clears only verified helper runtime residue, commits a
176
+ private completion proof and preserves the approval/disabled gate. It never
177
+ signals a recorded PID or restarts integration; use Recover or Approve and
178
+ activate separately afterward. Missing, replaced or busy witnesses and foreign
179
+ or live runtime paths refuse cleanup. Repeating Repair safely retries an
180
+ interrupted cleanup transaction.
181
+
182
+ Pre-R2 builds, including M1d/0001 Alpha and pre-R2 M1g, did not create this
183
+ witness. Upgrading cannot supply historical proof: retain their residue and use
184
+ the separately authorized reboot/Disable flow before upgrading. See
185
+ `docs/m1a-helper-lifecycle-contract.md` in the SDK repository. R2 has local and
186
+ isolated Linux systemd VM evidence; DSM 4.4 acceptance is still unknown.
187
+
188
+
189
+ ## M2 S1R build policy and unavailable delivery
190
+
191
+ The S8 source candidate also accepts `--integration-protocol 2` with
192
+ `--integration go` or `better-auth`. The default stays protocol 1. The manifest,
193
+ compiled helper/CGI inventory, payload/worker digests, inspector and lifecycle
194
+ approval pin the same protocol. A change requires exact new approval, never
195
+ protocol 1 data fallback.
196
+
197
+ Use `--data-access relaxed` with explicit protocol 2 to emit
198
+ `integration.dataAccess: relaxed`. Omission keeps unavailable behavior; explicit
199
+ `unavailable` is also accepted for protocol 2. The setting is bound into helper/CGI
200
+ inventory, digests and root approval. Rebuild and obtain new approval to change it.
201
+ It does not install missing adapters, enable write gates or certify NAS access.
202
+
203
+ Relaxed identity records UID and username. Recreated accounts with the same pair
204
+ may retain grants; changing either invalidates all grants for that identity and
205
+ requires new authorization. Disabled accounts and revoked App access are denied.
206
+ File operations use permanent dropped credentials and remain limited by NAS
207
+ permissions and grant scope. See `docs/m2-s1r-relaxed-identity.md` in the SDK repo.
208
+
209
+ NAS folder grants and file operations are not available for ordinary users or
210
+ administrators. Production DSM identity, permission and scope adapters are not yet certified.
211
+ Managed account pilot B is superseded by the relaxed UID/username contract. Enabling or
212
+ recovering integration, or signing in again, does not unlock NAS access.
213
+ Production shows this state in nine languages and supplies no picker/consent/
214
+ file CTA. Only dev/test builds accept an injected mock provider with a preview
215
+ banner; production ignores provider injection. No public data adapter is installed. Caller/admin/path fields never supply
216
+ trusted session, UID, groups or App permission.
217
+
218
+ Unknown NAS methods return `unknown_method`; the valid nil binary read route
219
+ returns `unsupported`. Missing native proof is `unavailable`, wrong peer is
220
+ `denied`, and unknown/stale/replay controls retain their own safe codes.
221
+ Anonymous/expired DSM sessions return `session_required`; authentication failure
222
+ returns `auth_unavailable`. Relogin restores only the ordinary app session.
223
+ Positive NAS functionality, ACL and final DSM SPK acceptance remain blocked /
224
+ unknown; local refusal and QEMU fixtures do not certify them.
@@ -51,7 +51,7 @@ The application adds no shadows or elevation system. Surface, overlay and dialog
51
51
  ## Components
52
52
 
53
53
  - **AppRoot and lifecycle:** `mount(root, ctx)` creates a fresh Vue instance per DSM window. Reopen refreshes its status. Unmount marks the instance disposed and clears its app cookie, note text and opaque note ID; pending responses must not repopulate a disposed instance. Do not share user/session state between mounts.
54
- - **SettingsSection and status:** integration is always visible; sample data appears only in `ready`. Keep the six existing labels and descriptions from `context.ts`: `not-enabled` → Not enabled; `ready` → Ready; `needs-approval` → Approval required; `incompatible` → Incompatible; `stopped` → Stopped; `failed` → Failed. Show cleanup-required guidance and the returned package/scheduler values, including `unknown` or `not-probed`.
54
+ - **SettingsSection and status:** integration is always visible; sample data appears only in `ready`. Keep the existing labels and descriptions from `context.ts`: `not-enabled` → Not enabled; `ready` → Ready; `needs-approval` → Approval required; `incompatible` → Incompatible; `stopped` → Stopped; `failed` → Failed; `pending` → Temporarily revalidating (localized safe copy). Pending hides sample authority and does not request administrator recovery. Show cleanup-required guidance and the returned package/scheduler values, including `unknown` or `not-probed`.
55
55
  - **Permissions and Button:** root controls appear only for an administrator with `ctx.root` and configured integration. Other accounts receive administrator guidance when integration is not ready. Activation/recovery/teardown/disable follow authorization before execution; cancelled approval reports that no operation ran.
56
56
  - **Loading, empty and mutation states:** Refresh and mutations disable competing controls; the main region exposes `aria-busy` and textual status. Failed status loading offers Refresh. A ready integration with no note ID shows the “No sample data” Callout. A labeled Textarea and Save button appear when a note exists. Completion notices use `role=status`; error copy uses `role=alert` and identifies a recovery action. Optional app identity appears only when its route reports `better-auth`.
57
57
  - **Dialog:** Disable opens the library confirmation dialog, explains refusal of new requests and retention of existing data/output, and presents Cancel plus danger Confirm disable. No application modal replacement is provided.