agentvault 1.0.1 → 1.0.2

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 (292) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/dist/cli/commands/approve.js +5 -5
  3. package/dist/cli/commands/archive.js +5 -5
  4. package/dist/cli/commands/backup.js +5 -5
  5. package/dist/cli/commands/cloud-backup.js +12 -12
  6. package/dist/cli/commands/decrypt.js +2 -2
  7. package/dist/cli/commands/deploy.js +1 -1
  8. package/dist/cli/commands/exec.js +2 -2
  9. package/dist/cli/commands/fetch.js +4 -4
  10. package/dist/cli/commands/inference.js +5 -5
  11. package/dist/cli/commands/init.d.ts +1 -1
  12. package/dist/cli/commands/init.js +16 -16
  13. package/dist/cli/commands/list.js +4 -4
  14. package/dist/cli/commands/package.js +2 -2
  15. package/dist/cli/commands/profile.js +1 -1
  16. package/dist/cli/commands/rebuild.js +2 -2
  17. package/dist/cli/commands/show.js +1 -1
  18. package/dist/cli/commands/status.d.ts +1 -1
  19. package/dist/cli/commands/status.js +8 -8
  20. package/dist/cli/commands/trace.js +1 -1
  21. package/dist/cli/commands/wallet-export.js +1 -1
  22. package/dist/cli/commands/wallet-sign.js +1 -1
  23. package/dist/cli/commands/wallet.d.ts +1 -1
  24. package/dist/cli/commands/wallet.js +1 -1
  25. package/dist/cli/index.d.ts +2 -2
  26. package/dist/cli/index.js +3 -3
  27. package/dist/src/archival/archive-manager.d.ts +85 -0
  28. package/dist/src/archival/archive-manager.js +294 -0
  29. package/dist/src/archival/arweave-client.d.ts +88 -0
  30. package/dist/src/archival/arweave-client.js +223 -0
  31. package/dist/src/archival/index.d.ts +8 -0
  32. package/{src/archival/index.ts → dist/src/archival/index.js} +1 -1
  33. package/dist/src/backup/backup.d.ts +67 -0
  34. package/dist/src/backup/backup.js +231 -0
  35. package/dist/src/backup/index.d.ts +7 -0
  36. package/{src/backup/index.ts → dist/src/backup/index.js} +1 -1
  37. package/dist/src/cloud-storage/cloud-sync.d.ts +49 -0
  38. package/dist/src/cloud-storage/cloud-sync.js +372 -0
  39. package/dist/src/cloud-storage/index.d.ts +11 -0
  40. package/{src/cloud-storage/index.ts → dist/src/cloud-storage/index.js} +1 -1
  41. package/dist/src/cloud-storage/provider-detector.d.ts +34 -0
  42. package/dist/src/cloud-storage/provider-detector.js +158 -0
  43. package/{src/cloud-storage/types.ts → dist/src/cloud-storage/types.d.ts} +40 -53
  44. package/dist/src/cloud-storage/types.js +10 -0
  45. package/dist/src/debugging/index.d.ts +6 -0
  46. package/{src/debugging/index.ts → dist/src/debugging/index.js} +1 -1
  47. package/dist/src/debugging/logs.d.ts +32 -0
  48. package/dist/src/debugging/logs.js +158 -0
  49. package/dist/src/debugging/types.d.ts +91 -0
  50. package/dist/src/debugging/types.js +5 -0
  51. package/dist/src/deployment/deployer.d.ts +52 -0
  52. package/dist/src/deployment/deployer.js +211 -0
  53. package/dist/src/deployment/icpClient.d.ts +144 -0
  54. package/dist/src/deployment/icpClient.js +545 -0
  55. package/dist/src/deployment/index.d.ts +11 -0
  56. package/dist/src/deployment/index.js +14 -0
  57. package/dist/src/deployment/promotion.d.ts +32 -0
  58. package/dist/src/deployment/promotion.js +114 -0
  59. package/dist/src/deployment/types.d.ts +101 -0
  60. package/dist/src/deployment/types.js +5 -0
  61. package/dist/src/icp/batch.d.ts +112 -0
  62. package/dist/src/icp/batch.js +273 -0
  63. package/dist/src/icp/cycles.d.ts +29 -0
  64. package/{src/icp/cycles.ts → dist/src/icp/cycles.js} +8 -22
  65. package/dist/src/icp/environment.d.ts +60 -0
  66. package/dist/src/icp/environment.js +183 -0
  67. package/dist/src/icp/icpcli.d.ts +204 -0
  68. package/dist/src/icp/icpcli.js +374 -0
  69. package/dist/src/icp/icwasm.d.ts +94 -0
  70. package/dist/src/icp/icwasm.js +197 -0
  71. package/dist/src/icp/identity.d.ts +50 -0
  72. package/{src/icp/identity.ts → dist/src/icp/identity.js} +15 -28
  73. package/dist/src/icp/index.d.ts +16 -0
  74. package/dist/src/icp/index.js +20 -0
  75. package/dist/src/icp/optimization.d.ts +16 -0
  76. package/dist/src/icp/optimization.js +225 -0
  77. package/dist/src/icp/tokens.d.ts +24 -0
  78. package/{src/icp/tokens.ts → dist/src/icp/tokens.js} +5 -12
  79. package/dist/src/icp/tool-detector.d.ts +31 -0
  80. package/dist/src/icp/tool-detector.js +104 -0
  81. package/dist/src/icp/types.d.ts +493 -0
  82. package/dist/src/icp/types.js +7 -0
  83. package/dist/src/index.d.ts +12 -0
  84. package/dist/src/index.js +18 -0
  85. package/dist/src/inference/bittensor-client.d.ts +108 -0
  86. package/dist/src/inference/bittensor-client.js +224 -0
  87. package/dist/src/inference/index.d.ts +8 -0
  88. package/{src/inference/index.ts → dist/src/inference/index.js} +1 -1
  89. package/dist/src/inference/inference-manager.d.ts +76 -0
  90. package/dist/src/inference/inference-manager.js +228 -0
  91. package/dist/src/metrics/index.d.ts +7 -0
  92. package/{src/metrics/index.ts → dist/src/metrics/index.js} +1 -1
  93. package/dist/src/metrics/metrics.d.ts +39 -0
  94. package/dist/src/metrics/metrics.js +129 -0
  95. package/dist/src/monitoring/alerting.d.ts +51 -0
  96. package/dist/src/monitoring/alerting.js +169 -0
  97. package/dist/src/monitoring/health.d.ts +40 -0
  98. package/dist/src/monitoring/health.js +164 -0
  99. package/dist/src/monitoring/index.d.ts +10 -0
  100. package/dist/src/monitoring/index.js +12 -0
  101. package/dist/src/monitoring/info.d.ts +15 -0
  102. package/dist/src/monitoring/info.js +109 -0
  103. package/dist/src/monitoring/types.d.ts +93 -0
  104. package/dist/src/monitoring/types.js +7 -0
  105. package/dist/src/network/index.d.ts +5 -0
  106. package/{src/network/index.ts → dist/src/network/index.js} +1 -1
  107. package/dist/src/network/network-config.d.ts +31 -0
  108. package/dist/src/network/network-config.js +109 -0
  109. package/dist/src/packaging/compiler.d.ts +61 -0
  110. package/dist/src/packaging/compiler.js +562 -0
  111. package/dist/src/packaging/config-persistence.d.ts +46 -0
  112. package/dist/src/packaging/config-persistence.js +108 -0
  113. package/dist/src/packaging/config-schemas.d.ts +115 -0
  114. package/dist/src/packaging/config-schemas.js +43 -0
  115. package/dist/src/packaging/detector.d.ts +26 -0
  116. package/dist/src/packaging/detector.js +193 -0
  117. package/dist/src/packaging/index.d.ts +16 -0
  118. package/dist/src/packaging/index.js +22 -0
  119. package/dist/src/packaging/packager.d.ts +31 -0
  120. package/dist/src/packaging/packager.js +90 -0
  121. package/dist/src/packaging/parsers/clawdbot.d.ts +19 -0
  122. package/dist/src/packaging/parsers/clawdbot.js +231 -0
  123. package/dist/src/packaging/parsers/cline.d.ts +26 -0
  124. package/dist/src/packaging/parsers/cline.js +185 -0
  125. package/dist/src/packaging/parsers/generic.d.ts +27 -0
  126. package/dist/src/packaging/parsers/generic.js +228 -0
  127. package/dist/src/packaging/parsers/goose.d.ts +26 -0
  128. package/dist/src/packaging/parsers/goose.js +175 -0
  129. package/dist/src/packaging/parsers/index.d.ts +11 -0
  130. package/{src/packaging/parsers/index.ts → dist/src/packaging/parsers/index.js} +1 -1
  131. package/dist/src/packaging/serializer.d.ts +108 -0
  132. package/dist/src/packaging/serializer.js +153 -0
  133. package/dist/src/packaging/types.d.ts +131 -0
  134. package/dist/src/packaging/types.js +5 -0
  135. package/dist/src/packaging/wasmedge-compiler.d.ts +76 -0
  136. package/dist/src/packaging/wasmedge-compiler.js +349 -0
  137. package/dist/src/security/index.d.ts +11 -0
  138. package/{src/security/index.ts → dist/src/security/index.js} +1 -4
  139. package/dist/src/security/multisig.d.ts +102 -0
  140. package/dist/src/security/multisig.js +283 -0
  141. package/dist/src/security/types.d.ts +207 -0
  142. package/dist/src/security/types.js +217 -0
  143. package/dist/src/security/vetkeys.d.ts +179 -0
  144. package/dist/src/security/vetkeys.js +499 -0
  145. package/dist/src/testing/index.d.ts +6 -0
  146. package/{src/testing/index.ts → dist/src/testing/index.js} +1 -1
  147. package/dist/src/testing/local-runner.d.ts +23 -0
  148. package/dist/src/testing/local-runner.js +226 -0
  149. package/dist/src/testing/types.d.ts +98 -0
  150. package/dist/src/testing/types.js +5 -0
  151. package/dist/src/wallet/cbor-serializer.d.ts +82 -0
  152. package/dist/src/wallet/cbor-serializer.js +282 -0
  153. package/dist/src/wallet/chain-dispatcher.d.ts +112 -0
  154. package/dist/src/wallet/chain-dispatcher.js +241 -0
  155. package/dist/src/wallet/cross-chain-aggregator.d.ts +119 -0
  156. package/dist/src/wallet/cross-chain-aggregator.js +235 -0
  157. package/dist/src/wallet/index.d.ts +16 -0
  158. package/dist/src/wallet/index.js +22 -0
  159. package/dist/src/wallet/key-derivation.d.ts +117 -0
  160. package/dist/src/wallet/key-derivation.js +325 -0
  161. package/dist/src/wallet/providers/base-provider.d.ts +111 -0
  162. package/dist/src/wallet/providers/base-provider.js +58 -0
  163. package/dist/src/wallet/providers/cketh-provider.d.ts +104 -0
  164. package/dist/src/wallet/providers/cketh-provider.js +343 -0
  165. package/dist/src/wallet/providers/polkadot-provider.d.ts +115 -0
  166. package/dist/src/wallet/providers/polkadot-provider.js +407 -0
  167. package/dist/src/wallet/providers/solana-provider.d.ts +102 -0
  168. package/dist/src/wallet/providers/solana-provider.js +393 -0
  169. package/dist/src/wallet/transaction-queue.d.ts +133 -0
  170. package/dist/src/wallet/transaction-queue.js +195 -0
  171. package/dist/src/wallet/types.d.ts +167 -0
  172. package/dist/src/wallet/types.js +5 -0
  173. package/dist/src/wallet/vetkeys-adapter.d.ts +134 -0
  174. package/dist/src/wallet/vetkeys-adapter.js +313 -0
  175. package/dist/src/wallet/wallet-manager.d.ts +202 -0
  176. package/dist/src/wallet/wallet-manager.js +451 -0
  177. package/dist/src/wallet/wallet-storage.d.ts +131 -0
  178. package/dist/src/wallet/wallet-storage.js +274 -0
  179. package/macos-wallet-app/AgentVaultWallet/App/AgentVaultWalletApp.swift +54 -0
  180. package/macos-wallet-app/AgentVaultWallet/Models/AppState.swift +102 -0
  181. package/macos-wallet-app/AgentVaultWallet/Models/Chain.swift +121 -0
  182. package/macos-wallet-app/AgentVaultWallet/Models/Wallet.swift +98 -0
  183. package/macos-wallet-app/AgentVaultWallet/Resources/AgentVaultWallet.entitlements +27 -0
  184. package/macos-wallet-app/AgentVaultWallet/Resources/Info.plist +69 -0
  185. package/macos-wallet-app/AgentVaultWallet/Services/BackupService.swift +270 -0
  186. package/macos-wallet-app/AgentVaultWallet/Services/CLIBridge.swift +367 -0
  187. package/macos-wallet-app/AgentVaultWallet/Services/CryptoService.swift +157 -0
  188. package/macos-wallet-app/AgentVaultWallet/Services/FileService.swift +120 -0
  189. package/macos-wallet-app/AgentVaultWallet/Services/KeychainService.swift +219 -0
  190. package/macos-wallet-app/AgentVaultWallet/Utilities/Constants.swift +44 -0
  191. package/macos-wallet-app/AgentVaultWallet/Utilities/Extensions.swift +115 -0
  192. package/macos-wallet-app/AgentVaultWallet/ViewModels/BackupViewModel.swift +237 -0
  193. package/macos-wallet-app/AgentVaultWallet/ViewModels/CreateWalletViewModel.swift +137 -0
  194. package/macos-wallet-app/AgentVaultWallet/ViewModels/ImportWalletViewModel.swift +179 -0
  195. package/macos-wallet-app/AgentVaultWallet/ViewModels/WalletStore.swift +286 -0
  196. package/macos-wallet-app/AgentVaultWallet/Views/Backup/BackupView.swift +235 -0
  197. package/macos-wallet-app/AgentVaultWallet/Views/Backup/RestoreView.swift +316 -0
  198. package/macos-wallet-app/AgentVaultWallet/Views/Create/CreateWalletFlow.swift +438 -0
  199. package/macos-wallet-app/AgentVaultWallet/Views/Import/ImportWalletFlow.swift +399 -0
  200. package/macos-wallet-app/AgentVaultWallet/Views/MainView.swift +134 -0
  201. package/macos-wallet-app/AgentVaultWallet/Views/Settings/SettingsView.swift +276 -0
  202. package/macos-wallet-app/AgentVaultWallet/Views/Sidebar/SidebarView.swift +133 -0
  203. package/macos-wallet-app/AgentVaultWallet/Views/Wallet/DashboardView.swift +233 -0
  204. package/macos-wallet-app/AgentVaultWallet/Views/Wallet/WalletDetailView.swift +281 -0
  205. package/macos-wallet-app/AgentVaultWallet/Views/Wallet/WalletListView.swift +280 -0
  206. package/macos-wallet-app/AgentVaultWallet/Views/Welcome/WelcomeView.swift +176 -0
  207. package/macos-wallet-app/Makefile +47 -0
  208. package/macos-wallet-app/project.yml +40 -0
  209. package/macos-wallet-app/setup.sh +73 -0
  210. package/package.json +10 -2
  211. package/backups/agentvault-backup-test-agent-2026-02-12T17-54-28-967Z.json +0 -28
  212. package/backups/agentvault-backup-test-agent-2026-02-12T17-54-29-032Z.backup +0 -1
  213. package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-373Z.json +0 -28
  214. package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-428Z.backup +0 -1
  215. package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-132Z.json +0 -28
  216. package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-247Z.backup +0 -1
  217. package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-216Z.json +0 -28
  218. package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-283Z.backup +0 -1
  219. package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-772Z.backup +0 -1
  220. package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-793Z.json +0 -28
  221. package/backups/test-backup.json +0 -28
  222. package/scripts/dev-dashboard.mjs +0 -84
  223. package/site/README.md +0 -63
  224. package/site/docusaurus.config.ts +0 -148
  225. package/site/package-lock.json +0 -18383
  226. package/site/package.json +0 -47
  227. package/site/sidebars.ts +0 -86
  228. package/site/static/.gitkeep +0 -0
  229. package/site/static/img/logo.svg +0 -28
  230. package/site/static/img/og-image.svg +0 -35
  231. package/src/archival/archive-manager.ts +0 -372
  232. package/src/archival/arweave-client.ts +0 -289
  233. package/src/backup/backup.ts +0 -315
  234. package/src/cloud-storage/cloud-sync.ts +0 -461
  235. package/src/cloud-storage/provider-detector.ts +0 -198
  236. package/src/debugging/logs.ts +0 -193
  237. package/src/debugging/types.ts +0 -100
  238. package/src/deployment/deployer.ts +0 -274
  239. package/src/deployment/icpClient.ts +0 -620
  240. package/src/deployment/index.ts +0 -46
  241. package/src/deployment/promotion.ts +0 -161
  242. package/src/deployment/types.ts +0 -111
  243. package/src/icp/batch.ts +0 -374
  244. package/src/icp/environment.ts +0 -215
  245. package/src/icp/icpcli.ts +0 -438
  246. package/src/icp/icwasm.ts +0 -222
  247. package/src/icp/index.ts +0 -94
  248. package/src/icp/optimization.ts +0 -242
  249. package/src/icp/tool-detector.ts +0 -110
  250. package/src/icp/types.ts +0 -574
  251. package/src/index.ts +0 -25
  252. package/src/inference/bittensor-client.ts +0 -304
  253. package/src/inference/inference-manager.ts +0 -327
  254. package/src/metrics/metrics.ts +0 -186
  255. package/src/monitoring/alerting.ts +0 -190
  256. package/src/monitoring/health.ts +0 -197
  257. package/src/monitoring/index.ts +0 -38
  258. package/src/monitoring/info.ts +0 -114
  259. package/src/monitoring/types.ts +0 -99
  260. package/src/network/network-config.ts +0 -129
  261. package/src/packaging/compiler.ts +0 -647
  262. package/src/packaging/config-persistence.ts +0 -135
  263. package/src/packaging/config-schemas.ts +0 -156
  264. package/src/packaging/detector.ts +0 -220
  265. package/src/packaging/index.ts +0 -90
  266. package/src/packaging/packager.ts +0 -118
  267. package/src/packaging/parsers/clawdbot.ts +0 -278
  268. package/src/packaging/parsers/cline.ts +0 -223
  269. package/src/packaging/parsers/generic.ts +0 -266
  270. package/src/packaging/parsers/goose.ts +0 -214
  271. package/src/packaging/serializer.ts +0 -260
  272. package/src/packaging/types.ts +0 -144
  273. package/src/packaging/wasmedge-compiler.ts +0 -406
  274. package/src/security/multisig.ts +0 -415
  275. package/src/security/types.ts +0 -416
  276. package/src/security/vetkeys.ts +0 -655
  277. package/src/testing/local-runner.ts +0 -264
  278. package/src/testing/types.ts +0 -104
  279. package/src/wallet/cbor-serializer.ts +0 -323
  280. package/src/wallet/chain-dispatcher.ts +0 -313
  281. package/src/wallet/cross-chain-aggregator.ts +0 -346
  282. package/src/wallet/index.ts +0 -76
  283. package/src/wallet/key-derivation.ts +0 -425
  284. package/src/wallet/providers/base-provider.ts +0 -154
  285. package/src/wallet/providers/cketh-provider.ts +0 -434
  286. package/src/wallet/providers/polkadot-provider.ts +0 -503
  287. package/src/wallet/providers/solana-provider.ts +0 -490
  288. package/src/wallet/transaction-queue.ts +0 -284
  289. package/src/wallet/types.ts +0 -178
  290. package/src/wallet/vetkeys-adapter.ts +0 -431
  291. package/src/wallet/wallet-manager.ts +0 -597
  292. package/src/wallet/wallet-storage.ts +0 -380
