@genobank/biofs 3.22.0 → 3.23.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 (316) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/abi/sequentia/ConsentGrant.json +1909 -0
  3. package/dist/commands/admin/verify-lab.js +1 -1
  4. package/dist/commands/admin/verify-lab.js.map +1 -1
  5. package/dist/commands/alphagenome/index.d.ts +26 -0
  6. package/dist/commands/alphagenome/index.d.ts.map +1 -0
  7. package/dist/commands/alphagenome/index.js +72 -0
  8. package/dist/commands/alphagenome/index.js.map +1 -0
  9. package/dist/commands/annotate/signed_headers.d.ts +5 -0
  10. package/dist/commands/annotate/signed_headers.d.ts.map +1 -0
  11. package/dist/commands/annotate/signed_headers.js +10 -0
  12. package/dist/commands/annotate/signed_headers.js.map +1 -0
  13. package/dist/commands/annotate/status.d.ts.map +1 -1
  14. package/dist/commands/annotate/status.js +4 -0
  15. package/dist/commands/annotate/status.js.map +1 -1
  16. package/dist/commands/annotate/submit.d.ts +4 -1
  17. package/dist/commands/annotate/submit.d.ts.map +1 -1
  18. package/dist/commands/annotate/submit.js +41 -12
  19. package/dist/commands/annotate/submit.js.map +1 -1
  20. package/dist/commands/biofiles.d.ts.map +1 -1
  21. package/dist/commands/biofiles.js +10 -2
  22. package/dist/commands/biofiles.js.map +1 -1
  23. package/dist/commands/clawbio/submit.d.ts +24 -0
  24. package/dist/commands/clawbio/submit.d.ts.map +1 -0
  25. package/dist/commands/clawbio/submit.js +175 -0
  26. package/dist/commands/clawbio/submit.js.map +1 -0
  27. package/dist/commands/consent.d.ts +1 -0
  28. package/dist/commands/consent.d.ts.map +1 -1
  29. package/dist/commands/consent.js +3 -2
  30. package/dist/commands/consent.js.map +1 -1
  31. package/dist/commands/context/create.d.ts.map +1 -1
  32. package/dist/commands/context/create.js +40 -5
  33. package/dist/commands/context/create.js.map +1 -1
  34. package/dist/commands/crypt4gh.d.ts +24 -0
  35. package/dist/commands/crypt4gh.d.ts.map +1 -0
  36. package/dist/commands/crypt4gh.js +220 -0
  37. package/dist/commands/crypt4gh.js.map +1 -0
  38. package/dist/commands/fluency/index.d.ts +6 -0
  39. package/dist/commands/fluency/index.d.ts.map +1 -1
  40. package/dist/commands/fluency/index.js +64 -0
  41. package/dist/commands/fluency/index.js.map +1 -1
  42. package/dist/commands/fourier-score.d.ts +2 -0
  43. package/dist/commands/fourier-score.d.ts.map +1 -1
  44. package/dist/commands/fourier-score.js +201 -107
  45. package/dist/commands/fourier-score.js.map +1 -1
  46. package/dist/commands/fusion-evidence/index.d.ts +25 -0
  47. package/dist/commands/fusion-evidence/index.d.ts.map +1 -0
  48. package/dist/commands/fusion-evidence/index.js +136 -0
  49. package/dist/commands/fusion-evidence/index.js.map +1 -0
  50. package/dist/commands/governance.d.ts +46 -0
  51. package/dist/commands/governance.d.ts.map +1 -0
  52. package/dist/commands/governance.js +126 -0
  53. package/dist/commands/governance.js.map +1 -0
  54. package/dist/commands/humanmark.d.ts +68 -0
  55. package/dist/commands/humanmark.d.ts.map +1 -0
  56. package/dist/commands/humanmark.js +278 -0
  57. package/dist/commands/humanmark.js.map +1 -0
  58. package/dist/commands/imaging/compare.d.ts +1 -0
  59. package/dist/commands/imaging/compare.d.ts.map +1 -1
  60. package/dist/commands/imaging/compare.js +1 -0
  61. package/dist/commands/imaging/compare.js.map +1 -1
  62. package/dist/commands/imaging/lesions.d.ts +1 -0
  63. package/dist/commands/imaging/lesions.d.ts.map +1 -1
  64. package/dist/commands/imaging/lesions.js +2 -1
  65. package/dist/commands/imaging/lesions.js.map +1 -1
  66. package/dist/commands/imaging/register.d.ts +1 -0
  67. package/dist/commands/imaging/register.d.ts.map +1 -1
  68. package/dist/commands/imaging/register.js +24 -0
  69. package/dist/commands/imaging/register.js.map +1 -1
  70. package/dist/commands/imaging/trajectory.d.ts +1 -0
  71. package/dist/commands/imaging/trajectory.d.ts.map +1 -1
  72. package/dist/commands/imaging/trajectory.js +2 -1
  73. package/dist/commands/imaging/trajectory.js.map +1 -1
  74. package/dist/commands/imaging/twin.d.ts +1 -0
  75. package/dist/commands/imaging/twin.d.ts.map +1 -1
  76. package/dist/commands/imaging/twin.js +1 -0
  77. package/dist/commands/imaging/twin.js.map +1 -1
  78. package/dist/commands/inventory-register-sqlite.d.ts +10 -0
  79. package/dist/commands/inventory-register-sqlite.d.ts.map +1 -1
  80. package/dist/commands/inventory-register-sqlite.js +62 -8
  81. package/dist/commands/inventory-register-sqlite.js.map +1 -1
  82. package/dist/commands/job/submit-clara.d.ts.map +1 -1
  83. package/dist/commands/job/submit-clara.js +71 -50
  84. package/dist/commands/job/submit-clara.js.map +1 -1
  85. package/dist/commands/kiosk/canon.d.ts +95 -0
  86. package/dist/commands/kiosk/canon.d.ts.map +1 -0
  87. package/dist/commands/kiosk/canon.js +120 -0
  88. package/dist/commands/kiosk/canon.js.map +1 -0
  89. package/dist/commands/kiosk/cli.d.ts +12 -0
  90. package/dist/commands/kiosk/cli.d.ts.map +1 -0
  91. package/dist/commands/kiosk/cli.js +784 -0
  92. package/dist/commands/kiosk/cli.js.map +1 -0
  93. package/dist/commands/kiosk/client.d.ts +32 -0
  94. package/dist/commands/kiosk/client.d.ts.map +1 -0
  95. package/dist/commands/kiosk/client.js +179 -0
  96. package/dist/commands/kiosk/client.js.map +1 -0
  97. package/dist/commands/kiosk/cryptobox.d.ts +41 -0
  98. package/dist/commands/kiosk/cryptobox.d.ts.map +1 -0
  99. package/dist/commands/kiosk/cryptobox.js +126 -0
  100. package/dist/commands/kiosk/cryptobox.js.map +1 -0
  101. package/dist/commands/kiosk/gate.d.ts +13 -0
  102. package/dist/commands/kiosk/gate.d.ts.map +1 -0
  103. package/dist/commands/kiosk/gate.js +174 -0
  104. package/dist/commands/kiosk/gate.js.map +1 -0
  105. package/dist/commands/kiosk/home.d.ts +80 -0
  106. package/dist/commands/kiosk/home.d.ts.map +1 -0
  107. package/dist/commands/kiosk/home.js +265 -0
  108. package/dist/commands/kiosk/home.js.map +1 -0
  109. package/dist/commands/kiosk/hooks.d.ts +24 -0
  110. package/dist/commands/kiosk/hooks.d.ts.map +1 -0
  111. package/dist/commands/kiosk/hooks.js +305 -0
  112. package/dist/commands/kiosk/hooks.js.map +1 -0
  113. package/dist/commands/kiosk/invitemail.d.ts +17 -0
  114. package/dist/commands/kiosk/invitemail.d.ts.map +1 -0
  115. package/dist/commands/kiosk/invitemail.js +58 -0
  116. package/dist/commands/kiosk/invitemail.js.map +1 -0
  117. package/dist/commands/kiosk/main.d.ts +7 -0
  118. package/dist/commands/kiosk/main.d.ts.map +1 -0
  119. package/dist/commands/kiosk/main.js +20 -0
  120. package/dist/commands/kiosk/main.js.map +1 -0
  121. package/dist/commands/kiosk/mcp.d.ts +28 -0
  122. package/dist/commands/kiosk/mcp.d.ts.map +1 -0
  123. package/dist/commands/kiosk/mcp.js +304 -0
  124. package/dist/commands/kiosk/mcp.js.map +1 -0
  125. package/dist/commands/kiosk/pairing.d.ts +28 -0
  126. package/dist/commands/kiosk/pairing.d.ts.map +1 -0
  127. package/dist/commands/kiosk/pairing.js +147 -0
  128. package/dist/commands/kiosk/pairing.js.map +1 -0
  129. package/dist/commands/kiosk/presence.d.ts +11 -0
  130. package/dist/commands/kiosk/presence.d.ts.map +1 -0
  131. package/dist/commands/kiosk/presence.js +105 -0
  132. package/dist/commands/kiosk/presence.js.map +1 -0
  133. package/dist/commands/kiosk/profile.d.ts +59 -0
  134. package/dist/commands/kiosk/profile.d.ts.map +1 -0
  135. package/dist/commands/kiosk/profile.js +266 -0
  136. package/dist/commands/kiosk/profile.js.map +1 -0
  137. package/dist/commands/kiosk/room.d.ts +252 -0
  138. package/dist/commands/kiosk/room.d.ts.map +1 -0
  139. package/dist/commands/kiosk/room.js +1057 -0
  140. package/dist/commands/kiosk/room.js.map +1 -0
  141. package/dist/commands/mirror.d.ts +16 -0
  142. package/dist/commands/mirror.d.ts.map +1 -0
  143. package/dist/commands/mirror.js +172 -0
  144. package/dist/commands/mirror.js.map +1 -0
  145. package/dist/commands/neoantigen/align.d.ts +15 -0
  146. package/dist/commands/neoantigen/align.d.ts.map +1 -0
  147. package/dist/commands/neoantigen/align.js +74 -0
  148. package/dist/commands/neoantigen/align.js.map +1 -0
  149. package/dist/commands/neoantigen/fabricate.d.ts +20 -0
  150. package/dist/commands/neoantigen/fabricate.d.ts.map +1 -0
  151. package/dist/commands/neoantigen/fabricate.js +119 -0
  152. package/dist/commands/neoantigen/fabricate.js.map +1 -0
  153. package/dist/commands/neoantigen/ingest.d.ts +14 -0
  154. package/dist/commands/neoantigen/ingest.d.ts.map +1 -0
  155. package/dist/commands/neoantigen/ingest.js +62 -0
  156. package/dist/commands/neoantigen/ingest.js.map +1 -0
  157. package/dist/commands/neoantigen/status.d.ts +4 -0
  158. package/dist/commands/neoantigen/status.d.ts.map +1 -0
  159. package/dist/commands/neoantigen/status.js +69 -0
  160. package/dist/commands/neoantigen/status.js.map +1 -0
  161. package/dist/commands/neoantigen-pipeline/index.d.ts +146 -2
  162. package/dist/commands/neoantigen-pipeline/index.d.ts.map +1 -1
  163. package/dist/commands/neoantigen-pipeline/index.js +413 -1
  164. package/dist/commands/neoantigen-pipeline/index.js.map +1 -1
  165. package/dist/commands/onramp/huggingface.d.ts +33 -0
  166. package/dist/commands/onramp/huggingface.d.ts.map +1 -0
  167. package/dist/commands/onramp/huggingface.js +124 -0
  168. package/dist/commands/onramp/huggingface.js.map +1 -0
  169. package/dist/commands/parabricks/index.d.ts +3 -1
  170. package/dist/commands/parabricks/index.d.ts.map +1 -1
  171. package/dist/commands/parabricks/index.js +16 -6
  172. package/dist/commands/parabricks/index.js.map +1 -1
  173. package/dist/commands/parabricks/registry.json +105 -3
  174. package/dist/commands/protein-impact/benchmark.d.ts +34 -0
  175. package/dist/commands/protein-impact/benchmark.d.ts.map +1 -0
  176. package/dist/commands/protein-impact/benchmark.js +75 -0
  177. package/dist/commands/protein-impact/benchmark.js.map +1 -0
  178. package/dist/commands/protein-impact/benchmark_v1.json +1 -0
  179. package/dist/commands/protein-impact/constants.d.ts +54 -0
  180. package/dist/commands/protein-impact/constants.d.ts.map +1 -0
  181. package/dist/commands/protein-impact/constants.js +47 -0
  182. package/dist/commands/protein-impact/constants.js.map +1 -0
  183. package/dist/commands/protein-impact/core.d.ts +145 -0
  184. package/dist/commands/protein-impact/core.d.ts.map +1 -0
  185. package/dist/commands/protein-impact/core.js +288 -0
  186. package/dist/commands/protein-impact/core.js.map +1 -0
  187. package/dist/commands/protein-impact/domain_table.json +23 -0
  188. package/dist/commands/protein-impact/domains.d.ts +9 -0
  189. package/dist/commands/protein-impact/domains.d.ts.map +1 -0
  190. package/dist/commands/protein-impact/domains.js +29 -0
  191. package/dist/commands/protein-impact/domains.js.map +1 -0
  192. package/dist/commands/protein-impact/estimate.d.ts +48 -0
  193. package/dist/commands/protein-impact/estimate.d.ts.map +1 -0
  194. package/dist/commands/protein-impact/estimate.js +101 -0
  195. package/dist/commands/protein-impact/estimate.js.map +1 -0
  196. package/dist/commands/protein-impact/exec.d.ts +60 -0
  197. package/dist/commands/protein-impact/exec.d.ts.map +1 -0
  198. package/dist/commands/protein-impact/exec.js +227 -0
  199. package/dist/commands/protein-impact/exec.js.map +1 -0
  200. package/dist/commands/protein-impact/features.d.ts +24 -0
  201. package/dist/commands/protein-impact/features.d.ts.map +1 -0
  202. package/dist/commands/protein-impact/features.js +93 -0
  203. package/dist/commands/protein-impact/features.js.map +1 -0
  204. package/dist/commands/protein-impact/gate.d.ts +94 -0
  205. package/dist/commands/protein-impact/gate.d.ts.map +1 -0
  206. package/dist/commands/protein-impact/gate.js +120 -0
  207. package/dist/commands/protein-impact/gate.js.map +1 -0
  208. package/dist/commands/protein-impact/gate_rules.json +10 -0
  209. package/dist/commands/protein-impact/guard.d.ts +44 -0
  210. package/dist/commands/protein-impact/guard.d.ts.map +1 -0
  211. package/dist/commands/protein-impact/guard.js +189 -0
  212. package/dist/commands/protein-impact/guard.js.map +1 -0
  213. package/dist/commands/protein-impact/metrics.d.ts +44 -0
  214. package/dist/commands/protein-impact/metrics.d.ts.map +1 -0
  215. package/dist/commands/protein-impact/metrics.js +178 -0
  216. package/dist/commands/protein-impact/metrics.js.map +1 -0
  217. package/dist/commands/protein-impact/numbering.d.ts +33 -0
  218. package/dist/commands/protein-impact/numbering.d.ts.map +1 -0
  219. package/dist/commands/protein-impact/numbering.js +115 -0
  220. package/dist/commands/protein-impact/numbering.js.map +1 -0
  221. package/dist/commands/protein-impact/register.d.ts +6 -0
  222. package/dist/commands/protein-impact/register.d.ts.map +1 -0
  223. package/dist/commands/protein-impact/register.js +139 -0
  224. package/dist/commands/protein-impact/register.js.map +1 -0
  225. package/dist/commands/protein-impact/request.d.ts +14 -0
  226. package/dist/commands/protein-impact/request.d.ts.map +1 -0
  227. package/dist/commands/protein-impact/request.js +73 -0
  228. package/dist/commands/protein-impact/request.js.map +1 -0
  229. package/dist/commands/protein-impact/submit.d.ts +117 -0
  230. package/dist/commands/protein-impact/submit.d.ts.map +1 -0
  231. package/dist/commands/protein-impact/submit.js +460 -0
  232. package/dist/commands/protein-impact/submit.js.map +1 -0
  233. package/dist/commands/protein-impact/tools.lock.json +53 -0
  234. package/dist/commands/protein-impact/tools_lock.d.ts +41 -0
  235. package/dist/commands/protein-impact/tools_lock.d.ts.map +1 -0
  236. package/dist/commands/protein-impact/tools_lock.js +52 -0
  237. package/dist/commands/protein-impact/tools_lock.js.map +1 -0
  238. package/dist/commands/psm-consensus.d.ts.map +1 -1
  239. package/dist/commands/psm-consensus.js +65 -26
  240. package/dist/commands/psm-consensus.js.map +1 -1
  241. package/dist/commands/reconcile-owners.d.ts +21 -0
  242. package/dist/commands/reconcile-owners.d.ts.map +1 -0
  243. package/dist/commands/reconcile-owners.js +86 -0
  244. package/dist/commands/reconcile-owners.js.map +1 -0
  245. package/dist/commands/reference-register/index.d.ts +8 -0
  246. package/dist/commands/reference-register/index.d.ts.map +1 -0
  247. package/dist/commands/reference-register/index.js +58 -0
  248. package/dist/commands/reference-register/index.js.map +1 -0
  249. package/dist/commands/register-derived-file.d.ts +9 -0
  250. package/dist/commands/register-derived-file.d.ts.map +1 -0
  251. package/dist/commands/register-derived-file.js +101 -0
  252. package/dist/commands/register-derived-file.js.map +1 -0
  253. package/dist/commands/rrm-consensus.d.ts.map +1 -1
  254. package/dist/commands/rrm-consensus.js +65 -26
  255. package/dist/commands/rrm-consensus.js.map +1 -1
  256. package/dist/commands/rrm-validate.d.ts +22 -0
  257. package/dist/commands/rrm-validate.d.ts.map +1 -0
  258. package/dist/commands/rrm-validate.js +109 -0
  259. package/dist/commands/rrm-validate.js.map +1 -0
  260. package/dist/commands/tele.d.ts +1 -0
  261. package/dist/commands/tele.d.ts.map +1 -1
  262. package/dist/commands/tele.js +37 -2
  263. package/dist/commands/tele.js.map +1 -1
  264. package/dist/commands/tokenize.d.ts.map +1 -1
  265. package/dist/commands/tokenize.js +35 -0
  266. package/dist/commands/tokenize.js.map +1 -1
  267. package/dist/commands/upload.d.ts +28 -1
  268. package/dist/commands/upload.d.ts.map +1 -1
  269. package/dist/commands/upload.js +174 -31
  270. package/dist/commands/upload.js.map +1 -1
  271. package/dist/commands/vault/mount.d.ts.map +1 -1
  272. package/dist/commands/vault/mount.js +6 -0
  273. package/dist/commands/vault/mount.js.map +1 -1
  274. package/dist/commands/workspace.d.ts +2 -0
  275. package/dist/commands/workspace.d.ts.map +1 -1
  276. package/dist/commands/workspace.js +16 -4
  277. package/dist/commands/workspace.js.map +1 -1
  278. package/dist/commands/x402/submit.d.ts.map +1 -1
  279. package/dist/commands/x402/submit.js +7 -4
  280. package/dist/commands/x402/submit.js.map +1 -1
  281. package/dist/index.js +810 -31
  282. package/dist/index.js.map +1 -1
  283. package/dist/lib/api/bionft-client.d.ts.map +1 -1
  284. package/dist/lib/api/bionft-client.js +1 -1
  285. package/dist/lib/api/bionft-client.js.map +1 -1
  286. package/dist/lib/api/fuse-client.d.ts.map +1 -1
  287. package/dist/lib/api/fuse-client.js +8 -1
  288. package/dist/lib/api/fuse-client.js.map +1 -1
  289. package/dist/lib/biofiles/resolver.d.ts.map +1 -1
  290. package/dist/lib/biofiles/resolver.js +5 -2
  291. package/dist/lib/biofiles/resolver.js.map +1 -1
  292. package/dist/lib/crypt4gh/bind.d.ts +51 -0
  293. package/dist/lib/crypt4gh/bind.d.ts.map +1 -0
  294. package/dist/lib/crypt4gh/bind.js +140 -0
  295. package/dist/lib/crypt4gh/bind.js.map +1 -0
  296. package/dist/lib/crypt4gh/index.d.ts +45 -0
  297. package/dist/lib/crypt4gh/index.d.ts.map +1 -0
  298. package/dist/lib/crypt4gh/index.js +391 -0
  299. package/dist/lib/crypt4gh/index.js.map +1 -0
  300. package/dist/lib/gene-map.d.ts.map +1 -1
  301. package/dist/lib/gene-map.js +13 -0
  302. package/dist/lib/gene-map.js.map +1 -1
  303. package/dist/lib/rrm_fft.py +555 -0
  304. package/dist/lib/sequentia/BioPIL.js +1 -1
  305. package/dist/lib/sequentia/BioPIL.js.map +1 -1
  306. package/dist/lib/sequentia/ConsentManager.js +1 -1
  307. package/dist/lib/sequentia/ConsentManager.js.map +1 -1
  308. package/dist/lib/sequentia/OpenCravatJobs.js +1 -1
  309. package/dist/lib/sequentia/OpenCravatJobs.js.map +1 -1
  310. package/dist/lib/sequentia/PaymentRouter.js +1 -1
  311. package/dist/lib/sequentia/PaymentRouter.js.map +1 -1
  312. package/dist/lib/sequentia/consent-grant-c2pa.d.ts +134 -0
  313. package/dist/lib/sequentia/consent-grant-c2pa.d.ts.map +1 -0
  314. package/dist/lib/sequentia/consent-grant-c2pa.js +218 -0
  315. package/dist/lib/sequentia/consent-grant-c2pa.js.map +1 -0
  316. package/package.json +2 -2
