felo-ai 0.2.18 → 0.2.23

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.
@@ -1,46 +1,46 @@
1
1
  # Felo SuperAgent Skill for Claude Code
2
2
 
3
- **AI 对话与流式输出,支持连续会话。**
3
+ **AI conversation with real-time streaming output, supporting continuous conversation.**
4
4
 
5
- 通过 Felo Open Platform SuperAgent API,在 Claude Code 中发起与 SuperAgent 的对话、接收 SSE 流式回复,并可查询会话详情。
5
+ Use the Felo Open Platform SuperAgent API in Claude Code to initiate conversations with SuperAgent, receive real-time SSE streaming responses, and query conversation details.
6
6
 
7
7
  ---
8
8
 
9
- ## 功能
9
+ ## Features
10
10
 
11
- - **流式对话**:创建会话后通过 SSE 实时接收 AI 回复
12
- - **LiveDoc 关联**:每次会话对应一个 LiveDoc,可后续查看资源
13
- - **连续对话**:通过 `--thread-id` 在已有会话上继续提问
14
- - **LiveDoc 管理**:列举 LiveDoc 列表、查看指定 LiveDoc 下的资源
15
- - **多语言**:支持 `accept_language`(如 zh / en)
16
- - **工具调用**:支持生图、研究报告、文档、PPTHTMLTwitter 搜索等工具
11
+ - **Streaming conversation**: Create a conversation and receive AI responses in real-time via SSE
12
+ - **LiveDoc association**: Each conversation corresponds to a LiveDoc for subsequent resource viewing
13
+ - **Continuous conversation**: Continue asking questions in an existing conversation using `--thread-id`
14
+ - **LiveDoc management**: List LiveDocs and view resources within a specific LiveDoc
15
+ - **Multi-language**: Supports `accept_language` (e.g., zh, en, ja, ko)
16
+ - **Tool invocation**: Supports image generation, research reports, documents, PPT, HTML, Twitter search, and more
17
17
 
18
- **适用场景:**
18
+ **Use cases:**
19
19
 