@@ -0,0 +1,176 @@
1
+ import SwiftUI
2
+
3
+ /// First-launch onboarding experience
4
+ struct WelcomeView: View {
5
+ @EnvironmentObject var walletStore: WalletStore
6
+ @EnvironmentObject var appState: AppState
7
+ @State private var currentPage = 0
8
+
9
+ private let pages = [
10
+ OnboardingPage(
11
+ icon: "shield.checkered",
12
+ title: "Welcome to AgentVault Wallet",
13
+ subtitle: "A secure, friendly wallet manager for your blockchain assets.",
14
+ description: "Manage wallets for Internet Computer, Ethereum, and Arweave — no terminal required."
15
+ ),
16
+ OnboardingPage(
17
+ icon: "key.viewfinder",
18
+ title: "Your Keys, Your Control",
19
+ subtitle: "Private keys never leave your Mac.",
20
+ description: "All secrets are stored in the macOS Keychain, protected by your system password and the Secure Enclave."
21
+ ),
22
+ OnboardingPage(
23
+ icon: "arrow.triangle.2.circlepath.icloud",
24
+ title: "Backup & Restore",
25
+ subtitle: "Encrypted backups keep you safe.",
26
+ description: "Create password-protected backups of all your wallets. Restore them on any Mac with AgentVault Wallet."
27
+ ),
28
+ ]
29
+
30
+ var body: some View {
31
+ VStack(spacing: 0) {
32
+ Spacer()
33
+
34
+ // Page content
35
+ TabView(selection: $currentPage) {
36
+ ForEach(Array(pages.enumerated()), id: \.offset) { index, page in
37
+ VStack(spacing: 24) {
38
+ // Icon
39
+ ZStack {
40
+ Circle()
41
+ .fill(.ultraThinMaterial)
42
+ .frame(width: 100, height: 100)
43
+
44
+ Image(systemName: page.icon)
45
+ .font(.system(size: 44))
46
+ .foregroundStyle(.primary)
47
+ }
48
+
49
+ // Title
50
+ Text(page.title)
51
+ .font(.system(size: 28, weight: .bold, design: .rounded))
52
+ .multilineTextAlignment(.center)
53
+
54
+ // Subtitle
55
+ Text(page.subtitle)
56
+ .font(.title3)
57
+ .foregroundStyle(.secondary)
58
+ .multilineTextAlignment(.center)
59
+
60
+ // Description
61
+ Text(page.description)
62
+ .font(.body)
63
+ .foregroundStyle(.tertiary)
64
+ .multilineTextAlignment(.center)
65
+ .frame(maxWidth: 420)
66
+ .padding(.top, 4)
67
+ }
68
+ .padding(40)
69
+ .tag(index)
70
+ }
71
+ }
72
+ .tabViewStyle(.automatic)
73
+
74
+ Spacer()
75
+
76
+ // Progress dots
77
+ HStack(spacing: 8) {
78
+ ForEach(0..<pages.count, id: \.self) { index in
79
+ Circle()
80
+ .fill(index == currentPage ? Color.accentColor : Color.secondary.opacity(0.3))
81
+ .frame(width: 8, height: 8)
82
+ .animation(.easeInOut, value: currentPage)
83
+ }
84
+ }
85
+ .padding(.bottom, 24)
86
+
87
+ // Environment status
88
+ if appState.isCheckingEnvironment {
89
+ HStack(spacing: 8) {
90
+ ProgressView()
91
+ .controlSize(.small)
92
+ Text("Checking environment...")
93
+ .font(.caption)
94
+ .foregroundStyle(.secondary)
95
+ }
96
+ .padding(.bottom, 16)
97
+ } else if !appState.environment.nodeInstalled {
98
+ HStack(spacing: 8) {
99
+ Image(systemName: "exclamationmark.triangle.fill")
100
+ .foregroundStyle(.orange)
101
+ Text("Node.js not detected. Some features may be limited.")
102
+ .font(.caption)
103
+ .foregroundStyle(.secondary)
104
+ }
105
+ .padding(.bottom, 16)
106
+ }
107
+
108
+ // Actions
109
+ VStack(spacing: 12) {
110
+ if currentPage < pages.count - 1 {
111
+ Button {
112
+ withAnimation { currentPage += 1 }
113
+ } label: {
114
+ Text("Next")
115
+ .frame(width: 200)
116
+ }
117
+ .buttonStyle(.borderedProminent)
118
+ .controlSize(.large)
119
+
120
+ Button("Skip") {
121
+ appState.completeOnboarding()
122
+ }
123
+ .buttonStyle(.plain)
124
+ .foregroundStyle(.secondary)
125
+ } else {
126
+ Button {
127
+ appState.completeOnboarding()
128
+ appState.activeSheet = .createWallet
129
+ } label: {
130
+ Text("Create Your First Wallet")
131
+ .frame(width: 240)
132
+ }
133
+ .buttonStyle(.borderedProminent)
134
+ .controlSize(.large)
135
+
136
+ HStack(spacing: 16) {
137
+ Button("Import Existing Wallet") {
138
+ appState.completeOnboarding()
139
+ appState.activeSheet = .importWallet
140
+ }
141
+ .buttonStyle(.bordered)
142
+
143
+ Button("Restore from Backup") {
144
+ appState.completeOnboarding()
145
+ appState.activeSheet = .restore
146
+ }
147
+ .buttonStyle(.bordered)
148
+ }
149
+
150
+ Button("Skip for Now") {
151
+ appState.completeOnboarding()
152
+ }
153
+ .buttonStyle(.plain)
154
+ .foregroundStyle(.secondary)
155
+ .padding(.top, 4)
156
+ }
157
+ }
158
+ .padding(.bottom, 32)
159
+ }
160
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
161
+ .background(
162
+ LinearGradient(
163
+ colors: [Color.accentColor.opacity(0.05), Color.clear],
164
+ startPoint: .topLeading,
165
+ endPoint: .bottomTrailing
166
+ )
167
+ )
168
+ }
169
+ }
170
+
171
+ struct OnboardingPage {
172
+ let icon: String
173
+ let title: String
174
+ let subtitle: String
175
+ let description: String
176
+ }
@@ -0,0 +1,47 @@
1
+ .PHONY: generate build run clean
2
+
3
+ # Generate Xcode project from project.yml using XcodeGen
4
+ generate:
5
+ @echo "Generating Xcode project..."
6
+ @command -v xcodegen >/dev/null 2>&1 || { echo "Installing XcodeGen..."; brew install xcodegen; }
7
+ xcodegen generate
8
+ @echo "Done! Open AgentVaultWallet.xcodeproj in Xcode."
9
+
10
+ # Build the app (Release)
11
+ build: generate
12
+ xcodebuild -project AgentVaultWallet.xcodeproj \
13
+ -scheme AgentVaultWallet \
14
+ -configuration Release \
15
+ -derivedDataPath build \
16
+ build
17
+
18
+ # Build and run (Debug)
19
+ run: generate
20
+ xcodebuild -project AgentVaultWallet.xcodeproj \
21
+ -scheme AgentVaultWallet \
22
+ -configuration Debug \
23
+ -derivedDataPath build \
24
+ build
25
+ @echo "Launching app..."
26
+ open build/Build/Products/Debug/AgentVault\ Wallet.app
27
+
28
+ # Open in Xcode
29
+ open: generate
30
+ open AgentVaultWallet.xcodeproj
31
+
32
+ # Clean build artifacts
33
+ clean:
34
+ rm -rf build
35
+ rm -rf AgentVaultWallet.xcodeproj
36
+
37
+ # Quick setup: install dependencies and generate project
38
+ setup:
39
+ @echo "Checking dependencies..."
40
+ @command -v xcodegen >/dev/null 2>&1 || { echo "Installing XcodeGen via Homebrew..."; brew install xcodegen; }
41
+ @echo "Generating Xcode project..."
42
+ xcodegen generate
43
+ @echo ""
44
+ @echo "Setup complete! Run one of:"
45
+ @echo " make open - Open in Xcode"
46
+ @echo " make build - Build from command line"
47
+ @echo " make run - Build and launch"
@@ -0,0 +1,40 @@
1
+ name: AgentVaultWallet
2
+ options:
3
+ bundleIdPrefix: com.agentvault
4
+ deploymentTarget:
5
+ macOS: "14.0"
6
+ xcodeVersion: "15.0"
7
+ createIntermediateGroups: true
8
+ generateEmptyDirectories: true
9
+
10
+ settings:
11
+ base:
12
+ SWIFT_VERSION: "5.9"
13
+ MACOSX_DEPLOYMENT_TARGET: "14.0"
14
+ CODE_SIGN_STYLE: Automatic
15
+ ENABLE_HARDENED_RUNTIME: YES
16
+
17
+ targets:
18
+ AgentVaultWallet:
19
+ type: application
20
+ platform: macOS
21
+ sources:
22
+ - path: AgentVaultWallet
23
+ settings:
24
+ base:
25
+ PRODUCT_BUNDLE_IDENTIFIER: com.agentvault.wallet
26
+ PRODUCT_NAME: AgentVault Wallet
27
+ INFOPLIST_FILE: AgentVaultWallet/Resources/Info.plist
28
+ CODE_SIGN_ENTITLEMENTS: AgentVaultWallet/Resources/AgentVaultWallet.entitlements
29
+ ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
30
+ info:
31
+ path: AgentVaultWallet/Resources/Info.plist
32
+ properties:
33
+ CFBundleName: AgentVault Wallet
34
+ CFBundleDisplayName: AgentVault Wallet
35
+ CFBundleShortVersionString: "1.0.0"
36
+ CFBundleVersion: "1"
37
+ LSMinimumSystemVersion: "14.0"
38
+ LSApplicationCategoryType: public.app-category.finance
39
+ NSMainNibFile: ""
40
+ NSPrincipalClass: NSApplication
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ echo "==================================="
5
+ echo " AgentVault Wallet - macOS Setup"
6
+ echo "==================================="
7
+ echo ""
8
+
9
+ # Check for Xcode
10
+ if ! command -v xcodebuild &> /dev/null; then
11
+ echo "ERROR: Xcode is not installed."
12
+ echo "Install Xcode from the Mac App Store or run:"
13
+ echo " xcode-select --install"
14
+ exit 1
15
+ fi
16
+
17
+ echo "[OK] Xcode found: $(xcodebuild -version | head -1)"
18
+
19
+ # Check for Homebrew
20
+ if ! command -v brew &> /dev/null; then
21
+ echo ""
22
+ echo "Homebrew is not installed. Install it? (recommended for XcodeGen)"
23
+ read -p "[y/N] " -n 1 -r
24
+ echo
25
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
26
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
27
+ else
28
+ echo "Skipping Homebrew. You'll need to install XcodeGen manually."
29
+ fi
30
+ fi
31
+
32
+ # Check/install XcodeGen
33
+ if ! command -v xcodegen &> /dev/null; then
34
+ echo ""
35
+ echo "Installing XcodeGen..."
36
+ if command -v brew &> /dev/null; then
37
+ brew install xcodegen
38
+ else
39
+ echo "ERROR: Cannot install XcodeGen without Homebrew."
40
+ echo "Install manually: https://github.com/yonaskolb/XcodeGen"
41
+ exit 1
42
+ fi
43
+ fi
44
+
45
+ echo "[OK] XcodeGen found: $(xcodegen --version)"
46
+
47
+ # Generate Xcode project
48
+ echo ""
49
+ echo "Generating Xcode project..."
50
+ cd "$(dirname "$0")"
51
+ xcodegen generate
52
+
53
+ echo ""
54
+ echo "==================================="
55
+ echo " Setup Complete!"
56
+ echo "==================================="
57
+ echo ""
58
+ echo "Next steps:"
59
+ echo " 1. Open the project: open AgentVaultWallet.xcodeproj"
60
+ echo " 2. Select your team in Signing & Capabilities"
61
+ echo " 3. Build and run (Cmd+R)"
62
+ echo ""
63
+ echo "Or build from terminal:"
64
+ echo " make build - Build release"
65
+ echo " make run - Build and launch debug"
66
+ echo ""
67
+
68
+ # Offer to open in Xcode
69
+ read -p "Open in Xcode now? [Y/n] " -n 1 -r
70
+ echo
71
+ if [[ ! $REPLY =~ ^[Nn]$ ]]; then
72
+ open AgentVaultWallet.xcodeproj
73
+ fi
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "agentvault",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Persistent On-Chain AI Agent Platform - Sovereign, Reconstructible, Autonomous",
5
- "main": "src/index.ts",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/src/index.d.ts",
10
+ "import": "./dist/src/index.js"
11
+ }
12
+ },
6
13
  "bin": {
7
14
  "agentvault": "dist/cli/index.js"
8
15
  },
