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,65 +1,112 @@
1
1
  ---
2
2
  name: felo-superAgent
3
- description: "Felo SuperAgent API: AI conversation with real-time SSE streaming and LiveDoc. Use when users want SuperAgent chat, continuous conversation, or LiveDoc-backed answers. Explicit commands: /felo-superagent."
3
+ description: "Felo SuperAgent API: AI conversation with real-time SSE streaming on a persistent LiveDoc canvas. Use when users want SuperAgent chat, continuous conversation, tweet writing, logo/branding design, or e-commerce product images. Explicit commands: /felo-superagent."
4
4
  ---
5
5
 
6
6
  # Felo SuperAgent Skill
7
7
 
8
+ ## Constraints (MUST READ FIRST)
9
+
10
+ These rules are mandatory. Violating any of them will produce incorrect behavior.
11
+
12
+ 1. **NEVER use `--json` flag.** The script MUST run in default (streaming) mode so that SuperAgent's answer is printed directly to stdout in real time. The `--json` flag suppresses all streaming output and is forbidden. State IDs are extracted from the `[state]` line in stderr instead.
13
+
14
+ 2. **NEVER summarize, rewrite, or re-output the script's stdout.** The script already streams the full answer and tool results directly to the user. After the script finishes, do NOT repeat, paraphrase, or summarize the answer. Only output supplementary information (LiveDoc URL, session state notes) if needed.
15
+
16
+ 3. **`--live-doc-id` is REQUIRED when creating a conversation.** Never call `run_superagent.mjs` without `--live-doc-id`. If you do not have one yet, obtain it first (see Step 2 below).
17
+
18
+ 4. **Reuse `live_doc_id` from ANY source.** If you already have a `live_doc_id` from any previous operation in this session — whether from a prior SuperAgent call, a `felo-livedoc` skill operation, user-provided input, or any other skill — use it directly. Do NOT request the LiveDoc list again. Only fetch the list when no `live_doc_id` is available from any source. (Note: `live_doc_id` corresponds to the API field `live_doc_short_id` and the `[state]` output key `live_doc_short_id`.)
19
+
20
+ 5. **One LiveDoc per session.** All conversations within a session MUST use the same `--live-doc-id`. Do NOT create a new LiveDoc unless the user explicitly asks to "open a new canvas" / "start a new LiveDoc" / "create a new workspace".
21
+
22
+ 6. **Default behavior is follow-up, not new conversation.** After the first question, every subsequent user message is a follow-up. You MUST pass `--thread-id` from the previous response. Only omit `--thread-id` (to start a new thread on the same LiveDoc) when:
23
+ - The user explicitly says "new topic" / "change subject" / "start over"
24
+ - The user's intent requires a specific `--skill-id` (e.g., tweet writing, logo design, product image) and the current thread was not created with that skill — because `--skill-id` only takes effect in new conversations
25
+
26
+ 7. **Always persist state.** After every call, extract `thread_short_id` and `live_doc_id` from the stderr `[state]` line (where `live_doc_id` is output as `live_doc_short_id`). Use them in the next call. Losing these IDs breaks conversation continuity.
27
+
28
+ 8. **Skill ID selection (New Conversations Only).** When creating a new conversation (no `--thread-id`), analyze the user's intent and determine if it matches one of the supported skill IDs:
29
+
30
+ **Available skill IDs:**
31
+ - `twitter-writer` — For composing, drafting, or posting tweets/X posts
32
+ - `logo-and-branding` — For creating logos, brand designs, or visual identity
33
+ - `ecommerce-product-image` — For generating product images for e-commerce use
34
+
35
+ **Selection logic:**
36
+ - If the user explicitly requests a specific skill-id, use their specified value
37
+ - If the user's intent clearly matches one of the above, pass `--skill-id` with that value
38
+ - If none of the above match, do NOT pass `--skill-id` (general conversation mode)
39
+ - `--skill-id` is only effective when creating a new conversation. It is ignored in follow-up mode (`--thread-id`).
40
+
41
+ 9. **Never create a new LiveDoc casually.** Reuse the existing one. The only exception is an explicit user request for a new canvas/workspace.
42
+
8
43
  ## When to Use
9
44
 
