safehands-pharos 1.4.0 → 1.5.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/README.md +174 -63
- package/dist/cli.d.ts +5 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +126 -124
- package/dist/cli.js.map +1 -1
- package/dist/demo.d.ts +1 -1
- package/dist/demo.js +171 -171
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -65
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +65 -65
- package/dist/lib/constants.d.ts +303 -291
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +302 -292
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/dodoApi.d.ts +78 -78
- package/dist/lib/dodoApi.js +196 -196
- package/dist/lib/envLoader.d.ts +2 -0
- package/dist/lib/envLoader.d.ts.map +1 -0
- package/dist/lib/envLoader.js +44 -0
- package/dist/lib/envLoader.js.map +1 -0
- package/dist/lib/http.d.ts +14 -14
- package/dist/lib/http.js +118 -118
- package/dist/lib/pharosClient.d.ts +58 -58
- package/dist/lib/pharosClient.js +63 -63
- package/dist/lib/policy/actionPolicyEngine.d.ts +53 -53
- package/dist/lib/policy/actionPolicyEngine.js +212 -212
- package/dist/lib/riskEngine.d.ts +26 -26
- package/dist/lib/riskEngine.d.ts.map +1 -1
- package/dist/lib/riskEngine.js +288 -283
- package/dist/lib/riskEngine.js.map +1 -1
- package/dist/lib/signer/index.d.ts +24 -24
- package/dist/lib/signer/index.js +88 -88
- package/dist/lib/testDodoLive.d.ts +1 -1
- package/dist/lib/testDodoLive.js +104 -104
- package/dist/lib/testLiveSafehands.d.ts +1 -1
- package/dist/lib/testLiveSafehands.js +92 -92
- package/dist/lib/testRpcLive.d.ts +1 -1
- package/dist/lib/testRpcLive.js +88 -88
- package/dist/lib/testTools.js +397 -398
- package/dist/lib/testX402Live.d.ts +1 -1
- package/dist/lib/testX402Live.js +159 -159
- package/dist/lib/toolResponse.d.ts +25 -25
- package/dist/lib/toolResponse.js +53 -53
- package/dist/lib/wallet/index.d.ts +37 -37
- package/dist/lib/wallet/index.js +128 -128
- package/dist/scripts/checkDeploy.d.ts +1 -1
- package/dist/scripts/checkDeploy.js +24 -24
- package/dist/scripts/deployRegistry.d.ts +1 -1
- package/dist/scripts/deployRegistry.js +100 -100
- package/dist/scripts/testRegistry.d.ts +1 -1
- package/dist/scripts/testRegistry.js +43 -43
- package/dist/tools/approveToken.d.ts +45 -45
- package/dist/tools/approveToken.js +85 -85
- package/dist/tools/assessRisk.d.ts +79 -79
- package/dist/tools/assessRisk.js +104 -104
- package/dist/tools/checkAllowance.d.ts +43 -43
- package/dist/tools/checkAllowance.js +56 -56
- package/dist/tools/checkTokenSecurity.d.ts +46 -46
- package/dist/tools/checkTokenSecurity.js +95 -95
- package/dist/tools/createAgentWallet.d.ts +28 -26
- package/dist/tools/createAgentWallet.d.ts.map +1 -1
- package/dist/tools/createAgentWallet.js +82 -58
- package/dist/tools/createAgentWallet.js.map +1 -1
- package/dist/tools/estimateGas.d.ts +79 -79
- package/dist/tools/estimateGas.js +124 -124
- package/dist/tools/executeSwap.d.ts +61 -61
- package/dist/tools/executeSwap.js +141 -141
- package/dist/tools/explainRisk.d.ts +29 -29
- package/dist/tools/explainRisk.js +32 -32
- package/dist/tools/getAgentWallet.d.ts +21 -21
- package/dist/tools/getAgentWallet.js +27 -27
- package/dist/tools/getAgentWalletBalance.d.ts +11 -11
- package/dist/tools/getAgentWalletBalance.js +70 -70
- package/dist/tools/getExecutionHistory.d.ts +49 -49
- package/dist/tools/getExecutionHistory.js +154 -154
- package/dist/tools/getGasPrice.d.ts +43 -43
- package/dist/tools/getGasPrice.js +59 -59
- package/dist/tools/getPoolInfo.d.ts +75 -75
- package/dist/tools/getPoolInfo.js +137 -137
- package/dist/tools/getTokenPrice.d.ts +113 -113
- package/dist/tools/getTokenPrice.js +117 -117
- package/dist/tools/getTransactionStatus.d.ts +43 -43
- package/dist/tools/getTransactionStatus.js +59 -59
- package/dist/tools/getWalletBalance.d.ts +68 -68
- package/dist/tools/getWalletBalance.js +87 -87
- package/dist/tools/publishRiskScore.d.ts +63 -63
- package/dist/tools/publishRiskScore.js +88 -88
- package/dist/tools/queryRiskRegistry.d.ts +38 -38
- package/dist/tools/queryRiskRegistry.js +55 -55
- package/dist/tools/safehandsPreflightCheck.d.ts +77 -77
- package/dist/tools/safehandsPreflightCheck.js +47 -47
- package/dist/tools/safehandsRiskReport.d.ts +81 -81
- package/dist/tools/safehandsRiskReport.js +28 -28
- package/dist/tools/safehandsSafeExecute.d.ts +20 -20
- package/dist/tools/safehandsSafeExecute.js +81 -81
- package/dist/tools/safehandsWalletHealth.d.ts +14 -14
- package/dist/tools/safehandsWalletHealth.js +103 -103
- package/dist/tools/safehandsX402Preflight.d.ts +26 -26
- package/dist/tools/safehandsX402Preflight.js +65 -65
- package/dist/tools/sendPayment.d.ts +57 -57
- package/dist/tools/sendPayment.js +117 -117
- package/dist/tools/simulateTransaction.d.ts +60 -60
- package/dist/tools/simulateTransaction.js +83 -83
- package/dist/tools/tokenRegistryStatus.d.ts +26 -26
- package/dist/tools/tokenRegistryStatus.js +96 -96
- package/dist/tools/x402PayAndFetch.d.ts +81 -81
- package/dist/tools/x402PayAndFetch.js +152 -152
- package/dist/x402Server.d.ts +1 -1
- package/dist/x402Server.js +300 -252
- package/dist/x402Server.js.map +1 -1
- package/package.json +6 -16
- package/examples/dashboard/index.html +0 -337
- package/examples/pharos-skill-engine/SKILL.safehands.md +0 -85
- package/examples/pharos-skill-engine/assets/safehands/example-actions.json +0 -49
- package/examples/pharos-skill-engine/assets/safehands/policy-defaults.json +0 -11
- package/examples/pharos-skill-engine/references/safehands.md +0 -345
- package/examples/scenario-hack.ts +0 -38
- package/skill/SKILL.md +0 -133
- package/skill/assets/safehands/example-actions.json +0 -49
- package/skill/assets/safehands/policy-defaults.json +0 -11
- package/skill/references/safehands.md +0 -345
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
# SafeHands Guard Reference
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
SafeHands Guard is a Transaction Safety Firewall / Guardrail Skill for Pharos Skill Engine. It lets an AI agent run policy-based preflight checks before execution. The CLI adapter returns the same standard response envelope as the MCP tools.
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"success": true,
|
|
10
|
-
"data": {},
|
|
11
|
-
"error": null,
|
|
12
|
-
"timestamp": "ISO_DATE_STRING"
|
|
13
|
-
}
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Failure responses use:
|
|
17
|
-
|
|
18
|
-
```json
|
|
19
|
-
{
|
|
20
|
-
"success": false,
|
|
21
|
-
"data": null,
|
|
22
|
-
"error": {
|
|
23
|
-
"code": "ERROR_CODE",
|
|
24
|
-
"message": "Human-readable message",
|
|
25
|
-
"retryable": false,
|
|
26
|
-
"source": "source_name"
|
|
27
|
-
},
|
|
28
|
-
"timestamp": "ISO_DATE_STRING"
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Command Template
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npx safehands-pharos skill <tool_name> --input-json '<json>'
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
All outputs are valid JSON. Do not parse stdout as prose.
|
|
39
|
-
|
|
40
|
-
## SafeHands Preflight Check
|
|
41
|
-
|
|
42
|
-
### Overview
|
|
43
|
-
|
|
44
|
-
Use this command before any payment, token approval, swap, x402 payment, registry publish, or custom contract call. It returns `ALLOW`, `WARN`, `BLOCK`, `REQUIRE_CONFIRMATION`, `REQUIRE_FUNDING`, or `REQUIRE_TOKEN_REVIEW`.
|
|
45
|
-
|
|
46
|
-
### Command Template
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx safehands-pharos skill safehands_preflight_check --input-json '<action_json>'
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Example:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx safehands-pharos skill safehands_preflight_check --input-json '{"actionType":"approve_token","chainId":688689,"tokenAddress":"0xE0BE08c77f415F577A1B3A9aD7a1Df1479564ec8","spenderAddress":"0x0000000000000000000000000000000000000001","amount":"1"}'
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Parameters
|
|
59
|
-
|
|
60
|
-
| Parameter | Type | Required | Description |
|
|
61
|
-
|---|---|---|---|
|
|
62
|
-
| actionType | string | Yes | `send_payment`, `approve_token`, `execute_swap`, `x402_pay_and_fetch`, `publish_risk_score`, `custom_contract_call` |
|
|
63
|
-
| chainId | number | Yes | Must be `688689` for Pharos Atlantic Testnet |
|
|
64
|
-
| walletAddress | address | Optional | Agent wallet address |
|
|
65
|
-
| targetAddress | address | Optional | Recipient, spender, or contract target |
|
|
66
|
-
| tokenAddress | address | Optional | Token involved in the action |
|
|
67
|
-
| amount | string | Optional | Amount to send, approve, swap, or pay |
|
|
68
|
-
| url | string | Optional | x402 URL for x402 actions |
|
|
69
|
-
| approvalAmount | string | Optional | Approval amount, including `max` for unlimited approval |
|
|
70
|
-
| recipient | address | Optional | Payment recipient |
|
|
71
|
-
| spender | address | Optional | Token spender |
|
|
72
|
-
|
|
73
|
-
### Output Parsing
|
|
74
|
-
|
|
75
|
-
| Field | Meaning |
|
|
76
|
-
|---|---|
|
|
77
|
-
| decision | `ALLOW`, `WARN`, `BLOCK`, `REQUIRE_CONFIRMATION`, `REQUIRE_FUNDING`, `REQUIRE_TOKEN_REVIEW` |
|
|
78
|
-
| riskLevel | `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`, `UNKNOWN` |
|
|
79
|
-
| safeToExecute | `true` or `false` |
|
|
80
|
-
| reasons | Why SafeHands made the decision |
|
|
81
|
-
| requiredActions | What user/agent should do next |
|
|
82
|
-
| checks | Individual policy checks |
|
|
83
|
-
| environment | Expected to be `atlantic-testnet` |
|
|
84
|
-
| chainId | Expected to be `688689` |
|
|
85
|
-
| isMainnet | Expected to be `false` |
|
|
86
|
-
|
|
87
|
-
### Error Handling
|
|
88
|
-
|
|
89
|
-
| Error code | Meaning | Agent action |
|
|
90
|
-
|---|---|---|
|
|
91
|
-
| `TOOL_EXECUTION_FAILED` | Input failed schema validation or handler threw | Fix the JSON input and retry |
|
|
92
|
-
| `CHAIN_ID_MISMATCH` | Action targets the wrong chain | Switch to Pharos Atlantic Testnet |
|
|
93
|
-
| `MAINNET_NOT_SUPPORTED` | Mainnet action was requested | Do not execute |
|
|
94
|
-
| `POLICY_BLOCKED` | Safety policy blocked execution | Explain reasons to the user |
|
|
95
|
-
|
|
96
|
-
### Agent Guidelines
|
|
97
|
-
|
|
98
|
-
1. Always run preflight before write actions.
|
|
99
|
-
2. If decision is `BLOCK`, do not execute the action.
|
|
100
|
-
3. If decision is `WARN`, explain the risk and ask for user confirmation.
|
|
101
|
-
4. If decision is `REQUIRE_CONFIRMATION`, ask for explicit user approval.
|
|
102
|
-
5. If decision is `ALLOW`, the action may continue through Pharos Skill Engine or MCP execution.
|
|
103
|
-
|
|
104
|
-
## SafeHands x402 Preflight
|
|
105
|
-
|
|
106
|
-
### Overview
|
|
107
|
-
|
|
108
|
-
Use this command before paying any x402 resource. It checks URL safety, SSRF protection, endpoint probing when requested, payment amount, token, signer readiness, `MAX_X402_PAYMENT_USDC`, and whether payment appears required.
|
|
109
|
-
|
|
110
|
-
### Command Template
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
npx safehands-pharos skill safehands_x402_preflight --input-json '<x402_action_json>'
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Example:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
npx safehands-pharos skill safehands_x402_preflight --input-json '{"url":"https://example.com/assess-risk","paymentAmountUsdc":"0.001","probeEndpoint":false}'
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Parameters
|
|
123
|
-
|
|
124
|
-
| Parameter | Type | Required | Description |
|
|
125
|
-
|---|---|---|---|
|
|
126
|
-
| url | string | Yes | x402 resource URL |
|
|
127
|
-
| method | string | Optional | HTTP method, default `GET` |
|
|
128
|
-
| paymentAmountUsdc | string | Optional | Estimated USDC payment amount |
|
|
129
|
-
| paymentTokenAddress | address | Optional | x402 payment token address |
|
|
130
|
-
| agentId | string | Optional | Managed wallet agent ID for signer readiness |
|
|
131
|
-
| probeEndpoint | boolean | Optional | If true, SafeHands probes the endpoint to detect HTTP 402 |
|
|
132
|
-
|
|
133
|
-
### Output Parsing
|
|
134
|
-
|
|
135
|
-
| Field | Meaning |
|
|
136
|
-
|---|---|
|
|
137
|
-
| decision | Safety decision for payment |
|
|
138
|
-
| safeToExecute | Whether the agent may continue |
|
|
139
|
-
| safeToPay | Interpret as true only when `decision` is `ALLOW` |
|
|
140
|
-
| paymentAmountUsdc | Estimated payment amount |
|
|
141
|
-
| maxPaymentUsdc | Configured `MAX_X402_PAYMENT_USDC` |
|
|
142
|
-
| signerAvailable | Whether a signer is available if payment is required |
|
|
143
|
-
| probe.paymentRequired | `true`, `false`, or `unknown` |
|
|
144
|
-
|
|
145
|
-
### Error Handling
|
|
146
|
-
|
|
147
|
-
| Error code | Meaning | Agent action |
|
|
148
|
-
|---|---|---|
|
|
149
|
-
| `SSRF_BLOCKED` | URL points to local/private/unsafe host | Do not fetch or pay |
|
|
150
|
-
| `NO_SIGNER_AVAILABLE` | Payment may require signer but none is ready | Ask user to configure managed wallet or signer |
|
|
151
|
-
| `POLICY_BLOCKED` | Amount, URL, token, or chain failed policy | Do not pay |
|
|
152
|
-
|
|
153
|
-
### Agent Guidelines
|
|
154
|
-
|
|
155
|
-
1. Run x402 preflight before paying any x402 resource.
|
|
156
|
-
2. If the endpoint is free, do not request a private key.
|
|
157
|
-
3. If HTTP 402/payment is required, verify amount, token, URL, and signer readiness.
|
|
158
|
-
4. If decision is `BLOCK`, do not pay.
|
|
159
|
-
5. If signer is unavailable, ask user to configure managed wallet or signer.
|
|
160
|
-
|
|
161
|
-
## SafeHands Wallet Health
|
|
162
|
-
|
|
163
|
-
### Overview
|
|
164
|
-
|
|
165
|
-
Use this command to check whether the current or managed agent wallet can pay gas, pay x402 resources, and execute write tools safely.
|
|
166
|
-
|
|
167
|
-
### Command Template
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
npx safehands-pharos skill safehands_wallet_health --input-json '{}'
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Parameters
|
|
174
|
-
|
|
175
|
-
| Parameter | Type | Required | Description |
|
|
176
|
-
|---|---|---|---|
|
|
177
|
-
| agentId | string | Optional | Managed wallet agent ID |
|
|
178
|
-
| walletAddress | address | Optional | Explicit wallet address for read-only balance checks |
|
|
179
|
-
|
|
180
|
-
### Output Parsing
|
|
181
|
-
|
|
182
|
-
| Field | Meaning |
|
|
183
|
-
|---|---|
|
|
184
|
-
| status | `READY`, `DEGRADED`, or `NOT_READY` |
|
|
185
|
-
| walletReady | Treat as true only when status is `READY` |
|
|
186
|
-
| walletMode | `none`, `env`, `managed-testnet`, or future signer mode |
|
|
187
|
-
| writeToolsEnabled | Whether execution tools can broadcast |
|
|
188
|
-
| readiness.canPayGas | PHRS gas readiness |
|
|
189
|
-
| readiness.canPayX402 | USDC x402 readiness |
|
|
190
|
-
| readiness.canExecuteWrites | Signer + gas + write-tool readiness |
|
|
191
|
-
| balances.PHRS | Native gas balance if RPC is available |
|
|
192
|
-
| balances.USDC | USDC balance if RPC is available |
|
|
193
|
-
|
|
194
|
-
### Error Handling
|
|
195
|
-
|
|
196
|
-
| Error code | Meaning | Agent action |
|
|
197
|
-
|---|---|---|
|
|
198
|
-
| `RPC_UNAVAILABLE` | RPC balance read failed | Treat wallet health as degraded and retry later |
|
|
199
|
-
| `NO_SIGNER_AVAILABLE` | No signer mode configured | Ask user to configure wallet mode |
|
|
200
|
-
| `WALLET_ENCRYPTION_KEY_REQUIRED` | Persistent managed wallet needs encryption key | Ask user to configure testnet wallet storage |
|
|
201
|
-
|
|
202
|
-
### Agent Guidelines
|
|
203
|
-
|
|
204
|
-
1. Run wallet health before x402 payment or write execution.
|
|
205
|
-
2. Do not execute writes if `writeToolsEnabled` is false.
|
|
206
|
-
3. If RPC is unavailable, report degraded status rather than assuming the wallet is funded.
|
|
207
|
-
4. If signer is unavailable, do not ask the user to paste a key into chat.
|
|
208
|
-
|
|
209
|
-
## Token Registry Status
|
|
210
|
-
|
|
211
|
-
### Overview
|
|
212
|
-
|
|
213
|
-
Use this command to classify whether a token is canonical, test liquidity, custom/non-registry, unknown, or invalid. The exact user-provided token address is checked; SafeHands does not silently replace it.
|
|
214
|
-
|
|
215
|
-
### Command Template
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
npx safehands-pharos skill token_registry_status --input-json '{"token":"<token_address>"}'
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Parameters
|
|
222
|
-
|
|
223
|
-
| Parameter | Type | Required | Description |
|
|
224
|
-
|---|---|---|---|
|
|
225
|
-
| token | string | Yes | Token symbol or exact contract address to classify |
|
|
226
|
-
|
|
227
|
-
### Status Values
|
|
228
|
-
|
|
229
|
-
| Status | Meaning |
|
|
230
|
-
|---|---|
|
|
231
|
-
| `CANONICAL_TESTNET_TOKEN` | Token is recognized as canonical for this testnet config |
|
|
232
|
-
| `TEST_LIQUIDITY_TOKEN` | Token is a test/demo liquidity token |
|
|
233
|
-
| `CUSTOM_NON_REGISTRY` | Valid address but not in SafeHands registry |
|
|
234
|
-
| `UNKNOWN` | Unknown status |
|
|
235
|
-
| `INVALID_ADDRESS` | Input is not a valid EVM address or known symbol |
|
|
236
|
-
|
|
237
|
-
### Output Parsing
|
|
238
|
-
|
|
239
|
-
| Field | Meaning |
|
|
240
|
-
|---|---|
|
|
241
|
-
| status | Registry classification |
|
|
242
|
-
| normalizedAddress | Checksummed address when valid |
|
|
243
|
-
| verificationStatus | `DOCS_VERIFIED`, `PROJECT_CONFIGURED`, `UNVERIFIED_CUSTOM_TOKEN`, etc. |
|
|
244
|
-
| docsSource | Source used for classification, when available |
|
|
245
|
-
|
|
246
|
-
### Error Handling
|
|
247
|
-
|
|
248
|
-
| Error code | Meaning | Agent action |
|
|
249
|
-
|---|---|---|
|
|
250
|
-
| `TOOL_EXECUTION_FAILED` | Missing token input or malformed request | Ask for exact token address |
|
|
251
|
-
|
|
252
|
-
### Agent Guidelines
|
|
253
|
-
|
|
254
|
-
1. Never silently replace user-provided token addresses.
|
|
255
|
-
2. If token is custom, clearly say it is custom/non-registry.
|
|
256
|
-
3. If token is canonical, show `docsSource` or `verificationStatus`.
|
|
257
|
-
|
|
258
|
-
## Explain Risk
|
|
259
|
-
|
|
260
|
-
### Overview
|
|
261
|
-
|
|
262
|
-
Use this command to convert a policy result into a concise human-readable explanation.
|
|
263
|
-
|
|
264
|
-
### Command Template
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
npx safehands-pharos skill explain_risk --input-json '<risk_json>'
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Parameters
|
|
271
|
-
|
|
272
|
-
| Parameter | Type | Required | Description |
|
|
273
|
-
|---|---|---|---|
|
|
274
|
-
| decision | string | Yes | Policy decision |
|
|
275
|
-
| riskLevel | string | Yes | Risk level |
|
|
276
|
-
| reasons | string[] | Optional | Reasons returned by policy engine |
|
|
277
|
-
| requiredActions | string[] | Optional | Required next actions |
|
|
278
|
-
|
|
279
|
-
### Output Parsing
|
|
280
|
-
|
|
281
|
-
| Field | Meaning |
|
|
282
|
-
|---|---|
|
|
283
|
-
| explanation | Human-readable explanation |
|
|
284
|
-
| decision | Original policy decision |
|
|
285
|
-
| riskLevel | Original risk level |
|
|
286
|
-
|
|
287
|
-
### Error Handling
|
|
288
|
-
|
|
289
|
-
| Error code | Meaning | Agent action |
|
|
290
|
-
|---|---|---|
|
|
291
|
-
| `TOOL_EXECUTION_FAILED` | Invalid risk JSON | Re-run with a policy result or valid fields |
|
|
292
|
-
|
|
293
|
-
### Agent Guidelines
|
|
294
|
-
|
|
295
|
-
1. Use this after a preflight result when the user asks “why?”.
|
|
296
|
-
2. Keep the explanation factual and tied to SafeHands reasons.
|
|
297
|
-
3. Do not override a `BLOCK` decision with reassuring language.
|
|
298
|
-
|
|
299
|
-
## SafeHands Risk Report
|
|
300
|
-
|
|
301
|
-
### Overview
|
|
302
|
-
|
|
303
|
-
Use this command to generate a judge/demo-friendly safety report. It runs preflight and returns a summary, reasons, required actions, checks, and environment.
|
|
304
|
-
|
|
305
|
-
### Command Template
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
npx safehands-pharos skill safehands_risk_report --input-json '<action_or_policy_result_json>'
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Parameters
|
|
312
|
-
|
|
313
|
-
| Parameter | Type | Required | Description |
|
|
314
|
-
|---|---|---|---|
|
|
315
|
-
| actionType | string | Yes | Same action type list as preflight |
|
|
316
|
-
| chainId | number | Optional | Defaults to Pharos Atlantic Testnet |
|
|
317
|
-
| amount | string | Optional | Amount involved |
|
|
318
|
-
| tokenAddress | address | Optional | Token involved |
|
|
319
|
-
| url | string | Optional | x402 URL when relevant |
|
|
320
|
-
| includeChecks | boolean | Optional | Include detailed policy checks, default true |
|
|
321
|
-
|
|
322
|
-
### Output Parsing
|
|
323
|
-
|
|
324
|
-
| Field | Meaning |
|
|
325
|
-
|---|---|
|
|
326
|
-
| summary | Human-readable risk report |
|
|
327
|
-
| decision | Safety decision |
|
|
328
|
-
| riskLevel | Risk level |
|
|
329
|
-
| reasons | Reasons for decision |
|
|
330
|
-
| requiredActions | Next steps |
|
|
331
|
-
| checks | Detailed checks when requested |
|
|
332
|
-
|
|
333
|
-
### Error Handling
|
|
334
|
-
|
|
335
|
-
| Error code | Meaning | Agent action |
|
|
336
|
-
|---|---|---|
|
|
337
|
-
| `TOOL_EXECUTION_FAILED` | Invalid action JSON | Fix the action JSON and retry |
|
|
338
|
-
| `POLICY_BLOCKED` | Safety policy blocked the action | Do not execute the action |
|
|
339
|
-
|
|
340
|
-
### Agent Guidelines
|
|
341
|
-
|
|
342
|
-
1. Use this for demos, user-facing summaries, and audit trails.
|
|
343
|
-
2. If the report says `BLOCK`, stop execution.
|
|
344
|
-
3. If the report says `WARN` or `REQUIRE_CONFIRMATION`, ask for explicit user confirmation.
|
|
345
|
-
4. If the report says `ALLOW`, the action may continue through Pharos Skill Engine or MCP execution.
|