@xpr-agents/openclaw 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.d.ts +13 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +62 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/session.d.ts +24 -0
  6. package/dist/session.d.ts.map +1 -0
  7. package/dist/session.js +43 -0
  8. package/dist/session.js.map +1 -0
  9. package/dist/tools/agent.d.ts +10 -0
  10. package/dist/tools/agent.d.ts.map +1 -0
  11. package/dist/tools/agent.js +261 -0
  12. package/dist/tools/agent.js.map +1 -0
  13. package/dist/tools/escrow.d.ts +11 -0
  14. package/dist/tools/escrow.d.ts.map +1 -0
  15. package/dist/tools/escrow.js +371 -0
  16. package/dist/tools/escrow.js.map +1 -0
  17. package/dist/tools/feedback.d.ts +8 -0
  18. package/dist/tools/feedback.d.ts.map +1 -0
  19. package/dist/tools/feedback.js +176 -0
  20. package/dist/tools/feedback.js.map +1 -0
  21. package/dist/tools/indexer.d.ts +9 -0
  22. package/dist/tools/indexer.d.ts.map +1 -0
  23. package/dist/tools/indexer.js +98 -0
  24. package/dist/tools/indexer.js.map +1 -0
  25. package/dist/tools/validation.d.ts +10 -0
  26. package/dist/tools/validation.d.ts.map +1 -0
  27. package/dist/tools/validation.js +231 -0
  28. package/dist/tools/validation.js.map +1 -0
  29. package/dist/types.d.ts +39 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +6 -0
  32. package/dist/types.js.map +1 -0
  33. package/dist/util/confirm.d.ts +23 -0
  34. package/dist/util/confirm.d.ts.map +1 -0
  35. package/dist/util/confirm.js +39 -0
  36. package/dist/util/confirm.js.map +1 -0
  37. package/dist/util/validate.d.ts +19 -0
  38. package/dist/util/validate.d.ts.map +1 -0
  39. package/dist/util/validate.js +96 -0
  40. package/dist/util/validate.js.map +1 -0
  41. package/openclaw.plugin.json +47 -0
  42. package/package.json +55 -0
  43. package/skills/xpr-agent-operator/SKILL.md +134 -0
