felo-ai 0.2.7 → 0.2.9

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,165 @@
1
+ ---
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."
4
+ ---
5
+
6
+ # Felo SuperAgent Skill
7
+
8
+ ## When to Use
9
+
10
+ Trigger this skill for:
11
+
12
+ - **SuperAgent 对话**:需要与 Felo SuperAgent 进行 AI 对话、流式输出
13
+ - **LiveDoc 集成**:希望回答与 LiveDoc 关联、可追溯资源
14
+ - **连续对话**:在已有会话/文档上继续提问(传入 `live_doc_short_id`)
15
+ - **多轮对话**:需要 thread_short_id / live_doc_short_id 以便后续查询会话详情或 LiveDoc 资源
16
+
17
+ **Trigger words / 触发词:**
18
+
19
+ - 简体中文:SuperAgent、超级助手、流式对话、LiveDoc、连续对话
20
+ - English: superagent, super agent, stream chat, livedoc, conversation
21
+ - **Explicit commands:** `/felo-superagent`, "use felo superagent", "felo superagent"
22
+
23
+ **Do NOT use for:**
24
+
25
+ - 简单单次问答、实时信息查询(优先用 `felo-search`)
26
+ - 仅需抓取网页内容(用 `felo-web-fetch`)
27
+ - 仅需生成 PPT(用 `felo-slides`)
28
+
29
+ ## Setup
30
+
31
+ ### 1. Get API Key
32
+
33
+ 1. Visit [felo.ai](https://felo.ai) and log in (or register)
34
+ 2. Click your avatar (top right) → **Settings**
35
+ 3. Open **API Keys** tab → Create and copy your API key
36
+
37
+ ### 2. Configure
38
+
39
+ Set the `FELO_API_KEY` environment variable:
40
+
41
+ **Linux/macOS:**
42
+
43
+ ```bash
44
+ export FELO_API_KEY="your-api-key-here"
45
+ ```
46
+
47
+ **Windows (PowerShell):**
48
+
49
+ ```powershell
50
+ $env:FELO_API_KEY="your-api-key-here"
51
+ ```
52
+
53
+ **Windows (CMD):**
54
+
55
+ ```cmd
56
+ set FELO_API_KEY=your-api-key-here
57
+ ```
58
+
59
+ ## How to Execute
60
+
61
+ Use the Bash tool and follow this workflow.
62
+
63
+ ### Step 1: Check API Key
64
+
65
+ ```bash
66
+ if [ -z "$FELO_API_KEY" ]; then
67
+ echo "ERROR: FELO_API_KEY not set"
68
+ exit 1
69
+ fi
70
+ ```
71
+
72
+ If not set, stop and show the user the setup instructions above.
73
+
74
+ ### Step 2: Run Node Script
75
+
76
+ From the project root (or ensure script path is correct):
77
+
78
+ ```bash
79
+ node felo-superAgent/scripts/run_superagent.mjs \
80
+ --query "USER_QUERY_HERE" \
81
+ --timeout 60
82
+ ```
83
+
84
+ Optional:
85
+
86
+ - **Reuse LiveDoc (连续对话):** `--live-doc-id "PvyKouzJirXjFdst4uKRK3"`
87
+ - **Language:** `--accept-language zh` or `--accept-language en`
88
+ - **JSON output:** `--json` (includes thread_short_id, live_doc_short_id, full answer)
89
+ - **Verbose:** `--verbose` (logs stream connection to stderr)
90
+
91
+ Example with options:
92
+
93
+ ```bash
94
+ node felo-superAgent/scripts/run_superagent.mjs \
95
+ --query "What is the latest news about AI?" \
96
+ --accept-language en \
97
+ --timeout 90 \
98
+ --json
99
+ ```
100
+
101
+ ### Step 3: Parse and Present
102
+
103
+ - **Default:** script prints the full answer text (from SSE `message` events) to stdout.
104
+ - **With `--json`:** script prints one JSON object with `answer`, `thread_short_id`, `live_doc_short_id`, etc.
105
+
106
+ Present to the user in this format:
107
+
108
+ ```markdown
109
+ ## SuperAgent Answer
110
+
111
+ [Full answer text from stream]
112
+
113
+ ## Metadata (optional, when using --json)
114
+
115
+ - Thread ID: <thread_short_id>
116
+ - LiveDoc ID: <live_doc_short_id>
117
+ ```
118
+
119
+ 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`.
120
+
121
+ ## API Workflow (Reference)
122
+
123
+ 1. **POST** `/v2/conversations` → get `stream_key`, `thread_short_id`, `live_doc_short_id`
124
+ 2. **GET** `/v2/conversations/stream/{stream_key}` → consume SSE until `done` or `error`
125
+ 3. Optionally: **GET** `/v2/conversations/{thread_short_id}` → conversation detail
126
+ 4. Optionally: **GET** `/v2/livedocs` → list LiveDocs
127
+ 5. Optionally: **GET** `/v2/livedocs/{live_doc_short_id}/resources` → list resources
128
+
129
+ Base URL: `https://openapi.felo.ai` (override with `FELO_API_BASE` if needed).
130
+
131
+ ## Error Handling
132
+
133
+ | Code | HTTP | Description |
134
+ | -------------------------------------- | ---- | ------------------------ |
135
+ | INVALID_API_KEY | 401 | API Key 无效或已撤销 |
136
+ | SUPER_AGENT_CONVERSATION_CREATE_FAILED | 502 | 创建会话失败(下游错误) |
137
+ | SUPER_AGENT_CONVERSATION_QUERY_FAILED | 502 | 查询会话详情失败 |
138
+ | SUPER_AGENT_LIVEDOC_LIST_FAILED | 502 | 列举 LiveDocs 失败 |
139
+ | SUPER_AGENT_LIVEDOC_RESOURCES_FAILED | 502 | 列举 LiveDoc 资源失败 |
140
+
141
+ SSE stream may send:
142
+
143
+ - `event: error` with `data: {"message": "..."}` — treat as failure and show message.
144
+
145
+ If `FELO_API_KEY` is not set, show:
146
+
147
+ ```
148
+ ❌ Felo API Key 未配置
149
+
150
+ 请设置环境变量 FELO_API_KEY:
151
+ 1. 在 https://felo.ai 获取 API Key(Settings → API Keys)
152
+ 2. 设置后重启 Claude Code 或重新加载环境
153
+ ```
154
+
155
+ ## Important Notes
156
+
157
+ - Execute this skill when the user clearly wants SuperAgent / 流式对话 / LiveDoc 能力。
158
+ - After create, connect to the stream **immediately** — `stream_key` 有效期有限。
159
+ - Use the bundled Node script to consume SSE; do not assume `jq` or other tools for parsing SSE.
160
+ - Same API key as other Felo skills (`FELO_API_KEY`).
161
+
162
+ ## References
163
+
164
+ - [SuperAgent API (Felo Open Platform)](https://openapi.felo.ai/docs/api-reference/v2/superagent.html)
165
+ - [Felo Open Platform](https://openapi.felo.ai/docs/)
@@ -1,78 +1,127 @@
1
- # Felo Web Fetch Skill
2
-
3
- Fetch webpage content from a URL using the [Felo Web Extract API](https://openapi.felo.ai/docs/api-reference/v2/web-extract.html).
4
-
5
- ## Features
6
-
7
- - Fetch content from any URL as **html**, **text**, or **markdown** (`--format`)
8
- - **Target one element** with a CSS selector (`--target-selector`, e.g. `article.main`, `#content`)
9
- - Optional **readability** mode for main article content only
10
- - Crawl modes: `fast` (default) or `fine`
11
- - Same `FELO_API_KEY` as other Felo skills
12
-
13
- ## Quick Start
14
-
15
- ### 1) Configure API key
16
-
17
- At [felo.ai](https://felo.ai) -> Settings -> API Keys, create a key, then:
18
-
19
- ```bash
20
- # Linux/macOS
21
- export FELO_API_KEY="your-api-key-here"
22
- ```
23
-
24
- ```powershell
25
- # Windows PowerShell
26
- $env:FELO_API_KEY="your-api-key-here"
27
- ```
28
-
29
- ### 2) Run fetch
30
-
31
- ```bash
32
- # Fetch as Markdown (default)
33
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article"
34
-
35
- # With readability for clean article text
36
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --readability --format markdown
37
-
38
- # Full JSON response
39
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --json
40
-
41
- # Only a specific element (CSS selector) and output format
42
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --target-selector "article.main" --format markdown
43
- ```
44
-
45
- ## Using the packaged CLI (`felo web-fetch`)
46
-
47
- After `npm install -g felo-ai`, you can run:
48
-
49
- ```bash
50
- felo web-fetch --url "https://example.com"
51
- ```
52
-
53
- **All parameters (how to pass)**
54
-
55
- | Parameter | Option | Example |
56
- |-----------|--------|---------|
57
- | URL (required) | `-u`, `--url` | `--url "https://example.com"` |
58
- | Output format | `-f`, `--format` | `--format text`, `-f markdown`, `-f html` |
59
- | Target element (CSS selector) | `--target-selector` | `--target-selector "article.main"` |
60
- | Wait for selector | `--wait-for-selector` | `--wait-for-selector ".content"` |
61
- | Readability (main content only) | `--readability` | `--readability` |
62
- | Crawl mode | `--crawl-mode` | `--crawl-mode fine` (default: `fast`) |
63
- | Timeout (seconds) | `-t`, `--timeout` | `--timeout 120`, `-t 90` |
64
- | Full JSON response | `-j`, `--json` | `-j` or `--json` |
65
-
66
- **Examples with multiple options**
67
-
68
- ```bash
69
- felo web-fetch -u "https://example.com" -f text --readability
70
- felo web-fetch --url "https://example.com" --target-selector "#content" --format markdown --timeout 90
71
- felo web-fetch --url "https://example.com" --wait-for-selector "main" --readability -j
72
- ```
73
-
74
- ## When to use (Agent)
75
-
76
- Trigger keywords: fetch webpage, scrape URL, fetch page content, url to markdown, `/felo-web-fetch`.
77
-
78
- See [SKILL.md](SKILL.md) for full agent instructions and API parameters.
1
+ # Felo Web Fetch Skill for Claude Code
2
+
3
+ Extract structured webpage content from URLs with the Felo Web Extract API.
4
+
5
+ ## Features
6
+
7
+ - URL content extraction (required)
8
+ - Output format: `html`, `markdown`, `text`
9
+ - Crawl mode: `fast`, `fine`
10
+ - CSS selector extraction (`target_selector`)
11
+ - Advanced options: cookies, user-agent, timeout, readability and link/image summary flags
12
+ - Spinner progress indicator during fetch
13
+
14
+ ## Quick Start
15
+
16
+ ### 1) Install the skill
17
+
18
+ ```bash
19
+ npx @claude/skills add felo-web-fetch
20
+ ```
21
+
22
+ Or install manually from this repository:
23
+
24
+ ```bash
25
+ # Linux/macOS
26
+ cp -r felo-web-fetch ~/.claude/skills/
27
+
28
+ # Windows (PowerShell)
29
+ Copy-Item -Recurse felo-web-fetch "$env:USERPROFILE\.claude\skills\"
30
+ ```
31
+
32
+ ### 2) Configure API key
33
+
34
+ Create API key at [felo.ai](https://felo.ai) -> Settings -> API Keys, then set:
35
+
36
+ ```bash
37
+ # Linux/macOS
38
+ export FELO_API_KEY="your-api-key-here"
39
+ ```
40
+
41
+ ```powershell
42
+ # Windows PowerShell
43
+ $env:FELO_API_KEY="your-api-key-here"
44
+ ```
45
+
46
+ ### 3) Trigger the skill
47
+
48
+ - Intent trigger: "Extract this article as markdown"
49
+ - Explicit trigger: `/felo-web-fetch https://example.com/article`
50
+
51
+ ## Using the packaged CLI (`felo web-fetch`)
52
+
53
+ After `npm install -g felo-ai`, you can run:
54
+
55
+ ```bash
56
+ felo web-fetch --url "https://example.com"
57
+ ```
58
+
59
+ **All parameters (how to pass)**
60
+
61
+ | Parameter | Option | Example |
62
+ | ------------------------------- | --------------------- | ----------------------------------------- |
63
+ | URL (required) | `-u`, `--url` | `--url "https://example.com"` |
64
+ | Output format | `-f`, `--format` | `--format text`, `-f markdown`, `-f html` |
65
+ | Target element (CSS selector) | `--target-selector` | `--target-selector "article.main"` |
66
+ | Wait for selector | `--wait-for-selector` | `--wait-for-selector ".content"` |
67
+ | Readability (main content only) | `--readability` | `--readability` |
68
+ | Crawl mode | `--crawl-mode` | `--crawl-mode fine` (default: `fast`) |
69
+ | Timeout (seconds) | `-t`, `--timeout` | `--timeout 120`, `-t 90` |
70
+ | Full JSON response | `-j`, `--json` | `-j` or `--json` |
71
+
72
+ **Examples with multiple options**
73
+
74
+ ```bash
75
+ felo web-fetch -u "https://example.com" -f text --readability
76
+ felo web-fetch --url "https://example.com" --target-selector "#content" --format markdown --timeout 90
77
+ felo web-fetch --url "https://example.com" --wait-for-selector "main" --readability -j
78
+ ```
79
+
80
+ ## Script Usage
81
+
82
+ The skill uses:
83
+
84
+ ```bash
85
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com"
86
+ ```
87
+
88
+ Common examples:
89
+
90
+ ```bash
91
+ node felo-web-fetch/scripts/run_web_fetch.mjs \
92
+ --url "https://example.com/post" \
93
+ --output-format markdown \
94
+ --crawl-mode fine
95
+ ```
96
+
97
+ ```bash
98
+ node felo-web-fetch/scripts/run_web_fetch.mjs \
99
+ --url "https://example.com" \
100
+ --target-selector "article.main" \
101
+ --output-format text \
102
+ --user-agent "Mozilla/5.0" \
103
+ --request-timeout-ms 20000
104
+ ```
105
+
106
+ ```bash
107
+ node felo-web-fetch/scripts/run_web_fetch.mjs \
108
+ --url "https://example.com/private" \
109
+ --cookie "session_id=abc123" \
110
+ --with-readability true \
111
+ --json
112
+ ```
113
+
114
+ ## Error Handling
115
+
116
+ - Missing key: `FELO_API_KEY not set`
117
+ - Invalid key: `INVALID_API_KEY`
118
+ - Invalid params / URL: `HTTP 400`
119
+ - Upstream extraction failure: `WEB_EXTRACT_FAILED` (`HTTP 500/502`)
120
+
121
+ ## Links
122
+
123
+ - [Web Extract API](https://openapi.felo.ai/docs/api-reference/v2/web-extract.html)
124
+ - [Felo Open Platform](https://openapi.felo.ai/docs/)
125
+ - [Get API Key](https://felo.ai)
126
+
127
+ See [SKILL.md](SKILL.md) for full agent instructions and API parameters.