agentvault 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/.dfx/local/network-id +4 -0
  2. package/.next/trace +2 -0
  3. package/.vercel/README.txt +11 -0
  4. package/.vercel/project.json +1 -0
  5. package/AGENTS.md +43 -0
  6. package/CHANGELOG.md +196 -0
  7. package/LICENSE +21 -0
  8. package/PLAN_VAULT_INTEGRATION.md +318 -0
  9. package/README.md +253 -0
  10. package/backups/agentvault-backup-test-agent-2026-02-12T17-54-28-967Z.json +28 -0
  11. package/backups/agentvault-backup-test-agent-2026-02-12T17-54-29-032Z.backup +1 -0
  12. package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-373Z.json +28 -0
  13. package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-428Z.backup +1 -0
  14. package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-132Z.json +28 -0
  15. package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-247Z.backup +1 -0
  16. package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-216Z.json +28 -0
  17. package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-283Z.backup +1 -0
  18. package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-772Z.backup +1 -0
  19. package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-793Z.json +28 -0
  20. package/backups/test-backup.json +28 -0
  21. package/dist/cli/commands/approve.d.ts +4 -0
  22. package/dist/cli/commands/approve.js +232 -0
  23. package/dist/cli/commands/archive.d.ts +4 -0
  24. package/dist/cli/commands/archive.js +192 -0
  25. package/dist/cli/commands/backup.d.ts +4 -0
  26. package/dist/cli/commands/backup.js +164 -0
  27. package/dist/cli/commands/cloud-backup.d.ts +4 -0
  28. package/dist/cli/commands/cloud-backup.js +221 -0
  29. package/dist/cli/commands/cycles.d.ts +8 -0
  30. package/dist/cli/commands/cycles.js +83 -0
  31. package/dist/cli/commands/decrypt.d.ts +16 -0
  32. package/dist/cli/commands/decrypt.js +101 -0
  33. package/dist/cli/commands/deploy.d.ts +32 -0
  34. package/dist/cli/commands/deploy.js +208 -0
  35. package/dist/cli/commands/exec.d.ts +26 -0
  36. package/dist/cli/commands/exec.js +109 -0
  37. package/dist/cli/commands/fetch.d.ts +23 -0
  38. package/dist/cli/commands/fetch.js +164 -0
  39. package/dist/cli/commands/health.d.ts +8 -0
  40. package/dist/cli/commands/health.js +72 -0
  41. package/dist/cli/commands/identity.d.ts +8 -0
  42. package/dist/cli/commands/identity.js +140 -0
  43. package/dist/cli/commands/inference.d.ts +4 -0
  44. package/dist/cli/commands/inference.js +225 -0
  45. package/dist/cli/commands/info.d.ts +8 -0
  46. package/dist/cli/commands/info.js +59 -0
  47. package/dist/cli/commands/init.d.ts +19 -0
  48. package/dist/cli/commands/init.js +135 -0
  49. package/dist/cli/commands/instrument.d.ts +8 -0
  50. package/dist/cli/commands/instrument.js +35 -0
  51. package/dist/cli/commands/list.d.ts +36 -0
  52. package/dist/cli/commands/list.js +173 -0
  53. package/dist/cli/commands/logs.d.ts +8 -0
  54. package/dist/cli/commands/logs.js +96 -0
  55. package/dist/cli/commands/monitor.d.ts +8 -0
  56. package/dist/cli/commands/monitor.js +84 -0
  57. package/dist/cli/commands/network.d.ts +14 -0
  58. package/dist/cli/commands/network.js +258 -0
  59. package/dist/cli/commands/package.d.ts +36 -0
  60. package/dist/cli/commands/package.js +188 -0
  61. package/dist/cli/commands/profile.d.ts +8 -0
  62. package/dist/cli/commands/profile.js +76 -0
  63. package/dist/cli/commands/promote.d.ts +8 -0
  64. package/dist/cli/commands/promote.js +89 -0
  65. package/dist/cli/commands/rebuild.d.ts +21 -0
  66. package/dist/cli/commands/rebuild.js +140 -0
  67. package/dist/cli/commands/rollback.d.ts +8 -0
  68. package/dist/cli/commands/rollback.js +120 -0
  69. package/dist/cli/commands/show.d.ts +36 -0
  70. package/dist/cli/commands/show.js +200 -0
  71. package/dist/cli/commands/stats.d.ts +8 -0
  72. package/dist/cli/commands/stats.js +34 -0
  73. package/dist/cli/commands/status.d.ts +14 -0
  74. package/dist/cli/commands/status.js +83 -0
  75. package/dist/cli/commands/test.d.ts +8 -0
  76. package/dist/cli/commands/test.js +109 -0
  77. package/dist/cli/commands/tokens.d.ts +8 -0
  78. package/dist/cli/commands/tokens.js +62 -0
  79. package/dist/cli/commands/trace.d.ts +8 -0
  80. package/dist/cli/commands/trace.js +68 -0
  81. package/dist/cli/commands/wallet-export.d.ts +13 -0
  82. package/dist/cli/commands/wallet-export.js +140 -0
  83. package/dist/cli/commands/wallet-history.d.ts +10 -0
  84. package/dist/cli/commands/wallet-history.js +127 -0
  85. package/dist/cli/commands/wallet-import.d.ts +10 -0
  86. package/dist/cli/commands/wallet-import.js +209 -0
  87. package/dist/cli/commands/wallet-multi-send.d.ts +17 -0
  88. package/dist/cli/commands/wallet-multi-send.js +195 -0
  89. package/dist/cli/commands/wallet-process-queue.d.ts +19 -0
  90. package/dist/cli/commands/wallet-process-queue.js +209 -0
  91. package/dist/cli/commands/wallet-sign.d.ts +13 -0
  92. package/dist/cli/commands/wallet-sign.js +207 -0
  93. package/dist/cli/commands/wallet.d.ts +12 -0
  94. package/dist/cli/commands/wallet.js +794 -0
  95. package/dist/cli/index.d.ts +10 -0
  96. package/dist/cli/index.js +96 -0
  97. package/dist/vitest.config.d.ts +3 -0
  98. package/dist/vitest.config.js +14 -0
  99. package/fixup_1_0_OSS_release.md +136 -0
  100. package/fixup_REALEASE_PRD.md +136 -0
  101. package/package.json +79 -0
  102. package/pnpm-workspace.yaml +5 -0
  103. package/scripts/dev-dashboard.mjs +84 -0
  104. package/site/README.md +63 -0
  105. package/site/docusaurus.config.ts +148 -0
  106. package/site/package-lock.json +18383 -0
  107. package/site/package.json +47 -0
  108. package/site/sidebars.ts +86 -0
  109. package/site/static/.gitkeep +0 -0
  110. package/site/static/img/logo.svg +28 -0
  111. package/site/static/img/og-image.svg +35 -0
  112. package/src/archival/archive-manager.ts +372 -0
  113. package/src/archival/arweave-client.ts +289 -0
  114. package/src/archival/index.ts +8 -0
  115. package/src/backup/backup.ts +315 -0
  116. package/src/backup/index.ts +7 -0
  117. package/src/cloud-storage/cloud-sync.ts +461 -0
  118. package/src/cloud-storage/index.ts +11 -0
  119. package/src/cloud-storage/provider-detector.ts +198 -0
  120. package/src/cloud-storage/types.ts +104 -0
  121. package/src/debugging/index.ts +6 -0
  122. package/src/debugging/logs.ts +193 -0
  123. package/src/debugging/types.ts +100 -0
  124. package/src/deployment/deployer.ts +274 -0
  125. package/src/deployment/icpClient.ts +620 -0
  126. package/src/deployment/index.ts +46 -0
  127. package/src/deployment/promotion.ts +161 -0
  128. package/src/deployment/types.ts +111 -0
  129. package/src/icp/batch.ts +374 -0
  130. package/src/icp/cycles.ts +50 -0
  131. package/src/icp/environment.ts +215 -0
  132. package/src/icp/icpcli.ts +438 -0
  133. package/src/icp/icwasm.ts +222 -0
  134. package/src/icp/identity.ts +77 -0
  135. package/src/icp/index.ts +94 -0
  136. package/src/icp/optimization.ts +242 -0
  137. package/src/icp/tokens.ts +36 -0
  138. package/src/icp/tool-detector.ts +110 -0
  139. package/src/icp/types.ts +574 -0
  140. package/src/index.ts +25 -0
  141. package/src/inference/bittensor-client.ts +304 -0
  142. package/src/inference/index.ts +8 -0
  143. package/src/inference/inference-manager.ts +327 -0
  144. package/src/metrics/index.ts +7 -0
  145. package/src/metrics/metrics.ts +186 -0
  146. package/src/monitoring/alerting.ts +190 -0
  147. package/src/monitoring/health.ts +197 -0
  148. package/src/monitoring/index.ts +38 -0
  149. package/src/monitoring/info.ts +114 -0
  150. package/src/monitoring/types.ts +99 -0
  151. package/src/network/index.ts +5 -0
  152. package/src/network/network-config.ts +129 -0
  153. package/src/packaging/compiler.ts +647 -0
  154. package/src/packaging/config-persistence.ts +135 -0
  155. package/src/packaging/config-schemas.ts +156 -0
  156. package/src/packaging/detector.ts +220 -0
  157. package/src/packaging/index.ts +90 -0
  158. package/src/packaging/packager.ts +118 -0
  159. package/src/packaging/parsers/clawdbot.ts +278 -0
  160. package/src/packaging/parsers/cline.ts +223 -0
  161. package/src/packaging/parsers/generic.ts +266 -0
  162. package/src/packaging/parsers/goose.ts +214 -0
  163. package/src/packaging/parsers/index.ts +11 -0
  164. package/src/packaging/serializer.ts +260 -0
  165. package/src/packaging/types.ts +144 -0
  166. package/src/packaging/wasmedge-compiler.ts +406 -0
  167. package/src/security/index.ts +17 -0
  168. package/src/security/multisig.ts +415 -0
  169. package/src/security/types.ts +416 -0
  170. package/src/security/vetkeys.ts +655 -0
  171. package/src/testing/index.ts +6 -0
  172. package/src/testing/local-runner.ts +264 -0
  173. package/src/testing/types.ts +104 -0
  174. package/src/wallet/cbor-serializer.ts +323 -0
  175. package/src/wallet/chain-dispatcher.ts +313 -0
  176. package/src/wallet/cross-chain-aggregator.ts +346 -0
  177. package/src/wallet/index.ts +76 -0
  178. package/src/wallet/key-derivation.ts +425 -0
  179. package/src/wallet/providers/base-provider.ts +154 -0
  180. package/src/wallet/providers/cketh-provider.ts +434 -0
  181. package/src/wallet/providers/polkadot-provider.ts +503 -0
  182. package/src/wallet/providers/solana-provider.ts +490 -0
  183. package/src/wallet/transaction-queue.ts +284 -0
  184. package/src/wallet/types.ts +178 -0
  185. package/src/wallet/vetkeys-adapter.ts +431 -0
  186. package/src/wallet/wallet-manager.ts +597 -0
  187. package/src/wallet/wallet-storage.ts +380 -0
  188. package/vercel.json +8 -0
