markdown-browser

TotalClaw 作者 totalclaw

OpenClaw web_fetch 结果的包装技能。当您需要在获取的页面上进行 MECE 后处理时使用:来自 Content-Signal 的策略决策、隐私编辑、可选的 Markdown 规范化回退以及稳定的输出模式,而无需重新实现网络获取。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~2233admin-markdown-browser
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~2233admin-markdown-browser/file -o 2233admin-markdown-browser.md
# Markdown Browser Skills

This skill is an orchestration layer, not a replacement fetcher. It always keeps official `web_fetch` as the fetch source of truth.

## MECE Architecture

1. Fetch layer (official, exclusive)
- Use OpenClaw `web_fetch` to retrieve the page.
- Do not call direct HTTP fetch inside this skill for normal operation.

2. Policy layer (these skills)
- Parse `Content-Signal` and compute `policy_action`.
- Current action focuses on `ai-input` semantics: `allow_input`, `block_input`, `needs_review`.

3. Privacy layer (these skills)
- Redact path/fragment/query values in output URL fields.
- Keep URL shape useful for debugging without leaking sensitive values.

4. Normalization layer (these skills)
- If `contentType=text/markdown`, keep content as-is.
- If `contentType=text/html`, convert with `turndown` as fallback enhancement.
- For other content types, pass through text.

## Execution Order

1. Call official `web_fetch`.
2. Pass the result JSON into this wrapper.
3. Optionally pass `Content-Signal` and `x-markdown-tokens` header values if available.
4. Use the returned normalized object for downstream agent logic.

## Wrapper Tool

`process_web_fetch_result({ web_fetch_result, content_signal_header, markdown_tokens_header })`

Input:
- `web_fetch_result` (required): JSON payload returned by OpenClaw `web_fetch`.
- `content_signal_header` (optional): raw `Content-Signal` header string.
- `markdown_tokens_header` (optional): raw `x-markdown-tokens` header value.

Output:
- `content`
- `format` (`markdown` | `html-fallback` | `text`)
- `token_estimate` (`number | null`)
- `content_signal`
- `policy_action`
- `source_url` (redacted)
- `status_code`
- `fallback_used`

## CLI Usage

```bash
# Install runtime dependency once inside the skill directory
npm install --omit=dev

# 1) Obtain a web_fetch payload first (from OpenClaw runtime)
# 2) Save it as /tmp/web_fetch.json
# 3) Run wrapper post-processing
node browser.js \
  --input /tmp/web_fetch.json \
  --content-signal "ai-input=yes, search=yes, ai-train=no" \
  --markdown-tokens "1820"
```

---

## 中文说明

# Markdown Browser 技能

本技能是一个编排层,而非替代性的获取器。它始终将官方 `web_fetch` 作为获取的唯一可信来源。

## MECE 架构

1. 获取层(官方、独占)
- 使用 OpenClaw `web_fetch` 检索页面。
- 在正常运行中,不要在本技能内部调用直接的 HTTP 获取。

2. 策略层(本技能)
- 解析 `Content-Signal` 并计算 `policy_action`。
- 当前操作聚焦于 `ai-input` 语义:`allow_input`、`block_input`、`needs_review`。

3. 隐私层(本技能)
- 在输出的 URL 字段中编辑(脱敏)path/fragment/query 值。
- 保持 URL 形态便于调试,同时不泄露敏感值。

4. 规范化层(本技能)
- 如果 `contentType=text/markdown`,则保持内容原样。
- 如果 `contentType=text/html`,则使用 `turndown` 进行转换作为回退增强。
- 对于其他内容类型,按文本直接透传。

## 执行顺序

1. 调用官方 `web_fetch`。
2. 将结果 JSON 传入本包装器。
3. 如有可用,可选地传入 `Content-Signal` 和 `x-markdown-tokens` 头部值。
4. 将返回的规范化对象用于下游代理逻辑。

## 包装器工具

`process_web_fetch_result({ web_fetch_result, content_signal_header, markdown_tokens_header })`

输入:
- `web_fetch_result`(必填):OpenClaw `web_fetch` 返回的 JSON 载荷。
- `content_signal_header`(可选):原始 `Content-Signal` 头部字符串。
- `markdown_tokens_header`(可选):原始 `x-markdown-tokens` 头部值。

输出:
- `content`
- `format`(`markdown` | `html-fallback` | `text`)
- `token_estimate`(`number | null`)
- `content_signal`
- `policy_action`
- `source_url`(已脱敏)
- `status_code`
- `fallback_used`

## CLI 用法

```bash
# Install runtime dependency once inside the skill directory
npm install --omit=dev

# 1) Obtain a web_fetch payload first (from OpenClaw runtime)
# 2) Save it as /tmp/web_fetch.json
# 3) Run wrapper post-processing
node browser.js \
  --input /tmp/web_fetch.json \
  --content-signal "ai-input=yes, search=yes, ai-train=no" \
  --markdown-tokens "1820"
```