@prktsol/prkt 1.0.0 → 1.0.1
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/.env.devnet.all-protocols.example +5 -0
- package/.env.example +7 -0
- package/CLI.md +24 -0
- package/CLI_QUICKSTART.md +16 -0
- package/README.md +59 -12
- package/dist/agent/AgentManager.d.ts +61 -0
- package/dist/agent/AgentRuntime.d.ts +28 -0
- package/dist/agent/DecisionEngine.d.ts +51 -0
- package/dist/agent/MockPriceFeed.d.ts +10 -0
- package/dist/agent/intents/types.d.ts +35 -0
- package/dist/agent/new-index.d.ts +9 -0
- package/dist/agent/policyFactory.d.ts +2 -0
- package/dist/agent/registry/AgentRegistry.d.ts +11 -0
- package/dist/agent/runner/AgentRunner.d.ts +51 -0
- package/dist/agent/runner/AgentRunner.js +59 -2
- package/dist/agent/strategies/MemoHeartbeatStrategy.d.ts +6 -0
- package/dist/agent/strategies/SimpleScriptedTransferStrategy.d.ts +12 -0
- package/dist/agent/strategies/TokenRebalancerStrategy.d.ts +13 -0
- package/dist/agent/strategies/TreasuryDistributorStrategy.d.ts +12 -0
- package/dist/agent/strategies/UniversalDeFiStrategy.d.ts +22 -0
- package/dist/agent/types/AgentContext.d.ts +28 -0
- package/dist/anchoring/SessionAnchor.d.ts +42 -0
- package/dist/anchoring/SessionAnchor.js +161 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +157 -16
- package/dist/cli/services/activityStore.d.ts +8 -0
- package/dist/cli/services/agentRegistry.d.ts +20 -0
- package/dist/cli/services/agentRuntime.d.ts +6 -0
- package/dist/cli/services/storagePaths.d.ts +8 -0
- package/dist/cli/services/strategyFactory.d.ts +5 -0
- package/dist/cli/services/walletCrypto.d.ts +12 -0
- package/dist/cli/services/walletRegistry.d.ts +26 -0
- package/dist/cli/types.d.ts +68 -0
- package/dist/cli/utils/completion.d.ts +4 -0
- package/dist/cli/utils/output.d.ts +5 -0
- package/dist/cli/utils/output.js +4 -1
- package/dist/compression/AuditLogManager.d.ts +9 -0
- package/dist/compression/AuditLogManager.js +86 -0
- package/dist/compression/PolicyAccountManager.d.ts +11 -0
- package/dist/compression/PolicyAccountManager.js +113 -0
- package/dist/compression/types.d.ts +20 -0
- package/dist/compression/types.js +2 -0
- package/dist/config/PRKTConfig.d.ts +17 -0
- package/dist/config/PRKTConfig.js +19 -0
- package/dist/config/agentPolicies.d.ts +14 -0
- package/dist/config/env.d.ts +39 -0
- package/dist/config/env.js +37 -0
- package/dist/config/policyPresets.d.ts +22 -0
- package/dist/core/balances/BalanceService.d.ts +14 -0
- package/dist/core/funding/DevnetFundingService.d.ts +38 -0
- package/dist/core/funding/DevnetFundingService.js +73 -6
- package/dist/core/idempotency/ExecutionIdempotencyGuard.d.ts +39 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/rpc/RpcClient.d.ts +21 -0
- package/dist/core/rpc/RpcClient.js +35 -0
- package/dist/core/rpc/RpcFailoverClient.d.ts +42 -0
- package/dist/core/tokens/TokenService.d.ts +40 -0
- package/dist/core/transactions/PostTransactionVerifier.d.ts +47 -0
- package/dist/core/transactions/TransactionService.d.ts +46 -0
- package/dist/core/types/services.d.ts +27 -0
- package/dist/core/wallet/WalletManager.d.ts +21 -0
- package/dist/defi/DeFiCoordinator.d.ts +24 -0
- package/dist/defi/DeFiExecutor.d.ts +15 -0
- package/dist/defi/DeFiPolicyGuard.d.ts +7 -0
- package/dist/defi/adapters/JupiterAdapter.d.ts +5 -0
- package/dist/defi/adapters/KaminoAdapter.d.ts +6 -0
- package/dist/defi/adapters/MarinadeAdapter.d.ts +5 -0
- package/dist/defi/adapters/RaydiumAdapter.d.ts +20 -0
- package/dist/defi/kamino/kaminoInstructionCompat.d.ts +3 -0
- package/dist/defi/kamino/kaminoLiveConfig.d.ts +14 -0
- package/dist/defi/kamino/loadKaminoMarketWithFallback.d.ts +11 -0
- package/dist/defi/lp/LpInstructionBuilder.d.ts +15 -0
- package/dist/defi/lp/RaydiumLpInstructionBuilder.d.ts +28 -0
- package/dist/defi/lp/raydiumDevnetConfig.d.ts +11 -0
- package/dist/defi/protocols.d.ts +8 -0
- package/dist/defi/types.d.ts +65 -0
- package/dist/defi/universal/UniversalDeFiOrchestrator.d.ts +24 -0
- package/dist/defi/universal/UniversalDeFiOrchestrator.js +157 -0
- package/dist/defi/universal/adapters.d.ts +25 -0
- package/dist/defi/universal/index.d.ts +2 -0
- package/dist/defi/universal/liveExecutors.d.ts +23 -0
- package/dist/defi/universal/types.d.ts +45 -0
- package/dist/demo/scenarios/multiAgentDevnetScenario.d.ts +5 -0
- package/dist/demo/scripts/runMultiAgentDevnetDemo.d.ts +1 -0
- package/dist/dex/JupiterSwapClient.d.ts +28 -0
- package/dist/dex/SwapExecutor.d.ts +36 -0
- package/dist/errors/PRKTError.d.ts +15 -0
- package/dist/errors/PRKTError.js +38 -0
- package/dist/evm/EvmAdapter.d.ts +45 -0
- package/dist/evm/EvmAdapter.js +2 -0
- package/dist/evm/NeonWalletBridge.d.ts +9 -0
- package/dist/evm/NeonWalletBridge.js +40 -0
- package/dist/evm/adapters/AaveAdapter.d.ts +17 -0
- package/dist/evm/adapters/AaveAdapter.js +100 -0
- package/dist/evm/adapters/UniswapV3Adapter.d.ts +18 -0
- package/dist/evm/adapters/UniswapV3Adapter.js +146 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +35 -20
- package/dist/kora/KoraRpcClient.d.ts +14 -0
- package/dist/kora/KoraSigner.d.ts +22 -0
- package/dist/kora/KoraSigner.js +33 -10
- package/dist/kora/gaslessDemo.d.ts +9 -0
- package/dist/onchain/index.d.ts +2 -0
- package/dist/onchain/index.js +17 -0
- package/dist/onchain/policyGuardProgram.d.ts +86 -0
- package/dist/onchain/policyGuardProgram.js +248 -0
- package/dist/policy/PolicyGuard.d.ts +13 -0
- package/dist/policy/emergencyLock.d.ts +4 -0
- package/dist/policy/engine/PolicyEngine.d.ts +28 -0
- package/dist/policy/engine/PolicyEngine.js +109 -1
- package/dist/policy/errors.d.ts +3 -0
- package/dist/policy/index.d.ts +3 -0
- package/dist/policy/sandbox/SandboxExecutor.d.ts +44 -0
- package/dist/policy/sandbox/SandboxExecutor.js +245 -3
- package/dist/policy/types/policy.d.ts +55 -0
- package/dist/scripts/devnetFunding.d.ts +9 -0
- package/dist/scripts/devnetFunding.js +0 -1
- package/dist/scripts/devnetWalletPreflight.d.ts +8 -0
- package/dist/scripts/localnetCheck.d.ts +1 -0
- package/dist/scripts/managedAgentWallet.d.ts +34 -0
- package/dist/scripts/mode.d.ts +2 -0
- package/dist/scripts/releaseReadiness.d.ts +9 -0
- package/dist/scripts/runAgentUniversalDeFi.d.ts +1 -0
- package/dist/scripts/runAutonomousAgentWalletDevnet.d.ts +1 -0
- package/dist/scripts/runAutonomousAgentWalletDevnet.js +1 -1
- package/dist/scripts/runAutonomousPortfolioDevnet.d.ts +1 -0
- package/dist/scripts/runAutonomousPortfolioDevnet.js +1 -1
- package/dist/scripts/runBorrowStrategy.d.ts +1 -0
- package/dist/scripts/runDeFiSuite.d.ts +1 -0
- package/dist/scripts/runDemoRehearsal.d.ts +1 -0
- package/dist/scripts/runDemoRehearsal.js +39 -10
- package/dist/scripts/runDevnetFeatureMatrix.d.ts +43 -0
- package/dist/scripts/runDevnetFeatureMatrix.js +787 -0
- package/dist/scripts/runDevnetWalletDemo.d.ts +1 -0
- package/dist/scripts/runGaslessMemo.d.ts +1 -0
- package/dist/scripts/runGaslessMemo.js +9 -1
- package/dist/scripts/runGaslessWalletDemo.d.ts +1 -0
- package/dist/scripts/runGaslessWalletDemo.js +9 -1
- package/dist/scripts/runKaminoDevnet.d.ts +1 -0
- package/dist/scripts/runKaminoDevnet.js +82 -42
- package/dist/scripts/runLpStrategy.d.ts +1 -0
- package/dist/scripts/runMarinadeDevnet.d.ts +1 -0
- package/dist/scripts/runOnchainPolicyGuardDevnet.d.ts +1 -0
- package/dist/scripts/runOnchainPolicyGuardDevnet.js +113 -0
- package/dist/scripts/runOrcaLpDevnet.d.ts +1 -0
- package/dist/scripts/runRaydiumLpDevnet.d.ts +1 -0
- package/dist/scripts/runReleaseReadiness.d.ts +1 -0
- package/dist/scripts/runStakeStrategy.d.ts +1 -0
- package/dist/scripts/runStatus.d.ts +1 -0
- package/dist/scripts/runStatus.js +22 -0
- package/dist/scripts/runStressTest.d.ts +1 -0
- package/dist/scripts/runTradeLoop.d.ts +1 -0
- package/dist/scripts/runUniversalDeFiDemo.d.ts +1 -0
- package/dist/scripts/runYieldStrategy.d.ts +1 -0
- package/dist/scripts/runtimeFactory.d.ts +8 -0
- package/dist/scripts/shared.d.ts +3 -0
- package/dist/scripts/shared.js +1 -0
- package/dist/scripts/simulateAttack.d.ts +1 -0
- package/dist/scripts/simulateSwarm.d.ts +1 -0
- package/dist/simulation/attack.d.ts +8 -0
- package/dist/solana/memoLedger.d.ts +33 -0
- package/dist/solana/memoLedger.js +205 -0
- package/dist/solana/programs.d.ts +6 -0
- package/dist/spl/TokenWallet.d.ts +18 -0
- package/dist/types/policy.d.ts +23 -0
- package/dist/wallet/WalletManager.d.ts +1 -0
- package/dist/zk/PolicyCircuit.d.ts +48 -0
- package/dist/zk/PolicyCircuit.js +171 -0
- package/dist/zk/ProofAnchor.d.ts +33 -0
- package/dist/zk/ProofAnchor.js +109 -0
- package/dist/zkCompression/CompressedCommitmentAnchor.d.ts +31 -0
- package/dist/zkCompression/CompressedCommitmentAnchor.js +90 -0
- package/dist/zkCompression/CompressedDataAccount.d.ts +45 -0
- package/dist/zkCompression/CompressedDataAccount.js +349 -0
- package/dist/zkCompression/LocalPayloadRegistry.d.ts +23 -0
- package/dist/zkCompression/LocalPayloadRegistry.js +53 -0
- package/package.json +20 -4
|
@@ -7,6 +7,11 @@ ENABLE_LIVE_SWAP_PATH=true
|
|
|
7
7
|
ENABLE_LIVE_RAYDIUM_LP=true
|
|
8
8
|
ENABLE_LIVE_KAMINO=true
|
|
9
9
|
ENABLE_LIVE_MARINADE=true
|
|
10
|
+
# Optional Light / zk-compression endpoints for real compressed commitment anchors on devnet.
|
|
11
|
+
# ZK_COMPRESSION_API_URL=https://your-compression-api.example.com
|
|
12
|
+
# ZK_PROVER_URL=https://your-prover.example.com
|
|
13
|
+
# Optional override for the deployed onchain policy/verifier program on devnet.
|
|
14
|
+
# ONCHAIN_POLICY_GUARD_PROGRAM_ID=3sUkfLW4jtwSQFgdtWyEj8FPedtvKfXSB1J16PMUZhMG
|
|
10
15
|
RAYDIUM_LP_CONFIG_PATH=raydium_lp.devnet.json
|
|
11
16
|
KAMINO_LIVE_CONFIG_PATH=kamino_live.json
|
|
12
17
|
UNIVERSAL_DEFI_LIVE_FIRST=true
|
package/.env.example
CHANGED
|
@@ -9,6 +9,13 @@ ENABLE_LIVE_RAYDIUM_LP=false
|
|
|
9
9
|
ENABLE_LIVE_KAMINO=false
|
|
10
10
|
# Set true for the autonomous agent wallet bounty demo and direct Marinade staking demo.
|
|
11
11
|
ENABLE_LIVE_MARINADE=false
|
|
12
|
+
# Optional Light / zk-compression endpoints for real compressed commitment anchors on devnet.
|
|
13
|
+
# ZK_COMPRESSION_API_URL=https://your-compression-api.example.com
|
|
14
|
+
# ZK_PROVER_URL=https://your-prover.example.com
|
|
15
|
+
# IMPLEMENTATION_PATH=defensible_devnet_demo
|
|
16
|
+
# NEON_BROADCAST_ENABLED=false
|
|
17
|
+
# Optional override for the deployed onchain policy/verifier program on devnet.
|
|
18
|
+
# ONCHAIN_POLICY_GUARD_PROGRAM_ID=3sUkfLW4jtwSQFgdtWyEj8FPedtvKfXSB1J16PMUZhMG
|
|
12
19
|
# KAMINO_LIVE_CONFIG_PATH=kamino_live.json
|
|
13
20
|
UNIVERSAL_DEFI_LIVE_FIRST=true
|
|
14
21
|
# Preferred production path: remote transaction signer with bearer auth.
|
package/CLI.md
CHANGED
|
@@ -6,6 +6,7 @@ For the full end-to-end product guide, see:
|
|
|
6
6
|
- [FULL_DOCUMENTATION.md](./FULL_DOCUMENTATION.md)
|
|
7
7
|
|
|
8
8
|
- Published binary entrypoint: `prkt ...`
|
|
9
|
+
- Published devnet verifier: `prkt-devnet-matrix`
|
|
9
10
|
- Source entrypoint: `npm run cli -- ...`
|
|
10
11
|
- CLI name in help output: `prkt`
|
|
11
12
|
- Global machine-readable output mode: `--json`
|
|
@@ -35,6 +36,7 @@ npm install
|
|
|
35
36
|
```bash
|
|
36
37
|
prkt --help
|
|
37
38
|
prkt init
|
|
39
|
+
prkt-devnet-matrix
|
|
38
40
|
```
|
|
39
41
|
3. Create a wallet:
|
|
40
42
|
```bash
|
|
@@ -54,6 +56,28 @@ Example:
|
|
|
54
56
|
prkt --json wallet list
|
|
55
57
|
```
|
|
56
58
|
|
|
59
|
+
## 3.2) Devnet Tryability Runner
|
|
60
|
+
Run the end-to-end devnet feature matrix. This is the fastest way to exercise the wallet stack and emit reviewable artifacts.
|
|
61
|
+
|
|
62
|
+
Published install:
|
|
63
|
+
```bash
|
|
64
|
+
prkt-devnet-matrix
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
From source:
|
|
68
|
+
```bash
|
|
69
|
+
npm run demo:feature-matrix:devnet
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Artifacts:
|
|
73
|
+
- `artifacts/devnet-feature-matrix.json`
|
|
74
|
+
- `artifacts/devnet-feature-matrix.md`
|
|
75
|
+
|
|
76
|
+
Optional env flags:
|
|
77
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_PROTOCOL_LIVE=1`
|
|
78
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_STRESS=1`
|
|
79
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_EXPORTS=1`
|
|
80
|
+
|
|
57
81
|
## 3.1) init
|
|
58
82
|
Bootstrap local PRKT state for the current user install.
|
|
59
83
|
|
package/CLI_QUICKSTART.md
CHANGED
|
@@ -19,6 +19,7 @@ Published CLI:
|
|
|
19
19
|
npm install -g @prktsol/prkt
|
|
20
20
|
prkt --help
|
|
21
21
|
prkt init
|
|
22
|
+
prkt-devnet-matrix
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
From source:
|
|
@@ -27,6 +28,21 @@ From source:
|
|
|
27
28
|
npm install
|
|
28
29
|
npm run cli -- --help
|
|
29
30
|
npm run cli -- init
|
|
31
|
+
npm run demo:feature-matrix:devnet
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 1a) One-command devnet proof
|
|
35
|
+
|
|
36
|
+
Use the feature matrix when you need the fastest end-to-end devnet verification run.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run demo:feature-matrix:devnet
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Published install:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
prkt-devnet-matrix
|
|
30
46
|
```
|
|
31
47
|
|
|
32
48
|
## 2) Create wallets
|
package/README.md
CHANGED
|
@@ -15,6 +15,13 @@ Published CLI:
|
|
|
15
15
|
npm install -g @prktsol/prkt
|
|
16
16
|
prkt --help
|
|
17
17
|
prkt init
|
|
18
|
+
prkt-devnet-matrix
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Typed Node SDK surface:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const { WalletManager, PolicyEngine, SessionAnchor } = require("@prktsol/prkt");
|
|
18
25
|
```
|
|
19
26
|
|
|
20
27
|
From source:
|
|
@@ -24,6 +31,7 @@ git clone <repo-url> && cd PRKT
|
|
|
24
31
|
npm install
|
|
25
32
|
npm run cli -- --help
|
|
26
33
|
npm run cli -- init
|
|
34
|
+
npm run demo:feature-matrix:devnet
|
|
27
35
|
```
|
|
28
36
|
|
|
29
37
|
### 2. Configure environment
|
|
@@ -50,18 +58,26 @@ Edit `.env`:
|
|
|
50
58
|
| `AGENT_PRIVATE_KEY` | Optional | `[]` | Only for operator-funded wallet demos; the autonomous devnet demo generates its own wallet |
|
|
51
59
|
| `DEVNET_TREASURY_PRIVATE_KEY` | No | `[]` | Optional funded devnet treasury used as an internal faucet for generated agent wallets |
|
|
52
60
|
| `USDC_MINT` | No | devnet USDC | Override only if using a custom mint |
|
|
53
|
-
| `KORA_MOCK_MODE` | No | `true` | Set `false` for live Kora gasless signing |
|
|
61
|
+
| `KORA_MOCK_MODE` | No | `true` | Set `false` for live Kora gasless signing; demo scripts fall back to mock if Kora is unavailable |
|
|
54
62
|
| `ENABLE_LIVE_SWAP_PATH` | No | `false` | Set `true` for live Jupiter swaps |
|
|
55
63
|
| `ENABLE_LIVE_RAYDIUM_LP` | No | `false` | Set `true` for live Raydium LP |
|
|
56
64
|
| `ENABLE_LIVE_KAMINO` | No | `false` | Set `true` for live Kamino lending / borrowing |
|
|
57
65
|
| `ENABLE_LIVE_MARINADE` | No | `false` | Set `true` for live Marinade staking |
|
|
58
66
|
| `KAMINO_LIVE_CONFIG_PATH` | No | `kamino_live.json` | Path to Kamino live config copied from `kamino_live.example.json` |
|
|
67
|
+
| `ZK_COMPRESSION_API_URL` | No | none | Light / ZK Compression API endpoint for memo-free compressed account storage on devnet |
|
|
68
|
+
| `ZK_PROVER_URL` | No | none | Optional Light prover endpoint; defaults to `ZK_COMPRESSION_API_URL` when omitted |
|
|
69
|
+
| `IMPLEMENTATION_PATH` | No | `strict_live` | Set `defensible_devnet_demo` to allow commitment-backed fallback storage when full Light data-account writes are unavailable on devnet |
|
|
70
|
+
| `NEON_BROADCAST_ENABLED` | No | `false` | Set `true` only when you want PRKT to broadcast Neon EVM transactions instead of failing closed |
|
|
71
|
+
| `ONCHAIN_POLICY_GUARD_PROGRAM_ID` | No | `3sUkfLW4jtwSQFgdtWyEj8FPedtvKfXSB1J16PMUZhMG` | Override for the deployed devnet onchain policy/verifier program |
|
|
59
72
|
| `POLICY_SESSION_TTL_MINUTES` | No | `60` | Session TTL in minutes (1–1440) |
|
|
60
73
|
|
|
61
74
|
> **Production**: Use `REMOTE_SIGNER_URL`, `REMOTE_SIGNER_BEARER_TOKEN`, and `REMOTE_SIGNER_PUBKEY` instead of `AGENT_PRIVATE_KEY`. All three must be set together.
|
|
62
75
|
|
|
63
76
|
For the autonomous bounty demo, set `ENABLE_LIVE_MARINADE=true`. No pre-existing wallet is required, but setting `DEVNET_TREASURY_PRIVATE_KEY` lets generated wallets fund from your own devnet treasury instead of the public faucet.
|
|
64
77
|
|
|
78
|
+
Reviewer-demo note: set `SOLANA_RPC_FALLBACK_URL` and `DEVNET_TREASURY_PRIVATE_KEY` before recording or sharing a live demo. The proof/session/policy path prefers real Light compressed storage on devnet, so also set `ZK_COMPRESSION_API_URL` and optionally `ZK_PROVER_URL`. In `IMPLEMENTATION_PATH=defensible_devnet_demo`, PRKT will fall back to on-chain commitment anchors plus a local payload registry if full Light data-account writes are unavailable.
|
|
79
|
+
The deployed devnet onchain policy/verifier program in this repo is `3sUkfLW4jtwSQFgdtWyEj8FPedtvKfXSB1J16PMUZhMG`.
|
|
80
|
+
|
|
65
81
|
### 3. Run the autonomous agent wallet demo
|
|
66
82
|
|
|
67
83
|
```bash
|
|
@@ -70,6 +86,29 @@ npm run demo:autonomous-agent-wallet:devnet
|
|
|
70
86
|
|
|
71
87
|
Expected output: generated wallet address, devnet funding signature, live Marinade staking signature, and an owner emergency-lock block message.
|
|
72
88
|
|
|
89
|
+
### 3a. Run the full devnet feature matrix
|
|
90
|
+
|
|
91
|
+
This is the fastest one-command proof that the wallet stack is tryable on devnet. It exercises the CLI, managed wallets, SPL flows, policy controls, agent runtime, monitor/audit views, gasless memo path, security simulation, and the proof/session/policy anchoring path. With `ZK_COMPRESSION_API_URL` configured, the proof/session/policy path prefers Light compressed account storage on devnet and can fall back to commitment anchors in `defensible_devnet_demo` mode.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run demo:feature-matrix:devnet
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Published install:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
prkt-devnet-matrix
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Artifacts:
|
|
104
|
+
- `artifacts/devnet-feature-matrix.json`
|
|
105
|
+
- `artifacts/devnet-feature-matrix.md`
|
|
106
|
+
|
|
107
|
+
Optional live-expansion flags:
|
|
108
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_PROTOCOL_LIVE=1`
|
|
109
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_STRESS=1`
|
|
110
|
+
- `PRKT_DEVNET_MATRIX_INCLUDE_EXPORTS=1`
|
|
111
|
+
|
|
73
112
|
### 4. Run the autonomous portfolio demo
|
|
74
113
|
|
|
75
114
|
```bash
|
|
@@ -139,6 +178,10 @@ flowchart TD
|
|
|
139
178
|
| `npm run release:check` | — | Preflight readiness check |
|
|
140
179
|
| `npm run cli -- --help` | — | CLI help |
|
|
141
180
|
|
|
181
|
+
| `npm run wallet:status` | — | Local wallet status smoke check |
|
|
182
|
+
| `npm run demo:feature-matrix:devnet` | `LIVE` / `SIMULATED` | One-command devnet tryability run with JSON and Markdown artifacts |
|
|
183
|
+
| `npm run onchain:policy-guard:devnet` | `LIVE` | Fresh operator wallet, onchain policy init, program-vault funding, session open, onchain proof verification, managed transfer, session close |
|
|
184
|
+
|
|
142
185
|
### Live Devnet
|
|
143
186
|
|
|
144
187
|
| Command | Mode | Description |
|
|
@@ -149,13 +192,14 @@ flowchart TD
|
|
|
149
192
|
| `npm run defi:stake:devnet -- 0.15` | `LIVE` | Marinade stake on devnet |
|
|
150
193
|
| `npm run defi:orca:devnet -- 0.05` | `LIVE` | Orca Whirlpool LP position on devnet |
|
|
151
194
|
| `npm run defi:lp:devnet` | `LIVE` | Raydium LP on devnet |
|
|
152
|
-
| `npm run defi:kamino:devnet -- deposit` | `LIVE` | Kamino deposit on devnet |
|
|
153
|
-
| `npm run defi:kamino:devnet -- borrow` | `LIVE` | Kamino borrow on devnet |
|
|
195
|
+
| `npm run defi:kamino:devnet -- deposit` | `LIVE` / `SIMULATED` | Kamino deposit on devnet, with simulated fallback when the selected devnet market cannot execute live |
|
|
196
|
+
| `npm run defi:kamino:devnet -- borrow` | `LIVE` / `SIMULATED` | Kamino borrow on devnet, with simulated fallback when the selected devnet market cannot execute live |
|
|
154
197
|
| `npm run demo:multi-agent:devnet` | `LIVE` | Multi-agent devnet demo |
|
|
155
198
|
| `npm run simulate-attack` | `LIVE` | Security guardrail demo |
|
|
156
199
|
| `npm run stress:agents` | `LIVE` | Rate limit + circuit breaker demo |
|
|
157
200
|
|
|
158
201
|
Set `PRKT_AGENT_NAME=<agent-id>` to pin these autonomous/live scripts to a specific persistent agent wallet across reruns.
|
|
202
|
+
Set `PRKT_DEVNET_MATRIX_INCLUDE_PROTOCOL_LIVE=1` to make the feature matrix attempt the full live protocol tranche as well.
|
|
159
203
|
|
|
160
204
|
### Simulated
|
|
161
205
|
|
|
@@ -288,34 +332,37 @@ npm run release:check
|
|
|
288
332
|
# 2. Rehearsal (generates demo-session.json)
|
|
289
333
|
npm run demo:rehearsal
|
|
290
334
|
|
|
291
|
-
# 3.
|
|
335
|
+
# 3. Full devnet feature matrix
|
|
336
|
+
npm run demo:feature-matrix:devnet
|
|
337
|
+
|
|
338
|
+
# 4. Autonomous agent wallet demo (LIVE)
|
|
292
339
|
npm run demo:autonomous-agent-wallet:devnet
|
|
293
340
|
|
|
294
|
-
#
|
|
341
|
+
# 5. Autonomous portfolio demo (LIVE)
|
|
295
342
|
npm run demo:autonomous-portfolio:devnet
|
|
296
343
|
|
|
297
|
-
#
|
|
344
|
+
# 6. Wallet demo (LIVE)
|
|
298
345
|
npm run wallet:devnet
|
|
299
346
|
|
|
300
347
|
# 6. Raydium LP (LIVE) — requires raydium_lp.devnet.json
|
|
301
348
|
npm run defi:lp:devnet
|
|
302
349
|
|
|
303
|
-
#
|
|
350
|
+
# 8. Marinade stake (LIVE)
|
|
304
351
|
npm run defi:stake:devnet -- 0.15
|
|
305
352
|
|
|
306
|
-
#
|
|
353
|
+
# 9. Orca Whirlpool LP (LIVE)
|
|
307
354
|
npm run defi:orca:devnet -- 0.05
|
|
308
355
|
|
|
309
|
-
#
|
|
356
|
+
# 10. Kamino deposit (LIVE attempt on devnet; current portfolio demo falls back to simulated if reserve refresh is broken)
|
|
310
357
|
npm run defi:kamino:devnet -- deposit
|
|
311
358
|
|
|
312
|
-
#
|
|
359
|
+
# 11. Security guardrails
|
|
313
360
|
npm run simulate-attack
|
|
314
361
|
|
|
315
|
-
#
|
|
362
|
+
# 12. Multi-agent stress test
|
|
316
363
|
npm run stress:agents
|
|
317
364
|
|
|
318
|
-
#
|
|
365
|
+
# 13. Fill artifacts/bounty-evidence.md with signatures
|
|
319
366
|
```
|
|
320
367
|
|
|
321
368
|
---
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PolicyGuard } from "../policy/PolicyGuard";
|
|
2
|
+
import type { PolicyConstraints } from "../types/policy";
|
|
3
|
+
import { WalletManager } from "../wallet/WalletManager";
|
|
4
|
+
import { MockPriceFeed } from "./MockPriceFeed";
|
|
5
|
+
import { KoraSigner } from "../kora/KoraSigner";
|
|
6
|
+
import { type TradeSimulationResult } from "./AgentRuntime";
|
|
7
|
+
import { SwapExecutor } from "../dex/SwapExecutor";
|
|
8
|
+
export type ManagedAgent = {
|
|
9
|
+
id: string;
|
|
10
|
+
policy: PolicyConstraints;
|
|
11
|
+
policyGuard: PolicyGuard;
|
|
12
|
+
walletManager: WalletManager;
|
|
13
|
+
};
|
|
14
|
+
export type AgentSafetyControls = {
|
|
15
|
+
cooldownMs: number;
|
|
16
|
+
maxActionsPerWindow: number;
|
|
17
|
+
maxConsecutiveFailures: number;
|
|
18
|
+
windowMs: number;
|
|
19
|
+
};
|
|
20
|
+
export type ManagedSimulationEvent = {
|
|
21
|
+
agentId: string;
|
|
22
|
+
iteration: number;
|
|
23
|
+
result: TradeSimulationResult;
|
|
24
|
+
status: "executed";
|
|
25
|
+
} | {
|
|
26
|
+
agentId: string;
|
|
27
|
+
iteration: number;
|
|
28
|
+
reason: string;
|
|
29
|
+
status: "blocked" | "failed";
|
|
30
|
+
};
|
|
31
|
+
export declare class AgentManager {
|
|
32
|
+
static spawnAgents(count: number): ManagedAgent[];
|
|
33
|
+
static runConcurrentTradeSimulation(input: {
|
|
34
|
+
amountSol: number;
|
|
35
|
+
koraSigner: KoraSigner;
|
|
36
|
+
liveSwapConfig?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
outputMint: string;
|
|
39
|
+
swapExecutor: SwapExecutor | null;
|
|
40
|
+
};
|
|
41
|
+
logger?: (message: string) => void;
|
|
42
|
+
priceFeed: MockPriceFeed;
|
|
43
|
+
}): Promise<Array<{
|
|
44
|
+
agentId: string;
|
|
45
|
+
result: TradeSimulationResult;
|
|
46
|
+
}>>;
|
|
47
|
+
static runManagedTradeSimulation(input: {
|
|
48
|
+
amountSol: number;
|
|
49
|
+
koraSigner: KoraSigner;
|
|
50
|
+
liveSwapConfig?: {
|
|
51
|
+
enabled: boolean;
|
|
52
|
+
outputMint: string;
|
|
53
|
+
swapExecutor: SwapExecutor | null;
|
|
54
|
+
};
|
|
55
|
+
logger?: (message: string) => void;
|
|
56
|
+
priceFeed: MockPriceFeed;
|
|
57
|
+
rounds: number;
|
|
58
|
+
safetyControls?: Partial<AgentSafetyControls>;
|
|
59
|
+
simulateAction?: (agent: ManagedAgent) => Promise<TradeSimulationResult>;
|
|
60
|
+
}): Promise<ManagedSimulationEvent[]>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PolicyGuard } from "../policy/PolicyGuard";
|
|
2
|
+
import { KoraSigner, type GaslessExecutionResult } from "../kora/KoraSigner";
|
|
3
|
+
import { WalletManager } from "../wallet/WalletManager";
|
|
4
|
+
import { MockPriceFeed, type MarketSnapshot } from "./MockPriceFeed";
|
|
5
|
+
import { SwapExecutor, type LiveSwapResult } from "../dex/SwapExecutor";
|
|
6
|
+
import type { GuardedPreparedTransactionExecutor } from "../defi/universal";
|
|
7
|
+
export type TradeSimulationResult = {
|
|
8
|
+
action: "execute_swap" | "hold";
|
|
9
|
+
execution: GaslessExecutionResult | null;
|
|
10
|
+
liveSwap: LiveSwapResult | null;
|
|
11
|
+
market: MarketSnapshot;
|
|
12
|
+
memo: string | null;
|
|
13
|
+
};
|
|
14
|
+
export type RuntimeLogger = (message: string) => void;
|
|
15
|
+
export declare function simulateMarketAction(input: {
|
|
16
|
+
amountSol: number;
|
|
17
|
+
koraSigner: KoraSigner;
|
|
18
|
+
liveSwapConfig?: {
|
|
19
|
+
guardedExecutor?: GuardedPreparedTransactionExecutor;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
outputMint: string;
|
|
22
|
+
swapExecutor: SwapExecutor | null;
|
|
23
|
+
};
|
|
24
|
+
logger?: RuntimeLogger;
|
|
25
|
+
policyGuard: PolicyGuard;
|
|
26
|
+
priceFeed: MockPriceFeed;
|
|
27
|
+
walletManager: WalletManager;
|
|
28
|
+
}): Promise<TradeSimulationResult>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AccountInfo, Commitment, PublicKey, SendOptions, SignatureResult, TransactionConfirmationStrategy, VersionedTransaction } from "@solana/web3.js";
|
|
2
|
+
import { WalletManager } from "../wallet/WalletManager";
|
|
3
|
+
export type DecisionEngineConnection = {
|
|
4
|
+
confirmTransaction(strategy: TransactionConfirmationStrategy, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
5
|
+
getAccountInfo(publicKey: PublicKey, commitment?: Commitment): Promise<AccountInfo<Buffer> | null>;
|
|
6
|
+
getBalance(publicKey: PublicKey, commitment?: Commitment): Promise<number>;
|
|
7
|
+
getLatestBlockhash(commitment?: Commitment): Promise<{
|
|
8
|
+
blockhash: string;
|
|
9
|
+
lastValidBlockHeight: number;
|
|
10
|
+
}>;
|
|
11
|
+
getTokenAccountBalance(publicKey: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAccountBalanceValue>>;
|
|
12
|
+
sendTransaction(transaction: VersionedTransaction, options?: SendOptions): Promise<string>;
|
|
13
|
+
};
|
|
14
|
+
type RpcResponseAndContext<T> = {
|
|
15
|
+
context: {
|
|
16
|
+
apiVersion?: string;
|
|
17
|
+
slot: number;
|
|
18
|
+
};
|
|
19
|
+
value: T;
|
|
20
|
+
};
|
|
21
|
+
type TokenAccountBalanceValue = {
|
|
22
|
+
amount: string;
|
|
23
|
+
decimals: number;
|
|
24
|
+
uiAmount: number | null;
|
|
25
|
+
uiAmountString?: string;
|
|
26
|
+
};
|
|
27
|
+
export type DecisionResult = {
|
|
28
|
+
action: "hold";
|
|
29
|
+
associatedTokenAddress: string;
|
|
30
|
+
reason: string;
|
|
31
|
+
solBalance: number;
|
|
32
|
+
wsolBalance: number;
|
|
33
|
+
} | {
|
|
34
|
+
action: "wrap";
|
|
35
|
+
associatedTokenAddress: string;
|
|
36
|
+
createdAssociatedTokenAccount: boolean;
|
|
37
|
+
reason: string;
|
|
38
|
+
signature: string;
|
|
39
|
+
solBalance: number;
|
|
40
|
+
wrapAmount: number;
|
|
41
|
+
wsolBalance: number;
|
|
42
|
+
};
|
|
43
|
+
export declare class DecisionEngine {
|
|
44
|
+
private readonly connection;
|
|
45
|
+
private readonly walletManager;
|
|
46
|
+
private readonly logger;
|
|
47
|
+
constructor(connection: DecisionEngineConnection, walletManager: WalletManager, logger?: (message: string) => void);
|
|
48
|
+
think(): Promise<DecisionResult>;
|
|
49
|
+
private getWsolBalance;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SupportedProtocol } from "../../types/policy";
|
|
2
|
+
import type { MarketSnapshot } from "../../defi/types";
|
|
3
|
+
export type TransferSolIntent = {
|
|
4
|
+
type: "transfer-sol";
|
|
5
|
+
to: string;
|
|
6
|
+
lamports: number;
|
|
7
|
+
};
|
|
8
|
+
export type TransferSplIntent = {
|
|
9
|
+
type: "transfer-spl";
|
|
10
|
+
mint: string;
|
|
11
|
+
toOwner: string;
|
|
12
|
+
amountRaw: bigint;
|
|
13
|
+
};
|
|
14
|
+
export type CreateAtaIntent = {
|
|
15
|
+
type: "create-ata";
|
|
16
|
+
mint: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
};
|
|
19
|
+
export type MintTokenIntent = {
|
|
20
|
+
type: "mint-token";
|
|
21
|
+
mint: string;
|
|
22
|
+
toOwner: string;
|
|
23
|
+
amountRaw: bigint;
|
|
24
|
+
};
|
|
25
|
+
export type WriteMemoIntent = {
|
|
26
|
+
type: "write-memo";
|
|
27
|
+
memo: string;
|
|
28
|
+
};
|
|
29
|
+
export type DeFiCapabilityIntent = {
|
|
30
|
+
type: "defi-capability";
|
|
31
|
+
capability: "trade" | "lp" | "lending" | "borrowing" | "yield" | "staking";
|
|
32
|
+
protocol?: SupportedProtocol;
|
|
33
|
+
snapshot: MarketSnapshot;
|
|
34
|
+
};
|
|
35
|
+
export type AgentIntent = TransferSolIntent | TransferSplIntent | CreateAtaIntent | MintTokenIntent | WriteMemoIntent | DeFiCapabilityIntent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { AgentRunner } from "./runner/AgentRunner";
|
|
2
|
+
export { AgentRegistry } from "./registry/AgentRegistry";
|
|
3
|
+
export type { AgentContext, AgentLogger, Strategy } from "./types/AgentContext";
|
|
4
|
+
export type { AgentIntent, CreateAtaIntent, MintTokenIntent, TransferSolIntent, TransferSplIntent, WriteMemoIntent } from "./intents/types";
|
|
5
|
+
export { MemoHeartbeatStrategy } from "./strategies/MemoHeartbeatStrategy";
|
|
6
|
+
export { SimpleScriptedTransferStrategy } from "./strategies/SimpleScriptedTransferStrategy";
|
|
7
|
+
export { TokenRebalancerStrategy } from "./strategies/TokenRebalancerStrategy";
|
|
8
|
+
export { TreasuryDistributorStrategy } from "./strategies/TreasuryDistributorStrategy";
|
|
9
|
+
export { UniversalDeFiStrategy } from "./strategies/UniversalDeFiStrategy";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
2
|
+
export type RegisteredAgent = {
|
|
3
|
+
context: AgentContext;
|
|
4
|
+
strategy: Strategy;
|
|
5
|
+
};
|
|
6
|
+
export declare class AgentRegistry {
|
|
7
|
+
private readonly agents;
|
|
8
|
+
register(agent: RegisteredAgent): void;
|
|
9
|
+
get(agentId: string): RegisteredAgent | undefined;
|
|
10
|
+
list(): RegisteredAgent[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ApprovalCallback, type PolicyConfig } from "../../policy";
|
|
2
|
+
import type { AgentIntent } from "../intents/types";
|
|
3
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
4
|
+
export type IntentExecutionOutcome = {
|
|
5
|
+
intent: AgentIntent;
|
|
6
|
+
allowed: boolean;
|
|
7
|
+
signature: string | null;
|
|
8
|
+
reasons: string[];
|
|
9
|
+
};
|
|
10
|
+
export type AgentRunResult = {
|
|
11
|
+
agentId: string;
|
|
12
|
+
strategy: string;
|
|
13
|
+
outcomes: IntentExecutionOutcome[];
|
|
14
|
+
};
|
|
15
|
+
export declare class AgentRunner {
|
|
16
|
+
private readonly registry;
|
|
17
|
+
private readonly runtimes;
|
|
18
|
+
private readonly policyAccountManager;
|
|
19
|
+
private readonly auditLogManager;
|
|
20
|
+
private readonly sessionAnchor;
|
|
21
|
+
constructor();
|
|
22
|
+
registerCompressedAgent(input: {
|
|
23
|
+
context: AgentContext;
|
|
24
|
+
strategy: Strategy;
|
|
25
|
+
approvalMode?: "sandbox" | "live";
|
|
26
|
+
approvalCallback?: ApprovalCallback;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
registerAgent(input: {
|
|
29
|
+
context: AgentContext;
|
|
30
|
+
strategy: Strategy;
|
|
31
|
+
policyConfig?: PolicyConfig;
|
|
32
|
+
approvalMode?: "sandbox" | "live";
|
|
33
|
+
approvalCallback?: ApprovalCallback;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
closeAgentSession(agentId: string): Promise<{
|
|
36
|
+
commitment: string;
|
|
37
|
+
ledgerSlot: number;
|
|
38
|
+
} | null>;
|
|
39
|
+
listAgents(): Array<{
|
|
40
|
+
id: string;
|
|
41
|
+
strategy: string;
|
|
42
|
+
}>;
|
|
43
|
+
runOnceParallel(): Promise<AgentRunResult[]>;
|
|
44
|
+
runRounds(rounds: number): Promise<AgentRunResult[]>;
|
|
45
|
+
private executeIntents;
|
|
46
|
+
private buildIntentTransaction;
|
|
47
|
+
private executePreparedTransaction;
|
|
48
|
+
private createSandboxExecutor;
|
|
49
|
+
private mergePolicyConfig;
|
|
50
|
+
private mergeUnique;
|
|
51
|
+
}
|
|
@@ -4,16 +4,62 @@ exports.AgentRunner = void 0;
|
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const policy_1 = require("../../policy");
|
|
6
6
|
const AgentRegistry_1 = require("../registry/AgentRegistry");
|
|
7
|
+
const PolicyAccountManager_1 = require("../../compression/PolicyAccountManager");
|
|
8
|
+
const AuditLogManager_1 = require("../../compression/AuditLogManager");
|
|
9
|
+
const SessionAnchor_1 = require("../../anchoring/SessionAnchor");
|
|
10
|
+
const PRKTConfig_1 = require("../../config/PRKTConfig");
|
|
7
11
|
class AgentRunner {
|
|
8
12
|
registry = new AgentRegistry_1.AgentRegistry();
|
|
9
13
|
runtimes = new Map();
|
|
10
|
-
|
|
14
|
+
policyAccountManager;
|
|
15
|
+
auditLogManager;
|
|
16
|
+
sessionAnchor;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.policyAccountManager = new PolicyAccountManager_1.PolicyAccountManager(PRKTConfig_1.defaultPRKTConfig.zkCompression.rpcEndpoint);
|
|
19
|
+
this.auditLogManager = new AuditLogManager_1.AuditLogManager(PRKTConfig_1.defaultPRKTConfig.zkCompression.rpcEndpoint);
|
|
20
|
+
this.sessionAnchor = new SessionAnchor_1.SessionAnchor(PRKTConfig_1.defaultPRKTConfig.zkCompression.rpcEndpoint);
|
|
21
|
+
}
|
|
22
|
+
async registerCompressedAgent(input) {
|
|
23
|
+
if (!PRKTConfig_1.defaultPRKTConfig.zkCompression.enabled) {
|
|
24
|
+
return this.registerAgent(input);
|
|
25
|
+
}
|
|
26
|
+
// Wire policy READ through compressed account
|
|
27
|
+
const compressed = await this.policyAccountManager.fetchCompressedPolicyAccount(input.context.id);
|
|
28
|
+
const policyConfig = {
|
|
29
|
+
agentId: compressed.agentId,
|
|
30
|
+
approvalMode: input.approvalMode ?? "sandbox",
|
|
31
|
+
limits: {
|
|
32
|
+
maxTransactionsPerDay: 100, // Derived or default
|
|
33
|
+
maxTransactionsPerSession: 50,
|
|
34
|
+
maxSolPerTxLamports: Number(compressed.dailySpendLimit.toString()), // Approximated
|
|
35
|
+
maxSplPerTxRawAmount: BigInt(compressed.dailySpendLimit.toString())
|
|
36
|
+
},
|
|
37
|
+
rules: {
|
|
38
|
+
allowedMintAddresses: [],
|
|
39
|
+
allowedProgramIds: compressed.programAllowlist.map((pk) => pk.toBase58()),
|
|
40
|
+
allowOpaqueProgramIds: [],
|
|
41
|
+
denyUnknownInstructionsByDefault: true,
|
|
42
|
+
rejectSuspiciousBalanceDeltas: true,
|
|
43
|
+
requireSimulationSuccess: true
|
|
44
|
+
},
|
|
45
|
+
sessionExpiresAtIso8601: new Date(Date.now() + compressed.sessionTTL * 60000).toISOString()
|
|
46
|
+
};
|
|
47
|
+
this.registerAgent({
|
|
48
|
+
...input,
|
|
49
|
+
policyConfig
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async registerAgent(input) {
|
|
11
53
|
const policyConfig = input.policyConfig ?? input.context.policyConfig;
|
|
12
54
|
const policyEngine = new policy_1.PolicyEngine({
|
|
13
55
|
...policyConfig,
|
|
14
56
|
approvalMode: input.approvalMode ?? policyConfig.approvalMode
|
|
15
57
|
});
|
|
16
58
|
const sandboxExecutor = new policy_1.SandboxExecutor(policyEngine, input.context.transactionService, input.approvalMode ?? policyConfig.approvalMode, input.approvalCallback);
|
|
59
|
+
let sessionId;
|
|
60
|
+
if (PRKTConfig_1.defaultPRKTConfig.dataAnchoring.enabled) {
|
|
61
|
+
sessionId = (await this.sessionAnchor.startSession(input.context.id)).sessionId;
|
|
62
|
+
}
|
|
17
63
|
this.registry.register({
|
|
18
64
|
context: {
|
|
19
65
|
...input.context,
|
|
@@ -30,9 +76,20 @@ class AgentRunner {
|
|
|
30
76
|
approvalMode: input.approvalMode ?? policyConfig.approvalMode,
|
|
31
77
|
strategy: input.strategy,
|
|
32
78
|
policyEngine,
|
|
33
|
-
sandboxExecutor
|
|
79
|
+
sandboxExecutor,
|
|
80
|
+
sessionId
|
|
34
81
|
});
|
|
35
82
|
}
|
|
83
|
+
async closeAgentSession(agentId) {
|
|
84
|
+
const runtime = this.runtimes.get(agentId);
|
|
85
|
+
if (!runtime || !runtime.sessionId) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const logs = await this.auditLogManager.fetchAuditLog(agentId);
|
|
89
|
+
const result = await this.sessionAnchor.closeSession(runtime.sessionId, logs);
|
|
90
|
+
runtime.sessionId = undefined; // clear
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
36
93
|
listAgents() {
|
|
37
94
|
return this.registry.list().map((entry) => ({
|
|
38
95
|
id: entry.context.id,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentIntent } from "../intents/types";
|
|
2
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
3
|
+
export declare class MemoHeartbeatStrategy implements Strategy {
|
|
4
|
+
readonly name = "memo-heartbeat";
|
|
5
|
+
nextIntents(context: AgentContext): Promise<AgentIntent[]>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentIntent } from "../intents/types";
|
|
2
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
3
|
+
export declare class SimpleScriptedTransferStrategy implements Strategy {
|
|
4
|
+
private readonly plan;
|
|
5
|
+
readonly name = "simple-scripted-transfer";
|
|
6
|
+
constructor(plan: {
|
|
7
|
+
to: string;
|
|
8
|
+
lamports: number;
|
|
9
|
+
memo?: string;
|
|
10
|
+
});
|
|
11
|
+
nextIntents(_context: AgentContext): Promise<AgentIntent[]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentIntent } from "../intents/types";
|
|
2
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
3
|
+
export declare class TokenRebalancerStrategy implements Strategy {
|
|
4
|
+
private readonly config;
|
|
5
|
+
readonly name = "token-rebalancer";
|
|
6
|
+
constructor(config: {
|
|
7
|
+
mint: string;
|
|
8
|
+
targetOwner: string;
|
|
9
|
+
minBalanceUi: number;
|
|
10
|
+
topUpRawAmount: bigint;
|
|
11
|
+
});
|
|
12
|
+
nextIntents(context: AgentContext): Promise<AgentIntent[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentIntent } from "../intents/types";
|
|
2
|
+
import type { AgentContext, Strategy } from "../types/AgentContext";
|
|
3
|
+
export declare class TreasuryDistributorStrategy implements Strategy {
|
|
4
|
+
private readonly config;
|
|
5
|
+
readonly name = "treasury-distributor";
|
|
6
|
+
constructor(config: {
|
|
7
|
+
mint: string;
|
|
8
|
+
recipients: string[];
|
|
9
|
+
amountRawPerRecipient: bigint;
|
|
10
|
+
});
|
|
11
|
+
nextIntents(_context: AgentContext): Promise<AgentIntent[]>;
|
|
12
|
+
}
|