@webmcp-auto-ui/agent 2.5.26 → 2.5.28

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.
@@ -928,6 +928,118 @@ component("gallery", {
928
928
  - **Forgetting to check** that the image field exists in the returned data (some Met Museum objects have no \`primaryImage\`)
929
929
  - **Using \`text\` to display URLs** instead of \`gallery\` — images must be rendered visually
930
930
  - **Not adapting the size**: iNaturalist returns "square" thumbnails by default — replace with "medium" or "large" in the URL
931
+ `,
932
+ 'hackathon-assemblee-nationale': `---
933
+ id: hackathon-assemblee-nationale-mcp-webmcp
934
+ name: Hackathon Assemblée Nationale · MCP & WebMCP starter
935
+ components_used: [notebook-document, notebook-compact]
936
+ when: the user mentions the Assemblée Nationale hackathon, wants to experiment with parliamentary data (Tricoteuses, Legifrance), or asks for a starter notebook to explore deputies, votes, amendments, or legislative texts in a hackathon context. Keywords include "hackathon Assemblée Nationale", "MCP WebMCP hackathon", "tricoteuses playbook", "parlement playground", "hackathon parlementaire".
937
+ servers: [autoui, tricoteuses]
938
+ layout:
939
+ type: single
940
+ ---
941
+
942
+ ## When to use
943
+
944
+ The user is participating in (or preparing for) the Assemblée Nationale hackathon around MCP and WebMCP. They want a ready-to-fork notebook with:
945
+ - A clear onboarding (what the hackathon is about, what data is available)
946
+ - Seed queries against Tricoteuses (parliamentary database) that return meaningful results immediately
947
+ - A visualization or transformation cell that the participant can iterate on
948
+ - A closing "your turn" note inviting them to modify, run, and share
949
+
950
+ This recipe is a **specialization** of the generic \`notebook-playbook\` recipe — pre-filled with parliamentary-specific seed cells and tailored to the hackathon narrative.
951
+
952
+ ## How to use
953
+
954
+ ### Step 1 — Pick the document layout
955
+
956
+ Default to \`notebook-document\` for the hackathon. Reasons:
957
+ - Participants expect to collaborate and leave traces for each other (avatars, comments)
958
+ - The document layout reads naturally as "hackathon brief + starter code" rather than "dev tool"
959
+ - Margin comments can be seeded to hint at directions to explore
960
+
961
+ If the participant asks for a minimal dev-focused playground instead, fall back to \`notebook-compact\`.
962
+
963
+ ### Step 2 — Seed the cells
964
+
965
+ The notebook should contain 5–7 cells covering:
966
+
967
+ 1. **Intro markdown** — title, one-line context of the hackathon, link to relevant docs
968
+ 2. **Challenge markdown** — a few axes of exploration suggested by the hackathon organizers (replace placeholders with actual challenges when known)
969
+ 3. **Starter SQL** — a safe, visibly meaningful query on Tricoteuses (e.g. recent votes, most active deputies, amendments on a specific text)
970
+ 4. **Transform JS** — a small JS cell that post-processes the SQL result (grouping, counting, chart prep)
971
+ 5. **Visualization hint** — a markdown cell pointing at available visualization widgets (\`hemicycle\`, \`profile\`, \`timeline\`)
972
+ 6. **Your turn** — a closing markdown inviting the participant to fork and edit
973
+
974
+ Example template (to be refined with actual hackathon organizers' briefs):
975
+
976
+ \`\`\`
977
+ widget_display({name: "notebook-document", params: {
978
+ title: "Hackathon Assemblée Nationale · starter",
979
+ cells: [
980
+ {
981
+ type: "md",
982
+ content: "### Bienvenue au hackathon IA de l'Assemblée Nationale\\n\\nCe notebook est votre point de départ. Les données parlementaires proviennent du serveur <mark>Tricoteuses</mark>. Forkez, éditez, partagez."
983
+ },
984
+ {
985
+ type: "md",
986
+ content: "### Pistes d'exploration\\n\\n- Profil d'un parlementaire et son activité\\n- Cartographie des votes par groupe politique\\n- Amendements sur un texte précis\\n- Enrichissement Wikipedia des parlementaires\\n- Croisement entre circonscription et données externes"
987
+ },
988
+ {
989
+ type: "sql",
990
+ content: "-- 10 scrutins les plus récents\\nSELECT id, date, intitule, pour, contre, abstention\\nFROM scrutins\\nORDER BY date DESC\\nLIMIT 10",
991
+ comment: {
992
+ who: "organizers",
993
+ when: "start",
994
+ body: "Remplacez par une requête sur un texte qui vous intéresse (LIMIT important)."
995
+ }
996
+ },
997
+ {
998
+ type: "js",
999
+ content: "// Regroupe les scrutins par mois\\nconst byMonth = {};\\nfor (const s of rows) {\\n const m = s.date.slice(0, 7);\\n byMonth[m] = (byMonth[m] || 0) + 1;\\n}\\nconsole.table(byMonth);"
1000
+ },
1001
+ {
1002
+ type: "md",
1003
+ content: "### Visualiser\\n\\nPour afficher un profil parlementaire : \`widget_display({name: \\"profile\\", params: {...}})\`.\\nPour un hémicycle : \`widget_display({name: \\"hemicycle\\", params: {groups, result}})\`.\\nPour une timeline de mandats : \`widget_display({name: \\"timeline\\", params: {events}})\`."
1004
+ },
1005
+ {
1006
+ type: "md",
1007
+ content: "### À vous\\n\\nAjoutez des cellules avec \`+ sql / + code\`, réarrangez, exécutez. Quand vous avez quelque chose d'intéressant, cliquez \`share\` pour partager le lien hyperskill avec votre équipe ou les organisateurs."
1008
+ }
1009
+ ]
1010
+ }})
1011
+ \`\`\`
1012
+
1013
+ ### Step 3 — Adapt to what the user knows
1014
+
1015
+ - If the user has no background in the Tricoteuses schema, mention they can use \`list_tables\` and \`describe_table\` on the Tricoteuses server to discover the data model before writing queries.
1016
+ - If the user already has a specific question ("I want to look at votes on the 2024 budget"), rewrite the starter SQL to target that question directly.
1017
+ - If the user asks for a minimal playground without the hackathon framing, fall back to the generic \`notebook-playbook\` recipe instead.
1018
+
1019
+ ### Step 4 — Share
1020
+
1021
+ After creating the notebook, remind the user that they can:
1022
+ - Use \`share\` → \`Hyperskill link\` to generate a fork-friendly URL to paste into their team's channel
1023
+ - Switch to \`view\` mode when demoing to organizers
1024
+ - Consult \`⟲ history\` to see their iteration trace and restore cells deleted by mistake
1025
+
1026
+ ## Notes
1027
+
1028
+ This recipe is intended as a **starting skeleton** — the concrete hackathon brief (dates, prizes, specific challenges, dataset access restrictions) will be refined in a dedicated session with the organizers. Placeholders in the example above (axes of exploration, comments) should be replaced with the actual material provided by the hackathon team when it is available.
1029
+
1030
+ For parliamentary profile pages, vote results with hemicycles, and legislative file browsing, prefer the dedicated recipes:
1031
+ - \`display-parliamentary-profile-with-hemicycle-and-votes\`
1032
+ - \`explorer-dossiers-legislatifs-parcours-texte\`
1033
+ - \`rechercher-textes-juridiques-legifrance\`
1034
+
1035
+ These recipes produce more specialized layouts than a generic notebook, and are better suited when the output is a single focused page rather than a multi-cell playbook.
1036
+
1037
+ ## Common mistakes
1038
+
1039
+ - **Forgetting the hackathon framing**: without the "bienvenue" and "à vous" markdown cells, participants land on a bare notebook and lose the playbook feeling.
1040
+ - **SQL without LIMIT**: Tricoteuses queries without \`LIMIT\` can return thousands of rows and slow down the first impression.
1041
+ - **Inventing data**: do not seed with fake French parliamentary content (fake deputies, fake votes). If the actual data is not known at seed time, use generic queries (\`SELECT * FROM scrutins LIMIT 5\`) and let the user discover from there.
1042
+ - **Picking the wrong layout**: if the user is solo and wants to code fast, \`notebook-compact\` is better than \`notebook-document\`. Default to document for hackathon context because of the collaborative framing, not as a hard rule.
931
1043
  `,
932
1044
  'hummingbird-data': `---
933
1045
  id: hummingbird-data
@@ -1017,6 +1129,200 @@ Phrase: "Salt crystals sing in the kettle at midnight."
1017
1129
  2. Chat: \`✅ hummingbird-middle followed — N7614\`
1018
1130
 
1019
1131
  Do NOT render any widget.
1132
+ `,
1133
+ 'notebook-playbook': `---
1134
+ id: create-interactive-notebook-playbook
1135
+ name: Create an interactive notebook playbook
1136
+ components_used: [notebook-compact, notebook-workspace, notebook-document, notebook-editorial]
1137
+ when: the user wants to experiment with data, prototype a small analysis, share a reusable scenario, or prepare a hackathon-ready playground. Keywords include "playground", "playbook", "experiment", "try", "prototype", "hackathon", "share a notebook", "template", "starter", "publish".
1138
+ servers: [autoui]
1139
+ layout:
1140
+ type: single
1141
+ ---
1142
+
1143
+ ## When to use
1144
+
1145
+ The user asks for a **notebook-like interactive playground** that combines text, queries, and code cells. Typical triggers:
1146
+ - "Give me a playground for exploring X"
1147
+ - "Prepare a notebook I can share with my team"
1148
+ - "I want to prototype a small analysis"
1149
+ - "Set up a hackathon starter"
1150
+ - "Make a reusable template for exploring CSVs / this API / these tables"
1151
+ - "Publish this analysis as a short memo"
1152
+
1153
+ This recipe applies across domains (parliamentary data, biodiversity, news, business datasets, etc.) — it only prescribes the **shape** of the answer, not its content.
1154
+
1155
+ ## How to use
1156
+
1157
+ ### Step 1 — Pick the right notebook layout
1158
+
1159
+ Choose one of the four \`notebook-*\` widgets based on the user's implicit intent:
1160
+
1161
+ | Layout | Use when |
1162
+ |---|---|
1163
+ | \`notebook-compact\` | Quick data exploration, reactive dataflow with named outputs, minimal chrome. **Default for most "playground" and "hackathon" requests.** |
1164
+ | \`notebook-workspace\` | The user expects a multi-cell analyst workspace with sources, cell navigation, \`run all\`, and a \`publish\` step. Use when they mention "dashboard", "app", "workspace", "publish". |
1165
+ | \`notebook-document\` | The user plans to share and discuss with a team. Use when "collaborate", "review", "comment", "reply" appear. |
1166
+ | \`notebook-editorial\` | The user wants a polished, article-like final deliverable mixing prose and code. Use for "memo", "report", "writeup", "blog-style". |
1167
+
1168
+ When in doubt, pick \`notebook-compact\`.
1169
+
1170
+ ### Step 2 — Pre-fill the cells with context-aware seeds
1171
+
1172
+ Never create an empty notebook. Always seed with 3–5 cells that give the user an immediate starting point:
1173
+
1174
+ 1. **First cell: markdown** — title + one-sentence context of what the notebook is for
1175
+ 2. **Second cell: markdown or code** — if an MCP data source is connected, a starter query that returns something visible (e.g. \`SELECT * FROM {table} LIMIT 10\`). Otherwise a markdown cell describing the next step
1176
+ 3. **Third cell: code** — a transformation or a visualization that uses the output of step 2. Use \`varname\` on the SQL cell (\`varname: "rows"\`) and reference it in the JS cell — this activates the **reactive dataflow** (the downstream JS cell is flagged stale automatically when its upstream re-runs)
1177
+ 4. **Last cell: markdown** — a short "to you to play" note inviting the user to add cells or edit
1178
+
1179
+ Example seed for a generic data playground:
1180
+
1181
+ \`\`\`
1182
+ widget_display({name: "notebook-compact", params: {
1183
+ title: "Exploration playground",
1184
+ cells: [
1185
+ {type: "md", content: "### Exploration playground\\n\\nStart by running the first SQL cell, then iterate."},
1186
+ {type: "sql", content: "select * from source limit 10", varname: "rows"},
1187
+ {type: "js", content: "// explore rows here\\nconsole.table(rows)"},
1188
+ {type: "md", content: "### Your turn\\n\\nAdd cells with \`+ sql\` or \`+ js\`, reorder via the drag handle, and share via the header button."}
1189
+ ]
1190
+ }})
1191
+ \`\`\`
1192
+
1193
+ ### Step 3 — Adapt seeds to the connected MCP server
1194
+
1195
+ If a specific MCP server is connected, replace the generic \`source\` and \`select *\` placeholders with actual tables and queries from that server:
1196
+ - For a parliamentary server (Tricoteuses): use actual tables like \`acteurs\`, \`scrutins\`, \`amendements\` with meaningful LIMIT
1197
+ - For a biodiversity server (iNaturalist): use the server's typical queries to return observations
1198
+ - For a generic SQL server: list tables first (\`list_tables\` or \`describe_table\`), then seed with a \`SELECT * FROM {first_table} LIMIT 10\`
1199
+
1200
+ Always keep queries **short** and **limited** so the first run returns quickly and visually.
1201
+
1202
+ SQL cells are dispatched automatically to the server's \`*_query_sql\` tool (first match). JS cells run in a Web Worker with upstream named outputs injected as scope.
1203
+
1204
+ ### Step 4 — Exporting & publishing
1205
+
1206
+ All four notebook layouts share the same \`share\` button in the toolbar, offering **four export formats**:
1207
+
1208
+ | Format | What it does |
1209
+ |---|---|
1210
+ | **Hyperskill link** | Copies both the canonical Hyperskill URL and a short domain-scoped URL (\`?n=<token>\`). The short URL opens the read-only public viewer at \`nb.hyperskills.net\`. |
1211
+ | **Markdown** | Downloads a \`.md\` file containing the notebook content. |
1212
+ | **PNG** | Snapshots the rendered notebook to an image. |
1213
+ | **JSON** | Exports the full widget state — re-importable for programmatic reuse. |
1214
+
1215
+ **Layout-specific share affordances:**
1216
+ - \`notebook-workspace\` has a dedicated \`publish\` button (primary, accent-coloured) that flips \`mode: 'view'\`, tags the notebook \`published\` (from \`draft\`), and copies the Hyperskill link in one gesture. Use this when the user wants a clean hand-off.
1217
+ - \`notebook-document\` shows a single \`share\` link (live invite/collaboration is not available in this build; presence avatars only render when the \`presence\` param is explicitly provided).
1218
+
1219
+ ### Step 5 — Working with connected data servers
1220
+
1221
+ When one or more MCP data servers are connected, every notebook layout exposes a **collapsible left pane** (bookmark-bar styling, collapsed by default) that lists:
1222
+ - **Recipes** published by each server (\`{server}_list_recipes()\`)
1223
+ - **Tools / tables** exposed by each server (\`{server}_list_tools()\`)
1224
+
1225
+ Clicking any recipe opens a viewer modal. Each fenced code block inside the recipe has a \`↳ inject\` button that drops the snippet into the notebook as a new cell — the user never has to copy-paste.
1226
+
1227
+ Two toolbar buttons flank the left pane on every layout:
1228
+ - **\`+ md\`** — 3-tab modal (New / File / URL) to create a markdown cell from scratch, from a local \`.md\` file, or from a URL
1229
+ - **\`+ recipe\`** — 3-tab modal (Browser / File / URL) to import a recipe from a connected server, a local \`.recipe.md\` file, or a URL
1230
+
1231
+ Pass the server metadata via the \`servers:\` param so these affordances populate correctly:
1232
+
1233
+ \`\`\`ts
1234
+ widget_display({
1235
+ name: 'notebook-compact',
1236
+ params: {
1237
+ title: '...',
1238
+ cells: [...],
1239
+ servers: [{ name: 'tricoteuses', url: 'https://...', kind: 'data' }]
1240
+ }
1241
+ })
1242
+ \`\`\`
1243
+
1244
+ **Filter rule**: only MCP *data* servers (\`kind: 'data'\`) belong in \`servers:\`. Do NOT include WebMCP UI servers such as \`autoui\` — they expose no queryable data.
1245
+
1246
+ ### Step 6 — Hand-off guidance
1247
+
1248
+ After creating the notebook, mention to the user that they can:
1249
+ - **Share in four formats** via the toolbar \`share\` button (Hyperskill / Markdown / PNG / JSON)
1250
+ - **Switch to \`view\` mode** (read-only) when presenting
1251
+ - Use **\`run all\`** (workspace) or **\`publish\`** (workspace) for one-shot execution and publication
1252
+ - **Reply** to margin comments in a document layout (\`+ reply\` under each comment)
1253
+ - Access the \`⟲ history\` panel to see the edit trace and restore deleted cells
1254
+ - **Import recipes** from connected MCP servers via the left pane or the \`+ recipe\` modal
1255
+
1256
+ For hackathon contexts, prefer seeding a \`notebook-document\` layout so participants can leave margin comments and replies on cells (presence stays opt-in — pass a \`presence\` array only if you have real editors to show).
1257
+
1258
+ ## Examples
1259
+
1260
+ ### Generic CSV / table playground
1261
+ \`\`\`
1262
+ // user: "I need a playground to play with this CSV"
1263
+ widget_display({name: "notebook-compact", params: {
1264
+ title: "CSV playground",
1265
+ cells: [
1266
+ {type: "md", content: "### CSV playground\\n\\nRun the SQL cell to see the first rows, then iterate."},
1267
+ {type: "sql", content: "select * from source limit 20", varname: "rows"},
1268
+ {type: "js", content: "// summarize, chart, or filter rows here\\nconsole.table(rows)"}
1269
+ ]
1270
+ }})
1271
+ \`\`\`
1272
+
1273
+ ### Publishable analyst workspace
1274
+ \`\`\`
1275
+ // user: "Set up an analysis I can publish to the team as an app"
1276
+ widget_display({name: "notebook-workspace", params: {
1277
+ title: "Sales review",
1278
+ cells: [
1279
+ {type: "md", name: "intro", content: "What this analysis covers."},
1280
+ {type: "sql", name: "fetch_sales", content: "select * from sales limit 100"},
1281
+ {type: "js", name: "plot", content: "// chart the rows"}
1282
+ ]
1283
+ }})
1284
+ // Then tell the user: click \`run all\` to execute, then \`publish\` to flip to view mode and copy the Hyperskill link.
1285
+ \`\`\`
1286
+
1287
+ ### Collaborative analysis with comments
1288
+ \`\`\`
1289
+ // user: "Set up a notebook my team can edit and comment on"
1290
+ widget_display({name: "notebook-document", params: {
1291
+ title: "Team analysis",
1292
+ cells: [
1293
+ {type: "md", content: "Kick-off: describe the question here."},
1294
+ {type: "sql", content: "select * from source limit 10", comment: {who: "reviewer", when: "2m", body: "Should we filter to last quarter only?"}},
1295
+ {type: "md", content: "Your findings: add thoughts, <mark>highlights</mark>, and reply to the comment on the query above."}
1296
+ ]
1297
+ }})
1298
+ \`\`\`
1299
+
1300
+ ### Final memo
1301
+ \`\`\`
1302
+ // user: "Prepare a short memo of my findings"
1303
+ widget_display({name: "notebook-editorial", params: {
1304
+ title: "Findings memo",
1305
+ kicker: "memo",
1306
+ cells: [
1307
+ {type: "md", content: "Three observations from last week's data."},
1308
+ {type: "md", content: "First, the volume is up. Here is the query:"},
1309
+ {type: "sql", content: "select count(*) from source"},
1310
+ {type: "md", content: "Second, the distribution has shifted."},
1311
+ {type: "js", content: "// chart distribution"},
1312
+ {type: "md", content: "We conclude that..."}
1313
+ ]
1314
+ }})
1315
+ \`\`\`
1316
+
1317
+ ## Common mistakes
1318
+
1319
+ - **Empty notebook**: never call \`widget_display\` without at least 3 seed cells. The user expects something they can immediately run.
1320
+ - **Wrong layout for the intent**: do not use \`notebook-editorial\` for quick exploration — it signals "finished article" and intimidates. Use \`notebook-compact\` unless the user explicitly asks for a publication feel.
1321
+ - **Heavy initial queries**: always \`LIMIT 10\` or \`LIMIT 20\` in seed SQL cells. Users will expand later if needed.
1322
+ - **Missing \`varname\` on SQL cells** (in compact layout): the named output is what the compact layout showcases, and it drives the stale-flag dataflow. Without it, the notebook loses half its reactive story.
1323
+ - **Inventing UUIDs**: leave \`id\` unset — the widget generates a sensible default. Only pass \`id\` when restoring an existing notebook.
1324
+ - **Faking presence**: do not pass a \`presence\` array to \`notebook-document\` unless there are real editors to show. Presence is opt-in by design — empty \`presence\` hides the avatar row entirely.
1325
+ - **Including \`autoui\` in \`servers:\`**: only MCP *data* servers (\`kind: 'data'\`) belong there. UI servers like \`autoui\` would pollute the left pane.
1020
1326
  `,
1021
1327
  'parlementaire-profile': `---
1022
1328
  id: display-parliamentary-profile-with-hemicycle-and-votes
@@ -0,0 +1,111 @@
1
+ ---
2
+ id: hackathon-assemblee-nationale-mcp-webmcp
3
+ name: Hackathon Assemblée Nationale · MCP & WebMCP starter
4
+ components_used: [notebook-document, notebook-compact]
5
+ when: the user mentions the Assemblée Nationale hackathon, wants to experiment with parliamentary data (Tricoteuses, Legifrance), or asks for a starter notebook to explore deputies, votes, amendments, or legislative texts in a hackathon context. Keywords include "hackathon Assemblée Nationale", "MCP WebMCP hackathon", "tricoteuses playbook", "parlement playground", "hackathon parlementaire".
6
+ servers: [autoui, tricoteuses]
7
+ layout:
8
+ type: single
9
+ ---
10
+
11
+ ## When to use
12
+
13
+ The user is participating in (or preparing for) the Assemblée Nationale hackathon around MCP and WebMCP. They want a ready-to-fork notebook with:
14
+ - A clear onboarding (what the hackathon is about, what data is available)
15
+ - Seed queries against Tricoteuses (parliamentary database) that return meaningful results immediately
16
+ - A visualization or transformation cell that the participant can iterate on
17
+ - A closing "your turn" note inviting them to modify, run, and share
18
+
19
+ This recipe is a **specialization** of the generic `notebook-playbook` recipe — pre-filled with parliamentary-specific seed cells and tailored to the hackathon narrative.
20
+
21
+ ## How to use
22
+
23
+ ### Step 1 — Pick the document layout
24
+
25
+ Default to `notebook-document` for the hackathon. Reasons:
26
+ - Participants expect to collaborate and leave traces for each other (avatars, comments)
27
+ - The document layout reads naturally as "hackathon brief + starter code" rather than "dev tool"
28
+ - Margin comments can be seeded to hint at directions to explore
29
+
30
+ If the participant asks for a minimal dev-focused playground instead, fall back to `notebook-compact`.
31
+
32
+ ### Step 2 — Seed the cells
33
+
34
+ The notebook should contain 5–7 cells covering:
35
+
36
+ 1. **Intro markdown** — title, one-line context of the hackathon, link to relevant docs
37
+ 2. **Challenge markdown** — a few axes of exploration suggested by the hackathon organizers (replace placeholders with actual challenges when known)
38
+ 3. **Starter SQL** — a safe, visibly meaningful query on Tricoteuses (e.g. recent votes, most active deputies, amendments on a specific text)
39
+ 4. **Transform JS** — a small JS cell that post-processes the SQL result (grouping, counting, chart prep)
40
+ 5. **Visualization hint** — a markdown cell pointing at available visualization widgets (`hemicycle`, `profile`, `timeline`)
41
+ 6. **Your turn** — a closing markdown inviting the participant to fork and edit
42
+
43
+ Example template (to be refined with actual hackathon organizers' briefs):
44
+
45
+ ```
46
+ widget_display({name: "notebook-document", params: {
47
+ title: "Hackathon Assemblée Nationale · starter",
48
+ cells: [
49
+ {
50
+ type: "md",
51
+ content: "### Bienvenue au hackathon IA de l'Assemblée Nationale\n\nCe notebook est votre point de départ. Les données parlementaires proviennent du serveur <mark>Tricoteuses</mark>. Forkez, éditez, partagez."
52
+ },
53
+ {
54
+ type: "md",
55
+ content: "### Pistes d'exploration\n\n- Profil d'un parlementaire et son activité\n- Cartographie des votes par groupe politique\n- Amendements sur un texte précis\n- Enrichissement Wikipedia des parlementaires\n- Croisement entre circonscription et données externes"
56
+ },
57
+ {
58
+ type: "sql",
59
+ content: "-- 10 scrutins les plus récents\nSELECT id, date, intitule, pour, contre, abstention\nFROM scrutins\nORDER BY date DESC\nLIMIT 10",
60
+ comment: {
61
+ who: "organizers",
62
+ when: "start",
63
+ body: "Remplacez par une requête sur un texte qui vous intéresse (LIMIT important)."
64
+ }
65
+ },
66
+ {
67
+ type: "js",
68
+ content: "// Regroupe les scrutins par mois\nconst byMonth = {};\nfor (const s of rows) {\n const m = s.date.slice(0, 7);\n byMonth[m] = (byMonth[m] || 0) + 1;\n}\nconsole.table(byMonth);"
69
+ },
70
+ {
71
+ type: "md",
72
+ content: "### Visualiser\n\nPour afficher un profil parlementaire : `widget_display({name: \"profile\", params: {...}})`.\nPour un hémicycle : `widget_display({name: \"hemicycle\", params: {groups, result}})`.\nPour une timeline de mandats : `widget_display({name: \"timeline\", params: {events}})`."
73
+ },
74
+ {
75
+ type: "md",
76
+ content: "### À vous\n\nAjoutez des cellules avec `+ sql / + code`, réarrangez, exécutez. Quand vous avez quelque chose d'intéressant, cliquez `share` pour partager le lien hyperskill avec votre équipe ou les organisateurs."
77
+ }
78
+ ]
79
+ }})
80
+ ```
81
+
82
+ ### Step 3 — Adapt to what the user knows
83
+
84
+ - If the user has no background in the Tricoteuses schema, mention they can use `list_tables` and `describe_table` on the Tricoteuses server to discover the data model before writing queries.
85
+ - If the user already has a specific question ("I want to look at votes on the 2024 budget"), rewrite the starter SQL to target that question directly.
86
+ - If the user asks for a minimal playground without the hackathon framing, fall back to the generic `notebook-playbook` recipe instead.
87
+
88
+ ### Step 4 — Share
89
+
90
+ After creating the notebook, remind the user that they can:
91
+ - Use `share` → `Hyperskill link` to generate a fork-friendly URL to paste into their team's channel
92
+ - Switch to `view` mode when demoing to organizers
93
+ - Consult `⟲ history` to see their iteration trace and restore cells deleted by mistake
94
+
95
+ ## Notes
96
+
97
+ This recipe is intended as a **starting skeleton** — the concrete hackathon brief (dates, prizes, specific challenges, dataset access restrictions) will be refined in a dedicated session with the organizers. Placeholders in the example above (axes of exploration, comments) should be replaced with the actual material provided by the hackathon team when it is available.
98
+
99
+ For parliamentary profile pages, vote results with hemicycles, and legislative file browsing, prefer the dedicated recipes:
100
+ - `display-parliamentary-profile-with-hemicycle-and-votes`
101
+ - `explorer-dossiers-legislatifs-parcours-texte`
102
+ - `rechercher-textes-juridiques-legifrance`
103
+
104
+ These recipes produce more specialized layouts than a generic notebook, and are better suited when the output is a single focused page rather than a multi-cell playbook.
105
+
106
+ ## Common mistakes
107
+
108
+ - **Forgetting the hackathon framing**: without the "bienvenue" and "à vous" markdown cells, participants land on a bare notebook and lose the playbook feeling.
109
+ - **SQL without LIMIT**: Tricoteuses queries without `LIMIT` can return thousands of rows and slow down the first impression.
110
+ - **Inventing data**: do not seed with fake French parliamentary content (fake deputies, fake votes). If the actual data is not known at seed time, use generic queries (`SELECT * FROM scrutins LIMIT 5`) and let the user discover from there.
111
+ - **Picking the wrong layout**: if the user is solo and wants to code fast, `notebook-compact` is better than `notebook-document`. Default to document for hackathon context because of the collaborative framing, not as a hard rule.
@@ -0,0 +1,193 @@
1
+ ---
2
+ id: create-interactive-notebook-playbook
3
+ name: Create an interactive notebook playbook
4
+ components_used: [notebook-compact, notebook-workspace, notebook-document, notebook-editorial]
5
+ when: the user wants to experiment with data, prototype a small analysis, share a reusable scenario, or prepare a hackathon-ready playground. Keywords include "playground", "playbook", "experiment", "try", "prototype", "hackathon", "share a notebook", "template", "starter", "publish".
6
+ servers: [autoui]
7
+ layout:
8
+ type: single
9
+ ---
10
+
11
+ ## When to use
12
+
13
+ The user asks for a **notebook-like interactive playground** that combines text, queries, and code cells. Typical triggers:
14
+ - "Give me a playground for exploring X"
15
+ - "Prepare a notebook I can share with my team"
16
+ - "I want to prototype a small analysis"
17
+ - "Set up a hackathon starter"
18
+ - "Make a reusable template for exploring CSVs / this API / these tables"
19
+ - "Publish this analysis as a short memo"
20
+
21
+ This recipe applies across domains (parliamentary data, biodiversity, news, business datasets, etc.) — it only prescribes the **shape** of the answer, not its content.
22
+
23
+ ## How to use
24
+
25
+ ### Step 1 — Pick the right notebook layout
26
+
27
+ Choose one of the four `notebook-*` widgets based on the user's implicit intent:
28
+
29
+ | Layout | Use when |
30
+ |---|---|
31
+ | `notebook-compact` | Quick data exploration, reactive dataflow with named outputs, minimal chrome. **Default for most "playground" and "hackathon" requests.** |
32
+ | `notebook-workspace` | The user expects a multi-cell analyst workspace with sources, cell navigation, `run all`, and a `publish` step. Use when they mention "dashboard", "app", "workspace", "publish". |
33
+ | `notebook-document` | The user plans to share and discuss with a team. Use when "collaborate", "review", "comment", "reply" appear. |
34
+ | `notebook-editorial` | The user wants a polished, article-like final deliverable mixing prose and code. Use for "memo", "report", "writeup", "blog-style". |
35
+
36
+ When in doubt, pick `notebook-compact`.
37
+
38
+ ### Step 2 — Pre-fill the cells with context-aware seeds
39
+
40
+ Never create an empty notebook. Always seed with 3–5 cells that give the user an immediate starting point:
41
+
42
+ 1. **First cell: markdown** — title + one-sentence context of what the notebook is for
43
+ 2. **Second cell: markdown or code** — if an MCP data source is connected, a starter query that returns something visible (e.g. `SELECT * FROM {table} LIMIT 10`). Otherwise a markdown cell describing the next step
44
+ 3. **Third cell: code** — a transformation or a visualization that uses the output of step 2. Use `varname` on the SQL cell (`varname: "rows"`) and reference it in the JS cell — this activates the **reactive dataflow** (the downstream JS cell is flagged stale automatically when its upstream re-runs)
45
+ 4. **Last cell: markdown** — a short "to you to play" note inviting the user to add cells or edit
46
+
47
+ Example seed for a generic data playground:
48
+
49
+ ```
50
+ widget_display({name: "notebook-compact", params: {
51
+ title: "Exploration playground",
52
+ cells: [
53
+ {type: "md", content: "### Exploration playground\n\nStart by running the first SQL cell, then iterate."},
54
+ {type: "sql", content: "select * from source limit 10", varname: "rows"},
55
+ {type: "js", content: "// explore rows here\nconsole.table(rows)"},
56
+ {type: "md", content: "### Your turn\n\nAdd cells with `+ sql` or `+ js`, reorder via the drag handle, and share via the header button."}
57
+ ]
58
+ }})
59
+ ```
60
+
61
+ ### Step 3 — Adapt seeds to the connected MCP server
62
+
63
+ If a specific MCP server is connected, replace the generic `source` and `select *` placeholders with actual tables and queries from that server:
64
+ - For a parliamentary server (Tricoteuses): use actual tables like `acteurs`, `scrutins`, `amendements` with meaningful LIMIT
65
+ - For a biodiversity server (iNaturalist): use the server's typical queries to return observations
66
+ - For a generic SQL server: list tables first (`list_tables` or `describe_table`), then seed with a `SELECT * FROM {first_table} LIMIT 10`
67
+
68
+ Always keep queries **short** and **limited** so the first run returns quickly and visually.
69
+
70
+ SQL cells are dispatched automatically to the server's `*_query_sql` tool (first match). JS cells run in a Web Worker with upstream named outputs injected as scope.
71
+
72
+ ### Step 4 — Exporting & publishing
73
+
74
+ All four notebook layouts share the same `share` button in the toolbar, offering **four export formats**:
75
+
76
+ | Format | What it does |
77
+ |---|---|
78
+ | **Hyperskill link** | Copies both the canonical Hyperskill URL and a short domain-scoped URL (`?n=<token>`). The short URL opens the read-only public viewer at `nb.hyperskills.net`. |
79
+ | **Markdown** | Downloads a `.md` file containing the notebook content. |
80
+ | **PNG** | Snapshots the rendered notebook to an image. |
81
+ | **JSON** | Exports the full widget state — re-importable for programmatic reuse. |
82
+
83
+ **Layout-specific share affordances:**
84
+ - `notebook-workspace` has a dedicated `publish` button (primary, accent-coloured) that flips `mode: 'view'`, tags the notebook `published` (from `draft`), and copies the Hyperskill link in one gesture. Use this when the user wants a clean hand-off.
85
+ - `notebook-document` shows a single `share` link (live invite/collaboration is not available in this build; presence avatars only render when the `presence` param is explicitly provided).
86
+
87
+ ### Step 5 — Working with connected data servers
88
+
89
+ When one or more MCP data servers are connected, every notebook layout exposes a **collapsible left pane** (bookmark-bar styling, collapsed by default) that lists:
90
+ - **Recipes** published by each server (`{server}_list_recipes()`)
91
+ - **Tools / tables** exposed by each server (`{server}_list_tools()`)
92
+
93
+ Clicking any recipe opens a viewer modal. Each fenced code block inside the recipe has a `↳ inject` button that drops the snippet into the notebook as a new cell — the user never has to copy-paste.
94
+
95
+ Two toolbar buttons flank the left pane on every layout:
96
+ - **`+ md`** — 3-tab modal (New / File / URL) to create a markdown cell from scratch, from a local `.md` file, or from a URL
97
+ - **`+ recipe`** — 3-tab modal (Browser / File / URL) to import a recipe from a connected server, a local `.recipe.md` file, or a URL
98
+
99
+ Pass the server metadata via the `servers:` param so these affordances populate correctly:
100
+
101
+ ```ts
102
+ widget_display({
103
+ name: 'notebook-compact',
104
+ params: {
105
+ title: '...',
106
+ cells: [...],
107
+ servers: [{ name: 'tricoteuses', url: 'https://...', kind: 'data' }]
108
+ }
109
+ })
110
+ ```
111
+
112
+ **Filter rule**: only MCP *data* servers (`kind: 'data'`) belong in `servers:`. Do NOT include WebMCP UI servers such as `autoui` — they expose no queryable data.
113
+
114
+ ### Step 6 — Hand-off guidance
115
+
116
+ After creating the notebook, mention to the user that they can:
117
+ - **Share in four formats** via the toolbar `share` button (Hyperskill / Markdown / PNG / JSON)
118
+ - **Switch to `view` mode** (read-only) when presenting
119
+ - Use **`run all`** (workspace) or **`publish`** (workspace) for one-shot execution and publication
120
+ - **Reply** to margin comments in a document layout (`+ reply` under each comment)
121
+ - Access the `⟲ history` panel to see the edit trace and restore deleted cells
122
+ - **Import recipes** from connected MCP servers via the left pane or the `+ recipe` modal
123
+
124
+ For hackathon contexts, prefer seeding a `notebook-document` layout so participants can leave margin comments and replies on cells (presence stays opt-in — pass a `presence` array only if you have real editors to show).
125
+
126
+ ## Examples
127
+
128
+ ### Generic CSV / table playground
129
+ ```
130
+ // user: "I need a playground to play with this CSV"
131
+ widget_display({name: "notebook-compact", params: {
132
+ title: "CSV playground",
133
+ cells: [
134
+ {type: "md", content: "### CSV playground\n\nRun the SQL cell to see the first rows, then iterate."},
135
+ {type: "sql", content: "select * from source limit 20", varname: "rows"},
136
+ {type: "js", content: "// summarize, chart, or filter rows here\nconsole.table(rows)"}
137
+ ]
138
+ }})
139
+ ```
140
+
141
+ ### Publishable analyst workspace
142
+ ```
143
+ // user: "Set up an analysis I can publish to the team as an app"
144
+ widget_display({name: "notebook-workspace", params: {
145
+ title: "Sales review",
146
+ cells: [
147
+ {type: "md", name: "intro", content: "What this analysis covers."},
148
+ {type: "sql", name: "fetch_sales", content: "select * from sales limit 100"},
149
+ {type: "js", name: "plot", content: "// chart the rows"}
150
+ ]
151
+ }})
152
+ // Then tell the user: click `run all` to execute, then `publish` to flip to view mode and copy the Hyperskill link.
153
+ ```
154
+
155
+ ### Collaborative analysis with comments
156
+ ```
157
+ // user: "Set up a notebook my team can edit and comment on"
158
+ widget_display({name: "notebook-document", params: {
159
+ title: "Team analysis",
160
+ cells: [
161
+ {type: "md", content: "Kick-off: describe the question here."},
162
+ {type: "sql", content: "select * from source limit 10", comment: {who: "reviewer", when: "2m", body: "Should we filter to last quarter only?"}},
163
+ {type: "md", content: "Your findings: add thoughts, <mark>highlights</mark>, and reply to the comment on the query above."}
164
+ ]
165
+ }})
166
+ ```
167
+
168
+ ### Final memo
169
+ ```
170
+ // user: "Prepare a short memo of my findings"
171
+ widget_display({name: "notebook-editorial", params: {
172
+ title: "Findings memo",
173
+ kicker: "memo",
174
+ cells: [
175
+ {type: "md", content: "Three observations from last week's data."},
176
+ {type: "md", content: "First, the volume is up. Here is the query:"},
177
+ {type: "sql", content: "select count(*) from source"},
178
+ {type: "md", content: "Second, the distribution has shifted."},
179
+ {type: "js", content: "// chart distribution"},
180
+ {type: "md", content: "We conclude that..."}
181
+ ]
182
+ }})
183
+ ```
184
+
185
+ ## Common mistakes
186
+
187
+ - **Empty notebook**: never call `widget_display` without at least 3 seed cells. The user expects something they can immediately run.
188
+ - **Wrong layout for the intent**: do not use `notebook-editorial` for quick exploration — it signals "finished article" and intimidates. Use `notebook-compact` unless the user explicitly asks for a publication feel.
189
+ - **Heavy initial queries**: always `LIMIT 10` or `LIMIT 20` in seed SQL cells. Users will expand later if needed.
190
+ - **Missing `varname` on SQL cells** (in compact layout): the named output is what the compact layout showcases, and it drives the stale-flag dataflow. Without it, the notebook loses half its reactive story.
191
+ - **Inventing UUIDs**: leave `id` unset — the widget generates a sensible default. Only pass `id` when restoring an existing notebook.
192
+ - **Faking presence**: do not pass a `presence` array to `notebook-document` unless there are real editors to show. Presence is opt-in by design — empty `presence` hides the avatar row entirely.
193
+ - **Including `autoui` in `servers:`**: only MCP *data* servers (`kind: 'data'`) belong there. UI servers like `autoui` would pollute the left pane.