felo-ai 0.2.6 → 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.
Files changed (39) hide show
  1. package/.github/workflows/publish-npm.yml +39 -0
  2. package/CHANGELOG.md +30 -0
  3. package/CONTRIBUTING.md +346 -346
  4. package/README.en.md +129 -129
  5. package/README.md +435 -408
  6. package/docs/EXAMPLES.md +632 -632
  7. package/docs/FAQ.md +479 -479
  8. package/felo-search/LICENSE +21 -21
  9. package/felo-search/README.md +440 -440
  10. package/felo-search/SKILL.md +291 -291
  11. package/felo-slides/LICENSE +21 -21
  12. package/felo-slides/README.md +87 -87
  13. package/felo-slides/SKILL.md +166 -166
  14. package/felo-slides/scripts/run_ppt_task.mjs +251 -251
  15. package/felo-superAgent/LICENSE +21 -0
  16. package/felo-superAgent/README.md +125 -0
  17. package/felo-superAgent/SKILL.md +165 -0
  18. package/felo-web-fetch/README.md +127 -0
  19. package/felo-web-fetch/SKILL.md +204 -0
  20. package/felo-web-fetch/scripts/run_web_fetch.mjs +316 -0
  21. package/felo-x-search/SKILL.md +204 -0
  22. package/felo-x-search/scripts/run_x_search.mjs +385 -0
  23. package/felo-youtube-subtitling/README.md +59 -59
  24. package/felo-youtube-subtitling/SKILL.md +161 -161
  25. package/felo-youtube-subtitling/scripts/run_youtube_subtitling.mjs +239 -239
  26. package/package.json +37 -35
  27. package/src/cli.js +370 -252
  28. package/src/config.js +66 -66
  29. package/src/search.js +142 -142
  30. package/src/slides.js +332 -332
  31. package/src/superAgent.js +609 -0
  32. package/src/{webExtract.js → webFetch.js} +148 -148
  33. package/src/xSearch.js +366 -0
  34. package/src/youtubeSubtitling.js +179 -179
  35. package/tests/config.test.js +78 -78
  36. package/tests/search.test.js +100 -100
  37. package/felo-web-extract/README.md +0 -78
  38. package/felo-web-extract/SKILL.md +0 -200
  39. package/felo-web-extract/scripts/run_web_extract.mjs +0 -232