@@ -0,0 +1,784 @@
1
+ "use strict";
2
+ /**
3
+ * `kiosk` commands (Stage 1). registerKiosk() attaches them to a commander program, either the
4
+ * standalone `kiosk` entry (main.ts) or, once Daniel decides to ship it, `biofs kiosk`.
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ var __importDefault = (this && this.__importDefault) || function (mod) {
40
+ return (mod && mod.__esModule) ? mod : { "default": mod };
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.wrapText = wrapText;
44
+ exports.markdownLite = markdownLite;
45
+ exports.renderLive = renderLive;
46
+ exports.registerKiosk = registerKiosk;
47
+ const readline = __importStar(require("readline"));
48
+ const chalk_1 = __importDefault(require("chalk"));
49
+ const ethers_1 = require("ethers");
50
+ const client_1 = require("./client");
51
+ const home_1 = require("./home");
52
+ const invitemail_1 = require("./invitemail");
53
+ const hooks_1 = require("./hooks");
54
+ const mcp_1 = require("./mcp");
55
+ const profile_1 = require("./profile");
56
+ const room = __importStar(require("./room"));
57
+ const gate_1 = require("./gate");
58
+ const crypto = __importStar(require("crypto"));
59
+ const fs = __importStar(require("fs"));
60
+ const path = __importStar(require("path"));
61
+ const ok = (s) => console.log(chalk_1.default.green(s));
62
+ const dim = (s) => chalk_1.default.gray(s);
63
+ function ask(question) {
64
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
65
+ return new Promise((resolve) => rl.question(question, (a) => { rl.close(); resolve(a.trim()); }));
66
+ }
67
+ const invitationBody = (url, from) => `Scan the QR code, or open this link on your Mac:\n${url}\n\n${from}`;
68
+ function line(e) {
69
+ const who = `${e.label}${e.key_role === 'seat' ? ' seat' : ''}`;
70
+ const body = e.erased ? dim('[erased by its author]') : e.undecryptable ? dim('[not readable with this device key]') : (e.text || dim(`(${e.kind}${e.meta && e.meta.action ? ': ' + e.meta.action : ''})`));
71
+ return `${dim(`#${e.seq} ${e.ts_relay.slice(11, 19)}`)} ${chalk_1.default.bold(who)} ${dim(`${e.kind}, ${e.evidence}`)} ${body}`;
72
+ }
73
+ // ---- the live view of `kiosk chat`, drawn the way Claude Code draws a conversation ----------------
74
+ const termWidth = () => Math.max(40, Math.min(process.stdout.columns || 100, 110));
75
+ function wrapText(text, indent = ' ', width = termWidth()) {
76
+ const max = Math.max(20, width - indent.length);
77
+ const out = [];
78
+ for (const raw of text.replace(/\r/g, '').split('\n')) {
79
+ if (!raw.trim()) {
80
+ out.push('');
81
+ continue;
82
+ }
83
+ const lead = raw.match(/^\s*/)[0];
84
+ let cur = '';
85
+ for (const w of raw.trim().split(/\s+/)) {
86
+ if (cur && (lead.length + cur.length + 1 + w.length) > max) {
87
+ out.push(lead + cur);
88
+ cur = w;
89
+ }
90
+ else
91
+ cur = cur ? `${cur} ${w}` : w;
92
+ }
93
+ out.push(lead + cur);
94
+ }
95
+ return out.map((l) => (l ? indent + l : '')).join('\n');
96
+ }
97
+ // Bold, inline code and headings, the 3 marks an answer uses most; everything else is left as typed.
98
+ function markdownLite(text) {
99
+ return text
100
+ .split('\n')
101
+ .map((l) => (/^#{1,6}\s+/.test(l) ? chalk_1.default.bold(l.replace(/^#{1,6}\s+/, '')) : l))
102
+ .join('\n')
103
+ .replace(/\*\*([^*\n]+)\*\*/g, (_m, t) => chalk_1.default.bold(t))
104
+ .replace(/`([^`\n]+)`/g, (_m, t) => chalk_1.default.cyan(t));
105
+ }
106
+ function renderLive(e) {
107
+ const m = (e.meta || {});
108
+ if (e.kind === 'erase')
109
+ return null;
110
+ if (e.erased)
111
+ return dim(` ${e.label}: [erased by its author]`);
112
+ if (e.undecryptable)
113
+ return dim(` ${e.label}: [not readable with this device key]`);
114
+ if (e.kind === 'member')
115
+ return dim(` · ${e.label} ${m.action === 'join' ? `admitted ${m.label || ''}`.trim() : m.action || ''}`);
116
+ if (e.kind === 'file_touch')
117
+ return ` ${dim('⎿')} Edited ${m.path || ''}`;
118
+ if (e.kind === 'commit_ref')
119
+ return ` ${dim('⎿')} Committed ${String(m.hash || '').slice(0, 10)} ${m.subject || ''}`;
120
+ const text = e.text || '';
121
+ if (e.key_role === 'seat') {
122
+ const who = `${chalk_1.default.bold('⏺')} ${chalk_1.default.bold('Claude')} ${dim(`· ${e.label}'s seat${m.model ? ` · ${m.model}` : ''}${e.kind === 'answer' ? '' : ` · ${e.kind}`}`)}`;
123
+ if (e.kind === 'task_done')
124
+ return ` ${dim('⎿')} Done: ${text}`;
125
+ return `\n${who}\n${wrapText(markdownLite(text))}`;
126
+ }
127
+ if (e.kind === 'prompt')
128
+ return `\n${chalk_1.default.bold(`> ${e.label}`)} ${dim('to Claude')}\n${wrapText(text)}\n${dim(' ✻ Claude is working…')}`;
129
+ if (e.kind === 'answer')
130
+ return `\n${chalk_1.default.bold('⏺')} ${chalk_1.default.bold(e.label)}\n${wrapText(markdownLite(text))}`;
131
+ return `\n${chalk_1.default.bold.cyan(`> ${e.label}`)}${e.kind === 'note' ? '' : dim(` · ${e.kind}`)}\n${wrapText(text)}`;
132
+ }
133
+ async function guard(fn) {
134
+ try {
135
+ await fn();
136
+ }
137
+ catch (e) {
138
+ if (e instanceof room.ForkError)
139
+ console.error(chalk_1.default.red.bold(`FORK ALARM: ${e.message}. Evidence saved in the room folder (fork_evidence.json). Stop and compare head fingerprints with the other members.`));
140
+ else if (e instanceof client_1.RelayError)
141
+ console.error(chalk_1.default.red(`Relay refused: ${e.reason}${e.data && e.data.relay_sig ? ' (signed by the relay)' : ''}. ${e.message}`));
142
+ else if (e instanceof client_1.NetworkError)
143
+ console.error(chalk_1.default.yellow(e.message));
144
+ else
145
+ console.error(chalk_1.default.red(e.message));
146
+ process.exitCode = 1;
147
+ }
148
+ }
149
+ function registerKiosk(program, entry) {
150
+ program
151
+ .command('init')
152
+ .description('Create this Mac\'s Kiosk wallet (seedless, kept in the macOS Keychain) and set the relay')
153
+ .option('--relay <url>', 'relay base URL')
154
+ .option('--label <name>', 'your display name in rooms')
155
+ .option('--wallet-key-file <path>', 'import an existing wallet key from a file instead of creating one')
156
+ .action((o) => guard(async () => {
157
+ const cfg = room.init({ relay: o.relay, label: o.label, walletKeyFile: o.walletKeyFile });
158
+ ok(`wallet ${room.display(cfg.wallet)} (${cfg.keystore} key store), label ${cfg.label}, relay ${cfg.relay}`);
159
+ }));
160
+ program
161
+ .command('create')
162
+ .description('Create a Kiosk owned by this wallet')
163
+ .requiredOption('--title <title>', 'name of the conversation')
164
+ .option('--objective <text>', 'the common objective')
165
+ .option('--repo <path>', 'team repository on this Mac')
166
+ .action((o) => guard(async () => {
167
+ const r = await room.create({ title: o.title, objective: o.objective, repo: o.repo });
168
+ ok(`created ${r.id} (genesis receipt seq ${r.seq})`);
169
+ console.log(r.id);
170
+ }));
171
+ program
172
+ .command('invite <id>')
173
+ .description('Invite one person: an invitation link, or its QR code in an Apple Mail draft you review and send')
174
+ .option('--role <role>', 'participant or observer', 'participant')
175
+ .option('--export', 'grant EXPORT (plaintext export of the log)')
176
+ .option('--derive', 'grant DERIVE (mint derived artifacts)')
177
+ .option('--hours <n>', 'hours the invitation stays valid', '24')
178
+ .option('--grant-days <n>', 'days the membership lasts', '9')
179
+ .option('--task-authority', 'let this member assign tasks to the owner\'s seat (only for a member who could hold a seat)')
180
+ .option('--email <address>', 'open an Apple Mail draft to this address with the QR code; nothing is sent')
181
+ .option('--from <address>', 'sender account for the draft')
182
+ .option('--subject <text>', 'subject of the draft', 'Kiosk invitation')
183
+ .option('--show-qr', 'draw the QR code in this terminal')
184
+ .option('--qr-out <path>', 'save the QR code PNG here')
185
+ .option('--wait', 'stay until the invitee claims, then admit her with Touch ID')
186
+ .option('--json', 'print JSON')
187
+ .action((id, o) => guard(async () => {
188
+ const hours = Number(o.hours);
189
+ const r = await room.invite(id, { role: o.role === 'observer' ? 'observer' : 'participant', exportOp: !!o.export, derive: !!o.derive, hours, grantDays: Number(o.grantDays), taskAuthority: !!o.taskAuthority });
190
+ let qrFile = null;
191
+ if (o.email || o.qrOut) {
192
+ const tag = crypto.createHash('sha256').update(r.code).digest('hex').slice(0, 10);
193
+ qrFile = o.qrOut ? path.resolve(o.qrOut) : path.join((0, home_1.roomDir)(id), 'invites', tag, 'KioskInvitation.png');
194
+ fs.mkdirSync(path.dirname(qrFile), { recursive: true, mode: 0o700 });
195
+ (0, invitemail_1.qrPng)(r.url, qrFile);
196
+ }
197
+ if (o.email)
198
+ (0, invitemail_1.mailDraft)({ to: o.email, from: o.from, subject: o.subject, body: invitationBody(r.url, room.context().cfg.label), attachment: qrFile });
199
+ if (o.json) {
200
+ console.log(JSON.stringify({ ...r, qr_file: qrFile, draft: !!o.email }));
201
+ }
202
+ else {
203
+ ok(`invitation for one ${r.role}, valid until ${r.expires_at}`);
204
+ if (o.email)
205
+ ok(`Apple Mail draft to ${o.email} is open with the QR code. Review it and send it yourself.`);
206
+ console.log(`\nInvitation link:\n\n ${r.url}\n`);
207
+ if (o.showQr) {
208
+ const q = (0, invitemail_1.qrTerminal)(r.url);
209
+ if (q)
210
+ console.log(q);
211
+ }
212
+ console.log(dim(`The invitee runs kiosk join on her Mac, then opens the link (or: kiosk join ${r.token}).`));
213
+ }
214
+ if (o.wait) {
215
+ if (!o.json)
216
+ console.log(dim('Waiting for the claim; keep this terminal open.'));
217
+ const admitted = await room.approve(id, {
218
+ waitSec: Math.round(hours * 3600),
219
+ onClaims: (cs) => {
220
+ for (const c of cs) {
221
+ if (o.json)
222
+ console.log(JSON.stringify({ claim: c.claim_id, label: c.label, verification: c.verification }));
223
+ else
224
+ console.log(`Claim from ${chalk_1.default.bold(c.label || 'a new member')} ${room.display(c.wallet)}, verification code ${chalk_1.default.bold(c.verification)}. Check that her screen shows the same code, then confirm with Touch ID.`);
225
+ }
226
+ },
227
+ });
228
+ for (const a of admitted) {
229
+ if (o.json)
230
+ console.log(JSON.stringify({ admitted: a.wallet, seq: a.seq }));
231
+ else
232
+ ok(`admitted ${a.label} (${room.display(a.wallet)}) at seq ${a.seq}`);
233
+ }
234
+ if (!admitted.length && !o.json)
235
+ console.log(chalk_1.default.yellow('The invitation expired before anyone claimed it.'));
236
+ }
237
+ }));
238
+ program
239
+ .command('join [invitation]')
240
+ .description('Join a Kiosk. With no argument it waits for the invitation page: press Accept on this Mac, or type the pairing code it shows on another device. Also takes the invitation link, code or token.')
241
+ .option('--name <name>', 'your display name in the room')
242
+ .option('--label <name>', 'same as --name')
243
+ .option('--relay <url>', 'relay to use (default: this Mac\'s relay, else GenoBank.io production)')
244
+ .option('--guardian <wallet>', 'guardian wallet for a member under 18')
245
+ .option('--wait-sec <n>', 'seconds to wait for the owner to admit you', '1800')
246
+ .option('--pair-minutes <n>', 'minutes to wait for the invitation page', '30')
247
+ .option('--json', 'print JSON lines')
248
+ .action((invitation, o) => guard(async () => {
249
+ let label = o.name || o.label;
250
+ if (!label && !(0, home_1.loadConfig)() && process.stdin.isTTY && !o.json)
251
+ label = (await ask('Your name, as the others in the room will see it: ')) || undefined;
252
+ const r = await room.join(invitation, {
253
+ label, guardian: o.guardian, relay: o.relay, waitSec: Number(o.waitSec), pairTimeoutSec: Math.round(Number(o.pairMinutes) * 60),
254
+ onPairing: (p) => {
255
+ if (o.json) {
256
+ console.log(JSON.stringify({ waiting: true, pair_code: p.pairCode, expires_at: p.expiresAt, listening: p.listening }));
257
+ return;
258
+ }
259
+ console.log('\nOpen the invitation email and scan its QR code, or click its link.');
260
+ if (p.listening)
261
+ console.log('On this Mac, press Accept on the page and it returns here by itself.');
262
+ console.log(`On a phone or another computer, type this pairing code on the page: ${chalk_1.default.bold(p.pairCode)}`);
263
+ console.log(dim('Waiting. A new pairing code appears every 10 minutes.'));
264
+ },
265
+ onInvitation: (i) => {
266
+ if (o.json)
267
+ console.log(JSON.stringify({ invitation: true, owner_label: i.ownerLabel, owner: i.owner, role: i.role, via: i.via }));
268
+ else
269
+ console.log(`\nInvitation from ${chalk_1.default.bold(i.ownerLabel || 'the owner')}${i.owner ? ` (${room.display(i.owner)})` : ''} to join as a ${i.role}. Confirm with Touch ID to join and accept the contributor terms.`);
270
+ },
271
+ onWaiting: (m, v) => {
272
+ if (o.json) {
273
+ console.log(JSON.stringify({ claimed: true, verification: v }));
274
+ return;
275
+ }
276
+ console.log(dim(m));
277
+ console.log(`Your verification code is ${chalk_1.default.bold(v)}. The owner sees the same code before admitting you.`);
278
+ },
279
+ });
280
+ if (o.json) {
281
+ console.log(JSON.stringify(r));
282
+ return;
283
+ }
284
+ if (r.status === 'pending') {
285
+ console.log(chalk_1.default.yellow(`Still waiting for the owner. Later, run: kiosk sync ${r.id}`));
286
+ }
287
+ else {
288
+ ok(`Joined ${r.id} as ${r.role}.`);
289
+ console.log(`\nTalk in the room: kiosk chat ${r.id}`);
290
+ console.log(`Work in a project folder with a Claude Code seat: kiosk open ${r.id} --repo <folder>`);
291
+ }
292
+ }));
293
+ program
294
+ .command('approve <id>')
295
+ .description('Admit pending claims (Touch ID), signing each grant record with a fresh subject key')
296
+ .option('--claim <claim_id>', 'approve only this claim')
297
+ .option('--wait-sec <n>', 'seconds to wait for a claim to arrive', '0')
298
+ .action((id, o) => guard(async () => {
299
+ const r = await room.approve(id, { claimId: o.claim, waitSec: Number(o.waitSec) });
300
+ if (!r.length) {
301
+ console.log('no pending claims');
302
+ return;
303
+ }
304
+ for (const a of r)
305
+ ok(`admitted ${a.label} (${room.display(a.wallet)}) at seq ${a.seq}`);
306
+ }));
307
+ program
308
+ .command('claims <id>')
309
+ .description('List pending claims (owner)')
310
+ .action((id) => guard(async () => {
311
+ for (const c of await room.pendingClaims(id))
312
+ console.log(`${c.claim_id} ${c.label} ${room.display(c.wallet)} ${c.role} verification ${c.verification} device ${c.device_key}`);
313
+ }));
314
+ program
315
+ .command('post <id> <text...>')
316
+ .description('Post to the Kiosk from this device (or as this Mac\'s seat)')
317
+ .option('--kind <kind>', 'note, task, decision or task_done', 'note')
318
+ .option('--as <who>', 'device or seat', 'device')
319
+ .option('--refs <seqs>', 'comma-separated events this answers')
320
+ .option('--json', 'print JSON')
321
+ .action((id, words, o) => guard(async () => {
322
+ const kind = String(o.kind);
323
+ if (!['note', 'task', 'decision', 'task_done', 'prompt', 'answer'].includes(kind))
324
+ throw new Error('unknown kind');
325
+ const refs = o.refs ? String(o.refs).split(',').map((x) => Number(x.trim())).filter((x) => x > 0) : [];
326
+ const r = await room.post(id, { kind, evidence: o.as === 'seat' ? 'harness-attested' : 'key-signed', text: words.join(' '), refs, as: o.as === 'seat' ? 'seat' : 'device', meta: o.as === 'seat' ? { model: (0, home_1.requireRoom)(id).model || 'claude' } : undefined });
327
+ if (o.json) {
328
+ console.log(JSON.stringify(r));
329
+ return;
330
+ }
331
+ if (r.status === 'delivered')
332
+ ok(`posted #${r.seq}`);
333
+ else if (r.status === 'queued')
334
+ console.log(chalk_1.default.yellow('relay unreachable; queued, will deliver once'));
335
+ else
336
+ console.log(chalk_1.default.red(`not posted: ${r.status} (${(r.reasons || []).join(', ')})`));
337
+ }));
338
+ program
339
+ .command('decide <id> <text...>')
340
+ .description('Record a final decision, signed by your wallet with Touch ID')
341
+ .option('--refs <seqs>', 'comma-separated events this settles')
342
+ .action((id, words, o) => guard(async () => {
343
+ const { requirePresence } = await Promise.resolve().then(() => __importStar(require('./presence')));
344
+ await requirePresence(`record a final decision in ${id}`);
345
+ const refs = o.refs ? String(o.refs).split(',').map((x) => Number(x.trim())).filter((x) => x > 0) : [];
346
+ const r = await room.post(id, { kind: 'decision', evidence: 'presence-signed', text: words.join(' '), refs, meta: { status: 'final' }, as: 'wallet' });
347
+ if (r.status === 'delivered')
348
+ ok(`decision #${r.seq} (presence-signed)`);
349
+ else
350
+ console.log(chalk_1.default.red(`not posted: ${r.status} ${(r.reasons || []).join(', ')}`));
351
+ }));
352
+ program
353
+ .command('sync <id>')
354
+ .description('Fetch, verify and cache new events')
355
+ .option('--json', 'print JSON')
356
+ .action((id, o) => guard(async () => {
357
+ await room.flush(id);
358
+ const r = await room.sync(id);
359
+ if (o.json) {
360
+ console.log(JSON.stringify({ new_events: r.events.length, head: (0, home_1.requireRoom)(id).head }));
361
+ return;
362
+ }
363
+ for (const e of r.events)
364
+ console.log(line(e));
365
+ ok(`${r.events.length} new, verified; head ${(0, home_1.requireRoom)(id).head.receipt_hash.slice(0, 10)} at seq ${(0, home_1.requireRoom)(id).head.seq}`);
366
+ }));
367
+ program
368
+ .command('log <id>')
369
+ .description('Print the verified local log')
370
+ .option('--since <seq>', 'start after this seq', '0')
371
+ .option('--json', 'print JSON')
372
+ .action((id, o) => guard(async () => {
373
+ const rows = room.readLocal(id, Number(o.since));
374
+ if (o.json) {
375
+ console.log(JSON.stringify(rows));
376
+ return;
377
+ }
378
+ for (const e of rows)
379
+ console.log(line(e));
380
+ }));
381
+ program
382
+ .command('tail <id>')
383
+ .description('Stream the room live in this terminal')
384
+ .action((id) => guard(async () => {
385
+ const c = room.context();
386
+ const st = (0, home_1.requireRoom)(id);
387
+ await room.sync(id);
388
+ for (const e of room.readLocal(id, Math.max(0, st.cursor - 20)))
389
+ console.log(line(e));
390
+ const client = new client_1.RelayClient(st.relay, room.deviceSigner(c, id), 0);
391
+ for (;;) {
392
+ try {
393
+ const how = await client.stream(id, (0, home_1.requireRoom)(id).cursor, () => {
394
+ room.sync(id).then((r) => r.events.forEach((e) => console.log(line(e)))).catch((e) => console.error(chalk_1.default.red(e.message)));
395
+ });
396
+ if (how === 'revoked') {
397
+ console.log(chalk_1.default.red('access revoked'));
398
+ return;
399
+ }
400
+ }
401
+ catch (e) {
402
+ if (!(e instanceof client_1.NetworkError))
403
+ throw e;
404
+ console.error(chalk_1.default.yellow('relay unreachable, retrying in 5 s'));
405
+ }
406
+ await new Promise((r) => setTimeout(r, 5000));
407
+ }
408
+ }));
409
+ program
410
+ .command('chat <id>')
411
+ .description('The live room in this terminal, drawn like Claude Code: read everyone and write to the room; for a member with no Claude seat')
412
+ .action((id) => guard(async () => {
413
+ const c = room.context();
414
+ const st = (0, home_1.requireRoom)(id);
415
+ await room.sync(id);
416
+ const me = st.labels[st.my_wallet] || 'you';
417
+ const tty = !!process.stdout.isTTY;
418
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: chalk_1.default.bold('> ') });
419
+ // Print above the input line and redraw it, so an incoming message never scrambles what is being typed.
420
+ const out = (s) => {
421
+ if (tty) {
422
+ readline.cursorTo(process.stdout, 0);
423
+ readline.clearLine(process.stdout, 0);
424
+ }
425
+ process.stdout.write(s + '\n');
426
+ if (tty)
427
+ rl.prompt(true);
428
+ };
429
+ console.log(chalk_1.default.bold(`Kiosk ${st.title || id}`) + dim(` · live · you are ${me}`));
430
+ console.log(dim('Write and press Enter: everyone in the room reads it, and a Claude seat whose human made you a co-driver answers you. /quit leaves.'));
431
+ for (const e of room.readLocal(id, Math.max(0, st.cursor - 20))) {
432
+ const r = renderLive(e);
433
+ if (r !== null)
434
+ console.log(r);
435
+ }
436
+ let shown = (0, home_1.requireRoom)(id).cursor;
437
+ const client = new client_1.RelayClient(st.relay, room.deviceSigner(c, id), 0);
438
+ const ac = new AbortController();
439
+ let chain = Promise.resolve();
440
+ const pull = () => {
441
+ chain = chain.then(async () => {
442
+ await room.sync(id);
443
+ for (const e of room.readLocal(id, shown)) {
444
+ shown = Math.max(shown, e.seq);
445
+ if (e.author_key === st.device_key)
446
+ continue;
447
+ const r = renderLive(e);
448
+ if (r !== null)
449
+ out(r);
450
+ }
451
+ }).catch(() => { });
452
+ };
453
+ (async () => {
454
+ while (!ac.signal.aborted) {
455
+ try {
456
+ pull();
457
+ const how = await client.stream(id, (0, home_1.requireRoom)(id).cursor, pull, ac.signal);
458
+ if (how === 'revoked') {
459
+ out(chalk_1.default.red('Your access to this Kiosk was revoked.'));
460
+ rl.close();
461
+ return;
462
+ }
463
+ }
464
+ catch (e) {
465
+ if (ac.signal.aborted)
466
+ return;
467
+ if (e instanceof client_1.NetworkError)
468
+ out(chalk_1.default.yellow(' relay unreachable, retrying in 5 s'));
469
+ }
470
+ await new Promise((r) => setTimeout(r, 5000));
471
+ }
472
+ })().catch(() => { });
473
+ rl.prompt();
474
+ rl.on('line', async (text) => {
475
+ const t = text.trim();
476
+ if (t === '/quit') {
477
+ ac.abort();
478
+ rl.close();
479
+ return;
480
+ }
481
+ if (t) {
482
+ if (tty) {
483
+ const rows = Math.max(1, Math.ceil((2 + text.length) / (process.stdout.columns || 80)));
484
+ readline.moveCursor(process.stdout, 0, -rows);
485
+ readline.cursorTo(process.stdout, 0);
486
+ readline.clearScreenDown(process.stdout);
487
+ }
488
+ process.stdout.write(`\n${chalk_1.default.bold.cyan(`> ${me}`)}\n${wrapText(t)}\n`);
489
+ const r = await room.post(id, { kind: 'note', evidence: 'key-signed', text: t, as: 'device' });
490
+ if (r.status === 'blocked')
491
+ out(chalk_1.default.red(` not shared: ${(r.reasons || []).join(', ')}`));
492
+ else if (r.status === 'queued')
493
+ out(chalk_1.default.yellow(' queued; it goes out when the relay is back'));
494
+ else if (r.status === 'rejected')
495
+ out(chalk_1.default.red(` refused by the relay: ${(r.reasons || []).join(', ')}`));
496
+ }
497
+ rl.prompt();
498
+ });
499
+ await new Promise((r) => rl.on('close', r));
500
+ ac.abort();
501
+ }));
502
+ program
503
+ .command('codrive <id> [member]')
504
+ .description('Let a member talk to your Claude Code seat directly while it is open (this Mac only); with no member, list the co-drivers')
505
+ .option('--off', 'stop co-driving')
506
+ .action((id, member, o) => guard(async () => {
507
+ const st0 = (0, home_1.requireRoom)(id);
508
+ const name = (w) => st0.labels[w] || room.display(w).slice(0, 10);
509
+ if (!member) {
510
+ const list = (st0.codrivers || []).map(name);
511
+ console.log(list.length ? `Co-drivers of your seat: ${list.join(', ')}` : 'No co-drivers; members\' messages reach your seat as data for you to confirm.');
512
+ return;
513
+ }
514
+ const i = await room.info(id);
515
+ const active = [{ wallet: i.room.owner, guardian: null }, ...i.room.members.filter((m) => m.status === 1)];
516
+ const want = String(member).toLowerCase();
517
+ const hit = active.find((m) => m.wallet.toLowerCase() === want || (st0.labels[m.wallet] || '').toLowerCase() === want);
518
+ if (!hit)
519
+ throw new Error(`${member} is not an active member of this Kiosk. Members: ${active.map((m) => name(m.wallet)).join(', ')}.`);
520
+ if (hit.wallet.toLowerCase() === st0.my_wallet.toLowerCase())
521
+ throw new Error('You already drive your own seat.');
522
+ if (hit.guardian && hit.guardian.toLowerCase() !== st0.my_wallet.toLowerCase()) {
523
+ throw new Error(`${name(hit.wallet)} joined under a guardian; only her guardian's seat can make her a co-driver.`);
524
+ }
525
+ await (0, home_1.withRoomLock)(id, async () => {
526
+ const s = (0, home_1.requireRoom)(id);
527
+ const set = new Set(s.codrivers || []);
528
+ if (o.off)
529
+ set.delete(hit.wallet);
530
+ else
531
+ set.add(hit.wallet);
532
+ s.codrivers = [...set];
533
+ (0, home_1.saveRoom)(s);
534
+ });
535
+ const me = name(st0.my_wallet);
536
+ const note = o.off
537
+ ? `${me} ended co-driving for ${name(hit.wallet)}: ${me}'s Claude now reads ${name(hit.wallet)}'s messages as notes for ${me}.`
538
+ : `${me} made ${name(hit.wallet)} a co-driver of ${me}'s Claude Code seat: write here and Claude answers you directly while the seat is open.`;
539
+ const r = await room.post(id, { kind: 'note', evidence: 'key-signed', text: note, as: 'device' });
540
+ ok(o.off ? `${name(hit.wallet)} is no longer a co-driver.` : `${name(hit.wallet)} is a co-driver of your seat. Restart the seat (kiosk open) if it is running, so Claude learns it.`);
541
+ if (r.status !== 'delivered')
542
+ console.log(chalk_1.default.yellow(`The room was not told (${r.status}).`));
543
+ }));
544
+ program
545
+ .command('status <id>')
546
+ .description('Relay, head, epoch, role, outbox and gate engine')
547
+ .option('--json', 'print JSON')
548
+ .action((id, o) => guard(async () => {
549
+ const st = (0, home_1.requireRoom)(id);
550
+ let relay = null;
551
+ try {
552
+ relay = await room.info(id);
553
+ }
554
+ catch (e) {
555
+ relay = { error: e.message };
556
+ }
557
+ const queued = fs.readdirSync((0, home_1.outboxDir)(id)).filter((f) => f.endsWith('.json')).length;
558
+ const g = (0, gate_1.gate)('status probe');
559
+ const out = {
560
+ kiosk_id: id, relay: st.relay, role: st.role, wallet: room.display(st.my_wallet), device_key: st.device_key, seat_key: st.seat_key || null,
561
+ local_head: st.head, relay_head: relay?.room?.head || null, epoch: relay?.room?.epoch ?? st.epoch, outbox_queued: queued,
562
+ gate_engine: g.engine, profile: `${(0, home_1.kioskHome)()}/rooms/${id}/claude`, error: relay?.error || null,
563
+ };
564
+ if (o.json) {
565
+ console.log(JSON.stringify(out));
566
+ return;
567
+ }
568
+ for (const [k, v] of Object.entries(out))
569
+ console.log(`${k.padEnd(14)} ${typeof v === 'object' ? JSON.stringify(v) : v}`);
570
+ }));
571
+ program
572
+ .command('list')
573
+ .description('Kiosks this wallet owns or is a member of (from the relay), and those on this Mac')
574
+ .option('--json', 'print JSON')
575
+ .action((o) => guard(async () => {
576
+ const cfg = (0, home_1.loadConfig)();
577
+ const rows = [];
578
+ const relays = new Set((0, home_1.listRooms)().map((r) => (0, home_1.loadRoom)(r).relay));
579
+ if (cfg)
580
+ relays.add(cfg.relay);
581
+ if (cfg) {
582
+ const c = room.context();
583
+ for (const relay of relays) {
584
+ try {
585
+ const r = await new client_1.RelayClient(relay, room.walletSigner(c)).call('GET', 'list');
586
+ for (const x of r.kiosks)
587
+ rows.push({ ...x, relay, on_this_mac: !!(0, home_1.loadRoom)(x.kiosk_id) });
588
+ }
589
+ catch (e) {
590
+ rows.push({ relay, error: e.message });
591
+ }
592
+ }
593
+ }
594
+ if (o.json) {
595
+ console.log(JSON.stringify(rows));
596
+ return;
597
+ }
598
+ for (const r of rows)
599
+ console.log(r.error ? chalk_1.default.yellow(`${r.relay}: ${r.error}`) : `${r.kiosk_id} ${r.role}${r.active ? '' : ' (inactive)'} head ${r.head_seq}${r.on_this_mac ? '' : dim(' not on this Mac')}`);
600
+ }));
601
+ program
602
+ .command('members <id>')
603
+ .description('Members and their keys')
604
+ .action((id) => guard(async () => {
605
+ const i = await room.info(id);
606
+ const st = (0, home_1.requireRoom)(id);
607
+ const rows = [{ wallet: i.room.owner, role: 'owner', status: 1 }, ...i.room.members];
608
+ for (const m of rows) {
609
+ console.log(`${chalk_1.default.bold(st.labels[m.wallet] || room.display(m.wallet))} ${room.display(m.wallet)} ${m.role}${m.status === 1 ? '' : chalk_1.default.red(' inactive')}`);
610
+ for (const k of i.room.keys.filter((x) => x.wallet === m.wallet))
611
+ console.log(` ${k.role} ${k.key} ${k.label || ''}${k.model ? ` model ${k.model} (attested)` : ''}${k.revoked ? chalk_1.default.red(' revoked') : ''}`);
612
+ }
613
+ }));
614
+ program
615
+ .command('tasks <id>')
616
+ .description('Open tasks')
617
+ .action((id) => guard(async () => {
618
+ for (const t of room.openTasks(id))
619
+ console.log(`#${t.seq} ${t.label}: ${t.text}`);
620
+ }));
621
+ program
622
+ .command('lease <id> <path>')
623
+ .description('Claim, renew or release an advisory lease on a repository path')
624
+ .option('--release', 'release it')
625
+ .action((id, p, o) => guard(async () => {
626
+ const l = await room.lease(id, p, { release: !!o.release, as: 'device' });
627
+ console.log(o.release ? (l.released ? 'released' : 'no lease of yours') : l.granted ? `lease until ${l.expires_at}` : `held by ${l.holder_label} until ${l.expires_at}`);
628
+ }));
629
+ program
630
+ .command('revoke <id>')
631
+ .description('Revoke a member (owner) or a device of yours; the owner rotates the room key')
632
+ .option('--member <wallet>', 'member wallet (owner only)')
633
+ .option('--device <key>', 'device key (your own, or any as owner)')
634
+ .action((id, o) => guard(async () => {
635
+ if (!o.member && !o.device)
636
+ throw new Error('give --member or --device');
637
+ const r = await room.revoke(id, { member: o.member, device: o.device });
638
+ ok(`revoked${r.epoch ? `; room key rotated to epoch ${r.epoch}` : ''}`);
639
+ }));
640
+ program
641
+ .command('rotate <id>')
642
+ .description('Rotate the room key (owner)')
643
+ .action((id) => guard(async () => { ok(`epoch ${await room.rotate(id)}`); }));
644
+ program
645
+ .command('leave <id>')
646
+ .description('Leave a Kiosk and wipe its keys and cache from this Mac')
647
+ .action((id) => guard(async () => { await room.leave(id); ok(`left ${id}; local keys and cache wiped`); }));
648
+ program
649
+ .command('delete <id>')
650
+ .description('Delete a Kiosk for every member (owner): ciphertext, wraps and keys')
651
+ .action((id) => guard(async () => { await room.deleteRoom(id); ok(`deleted ${id}`); }));
652
+ program
653
+ .command('erase <id> <seq>')
654
+ .description('Erase one of your own events (or, as guardian, one of hers)')
655
+ .action((id, seq) => guard(async () => { ok(`erased #${seq} (erase event #${await room.erase(id, Number(seq))})`); }));
656
+ program
657
+ .command('device-request <id>')
658
+ .description('Request enrollment of this Mac account as a device of a wallet; the account holding the wallet approves it')
659
+ .option('--relay <url>', 'relay base URL (default: this account\'s relay)')
660
+ .option('--label <name>', 'device label')
661
+ .option('--wallet <address>', 'enroll under this wallet held by another Mac account (a separate macOS user for your seats); the wallet key never comes here')
662
+ .option('--seat', 'also request a Claude Code seat key for this account')
663
+ .option('--model <name>', 'model label for the seat', 'claude')
664
+ .option('--out <file>', 'also write the request to this new file, for example in /Users/Shared when the approving account is another user on this Mac')
665
+ .action((id, o) => guard(async () => {
666
+ const relay = o.relay || room.context().cfg.relay;
667
+ const r = await room.deviceRequest(id, relay, { label: o.label, wallet: o.wallet, seat: !!o.seat, model: o.model, out: o.out });
668
+ console.error(`Verification code ${r.verification}. The account that approves must show the same code before Touch ID.`);
669
+ if (o.out)
670
+ console.error(`Request written to ${o.out}. On the account that holds the wallet run: kiosk device-approve ${id} ${o.out}`);
671
+ console.log(r.token);
672
+ }));
673
+ program
674
+ .command('device-approve <id> <request>')
675
+ .description('On the account that holds the wallet: approve a device request (the token, or the file that holds it), and its seat if it asks for one (Touch ID)')
676
+ .action((id, req) => guard(async () => {
677
+ let token = String(req);
678
+ if (!token.trim().startsWith('KSKD-') && fs.existsSync(token)) {
679
+ if (fs.statSync(token).size > 65536)
680
+ throw new Error(`${token} is too large to be a device request`);
681
+ token = fs.readFileSync(token, 'utf8');
682
+ }
683
+ const r = await room.deviceApprove(id, token, (code) => console.error(`Verification code ${code}. Approve only if the account that made the request shows the same code; otherwise cancel.`));
684
+ ok(`enrolled device ${r.device}${r.seat ? ` and seat ${r.seat}` : ''}, verification ${r.verification}`);
685
+ }));
686
+ program
687
+ .command('credits <id>')
688
+ .description('Contribution report per author, with the evidence level of every count')
689
+ .option('--repo <path>', 'also count commits carrying the Kiosk-Event trailer')
690
+ .action((id, o) => guard(async () => { console.log(JSON.stringify(room.credits(id, o.repo), null, 2)); }));
691
+ program
692
+ .command('export <id>')
693
+ .description('Write the decrypted log to a file; refuses unless your grant includes EXPORT')
694
+ .requiredOption('--out <file>', 'output file')
695
+ .action((id, o) => guard(async () => { ok(`exported ${await room.exportRoom(id, o.out)} events to ${o.out}`); }));
696
+ program
697
+ .command('verify <id>')
698
+ .description('Re-verify the whole log from genesis against a fresh copy from the relay')
699
+ .option('--json', 'print JSON')
700
+ .action((id, o) => guard(async () => {
701
+ const r = await room.verify(id);
702
+ if (o.json) {
703
+ console.log(JSON.stringify(r));
704
+ return;
705
+ }
706
+ if (r.ok)
707
+ ok(`VALID: ${r.count} events, every receipt, signature and body checked; head ${r.head.slice(0, 10)}`);
708
+ else {
709
+ console.log(chalk_1.default.red(`INVALID: ${r.problems.length} problem(s)`));
710
+ r.problems.forEach((p) => console.log(chalk_1.default.red(` ${p}`)));
711
+ process.exitCode = 2;
712
+ }
713
+ }));
714
+ program
715
+ .command('gate <text...>')
716
+ .description('Show what the egress gate would do with a text')
717
+ .action((words) => guard(async () => { console.log(JSON.stringify((0, gate_1.gate)(words.join(' '), (0, home_1.macDenylist)()))); }));
718
+ program
719
+ .command('repo-setup <id>')
720
+ .description('Prepare the team repository: your own branch, and CODEOWNERS for the files a teammate could use to instruct your seat')
721
+ .requiredOption('--repo <path>', 'team repository on this Mac')
722
+ .requiredOption('--handle <name>', 'short name for your branch (hack/<name>)')
723
+ .option('--reviewer <github_user>', 'GitHub user who must review CLAUDE.md, .claude/, .mcp.json and hooks')
724
+ .action((id, o) => guard(async () => {
725
+ const { spawnSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
726
+ const path = await Promise.resolve().then(() => __importStar(require('path')));
727
+ (0, home_1.requireRoom)(id);
728
+ const git = (...a) => spawnSync('git', ['-C', o.repo, ...a], { encoding: 'utf8' });
729
+ if (git('rev-parse', '--is-inside-work-tree').stdout.trim() !== 'true')
730
+ throw new Error(`${o.repo} is not a git repository`);
731
+ const branch = `hack/${String(o.handle).replace(/[^A-Za-z0-9._-]/g, '')}`;
732
+ const exists = git('rev-parse', '--verify', '--quiet', branch).status === 0;
733
+ const r = exists ? git('checkout', branch) : git('checkout', '-b', branch);
734
+ if (r.status !== 0)
735
+ throw new Error(r.stderr.trim());
736
+ ok(`working on ${branch}; commit only here, and merge into main through review`);
737
+ const lines = ['CLAUDE.md', '**/CLAUDE.md', '.claude/', '.mcp.json', '.githooks/', 'package.json', '**/package.json'].map((p) => `${p} @${o.reviewer || '<reviewer>'}`);
738
+ const co = path.join(o.repo, '.github', 'CODEOWNERS');
739
+ if (!fs.existsSync(co) && o.reviewer) {
740
+ fs.mkdirSync(path.dirname(co), { recursive: true });
741
+ fs.writeFileSync(co, ['# A change to these files reaches every seat as instructions or code, so it needs review.', ...lines, ''].join('\n'));
742
+ ok(`wrote ${co}; commit it on ${branch} and merge it first`);
743
+ }
744
+ else {
745
+ console.log(`Add these lines to .github/CODEOWNERS (the file is ${fs.existsSync(co) ? 'already there; edit it yourself' : 'not written without --reviewer'}):`);
746
+ lines.forEach((l) => console.log(` ${l}`));
747
+ }
748
+ console.log('Then protect main on GitHub (Settings, Branches): require a pull request with review from code owners, and block force pushes.');
749
+ }));
750
+ program
751
+ .command('open <id>')
752
+ .description('Start a Claude Code seat in the clean-room profile of this Kiosk')
753
+ .option('--repo <path>', 'team repository (default: the current directory)')
754
+ .option('--allow-domain <host...>', 'extra hosts the seat\'s shell may reach')
755
+ .option('--private <path...>', 'extra private trees the seat may not read')
756
+ .option('--model <name>', 'model name recorded as attested on seat events', 'claude')
757
+ .option('--print', 'write the profile and print the launch command, but do not launch')
758
+ .option('--no-channel', 'start the seat without the live room (remote messages arrive only with your next prompt)')
759
+ .action((id, o) => guard(async () => {
760
+ if (o.channel !== false && !o.print) {
761
+ console.log(chalk_1.default.bold('The room is live in this seat.') + ' Claude Code will show a warning about a development channel: choose "I am using this for local development".');
762
+ }
763
+ const r = await (0, profile_1.openSeat)(id, { repo: o.repo || process.cwd(), allowDomains: o.allowDomain, privateTrees: o.private, model: o.model, launch: !o.print, entry, channel: o.channel !== false });
764
+ if (o.print) {
765
+ console.log(JSON.stringify({ profile: r.dir, settings: r.settingsPath, mcp: r.mcpPath, claude_md: r.claudeMd, repo: r.repo }, null, 2));
766
+ console.log(`\ncd ${r.repo} && ${o.channel !== false ? 'KIOSK_CHANNEL=1 ' : ''}CLAUDE_CONFIG_DIR=${r.dir} claude --setting-sources user --strict-mcp-config --mcp-config ${r.mcpPath}${o.channel !== false ? ' ' + profile_1.CHANNEL_ARGS.join(' ') : ''}`);
767
+ }
768
+ }));
769
+ program
770
+ .command('hook <name>')
771
+ .description('Claude Code hook entry (used by the room profile)')
772
+ .requiredOption('--room <id>', 'Kiosk id')
773
+ .action(async (name, o) => { process.exitCode = await (0, hooks_1.runHook)(name, o.room); });
774
+ program
775
+ .command('mcp')
776
+ .description('Kiosk MCP server on stdio (used by the room profile)')
777
+ .requiredOption('--room <id>', 'Kiosk id')
778
+ .action((o) => { (0, mcp_1.serveMcp)(o.room); });
779
+ void home_1.withRoomLock;
780
+ void home_1.saveRoom;
781
+ void ethers_1.ethers;
782
+ return program;
783
+ }
784
+ //# sourceMappingURL=cli.js.map