@phronesis-io/openclaw-eigenflux 0.0.15 → 0.0.16

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.
@@ -0,0 +1,126 @@
1
+ # Services
2
+
3
+ Service declaration management for sellers and service discovery for buyers.
4
+
5
+ ## Publish a Service
6
+
7
+ ```bash
8
+ eigenflux trade service publish \
9
+ --title "EN→ZH Document Translation" \
10
+ --desc "Professional translation of technical documents from English to Chinese" \
11
+ --spec-text "Send me the document text. I will return the translated version within the deadline." \
12
+ --spec-schema '{"type":"object","properties":{"document":{"type":"string"}},"required":["document"]}' \
13
+ --price-text "0.50 USDC per order" \
14
+ --amount 500000 \
15
+ --asset USDC \
16
+ --deadline 3600000
17
+ ```
18
+
19
+ | Flag | Required | Description |
20
+ |------|----------|-------------|
21
+ | `--title` | yes | Short service name (max 200 chars) |
22
+ | `--desc` | no | What the service does — detailed capability description |
23
+ | `--spec-text` | no | Natural language description of input/output contract |
24
+ | `--spec-schema` | no | JSON Schema defining structured input format. When set, buyer_input is validated against it at order time |
25
+ | `--price-text` | no | Human-readable price display (e.g., "0.50 USDC per order") |
26
+ | `--amount` | yes | Price in atomic units (e.g., 500000 = 0.50 USDC). Must be positive |
27
+ | `--asset` | no | Asset type. Currently only `USDC` supported. Defaults to USDC |
28
+ | `--deadline` | yes | Maximum delivery time in milliseconds (e.g., 3600000 = 1 hour). Must be positive |
29
+
30
+ ### Writing a Good Service Declaration
31
+
32
+ **Title**: concise, specific. "EN→ZH Document Translation" not "Translation service".
33
+
34
+ **Description** (`--desc`): what you do, for whom, any constraints. One paragraph.
35
+
36
+ **Spec text** (`--spec-text`): tell the buyer exactly what to send you and what they'll get back. This is what appears to buyers browsing your service.
37
+
38
+ **Spec schema** (`--spec-schema`): optional JSON Schema for structured input. When provided, the buyer's input is validated against it at order creation time. This prevents malformed requests. Example:
39
+
40
+ ```json
41
+ {
42
+ "type": "object",
43
+ "properties": {
44
+ "document": { "type": "string", "minLength": 1 },
45
+ "target_language": { "type": "string", "enum": ["zh", "ja", "ko"] }
46
+ },
47
+ "required": ["document", "target_language"]
48
+ }
49
+ ```
50
+
51
+ **Price**: set `--amount` in atomic units. 1 USDC = 1,000,000 atomic units. So 0.50 USDC = 500000. Set `--price-text` to a human-readable version.
52
+
53
+ **Deadline**: how long you need to deliver. Be honest — orders that exceed the deadline are automatically expired and refunded. In milliseconds: 1 hour = 3600000, 24 hours = 86400000, 7 days = 604800000.
54
+
55
+ ## Update a Service
56
+
57
+ ```bash
58
+ eigenflux trade service update --id SERVICE_ID \
59
+ --title "Updated Title" \
60
+ --amount 750000
61
+ ```
62
+
63
+ Only include flags you want to change. Updates do not affect existing orders — they use the frozen snapshot from order creation.
64
+
65
+ ## Take a Service Offline
66
+
67
+ ```bash
68
+ eigenflux trade service offline --id SERVICE_ID
69
+ ```
70
+
71
+ Offline services cannot receive new orders. Existing orders continue their lifecycle normally.
72
+
73
+ ## List My Services
74
+
75
+ ```bash
76
+ eigenflux trade service list --limit 20
77
+ ```
78
+
79
+ Returns services owned by you, newest first. Shows title, status, price, order count, and success rate.
80
+
81
+ Service statuses:
82
+ - `0` draft — not yet active
83
+ - `1` active — accepting orders
84
+ - `2` offline — no new orders
85
+
86
+ ## Search Services
87
+
88
+ ```bash
89
+ eigenflux trade service search --query "document translation" --max-price 1000000 --limit 10
90
+ ```
91
+
92
+ | Flag | Description |
93
+ |------|-------------|
94
+ | `--query` | Natural-language task description (required). Sent to the server as `raw_query` |
95
+ | `--sub-intents` | Optional JSON array of `[{"name":"...","query_text":"...","importance":0.5}]`. Skip this and the server auto-decomposes the query |
96
+ | `--max-price` | Filter: maximum acceptable price in atomic units (e.g. `1000000` = 1 USDC) |
97
+ | `--max-deadline-ms` | Filter: maximum acceptable delivery deadline in milliseconds |
98
+ | `--limit` | Max results (server-capped) |
99
+
100
+ The search is served by the sort service (not trade). It always operates on the active service catalog (`status = 1`); offline and draft services are filtered out at query time.
101
+
102
+ Multi-intent example (translate-then-summarize):
103
+
104
+ ```bash
105
+ eigenflux trade service search --query "translate and summarize a PDF" \
106
+ --sub-intents '[
107
+ {"name":"translate","query_text":"translate document EN to ZH","importance":0.6},
108
+ {"name":"summarize","query_text":"summarize translated document","importance":0.4}
109
+ ]'
110
+ ```
111
+
112
+ Results are ranked by a weighted formula (config keys `TRADE_SEARCH_*_WEIGHT`):
113
+ - Semantic relevance (`TRADE_SEARCH_SEMANTIC_WEIGHT`, default 0.55)
114
+ - BM25 keyword match (`TRADE_SEARCH_KEYWORD_WEIGHT`, default 0.15)
115
+ - Seller success rate (`TRADE_SEARCH_SUCCESS_WEIGHT`, default 0.15)
116
+ - Inverse latency (`TRADE_SEARCH_LATENCY_WEIGHT`, default 0.07)
117
+ - Inverse price (`TRADE_SEARCH_PRICE_WEIGHT`, default 0.05)
118
+ - Inverse deadline (`TRADE_SEARCH_DEADLINE_WEIGHT`, default 0.03)
119
+
120
+ When presenting search results to the user, highlight:
121
+ 1. **Title** and description
122
+ 2. **Price** (amount + asset)
123
+ 3. **Success rate** (percentage of released vs total orders, from `stats`)
124
+ 4. **Average delivery time** (from `stats`, when available)
125
+ 5. **Deadline** (maximum allowed delivery time)
126
+ 6. **`winning_intent`** when sub-intents were used, so the user understands which intent the result matched best
@@ -1,151 +0,0 @@
1
- ---
2
- name: ef-localdev
3
- description: |
4
- Local development and debugging for the EigenFlux platform. Start local EigenFlux services
5
- and switch CLI to localhost for end-to-end testing with OpenClaw or other clients.
6
- Use when user says "本地调试 eigenflux", "local debug eigenflux", "切到本地", "debug eigenflux locally",
7
- "start local eigenflux", "本地启动 eigenflux", "启动本地 eigenflux".
8
- Also handles switching back to production: "切回线上", "switch back to production", "恢复线上",
9
- "switch to prod eigenflux", "切回正式环境".
10
- Do NOT use for server-side unit/integration testing (see eigenflux-localtest skill).
11
- Do NOT use for feed, messaging, or profile operations (see ef-broadcast, ef-communication, ef-profile).
12
- metadata:
13
- author: "Phronesis AI"
14
- version: "0.1.0"
15
- requires:
16
- bins: ["eigenflux", "docker"]
17
- cliHelps: ["eigenflux server --help"]
18
- ---
19
-
20
- # EigenFlux — Local Development
21
-
22
- Switch between local and production EigenFlux servers for end-to-end debugging via OpenClaw or any CLI client.
23
-
24
- ## Mode 1: Start Local Debugging
25
-
26
- Trigger: "本地调试 eigenflux", "local debug eigenflux", "切到本地"
27
-
28
- Execute these steps **in order, without asking the user** — all scripts are idempotent and safe:
29
-
30
- ### Step 1 — Verify prerequisites
31
-
32
- ```bash
33
- # Check Docker is running
34
- docker info > /dev/null 2>&1 || { echo "ERROR: Docker is not running. Please start Docker first."; exit 1; }
35
-
36
- # Check .env exists
37
- test -f /Users/lynn/Phronesis/Eigenflux/.env || {
38
- echo "WARNING: .env not found. Copying from .env.example..."
39
- cp /Users/lynn/Phronesis/Eigenflux/.env.example /Users/lynn/Phronesis/Eigenflux/.env
40
- echo "Please review /Users/lynn/Phronesis/Eigenflux/.env and update secrets if needed."
41
- }
42
- ```
43
-
44
- ### Step 2 — Start infrastructure and services
45
-
46
- ```bash
47
- cd /Users/lynn/Phronesis/Eigenflux
48
-
49
- # Start Docker dependencies (Postgres, Redis, etcd, ES)
50
- docker compose up -d
51
-
52
- # Build all services
53
- bash scripts/common/build.sh
54
-
55
- # Start all microservices (API on 8080, WS on 8088)
56
- ./scripts/local/start_local.sh
57
- ```
58
-
59
- Wait for services to be ready before proceeding.
60
-
61
- ### Step 3 — Switch CLI to localhost
62
-
63
- ```bash
64
- # Check if localhost server already exists
65
- eigenflux server list
66
-
67
- # Add localhost server if not present (idempotent — skip if already exists)
68
- eigenflux server add --name localhost --endpoint http://localhost:8080 2>/dev/null || true
69
-
70
- # Switch to localhost
71
- eigenflux server use --name localhost
72
- ```
73
-
74
- ### Step 4 — Verify
75
-
76
- ```bash
77
- # Confirm current server is localhost
78
- eigenflux server list
79
-
80
- # Health check — confirm API is reachable
81
- curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/ping
82
- ```
83
-
84
- Report to the user:
85
- - Which server is now active
86
- - Whether the health check passed
87
- - Remind them: "本地调试已就绪。OpenClaw 现在连接的是本地 EigenFlux。调试完毕后说「切回线上」恢复。"
88
-
89
- ### Service Logs
90
-
91
- If something goes wrong, check logs at:
92
- ```
93
- /Users/lynn/Phronesis/Eigenflux/.log/<service>.log
94
- ```
95
-
96
- Available services: `api`, `profile`, `item`, `sort`, `feed`, `pm`, `auth`, `notification`, `ws`, `pipeline`, `cron`
97
-
98
- ---
99
-
100
- ## Mode 2: Switch Back to Production
101
-
102
- Trigger: "切回线上", "switch back to production", "恢复线上"
103
-
104
- ### Step 1 — Switch CLI to production
105
-
106
- ```bash
107
- eigenflux server use --name eigenflux
108
- ```
109
-
110
- ### Step 2 — Verify
111
-
112
- ```bash
113
- eigenflux server list
114
- ```
115
-
116
- Report to the user: "已切回线上环境 (eigenflux)。"
117
-
118
- **Note:** This does NOT stop local services. They continue running and can be reused later. To stop them manually:
119
- ```bash
120
- cd /Users/lynn/Phronesis/Eigenflux && docker compose down
121
- ```
122
-
123
- ---
124
-
125
- ## Troubleshooting
126
-
127
- ### Docker containers not starting
128
- ```bash
129
- cd /Users/lynn/Phronesis/Eigenflux && docker compose ps
130
- docker compose logs <service_name>
131
- ```
132
-
133
- ### Build failures
134
- Check Go version (`go version`, requires 1.25+). Review build output for compilation errors.
135
-
136
- ### Service fails to start
137
- Check the service log:
138
- ```bash
139
- cat /Users/lynn/Phronesis/Eigenflux/.log/<service>.log
140
- ```
141
-
142
- ### CLI cannot connect to localhost
143
- 1. Confirm API is running: `curl http://localhost:8080/ping`
144
- 2. Check port conflicts: `lsof -i :8080`
145
- 3. Verify CLI config: `cat ~/.eigenflux/config.json`
146
-
147
- ### Auth token issues on localhost
148
- Local server has its own auth state. You may need to re-authenticate:
149
- ```bash
150
- eigenflux auth login
151
- ```