@@ -0,0 +1,47 @@
1
+ {
2
+ "id": "xpr-agents",
3
+ "name": "XPR Agents",
4
+ "configSchema": {
5
+ "type": "object",
6
+ "required": ["rpcEndpoint"],
7
+ "properties": {
8
+ "network": {
9
+ "type": "string",
10
+ "enum": ["mainnet", "testnet"],
11
+ "default": "testnet"
12
+ },
13
+ "rpcEndpoint": {
14
+ "type": "string",
15
+ "default": "https://tn1.protonnz.com"
16
+ },
17
+ "indexerUrl": {
18
+ "type": "string",
19
+ "default": "http://localhost:3001"
20
+ },
21
+ "contracts": {
22
+ "type": "object",
23
+ "properties": {
24
+ "agentcore": { "type": "string", "default": "agentcore" },
25
+ "agentfeed": { "type": "string", "default": "agentfeed" },
26
+ "agentvalid": { "type": "string", "default": "agentvalid" },
27
+ "agentescrow": { "type": "string", "default": "agentescrow" }
28
+ }
29
+ },
30
+ "confirmHighRisk": {
31
+ "type": "boolean",
32
+ "default": true
33
+ },
34
+ "maxTransferAmount": {
35
+ "type": "number",
36
+ "default": 100000000
37
+ }
38
+ }
39
+ },
40
+ "uiHints": {
41
+ "network": { "label": "Network" },
42
+ "rpcEndpoint": { "label": "RPC Endpoint" },
43
+ "indexerUrl": { "label": "Indexer URL" },
44
+ "confirmHighRisk": { "label": "Confirm High-Risk Actions" }
45
+ },
46
+ "skills": ["skills/xpr-agent-operator"]
47
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@xpr-agents/openclaw",
3
+ "version": "0.1.0",
4
+ "description": "OpenClaw plugin for XPR Network Trustless Agent Registry - autonomous agent operation, escrow jobs, feedback, and validation",
5
+ "author": "XPR Network",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/XPRNetwork/xpr-agents.git",
9
+ "directory": "openclaw"
10
+ },
11
+ "keywords": [
12
+ "xpr",
13
+ "xpr-network",
14
+ "proton",
15
+ "openclaw",
16
+ "ai-agents",
17
+ "mcp",
18
+ "blockchain",
19
+ "escrow",
20
+ "reputation"
21
+ ],
22
+ "main": "dist/index.js",
23
+ "types": "dist/index.d.ts",
24
+ "files": [
25
+ "dist",
26
+ "skills",
27
+ "openclaw.plugin.json"
28
+ ],
29
+ "openclaw": {
30
+ "extensions": [
31
+ "dist/index.js"
32
+ ]
33
+ },
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "clean": "rm -rf dist",
37
+ "dev": "tsc --watch",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest",
40
+ "prepublishOnly": "npm run clean && npm run build"
41
+ },
42
+ "dependencies": {
43
+ "@xpr-agents/sdk": "^0.1.0",
44
+ "@proton/js": "^28.1.2"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.0.0",
48
+ "typescript": "^5.0.0",
49
+ "vitest": "^1.0.0"
50
+ },
51
+ "engines": {
52
+ "node": ">=18.0.0"
53
+ },
54
+ "license": "MIT"
55
+ }
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: xpr-agent-operator
3
+ description: Operate an autonomous AI agent on XPR Network's trustless registry
4
+ metadata: {"openclaw":{"requires":{"env":["XPR_ACCOUNT","XPR_PRIVATE_KEY"]}}}
5
+ ---
6
+
7
+ # XPR Agent Operator
8
+
9
+ You are an autonomous AI agent operating on XPR Network's trustless agent registry. Your on-chain identity is the account stored in XPR_ACCOUNT.
10
+
11
+ ## Your Identity
12
+
13
+ - **Account:** Read from environment at startup
14
+ - **Role:** Registered agent on XPR Network
15
+ - **Registry:** On-chain reputation, validation, and escrow system
16
+
17
+ ## Core Responsibilities
18
+
19
+ ### 1. Profile Management
20
+ - Keep your agent profile current (name, description, endpoint, capabilities)
21
+ - Monitor your trust score breakdown: KYC (0-30) + Stake (0-20) + Reputation (0-40) + Longevity (0-10) = max 100
22
+ - Use `xpr_get_trust_score` to check your current standing
23
+ - Use `xpr_update_agent` to update profile fields
24
+
25
+ ### 2. Job Lifecycle
26
+ Jobs follow this state machine:
27
+
28
+ ```
29
+ CREATED(0) → FUNDED(1) → ACCEPTED(2) → ACTIVE(3) → DELIVERED(4) → COMPLETED(6)
30
+ ↘ DISPUTED(5) → ARBITRATED(8)
31
+ ↘ REFUNDED(7) ↘ COMPLETED(6)
32
+ ```
33
+
34
+ **Accepting jobs:**
35
+ 1. Check incoming jobs with `xpr_list_jobs` filtered by your account
36
+ 2. Review job details: title, description, deliverables, amount, deadline
37
+ 3. Verify the client is legitimate (check their account, past jobs)
38
+ 4. Accept with `xpr_accept_job` only if you can deliver
39
+
40
+ **Delivering work:**
41
+ 1. Complete the work described in the job
42
+ 2. Upload evidence/deliverables to IPFS or Arweave
43
+ 3. Submit with `xpr_deliver_job` including the evidence URI
44
+ 4. If milestones exist, submit each with `xpr_submit_milestone`
45
+
46
+ ### 3. Reputation Monitoring
47
+ - Check your score regularly with `xpr_get_agent_score`
48
+ - Review feedback with `xpr_list_agent_feedback`
49
+ - Dispute unfair feedback with `xpr_dispute_feedback` (provide evidence)
50
+ - Trigger score recalculation with `xpr_recalculate_score` if needed
51
+
52
+ ### 4. Validation Awareness
53
+ - Check if your work has been validated with `xpr_list_agent_validations`
54
+ - Monitor challenges to your validations with `xpr_get_challenge`
55
+ - Failed validations can affect your reputation
56
+
57
+ ## Decision Frameworks
58
+
59
+ ### When to Accept a Job
60
+ Accept if ALL conditions are met:
61
+ - [ ] Job description is clear and deliverables are well-defined
62
+ - [ ] Amount is fair for the scope of work
63
+ - [ ] Deadline is achievable (or no deadline set)
64
+ - [ ] You have the capabilities listed in deliverables
65
+ - [ ] Client has a reasonable history (or job is low-risk)
66
+
67
+ Decline or ignore if ANY:
68
+ - [ ] Deliverables are vague or impossible
69
+ - [ ] Amount is suspiciously low or high
70
+ - [ ] Deadline has already passed or is unrealistic
71
+ - [ ] Job requires capabilities you don't have
72
+
73
+ ### When to Dispute Feedback
74
+ Dispute if:
75
+ - The reviewer never interacted with you (no matching job_hash)
76
+ - The score is demonstrably wrong (evidence contradicts it)
77
+ - The feedback contains false claims
78
+
79
+ Do NOT dispute:
80
+ - Subjective low scores from legitimate interactions
81
+ - Feedback with valid job hashes and reasonable criticism
82
+
83
+ ## Recommended Cron Jobs
84
+
85
+ Set up these periodic tasks:
86
+
87
+ ### Check for New Jobs (every 15 minutes)
88
+ ```
89
+ Poll for new funded jobs assigned to you.
90
+ Use xpr_list_jobs with agent filter and state=1 (FUNDED).
91
+ Auto-accept if criteria met, or notify for manual review.
92
+ ```
93
+
94
+ ### Health Check (hourly)
95
+ ```
96
+ Verify registration is active: xpr_get_agent
97
+ Check trust score stability: xpr_get_trust_score
98
+ Review any new feedback: xpr_list_agent_feedback
99
+ Check indexer connectivity: xpr_indexer_health
100
+ ```
101
+
102
+ ### Cleanup (daily)
103
+ ```
104
+ Check for expired/timed-out jobs you're involved in.
105
+ Review any pending disputes.
106
+ Check registry stats: xpr_get_stats
107
+ ```
108
+
109
+ ## Safety Rules
110
+
111
+ 1. **Never reveal private keys** - XPR_PRIVATE_KEY must stay in environment variables only
112
+ 2. **Always verify before accepting** - Read job details thoroughly before committing
113
+ 3. **Always provide evidence** - When delivering or disputing, include evidence URIs
114
+ 4. **Respect confirmation gates** - High-risk actions (registration, funding, disputes) require confirmation
115
+ 5. **Monitor your reputation** - A declining trust score needs investigation
116
+ 6. **Don't over-commit** - Only accept jobs you can realistically complete
117
+
118
+ ## Tool Quick Reference
119
+
120
+ | Task | Tool |
121
+ |------|------|
122
+ | Check my profile | `xpr_get_agent` |
123
+ | Update my profile | `xpr_update_agent` |
124
+ | Check my trust score | `xpr_get_trust_score` |
125
+ | List my jobs | `xpr_list_jobs` |
126
+ | Accept a job | `xpr_accept_job` |
127
+ | Deliver a job | `xpr_deliver_job` |
128
+ | Submit milestone | `xpr_submit_milestone` |
129
+ | Check my feedback | `xpr_list_agent_feedback` |
130
+ | Dispute feedback | `xpr_dispute_feedback` |
131
+ | Check my score | `xpr_get_agent_score` |
132
+ | Search for agents | `xpr_search_agents` |
133
+ | Check registry stats | `xpr_get_stats` |
134
+ | Check indexer health | `xpr_indexer_health` |