20
- - 需要 SuperAgent 流式回答
21
- - 需要与 LiveDoc 关联、可追溯资源的对话
22
- - 多轮/连续对话(复用同一 LiveDoc
20
+ - Need SuperAgent streaming answers
21
+ - Need conversation associated with LiveDoc for traceable resources
22
+ - Multi-turn/continuous conversation (reuse the same LiveDoc)
23
23
 
24
- **不适用:**
24
+ **Not suitable for:**
25
25
 
26
- - 仅需单次实时信息检索使用 `felo-search`
27
- - 仅需抓取网页正文使用 `felo-web-fetch`
28
- - 仅需生成 PPT → 使用 `felo-slides`
29
- - 需要 LiveDoc 知识库功能使用 `felo-livedoc`
26
+ - Simple one-off real-time information retrieval use `felo-search`
27
+ - Only need to fetch webpage content use `felo-web-fetch`
28
+ - Only need to generate PPT → use `felo-slides`
29
+ - Need LiveDoc knowledge base features use `felo-livedoc`
30
30
 
31
31
  ---
32
32
 
33
- ## 快速开始
33
+ ## Quick Start
34
34
 
35
- ### 1. 安装
35
+ ### 1. Installation
36
36
 
37
- **一键安装(推荐):**
37
+ **One-click install (recommended):**
38
38
 
39
39
  ```bash
40
40
  npx skills add Felo-Inc/felo-skills --skill felo-superAgent
41
41
  ```
42
42
 
43
- **手动安装:** 若上述命令不可用,从本仓库复制到 Claude Code skills 目录:
43
+ **Manual install:** If the above command is unavailable, copy from this repository to Claude Code's skills directory:
44
44
 
45
45
  ```bash
46
46
  # Linux/macOS
@@ -50,15 +50,15 @@ cp -r felo-superAgent ~/.claude/skills/
50
50
  Copy-Item -Recurse felo-superAgent "$env:USERPROFILE\.claude\skills\"
51
51
  ```
52
52
 
53
- (若为本地 skill,确保 Cursor/Claude Code 已配置该 skill 路径。)
53
+ (If using a local skill, ensure Cursor/Claude Code has configured the skill path.)
54
54
 
55
- ### 2. 配置 API Key
55
+ ### 2. Configure API Key
56
56
 
57
- 与其它 Felo skills 相同,使用同一 API Key
57
+ Same as other Felo skills, use the same API Key:
58
58
 
59
- 1. 打开 [felo.ai](https://felo.ai) 登录
60
- 2. 头像 → **Settings** → **API Keys** → 创建并复制 Key
61
- 3. 设置环境变量:
59
+ 1. Open [felo.ai](https://felo.ai) and log in
60
+ 2. Avatar → **Settings** → **API Keys** → Create and copy Key
61
+ 3. Set environment variable:
62
62
 
63
63
  ```bash
64
64
  # Linux/macOS
@@ -68,114 +68,388 @@ export FELO_API_KEY="your-api-key-here"
68
68
  $env:FELO_API_KEY="your-api-key-here"
69
69
  ```
70
70
 
71
- ### 3. 使用方式
71
+ For permanent configuration, add to your shell profile (~/.bashrc, ~/.zshrc) or system environment variables.
72
72
 
73
- **在对话中触发:**
73
+ ### 3. Usage
74
74
 
75
- - 明确指令:`/felo-superagent`、"use felo super agent"
76
- - 描述意图:SuperAgent 对话、流式对话、LiveDoc 对话、连续对话
75
+ **Trigger in conversation:**
77
76
 
78
- **命令行直接跑脚本:**
77
+ - Explicit commands: `/felo-superagent`, "use felo super agent"
78
+ - Describe intent: SuperAgent conversation, streaming conversation, LiveDoc conversation, continuous conversation
79
+
80
+ **Run script directly from command line:**
79
81
 
80
82
  ```bash
81
83
  node felo-superAgent/scripts/run_superagent.mjs --query "What is the latest news about AI?"
82
84
  ```
83
85
 
84
- 输出为流式汇总后的完整回答正文。加 `--json` 可得到包含 `thread_short_id`、`live_doc_short_id` JSON。
86
+ Output is the complete answer text after streaming aggregation. Add `--json` to get JSON including `thread_short_id` and `live_doc_short_id`.
85
87
 
86
- **CLI 命令(安装后):**
88
+ **CLI commands (after installation):**
87
89
 
88
90
  ```bash
89
- # SuperAgent 对话
91
+ # SuperAgent conversation
90
92
  felo superagent "What is the latest news about AI?"
91
93
 
92
- # 继续对话
94
+ # Continue conversation
93
95
  felo superagent "Tell me more" --thread-id <thread_short_id>
94
96
 
95
- # 列举 LiveDoc 列表
97
+ # List LiveDocs
96
98
  felo livedocs
97
99
  felo livedocs --page 2 --size 10
98
100
  felo livedocs --keyword AI
99
101
 
100
- # 查看指定 LiveDoc 下的资源
102
+ # View resources in a specific LiveDoc
101
103
  felo livedoc-resources <livedoc-id>
102
104
  ```
103
105
 
104
106
  ---
105
107
 
106
- ## 脚本参数
108
+ ## Script Parameters
107
109
 
108
110
  ### superagent
109
111
 
110
- | 参数 | 说明 |
111
- | --------------------------------- | ---------------------------------------------------------- |
112
- | `--query <text>` | 用户问题(必填,12000 字符) |
113
- | `--thread-id <id>` | 已有会话 ID,用于继续对话 |
114
- | `--live-doc-id <id>` | 复用已有 LiveDoc short_id(连续对话) |
115
- | `--skill-id <id>` | Skill ID(仅新建会话时有效) |
116
- | `--selected-resource-ids <ids>` | 逗号分隔的资源 ID(仅新建会话时有效) |
117
- | `--ext <json>` | 额外参数 JSON,如 `'{"style_id":"xxx"}'`(仅新建会话时有效)|
118
- | `--accept-language <lang>` | 语言偏好,如 zh / en |
119
- | `--timeout <seconds>` | 请求/流超时,默认 60 |
120
- | `--json` | 输出 JSON(含 answerthread_short_idlive_doc_short_id |
121
- | `--verbose` | 将流连接信息打到 stderr |
112
+ | Parameter | Description |
113
+ | --------------------------------- | ----------------------------------------------------------------- |
114
+ | `--query <text>` | User question (required, 1-2000 characters) |
115
+ | `--thread-id <id>` | Existing thread ID for follow-up conversations |
116
+ | `--live-doc-id <id>` | Reuse existing LiveDoc short_id (continuous conversation) |
117
+ | `--skill-id <id>` | Skill ID (new conversations only) |
118
+ | `--selected-resource-ids <ids>` | Comma-separated resource IDs (new conversations only) |
119
+ | `--ext <json>` | Extra parameters as JSON, e.g., `'{"style_id":"xxx"}'` (new conversations only) |
120
+ | `--accept-language <lang>` | Language preference, e.g., zh, en, ja, ko |
121
+ | `--timeout <seconds>` | Request/stream timeout, default 60 |
122
+ | `--json` | Output JSON (includes answer, thread_short_id, live_doc_short_id) |
123
+ | `--verbose` | Log stream connection details to stderr |
122
124
 
123
125
  ### livedocs
124
126
 
125
- | 参数 | 说明 |
126
- | ----------------------- | ------------------------ |
127
- | `-p, --page <number>` | 页码,默认 1 |
128
- | `-s, --size <number>` | 每页条数,默认 20 |
129
- | `-k, --keyword <text>` | 关键词过滤 |
130
- | `-j, --json` | 输出原始 JSON |
131
- | `-t, --timeout <seconds>` | 请求超时,默认 60 |
127
+ | Parameter | Description |
128
+ | -------------------------- | ------------------------------- |
129
+ | `-p, --page <number>` | Page number, default 1 |
130
+ | `-s, --size <number>` | Items per page, default 20 |
131
+ | `-k, --keyword <text>` | Keyword filter |
132
+ | `-j, --json` | Output raw JSON |
133
+ | `-t, --timeout <seconds>` | Request timeout, default 60 |
132
134
 
133
135
  ### livedoc-resources
134
136
 
135
- | 参数 | 说明 |
136
- | -------------------------- | ------------------------ |
137
- | `<livedoc-id>` | LiveDoc short_id(必填) |
138
- | `-j, --json` | 输出原始 JSON |
139
- | `-t, --timeout <seconds>` | 请求超时,默认 60 |
137
+ | Parameter | Description |
138
+ | -------------------------- | ------------------------------- |
139
+ | `<livedoc-id>` | LiveDoc short_id (required) |
140
+ | `-j, --json` | Output raw JSON |
141
+ | `-t, --timeout <seconds>` | Request timeout, default 60 |
140
142
 
141
143
  ---
142
144
 
143
- ## 输出格式
145
+ ## Output Format
144
146
 
145
- **默认(纯文本):**
146
- 脚本 stdout 为完整回答内容(由 SSE `message` 事件拼接)。
147
+ **Default (plain text):**
148
+ Script stdout is the complete answer content (concatenated from SSE `message` events).
147
149
 
148
- **`--json`:**
149
- 单行 JSON 对象,例如:
150
+ **`--json`:**
151
+ Single-line JSON object, for example:
150
152
 
151
153
  ```json
152
154
  {
153
155
  "status": "ok",
154
156
  "data": {
155
- "answer": "完整回答内容...",
157
+ "answer": "Complete answer content...",
156
158
  "thread_short_id": "TvyKouzJirXjFdst4uKRK3",
157
- "live_doc_short_id": "PvyKouzJirXjFdst4uKRK3"
159
+ "live_doc_short_id": "PvyKouzJirXjFdst4uKRK3",
160
+ "live_doc_url": "https://felo.ai/zh-Hans/livedoc/...",
161
+ "image_urls": [{"url": "...", "title": "..."}],
162
+ "discoveries": [{"title": "Research Report"}],
163
+ "documents": [{"title": "Generated Document"}],
164
+ "ppts": [{"title": "Presentation"}],
165
+ "htmls": [{"title": "HTML Page"}],
166
+ "search_x": [{"tweets": [...]}]
158
167
  }
159
168
  }
160
169
  ```
161
170
 
162
- 可用 `thread_short_id` 调用「查询会话详情」接口,`live_doc_short_id` 可传入 `felo-livedoc` 查询相关资源。
171
+ Use `thread_short_id` to call the "query conversation details" API, and `live_doc_short_id` can be passed to `felo-livedoc` to query related resources.
172
+
173
+ ---
174
+
175
+ ## Complete Examples
176
+
177
+ ### Example 1: Simple question
178
+
179
+ ```bash
180
+ node felo-superAgent/scripts/run_superagent.mjs \
181
+ --query "What is quantum computing?" \
182
+ --accept-language en \
183
+ --timeout 90
184
+ ```
185
+
186
+ **Output:**
187
+ ```
188
+ SuperAgent: creating conversation...
189
+ Quantum computing is a revolutionary approach to computation that leverages...
190
+ [complete streaming answer]
191
+ ```
192
+
193
+ ### Example 2: Continue conversation on existing LiveDoc
194
+
195
+ ```bash
196
+ # First conversation
197
+ node felo-superAgent/scripts/run_superagent.mjs \
198
+ --query "Explain artificial intelligence" \
199
+ --json
200
+
201
+ # Returns: {"data": {"live_doc_short_id": "PvyKouzJirXjFdst4uKRK3", ...}}
202
+
203
+ # Continue on same LiveDoc
204
+ node felo-superAgent/scripts/run_superagent.mjs \
205
+ --query "What are the main applications?" \
206
+ --live-doc-id "PvyKouzJirXjFdst4uKRK3"
207
+ ```
208
+
209
+ ### Example 3: Follow-up question in thread
210
+
211
+ ```bash
212
+ # First question
213
+ node felo-superAgent/scripts/run_superagent.mjs \
214
+ --query "What is machine learning?" \
215
+ --json
216
+
217
+ # Returns: {"data": {"thread_short_id": "TvyKouzJirXjFdst4uKRK3", ...}}
218
+
219
+ # Follow-up question
220
+ node felo-superAgent/scripts/run_superagent.mjs \
221
+ --query "Can you elaborate on neural networks?" \
222
+ --thread-id "TvyKouzJirXjFdst4uKRK3"
223
+ ```
224
+
225
+ ### Example 4: With verbose logging
226
+
227
+ ```bash
228
+ node felo-superAgent/scripts/run_superagent.mjs \
229
+ --query "Latest developments in AI" \
230
+ --accept-language en \
231
+ --verbose \
232
+ --json
233
+ ```
234
+
235
+ **Stderr output:**
236
+ ```
237
+ SuperAgent: creating conversation...
238
+ Stream key: abc123...
239
+ Thread ID: TvyKouzJirXjFdst4uKRK3
240
+ LiveDoc ID: PvyKouzJirXjFdst4uKRK3
241
+ [stream] event=message
242
+ [stream] data={"content":"Recent AI developments..."}
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Tool Support
248
+
249
+ SuperAgent may invoke tools during conversation. The script automatically extracts and displays:
250
+
251
+ ### Image Generation
252
+ - Tool: `generate_images`
253
+ - Output: Image URLs and titles
254
+ - Example: `[AI Generated Image](https://felo.ai/zh-Hans/livedoc/...)`
255
+
256
+ ### Research & Discovery
257
+ - Tool: `generate_discovery`
258
+ - Output: Research report titles
259
+ - Example: `[AI Research Report](https://felo.ai/zh-Hans/livedoc/...)`
260
+
261
+ ### Document Generation
262
+ - Tool: `generate_document`
263
+ - Output: Document titles
264
+ - Example: `[Generated Document](https://felo.ai/zh-Hans/livedoc/...)`
265
+
266
+ ### Presentation Generation
267
+ - Tool: `generate_ppt`
268
+ - Output: PPT titles
269
+ - Example: `[AI Presentation](https://felo.ai/zh-Hans/livedoc/...)`
270
+
271
+ ### HTML Generation
272
+ - Tool: `generate_html`
273
+ - Output: HTML page titles
274
+ - Example: `[HTML Page](https://felo.ai/zh-Hans/livedoc/...)`
275
+
276
+ ### Twitter/X Search
277
+ - Tool: `search_x`
278
+ - Output: Tweet content, author info, metrics (likes, retweets, views)
279
+ - Example:
280
+ ```
281
+ [Twitter Search Results] (5 tweets)
282
+ Elon Musk (@elonmusk) [1.2K likes | 234 retweets | 45K views]
283
+ AI is the future of humanity...
284
+ https://twitter.com/...
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Error Handling
290
+
291
+ Common error codes (see [SuperAgent API documentation](https://openapi.felo.ai/docs/api-reference/v2/superagent.html)):
292
+
293
+ - `INVALID_API_KEY` (401): Key is invalid or revoked
294
+ - `SUPER_AGENT_CONVERSATION_CREATE_FAILED` (502): Failed to create conversation
295
+ - Other 502 errors: Downstream service issues, retry or contact support
296
+
297
+ If `FELO_API_KEY` is not configured, the script will error and show configuration instructions.
298
+
299
+ ---
300
+
301
+ ## API Workflow
302
+
303
+ The script handles this workflow automatically:
304
+
305
+ 1. **Create conversation:**
306
+ - New: `POST /v2/conversations`
307
+ - Follow-up: `POST /v2/conversations/{threadId}/follow_up`
308
+ - Returns: `stream_key`, `thread_short_id`, `live_doc_short_id`
309
+
310
+ 2. **Consume SSE stream:**
311
+ - `GET /v2/conversations/stream/{stream_key}`
312
+ - Supports offset parameter for resuming: `?offset={lastOffset}`
313
+ - Reconnects automatically if connection drops (2-second delay)
314
+
315
+ 3. **Parse events:**
316
+ - `message` — Direct text content
317
+ - `stream` — Wrapped content with type information
318
+ - `heartbeat` — Keep-alive signal
319
+ - `done` / `completed` / `complete` — Stream finished
320
+ - `error` — Error event (non-terminal, continues reading)
321
+
322
+ 4. **Extract tool results:**
323
+ - Automatically detects and formats tool outputs
324
+ - Deduplicates results to avoid showing the same resource multiple times
325
+
326
+ Base URL: `https://openapi.felo.ai` (override with `FELO_API_BASE` if needed).
163
327
 
164
328
  ---
165
329
 
166
- ## 错误处理
330
+ ## Conversation Continuity
167
331
 
168
- 常见错误码参见 [SuperAgent API 文档](https://openapi.felo.ai/docs/api-reference/v2/superagent.html):
332
+ **Three modes of conversation:**
169
333
 
170
- - `INVALID_API_KEY` (401):Key 无效或已撤销
171
- - `SUPER_AGENT_CONVERSATION_CREATE_FAILED` (502):创建会话失败
172
- - 其它 502:下游服务异常,可重试或联系支持
334
+ 1. **New conversation:** No IDs provided — creates fresh thread and LiveDoc
335
+ 2. **LiveDoc continuation:** Provide `--live-doc-id` — new thread, same knowledge base
336
+ 3. **Thread follow-up:** Provide `--thread-id` — continue exact conversation
173
337
 
174
- 若未配置 `FELO_API_KEY`,脚本会报错并提示配置方法。
338
+ **When to use each mode:**
339
+ - Use **new conversation** for unrelated questions
340
+ - Use **LiveDoc continuation** to build knowledge on a topic across multiple threads
341
+ - Use **thread follow-up** for clarifying questions or continuing the exact same discussion
342
+
343
+ ---
344
+
345
+ ## Troubleshooting
346
+
347
+ ### API Key Not Set
348
+
349
+ **Error:**
350
+ ```
351
+ ERROR: FELO_API_KEY not set
352
+ ```
353
+
354
+ **Solution:**
355
+ 1. Get your API key from https://felo.ai (Settings → API Keys)
356
+ 2. Set the environment variable:
357
+ ```bash
358
+ export FELO_API_KEY="your-api-key-here"
359
+ ```
360
+ 3. Restart your terminal or reload the environment
361
+
362
+ ### Invalid API Key
363
+
364
+ **Error:**
365
+ ```
366
+ HTTP 401: INVALID_API_KEY
367
+ ```
368
+
369
+ **Solution:**
370
+ - Check if your API key is correct
371
+ - Verify the key hasn't been revoked at https://felo.ai
372
+ - Generate a new key if needed
373
+
374
+ ### Stream Timeout
375
+
376
+ **Error:**
377
+ ```
378
+ Stream idle timeout (no data for 7200s)
379
+ ```
380
+
381
+ **Solution:**
382
+ - The stream was idle for 2 hours with no data
383
+ - This is normal for very long-running conversations
384
+ - Retry the query or increase timeout with `--timeout 120`
385
+
386
+ ### Connection Issues
387
+
388
+ **Behavior:** Script shows "SuperAgent: creating conversation..." but hangs
389
+
390
+ **Solution:**
391
+ - Check your internet connection
392
+ - Verify `https://openapi.felo.ai` is accessible
393
+ - Try with `--verbose` to see detailed connection logs
394
+ - Check if a firewall is blocking SSE connections
395
+
396
+ ### Tool Results Not Showing
397
+
398
+ **Behavior:** Answer appears but tool results (images, documents) are missing
399
+
400
+ **Solution:**
401
+ - Tool results appear inline during streaming
402
+ - Use `--json` to see all tool results in structured format
403
+ - Check if LiveDoc URL is accessible
404
+
405
+ ---
406
+
407
+ ## Advanced Usage
408
+
409
+ ### Custom API Base URL
410
+
411
+ Override the API base URL:
412
+
413
+ ```bash
414
+ export FELO_API_BASE="https://custom-api.example.com"
415
+ node felo-superAgent/scripts/run_superagent.mjs --query "test"
416
+ ```
417
+
418
+ ### Custom Web Base URL
419
+
420
+ Override the web base URL for LiveDoc links:
421
+
422
+ ```bash
423
+ export FELO_WEB_BASE="https://custom-web.example.com"
424
+ node felo-superAgent/scripts/run_superagent.mjs --query "test"
425
+ ```
426
+
427
+ ### Extended Parameters
428
+
429
+ Pass custom parameters to the API:
430
+
431
+ ```bash
432
+ node felo-superAgent/scripts/run_superagent.mjs \
433
+ --query "Generate a report" \
434
+ --ext '{"style_id":"professional","format":"detailed"}'
435
+ ```
436
+
437
+ ### Resource Selection
438
+
439
+ Select specific resources for the conversation:
440
+
441
+ ```bash
442
+ node felo-superAgent/scripts/run_superagent.mjs \
443
+ --query "Summarize these documents" \
444
+ --live-doc-id "PvyKouzJirXjFdst4uKRK3" \
445
+ --selected-resource-ids "res1,res2,res3"
446
+ ```
175
447
 
176
448
  ---
177
449
 
178
- ## 参考链接
450
+ ## References
179
451
 
180
- - [SuperAgent API 文档](https://openapi.felo.ai/docs/api-reference/v2/superagent.html)
452
+ - [SuperAgent API Documentation](https://openapi.felo.ai/docs/api-reference/v2/superagent.html)
181
453
  - [Felo Open Platform](https://openapi.felo.ai/docs/)
454
+ - [Get API Key](https://felo.ai) (Settings → API Keys)
455
+ - [GitHub Repository](https://github.com/Felo-Inc/felo-skills)