@@ -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/)
@@ -0,0 +1,127 @@
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.
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: felo-web-fetch
3
+ description: "Extract webpage content with Felo Web Extract API. Use for turning URLs into html/markdown/text, selecting specific page areas with CSS selectors, and controlling extraction options like crawl mode, cookies, user-agent, and timeout."
4
+ ---
5
+
6
+ # Felo Web Fetch Skill
7
+
8
+ ## When to Use
9
+
10
+ Trigger this skill when users want to extract or convert webpage content from a URL:
11
+
12
+ - Fetch or scrape content from a webpage URL
13
+ - Convert webpage content to `html`, `markdown`, or `text`
14
+ - Extract specific blocks using CSS selector
15
+ - Get article/main text from a link with readability mode
16
+ - Tune extraction behavior with crawl mode (`fast`/`fine`)
17
+ - Pass request details such as cookies, user-agent, timeout
18
+
19
+ Trigger keywords (examples):
20
+
21
+ - fetch webpage, scrape URL, fetch page content, web fetch, url to markdown
22
+ - Explicit: `/felo-web-fetch`, "use felo web fetch", "extract this URL with felo"
23
+ - Same intent in other languages (e.g. 网页抓取, 提取网页内容) also triggers this skill
24
+
25
+ Do NOT use this skill for:
26
+
27
+ - Real-time Q&A search summaries (use `felo-search`)
28
+ - Slide generation tasks (use `felo-slides`)
29
+ - Local file parsing in current workspace
30
+
31
+ ## Setup
32
+
33
+ ### 1. Get API key
34
+
35
+ 1. Visit [felo.ai](https://felo.ai)
36
+ 2. Open Settings -> API Keys
37
+ 3. Create and copy your API key
38
+
39
+ ### 2. Configure environment variable
40
+
41
+ Linux/macOS:
42
+ ```bash
43
+ export FELO_API_KEY="your-api-key-here"
44
+ ```
45
+
46
+ Windows PowerShell:
47
+ ```powershell
48
+ $env:FELO_API_KEY="your-api-key-here"
49
+ ```
50
+
51
+ ## How to Execute
52
+
53
+ ### Option A: Use the bundled script or packaged CLI
54
+
55
+ **Script** (from repo):
56
+
57
+ ```bash
58
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" [options]
59
+ ```
60
+
61
+ **Packaged CLI** (after `npm install -g felo-ai`): same options, with short forms allowed:
62
+
63
+ ```bash
64
+ felo web-fetch -u "https://example.com" [options]
65
+ # Short forms: -u (url), -f (format), -t (timeout, seconds), -j (json)
66
+ ```
67
+
68
+ Required parameter:
69
+ - `--url`
70
+
71
+ Core optional parameters:
72
+ - `--output-format html|markdown|text`
73
+ - `--crawl-mode fast|fine`
74
+ - `--target-selector "article.main-content"`
75
+ - `--wait-for-selector ".content-ready"`
76
+
77
+ Other key optional parameters:
78
+ - `--cookie "session_id=xxx"` (repeatable)
79
+ - `--set-cookies-json '[{"name":"sid","value":"xxx","domain":"example.com"}]'`
80
+ - `--user-agent "Mozilla/5.0 ..."`
81
+ - `--timeout 60` (HTTP request timeout in seconds)
82
+ - `--request-timeout-ms 15000` (API payload `timeout` in ms)
83
+ - `--with-readability true`
84
+ - `--with-links-summary true`
85
+ - `--with-images-summary true`
86
+ - `--with-images-readability true`
87
+ - `--with-images true`
88
+ - `--with-links true`
89
+ - `--ignore-empty-text-image true`
90
+ - `--with-cache false`
91
+ - `--with-stypes true`
92
+ - `--json` (print full JSON response)
93
+
94
+ ### How to write instructions (target_selector + output_format)
95
+
96
+ When the user wants a **specific part** of the page or a **specific output format**, phrase the command like this:
97
+
98
+ - **Output format**: "Fetch as **text**" / "Get **markdown**" / "Return **html**" → use `--output-format text`, `--output-format markdown`, or `--output-format html`.
99
+ - **Target one element**: "Only the **main article**" / "Just the **content inside** `#main`" / "Fetch only **article.main-content**" → use `--target-selector "article.main"` or the selector they give.
100
+
101
+ Examples:
102
+
103
+ ```bash
104
+ # Basic: fetch as Markdown
105
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --output-format markdown
106
+
107
+ # Article-style with readability
108
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" --with-readability true --output-format markdown
109
+
110
+ # Only the element matching a CSS selector
111
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --target-selector "article.main" --output-format markdown
112
+
113
+ # With cookies and custom user-agent
114
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/private" --cookie "session_id=abc123" --with-readability true --json
115
+
116
+ # Full JSON response
117
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --output-format text --json
118
+ ```
119
+
120
+ ### Option B: Call API with curl
121
+
122
+ ```bash
123
+ curl -X POST "https://openapi.felo.ai/v2/web/extract" \
124
+ -H "Authorization: Bearer $FELO_API_KEY" \
125
+ -H "Content-Type: application/json" \
126
+ -d '{"url": "https://example.com", "output_format": "markdown", "with_readability": true}'
127
+ ```
128
+
129
+ ## API Reference (summary)
130
+
131
+ - **Endpoint**: `POST /v2/web/extract`
132
+ - **Base URL**: `https://openapi.felo.ai`. Override with `FELO_API_BASE` env if needed.
133
+ - **Auth**: `Authorization: Bearer YOUR_API_KEY`
134
+
135
+ ### Request body (JSON)
136
+
137
+ | Parameter | Type | Required | Default | Description |
138
+ |-----------|------|----------|---------|-------------|
139
+ | url | string | Yes | - | Webpage URL to fetch |
140
+ | crawl_mode | string | No | fast | `fast` or `fine` |
141
+ | output_format | string | No | html | `html`, `text`, `markdown` |
142
+ | with_readability | boolean | No | - | Use readability (main content) |
143
+ | with_links_summary | boolean | No | - | Include links summary |
144
+ | with_images_summary | boolean | No | - | Include images summary |
145
+ | target_selector | string | No | - | CSS selector for target element |
146
+ | wait_for_selector | string | No | - | Wait for selector before fetch |
147
+ | timeout | integer | No | - | Timeout in milliseconds |
148
+ | with_cache | boolean | No | true | Use cache |
149
+ | set_cookies | array | No | - | Cookie entries |
150
+ | user_agent | string | No | - | Custom user-agent |
151
+
152
+ ### Response
153
+
154
+ Success (200):
155
+
156
+ ```json
157
+ {
158
+ "code": 0,
159
+ "message": "success",
160
+ "data": {
161
+ "content": { ... }
162
+ }
163
+ }
164
+ ```
165
+
166
+ Fetched content is in `data.content`; structure depends on `output_format`.
167
+
168
+ ### Error codes
169
+
170
+ | HTTP | Code | Description |
171
+ |------|------|-------------|
172
+ | 400 | - | Parameter validation failed |
173
+ | 401 | INVALID_API_KEY | API key invalid or revoked |
174
+ | 500/502 | WEB_EXTRACT_FAILED | Fetch failed (server or page error) |
175
+
176
+ ## Output Format
177
+
178
+ - Default output is extracted content only (for direct use or piping).
179
+ - If response content is not a string, script prints JSON.
180
+ - Use `--json` when user needs metadata and full response object.
181
+
182
+ Error response format:
183
+
184
+ ```markdown
185
+ ## Web Fetch Failed
186
+ - Message: <error message>
187
+ - Suggested Action: verify URL/parameters and retry
188
+ ```
189
+
190
+ ## Important Notes
191
+
192
+ - Always require URL before running.
193
+ - Validate enum values:
194
+ - `output_format`: `html`, `markdown`, `text`
195
+ - `crawl_mode`: `fast`, `fine`
196
+ - Use `--target-selector` when users only want a specific part of the page.
197
+ - Use `--request-timeout-ms` for page rendering/extraction wait, and `--timeout` for local HTTP timeout.
198
+ - For long articles or slow sites, consider increasing `--timeout`.
199
+ - API may cache results; use `--with-cache false` only when fresh content is required.
200
+
201
+ ## References
202
+
203
+ - [Web Extract API](https://openapi.felo.ai/docs/api-reference/v2/web-extract.html)
204
+ - [Felo Open Platform](https://openapi.felo.ai/docs/)