Skip to content

Commit 5254e03

Browse files
Leo310claude
andauthored
docs(widgets): Widgets page, skill and tool updates, release checklist (#3)
* docs(widgets): the Widgets page, skill and tool updates, release checklist Documents the widgets feature shipped in smart-second-brain #505/#506: what a widget is, the chat toolbar (Expand, Copy as block, Save as a widget file), `.widget` files (own tab with Edit source/Refresh, embeds, live re-render, agent revisions through review), the header keys (title, description, icon, height, queries, libs), note links with page preview under the "S2B Widgets" source, Plotly plots, the sandbox, indexing by title and description, and the Sync/backlink caveats. Adds `widgets` to the bundled core skills (five now), notes that read_content and manage_notes accept `.widget` files, links the page from the Agents overview, and adds a widgets row to the release checklist and the verification table. Co-Authored-By: Claude <noreply@anthropic.com> * docs(widgets): the tab's Rename action Co-Authored-By: Claude <noreply@anthropic.com> * docs(widgets): describe the rendered review of agent edits * docs(widgets): rename lives in the tab menu; no refresh action * docs(widgets): edit source moved to the tab menu * landing: widgets in the agents section, and the chat still shows one The agents lede names the second thing an agent produces, a fifth point describes widgets with the plugin's own `component` glyph, and the chat still trades the staged-flashcards story (the demo above already IS the approval feature) for a widget card: the toolbar the chat renders — icon, title, Expand, Copy as block, Save as widget file — over a bar chart of notes per week. Static, no JS; checked at 1280 light and 375 dark. * landing: the Skills point names all five core skills --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 84017c3 commit 5254e03

10 files changed

Lines changed: 229 additions & 49 deletions

File tree

‎CLAUDE.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ in the plugin repo, checked out alongside this one at `../smart-second-brain`:
776776
| Providers | `src/providers/index.ts` → `PROVIDER_TEMPLATES` |
777777
| Built-in tools | `src/types/plugin.ts` → `BUILT_IN_TOOL_IDS` |
778778
| Bundled core skills | `src/skills/defaults/*/SKILL.md` |
779+
| Widgets (fence, `.widget` files, header keys, libraries, sandbox) | `src/widget/` (`widgetSpec.ts`, `widgetFrame.ts`, `widgetLibs.ts`, `registerWidgetBlocks.ts`), `src/views/widget/` |
779780
| Integration skills | `src/skills/integrations/*/SKILL.md`, and `CURATED_PLUGIN_INTEGRATIONS` in `src/agent/integrations/pluginIntegrations.ts` |
780781
| Skill/memory folder paths | `src/utils/agentPaths.ts` |
781782
| Command names | `src/main.ts` → `addCommand` calls |
@@ -804,6 +805,12 @@ hand before each release. Work through this list against the sources above:
804805

805806
- [ ] `start/providers` — provider table matches `PROVIDER_TEMPLATES`
806807
- [ ] `agents/skills` — bundled core skills match `src/skills/defaults/`
808+
- [ ] `agents/widgets` — header keys match `WidgetSpec` in
809+
`src/widget/widgetSpec.ts`, `libs` matches `WIDGET_LIBS` in
810+
`src/widget/widgetLibs.ts` (and the trace types the Plotly build carries),
811+
the chat toolbar labels match `registerWidgetBlocks.ts`, the tab actions
812+
match `views/widget/WidgetView.ts`, and the default icon matches
813+
`DEFAULT_WIDGET_ICON`
807814
- [ ] `agents/integrations` — curated list matches
808815
`CURATED_PLUGIN_INTEGRATIONS`; the seeded-at-startup core-plugin
809816
integrations are the entries in `src/skills/integrations/` whose

‎astro.config.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export default defineConfig({
110110
items: [
111111
{ label: 'Overview', slug: 'agents' },
112112
{ label: 'Skills', slug: 'agents/skills' },
113+
{ label: 'Widgets', slug: 'agents/widgets' },
113114
{ label: 'Integrations', slug: 'agents/integrations' },
114115
{ label: 'Memory', slug: 'agents/memory' },
115116
{ label: 'MCP servers', slug: 'agents/mcp' },

‎src/content/docs/agents/index.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ What an agent *has* is covered on its own page: the
1616
[skills](/agents/skills/) that give it tools, the
1717
[integrations](/agents/integrations/) that let it script other plugins, its
1818
[memory](/agents/memory/), and any [MCP servers](/agents/mcp/) it connects to.
19+
What it can *build* for you — dashboards, charts and plots from your notes —
20+
is on the [Widgets](/agents/widgets/) page.
1921

2022
## Conversations are notes
2123

@@ -68,12 +70,12 @@ on its enabled skills. See [Skills](/agents/skills/).
6870
| --- | --- |
6971
| `search_notes` | Search the vault (lexical, semantic, or hybrid) |
7072
| `list_directory` | List folders and files |
71-
| `read_content` | Read a note's content |
73+
| `read_content` | Read a note (or a `.widget` file) |
7274
| `grep_notes` | Find an exact substring or regex across notes |
7375
| `get_all_tags` | List every tag in the vault |
7476
| `get_properties` | Read frontmatter properties, or list all property keys |
7577
| `execute_javascript` | Run JavaScript against the vault |
76-
| `manage_notes` | Create, update, delete, and move notes (**staged for review**) |
78+
| `manage_notes` | Create, update, delete, and move notes and `.widget` files (**staged for review**) |
7779
| `fetch_url` | Fetch a public web page as markdown |
7880
| `web_search` | Search the web |
7981
| `manage_skills` | Create, revise, or delete skills |

‎src/content/docs/agents/integrations.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Integrations
33
description: Let an agent script other Obsidian plugins through their public APIs.
44
sidebar:
5-
order: 3
5+
order: 4
66
---
77

88
An integration lets an agent call another Obsidian plugin's public API. Ask for

‎src/content/docs/agents/mcp.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: MCP servers
33
description: Connect external tools and data sources via MCP.
44
sidebar:
5-
order: 5
5+
order: 6
66
---
77

88
[MCP](https://modelcontextprotocol.io/), the Model Context Protocol, is an

‎src/content/docs/agents/memory.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Memory
33
description: Working memory stored as real notes in your vault.
44
sidebar:
5-
order: 4
5+
order: 5
66
---
77

88
Memory lets an agent remember things between conversations: that you prefer

‎src/content/docs/agents/skills.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ allowed-tools: manage_notes
3535

3636
## Bundled core skills
3737

38-
Four ship with the plugin and are seeded into your vault on first run:
38+
Five ship with the plugin and are seeded into your vault on first run:
3939

4040
| Skill | Attaches | Covers |
4141
| --- | --- | --- |
4242
| `explore-vault` | `search_notes`, `list_directory`, `read_content`, `grep_notes`, `get_all_tags`, `get_properties`, `execute_javascript` | Finding and reading notes: verify tags and properties before querying, and what to do when a search comes back weak |
4343
| `manage-notes` | `manage_notes` | Creating, editing, deleting and moving notes: the staging policy, and how to replace or withdraw an edit it has already staged |
4444
| `web` | `fetch_url`, `web_search` | Reaching the public internet, vault-first |
4545
| `manage-skills` | `manage_skills` | Authoring and revising skills |
46+
| `widgets` | *(no tools)* | Building [widgets](/agents/widgets/): the block format, the data bridge, and the sandbox rules. Pure guidance, so it is never hidden by a tool override |
4647

4748
Older vaults had `manage-notes` under the name `edit-notes` and `manage-skills`
4849
under `update-skills`. The plugin renames the folders on update and keeps your

‎src/content/docs/agents/widgets.md‎

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: Widgets
3+
description: "Interactive dashboards, charts and plots the agent builds from your vault, kept as files you can embed anywhere."
4+
sidebar:
5+
order: 3
6+
---
7+
8+
Ask the agent for a dashboard of your open tasks, a heatmap of when you edit
9+
notes, or a 3D plot of a function you are studying, and it answers with a
10+
**widget**: a small interactive page, rendered right there in the chat, built
11+
from live data in your vault. Keep the ones you like as `.widget` files. They
12+
open in their own tab, embed in any note, and stay up to date as the vault
13+
changes.
14+
15+
Widgets need the [`widgets` skill](/agents/skills/), which ships with the plugin
16+
and is on by default. Live data needs the
17+
[Dataview](https://github.com/blacksmithgu/obsidian-dataview) plugin; without it
18+
a widget can still show data the agent gathered, it just won't refresh itself.
19+
20+
## In the chat
21+
22+
A widget renders as a card in the reply, with a small toolbar above it:
23+
24+
- **Expand** opens it almost full-window for a closer look.
25+
- **Copy as block** puts the widget on the clipboard as a code block you can
26+
paste into any note, where it renders the same way.
27+
- **Save as a widget file** writes it to your **Widgets folder** (Settings →
28+
Agents → Widgets, default `Widgets/`) and opens it.
29+
30+
A widget starts rendering the moment its block is complete, while the rest of
31+
the reply is still streaming.
32+
33+
## Widget files
34+
35+
A saved widget is a `.widget` file. It behaves like any file in the vault:
36+
37+
- **Its own tab.** Open it from the file explorer or the quick switcher and it
38+
fills the pane. The tab's context menu adds **Edit source** (a plain-text
39+
editor for the file, since Obsidian has none for the extension) and
40+
**Rename…** next to the usual file actions.
41+
- **Embeddable.** `![[Vault overview.widget]]` renders it inside a note at its
42+
own height. Hovering a link to it shows the same preview as any page preview.
43+
- **Live.** Edit the file, or accept an agent's edit to it, and every open tab
44+
and embed re-renders.
45+
46+
The agent can revise a saved widget the same way it edits notes: it reads the
47+
file and stages the change, and you review it as the **rendered widget** before
48+
anything is written. The chat's pending-changes bar previews the proposal in
49+
place (with the source diff a click away), and the widget's own pane shows the
50+
proposed version under an accept/reject bar, with a toggle back to the current
51+
one.
52+
53+
:::note
54+
Obsidian Sync carries `.widget` files only if **Sync all other types** is on
55+
in its settings. Links written *inside* a widget open and preview normally but
56+
don't count as backlinks, since Obsidian's link index reads markdown only.
57+
:::
58+
59+
## What is in a widget
60+
61+
A widget is an HTML page with a short header:
62+
63+
````markdown
64+
```s2b-widget
65+
---
66+
title: Notes per tag
67+
description: The fifteen most-used tags, as a bar chart
68+
icon: tags
69+
queries:
70+
tags: TABLE length(rows) AS n FROM "" FLATTEN file.tags AS tag GROUP BY tag
71+
---
72+
<div id="chart"></div>
73+
<script>
74+
s2b.onData(({ tags }) => { /* draw from tags.rows */ });
75+
</script>
76+
```
77+
````
78+
79+
The header keys, all optional:
80+
81+
| Key | What it does |
82+
| --- | --- |
83+
| `title` | Shown on the card and the tab; the file name when saved |
84+
| `description` | One line on what the widget shows. With the title, the only part of a saved widget that search indexes |
85+
| `icon` | Any [Lucide](https://lucide.dev/icons/) icon name for the tab and card; the default is `component` |
86+
| `height` | A fixed height in pixels. Without it the widget sizes to its content; with it, it still shrinks when the content is shorter |
87+
| `queries` | Named [Dataview](https://blacksmithgu.github.io/obsidian-dataview/queries/structure/) queries. The plugin runs them, hands the results to the widget, and runs them again whenever the vault changes |
88+
| `libs` | Bundled libraries to load. Currently `plotly`, for 2D and 3D plots |
89+
90+
The `.widget` file is exactly this, without the fence lines. You never need to
91+
write one by hand, but you can, and the source editor shows the header keys as
92+
a reminder.
93+
94+
### Links to notes
95+
96+
Anything in a widget marked with `data-note="Path/To/Note.md"` (or a plain link
97+
whose target is a vault path) is a note link: click opens the note, Cmd/Ctrl-click
98+
opens it in a new tab, and hovering shows a page preview. Page preview lists
99+
widgets as their own source, **S2B Widgets**, so you can decide there whether the
100+
preview needs a modifier key, as for any other source.
101+
102+
### Plots
103+
104+
With `libs: plotly` a widget gets [Plotly](https://plotly.com/javascript/) for
105+
line, scatter, bar and pie charts, and for 3D surfaces, scatter and meshes with
106+
orbit and zoom. The build is bundled with the plugin, so plots work offline like
107+
everything else. Without a library, a widget can still draw with SVG or a
108+
canvas.
109+
110+
## Widgets are sandboxed
111+
112+
A widget is code the agent wrote, so it runs in a box:
113+
114+
- It renders in an isolated frame with **no access to Obsidian, your vault, or
115+
the network**. It cannot fetch, load remote scripts, or navigate anywhere.
116+
- The **plugin** runs the widget's queries and passes the results in. The
117+
widget sees only what its own queries return.
118+
- Libraries are bundled with the plugin, never downloaded.
119+
120+
Treat a widget like anything else the agent produces: it can only act on data
121+
you let the agent read.
122+
123+
## Widgets and search
124+
125+
A saved widget is indexed by its **title and description only**, so you and
126+
the agent can find "the tags overview" without its code ever showing up as a
127+
search result. A widget pasted into a note as a block is likewise reduced to a
128+
marker with its title before that note is indexed.

0 commit comments

Comments
 (0)