10
- Trigger this skill for:
45
+ Trigger this skill when users want:
46
+
47
+ - **SuperAgent conversation:** AI conversation with Felo SuperAgent, with real-time streaming output
48
+ - **Continuous conversation:** Multi-turn Q&A on a persistent LiveDoc canvas
49
+ - **Tweet writing:** Compose or post tweets (auto-selects `twitter-writer` skill)
50
+ - **Logo & branding:** Create logos or brand designs (auto-selects `logo-and-branding` skill)
51
+ - **E-commerce images:** Generate product images (auto-selects `ecommerce-product-image` skill)
52
+ - **Tool-augmented answers:** Responses that may include image generation, document creation, PPT generation, or Twitter/X search
53
+ - **Streaming responses:** Real-time answer generation with Server-Sent Events (SSE)
11
54
 
12
- - **SuperAgent 对话**:需要与 Felo SuperAgent 进行 AI 对话、流式输出
13
- - **LiveDoc 关联**:每次会话对应一个 LiveDoc,可后续查看资源
14
- - **连续对话**:在已有 LiveDoc 上继续提问(传入 `live_doc_short_id`)
15
- - **多轮对话**:需要 thread_short_id / live_doc_short_id 以便后续查询会话详情
55
+ **Trigger words:**
16
56
 
17
- **Trigger words / 触发词:**
57
+ - English: superagent, super agent, stream chat, streaming conversation, livedoc conversation, continuous chat, follow-up question, write a tweet, post a tweet, create a logo, brand design, product image, e-commerce image
58
+ - Simplified Chinese (pinyin): chao ji zhu shou, liu shi dui hua, lian xu dui hua, zhui wen, fa tui wen, xie tui wen, she ji logo, pin pai she ji, dian shang tu pian
59
+ - Traditional Chinese (pinyin): chao ji zhu shou, liu shi dui hua, lian xu dui hua, zhui wen, fa tui wen, xie tui wen, she ji logo, pin pai she ji, dian shang tu pian
60
+ - Japanese (romaji): suupaa eejento, sutoriimingu kaiwa, keizoku kaiwa, tsuiito wo kaku, rogo sakusei, shouhin gazou
18
61
 
19
- - 简体中文:SuperAgent、超级助手、流式对话、LiveDoc、连续对话
20
- - English: superagent, super agent, stream chat, livedoc, conversation
21
- - **Explicit commands:** `/felo-superagent`, "use felo superagent", "felo superagent"
62
+ **Explicit commands:** `/felo-superagent`, "use felo superagent", "felo superagent"
22
63
 
23
64
  **Do NOT use for:**
24
65
 
25
- - 简单单次问答、实时信息查询(优先用 `felo-search`)
26
- - 仅需抓取网页内容(用 `felo-web-fetch`)
27
- - 仅需生成 PPT(用 `felo-slides`)
28
- - 需要 LiveDoc 知识库功能(用 `felo-livedoc`)
66
+ - Simple one-off Q&A or real-time information queries (prefer `felo-search`)
67
+ - Web page content fetching only (use `felo-web-fetch`)
68
+ - PPT/slide generation only (use `felo-slides`)
69
+ - LiveDoc knowledge base management only (use `felo-livedoc`)
70
+ - Twitter/X search only (use `felo-x-search`)
29
71
 
30
72
  ## Setup
31
73
 
32
- ### 1. Get API Key
74
+ ### 1. Get Your API Key
33
75
 