@@ -0,0 +1,225 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import ora from 'ora';
4
+ import { BittensorClient, getCachedInference, setCachedInference, clearCache, getCacheStats, formatInferenceTime, } from '../../src/inference/index.js';
5
+ const inferenceCmd = new Command('inference');
6
+ inferenceCmd
7
+ .description('[Experimental] Query AI inference services (Bittensor network)')
8
+ .action(async () => {
9
+ console.log(chalk.yellow('[Experimental] This feature is under active development and may change.'));
10
+ console.log(chalk.yellow('Please specify a subcommand: query, subnets, modules, cache, or stats'));
11
+ console.log(chalk.gray(`\nExamples:
12
+ ${chalk.cyan('soulrecall inference query <netuid> <inputs>')}${chalk.gray(' Query inference')}
13
+ ${chalk.cyan('soulrecall inference subnets')}${chalk.gray(' List Bittensor subnets')}
14
+ ${chalk.cyan('soulrecall inference modules <netuid>')}${chalk.gray(' List subnet modules')}
15
+ ${chalk.cyan('soulrecall inference cache clear')}${chalk.gray(' Clear inference cache')}
16
+ ${chalk.cyan('soulrecall inference cache stats')}${chalk.gray(' Show cache statistics')}`));
17
+ });
18
+ inferenceCmd
19
+ .command('query')
20
+ .description('Query AI inference from Bittensor network')
21
+ .argument('<netuid>', 'Subnet UID')
22
+ .argument('<inputs>', 'Inference inputs (JSON string)')
23
+ .option('--uid <number>', 'Module UID (defaults to best module)')
24
+ .option('--batch <number>', 'Query multiple modules (default: 1)', '1')
25
+ .option('--timeout <ms>', 'Request timeout', '30000')
26
+ .option('--no-cache', 'Disable caching', false)
27
+ .action(async (netuidArg, inputsArg, options) => {
28
+ const spinner = ora(`Querying subnet ${netuidArg}...`).start();
29
+ try {
30
+ const netuid = parseInt(netuidArg, 10);
31
+ if (isNaN(netuid)) {
32
+ spinner.fail(chalk.red('Invalid netuid'));
33
+ process.exit(1);
34
+ }
35
+ const inputs = JSON.parse(inputsArg);
36
+ const config = {
37
+ netuid,
38
+ uid: options.uid ? parseInt(options.uid, 10) : undefined,
39
+ batchSize: parseInt(options.batch, 10),
40
+ timeout: parseInt(options.timeout, 10),
41
+ enableCache: !options.noCache,
42
+ };
43
+ const client = new BittensorClient();
44
+ if (!options.noCache) {
45
+ const cached = getCachedInference(netuid, inputs);
46
+ if (cached) {
47
+ spinner.succeed(chalk.green('Using cached result'));
48
+ console.log(chalk.gray(`Cached at: ${cached.timestamp.toLocaleString()}`));
49
+ console.log(chalk.gray(`Expires: ${cached.expiresAt.toLocaleString()}`));
50
+ console.log(JSON.stringify(cached.result, null, 2));
51
+ return;
52
+ }
53
+ }
54
+ const batchSize = config.batchSize || 1;
55
+ const startTime = Date.now();
56
+ const inference = async () => {
57
+ if (config.uid) {
58
+ return client.infer({ netuid, uid: config.uid, inputs });
59
+ }
60
+ else if (batchSize > 1) {
61
+ const results = await client.batchInfer({ netuid, inputs }, batchSize);
62
+ return {
63
+ success: results.length > 0,
64
+ data: results[0]?.data,
65
+ metadata: results[0]?.metadata,
66
+ };
67
+ }
68
+ else {
69
+ const bestModule = await client.findBestModule(netuid);
70
+ if (!bestModule) {
71
+ return { success: false, error: 'No modules found' };
72
+ }
73
+ return client.infer({ netuid, uid: bestModule.uid, inputs });
74
+ }
75
+ };
76
+ const response = await inference();
77
+ const responseTime = Date.now() - startTime;
78
+ if (response.success) {
79
+ spinner.succeed(chalk.green(`Inference complete (${formatInferenceTime(responseTime)})`));
80
+ console.log(JSON.stringify(response.data, null, 2));
81
+ if (response.metadata) {
82
+ console.log(chalk.gray(`\nModule: ${response.metadata.name} (${response.metadata.uid})`));
83
+ console.log(chalk.gray(`Response time: ${formatInferenceTime(response.metadata.responseTime)}`));
84
+ }
85
+ if (!options.noCache && response.data) {
86
+ setCachedInference(netuid, inputs, response.data, 3600000);
87
+ }
88
+ }
89
+ else {
90
+ spinner.fail(chalk.red('Inference failed'));
91
+ if (response.error) {
92
+ console.error(chalk.red(response.error));
93
+ }
94
+ process.exit(1);
95
+ }
96
+ }
97
+ catch (error) {
98
+ spinner.fail(chalk.red('Inference query failed'));
99
+ const message = error instanceof Error ? error.message : 'Unknown error';
100
+ console.error(chalk.red(message));
101
+ process.exit(1);
102
+ }
103
+ });
104
+ inferenceCmd
105
+ .command('subnets')
106
+ .description('List Bittensor subnets')
107
+ .action(async () => {
108
+ const spinner = ora('Loading subnets...').start();
109
+ try {
110
+ const client = new BittensorClient();
111
+ const subnets = await client.getSubnets();
112
+ spinner.succeed(chalk.green(`Found ${subnets.length} subnet(s)`));
113
+ if (subnets.length === 0) {
114
+ console.log(chalk.gray('No subnets found'));
115
+ return;
116
+ }
117
+ for (const subnet of subnets) {
118
+ console.log(`\n${chalk.bold(`NetUID: ${subnet.netuid}`)}`);
119
+ console.log(` Name: ${subnet.name}`);
120
+ console.log(` Modality: ${subnet.modality}`);
121
+ console.log(` Registered: ${subnet.registered} modules`);
122
+ console.log(` Tempo: ${subnet.tempo}`);
123
+ }
124
+ }
125
+ catch (error) {
126
+ spinner.fail(chalk.red('Failed to list subnets'));
127
+ const message = error instanceof Error ? error.message : 'Unknown error';
128
+ console.error(chalk.red(message));
129
+ process.exit(1);
130
+ }
131
+ });
132
+ inferenceCmd
133
+ .command('modules')
134
+ .description('List modules for a subnet')
135
+ .argument('<netuid>', 'Subnet UID')
136
+ .action(async (netuidArg) => {
137
+ const spinner = ora(`Loading modules for subnet ${netuidArg}...`).start();
138
+ try {
139
+ const client = new BittensorClient();
140
+ const netuid = parseInt(netuidArg, 10);
141
+ const modules = await client.getModules(netuid);
142
+ spinner.succeed(chalk.green(`Found ${modules.length} module(s)`));
143
+ if (modules.length === 0) {
144
+ console.log(chalk.gray('No modules found'));
145
+ return;
146
+ }
147
+ const sorted = modules.sort((a, b) => b.rank - a.rank);
148
+ for (const module of sorted.slice(0, 20)) {
149
+ const status = module.validator_permit ? chalk.green('✓') : chalk.gray('○');
150
+ console.log(`${status} ${chalk.bold(`UID ${module.uid}`)}: ${module.name || 'Unnamed'} (Rank: ${module.rank})`);
151
+ }
152
+ if (modules.length > 20) {
153
+ console.log(chalk.gray(`\n... and ${modules.length - 20} more`));
154
+ }
155
+ }
156
+ catch (error) {
157
+ spinner.fail(chalk.red('Failed to list modules'));
158
+ const message = error instanceof Error ? error.message : 'Unknown error';
159
+ console.error(chalk.red(message));
160
+ process.exit(1);
161
+ }
162
+ });
163
+ inferenceCmd
164
+ .command('cache')
165
+ .description('Manage inference cache')
166
+ .argument('<action>', 'Action: clear or stats')
167
+ .action(async (action) => {
168
+ switch (action) {
169
+ case 'clear': {
170
+ const spinner = ora('Clearing cache...').start();
171
+ clearCache();
172
+ spinner.succeed(chalk.green('Cache cleared'));
173
+ break;
174
+ }
175
+ case 'stats':
176
+ try {
177
+ const stats = getCacheStats();
178
+ console.log(chalk.bold('\nCache Statistics:'));
179
+ console.log(` Total entries: ${stats.total}`);
180
+ console.log(` Expired: ${stats.expired}`);
181
+ console.log(` Size: ${(stats.sizeBytes / 1024 / 1024).toFixed(2)} MB`);
182
+ }
183
+ catch (error) {
184
+ console.error(chalk.red('Failed to get cache stats'));
185
+ const message = error instanceof Error ? error.message : 'Unknown error';
186
+ console.error(chalk.red(message));
187
+ process.exit(1);
188
+ }
189
+ break;
190
+ default:
191
+ console.log(chalk.red('Invalid action. Use "clear" or "stats"'));
192
+ process.exit(1);
193
+ }
194
+ });
195
+ inferenceCmd
196
+ .command('health')
197
+ .description('Check Bittensor API health')
198
+ .action(async () => {
199
+ const spinner = ora('Checking API health...').start();
200
+ try {
201
+ const client = new BittensorClient();
202
+ const status = await client.getApiStatus();
203
+ if (status.online) {
204
+ spinner.succeed(chalk.green('Bittensor API is online'));
205
+ if (status.version) {
206
+ console.log(chalk.gray(`API version: ${status.version}`));
207
+ }
208
+ }
209
+ else {
210
+ spinner.fail(chalk.red('Bittensor API is offline'));
211
+ if (status.error) {
212
+ console.error(chalk.red(status.error));
213
+ }
214
+ process.exit(1);
215
+ }
216
+ }
217
+ catch (error) {
218
+ spinner.fail(chalk.red('Failed to check API health'));
219
+ const message = error instanceof Error ? error.message : 'Unknown error';
220
+ console.error(chalk.red(message));
221
+ process.exit(1);
222
+ }
223
+ });
224
+ export { inferenceCmd };
225
+ //# sourceMappingURL=inference.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Info Command
3
+ *
4
+ * Displays detailed canister information.
5
+ */
6
+ import { Command } from 'commander';
7
+ export declare function infoCommand(): Command;
8
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Info Command
3
+ *
4
+ * Displays detailed canister information.
5
+ */
6
+ import { Command } from 'commander';
7
+ import chalk from 'chalk';
8
+ import ora from 'ora';
9
+ import { getCanisterInfo } from '../../src/monitoring/info.js';
10
+ export function infoCommand() {
11
+ const command = new Command('info');
12
+ command
13
+ .description('Display canister information and status')
14
+ .argument('<canister-id>', 'Canister ID to query')
15
+ .option('-t, --thresholds <json>', 'Health check thresholds as JSON')
16
+ .option('-i, --interval <ms>', 'Polling interval in milliseconds')
17
+ .option('--max-alerts <n>', 'Maximum number of alerts to display');
18
+ command
19
+ .action(async (canisterId, options) => {
20
+ const thresholds = options.thresholds ? JSON.parse(options.thresholds) : undefined;
21
+ const monitoringOpts = {
22
+ canister: canisterId,
23
+ thresholds,
24
+ pollInterval: options.interval ? parseInt(options.interval) : undefined,
25
+ maxSnapshots: options.maxAlerts ? parseInt(options.maxAlerts) : undefined,
26
+ };
27
+ const spinner = ora('Fetching canister info...').start();
28
+ try {
29
+ const statusInfo = await getCanisterInfo(canisterId, monitoringOpts);
30
+ spinner.succeed('Canister info retrieved successfully');
31
+ displayInfo(statusInfo);
32
+ }
33
+ catch (error) {
34
+ const message = error instanceof Error ? error.message : 'Unknown error';
35
+ spinner.fail(`Failed to fetch info: ${message}`);
36
+ throw error;
37
+ }
38
+ });
39
+ return command;
40
+ }
41
+ function displayInfo(statusInfo) {
42
+ console.log();
43
+ console.log(chalk.cyan('Canister ID:'), chalk.bold(statusInfo.canisterId));
44
+ console.log();
45
+ console.log(chalk.cyan('Status:'), chalk.bold(statusInfo.status));
46
+ if (statusInfo.memorySize !== undefined) {
47
+ const memoryMB = Number(statusInfo.memorySize) / (1024 * 1024);
48
+ console.log(chalk.cyan('Memory:'), chalk.bold(`${memoryMB.toFixed(2)} MB`));
49
+ }
50
+ if (statusInfo.cycles !== undefined) {
51
+ console.log(chalk.cyan('Cycles:'), chalk.bold(statusInfo.cycles.toString()));
52
+ }
53
+ if (statusInfo.moduleHash !== undefined) {
54
+ console.log(chalk.cyan('WASM Hash:'), chalk.bold(statusInfo.moduleHash.substring(0, 16)));
55
+ }
56
+ console.log();
57
+ console.log(chalk.cyan('Timestamp:'), statusInfo.timestamp?.toISOString() || 'N/A');
58
+ }
59
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Init command - Initialize a new SoulRecall project
3
+ */
4
+ import { Command } from 'commander';
5
+ export interface InitOptions {
6
+ name?: string;
7
+ yes?: boolean;
8
+ verbose?: boolean;
9
+ v?: boolean;
10
+ }
11
+ export interface InitAnswers {
12
+ name: string;
13
+ description: string;
14
+ confirm: boolean;
15
+ }
16
+ export declare function promptForInitOptions(options: InitOptions): Promise<InitAnswers | null>;
17
+ export declare function executeInit(answers: InitAnswers, _options: InitOptions, sourcePath: string): Promise<void>;
18
+ export declare function initCommand(): Command;
19
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Init command - Initialize a new SoulRecall project
3
+ */
4
+ import * as path from 'node:path';
5
+ import * as fs from 'node:fs';
6
+ import { Command } from 'commander';
7
+ import inquirer from 'inquirer';
8
+ import chalk from 'chalk';
9
+ import ora from 'ora';
10
+ export async function promptForInitOptions(options) {
11
+ // If --yes flag is provided, use defaults
12
+ if (options.yes) {
13
+ return {
14
+ name: options.name ?? 'my-agent',
15
+ description: 'An SoulRecall agent',
16
+ confirm: true,
17
+ };
18
+ }
19
+ const answers = await inquirer.prompt([
20
+ {
21
+ type: 'input',
22
+ name: 'name',
23
+ message: 'What is the name of your agent?',
24
+ default: options.name ?? 'my-agent',
25
+ validate: (input) => {
26
+ if (!input.trim()) {
27
+ return 'Agent name is required';
28
+ }
29
+ if (!/^[a-z0-9-]+$/.test(input)) {
30
+ return 'Agent name must be lowercase alphanumeric with hyphens only';
31
+ }
32
+ return true;
33
+ },
34
+ },
35
+ {
36
+ type: 'input',
37
+ name: 'description',
38
+ message: 'Provide a description for your agent:',
39
+ default: 'An SoulRecall agent',
40
+ },
41
+ {
42
+ type: 'confirm',
43
+ name: 'confirm',
44
+ message: 'Create agent with these settings?',
45
+ default: true,
46
+ },
47
+ ]);
48
+ return answers;
49
+ }
50
+ export async function executeInit(answers, _options, sourcePath) {
51
+ const spinner = ora('Initializing SoulRecall project...').start();
52
+ const projectDir = path.resolve(sourcePath, '.soulrecall');
53
+ const agentDir = path.join(projectDir, 'agent');
54
+ const canisterDir = path.join(projectDir, 'canister');
55
+ const configDir = path.join(projectDir, 'config');
56
+ const srcDir = path.join(projectDir, 'src');
57
+ const canisterWasmDir = path.join(canisterDir, 'wasm');
58
+ const directories = [agentDir, canisterDir, configDir, srcDir, canisterWasmDir];
59
+ for (const dir of directories) {
60
+ if (!fs.existsSync(dir)) {
61
+ fs.mkdirSync(dir, { recursive: true });
62
+ }
63
+ }
64
+ const configPath = path.join(configDir, 'agent.config.json');
65
+ const configContent = {
66
+ name: answers.name,
67
+ type: 'generic',
68
+ version: '1.0.0',
69
+ createdAt: Date.now(),
70
+ description: answers.description || 'An SoulRecall agent',
71
+ };
72
+ fs.writeFileSync(configPath, JSON.stringify(configContent, null, 2), 'utf-8');
73
+ const gitignorePath = path.join(projectDir, '.gitignore');
74
+ const gitignoreContent = `# SoulRecall dependencies
75
+ node_modules/
76
+ dist/
77
+ *.log
78
+ .env
79
+ *.local
80
+ .DS_Store
81
+
82
+ # SoulRecall generated files
83
+ *.wasm
84
+ *.backup
85
+ *.state.json
86
+
87
+ # SoulRecall project structure
88
+ .soulrecall/
89
+ src/
90
+ canister/
91
+ config/
92
+ `;
93
+ fs.writeFileSync(gitignorePath, gitignoreContent, 'utf-8');
94
+ spinner.succeed('SoulRecall project initialized successfully!');
95
+ console.log();
96
+ console.log(chalk.green('✓'), 'Project initialized at:', chalk.bold(projectDir));
97
+ console.log(chalk.cyan('Directory structure:'));
98
+ console.log(' ├── src/', chalk.yellow('(agent source code)'));
99
+ console.log(' ├── canister/', chalk.yellow('(WASM files)'));
100
+ console.log(' ├── config/', chalk.yellow('(agent config)'));
101
+ console.log(' └── .gitignore', chalk.yellow('(git ignore file)'));
102
+ console.log();
103
+ console.log(chalk.cyan('Configuration:'));
104
+ console.log(' ├── Name:', chalk.bold(configContent.name));
105
+ console.log(' ├── Type:', chalk.bold(configContent.type));
106
+ console.log(' ├── Version:', chalk.bold(configContent.version));
107
+ console.log(' ├── Description:', chalk.bold(configContent.description));
108
+ console.log();
109
+ console.log(chalk.cyan('Next steps:'));
110
+ console.log(' 1. Run', chalk.bold('soulrecall status'), 'to check your project');
111
+ console.log(' 2. Configure your agent in', chalk.bold('agent.config.json'), '(add agent type, description, etc.)');
112
+ console.log(' 3. Compile agent with', chalk.bold('soulrecall package'), 'to prepare for deployment');
113
+ console.log(' 4. Deploy with', chalk.bold('soulrecall deploy'), 'to upload to ICP');
114
+ }
115
+ export function initCommand() {
116
+ const command = new Command('init');
117
+ command
118
+ .description('Initialize a new SoulRecall project')
119
+ .argument('[source]', 'path to agent source directory', '.')
120
+ .option('-n, --name <name>', 'name of the agent')
121
+ .option('-y, --yes', 'skip prompts and use defaults')
122
+ .option('-v, --verbose', 'display detailed configuration information')
123
+ .option('--vv', 'extra verbose mode for debugging')
124
+ .action(async (source, options) => {
125
+ console.log(chalk.bold('\n🔐 SoulRecall Project Initialization\n'));
126
+ const answers = await promptForInitOptions(options);
127
+ if (!answers || !answers.confirm) {
128
+ console.log(chalk.yellow('Initialization cancelled.'));
129
+ return;
130
+ }
131
+ await executeInit(answers, options, source);
132
+ });
133
+ return command;
134
+ }
135
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Instrument CLI command
3
+ *
4
+ * Provides command for instrumenting WASM files for debugging
5
+ */
6
+ import { Command } from 'commander';
7
+ export declare const instrumentCmd: Command;
8
+ //# sourceMappingURL=instrument.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Instrument CLI command
3
+ *
4
+ * Provides command for instrumenting WASM files for debugging
5
+ */
6
+ import { Command } from 'commander';
7
+ import chalk from 'chalk';
8
+ import ora from 'ora';
9
+ import { instrument } from '../../src/icp/icwasm.js';
10
+ export const instrumentCmd = new Command('instrument');
11
+ instrumentCmd
12
+ .description('Instrument WASM file for debugging')
13
+ .argument('<input-wasm>', 'Input WASM file path')
14
+ .option('-o, --output <path>', 'Output WASM file path')
15
+ .action(async (inputWasm, options) => {
16
+ const outputPath = options.output || inputWasm.replace(/\.wasm$/, '.instrumented.wasm');
17
+ const spinner = ora(`Instrumenting ${inputWasm}...`).start();
18
+ try {
19
+ const result = await instrument({ input: inputWasm, output: outputPath });
20
+ if (!result.success) {
21
+ spinner.fail(chalk.red('Instrumentation failed'));
22
+ console.error(chalk.red(result.stderr));
23
+ process.exit(1);
24
+ }
25
+ spinner.succeed(chalk.green(`Instrumented WASM saved to ${outputPath}`));
26
+ console.log(chalk.gray(result.stdout));
27
+ }
28
+ catch (error) {
29
+ spinner.fail(chalk.red('Failed to instrument WASM'));
30
+ const message = error instanceof Error ? error.message : 'Unknown error';
31
+ console.error(chalk.red(message));
32
+ process.exit(1);
33
+ }
34
+ });
35
+ //# sourceMappingURL=instrument.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * List command - List all agents
3
+ */
4
+ import { Command } from 'commander';
5
+ export interface ListCommandOptions {
6
+ all?: boolean;
7
+ deployed?: boolean;
8
+ local?: boolean;
9
+ json?: boolean;
10
+ }
11
+ export interface AgentInfo {
12
+ name: string;
13
+ type: string;
14
+ sourcePath: string;
15
+ deployed?: boolean;
16
+ canisterId?: string;
17
+ network?: string;
18
+ lastUpdated?: string;
19
+ }
20
+ /**
21
+ * Get list of all agents
22
+ */
23
+ export declare function getAgents(options: ListCommandOptions): Promise<AgentInfo[]>;
24
+ /**
25
+ * Display list of agents
26
+ */
27
+ export declare function displayAgents(agents: AgentInfo[], options: ListCommandOptions): void;
28
+ /**
29
+ * Execute list command
30
+ */
31
+ export declare function executeList(options: ListCommandOptions): Promise<void>;
32
+ /**
33
+ * Create list command
34
+ */
35
+ export declare function listCommand(): Command;
36
+ //# sourceMappingURL=list.d.ts.map