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.
- package/.dfx/local/network-id +4 -0
- package/.next/trace +2 -0
- package/.vercel/README.txt +11 -0
- package/.vercel/project.json +1 -0
- package/AGENTS.md +43 -0
- package/CHANGELOG.md +196 -0
- package/LICENSE +21 -0
- package/PLAN_VAULT_INTEGRATION.md +318 -0
- package/README.md +253 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-28-967Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-54-29-032Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-373Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T17-57-42-428Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-132Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-52-25-247Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-216Z.json +28 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T18-54-09-283Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-772Z.backup +1 -0
- package/backups/agentvault-backup-test-agent-2026-02-12T22-18-22-793Z.json +28 -0
- package/backups/test-backup.json +28 -0
- package/dist/cli/commands/approve.d.ts +4 -0
- package/dist/cli/commands/approve.js +232 -0
- package/dist/cli/commands/archive.d.ts +4 -0
- package/dist/cli/commands/archive.js +192 -0
- package/dist/cli/commands/backup.d.ts +4 -0
- package/dist/cli/commands/backup.js +164 -0
- package/dist/cli/commands/cloud-backup.d.ts +4 -0
- package/dist/cli/commands/cloud-backup.js +221 -0
- package/dist/cli/commands/cycles.d.ts +8 -0
- package/dist/cli/commands/cycles.js +83 -0
- package/dist/cli/commands/decrypt.d.ts +16 -0
- package/dist/cli/commands/decrypt.js +101 -0
- package/dist/cli/commands/deploy.d.ts +32 -0
- package/dist/cli/commands/deploy.js +208 -0
- package/dist/cli/commands/exec.d.ts +26 -0
- package/dist/cli/commands/exec.js +109 -0
- package/dist/cli/commands/fetch.d.ts +23 -0
- package/dist/cli/commands/fetch.js +164 -0
- package/dist/cli/commands/health.d.ts +8 -0
- package/dist/cli/commands/health.js +72 -0
- package/dist/cli/commands/identity.d.ts +8 -0
- package/dist/cli/commands/identity.js +140 -0
- package/dist/cli/commands/inference.d.ts +4 -0
- package/dist/cli/commands/inference.js +225 -0
- package/dist/cli/commands/info.d.ts +8 -0
- package/dist/cli/commands/info.js +59 -0
- package/dist/cli/commands/init.d.ts +19 -0
- package/dist/cli/commands/init.js +135 -0
- package/dist/cli/commands/instrument.d.ts +8 -0
- package/dist/cli/commands/instrument.js +35 -0
- package/dist/cli/commands/list.d.ts +36 -0
- package/dist/cli/commands/list.js +173 -0
- package/dist/cli/commands/logs.d.ts +8 -0
- package/dist/cli/commands/logs.js +96 -0
- package/dist/cli/commands/monitor.d.ts +8 -0
- package/dist/cli/commands/monitor.js +84 -0
- package/dist/cli/commands/network.d.ts +14 -0
- package/dist/cli/commands/network.js +258 -0
- package/dist/cli/commands/package.d.ts +36 -0
- package/dist/cli/commands/package.js +188 -0
- package/dist/cli/commands/profile.d.ts +8 -0
- package/dist/cli/commands/profile.js +76 -0
- package/dist/cli/commands/promote.d.ts +8 -0
- package/dist/cli/commands/promote.js +89 -0
- package/dist/cli/commands/rebuild.d.ts +21 -0
- package/dist/cli/commands/rebuild.js +140 -0
- package/dist/cli/commands/rollback.d.ts +8 -0
- package/dist/cli/commands/rollback.js +120 -0
- package/dist/cli/commands/show.d.ts +36 -0
- package/dist/cli/commands/show.js +200 -0
- package/dist/cli/commands/stats.d.ts +8 -0
- package/dist/cli/commands/stats.js +34 -0
- package/dist/cli/commands/status.d.ts +14 -0
- package/dist/cli/commands/status.js +83 -0
- package/dist/cli/commands/test.d.ts +8 -0
- package/dist/cli/commands/test.js +109 -0
- package/dist/cli/commands/tokens.d.ts +8 -0
- package/dist/cli/commands/tokens.js +62 -0
- package/dist/cli/commands/trace.d.ts +8 -0
- package/dist/cli/commands/trace.js +68 -0
- package/dist/cli/commands/wallet-export.d.ts +13 -0
- package/dist/cli/commands/wallet-export.js +140 -0
- package/dist/cli/commands/wallet-history.d.ts +10 -0
- package/dist/cli/commands/wallet-history.js +127 -0
- package/dist/cli/commands/wallet-import.d.ts +10 -0
- package/dist/cli/commands/wallet-import.js +209 -0
- package/dist/cli/commands/wallet-multi-send.d.ts +17 -0
- package/dist/cli/commands/wallet-multi-send.js +195 -0
- package/dist/cli/commands/wallet-process-queue.d.ts +19 -0
- package/dist/cli/commands/wallet-process-queue.js +209 -0
- package/dist/cli/commands/wallet-sign.d.ts +13 -0
- package/dist/cli/commands/wallet-sign.js +207 -0
- package/dist/cli/commands/wallet.d.ts +12 -0
- package/dist/cli/commands/wallet.js +794 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.js +96 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.js +14 -0
- package/fixup_1_0_OSS_release.md +136 -0
- package/fixup_REALEASE_PRD.md +136 -0
- package/package.json +79 -0
- package/pnpm-workspace.yaml +5 -0
- package/scripts/dev-dashboard.mjs +84 -0
- package/site/README.md +63 -0
- package/site/docusaurus.config.ts +148 -0
- package/site/package-lock.json +18383 -0
- package/site/package.json +47 -0
- package/site/sidebars.ts +86 -0
- package/site/static/.gitkeep +0 -0
- package/site/static/img/logo.svg +28 -0
- package/site/static/img/og-image.svg +35 -0
- package/src/archival/archive-manager.ts +372 -0
- package/src/archival/arweave-client.ts +289 -0
- package/src/archival/index.ts +8 -0
- package/src/backup/backup.ts +315 -0
- package/src/backup/index.ts +7 -0
- package/src/cloud-storage/cloud-sync.ts +461 -0
- package/src/cloud-storage/index.ts +11 -0
- package/src/cloud-storage/provider-detector.ts +198 -0
- package/src/cloud-storage/types.ts +104 -0
- package/src/debugging/index.ts +6 -0
- package/src/debugging/logs.ts +193 -0
- package/src/debugging/types.ts +100 -0
- package/src/deployment/deployer.ts +274 -0
- package/src/deployment/icpClient.ts +620 -0
- package/src/deployment/index.ts +46 -0
- package/src/deployment/promotion.ts +161 -0
- package/src/deployment/types.ts +111 -0
- package/src/icp/batch.ts +374 -0
- package/src/icp/cycles.ts +50 -0
- package/src/icp/environment.ts +215 -0
- package/src/icp/icpcli.ts +438 -0
- package/src/icp/icwasm.ts +222 -0
- package/src/icp/identity.ts +77 -0
- package/src/icp/index.ts +94 -0
- package/src/icp/optimization.ts +242 -0
- package/src/icp/tokens.ts +36 -0
- package/src/icp/tool-detector.ts +110 -0
- package/src/icp/types.ts +574 -0
- package/src/index.ts +25 -0
- package/src/inference/bittensor-client.ts +304 -0
- package/src/inference/index.ts +8 -0
- package/src/inference/inference-manager.ts +327 -0
- package/src/metrics/index.ts +7 -0
- package/src/metrics/metrics.ts +186 -0
- package/src/monitoring/alerting.ts +190 -0
- package/src/monitoring/health.ts +197 -0
- package/src/monitoring/index.ts +38 -0
- package/src/monitoring/info.ts +114 -0
- package/src/monitoring/types.ts +99 -0
- package/src/network/index.ts +5 -0
- package/src/network/network-config.ts +129 -0
- package/src/packaging/compiler.ts +647 -0
- package/src/packaging/config-persistence.ts +135 -0
- package/src/packaging/config-schemas.ts +156 -0
- package/src/packaging/detector.ts +220 -0
- package/src/packaging/index.ts +90 -0
- package/src/packaging/packager.ts +118 -0
- package/src/packaging/parsers/clawdbot.ts +278 -0
- package/src/packaging/parsers/cline.ts +223 -0
- package/src/packaging/parsers/generic.ts +266 -0
- package/src/packaging/parsers/goose.ts +214 -0
- package/src/packaging/parsers/index.ts +11 -0
- package/src/packaging/serializer.ts +260 -0
- package/src/packaging/types.ts +144 -0
- package/src/packaging/wasmedge-compiler.ts +406 -0
- package/src/security/index.ts +17 -0
- package/src/security/multisig.ts +415 -0
- package/src/security/types.ts +416 -0
- package/src/security/vetkeys.ts +655 -0
- package/src/testing/index.ts +6 -0
- package/src/testing/local-runner.ts +264 -0
- package/src/testing/types.ts +104 -0
- package/src/wallet/cbor-serializer.ts +323 -0
- package/src/wallet/chain-dispatcher.ts +313 -0
- package/src/wallet/cross-chain-aggregator.ts +346 -0
- package/src/wallet/index.ts +76 -0
- package/src/wallet/key-derivation.ts +425 -0
- package/src/wallet/providers/base-provider.ts +154 -0
- package/src/wallet/providers/cketh-provider.ts +434 -0
- package/src/wallet/providers/polkadot-provider.ts +503 -0
- package/src/wallet/providers/solana-provider.ts +490 -0
- package/src/wallet/transaction-queue.ts +284 -0
- package/src/wallet/types.ts +178 -0
- package/src/wallet/vetkeys-adapter.ts +431 -0
- package/src/wallet/wallet-manager.ts +597 -0
- package/src/wallet/wallet-storage.ts +380 -0
- package/vercel.json +8 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Detector
|
|
3
|
+
*
|
|
4
|
+
* Auto-detects availability of ICP tools (ic-wasm, icp, dfx)
|
|
5
|
+
* on the current system. Used for hybrid compatibility strategy:
|
|
6
|
+
* prefer icp-cli when available, fall back to dfx.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { execaCommand } from 'execa';
|
|
10
|
+
import type { ToolName, ToolInfo, ToolchainStatus } from './types.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Detect whether a single tool is installed and get its version.
|
|
14
|
+
*
|
|
15
|
+
* @param name - Tool binary name
|
|
16
|
+
* @returns ToolInfo with availability, path, and version
|
|
17
|
+
*/
|
|
18
|
+
export async function detectTool(name: ToolName): Promise<ToolInfo> {
|
|
19
|
+
const result: ToolInfo = { name, available: false };
|
|
20
|
+
|
|
21
|
+
// Locate the binary
|
|
22
|
+
try {
|
|
23
|
+
const whichResult = await execaCommand(`which ${name}`, {
|
|
24
|
+
reject: false,
|
|
25
|
+
timeout: 5000,
|
|
26
|
+
});
|
|
27
|
+
if (whichResult.exitCode === 0 && whichResult.stdout.trim()) {
|
|
28
|
+
result.path = whichResult.stdout.trim();
|
|
29
|
+
} else {
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Get the version
|
|
37
|
+
try {
|
|
38
|
+
const versionResult = await execaCommand(`${name} --version`, {
|
|
39
|
+
reject: false,
|
|
40
|
+
timeout: 5000,
|
|
41
|
+
});
|
|
42
|
+
if (versionResult.exitCode === 0) {
|
|
43
|
+
const output = versionResult.stdout.trim() || versionResult.stderr.trim();
|
|
44
|
+
// Extract version number from output like "ic-wasm 0.9.11" or "icp 0.1.0" or "dfx 0.25.0"
|
|
45
|
+
const match = output.match(/(\d+\.\d+\.\d+)/);
|
|
46
|
+
if (match) {
|
|
47
|
+
result.version = match[1];
|
|
48
|
+
} else {
|
|
49
|
+
result.version = output;
|
|
50
|
+
}
|
|
51
|
+
result.available = true;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
// Binary exists but version check failed - still mark as available
|
|
55
|
+
result.available = !!result.path;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Detect all ICP tools and determine the preferred toolchain.
|
|
63
|
+
*
|
|
64
|
+
* @returns Complete toolchain status
|
|
65
|
+
*/
|
|
66
|
+
export async function detectToolchain(): Promise<ToolchainStatus> {
|
|
67
|
+
const [icWasm, icp, dfx] = await Promise.all([
|
|
68
|
+
detectTool('ic-wasm'),
|
|
69
|
+
detectTool('icp'),
|
|
70
|
+
detectTool('dfx'),
|
|
71
|
+
]);
|
|
72
|
+
|
|
73
|
+
let preferredDeployTool: 'icp' | 'dfx' | null = null;
|
|
74
|
+
if (icp.available) {
|
|
75
|
+
preferredDeployTool = 'icp';
|
|
76
|
+
} else if (dfx.available) {
|
|
77
|
+
preferredDeployTool = 'dfx';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
icWasm,
|
|
82
|
+
icp,
|
|
83
|
+
dfx,
|
|
84
|
+
preferredDeployTool,
|
|
85
|
+
canOptimize: icWasm.available,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Require a specific tool, throwing a descriptive error if not found.
|
|
91
|
+
*
|
|
92
|
+
* @param name - Tool to require
|
|
93
|
+
* @param purpose - Human-readable description of why it's needed
|
|
94
|
+
* @returns ToolInfo (guaranteed available)
|
|
95
|
+
* @throws Error if tool is not available
|
|
96
|
+
*/
|
|
97
|
+
export async function requireTool(name: ToolName, purpose: string): Promise<ToolInfo> {
|
|
98
|
+
const tool = await detectTool(name);
|
|
99
|
+
if (!tool.available) {
|
|
100
|
+
const installHints: Record<ToolName, string> = {
|
|
101
|
+
'ic-wasm': 'Install with: cargo install ic-wasm',
|
|
102
|
+
'icp': 'Install from: https://github.com/dfinity/icp-cli',
|
|
103
|
+
'dfx': 'Install with: sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"',
|
|
104
|
+
};
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Tool '${name}' is required for ${purpose} but was not found.\n${installHints[name]}`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return tool;
|
|
110
|
+
}
|
package/src/icp/types.ts
ADDED
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for ICP tool integration (ic-wasm, icp-cli)
|
|
3
|
+
*
|
|
4
|
+
* Provides TypeScript interfaces for all external tool operations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ─── Tool Detection ────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/** Names of external tools that can be detected */
|
|
10
|
+
export type ToolName = 'ic-wasm' | 'icp' | 'dfx';
|
|
11
|
+
|
|
12
|
+
/** Result of detecting a single tool */
|
|
13
|
+
export interface ToolInfo {
|
|
14
|
+
/** Tool name */
|
|
15
|
+
name: ToolName;
|
|
16
|
+
/** Whether the tool is installed and reachable */
|
|
17
|
+
available: boolean;
|
|
18
|
+
/** Absolute path to the binary (if found) */
|
|
19
|
+
path?: string;
|
|
20
|
+
/** Semver version string (if available) */
|
|
21
|
+
version?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Combined detection result for all tools */
|
|
25
|
+
export interface ToolchainStatus {
|
|
26
|
+
icWasm: ToolInfo;
|
|
27
|
+
icp: ToolInfo;
|
|
28
|
+
dfx: ToolInfo;
|
|
29
|
+
/** Preferred deployment tool based on availability */
|
|
30
|
+
preferredDeployTool: 'icp' | 'dfx' | null;
|
|
31
|
+
/** Whether ic-wasm optimization is available */
|
|
32
|
+
canOptimize: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ─── ic-wasm Types ─────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
/** Optimization level for ic-wasm optimize (maps to wasm-opt levels) */
|
|
38
|
+
export type IcWasmOptLevel = 'O0' | 'O1' | 'O2' | 'O3' | 'O4' | 'Os' | 'Oz';
|
|
39
|
+
|
|
40
|
+
/** Options for ic-wasm optimize command */
|
|
41
|
+
export interface IcWasmOptimizeOptions {
|
|
42
|
+
/** Input WASM file path */
|
|
43
|
+
input: string;
|
|
44
|
+
/** Output WASM file path */
|
|
45
|
+
output: string;
|
|
46
|
+
/** Optimization level */
|
|
47
|
+
level?: IcWasmOptLevel;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Options for ic-wasm shrink command */
|
|
51
|
+
export interface IcWasmShrinkOptions {
|
|
52
|
+
/** Input WASM file path */
|
|
53
|
+
input: string;
|
|
54
|
+
/** Output WASM file path */
|
|
55
|
+
output: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Options for ic-wasm resource command */
|
|
59
|
+
export interface IcWasmResourceOptions {
|
|
60
|
+
/** Input WASM file path */
|
|
61
|
+
input: string;
|
|
62
|
+
/** Output WASM file path */
|
|
63
|
+
output: string;
|
|
64
|
+
/** Resource limit name */
|
|
65
|
+
name: string;
|
|
66
|
+
/** Resource limit value */
|
|
67
|
+
value: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Metadata visibility */
|
|
71
|
+
export type MetadataVisibility = 'public' | 'private';
|
|
72
|
+
|
|
73
|
+
/** Options for ic-wasm metadata command */
|
|
74
|
+
export interface IcWasmMetadataOptions {
|
|
75
|
+
/** Input WASM file path */
|
|
76
|
+
input: string;
|
|
77
|
+
/** Output WASM file path (for set operations, file data via -d) */
|
|
78
|
+
output?: string;
|
|
79
|
+
/** Metadata key name */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Metadata value (for set operations, string data via -d) */
|
|
82
|
+
data?: string;
|
|
83
|
+
/** Metadata file path (for set operations, file data via -f) */
|
|
84
|
+
file?: string;
|
|
85
|
+
/** Metadata visibility */
|
|
86
|
+
visibility?: MetadataVisibility;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Options for ic-wasm check-endpoints command */
|
|
90
|
+
export interface IcWasmCheckEndpointsOptions {
|
|
91
|
+
/** Input WASM file path */
|
|
92
|
+
input: string;
|
|
93
|
+
/** Path to Candid .did interface file */
|
|
94
|
+
candidInterface: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Options for ic-wasm instrument command */
|
|
98
|
+
export interface IcWasmInstrumentOptions {
|
|
99
|
+
/** Input WASM file path */
|
|
100
|
+
input: string;
|
|
101
|
+
/** Output WASM file path */
|
|
102
|
+
output: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Result of an ic-wasm command execution */
|
|
106
|
+
export interface IcWasmResult {
|
|
107
|
+
/** Whether the command succeeded */
|
|
108
|
+
success: boolean;
|
|
109
|
+
/** stdout from the command */
|
|
110
|
+
stdout: string;
|
|
111
|
+
/** stderr from the command */
|
|
112
|
+
stderr: string;
|
|
113
|
+
/** Exit code */
|
|
114
|
+
exitCode: number;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Result of an ic-wasm info command */
|
|
118
|
+
export interface IcWasmInfo {
|
|
119
|
+
/** Raw info output text */
|
|
120
|
+
raw: string;
|
|
121
|
+
/** Parsed sections (best effort) */
|
|
122
|
+
sections?: Record<string, string>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ─── icp-cli Types ────────────────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
/** Environment name for icp-cli */
|
|
128
|
+
export type IcpEnvironment = 'local' | 'ic' | string;
|
|
129
|
+
|
|
130
|
+
/** Deploy mode for icp deploy */
|
|
131
|
+
export type IcpDeployMode = 'auto' | 'install' | 'reinstall' | 'upgrade';
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Result of an icp-cli command execution
|
|
135
|
+
*/
|
|
136
|
+
export interface IcpCliResult {
|
|
137
|
+
/** Whether the command succeeded */
|
|
138
|
+
success: boolean;
|
|
139
|
+
/** stdout from the command */
|
|
140
|
+
stdout: string;
|
|
141
|
+
/** stderr from the command */
|
|
142
|
+
stderr: string;
|
|
143
|
+
/** Exit code */
|
|
144
|
+
exitCode: number;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Result of an ic-wasm command execution
|
|
149
|
+
*/
|
|
150
|
+
export interface IcWasmResult {
|
|
151
|
+
/** Whether the command succeeded */
|
|
152
|
+
success: boolean;
|
|
153
|
+
/** stdout from the command */
|
|
154
|
+
stdout: string;
|
|
155
|
+
/** stderr from the command */
|
|
156
|
+
stderr: string;
|
|
157
|
+
/** Exit code */
|
|
158
|
+
exitCode: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Options for icp build command */
|
|
163
|
+
export interface IcpBuildOptions extends IcpCommonOptions {
|
|
164
|
+
/** Canister names to build (omit for all) */
|
|
165
|
+
canisters?: string[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Options for icp deploy command */
|
|
170
|
+
export interface IcpDeployOptions extends IcpCommonOptions {
|
|
171
|
+
/** Deploy mode */
|
|
172
|
+
mode?: IcpDeployMode;
|
|
173
|
+
/** Canister names to deploy (omit for all) */
|
|
174
|
+
canisters?: string[];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Options for icp canister status */
|
|
179
|
+
export interface IcpCanisterStatusOptions extends IcpCommonOptions {
|
|
180
|
+
/** Canister ID or name */
|
|
181
|
+
canister: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Options for icp canister call */
|
|
186
|
+
export interface IcpCanisterCallOptions extends IcpCommonOptions {
|
|
187
|
+
/** Canister ID or name */
|
|
188
|
+
canister: string;
|
|
189
|
+
/** Method name */
|
|
190
|
+
method: string;
|
|
191
|
+
/** Arguments (Candid text format) */
|
|
192
|
+
args?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Options for icp canister list */
|
|
197
|
+
export interface IcpCommonOptions {
|
|
198
|
+
/** Environment name */
|
|
199
|
+
environment?: string;
|
|
200
|
+
/** Project root override path */
|
|
201
|
+
projectRoot?: string;
|
|
202
|
+
/** Identity to use */
|
|
203
|
+
identity?: string;
|
|
204
|
+
/** Identity name */
|
|
205
|
+
name?: string;
|
|
206
|
+
/** Identity password file */
|
|
207
|
+
identityPasswordFile?: string;
|
|
208
|
+
/** Enable debug output */
|
|
209
|
+
debug?: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Result of an icp-cli command execution */
|
|
214
|
+
export interface IcpCliResult {
|
|
215
|
+
/** Whether the command succeeded */
|
|
216
|
+
success: boolean;
|
|
217
|
+
/** stdout from the command */
|
|
218
|
+
stdout: string;
|
|
219
|
+
/** stderr from the command */
|
|
220
|
+
stderr: string;
|
|
221
|
+
/** Exit code */
|
|
222
|
+
exitCode: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ─── Optimization Types ─────────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
/** Options for ic-wasm shrink command */
|
|
228
|
+
export interface IcWasmShrinkOptions {
|
|
229
|
+
/** Input WASM file path */
|
|
230
|
+
input: string;
|
|
231
|
+
/** Output WASM file path */
|
|
232
|
+
output: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Options for ic-wasm resource command */
|
|
236
|
+
export interface IcWasmResourceOptions {
|
|
237
|
+
/** Input WASM file path */
|
|
238
|
+
input: string;
|
|
239
|
+
/** Output WASM file path */
|
|
240
|
+
output: string;
|
|
241
|
+
/** Resource limit name */
|
|
242
|
+
name: string;
|
|
243
|
+
/** Resource limit value */
|
|
244
|
+
value: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ─── Optimization Types ─────────────────────────────────────────────────────────
|
|
248
|
+
|
|
249
|
+
/** Combined optimization pipeline options */
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
251
|
+
export interface IcWasmOptimizeOptions {}
|
|
252
|
+
|
|
253
|
+
/** Result of an optimization operation with metrics */
|
|
254
|
+
export interface IcWasmOptimizationResult {
|
|
255
|
+
/** Whether optimization succeeded */
|
|
256
|
+
success: boolean;
|
|
257
|
+
/** Path to the optimized WASM */
|
|
258
|
+
outputPath: string;
|
|
259
|
+
/** Original file size in bytes */
|
|
260
|
+
originalSize: number;
|
|
261
|
+
/** Optimized file size in bytes */
|
|
262
|
+
optimizedSize: number;
|
|
263
|
+
/** Size reduction as a percentage (0-100) */
|
|
264
|
+
reductionPercent: number;
|
|
265
|
+
/** Duration of the optimization in milliseconds */
|
|
266
|
+
durationMs: number;
|
|
267
|
+
/** Any warnings from the tool */
|
|
268
|
+
warnings: string[];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Combined optimization pipeline options */
|
|
272
|
+
export interface IcWasmOptimizationPipelineOptions {
|
|
273
|
+
/** Input WASM file path */
|
|
274
|
+
input: string;
|
|
275
|
+
/** Output WASM file path */
|
|
276
|
+
output: string;
|
|
277
|
+
/** Run ic-wasm optimize (default true if ic-wasm available) */
|
|
278
|
+
optimize?: boolean;
|
|
279
|
+
/** Optimization level for wasm-opt (0-3, Os, Oz) */
|
|
280
|
+
optimizeLevel?: IcWasmOptLevel;
|
|
281
|
+
/** Run ic-wasm shrink (default true) */
|
|
282
|
+
shrink?: boolean;
|
|
283
|
+
/** Set resource limits */
|
|
284
|
+
resourceLimits?: Record<string, string>;
|
|
285
|
+
/** Validate against Candid interface */
|
|
286
|
+
candidInterface?: string;
|
|
287
|
+
/** Inject metadata */
|
|
288
|
+
metadata?: Array<{ name: string; data: string; visibility?: MetadataVisibility }>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Result of the full optimization pipeline */
|
|
292
|
+
export interface IcWasmOptimizationPipelineResult {
|
|
293
|
+
/** Whether the entire pipeline succeeded */
|
|
294
|
+
success: boolean;
|
|
295
|
+
/** Path to the final optimized WASM */
|
|
296
|
+
outputPath: string;
|
|
297
|
+
/** Original file size in bytes */
|
|
298
|
+
originalSize: number;
|
|
299
|
+
/** Final file size in bytes */
|
|
300
|
+
finalSize: number;
|
|
301
|
+
/** Size reduction as a percentage (0-100) */
|
|
302
|
+
reductionPercent: number;
|
|
303
|
+
/** Total duration in milliseconds */
|
|
304
|
+
totalDurationMs: number;
|
|
305
|
+
/** Per-step results */
|
|
306
|
+
steps: Array<{
|
|
307
|
+
step: string;
|
|
308
|
+
success: boolean;
|
|
309
|
+
durationMs: number;
|
|
310
|
+
sizeAfter?: number;
|
|
311
|
+
error?: string;
|
|
312
|
+
}>;
|
|
313
|
+
/** Validation result (if Candid interface was provided) */
|
|
314
|
+
validationPassed?: boolean;
|
|
315
|
+
/** Collected warnings */
|
|
316
|
+
warnings: string[];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ─── Cycles Types ─────────────────────────────────────────────────────────────
|
|
320
|
+
|
|
321
|
+
/** Options for icp cycles balance */
|
|
322
|
+
export interface IcpCyclesBalanceOptions extends IcpCommonOptions {
|
|
323
|
+
/** Canister ID or name */
|
|
324
|
+
canister: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Options for icp cycles mint */
|
|
328
|
+
export interface IcpCyclesMintOptions extends IcpCommonOptions {
|
|
329
|
+
/** Amount to mint */
|
|
330
|
+
amount: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** Options for icp cycles transfer */
|
|
334
|
+
export interface IcpCyclesTransferOptions extends IcpCommonOptions {
|
|
335
|
+
/** Amount to transfer */
|
|
336
|
+
amount: string;
|
|
337
|
+
/** Recipient principal or canister ID */
|
|
338
|
+
to: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// ─── Token Types ─────────────────────────────────────────────────────────────
|
|
342
|
+
|
|
343
|
+
/** Options for icp token balance */
|
|
344
|
+
export interface IcpTokenBalanceOptions extends IcpCommonOptions {
|
|
345
|
+
/** Token canister ID */
|
|
346
|
+
canister?: string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** Options for icp token transfer */
|
|
350
|
+
export interface IcpTokenTransferOptions extends IcpCommonOptions {
|
|
351
|
+
/** Token canister ID */
|
|
352
|
+
canister?: string;
|
|
353
|
+
/** Amount to transfer */
|
|
354
|
+
amount: string;
|
|
355
|
+
/** Recipient principal or account */
|
|
356
|
+
to: string;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// ─── Identity Types ─────────────────────────────────────────────────────────────
|
|
360
|
+
|
|
361
|
+
/** Options for icp identity list */
|
|
362
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
363
|
+
export interface IcpIdentityListOptions extends IcpCommonOptions {}
|
|
364
|
+
|
|
365
|
+
/** Options for icp identity new */
|
|
366
|
+
export interface IcpIdentityNewOptions extends IcpCommonOptions {
|
|
367
|
+
/** Identity name */
|
|
368
|
+
name?: string;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** Options for icp identity export */
|
|
372
|
+
export interface IcpIdentityExportOptions extends IcpCommonOptions {
|
|
373
|
+
/** Identity name */
|
|
374
|
+
name?: string;
|
|
375
|
+
/** Output PEM file path */
|
|
376
|
+
output?: string;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** Options for icp identity import */
|
|
380
|
+
export interface IcpIdentityImportOptions extends IcpCommonOptions {
|
|
381
|
+
/** Identity name */
|
|
382
|
+
name?: string;
|
|
383
|
+
/** PEM file path */
|
|
384
|
+
pemFile?: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// ─── Network Types ─────────────────────────────────────────────────────────────
|
|
388
|
+
|
|
389
|
+
/** Options for icp network start */
|
|
390
|
+
export interface IcpNetworkStartOptions extends IcpCommonOptions {
|
|
391
|
+
/** Network name */
|
|
392
|
+
network?: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** Options for icp network stop */
|
|
396
|
+
export interface IcpNetworkStopOptions extends IcpCommonOptions {
|
|
397
|
+
/** Network name */
|
|
398
|
+
network?: string;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// ─── Sync Types ─────────────────────────────────────────────────────────────
|
|
402
|
+
|
|
403
|
+
/** Options for icp sync */
|
|
404
|
+
export interface IcpSyncOptions extends IcpCommonOptions {
|
|
405
|
+
/** Network name */
|
|
406
|
+
network?: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// ─── Environment Types ─────────────────────────────────────────────────────
|
|
410
|
+
|
|
411
|
+
/** Options for icp environment list */
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
413
|
+
export interface IcpEnvironmentListOptions extends IcpCommonOptions {}
|
|
414
|
+
|
|
415
|
+
// ─── Network Config ─────────────────────────────────────────────────────────────
|
|
416
|
+
|
|
417
|
+
/** Network configuration for deployment */
|
|
418
|
+
export interface IcpNetworkConfig {
|
|
419
|
+
/** Network name (local, ic, staging) */
|
|
420
|
+
name: string;
|
|
421
|
+
/** Network URL */
|
|
422
|
+
url: string;
|
|
423
|
+
/** Whether this is a local network */
|
|
424
|
+
isLocal: boolean;
|
|
425
|
+
/** Cycles wallet principal (if any) */
|
|
426
|
+
walletPrincipal?: string;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ─── Cycles Config ─────────────────────────────────────────────────────────────
|
|
430
|
+
|
|
431
|
+
/** Cycles configuration for a project */
|
|
432
|
+
export interface IcpCyclesConfig {
|
|
433
|
+
/** Minimum cycles to maintain */
|
|
434
|
+
minCycles?: bigint;
|
|
435
|
+
/** Top-up amount when cycles fall below minimum */
|
|
436
|
+
topUpAmount?: bigint;
|
|
437
|
+
/** Whether to automatically top up */
|
|
438
|
+
autoTopUp?: boolean;
|
|
439
|
+
/** Initial cycles allocation (for new canisters) */
|
|
440
|
+
initial?: string;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// ─── Environment Config ─────────────────────────────────────────────────────
|
|
444
|
+
|
|
445
|
+
/** Network configuration for environments */
|
|
446
|
+
export interface IcpEnvNetworkConfig {
|
|
447
|
+
/** Network type */
|
|
448
|
+
type: 'local' | 'ic';
|
|
449
|
+
/** Number of replicas (optional) */
|
|
450
|
+
replicaCount?: number;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/** Environment configuration */
|
|
454
|
+
export interface IcpEnvironmentConfig {
|
|
455
|
+
/** Environment name */
|
|
456
|
+
name: string;
|
|
457
|
+
/** Network to use */
|
|
458
|
+
network: string | IcpEnvNetworkConfig;
|
|
459
|
+
/** Cycles configuration */
|
|
460
|
+
cycles?: IcpCyclesConfig;
|
|
461
|
+
/** Optimization configuration */
|
|
462
|
+
optimization?: IcpOptimizationConfig;
|
|
463
|
+
/** Identity to use (optional) */
|
|
464
|
+
identity?: string;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// ─── Optimization Config ─────────────────────────────────────────────────────
|
|
468
|
+
|
|
469
|
+
/** Optimization configuration for builds */
|
|
470
|
+
export interface IcpOptimizationConfig {
|
|
471
|
+
/** Whether to enable WASM optimization */
|
|
472
|
+
enabled: boolean;
|
|
473
|
+
/** Optimization level */
|
|
474
|
+
level?: IcWasmOptLevel | number;
|
|
475
|
+
/** Whether to shrink the WASM */
|
|
476
|
+
shrink?: boolean;
|
|
477
|
+
/** Remove debug symbols */
|
|
478
|
+
removeDebug?: boolean;
|
|
479
|
+
/** Additional wasm-opt flags */
|
|
480
|
+
wasmOptFlags?: string[];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// ─── Project Config ─────────────────────────────────────────────────────────────
|
|
484
|
+
|
|
485
|
+
/** Project configuration loaded from .icprc.json */
|
|
486
|
+
export interface IcpProjectConfig {
|
|
487
|
+
/** Project name */
|
|
488
|
+
name: string;
|
|
489
|
+
/** Default environment */
|
|
490
|
+
defaultEnvironment: string;
|
|
491
|
+
/** Environments */
|
|
492
|
+
environments: Record<string, IcpEnvironmentConfig>;
|
|
493
|
+
/** Cycles configuration */
|
|
494
|
+
cycles?: IcpCyclesConfig;
|
|
495
|
+
/** Optimization configuration */
|
|
496
|
+
optimization?: IcpOptimizationConfig;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// ─── Phase 3 Types ─────────────────────────────────────────────────────────────
|
|
500
|
+
|
|
501
|
+
/** Network configuration for local/IC networks */
|
|
502
|
+
export interface NetworkConfig {
|
|
503
|
+
/** Network name */
|
|
504
|
+
name: string;
|
|
505
|
+
/** Network type */
|
|
506
|
+
type: 'local' | 'ic';
|
|
507
|
+
/** Number of nodes in the network */
|
|
508
|
+
nodes?: number;
|
|
509
|
+
/** Number of replicas */
|
|
510
|
+
replicaCount?: number;
|
|
511
|
+
/** Cycles configuration */
|
|
512
|
+
cycles?: {
|
|
513
|
+
/** Initial cycles allocation */
|
|
514
|
+
initial: string;
|
|
515
|
+
/** Minimum cycles threshold */
|
|
516
|
+
min?: string;
|
|
517
|
+
/** Enable automatic top-up */
|
|
518
|
+
autoTopup?: boolean;
|
|
519
|
+
};
|
|
520
|
+
/** When this network config was created */
|
|
521
|
+
created?: Date;
|
|
522
|
+
/** Current status of the network */
|
|
523
|
+
status?: 'running' | 'stopped' | 'error';
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** Deployment history entry */
|
|
527
|
+
export interface DeploymentHistory {
|
|
528
|
+
/** Agent name */
|
|
529
|
+
agentName: string;
|
|
530
|
+
/** Environment deployed to */
|
|
531
|
+
environment: string;
|
|
532
|
+
/** Canister ID */
|
|
533
|
+
canisterId: string;
|
|
534
|
+
/** WASM hash deployed */
|
|
535
|
+
wasmHash: string;
|
|
536
|
+
/** Deployment timestamp */
|
|
537
|
+
timestamp: Date;
|
|
538
|
+
/** Deployment version */
|
|
539
|
+
version: number;
|
|
540
|
+
/** Whether deployment succeeded */
|
|
541
|
+
success: boolean;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Canister state snapshot */
|
|
545
|
+
export interface CanisterSnapshot {
|
|
546
|
+
/** Canister ID */
|
|
547
|
+
canisterId: string;
|
|
548
|
+
/** Snapshot timestamp */
|
|
549
|
+
timestamp: Date;
|
|
550
|
+
/** Serialized state */
|
|
551
|
+
state: ArrayBuffer;
|
|
552
|
+
/** Cycles balance at snapshot time */
|
|
553
|
+
cycles: bigint;
|
|
554
|
+
/** Memory usage at snapshot time */
|
|
555
|
+
memory: bigint;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** Execution trace entry */
|
|
559
|
+
export interface ExecutionTrace {
|
|
560
|
+
/** Method name */
|
|
561
|
+
method: string;
|
|
562
|
+
/** Start time (milliseconds since epoch) */
|
|
563
|
+
startTime: number;
|
|
564
|
+
/** End time (milliseconds since epoch) */
|
|
565
|
+
endTime: number;
|
|
566
|
+
/** Duration in milliseconds */
|
|
567
|
+
duration: number;
|
|
568
|
+
/** Caller principal */
|
|
569
|
+
caller?: string;
|
|
570
|
+
/** Nested method calls */
|
|
571
|
+
children: ExecutionTrace[];
|
|
572
|
+
/** Memory delta during execution */
|
|
573
|
+
memoryDelta?: bigint;
|
|
574
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentVault - Persistent On-Chain AI Agent Platform
|
|
3
|
+
*
|
|
4
|
+
* Sovereign, Reconstructible, Autonomous
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const VERSION = '1.0.0';
|
|
8
|
+
|
|
9
|
+
export interface AgentVaultConfig {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function createConfig(name: string): AgentVaultConfig {
|
|
15
|
+
return {
|
|
16
|
+
name,
|
|
17
|
+
version: VERSION,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// CLI entry point
|
|
22
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
23
|
+
console.log(`AgentVault v${VERSION}`);
|
|
24
|
+
console.log('Persistent On-Chain AI Agent Platform');
|
|
25
|
+
}
|