34
76
  1. Visit [felo.ai](https://felo.ai) and log in (or register)
35
- 2. Click your avatar (top right)**Settings**
36
- 3. Open **API Keys** tab → Create and copy your API key
77
+ 2. Click your avatar in the top right corner → Settings
78
+ 3. Navigate to the "API Keys" tab
79
+ 4. Click "Create New Key" to generate a new API Key
80
+ 5. Copy and save your API Key securely
37
81
 
38
- ### 2. Configure
82
+ ### 2. Configure API Key
39
83
 
40
84
  Set the `FELO_API_KEY` environment variable:
41
85
 
42
86
  **Linux/macOS:**
43
-
44
87
  ```bash
45
88
  export FELO_API_KEY="your-api-key-here"
46
89
  ```
47
90
 
48
91
  **Windows (PowerShell):**
49
-
50
92
  ```powershell
51
93
  $env:FELO_API_KEY="your-api-key-here"
52
94
  ```
53
95
 
54
96
  **Windows (CMD):**
55
-
56
97
  ```cmd
57
98
  set FELO_API_KEY=your-api-key-here
58
99
  ```
59
100
 
101
+ For permanent configuration, add it to your shell profile (~/.bashrc, ~/.zshrc) or system environment variables.
102
+
103
+ ### 3. Dependency: felo-livedoc
104
+
105
+ This skill depends on the `felo-livedoc` skill to obtain and create LiveDocs. Ensure `felo-livedoc/scripts/run_livedoc.mjs` is available at the same level as `felo-superAgent/`.
106
+
60
107
  ## How to Execute
61
108
 
62
- Use the Bash tool and follow this workflow.
109
+ When this skill is triggered, follow these steps strictly in order. Execute all commands using the Bash tool.
63
110
 
64
111
  ### Step 1: Check API Key
65
112
 
@@ -72,91 +119,445 @@ fi
72
119
 
73
120
  If not set, stop and show the user the setup instructions above.
74
121
 
75
- ### Step 2: Run Node Script
122
+ ### Step 2: Obtain `live_doc_id`
123
+
124
+ This step ensures you always have a valid `--live-doc-id` before creating any conversation. (Note: `live_doc_id` corresponds to the API field `live_doc_short_id`.)
76
125
 
77
- From the project root (or ensure script path is correct):
126
+ **2a. If you already have a `live_doc_id` from ANY source in this session:**
127
+ Skip to Step 3. Reuse the same ID. Sources include: a previous SuperAgent call's `[state]` output (the `live_doc_short_id` field), a `felo-livedoc` skill operation (create, list, etc.), user-provided input, or any other skill that returned a LiveDoc ID.
128
+
129
+ **2b. If no `live_doc_id` is available from any source — fetch the LiveDoc list:**
78
130
 
131
+ ```bash
132
+ node felo-livedoc/scripts/run_livedoc.mjs list --json
133
+ ```
134
+
135
+ Parse the JSON output. The response contains `data.items` — an array of LiveDoc objects sorted by modification time. Pick the first item's `short_id` as your `live_doc_id`.
136
+
137
+ Example response:
138
+ ```json
139
+ {
140
+ "status": "ok",
141
+ "data": {
142
+ "total": 3,
143
+ "items": [
144
+ { "short_id": "QPetunwpGnkKuZHStP7gwt", "name": "My Workspace", "modified_at": "..." },
145
+ ...
146
+ ]
147
+ }
148
+ }
149
+ ```
150
+
151
+ Use: `live_doc_id = items[0].short_id`
152
+
153
+ **2c. If the list is empty (no LiveDocs exist) — create one:**
154
+
155
+ ```bash
156
+ node felo-livedoc/scripts/run_livedoc.mjs create --name "SuperAgent Workspace" --json
157
+ ```
158
+
159
+ Parse the JSON output and extract `data.short_id` as your `live_doc_id`.
160
+
161
+ Example response:
162
+ ```json
163
+ {
164
+ "status": "ok",
165
+ "data": {
166
+ "short_id": "NewDocId123abc",
167
+ "name": "SuperAgent Workspace",
168
+ ...
169
+ }
170
+ }
171
+ ```
172
+
173
+ **2d. If the user explicitly requests a new canvas/workspace:**
174
+
175
+ Create a new LiveDoc (same as 2c), then use the new ID for all subsequent calls. Discard the old `live_doc_id`.
176
+
177
+ ### Step 3: Determine Conversation Mode
178
+
179
+ Decide whether this is a **new conversation** or a **follow-up**:
180
+
181
+ | Condition | Mode | What to pass |
182
+ | ------------------------------------------------------------ | ---------------- | ------------------------------------------- |
183
+ | First question in session (no `thread_short_id` yet) | New conversation | `--live-doc-id` only |
184
+ | User asks a follow-up / continues the topic (DEFAULT) | Follow-up | `--thread-id` AND `--live-doc-id` |
185
+ | User explicitly says "new topic" / "change subject" | New conversation | `--live-doc-id` only (same LiveDoc) |
186
+ | User's intent requires a `--skill-id` not matching current thread | New conversation | `--live-doc-id` + `--skill-id` (same LiveDoc) |
187
+ | User explicitly says "new canvas" / "new LiveDoc" | New conversation | New `--live-doc-id` from Step 2d |
188
+
189
+ **IMPORTANT:** The default for any user message after the first one is ALWAYS follow-up. Only treat it as a new conversation if the user explicitly requests it.
190
+
191
+ ### Step 4: Determine Skill ID (New Conversations Only)
192
+
193
+ If this is a new conversation (no `--thread-id`), analyze the user's intent:
194
+
195
+ **Available skill IDs:**
196
+ - `twitter-writer` — For composing, drafting, or posting tweets/X posts
197
+ - `logo-and-branding` — For creating logos, brand designs, or visual identity
198
+ - `ecommerce-product-image` — For generating product images for e-commerce use
199
+
200
+ **How to decide:**
201
+ 1. If the user explicitly specifies a skill-id, use that value
202
+ 2. Otherwise, analyze the user's request and determine if it matches one of the above
203
+ 3. If none match, do NOT pass `--skill-id`
204
+
205
+ If this is a follow-up (`--thread-id` is set), skip this step entirely. `--skill-id` is ignored in follow-up mode.
206
+
207
+ ### Step 5: Run the Script
208
+
209
+ Construct and execute the command. **NEVER use `--json`** — the script must run in default streaming mode so the answer is printed directly to the user in real time.
210
+
211
+ **IMPORTANT:** The SSE stream may take a long time (especially for image generation, research reports, etc.). You MUST set the Bash tool timeout to at least 600000ms (10 minutes) when executing the script to prevent premature termination.
212
+
213
+ **`--accept-language` selection:** Default is `en`. Match the user's language — if the user writes in Chinese use `zh`, Japanese use `ja`, Korean use `ko`, etc.
214
+
215
+ **`--query` construction:** Do NOT simply pass the user's raw input as-is. You should enrich and refine the query to make it more complete and effective for SuperAgent:
216
+
217
+ - **Add context:** If the conversation has prior context (e.g., the user previously discussed a topic), incorporate relevant details so SuperAgent understands the full picture.
218
+ - **Clarify vague requests:** If the user says something brief like "continue" or "go on", expand it to describe what should be continued (e.g., "Please continue the previous analysis and provide more details").
219
+ - **Supplement missing details:** If the user's request implies information they mentioned earlier (e.g., brand name, product type, style preference), include those details in the query.
220
+ - **Preserve user intent:** Never change the user's core intent. Only add context and clarity — do not inject opinions or redirect the topic.
221
+ - **Keep it concise:** The query has a 2000-character limit. Enrich the content but stay focused and avoid unnecessary padding.
222
+
223
+ Examples:
224
+ - User says "继续" → `--query "请继续上面关于量子计算的分析,进一步展开实际应用场景"`
225
+ - User says "再来一张" → `--query "请再生成一张类似风格的无线耳机产品图,白色背景"`
226
+ - User says "帮我改改" → `--query "请修改上面生成的推文,语气更轻松一些,加一些emoji"`
227
+
228
+ **New conversation (first question):**
79
229
  ```bash
80
230
  node felo-superAgent/scripts/run_superagent.mjs \
81
231
  --query "USER_QUERY_HERE" \
82
- --timeout 60
232
+ --live-doc-id "LIVE_DOC_ID" \
233
+ --accept-language en \
234
+ --timeout 3600
83
235
  ```
84
236
 
85
- Optional:
237
+ **New conversation with skill ID (e.g., tweet writing):**
238
+ ```bash
239
+ node felo-superAgent/scripts/run_superagent.mjs \
240
+ --query "Write a tweet about the latest AI trends" \
241
+ --live-doc-id "LIVE_DOC_ID" \
242
+ --skill-id twitter-writer \
243
+ --accept-language en \
244
+ --timeout 3600
245
+ ```
246
+
247
+ **Follow-up question (DEFAULT for 2nd+ messages):**
248
+ ```bash
249
+ node felo-superAgent/scripts/run_superagent.mjs \
250
+ --query "USER_FOLLOW_UP_QUERY" \
251
+ --thread-id "THREAD_SHORT_ID_FROM_PREVIOUS" \
252
+ --live-doc-id "LIVE_DOC_ID" \
253
+ --timeout 3600
254
+ ```
255
+
256
+ ### Step 6: Extract State from stderr (Do NOT Re-output the Answer)
257
+
258
+ The script has already streamed the full answer and tool results directly to stdout. **Do NOT repeat, summarize, or rewrite any of that content.**
259
+
260
+ After the script finishes, look for the `[state]` line in stderr output:
261
+
262
+ ```
263
+ [state] thread_short_id=CmYpuGwBgCnrUdDx5ZtmxA live_doc_short_id=QPetunwpGnkKuZHStP7gwt live_doc_url=https://felo.ai/livedoc/QPetunwpGnkKuZHStP7gwt
264
+ ```
265
+
266
+ 1. **Extract and save** `thread_short_id` and `live_doc_id` (from the `live_doc_short_id` field in the `[state]` line) — you MUST use these in the next call.
267
+ 2. **Optionally show** the `live_doc_url` link to the user so they can view the LiveDoc canvas in a browser.
268
+
269
+ Do NOT show `thread_short_id` or `live_doc_id` to the user unless they ask for it. These are internal state for the skill to manage.
86
270
 
87
- - **Language:** `--accept-language zh` or `--accept-language en`
88
- - **Reuse LiveDoc (连续对话):** `--live-doc-id "PvyKouzJirXjFdst4uKRK3"`
89
- - **JSON output:** `--json` (includes thread_short_id, live_doc_short_id, full answer)
90
- - **Verbose:** `--verbose` (logs stream connection to stderr)
271
+ ## Complete Workflow Examples
91
272
 
92
- Example with options:
273
+ ### Example A: Multi-turn Conversation (Most Common)
93
274
 
275
+ ```
276
+ User: "What is quantum computing?"
277
+ ```
278
+
279
+ **Step 2b:** Fetch LiveDoc list → get `live_doc_id = "QPetunwpGnkKuZHStP7gwt"`
280
+ **Step 3:** First question → New conversation
281
+ **Step 4:** No special skill → no `--skill-id`
282
+ **Step 5:**
94
283
  ```bash
95
284
  node felo-superAgent/scripts/run_superagent.mjs \
96
- --query "What is the latest news about AI?" \
97
- --accept-language en \
98
- --timeout 90 \
99
- --json
285
+ --query "What is quantum computing?" \
286
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
287
+ --accept-language en --timeout 3600
288
+ ```
289
+ **Step 6:** The answer is already streamed to the user. Extract from stderr `[state]` line: `thread_short_id = "CmYpuGwBgCnrUdDx5ZtmxA"`, `live_doc_id = "QPetunwpGnkKuZHStP7gwt"`. Do NOT repeat the answer.
290
+
291
+ ```
292
+ User: "What are its practical applications?"
293
+ ```
294
+
295
+ **Step 2a:** Already have `live_doc_id` → skip
296
+ **Step 3:** Follow-up (default) → use saved `thread_short_id`
297
+ **Step 5:**
298
+ ```bash
299
+ node felo-superAgent/scripts/run_superagent.mjs \
300
+ --query "What are its practical applications?" \
301
+ --thread-id "CmYpuGwBgCnrUdDx5ZtmxA" \
302
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
303
+ --timeout 3600
304
+ ```
305
+ **Step 6:** Answer already streamed. Extract updated `thread_short_id` from stderr `[state]` line (may be the same), keep `live_doc_id`.
306
+
307
+ ```
308
+ User: "Tell me more about quantum error correction"
309
+ ```
310
+
311
+ **Step 3:** Still follow-up (same topic) → use saved `thread_short_id`
312
+ **Step 5:** Same pattern as above with new query
313
+
314
+ ### Example B: Tweet Writing
315
+
316
+ ```
317
+ User: "Help me write a tweet about AI trends"
318
+ ```
319
+
320
+ **Step 2a:** Already have `live_doc_id` → reuse
321
+ **Step 3:** New conversation — `--skill-id twitter-writer` is required, which only takes effect in new conversations
322
+ **Step 4:** User intent matches "write a tweet" → `--skill-id twitter-writer`
323
+ **Step 5:**
324
+ ```bash
325
+ node felo-superAgent/scripts/run_superagent.mjs \
326
+ --query "Help me write a tweet about AI trends" \
327
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
328
+ --skill-id twitter-writer \
329
+ --accept-language en --timeout 3600
330
+ ```
331
+ **Step 6:** Answer already streamed. Extract new `thread_short_id` from stderr `[state]` line, keep same `live_doc_id`.
332
+
333
+ ```
334
+ User: "Make it more casual and add some emojis"
335
+ ```
336
+
337
+ **Step 3:** Follow-up → use saved `thread_short_id`
338
+ **Step 5:**
339
+ ```bash
340
+ node felo-superAgent/scripts/run_superagent.mjs \
341
+ --query "Make it more casual and add some emojis" \
342
+ --thread-id "NEW_THREAD_FROM_TWEET" \
343
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
344
+ --timeout 3600
345
+ ```
346
+
347
+ ### Example C: Logo Design
348
+
349
+ ```
350
+ User: "Design a logo for my coffee shop called Bean & Brew"
100
351
  ```
101
352
 
102
- ### Step 3: Parse and Present
353
+ **Step 4:** Detected "design a logo" → `--skill-id logo-and-branding`
354
+ **Step 5:**
355
+ ```bash
356
+ node felo-superAgent/scripts/run_superagent.mjs \
357
+ --query "Design a logo for my coffee shop called Bean & Brew" \
358
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
359
+ --skill-id logo-and-branding \
360
+ --accept-language en --timeout 3600
361
+ ```
103
362
 
104
- - **Default:** script prints the full answer text (from SSE `message` events) to stdout.
105
- - **With `--json`:** script prints one JSON object with `answer`, `thread_short_id`, `live_doc_short_id`, etc.
363
+ ### Example D: E-commerce Product Image
106
364
 
107
- Present to the user in this format:
365
+ ```
366
+ User: "Generate a product image for a wireless headphone on white background"
367
+ ```
108
368
 
109
- ```markdown
110
- ## SuperAgent Answer
369
+ **Step 4:** Detected "product image" → `--skill-id ecommerce-product-image`
370
+ **Step 5:**
371
+ ```bash
372
+ node felo-superAgent/scripts/run_superagent.mjs \
373
+ --query "Generate a product image for a wireless headphone on white background" \
374
+ --live-doc-id "QPetunwpGnkKuZHStP7gwt" \
375
+ --skill-id ecommerce-product-image \
376
+ --accept-language en --timeout 3600
377
+ ```
111
378
 
112
- [Full answer text from stream]
379
+ ### Example E: User Requests a New Canvas
113
380
 
114
- ## Metadata (optional, when using --json)
381
+ ```
382
+ User: "Open a new canvas for a different project"
383
+ ```
115
384
 
116
- - Thread ID: <thread_short_id>
117
- - LiveDoc ID: <live_doc_short_id>
385
+ **Step 2d:** Create new LiveDoc:
386
+ ```bash
387
+ node felo-livedoc/scripts/run_livedoc.mjs create --name "New Project" --json
118
388
  ```
389
+ Extract new `live_doc_id`. Discard the old one. All subsequent calls use the new ID.
390
+
391
+ ## Available Script Options
392
+
393
+ **Core parameters:**
394
+ - `--query <text>` (REQUIRED) — User question, 1-2000 characters
395
+ - `--live-doc-id <id>` (REQUIRED for new conversations) — LiveDoc ID (`live_doc_id`) to associate with
396
+ - `--thread-id <id>` — Thread ID from previous response, for follow-up conversations
397
+ - `--timeout <seconds>` — Request/stream timeout, default 3600 seconds
119
398
 
120
- If the user asked for conversation detail or LiveDoc resources, you can call the REST APIs (see API Reference below) with `thread_short_id` / `live_doc_short_id`.
399
+ **Skill parameters (new conversations only, ignored in follow-up):**
400
+ - `--skill-id <id>` — Skill ID (see Constraint #8 for available skill IDs)
401
+ - `--selected-resource-ids <ids>` — Comma-separated resource IDs to include
402
+ - `--ext <json>` — Extra parameters as JSON object
403
+
404
+ **Output control:**
405
+ - `--json` / `-j` — Output JSON format with full metadata (DO NOT use in this skill — it suppresses streaming output)
406
+ - `--verbose` / `-v` — Log stream connection details to stderr (for debugging only, not needed for normal use)
407
+ - `--accept-language <lang>` — Language preference (e.g., en, ja, ko)
121
408
 
122
409
  ## API Workflow (Reference)
123
410
 
124
- 1. **POST** `/v2/conversations` get `stream_key`, `thread_short_id`, `live_doc_short_id`
125
- 2. **GET** `/v2/conversations/stream/{stream_key}` → consume SSE until `done` or `error`
126
- 3. Optionally: **GET** `/v2/conversations/{thread_short_id}` → conversation detail
411
+ The script handles this workflow automatically:
412
+
413
+ 1. **Create conversation:**
414
+ - New: `POST /v2/conversations` (requires `live_doc_short_id` in body)
415
+ - Follow-up: `POST /v2/conversations/{threadId}/follow_up`
416
+ - Returns: `stream_key`, `thread_short_id`, `live_doc_short_id`
417
+
418
+ 2. **Consume SSE stream:**
419
+ - `GET /v2/conversations/stream/{stream_key}`
420
+ - Supports offset parameter for resuming: `?offset={lastOffset}`
421
+ - Reconnects automatically if connection drops (2-second delay)
422
+
423
+ 3. **Parse events:**
424
+ - `message` — Direct text content
425
+ - `stream` — Wrapped content with type information
426
+ - `heartbeat` — Keep-alive signal
427
+ - `done` / `completed` / `complete` — Stream finished
428
+ - `error` — Error event (non-terminal, continues reading)
429
+
430
+ 4. **Extract tool results:**
431
+ - Image generation (`generate_images`)
432
+ - Research reports (`generate_discovery`)
433
+ - Document generation (`generate_document`)
434
+ - PPT generation (`generate_ppt`)
435
+ - HTML generation (`generate_html`)
436
+ - Twitter/X search (`search_x`)
127
437
 
128
438
  Base URL: `https://openapi.felo.ai` (override with `FELO_API_BASE` if needed).
129
439
 
440
+ ## Tool Support
441
+
442
+ SuperAgent may invoke tools during conversation. The script automatically extracts and displays:
443
+
444
+ **Image Generation:**
445
+ - Tool: `generate_images`
446
+ - Output: Image URLs and titles
447
+
448
+ **Research & Discovery:**
449
+ - Tool: `generate_discovery`
450
+ - Output: Research report titles and status
451
+
452
+ **Document Generation:**
453
+ - Tool: `generate_document`
454
+ - Output: Document titles and status
455
+
456
+ **Presentation Generation:**
457
+ - Tool: `generate_ppt`
458
+ - Output: PPT titles and status
459
+
460
+ **HTML Generation:**
461
+ - Tool: `generate_html`
462
+ - Output: HTML page titles and status
463
+
464
+ **Twitter/X Search:**
465
+ - Tool: `search_x`
466
+ - Output: Tweet content, author info, metrics (likes, retweets, views)
467
+
130
468
  ## Error Handling
131
469
 
132
- | Code | HTTP | Description |
133
- | -------------------------------------- | ---- | ------------------------ |
134
- | INVALID_API_KEY | 401 | API Key 无效或已撤销 |
135
- | SUPER_AGENT_CONVERSATION_CREATE_FAILED | 502 | 创建会话失败(下游错误) |
136
- | SUPER_AGENT_CONVERSATION_QUERY_FAILED | 502 | 查询会话详情失败 |
470
+ ### Common Error Codes
137
471
 
138
- SSE stream may send:
472
+ | Code | HTTP | Description |
473
+ | -------------------------------------- | ---- | ------------------------------------------------- |
474
+ | INVALID_API_KEY | 401 | API Key is invalid or has been revoked |
475
+ | SUPER_AGENT_CONVERSATION_CREATE_FAILED | 502 | Failed to create conversation (upstream error) |
476
+ | SUPER_AGENT_CONVERSATION_QUERY_FAILED | 502 | Failed to query conversation details |
139
477
 
140
- - `event: error` with `data: {"message": "..."}` — treat as failure and show message.
478
+ ### SSE Stream Errors
141
479
 
142
- If `FELO_API_KEY` is not set, show:
480
+ The stream may send:
481
+ - `event: error` with `data: {"message": "..."}` — treat as failure and show message
482
+ - Connection timeout — script automatically reconnects with 2-second delay
483
+ - Idle timeout (2 hours) — stream aborted if no data received
484
+
485
+ ### Missing API Key
486
+
487
+ If `FELO_API_KEY` is not set, display this message:
143
488
 
144
489
  ```
145
- Felo API Key 未配置
490
+ ERROR: FELO_API_KEY not set
491
+
492
+ To use this skill, you need to set up your Felo API Key:
493
+
494
+ 1. Get your API key from https://felo.ai (Settings -> API Keys)
495
+ 2. Set the environment variable:
146
496
 
147
- 请设置环境变量 FELO_API_KEY:
148
- 1. 在 https://felo.ai 获取 API Key(Settings → API Keys)
149
- 2. 设置后重启 Claude Code 或重新加载环境
497
+ Linux/macOS:
498
+ export FELO_API_KEY="your-api-key-here"
499
+
500
+ Windows (PowerShell):
501
+ $env:FELO_API_KEY="your-api-key-here"
502
+
503
+ 3. Restart Claude Code or reload the environment
150
504
  ```
151
505
 
506
+ ### Timeout Handling
507
+
508
+ - Default timeout: 3600 seconds (recommended for all SuperAgent calls due to SSE streaming)
509
+ - Idle timeout: 2 hours (no data received)
510
+ - **Bash tool timeout:** MUST be set to at least 600000ms (10 minutes) when executing the script
511
+
152
512
  ## Important Notes
153
513
 
154
- - Execute this skill when the user clearly wants SuperAgent / 流式对话 / LiveDoc 能力。
155
- - After create, connect to the stream **immediately** `stream_key` 有效期有限。
156
- - Use the bundled Node script to consume SSE; do not assume `jq` or other tools for parsing SSE.
157
- - Same API key as other Felo skills (`FELO_API_KEY`).
514
+ - Execute this skill immediately using the Bash tool do not just describe what you would do
515
+ - **NEVER use `--json`** it suppresses all streaming output. State IDs come from the `[state]` line in stderr
516
+ - **NEVER summarize or re-output the answer** the script already streams it directly to the user
517
+ - After create, the script connects to the stream **immediately** — the `stream_key` has a limited validity period
518
+ - Use the bundled Node script to consume SSE; do not assume `jq` or other tools for parsing SSE
519
+ - Same API key as other Felo skills (`FELO_API_KEY`)
520
+ - The script handles reconnection automatically if the stream drops
521
+ - Tool results are deduplicated to avoid showing the same resource multiple times
522
+ - If `live_doc_id` is already known from any source (other skills, user input, previous calls), use it directly — do NOT fetch the LiveDoc list again
523
+ - Multi-language support: Fully supports Simplified Chinese, Traditional Chinese, Japanese, and English
524
+ - The API returns results in the same language as the query when possible
525
+
526
+ ## Decision Flowchart
527
+
528
+ ```
529
+ User sends a message
530
+ |
531
+ v
532
+ Have live_doc_id from ANY source?
533
+ NO --> Step 2b: fetch list --> got items?
534
+ YES --> use items[0].short_id as live_doc_id
535
+ NO --> Step 2c: create new LiveDoc
536
+ YES --> continue (reuse it, do NOT fetch list)
537
+ |
538
+ v
539
+ Have thread_short_id from previous call?
540
+ NO --> This is a NEW conversation
541
+ --> Step 4: determine skill-id by analyzing user intent
542
+ --> Step 5: run WITHOUT --thread-id
543
+ YES --> Does user's intent require a skill-id not matching current thread?
544
+ YES --> NEW conversation (same live-doc-id, with --skill-id)
545
+ NO --> Is user explicitly starting a new topic?
546
+ YES --> NEW conversation (same live-doc-id, no --thread-id)
547
+ NO --> FOLLOW-UP (pass --thread-id)
548
+ |
549
+ v
550
+ Run script (NO --json, Bash timeout >= 600000ms) --> answer streams directly to user
551
+ |
552
+ v
553
+ Extract thread_short_id + live_doc_id from stderr [state] line
554
+ |
555
+ v
556
+ Do NOT repeat or summarize the answer (already shown)
557
+ ```
158
558
 
159
559
  ## References
160
560
 
161
561
  - [SuperAgent API (Felo Open Platform)](https://openapi.felo.ai/docs/api-reference/v2/superagent.html)
162
562
  - [Felo Open Platform](https://openapi.felo.ai/docs/)
563
+ - [Get API Key](https://felo.ai) (Settings -> API Keys)