@vess-id/vess 0.0.0-dev-20260902121045

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 (321) hide show
  1. package/LICENSE +64 -0
  2. package/README.md +215 -0
  3. package/bin/vess.js +2 -0
  4. package/dist/__mocks__/@napi-rs/keyring.d.ts +9 -0
  5. package/dist/__mocks__/@napi-rs/keyring.d.ts.map +1 -0
  6. package/dist/__mocks__/@napi-rs/keyring.js +33 -0
  7. package/dist/__mocks__/@napi-rs/keyring.js.map +1 -0
  8. package/dist/__mocks__/node-mac-auth.d.ts +8 -0
  9. package/dist/__mocks__/node-mac-auth.d.ts.map +1 -0
  10. package/dist/__mocks__/node-mac-auth.js +29 -0
  11. package/dist/__mocks__/node-mac-auth.js.map +1 -0
  12. package/dist/adapter/mcp/http-transport.d.ts +40 -0
  13. package/dist/adapter/mcp/http-transport.d.ts.map +1 -0
  14. package/dist/adapter/mcp/http-transport.js +228 -0
  15. package/dist/adapter/mcp/http-transport.js.map +1 -0
  16. package/dist/adapter/mcp/mcp-adapter.d.ts +43 -0
  17. package/dist/adapter/mcp/mcp-adapter.d.ts.map +1 -0
  18. package/dist/adapter/mcp/mcp-adapter.js +65 -0
  19. package/dist/adapter/mcp/mcp-adapter.js.map +1 -0
  20. package/dist/adapter/mcp/mcp-server.factory.d.ts +44 -0
  21. package/dist/adapter/mcp/mcp-server.factory.d.ts.map +1 -0
  22. package/dist/adapter/mcp/mcp-server.factory.js +311 -0
  23. package/dist/adapter/mcp/mcp-server.factory.js.map +1 -0
  24. package/dist/adapter/mcp/stdio-transport.d.ts +7 -0
  25. package/dist/adapter/mcp/stdio-transport.d.ts.map +1 -0
  26. package/dist/adapter/mcp/stdio-transport.js +13 -0
  27. package/dist/adapter/mcp/stdio-transport.js.map +1 -0
  28. package/dist/adapter/mcp/transport.d.ts +10 -0
  29. package/dist/adapter/mcp/transport.d.ts.map +1 -0
  30. package/dist/adapter/mcp/transport.js +14 -0
  31. package/dist/adapter/mcp/transport.js.map +1 -0
  32. package/dist/approval/approval-token.d.ts +23 -0
  33. package/dist/approval/approval-token.d.ts.map +1 -0
  34. package/dist/approval/approval-token.js +81 -0
  35. package/dist/approval/approval-token.js.map +1 -0
  36. package/dist/audit/audit-dto-mapper.d.ts +29 -0
  37. package/dist/audit/audit-dto-mapper.d.ts.map +1 -0
  38. package/dist/audit/audit-dto-mapper.js +61 -0
  39. package/dist/audit/audit-dto-mapper.js.map +1 -0
  40. package/dist/audit/audit-logger.d.ts +35 -0
  41. package/dist/audit/audit-logger.d.ts.map +1 -0
  42. package/dist/audit/audit-logger.js +67 -0
  43. package/dist/audit/audit-logger.js.map +1 -0
  44. package/dist/audit/audit-sync.d.ts +12 -0
  45. package/dist/audit/audit-sync.d.ts.map +1 -0
  46. package/dist/audit/audit-sync.js +65 -0
  47. package/dist/audit/audit-sync.js.map +1 -0
  48. package/dist/auth/user-authenticator.d.ts +51 -0
  49. package/dist/auth/user-authenticator.d.ts.map +1 -0
  50. package/dist/auth/user-authenticator.js +155 -0
  51. package/dist/auth/user-authenticator.js.map +1 -0
  52. package/dist/bootstrap/sdk-precheck.d.ts +9 -0
  53. package/dist/bootstrap/sdk-precheck.d.ts.map +1 -0
  54. package/dist/bootstrap/sdk-precheck.js +103 -0
  55. package/dist/bootstrap/sdk-precheck.js.map +1 -0
  56. package/dist/cli/claude-config-path.d.ts +17 -0
  57. package/dist/cli/claude-config-path.d.ts.map +1 -0
  58. package/dist/cli/claude-config-path.js +59 -0
  59. package/dist/cli/claude-config-path.js.map +1 -0
  60. package/dist/cli/cli-db.d.ts +12 -0
  61. package/dist/cli/cli-db.d.ts.map +1 -0
  62. package/dist/cli/cli-db.js +20 -0
  63. package/dist/cli/cli-db.js.map +1 -0
  64. package/dist/cli/cli-utils.d.ts +14 -0
  65. package/dist/cli/cli-utils.d.ts.map +1 -0
  66. package/dist/cli/cli-utils.js +57 -0
  67. package/dist/cli/cli-utils.js.map +1 -0
  68. package/dist/cli/daemon-utils.d.ts +30 -0
  69. package/dist/cli/daemon-utils.d.ts.map +1 -0
  70. package/dist/cli/daemon-utils.js +131 -0
  71. package/dist/cli/daemon-utils.js.map +1 -0
  72. package/dist/cli/daemon.d.ts +13 -0
  73. package/dist/cli/daemon.d.ts.map +1 -0
  74. package/dist/cli/daemon.js +207 -0
  75. package/dist/cli/daemon.js.map +1 -0
  76. package/dist/cli/doctor.d.ts +6 -0
  77. package/dist/cli/doctor.d.ts.map +1 -0
  78. package/dist/cli/doctor.js +136 -0
  79. package/dist/cli/doctor.js.map +1 -0
  80. package/dist/cli/env-delete.d.ts +6 -0
  81. package/dist/cli/env-delete.d.ts.map +1 -0
  82. package/dist/cli/env-delete.js +80 -0
  83. package/dist/cli/env-delete.js.map +1 -0
  84. package/dist/cli/env-list.d.ts +5 -0
  85. package/dist/cli/env-list.d.ts.map +1 -0
  86. package/dist/cli/env-list.js +42 -0
  87. package/dist/cli/env-list.js.map +1 -0
  88. package/dist/cli/env-post-integration.d.ts +21 -0
  89. package/dist/cli/env-post-integration.d.ts.map +1 -0
  90. package/dist/cli/env-post-integration.js +300 -0
  91. package/dist/cli/env-post-integration.js.map +1 -0
  92. package/dist/cli/env-restore.d.ts +15 -0
  93. package/dist/cli/env-restore.d.ts.map +1 -0
  94. package/dist/cli/env-restore.js +130 -0
  95. package/dist/cli/env-restore.js.map +1 -0
  96. package/dist/cli/env.d.ts +14 -0
  97. package/dist/cli/env.d.ts.map +1 -0
  98. package/dist/cli/env.js +182 -0
  99. package/dist/cli/env.js.map +1 -0
  100. package/dist/cli/error-handlers.d.ts +13 -0
  101. package/dist/cli/error-handlers.d.ts.map +1 -0
  102. package/dist/cli/error-handlers.js +32 -0
  103. package/dist/cli/error-handlers.js.map +1 -0
  104. package/dist/cli/hook-check-env.d.ts +12 -0
  105. package/dist/cli/hook-check-env.d.ts.map +1 -0
  106. package/dist/cli/hook-check-env.js +117 -0
  107. package/dist/cli/hook-check-env.js.map +1 -0
  108. package/dist/cli/hook-session-project.d.ts +10 -0
  109. package/dist/cli/hook-session-project.d.ts.map +1 -0
  110. package/dist/cli/hook-session-project.js +206 -0
  111. package/dist/cli/hook-session-project.js.map +1 -0
  112. package/dist/cli/index.d.ts +2 -0
  113. package/dist/cli/index.d.ts.map +1 -0
  114. package/dist/cli/index.js +361 -0
  115. package/dist/cli/index.js.map +1 -0
  116. package/dist/cli/init-guard.d.ts +13 -0
  117. package/dist/cli/init-guard.d.ts.map +1 -0
  118. package/dist/cli/init-guard.js +62 -0
  119. package/dist/cli/init-guard.js.map +1 -0
  120. package/dist/cli/init.d.ts +19 -0
  121. package/dist/cli/init.d.ts.map +1 -0
  122. package/dist/cli/init.js +440 -0
  123. package/dist/cli/init.js.map +1 -0
  124. package/dist/cli/install.d.ts +14 -0
  125. package/dist/cli/install.d.ts.map +1 -0
  126. package/dist/cli/install.js +183 -0
  127. package/dist/cli/install.js.map +1 -0
  128. package/dist/cli/login.d.ts +6 -0
  129. package/dist/cli/login.d.ts.map +1 -0
  130. package/dist/cli/login.js +76 -0
  131. package/dist/cli/login.js.map +1 -0
  132. package/dist/cli/logs.d.ts +32 -0
  133. package/dist/cli/logs.d.ts.map +1 -0
  134. package/dist/cli/logs.js +147 -0
  135. package/dist/cli/logs.js.map +1 -0
  136. package/dist/cli/otel-headers.d.ts +12 -0
  137. package/dist/cli/otel-headers.d.ts.map +1 -0
  138. package/dist/cli/otel-headers.js +38 -0
  139. package/dist/cli/otel-headers.js.map +1 -0
  140. package/dist/cli/project.d.ts +8 -0
  141. package/dist/cli/project.d.ts.map +1 -0
  142. package/dist/cli/project.js +102 -0
  143. package/dist/cli/project.js.map +1 -0
  144. package/dist/cli/reset.d.ts +8 -0
  145. package/dist/cli/reset.d.ts.map +1 -0
  146. package/dist/cli/reset.js +137 -0
  147. package/dist/cli/reset.js.map +1 -0
  148. package/dist/cli/run.d.ts +22 -0
  149. package/dist/cli/run.d.ts.map +1 -0
  150. package/dist/cli/run.js +103 -0
  151. package/dist/cli/run.js.map +1 -0
  152. package/dist/cli/start.d.ts +2 -0
  153. package/dist/cli/start.d.ts.map +1 -0
  154. package/dist/cli/start.js +29 -0
  155. package/dist/cli/start.js.map +1 -0
  156. package/dist/cli/status.d.ts +12 -0
  157. package/dist/cli/status.d.ts.map +1 -0
  158. package/dist/cli/status.js +131 -0
  159. package/dist/cli/status.js.map +1 -0
  160. package/dist/cli/telemetry-setup.d.ts +27 -0
  161. package/dist/cli/telemetry-setup.d.ts.map +1 -0
  162. package/dist/cli/telemetry-setup.js +157 -0
  163. package/dist/cli/telemetry-setup.js.map +1 -0
  164. package/dist/cli/uninstall.d.ts +8 -0
  165. package/dist/cli/uninstall.d.ts.map +1 -0
  166. package/dist/cli/uninstall.js +110 -0
  167. package/dist/cli/uninstall.js.map +1 -0
  168. package/dist/cli/version.d.ts +2 -0
  169. package/dist/cli/version.d.ts.map +1 -0
  170. package/dist/cli/version.js +10 -0
  171. package/dist/cli/version.js.map +1 -0
  172. package/dist/config/config.d.ts +10 -0
  173. package/dist/config/config.d.ts.map +1 -0
  174. package/dist/config/config.js +64 -0
  175. package/dist/config/config.js.map +1 -0
  176. package/dist/config/constants.d.ts +11 -0
  177. package/dist/config/constants.d.ts.map +1 -0
  178. package/dist/config/constants.js +14 -0
  179. package/dist/config/constants.js.map +1 -0
  180. package/dist/config/paths.d.ts +9 -0
  181. package/dist/config/paths.d.ts.map +1 -0
  182. package/dist/config/paths.js +58 -0
  183. package/dist/config/paths.js.map +1 -0
  184. package/dist/config/version.d.ts +3 -0
  185. package/dist/config/version.d.ts.map +1 -0
  186. package/dist/config/version.js +80 -0
  187. package/dist/config/version.js.map +1 -0
  188. package/dist/core/execution-engine.d.ts +289 -0
  189. package/dist/core/execution-engine.d.ts.map +1 -0
  190. package/dist/core/execution-engine.js +1931 -0
  191. package/dist/core/execution-engine.js.map +1 -0
  192. package/dist/core/runtime.d.ts +43 -0
  193. package/dist/core/runtime.d.ts.map +1 -0
  194. package/dist/core/runtime.js +147 -0
  195. package/dist/core/runtime.js.map +1 -0
  196. package/dist/core/sync-scheduler.d.ts +42 -0
  197. package/dist/core/sync-scheduler.d.ts.map +1 -0
  198. package/dist/core/sync-scheduler.js +131 -0
  199. package/dist/core/sync-scheduler.js.map +1 -0
  200. package/dist/core/types.d.ts +106 -0
  201. package/dist/core/types.d.ts.map +1 -0
  202. package/dist/core/types.js +7 -0
  203. package/dist/core/types.js.map +1 -0
  204. package/dist/daemon/service-manager.d.ts +68 -0
  205. package/dist/daemon/service-manager.d.ts.map +1 -0
  206. package/dist/daemon/service-manager.js +303 -0
  207. package/dist/daemon/service-manager.js.map +1 -0
  208. package/dist/env/env-classifier.d.ts +14 -0
  209. package/dist/env/env-classifier.d.ts.map +1 -0
  210. package/dist/env/env-classifier.js +94 -0
  211. package/dist/env/env-classifier.js.map +1 -0
  212. package/dist/env/env-parser.d.ts +13 -0
  213. package/dist/env/env-parser.d.ts.map +1 -0
  214. package/dist/env/env-parser.js +33 -0
  215. package/dist/env/env-parser.js.map +1 -0
  216. package/dist/env/env-profile-store.d.ts +15 -0
  217. package/dist/env/env-profile-store.d.ts.map +1 -0
  218. package/dist/env/env-profile-store.js +35 -0
  219. package/dist/env/env-profile-store.js.map +1 -0
  220. package/dist/env/env-reference.d.ts +10 -0
  221. package/dist/env/env-reference.d.ts.map +1 -0
  222. package/dist/env/env-reference.js +33 -0
  223. package/dist/env/env-reference.js.map +1 -0
  224. package/dist/env/env-resolver.d.ts +18 -0
  225. package/dist/env/env-resolver.d.ts.map +1 -0
  226. package/dist/env/env-resolver.js +48 -0
  227. package/dist/env/env-resolver.js.map +1 -0
  228. package/dist/env/fs-utils.d.ts +9 -0
  229. package/dist/env/fs-utils.d.ts.map +1 -0
  230. package/dist/env/fs-utils.js +59 -0
  231. package/dist/env/fs-utils.js.map +1 -0
  232. package/dist/env/secret-backend.d.ts +15 -0
  233. package/dist/env/secret-backend.d.ts.map +1 -0
  234. package/dist/env/secret-backend.js +24 -0
  235. package/dist/env/secret-backend.js.map +1 -0
  236. package/dist/executor/executor-registry.d.ts +22 -0
  237. package/dist/executor/executor-registry.d.ts.map +1 -0
  238. package/dist/executor/executor-registry.js +42 -0
  239. package/dist/executor/executor-registry.js.map +1 -0
  240. package/dist/executor/process-launcher.d.ts +26 -0
  241. package/dist/executor/process-launcher.d.ts.map +1 -0
  242. package/dist/executor/process-launcher.js +98 -0
  243. package/dist/executor/process-launcher.js.map +1 -0
  244. package/dist/executor/secret-file.d.ts +28 -0
  245. package/dist/executor/secret-file.d.ts.map +1 -0
  246. package/dist/executor/secret-file.js +127 -0
  247. package/dist/executor/secret-file.js.map +1 -0
  248. package/dist/gateway/auth.d.ts +26 -0
  249. package/dist/gateway/auth.d.ts.map +1 -0
  250. package/dist/gateway/auth.js +66 -0
  251. package/dist/gateway/auth.js.map +1 -0
  252. package/dist/gateway/gateway-client.d.ts +363 -0
  253. package/dist/gateway/gateway-client.d.ts.map +1 -0
  254. package/dist/gateway/gateway-client.js +611 -0
  255. package/dist/gateway/gateway-client.js.map +1 -0
  256. package/dist/identity/agent-identity.d.ts +29 -0
  257. package/dist/identity/agent-identity.d.ts.map +1 -0
  258. package/dist/identity/agent-identity.js +54 -0
  259. package/dist/identity/agent-identity.js.map +1 -0
  260. package/dist/identity/did-manager.d.ts +17 -0
  261. package/dist/identity/did-manager.d.ts.map +1 -0
  262. package/dist/identity/did-manager.js +29 -0
  263. package/dist/identity/did-manager.js.map +1 -0
  264. package/dist/identity/key-manager.d.ts +21 -0
  265. package/dist/identity/key-manager.d.ts.map +1 -0
  266. package/dist/identity/key-manager.js +126 -0
  267. package/dist/identity/key-manager.js.map +1 -0
  268. package/dist/identity/session-key.d.ts +13 -0
  269. package/dist/identity/session-key.d.ts.map +1 -0
  270. package/dist/identity/session-key.js +17 -0
  271. package/dist/identity/session-key.js.map +1 -0
  272. package/dist/policy/policy-evaluator.d.ts +63 -0
  273. package/dist/policy/policy-evaluator.d.ts.map +1 -0
  274. package/dist/policy/policy-evaluator.js +266 -0
  275. package/dist/policy/policy-evaluator.js.map +1 -0
  276. package/dist/policy/policy-loader.d.ts +10 -0
  277. package/dist/policy/policy-loader.d.ts.map +1 -0
  278. package/dist/policy/policy-loader.js +71 -0
  279. package/dist/policy/policy-loader.js.map +1 -0
  280. package/dist/policy/types.d.ts +21 -0
  281. package/dist/policy/types.d.ts.map +1 -0
  282. package/dist/policy/types.js +3 -0
  283. package/dist/policy/types.js.map +1 -0
  284. package/dist/telemetry/claude-settings.d.ts +67 -0
  285. package/dist/telemetry/claude-settings.d.ts.map +1 -0
  286. package/dist/telemetry/claude-settings.js +191 -0
  287. package/dist/telemetry/claude-settings.js.map +1 -0
  288. package/dist/telemetry/otel-headers.d.ts +27 -0
  289. package/dist/telemetry/otel-headers.d.ts.map +1 -0
  290. package/dist/telemetry/otel-headers.js +33 -0
  291. package/dist/telemetry/otel-headers.js.map +1 -0
  292. package/dist/telemetry/project-key.d.ts +12 -0
  293. package/dist/telemetry/project-key.d.ts.map +1 -0
  294. package/dist/telemetry/project-key.js +113 -0
  295. package/dist/telemetry/project-key.js.map +1 -0
  296. package/dist/utils/credential-errors.d.ts +73 -0
  297. package/dist/utils/credential-errors.d.ts.map +1 -0
  298. package/dist/utils/credential-errors.js +90 -0
  299. package/dist/utils/credential-errors.js.map +1 -0
  300. package/dist/utils/resource-canonicalizer.d.ts +19 -0
  301. package/dist/utils/resource-canonicalizer.d.ts.map +1 -0
  302. package/dist/utils/resource-canonicalizer.js +100 -0
  303. package/dist/utils/resource-canonicalizer.js.map +1 -0
  304. package/dist/utils/vc-utils.d.ts +23 -0
  305. package/dist/utils/vc-utils.d.ts.map +1 -0
  306. package/dist/utils/vc-utils.js +53 -0
  307. package/dist/utils/vc-utils.js.map +1 -0
  308. package/dist/wallet/sqlite.d.ts +4 -0
  309. package/dist/wallet/sqlite.d.ts.map +1 -0
  310. package/dist/wallet/sqlite.js +158 -0
  311. package/dist/wallet/sqlite.js.map +1 -0
  312. package/dist/wallet/vp-builder.d.ts +26 -0
  313. package/dist/wallet/vp-builder.d.ts.map +1 -0
  314. package/dist/wallet/vp-builder.js +55 -0
  315. package/dist/wallet/vp-builder.js.map +1 -0
  316. package/dist/wallet/wallet.d.ts +64 -0
  317. package/dist/wallet/wallet.d.ts.map +1 -0
  318. package/dist/wallet/wallet.js +179 -0
  319. package/dist/wallet/wallet.js.map +1 -0
  320. package/package.json +71 -0
  321. package/required-sdk-symbols.json +15 -0
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.NoopAuthenticator = exports.MacOSAuthenticator = exports.AuthenticationUnavailableError = exports.AuthenticationDeniedError = void 0;
37
+ exports._setExecFileSync = _setExecFileSync;
38
+ exports.createAuthenticator = createAuthenticator;
39
+ const child_process_1 = require("child_process");
40
+ // Indirection for testability — tests can swap this via _setExecFileSync
41
+ let execFileSyncFn = child_process_1.execFileSync;
42
+ /** @internal Test-only: override execFileSync for mocking */
43
+ function _setExecFileSync(fn) {
44
+ execFileSyncFn = fn;
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // Error types
48
+ // ---------------------------------------------------------------------------
49
+ class AuthenticationDeniedError extends Error {
50
+ constructor(message = 'Authentication denied by user') {
51
+ super(message);
52
+ this.name = 'AuthenticationDeniedError';
53
+ }
54
+ }
55
+ exports.AuthenticationDeniedError = AuthenticationDeniedError;
56
+ class AuthenticationUnavailableError extends Error {
57
+ constructor(message = 'User authentication is not available on this platform') {
58
+ super(message);
59
+ this.name = 'AuthenticationUnavailableError';
60
+ }
61
+ }
62
+ exports.AuthenticationUnavailableError = AuthenticationUnavailableError;
63
+ // ---------------------------------------------------------------------------
64
+ // MacOSAuthenticator
65
+ // ---------------------------------------------------------------------------
66
+ /**
67
+ * macOS authenticator with Touch ID → system password fallback.
68
+ *
69
+ * 1. If Touch ID hardware is available, uses node-mac-auth (biometric prompt)
70
+ * 2. If not (Mac mini, old MacBook, lid closed), falls back to osascript
71
+ * confirmation dialog (no admin privileges required)
72
+ *
73
+ * Security note (Phase 1): Both Touch ID and password dialog serve as UX
74
+ * gates — they prevent accidental secret exposure by requiring physical
75
+ * user presence. The authentication and Keychain read are separate
76
+ * operations. Phase 2 will merge these into a single native call using
77
+ * Security.framework's kSecAccessControlUserPresence for OS-level protection.
78
+ */
79
+ class MacOSAuthenticator {
80
+ async isAvailable() {
81
+ return true; // macOS always has at least password-based auth
82
+ }
83
+ async authenticate(reason) {
84
+ // Try Touch ID first
85
+ if (await this.tryTouchId(reason))
86
+ return;
87
+ // Fall back to confirmation dialog via osascript
88
+ this.promptSystemPassword(reason);
89
+ }
90
+ async tryTouchId(reason) {
91
+ try {
92
+ const mod = await Promise.resolve().then(() => __importStar(require('node-mac-auth')));
93
+ if (!mod.canPromptTouchID())
94
+ return false;
95
+ await mod.promptTouchID({ reason });
96
+ return true;
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }
102
+ promptSystemPassword(reason) {
103
+ // osascript presents a native macOS confirmation dialog that cannot be
104
+ // bypassed by a non-interactive process. The dialog blocks until the user
105
+ // clicks OK or Cancel. No admin privileges are required — this is purely
106
+ // a UX gate to confirm user presence.
107
+ // Using execFileSync with arguments array to prevent shell injection.
108
+ const script = `display dialog ${JSON.stringify(reason)} ` +
109
+ `buttons {"Cancel", "OK"} default button "OK" ` +
110
+ `with title "VESS Authentication" ` +
111
+ `with icon caution`;
112
+ try {
113
+ execFileSyncFn('osascript', ['-e', script], {
114
+ stdio: ['ignore', 'pipe', 'pipe'],
115
+ timeout: 120_000, // 2 minute timeout for user response
116
+ });
117
+ }
118
+ catch {
119
+ throw new AuthenticationDeniedError('System password authentication denied or cancelled');
120
+ }
121
+ }
122
+ }
123
+ exports.MacOSAuthenticator = MacOSAuthenticator;
124
+ // ---------------------------------------------------------------------------
125
+ // NoopAuthenticator
126
+ // ---------------------------------------------------------------------------
127
+ /**
128
+ * Fallback authenticator for platforms without supported authentication.
129
+ * Always reports unavailable and throws on authenticate().
130
+ */
131
+ class NoopAuthenticator {
132
+ async isAvailable() {
133
+ return false;
134
+ }
135
+ async authenticate(_reason) {
136
+ throw new AuthenticationUnavailableError();
137
+ }
138
+ }
139
+ exports.NoopAuthenticator = NoopAuthenticator;
140
+ // ---------------------------------------------------------------------------
141
+ // Factory
142
+ // ---------------------------------------------------------------------------
143
+ /**
144
+ * Create a platform-appropriate authenticator.
145
+ * - macOS: Touch ID with system password fallback
146
+ * - Others: NoopAuthenticator (restore not available)
147
+ * @param platform - Override for testing (defaults to process.platform)
148
+ */
149
+ function createAuthenticator(platform = process.platform) {
150
+ if (platform === 'darwin') {
151
+ return new MacOSAuthenticator();
152
+ }
153
+ return new NoopAuthenticator();
154
+ }
155
+ //# sourceMappingURL=user-authenticator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-authenticator.js","sourceRoot":"","sources":["../../src/auth/user-authenticator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4CAEC;AA4HD,kDAKC;AAzID,iDAA6D;AAE7D,yEAAyE;AACzE,IAAI,cAAc,GAAyB,4BAAa,CAAA;AAExD,6DAA6D;AAC7D,SAAgB,gBAAgB,CAAC,EAAwB;IACvD,cAAc,GAAG,EAAE,CAAA;AACrB,CAAC;AAcD,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAa,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAO,GAAG,+BAA+B;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AALD,8DAKC;AAED,MAAa,8BAA+B,SAAQ,KAAK;IACvD,YAAY,OAAO,GAAG,uDAAuD;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAA;IAC9C,CAAC;CACF;AALD,wEAKC;AAED,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;;;;;;;GAYG;AACH,MAAa,kBAAkB;IAC7B,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAA,CAAC,gDAAgD;IAC9D,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,qBAAqB;QACrB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAM;QAEzC,iDAAiD;QACjD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,MAAc;QACrC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,wDAAa,eAAe,GAA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;IACjC,CAAC;IACD,OAAO,IAAI,iBAAiB,EAAE,CAAA;AAChC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runtime guard: verifies that the installed @vess-id/ai-identity exports every
3
+ * symbol agentd depends on at runtime. If any are missing (e.g. the published
4
+ * agentd was pinned to a stale SDK that lacked these exports), abort startup
5
+ * with an actionable error message instead of failing later with a cryptic
6
+ * `(0, ai_identity_1.foo) is not a function`.
7
+ */
8
+ export declare function runSdkPrecheck(): void;
9
+ //# sourceMappingURL=sdk-precheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-precheck.d.ts","sourceRoot":"","sources":["../../src/bootstrap/sdk-precheck.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8CrC"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.runSdkPrecheck = runSdkPrecheck;
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
39
+ const sdk = __importStar(require("@vess-id/ai-identity"));
40
+ /**
41
+ * Runtime guard: verifies that the installed @vess-id/ai-identity exports every
42
+ * symbol agentd depends on at runtime. If any are missing (e.g. the published
43
+ * agentd was pinned to a stale SDK that lacked these exports), abort startup
44
+ * with an actionable error message instead of failing later with a cryptic
45
+ * `(0, ai_identity_1.foo) is not a function`.
46
+ */
47
+ function runSdkPrecheck() {
48
+ const symbolsPath = path.join(__dirname, '..', '..', 'required-sdk-symbols.json');
49
+ let required;
50
+ try {
51
+ required = JSON.parse(fs.readFileSync(symbolsPath, 'utf8'));
52
+ }
53
+ catch (err) {
54
+ // Reachable only when the published tarball is missing the JSON or it
55
+ // is malformed — both indicate a packaging defect, not a user error.
56
+ process.stderr.write([
57
+ 'vess: failed to load required-sdk-symbols.json (packaging defect).',
58
+ ` path: ${symbolsPath}`,
59
+ ` reason: ${err.message}`,
60
+ '',
61
+ 'Please re-install @vess-id/vess. If the error persists,',
62
+ 'file an issue at https://github.com/cvoxelprotocol/aidentity/issues.',
63
+ '',
64
+ ].join('\n'));
65
+ process.exit(1);
66
+ return;
67
+ }
68
+ const mod = sdk;
69
+ const missing = required.filter((name) => !(name in mod) || typeof mod[name] === 'undefined');
70
+ if (missing.length === 0)
71
+ return;
72
+ const sdkVersion = readVersion('@vess-id/ai-identity/package.json');
73
+ const cliVersion = readVersion(path.join(__dirname, '..', '..', 'package.json'));
74
+ const lines = [
75
+ 'vess: incompatible @vess-id/ai-identity installation.',
76
+ '',
77
+ `The installed @vess-id/ai-identity@${sdkVersion} is missing required exports:`,
78
+ ...missing.map((n) => ` - ${n}`),
79
+ '',
80
+ 'This means @vess-id/vess was published with a stale SDK pin. Please update:',
81
+ ' npm install -g @vess-id/vess@latest',
82
+ '',
83
+ 'If this persists, file an issue at https://github.com/cvoxelprotocol/aidentity/issues',
84
+ 'referencing your installed versions:',
85
+ ` - vess CLI: ${cliVersion}`,
86
+ ` - @vess-id/ai-identity: ${sdkVersion}`,
87
+ '',
88
+ ];
89
+ process.stderr.write(lines.join('\n'));
90
+ process.exit(1);
91
+ }
92
+ function readVersion(specifierOrPath) {
93
+ try {
94
+ // require() handles both package specifiers (resolved via node_modules)
95
+ // and absolute filesystem paths (e.g. agentd's own package.json).
96
+ const pkg = require(specifierOrPath);
97
+ return pkg.version ?? 'unknown';
98
+ }
99
+ catch {
100
+ return 'unknown';
101
+ }
102
+ }
103
+ //# sourceMappingURL=sdk-precheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-precheck.js","sourceRoot":"","sources":["../../src/bootstrap/sdk-precheck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,wCA8CC;AAzDD,4CAA6B;AAC7B,gDAAiC;AACjC,0DAA2C;AAE3C;;;;;;GAMG;AACH,SAAgB,cAAc;IAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAA;IACjF,IAAI,QAAkB,CAAA;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;IAC7D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,sEAAsE;QACtE,qEAAqE;QACrE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB;YACE,oEAAoE;YACpE,WAAW,WAAW,EAAE;YACxB,aAAc,GAAa,CAAC,OAAO,EAAE;YACrC,EAAE;YACF,yDAA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AI,SAAS,CAAA;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Resolve the path to Claude Code's `.claude.json` configuration file.
3
+ *
4
+ * Claude Code reads its config from `$CLAUDE_CONFIG_DIR/.claude.json` when the
5
+ * `CLAUDE_CONFIG_DIR` environment variable is set (used for multi-profile setups
6
+ * such as switching between personal and work accounts). When the variable is
7
+ * unset or empty, Claude Code falls back to `~/.claude.json`.
8
+ *
9
+ * Hardcoding `os.homedir()` here previously caused `vess mcp register` (and the
10
+ * companion uninstall/doctor commands) to silently target the wrong file when
11
+ * the user had `CLAUDE_CONFIG_DIR` exported. The MCP entry was written but
12
+ * Claude Code never read it back. (AIDENTITY-33)
13
+ *
14
+ * @returns Absolute path to the `.claude.json` file Claude Code is configured to use.
15
+ */
16
+ export declare function getClaudeConfigPath(): string;
17
+ //# sourceMappingURL=claude-config-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-config-path.d.ts","sourceRoot":"","sources":["../../src/cli/claude-config-path.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getClaudeConfigPath = getClaudeConfigPath;
37
+ const os = __importStar(require("os"));
38
+ const path = __importStar(require("path"));
39
+ /**
40
+ * Resolve the path to Claude Code's `.claude.json` configuration file.
41
+ *
42
+ * Claude Code reads its config from `$CLAUDE_CONFIG_DIR/.claude.json` when the
43
+ * `CLAUDE_CONFIG_DIR` environment variable is set (used for multi-profile setups
44
+ * such as switching between personal and work accounts). When the variable is
45
+ * unset or empty, Claude Code falls back to `~/.claude.json`.
46
+ *
47
+ * Hardcoding `os.homedir()` here previously caused `vess mcp register` (and the
48
+ * companion uninstall/doctor commands) to silently target the wrong file when
49
+ * the user had `CLAUDE_CONFIG_DIR` exported. The MCP entry was written but
50
+ * Claude Code never read it back. (AIDENTITY-33)
51
+ *
52
+ * @returns Absolute path to the `.claude.json` file Claude Code is configured to use.
53
+ */
54
+ function getClaudeConfigPath() {
55
+ const configDir = process.env.CLAUDE_CONFIG_DIR?.trim();
56
+ const baseDir = configDir && configDir.length > 0 ? configDir : os.homedir();
57
+ return path.join(baseDir, '.claude.json');
58
+ }
59
+ //# sourceMappingURL=claude-config-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-config-path.js","sourceRoot":"","sources":["../../src/cli/claude-config-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,kDAIC;AAtBD,uCAAwB;AACxB,2CAA4B;AAE5B;;;;;;;;;;;;;;GAcG;AACH,SAAgB,mBAAmB;IACjC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAA;IACvD,MAAM,OAAO,GAAG,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAA;IAC5E,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { EnvProfileStore } from '../env/env-profile-store';
2
+ import type Database from 'better-sqlite3';
3
+ export interface ProfileStoreContext {
4
+ db: Database.Database;
5
+ profileStore: EnvProfileStore;
6
+ }
7
+ /**
8
+ * Open the profile store database with standard initialization.
9
+ * Returns null if VESS is not initialized (ensureInitialized fails).
10
+ */
11
+ export declare function openProfileStore(command: string): ProfileStoreContext | null;
12
+ //# sourceMappingURL=cli-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-db.d.ts","sourceRoot":"","sources":["../../src/cli/cli-db.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAE1C,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAA;IACrB,YAAY,EAAE,eAAe,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAM5E"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openProfileStore = openProfileStore;
4
+ const paths_1 = require("../config/paths");
5
+ const sqlite_1 = require("../wallet/sqlite");
6
+ const env_profile_store_1 = require("../env/env-profile-store");
7
+ const init_guard_1 = require("./init-guard");
8
+ /**
9
+ * Open the profile store database with standard initialization.
10
+ * Returns null if VESS is not initialized (ensureInitialized fails).
11
+ */
12
+ function openProfileStore(command) {
13
+ const paths = new paths_1.VessPaths();
14
+ if (!(0, init_guard_1.ensureInitialized)(paths, command))
15
+ return null;
16
+ const db = (0, sqlite_1.openDatabase)(paths.walletDb);
17
+ (0, sqlite_1.initSchema)(db);
18
+ return { db, profileStore: new env_profile_store_1.EnvProfileStore(db) };
19
+ }
20
+ //# sourceMappingURL=cli-db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-db.js","sourceRoot":"","sources":["../../src/cli/cli-db.ts"],"names":[],"mappings":";;AAeA,4CAMC;AArBD,2CAA2C;AAC3C,6CAA2D;AAC3D,gEAA0D;AAC1D,6CAAgD;AAQhD;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,KAAK,GAAG,IAAI,iBAAS,EAAE,CAAA;IAC7B,IAAI,CAAC,IAAA,8BAAiB,EAAC,KAAK,EAAE,OAAO,CAAC;QAAE,OAAO,IAAI,CAAA;IACnD,MAAM,EAAE,GAAG,IAAA,qBAAY,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACvC,IAAA,mBAAU,EAAC,EAAE,CAAC,CAAA;IACd,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,mCAAe,CAAC,EAAE,CAAC,EAAE,CAAA;AACtD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as readline from 'node:readline/promises';
2
+ /** Log to stderr (used by all CLI commands) */
3
+ export declare function log(msg: string): void;
4
+ /** Open a URL in the default browser (fire-and-forget). Only http(s) URLs are allowed. */
5
+ export declare function openBrowser(url: string): void;
6
+ /**
7
+ * If running in a TTY, listen for a single Enter keypress and open the
8
+ * given URL in the default browser. Returns a cleanup function that
9
+ * removes the listener, or `undefined` when not in a TTY.
10
+ */
11
+ export declare function promptEnterToOpenBrowser(url: string): (() => void) | undefined;
12
+ /** Prompt yes/no with default yes. Returns false on 'n', EOF, or error. */
13
+ export declare function promptYesNo(rl: readline.Interface, question: string): Promise<boolean>;
14
+ //# sourceMappingURL=cli-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-utils.d.ts","sourceRoot":"","sources":["../../src/cli/cli-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAGlD,+CAA+C;AAC/C,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAErC;AAED,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ7C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAoB9E;AAED,2EAA2E;AAC3E,wBAAsB,WAAW,CAC/B,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAOlB"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = log;
4
+ exports.openBrowser = openBrowser;
5
+ exports.promptEnterToOpenBrowser = promptEnterToOpenBrowser;
6
+ exports.promptYesNo = promptYesNo;
7
+ const node_child_process_1 = require("node:child_process");
8
+ /** Log to stderr (used by all CLI commands) */
9
+ function log(msg) {
10
+ process.stderr.write(`${msg}\n`);
11
+ }
12
+ /** Open a URL in the default browser (fire-and-forget). Only http(s) URLs are allowed. */
13
+ function openBrowser(url) {
14
+ if (!/^https?:\/\//i.test(url))
15
+ return;
16
+ if (process.platform === 'win32') {
17
+ (0, node_child_process_1.execFile)('cmd', ['/c', 'start', '', url], () => { });
18
+ }
19
+ else {
20
+ const cmd = process.platform === 'darwin' ? 'open' : 'xdg-open';
21
+ (0, node_child_process_1.execFile)(cmd, [url], () => { });
22
+ }
23
+ }
24
+ /**
25
+ * If running in a TTY, listen for a single Enter keypress and open the
26
+ * given URL in the default browser. Returns a cleanup function that
27
+ * removes the listener, or `undefined` when not in a TTY.
28
+ */
29
+ function promptEnterToOpenBrowser(url) {
30
+ if (!process.stdin.isTTY)
31
+ return undefined;
32
+ log('Press Enter to open in browser (or copy the URL above)');
33
+ const wasPaused = process.stdin.isPaused();
34
+ process.stdin.resume();
35
+ const onData = () => {
36
+ openBrowser(url);
37
+ cleanup();
38
+ };
39
+ const cleanup = () => {
40
+ process.stdin.removeListener('data', onData);
41
+ if (wasPaused)
42
+ process.stdin.pause();
43
+ };
44
+ process.stdin.once('data', onData);
45
+ return cleanup;
46
+ }
47
+ /** Prompt yes/no with default yes. Returns false on 'n', EOF, or error. */
48
+ async function promptYesNo(rl, question) {
49
+ try {
50
+ const answer = await rl.question(`${question} (Y/n): `);
51
+ return answer.trim().toLowerCase() !== 'n';
52
+ }
53
+ catch {
54
+ return false; // EOF or error — treat as decline
55
+ }
56
+ }
57
+ //# sourceMappingURL=cli-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-utils.js","sourceRoot":"","sources":["../../src/cli/cli-utils.ts"],"names":[],"mappings":";;AAIA,kBAEC;AAGD,kCAQC;AAOD,4DAoBC;AAGD,kCAUC;AAxDD,2DAA6C;AAE7C,+CAA+C;AAC/C,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,0FAA0F;AAC1F,SAAgB,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAM;IACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAA,6BAAQ,EAAC,KAAK,EAA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,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG,CAAA;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA,CAAC,kCAAkC;IACjD,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Write PID to file. Creates parent directories if needed.
3
+ */
4
+ export declare function writePidFile(filePath: string, pid: number): void;
5
+ /**
6
+ * Read PID from file. Returns null if file doesn't exist or contains invalid data.
7
+ */
8
+ export declare function readPidFile(filePath: string): number | null;
9
+ /**
10
+ * Write port number to file. Creates parent directories if needed.
11
+ */
12
+ export declare function writePortFile(filePath: string, port: number): void;
13
+ /**
14
+ * Read port from file. Returns null if file doesn't exist or contains invalid data.
15
+ */
16
+ export declare function readPortFile(filePath: string): number | null;
17
+ /**
18
+ * Remove PID file. No-op if file doesn't exist.
19
+ */
20
+ export declare function removePidFile(filePath: string): void;
21
+ /**
22
+ * Remove port file. No-op if file doesn't exist.
23
+ */
24
+ export declare function removePortFile(filePath: string): void;
25
+ /**
26
+ * Check if a process with the given PID is running.
27
+ * Uses kill(pid, 0) which checks existence without sending a signal.
28
+ */
29
+ export declare function isDaemonRunning(pid: number): boolean;
30
+ //# sourceMappingURL=daemon-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon-utils.d.ts","sourceRoot":"","sources":["../../src/cli/daemon-utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAMhE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMlE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQpD"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.writePidFile = writePidFile;
37
+ exports.readPidFile = readPidFile;
38
+ exports.writePortFile = writePortFile;
39
+ exports.readPortFile = readPortFile;
40
+ exports.removePidFile = removePidFile;
41
+ exports.removePortFile = removePortFile;
42
+ exports.isDaemonRunning = isDaemonRunning;
43
+ /**
44
+ * Daemon utility functions for PID/port file management.
45
+ */
46
+ const fs = __importStar(require("node:fs"));
47
+ const path = __importStar(require("node:path"));
48
+ /**
49
+ * Write PID to file. Creates parent directories if needed.
50
+ */
51
+ function writePidFile(filePath, pid) {
52
+ const dir = path.dirname(filePath);
53
+ if (!fs.existsSync(dir)) {
54
+ fs.mkdirSync(dir, { recursive: true });
55
+ }
56
+ fs.writeFileSync(filePath, String(pid), { encoding: 'utf-8', mode: 0o600 });
57
+ }
58
+ /**
59
+ * Read PID from file. Returns null if file doesn't exist or contains invalid data.
60
+ */
61
+ function readPidFile(filePath) {
62
+ try {
63
+ const content = fs.readFileSync(filePath, 'utf-8').trim();
64
+ const pid = parseInt(content, 10);
65
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /**
72
+ * Write port number to file. Creates parent directories if needed.
73
+ */
74
+ function writePortFile(filePath, port) {
75
+ const dir = path.dirname(filePath);
76
+ if (!fs.existsSync(dir)) {
77
+ fs.mkdirSync(dir, { recursive: true });
78
+ }
79
+ fs.writeFileSync(filePath, String(port), { encoding: 'utf-8', mode: 0o600 });
80
+ }
81
+ /**
82
+ * Read port from file. Returns null if file doesn't exist or contains invalid data.
83
+ */
84
+ function readPortFile(filePath) {
85
+ try {
86
+ const content = fs.readFileSync(filePath, 'utf-8').trim();
87
+ const port = parseInt(content, 10);
88
+ return Number.isFinite(port) && port > 0 ? port : null;
89
+ }
90
+ catch {
91
+ return null;
92
+ }
93
+ }
94
+ /**
95
+ * Remove PID file. No-op if file doesn't exist.
96
+ */
97
+ function removePidFile(filePath) {
98
+ try {
99
+ fs.unlinkSync(filePath);
100
+ }
101
+ catch {
102
+ // Ignore errors (file may not exist)
103
+ }
104
+ }
105
+ /**
106
+ * Remove port file. No-op if file doesn't exist.
107
+ */
108
+ function removePortFile(filePath) {
109
+ try {
110
+ fs.unlinkSync(filePath);
111
+ }
112
+ catch {
113
+ // Ignore errors (file may not exist)
114
+ }
115
+ }
116
+ /**
117
+ * Check if a process with the given PID is running.
118
+ * Uses kill(pid, 0) which checks existence without sending a signal.
119
+ */
120
+ function isDaemonRunning(pid) {
121
+ if (pid <= 0)
122
+ return false;
123
+ try {
124
+ process.kill(pid, 0);
125
+ return true;
126
+ }
127
+ catch {
128
+ return false;
129
+ }
130
+ }
131
+ //# sourceMappingURL=daemon-utils.js.map