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,60 @@
1
+ /**
2
+ * Environment Manager
3
+ *
4
+ * Manages ICP environment configurations from icp.yaml files.
5
+ * Supports multiple environments (local, dev, staging, production)
6
+ * with independent settings for network, cycles, identity, and optimization.
7
+ */
8
+ import type { IcpProjectConfig, IcpEnvironmentConfig, IcpOptimizationConfig } from './types.js';
9
+ /**
10
+ * Find the icp.yaml configuration file by walking up from a starting directory.
11
+ *
12
+ * @param startDir - Directory to start searching from
13
+ * @returns Absolute path to icp.yaml, or null if not found
14
+ */
15
+ export declare function findConfigFile(startDir?: string): string | null;
16
+ /**
17
+ * Load and parse icp.yaml configuration.
18
+ *
19
+ * @param configPath - Path to icp.yaml (if null, will search for it)
20
+ * @returns Parsed configuration, or null if not found
21
+ */
22
+ export declare function loadConfig(configPath?: string): IcpProjectConfig | null;
23
+ /**
24
+ * Get the configuration for a specific environment.
25
+ *
26
+ * Falls back to 'local' default if the environment is not defined.
27
+ *
28
+ * @param envName - Environment name
29
+ * @param config - Project configuration (will be loaded if not provided)
30
+ * @returns Environment configuration
31
+ */
32
+ export declare function getEnvironment(envName: string, config?: IcpProjectConfig | null): IcpEnvironmentConfig;
33
+ /**
34
+ * Get the optimization configuration.
35
+ *
36
+ * @param config - Project configuration (will be loaded if not provided)
37
+ * @returns Optimization configuration
38
+ */
39
+ export declare function getOptimizationConfig(config?: IcpProjectConfig | null): IcpOptimizationConfig;
40
+ /**
41
+ * List all defined environment names.
42
+ *
43
+ * @param config - Project configuration (will be loaded if not provided)
44
+ * @returns Array of environment names
45
+ */
46
+ export declare function listEnvironments(config?: IcpProjectConfig | null): string[];
47
+ /**
48
+ * Write an icp.yaml configuration file.
49
+ *
50
+ * @param config - Configuration to write
51
+ * @param outputPath - Path to write to (defaults to ./icp.yaml)
52
+ */
53
+ export declare function writeConfig(config: IcpProjectConfig, outputPath?: string): void;
54
+ /**
55
+ * Generate a default icp.yaml configuration.
56
+ *
57
+ * @returns Default project configuration with local, dev, staging, production environments
58
+ */
59
+ export declare function generateDefaultConfig(): IcpProjectConfig;
60
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Environment Manager
3
+ *
4
+ * Manages ICP environment configurations from icp.yaml files.
5
+ * Supports multiple environments (local, dev, staging, production)
6
+ * with independent settings for network, cycles, identity, and optimization.
7
+ */
8
+ import * as fs from 'node:fs';
9
+ import * as path from 'node:path';
10
+ import YAML from 'yaml';
11
+ /**
12
+ * Default paths to search for icp.yaml configuration.
13
+ */
14
+ const CONFIG_SEARCH_PATHS = [
15
+ 'icp.yaml',
16
+ 'icp.yml',
17
+ '.agentvault/icp.yaml',
18
+ ];
19
+ /**
20
+ * Default environment configuration when nothing is specified.
21
+ */
22
+ const DEFAULT_LOCAL_ENV = {
23
+ name: 'local',
24
+ network: { type: 'local' },
25
+ cycles: { initial: '100T' },
26
+ };
27
+ /**
28
+ * Default optimization settings.
29
+ */
30
+ const DEFAULT_OPTIMIZATION = {
31
+ enabled: true,
32
+ level: 3,
33
+ shrink: true,
34
+ removeDebug: true,
35
+ wasmOptFlags: ['--O3', '--dce', '--strip-debug'],
36
+ };
37
+ /**
38
+ * Find the icp.yaml configuration file by walking up from a starting directory.
39
+ *
40
+ * @param startDir - Directory to start searching from
41
+ * @returns Absolute path to icp.yaml, or null if not found
42
+ */
43
+ export function findConfigFile(startDir) {
44
+ const searchDir = startDir ? path.resolve(startDir) : process.cwd();
45
+ // Check each search path in the starting directory
46
+ for (const relPath of CONFIG_SEARCH_PATHS) {
47
+ const fullPath = path.join(searchDir, relPath);
48
+ if (fs.existsSync(fullPath)) {
49
+ return fullPath;
50
+ }
51
+ }
52
+ // Walk up the directory tree
53
+ const parent = path.dirname(searchDir);
54
+ if (parent !== searchDir) {
55
+ return findConfigFile(parent);
56
+ }
57
+ return null;
58
+ }
59
+ /**
60
+ * Load and parse icp.yaml configuration.
61
+ *
62
+ * @param configPath - Path to icp.yaml (if null, will search for it)
63
+ * @returns Parsed configuration, or null if not found
64
+ */
65
+ export function loadConfig(configPath) {
66
+ const resolvedPath = configPath ?? findConfigFile();
67
+ if (!resolvedPath || !fs.existsSync(resolvedPath)) {
68
+ return null;
69
+ }
70
+ try {
71
+ const content = fs.readFileSync(resolvedPath, 'utf-8');
72
+ const parsed = YAML.parse(content);
73
+ return parsed;
74
+ }
75
+ catch (error) {
76
+ const message = error instanceof Error ? error.message : 'Unknown error';
77
+ throw new Error(`Failed to parse icp.yaml at ${resolvedPath}: ${message}`);
78
+ }
79
+ }
80
+ /**
81
+ * Get the configuration for a specific environment.
82
+ *
83
+ * Falls back to 'local' default if the environment is not defined.
84
+ *
85
+ * @param envName - Environment name
86
+ * @param config - Project configuration (will be loaded if not provided)
87
+ * @returns Environment configuration
88
+ */
89
+ export function getEnvironment(envName, config) {
90
+ const projectConfig = config ?? loadConfig();
91
+ if (projectConfig?.environments) {
92
+ const envConfig = projectConfig.environments[envName];
93
+ if (envConfig) {
94
+ return envConfig;
95
+ }
96
+ }
97
+ // Return defaults for known environment names
98
+ if (envName === 'local') {
99
+ return DEFAULT_LOCAL_ENV;
100
+ }
101
+ // For 'ic' or 'mainnet', return a mainnet default
102
+ if (envName === 'ic' || envName === 'mainnet') {
103
+ return {
104
+ name: envName,
105
+ network: { type: 'ic' },
106
+ cycles: { initial: '1T' },
107
+ };
108
+ }
109
+ // Unknown environment - return local defaults with a type based on name
110
+ return DEFAULT_LOCAL_ENV;
111
+ }
112
+ /**
113
+ * Get the optimization configuration.
114
+ *
115
+ * @param config - Project configuration (will be loaded if not provided)
116
+ * @returns Optimization configuration
117
+ */
118
+ export function getOptimizationConfig(config) {
119
+ const projectConfig = config ?? loadConfig();
120
+ return projectConfig?.optimization ?? DEFAULT_OPTIMIZATION;
121
+ }
122
+ /**
123
+ * List all defined environment names.
124
+ *
125
+ * @param config - Project configuration (will be loaded if not provided)
126
+ * @returns Array of environment names
127
+ */
128
+ export function listEnvironments(config) {
129
+ const projectConfig = config ?? loadConfig();
130
+ if (projectConfig?.environments) {
131
+ return Object.keys(projectConfig.environments);
132
+ }
133
+ return ['local'];
134
+ }
135
+ /**
136
+ * Write an icp.yaml configuration file.
137
+ *
138
+ * @param config - Configuration to write
139
+ * @param outputPath - Path to write to (defaults to ./icp.yaml)
140
+ */
141
+ export function writeConfig(config, outputPath) {
142
+ const targetPath = outputPath ?? path.join(process.cwd(), 'icp.yaml');
143
+ const content = YAML.stringify(config, { indent: 2 });
144
+ fs.writeFileSync(targetPath, content, 'utf-8');
145
+ }
146
+ /**
147
+ * Generate a default icp.yaml configuration.
148
+ *
149
+ * @returns Default project configuration with local, dev, staging, production environments
150
+ */
151
+ export function generateDefaultConfig() {
152
+ return {
153
+ name: 'agentvault-project',
154
+ defaultEnvironment: 'local',
155
+ environments: {
156
+ local: {
157
+ name: 'local',
158
+ network: { type: 'local', replicaCount: 4 },
159
+ cycles: { initial: '100T' },
160
+ },
161
+ dev: {
162
+ name: 'dev',
163
+ network: { type: 'ic', replicaCount: 13 },
164
+ cycles: { initial: '1T' },
165
+ identity: 'dev-wallet',
166
+ },
167
+ staging: {
168
+ name: 'staging',
169
+ network: { type: 'ic', replicaCount: 28 },
170
+ cycles: { initial: '10T' },
171
+ identity: 'staging-wallet',
172
+ },
173
+ production: {
174
+ name: 'production',
175
+ network: { type: 'ic', replicaCount: 28 },
176
+ cycles: { initial: '100T' },
177
+ identity: 'main-wallet',
178
+ },
179
+ },
180
+ optimization: DEFAULT_OPTIMIZATION,
181
+ };
182
+ }
183
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1,204 @@
1
+ /**
2
+ * icp-cli Wrapper
3
+ *
4
+ * TypeScript wrapper around the icp CLI tool (v0.1.0).
5
+ * The binary name is `icp` (not `icp-cli`).
6
+ *
7
+ * Provides typed interfaces for build, deploy, canister operations,
8
+ * cycles management, identity management, network management,
9
+ * token operations, sync, and environment queries.
10
+ */
11
+ import type { IcpCliResult, IcpBuildOptions, IcpDeployOptions, IcpCanisterStatusOptions, IcpCanisterCallOptions, IcpCyclesBalanceOptions, IcpCyclesMintOptions, IcpCyclesTransferOptions, IcpIdentityListOptions, IcpIdentityNewOptions, IcpIdentityExportOptions, IcpIdentityImportOptions, IcpNetworkStartOptions, IcpNetworkStopOptions, IcpSyncOptions, IcpTokenBalanceOptions, IcpTokenTransferOptions, IcpEnvironmentListOptions, IcpCommonOptions } from './types.js';
12
+ /**
13
+ * Build canisters using icp build.
14
+ *
15
+ * @param options - Build options
16
+ * @returns Command result
17
+ */
18
+ export declare function build(options?: IcpBuildOptions): Promise<IcpCliResult>;
19
+ /**
20
+ * Deploy project to an environment.
21
+ *
22
+ * @param options - Deploy options
23
+ * @returns Command result
24
+ */
25
+ export declare function deploy(options?: IcpDeployOptions): Promise<IcpCliResult>;
26
+ /**
27
+ * Get canister status.
28
+ *
29
+ * @param options - Canister status options
30
+ * @returns Command result with status in stdout
31
+ */
32
+ export declare function canisterStatus(options: IcpCanisterStatusOptions): Promise<IcpCliResult>;
33
+ /**
34
+ * Call a canister method.
35
+ *
36
+ * @param options - Canister call options
37
+ * @returns Command result with response in stdout
38
+ */
39
+ export declare function canisterCall(options: IcpCanisterCallOptions): Promise<IcpCliResult>;
40
+ /**
41
+ * List canisters in the project.
42
+ *
43
+ * @param options - Common options
44
+ * @returns Command result with canister list in stdout
45
+ */
46
+ export declare function canisterList(options?: IcpCommonOptions): Promise<IcpCliResult>;
47
+ /**
48
+ * Start a stopped canister.
49
+ *
50
+ * @param canister - Canister ID or name
51
+ * @param options - Common options
52
+ * @returns Command result
53
+ */
54
+ export declare function canisterStart(canister: string, options?: IcpCommonOptions): Promise<IcpCliResult>;
55
+ /**
56
+ * Stop a running canister.
57
+ *
58
+ * @param canister - Canister ID or name
59
+ * @param options - Common options
60
+ * @returns Command result
61
+ */
62
+ export declare function canisterStop(canister: string, options?: IcpCommonOptions): Promise<IcpCliResult>;
63
+ /**
64
+ * Delete a canister.
65
+ *
66
+ * @param canister - Canister ID or name
67
+ * @param options - Common options
68
+ * @returns Command result
69
+ */
70
+ export declare function canisterDelete(canister: string, options?: IcpCommonOptions): Promise<IcpCliResult>;
71
+ /**
72
+ * Check cycle balance of a canister.
73
+ *
74
+ * @param options - Cycles balance options
75
+ * @returns Command result with balance in stdout
76
+ */
77
+ export declare function cyclesBalance(options: IcpCyclesBalanceOptions): Promise<IcpCliResult>;
78
+ /**
79
+ * Mint cycles.
80
+ *
81
+ * @param options - Mint options
82
+ * @returns Command result
83
+ */
84
+ export declare function cyclesMint(options: IcpCyclesMintOptions): Promise<IcpCliResult>;
85
+ /**
86
+ * Transfer cycles to a canister.
87
+ *
88
+ * @param options - Transfer options
89
+ * @returns Command result
90
+ */
91
+ export declare function cyclesTransfer(options: IcpCyclesTransferOptions): Promise<IcpCliResult>;
92
+ /**
93
+ * List available identities.
94
+ *
95
+ * @param options - Common options
96
+ * @returns Command result with identity list in stdout
97
+ */
98
+ export declare function identityList(options?: IcpIdentityListOptions): Promise<IcpCliResult>;
99
+ /**
100
+ * Create a new identity.
101
+ *
102
+ * @param options - New identity options
103
+ * @returns Command result
104
+ */
105
+ export declare function identityNew(options: IcpIdentityNewOptions): Promise<IcpCliResult>;
106
+ /**
107
+ * Export an identity.
108
+ *
109
+ * @param options - Export options
110
+ * @returns Command result with PEM data in stdout
111
+ */
112
+ export declare function identityExport(options: IcpIdentityExportOptions): Promise<IcpCliResult>;
113
+ /**
114
+ * Import an identity from a PEM file.
115
+ *
116
+ * @param options - Import options
117
+ * @returns Command result
118
+ */
119
+ export declare function identityImport(options: IcpIdentityImportOptions): Promise<IcpCliResult>;
120
+ /**
121
+ * Get the principal of the current or named identity.
122
+ *
123
+ * @param options - Common options (use identity field to specify which identity)
124
+ * @returns Command result with principal in stdout
125
+ */
126
+ export declare function identityPrincipal(options?: IcpCommonOptions): Promise<IcpCliResult>;
127
+ /**
128
+ * Get the default identity name.
129
+ *
130
+ * @param options - Common options
131
+ * @returns Command result with default identity name in stdout
132
+ */
133
+ export declare function identityDefault(options?: IcpCommonOptions): Promise<IcpCliResult>;
134
+ /**
135
+ * Start a local test network.
136
+ *
137
+ * @param options - Network start options
138
+ * @returns Command result
139
+ */
140
+ export declare function networkStart(options?: IcpNetworkStartOptions): Promise<IcpCliResult>;
141
+ /**
142
+ * Stop a local test network.
143
+ *
144
+ * @param options - Network stop options
145
+ * @returns Command result
146
+ */
147
+ export declare function networkStop(options?: IcpNetworkStopOptions): Promise<IcpCliResult>;
148
+ /**
149
+ * Get network status.
150
+ *
151
+ * @param options - Common options
152
+ * @returns Command result with status in stdout
153
+ */
154
+ export declare function networkStatus(options?: IcpCommonOptions): Promise<IcpCliResult>;
155
+ /**
156
+ * List available networks.
157
+ *
158
+ * @param options - Common options
159
+ * @returns Command result with network list in stdout
160
+ */
161
+ export declare function networkList(options?: IcpCommonOptions): Promise<IcpCliResult>;
162
+ /**
163
+ * Ping a network to check connectivity.
164
+ *
165
+ * @param options - Common options
166
+ * @returns Command result
167
+ */
168
+ export declare function networkPing(options?: IcpCommonOptions): Promise<IcpCliResult>;
169
+ /**
170
+ * Synchronize canisters with the network.
171
+ *
172
+ * @param options - Sync options
173
+ * @returns Command result
174
+ */
175
+ export declare function sync(options?: IcpSyncOptions): Promise<IcpCliResult>;
176
+ /**
177
+ * Get token balance.
178
+ *
179
+ * @param options - Token balance options
180
+ * @returns Command result with balance in stdout
181
+ */
182
+ export declare function tokenBalance(options?: IcpTokenBalanceOptions): Promise<IcpCliResult>;
183
+ /**
184
+ * Transfer tokens.
185
+ *
186
+ * @param options - Token transfer options
187
+ * @returns Command result
188
+ */
189
+ export declare function tokenTransfer(options: IcpTokenTransferOptions): Promise<IcpCliResult>;
190
+ /**
191
+ * List project environments.
192
+ *
193
+ * @param options - Common options
194
+ * @returns Command result with environments in stdout
195
+ */
196
+ export declare function environmentList(options?: IcpEnvironmentListOptions): Promise<IcpCliResult>;
197
+ /**
198
+ * Show project information (effective YAML config).
199
+ *
200
+ * @param options - Common options
201
+ * @returns Command result with project info in stdout
202
+ */
203
+ export declare function projectShow(options?: IcpCommonOptions): Promise<IcpCliResult>;
204
+ //# sourceMappingURL=icpcli.d.ts.map