← 返回 Skills 市场
kuaner

Interactive Widget

作者 kuaner · GitHub ↗ · v0.1.2 · MIT-0
cross-platform ✓ 安全检测通过
189
总下载
1
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install interactive-widget
功能描述
Create shareable interactive web pages — dashboards, charts, forms, simulations — via the duoduo-widget CLI. Each widget gets a permanent URL that works in a...
使用说明 (SKILL.md)

Widget — Durable Interactive Artifacts

The user watches the widget live — stream content fast, one section per tool call.

Quick start

npm install -g @openduo/duoduo-widgets  # if not installed

1. Open

duoduo-widget open --title "Dashboard" --ttl-seconds 300

Send links.feishu_sidebar or links.browser to user. NEVER send control_url/control_token.

2. Skeleton + push

cat > /tmp/w-{wid}.html \x3C\x3C 'SKELETON'
\x3Cdiv style="background:#1a1a1a;color:#e0e0e0;padding:20px;font-family:system-ui;min-height:100vh;">
  \x3Ch1 style="color:#fff;font-size:28px;font-weight:500;margin:0 0 4px;">Title\x3C/h1>
  \x3Cp style="color:#999;font-size:14px;margin:0 0 20px;">Subtitle\x3C/p>
\x3C!-- NEXT -->
\x3C/div>
SKELETON
cat /tmp/w-{wid}.html | duoduo-widget update --wid "wid_..."

3a. Append section via full HTML (classic)

python3 - /tmp/w-{wid}.html \x3C\x3C 'PYEOF'
import sys
f = sys.argv[1]
html = open(f).read()
section = """\x3Cdiv style="background:#2a2a2a;padding:16px;border-radius:8px;margin-bottom:12px;">
  \x3Ch3 style="margin:0 0 8px;color:#fff;font-size:16px;font-weight:500;">Section title\x3C/h3>
  \x3Cp style="margin:0;color:#999;font-size:14px;">Content — $100 safe, no escaping needed\x3C/p>
\x3C/div>
\x3C!-- NEXT -->"""
html = html.replace('\x3C!-- NEXT -->', section)
open(f, 'w').write(html)
PYEOF
cat /tmp/w-{wid}.html | duoduo-widget update --wid "wid_..."

Quoted heredoc 'PYEOF' — write raw HTML, no shell escaping. Only change content inside """...""".

3b. Incremental update via --patch (preferred for data-heavy widgets)

After the skeleton is pushed, use --patch to update specific parts of the page without re-sending the entire HTML. This is faster, uses less bandwidth, and avoids morphdom re-rendering.

duoduo-widget update --wid "wid_..." --patch '[
  {"op":"append","selector":"#rows","html":"\x3Ctr>\x3Ctd>New item\x3C/td>\x3Ctd>$100\x3C/td>\x3C/tr>"},
  {"op":"text","selector":"#count","text":"42"},
  {"op":"innerHTML","selector":"#status","html":"\x3Cstrong style=\"color:#4ade80\">Done\x3C/strong>"}
]'

Patch operations:

Op What it does Requires
append Insert html as last child of selector html
prepend Insert html as first child of selector html
replace Replace element matching selector html
innerHTML Set innerHTML of selector html
text Set textContent of selector text
remove Remove element matching selector

When to use patch vs full HTML:

  • Patch: tables gaining rows, dashboards updating numbers, status text changes, progressive list building
  • Full HTML: first skeleton push, layout changes, adding new scripts/CDN libraries

Important: Patches update the live viewer instantly but do NOT update the stored HTML on the server. To ensure the finalized artifact includes all changes, use this pattern:

  1. Push skeleton via full update --html (keep the temp file)
  2. Stream data via --patch for live viewer speed
  3. In parallel, keep appending to /tmp/w-{wid}.html locally
  4. Before finalize, do one last cat /tmp/w-{wid}.html | duoduo-widget update --wid ...
  5. Then finalize

Or simply: pass the final complete HTML via duoduo-widget finalize --wid ... --html "..." if available.

Skeleton design for patch: Give target elements id attributes so patches can address them:

\x3Ctbody id="rows">\x3C/tbody>
\x3C!-- append rows here -->
\x3Cspan id="count">0\x3C/span>
\x3C!-- update text here -->
\x3Cdiv id="status">Loading...\x3C/div>
\x3C!-- update status here -->

4. Finalize

duoduo-widget finalize --wid "wid_..."

Rules

  1. Copy from references/html_patterns.md — read it first, pick a section template, change only the data values. Never design HTML from scratch
  2. One section per Bash call — heredoc + cat pipe in a single command
  3. Push after every section — never batch
  4. Never build full HTML in context — the temp file accumulates; context only sees the section
  5. Never read the temp file back — it only flows through the pipe
  6. Act on _hints in update output: no_viewers → send link; ttl_low/ttl_expiring → finalize now; many_updates → wrap up

Interactive widgets

duoduo-widget open --title "Confirm" --ttl-seconds 300 \
  --interaction-mode submit --interaction-prompt "Review and confirm"

Button: \x3Cbutton onclick="window.duoduo.submit('action', {key:'val'})" style="background:#4a9;color:#fff;border:none;padding:10px 24px;border-radius:6px;font-size:14px;cursor:pointer;">Label\x3C/button>

Read result: duoduo-widget wait --wid "wid_..." --timeout-seconds 120