@@ -61,6 +68,7 @@
61
68
  "@dfinity/principal": "^3.4.3",
62
69
  "@noble/curves": "^1.7.0",
63
70
  "@polkadot/api": "^16.5.4",
71
+ "@polkadot/keyring": "^14.0.1",
64
72
  "@polkadot/util": "^14.0.1",
65
73
  "@polkadot/util-crypto": "^14.0.1",
66
74
  "@solana/web3.js": "^1.98.4",
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1770918868967,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1770918868967,
14
- "updatedAt": 1770918868967,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1770918868967,
24
- "updatedAt": 1770918868967,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1 +0,0 @@
1
- {"encrypted":"601fecd19c66b7208418848c25fc5ab223b694d01f3e3a841dedd7c1c8e99a45223092b8b14c8a5bb54e4099944bac5c937725009efa33282d97eed87b5d5f8d2b7a79792b22627b703dff7d8d21d94fe18637acac331c5ef5269af7f57fb3ded7ba073803c04961c7e12a277d9655331afd0e92240701d44dfeae03b584e0f20cf283aadafcdd7997145316792302abcc5400d9a13cef0e74c8b72c9f66be6664a1797757240cd1a84d08329dfa0d254462945b83d6bb55e4c7f37b2fcee1db39630df81320f8d2e5e38ed2af7bb0ee750357233d9c86289f13afcf549b945e41f944607a36d440c5a0310cf373777385aa98c3aa5af83f53766c2d1e3035f85be4173cc4358132383f06970f16c1d7c2064114284526043cad36533323d7d6b0ddebf4e1de4c3a4eb795dc666c292d7b81bb8e1da78b02c2568ff0fa0608cf52cad455aa02a9c74393fe4a84e996a70de0a02c054f9e41d808ae24bf22692c32a12e7a7b19dc1b5427935c809aa00fd4cc42e063d19674d6427f4b47c3cb5e2fabb1cca37f19104c30497a553f0c4ba74522dea156434ed3172794b3511818a5e2e78e500e0ca25e08eb0bfe07f34fbc819cd3688b4e243a5ea525314824f82b9ab190338ae2e178c4fb0242f776231b3dd97e3e14f7f27e6892.feb08a8a8fd6b9be8bcbd441aa83e67c"}
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1770919062374,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1770919062373,
14
- "updatedAt": 1770919062373,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1770919062373,
24
- "updatedAt": 1770919062373,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1 +0,0 @@
1
- {"encrypted":"24a771888039381d577a63fe00df9329cc4a9146db72eec35f206749f86d4745230bf150284b6c88505c368db132b4c216b70300e9c54aa37a797288e29bd43bebb281fe677fbd2c51202b04d7fac922927b1eda8da57cfc37de77f5765c79eac282e63d8c318346dc42e43864efb9566c12da3a8f66f06bace75bc4791c46c37aca495fb47e256ce0d4310713c093105d458e809673641b0e219b9509dff9811654de30a43e32bb6e333dfc55238e2a7d549deac02d1e2eb3523153eee504e0abc57a801127c8809e7fef3109a68949bff235442c936cae8438fb782508b3213d37880303f1b446b1ddf7d286c8b85d2dd78da37c02b1551acb791aeaa44ebaa5f8e22d1fa85acb28ea69e4588def5259b2caa6ed85cc48e2b74862c3f1d9b8450e43ecc14c8f5345afdc8321ed0cde0255bc60ad80c290ad1a5ade52588b076c0f48d2c0e880f3be83037b10c382348d85e23a89214307ad421b7ceb40086919e5aa0e552a5d4e2e33edba5fd7b4a0be369efe3a64d712ace867d38abe6172ead9c6395f44791b955a2ae0eae1450645cfac5fce67101635bc2ca6cce07ee4afcfe2864500da777fbd425d3e5e7614b22177478012f77826efe682af73e6ed92e479fcf234020ab065483efc6f0318368bdf501eb0bf6250f4dd.7aefcc7265f58c652c096d39067b9806"}
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1770922345133,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1770922345132,
14
- "updatedAt": 1770922345132,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1770922345132,
24
- "updatedAt": 1770922345132,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1 +0,0 @@
1
- {"encrypted":"6327bb22b39ebc91b780f3b3405f99b540aa8b8da54ef348372b333007db38c29cbb90aae4deebb0651c109302c466de03bddfcf14007de39a0ec1fc06467f5b5ea54cb4ac50e55b05ec2219d2492baaeb2fb156cc7a967470332738d411281605b4dc3c6596cd58352715ec865bb0bafcb9c8842e053b32660eaf623acb6098c92b92b088a06b3990c74a2c40045cecbbbc40c215083ff5e0c8a5042f20604c20c38622dd8edb8df09635590fc4e3d7867f1c044d3ae4648fffd25fee767433f393c4e6fed78a82fae705d919566df1e7eac98ba01542e1cba0bd3f5952527b2a7894fe74cd239c1c9953310de8c37beaacff376ad13e8b57829d8daacb2540dfb1e6a4c8a6f0cf866a629879bbca811830f7aa2a109a45a20e4e1996e32b88c76269d348044e9012e69263e358aeedf5c565ef225ada153531cc4cd26f8d195c824c798e4218df62eb69fea4fec2c818db73621957ef85dfa1d48aa0ed0ff8029ca9762fee9520de2163b491412cf1a184fdd890ecfc904b16db92703678a08013064cec3980eaaa564e9e41e1a2635465ab79240ff1137c1d3e0c28516b6277bd7e7d329a0890587ea8f4fa9fedd3fd21e981d167c6f4f509719fddfc98f3a98632a919ecaaea01e984139c5ed9c4d755460d41bf73ca3c4a20.36ed2be30022b68e47c1a001c5ab6633"}
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1770922449216,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1770922449209,
14
- "updatedAt": 1770922449209,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1770922449209,
24
- "updatedAt": 1770922449209,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1 +0,0 @@
1
- {"encrypted":"da6dc94ce5ddc2fa316b86ffc93e33dd5005c73536eb8b970403ce0007ab9a1d5861df815a30bea164d55c71333c7ccead0ad1133365fe94a2b42d63059a8904c3fa8db39ea6021a2f6ffedf961cbcb89ef4e1e6f5d690719e7c244d8ce65477e43b0e1627af287df6d445218e2979abf486d619ed0e1991e403f0c59c010fb016f5ce4d384d873aa2efc33a7418b53b047323e36679cd7e6c81bb75375fbb911da34de78c25e0f7c0a13cc6333719eeb9fb0624d64baf9f1855e2c5ebc7f171e090de6a6985f1eb08de5076251d01f94737d6849de59400305ea0a3325467f690f73ad816d74379c976e67da5623613512bc3bd3908fc30f842d7d47d7df8f535e792b0c7ae5106f1fd0ad6e1b587f9431e302c90ed57554104f82ae0a1e75b7881d85f671d97bc624058017beb26d0cd637ecaed3194acd18c5883152bd925ef3dfcb83ecb6fc22dfdb022f48ba3f8fdd1a702cb6dca202dc48a85079d348e5124e6a8351f87b0119c17e2102c0fee094a9abce58f53d57b28ed20f552a2fc1b7c99537624d67becb12ff196c1c5cd401e2bb3d4fdba6cb6e1ddbe00bfe5c45d8e20426df80fee7e62b520696fec1f0b23b30c861cb6e1b2a89aa7561ec897c22ce02bace4f21be511b76c52900eaed2fe60b8cc45daf488d29f.d7869a1924b7c6f7a65146e053409960"}
@@ -1 +0,0 @@
1
- {"encrypted":"2dd98d8fdb2707830c917802d1acde9f94dd31a8ee62612323c5c81f5c4fda15c4764f5ddf7ba7c90048d280d7005656177a8d184d6b60868480821dba3826f582e4d25d8d8c4ffe985da64a56d00c409677ab2e1857cd08f4ef1b0bc5e0a0e31d1d524ab717a4ec25deb9ee0f20e4e423bbf09b8b7d302bf389d6e93a75d5ab1b01b31c8d2e5436cb22e077b07ce69bf3b7fe52c14b757f89bbf6fc62ce687589f494ef5822c9cf22c81c3ce502fab75dc77684b6c1c39c025d7ffba968f80974bf40509a1599342f16b446bff6c001450087cd23d8887bdaa83d4bf0679a5347e064a0f5e49c0a0f138a20c6d722acf56b2245b58f07dc73b49a3e698fbb23681813106ee5e0f9093cd97840e1abc698d817be04e980305c05f38dc60bcb10d5fd1d38384eb831dc629055e4b58ff3a99e08f98da688bfd99fcd723a9c98c054141d7343428d3d3262c06b66ef7b1579804d4318a600e51a5b1cb722248d25dfbd1f7ea2c186d513c7bbbfea29911861ab2aa190f108eab4f9c31a0e8e345048d8dabb1eb4cc818721f74d663111fc9a27ae11cb945ec2a65f7132ed4dde14c28d86bb54b30dd1044b7fc3b7c2a00d1a2b64a9bcacd8c2ffb316214c3d5dfed61f410347eb1ae1828b37c063eb92f8dd44774e907b32aa203c98.0b0e2b98e9d80607a998eb6157697e4c"}
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1770934702794,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1770934702793,
14
- "updatedAt": 1770934702793,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1770934702793,
24
- "updatedAt": 1770934702793,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1,28 +0,0 @@
1
- {
2
- "version": "1.0",
3
- "agentId": "test-agent",
4
- "exportedAt": 1771032384251,
5
- "format": "json",
6
- "wallets": [
7
- {
8
- "id": "wallet-1",
9
- "agentId": "test-agent",
10
- "chain": "cketh",
11
- "address": "0x1234567890abcdef1234567890abcdef12345678",
12
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
13
- "createdAt": 1771032384247,
14
- "updatedAt": 1771032384247,
15
- "creationMethod": "private-key"
16
- },
17
- {
18
- "id": "wallet-2",
19
- "agentId": "test-agent",
20
- "chain": "cketh",
21
- "address": "0x1234567890abcdef1234567890abcdef12345678",
22
- "privateKey": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
23
- "createdAt": 1771032384247,
24
- "updatedAt": 1771032384247,
25
- "creationMethod": "private-key"
26
- }
27
- ]
28
- }
@@ -1,84 +0,0 @@
1
- import { spawn } from 'node:child_process'
2
-
3
- const tasks = [
4
- {
5
- name: 'core',
6
- command: 'npm',
7
- args: ['run', 'dev:core'],
8
- },
9
- {
10
- name: 'webapp',
11
- command: 'npm',
12
- args: ['run', 'dev:webapp'],
13
- },
14
- ]
15
-
16
- const running = new Map()
17
- let shuttingDown = false
18
-
19
- function shutdown(signal = 'SIGTERM', exitCode = 0) {
20
- if (shuttingDown) {
21
- return
22
- }
23
- shuttingDown = true
24
- process.exitCode = exitCode
25
-
26
- for (const child of running.values()) {
27
- if (!child.killed) {
28
- child.kill(signal)
29
- }
30
- }
31
-
32
- setTimeout(() => {
33
- for (const child of running.values()) {
34
- if (!child.killed) {
35
- child.kill('SIGKILL')
36
- }
37
- }
38
- }, 2000).unref()
39
- }
40
-
41
- for (const task of tasks) {
42
- const child = spawn(task.command, task.args, {
43
- stdio: 'inherit',
44
- env: process.env,
45
- })
46
-
47
- running.set(task.name, child)
48
-
49
- child.on('exit', (code, signal) => {
50
- running.delete(task.name)
51
-
52
- if (shuttingDown) {
53
- if (running.size === 0) {
54
- process.exit(process.exitCode ?? 0)
55
- }
56
- return
57
- }
58
-
59
- if (signal) {
60
- console.error(`[dev:${task.name}] exited via signal ${signal}`)
61
- shutdown('SIGTERM', 1)
62
- return
63
- }
64
-
65
- if ((code ?? 0) !== 0) {
66
- console.error(`[dev:${task.name}] exited with code ${code}`)
67
- shutdown('SIGTERM', code ?? 1)
68
- return
69
- }
70
-
71
- if (running.size === 0) {
72
- process.exit(0)
73
- }
74
- })
75
-
76
- child.on('error', (error) => {
77
- console.error(`[dev:${task.name}] failed to start: ${error.message}`)
78
- shutdown('SIGTERM', 1)
79
- })
80
- }
81
-
82
- process.on('SIGINT', () => shutdown('SIGINT', 0))
83
- process.on('SIGTERM', () => shutdown('SIGTERM', 0))
84
- process.on('SIGHUP', () => shutdown('SIGTERM', 0))