HTML rules

  • Inline styles only. CDN: cdnjs.cloudflare.com, esm.sh, cdn.jsdelivr.net, unpkg.com
  • Forbidden: fetch(), XMLHttpRequest, WebSocket, eval(), new Function()

Templates — read references/html_patterns.md first. Copy a template, change data values only.

CLI reference

Command Purpose Key flags
open Create draft --title, --ttl-seconds, --interaction-mode, --interaction-prompt
update Push HTML or patch --wid, stdin or --html, --patch \x3Cjson>, --text-fallback
finalize Freeze --wid
wait Block for submit --wid, --timeout-seconds
get Poll status --wid

State machine

draftfinalizedawaiting_inputsubmitted (terminal)

Finalized artifacts are permanent. Fork: open --fork \x3Cwidget_id>.

Environment

WIDGET_SERVICE_URL env var (default: https://aidgets.dev).

安全使用建议
This is a usage guide for a third-party CLI/service rather than code bundled into the agent. Before using: (1) verify you trust the @openduo/duoduo-widgets package and the service it talks to (there is no homepage/source in the skill metadata), (2) avoid putting secrets or private data into widget HTML or patches (these are uploaded to the provider), and (3) follow the skill's guidance to never reveal control_url/control_token. If you need to display sensitive information, consider hosting widgets yourself or using a trusted alternative.
功能分析
Type: OpenClaw Skill Name: interactive-widget Version: 0.1.2 The skill provides a framework for an AI agent to create interactive web widgets (dashboards, forms) using the `duoduo-widget` CLI and a remote service at aidgets.dev. It includes explicit security instructions for the agent, such as forbidding the disclosure of control tokens and prohibiting the use of dangerous JavaScript APIs (e.g., `eval`, `fetch`, `XMLHttpRequest`) within the generated widgets. The implementation uses quoted heredocs in Bash and Python for safe HTML manipulation, demonstrating a defensive coding style rather than malicious intent. No indicators of data exfiltration, unauthorized execution, or persistence were found.
能力评估
Purpose & Capability
Name/description match the instructions: the SKILL.md documents how to open, stream, update, patch, and finalize shareable widgets via the duoduo-widget CLI. No unrelated env vars, binaries, or config paths are requested.
Instruction Scope
Runtime instructions are narrowly scoped to building and pushing HTML fragments to the duoduo-widget service, using patches or full HTML. The doc explicitly forbids network APIs from the widget (fetch/XHR/WebSocket) and warns not to expose control_url/control_token. The instructions do not instruct reading unrelated system files or environment variables.
Install Mechanism
There is no install spec (instruction-only). The Quick Start suggests npm install -g @openduo/duoduo-widgets, but the skill does not itself install anything. That is proportionate for a CLI guide, however the referenced npm package and service are external and the skill provides no homepage or source link to verify.
Credentials
The skill requires no environment variables, credentials, or config paths. All operations are expected to use the duoduo-widget CLI and its output; nothing requests unrelated secrets.
Persistence & Privilege
always:false and no install or system-wide changes are requested. The skill does not request persistent privileges or modify other skills' configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install interactive-widget
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /interactive-widget 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.2
**Version 0.1.2 Changelog** - Added support and documentation for fast incremental widget updates using the new `update --patch` CLI flag. - Described available patch operations (e.g., append, prepend, replace, innerHTML, text, remove). - Clarified when to use patch vs. full HTML updates and how to ensure the finalized artifact is complete. - Updated CLI reference to include `--patch`. - Provided a best-practice section for designing skeletons with target IDs for patching.
v0.1.1
interactive-widget 0.1.1 - Major SKILL.md rewrite for clarity: workflow explained as fast, live, section-by-section updates for better user experience. - Stronger guidance: always copy HTML from `references/html_patterns.md`; never design from scratch or batch multiple sections. - Added explicit code snippets for building and updating HTML incrementally using heredocs and Python, with clear separation of section and accumulator file. - Streamlined CLI usage instructions and HTML authoring rules. - Highlighted action on `_hints` output and improved interactive input/button documentation. - Deprecated unused flags and reduced reference clutter.
v0.1.0
Initial release of interactive-widget skill — create and share persistent, interactive web widgets. - Enables creation of dashboards, forms, charts, parameter confirmations, and live visualizations with permanent URLs. - Integrates with the duoduo-widget CLI for a full open → update → finalize artifact lifecycle. - Supports streaming/progressive updates for responsive user experience, especially in Feishu/Lark sidebar. - Provides structured user input and parameter confirmation via submit buttons and `window.duoduo` bridge. - Channel-specific links for browser and Feishu/Lark platforms. - Outlines security and HTML authoring guidelines, including CDN allowlist and restricted JS features.
元数据
Slug interactive-widget
版本 0.1.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Interactive Widget 是什么?

Create shareable interactive web pages — dashboards, charts, forms, simulations — via the duoduo-widget CLI. Each widget gets a permanent URL that works in a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 189 次。

如何安装 Interactive Widget?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install interactive-widget」即可一键安装,无需额外配置。

Interactive Widget 是免费的吗?

是的,Interactive Widget 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Interactive Widget 支持哪些平台?

Interactive Widget 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Interactive Widget?

由 kuaner(@kuaner)开发并维护,当前版本 v0.1.2。

💬 留言讨论