migrate-waniwani-sdk-0.18-to-0.19
Skill18 starsChanged 8 days agoMITView on GitHub
Migrate a project from @waniwani/sdk 0.18.x to 0.19.x (first published: 0.19.1) and auto-apply its breaking change: suggestion.clicked (WidgetEvent / WidgetEventDetail from @waniwani/sdk/chat) gained a required properties.origin field (channel | page | flow | followup). Reading events through onEvent needs no changes; only code constructing a suggestion.clicked event literal must add origin. Also covers the SuggestionsConfig.dynamic deprecation (use origins) and how to opt in to flow-driven suggestion pills. Trigger when the user is on @waniwani/sdk 0.18.x and wants to move to 0.19, asks to migrate to 0.19, or hits type errors on suggestion.clicked literals after bumping @waniwani/sdk.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-browserSkill
- copySkill
- deploy-prodSkill
- linear-oneshotSkill
- project-planningSkill
- project-updateSkill
- pull-requestSkill
- wani-code-reviewSkill
- create-flow-appSkill
- frontend-designSkill
- knowledge-baseSkill
- release-migrationSkill
- transfer-to-kitSkill
- translationsSkill
- visualize-flowSkill
- audit-trackingSkill
- instrument-trackingSkill
- migrate-waniwani-sdk-0.15-to-0.16Skill
- migrate-waniwani-sdk-0.16-to-0.17Skill
- migrate-waniwani-sdk-0.17-to-0.18Skill
- migrate-waniwani-sdk-0.19-to-0.20Skill
- migrate-waniwani-sdk-0.22-to-0.23Skill
- migrate-waniwani-sdk-0.23-to-0.24Skill
- migrate-waniwani-sdk-0.24-to-0.25Skill
- migrate-waniwani-sdk-0.25-to-1.0Skill
- waniwani-sdkSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Collect the call sites: Run the type checker and/or grep:
- Very specific: line 41
Only *constructions* of the event literal need changes (test fixtures, custom adapters).
- Very specific: line 75
Only on the <ChatEmbed> primitive's suggestions prop:
- Very specific: line 91
Not a migration, but the reason to upgrade.
- Very specific: line 106
Adding
sourceinstead oforigin: No published version ever had a source field.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migrate @waniwani/sdk 0.18 → 0.19
A self-contained migration for the single hop from 0.18.x to 0.19.x (the first published 0.19 release is 0.19.1; 0.19.0 was never published to npm). Apply it when a project on 0.18 is moving to 0.19. It covers only that jump; for other version boundaries use the matching migrate-waniwani-sdk-<from>-to-<to> skill, or the general procedure in the SDK's changelog.
Precondition: the project is on @waniwani/sdk@0.18.x. If it is on an older version, migrate up to 0.18 first (each jump ships its own migration skill); if it is already on 0.19+, there is nothing to do here.
What 0.19 changes
Flow interrupt({ suggestions }) values now also render as clickable pills above the input in the Waniwani chat widget, gated by a named origin list. Almost all of it is additive; the one break:
suggestion.clickedgained a requiredproperties.originfield —"channel" | "page" | "flow" | "followup", reporting which provider supplied the clicked pill. On 0.18.x the payload was{ text, index }. The field is part ofWidgetEventDetail/WidgetEventfrom@waniwani/sdk/chat.
Also shipped (no action required):
SuggestionsConfig.origins(SuggestionOrigin[]) replaces thedynamicboolean on the<ChatEmbed>primitive.dynamicis deprecated but still works:truemaps to every origin,falseto none,originswins when both are set.suggestionOriginson<WaniwaniChat>overrides anddata-suggestion-originson the<script>embed. Default everywhere is["channel", "page", "followup"]— flow-driven pills stay opt-in.- Flow tool results always carry
_meta["waniwani/suggestions"](exported asSUGGESTIONS_META_KEY/SuggestionsMeta). Additive; hosts that ignore_metaare unaffected.
Not affected: reading widget events through onEvent — origin is a new, always-populated field, so existing readers keep compiling and running. Other MCP hosts (ChatGPT, Claude) see no behavior change.
This break is visible to tsc: every hand-constructed suggestion.clicked literal typed as WidgetEvent / WidgetEventDetail fails to typecheck after the bump, so the compiler output is the complete call-site list.
Procedure
- Bump the dependency.
bun add @waniwani/sdk@^0.19.1 - Collect the call sites. Run the type checker and/or grep:
Only constructions of the event literal need changes (test fixtures, custom adapters).bun run typecheck rg "suggestion\.clicked"onEventhandlers that readevent.name === "suggestion.clicked"are fine as-is. - Apply rewrite 1 to every construction site.
- Optionally apply rewrite 2 (deprecation, not required to compile).
- Verify — this is the completion check.
bun run typecheck bun test - Report which rewrite each call site took.
Rewrite 1 — add origin to suggestion.clicked literals
// Before
const event: WidgetEvent = {
mode: "inline",
timestamp: Date.now(),
name: "suggestion.clicked",
properties: { text: "Book a demo", index: 0 },
};
// After
const event: WidgetEvent = {
mode: "inline",
timestamp: Date.now(),
name: "suggestion.clicked",
properties: { text: "Book a demo", index: 0, origin: "channel" },
};Pick the value by what the fixture stands in for: "channel" for starter prompts, "page" for per-URL starter prompts, "flow" for a flow-driven pill, "followup" for a generated follow-up. When the fixture doesn't care, use "channel".
Rewrite 2 — dynamic → origins (deprecation, optional)
Only on the <ChatEmbed> primitive's suggestions prop:
// Before
<ChatEmbed suggestions={{ initial: ["Pricing?"], dynamic: true }} />
<ChatEmbed suggestions={{ initial: ["Pricing?"], dynamic: false }} />
// After
<ChatEmbed suggestions={{ initial: ["Pricing?"], origins: ["channel", "page", "flow", "followup"] }} />
<ChatEmbed suggestions={{ initial: ["Pricing?"], origins: [] }} />dynamic keeps working in 0.19 (origins wins when both are set), so this rewrite is opportunistic — apply it when touching the file anyway.
Opt-in — render flow-driven pills
Not a migration, but the reason to upgrade. If your flows declare interrupt({ suggestions }), include "flow" in the host surface's origins to render them as pills:
<WaniwaniChat>:overrides={{ suggestionOrigins: ["channel", "page", "flow", "followup"] }}<script>embed:data-suggestion-origins="channel,page,flow,followup"<ChatEmbed>:suggestions={{ origins: ["flow"] }}
Pills appear only on steps with exactly one open question.
Not covered by a shim
origin is required rather than optional by design: a guaranteed field is better DX for readers (the primary audience) than an optional one every reader would have to narrow. The compiler output in step 2 is the complete migration to-do list.
Common mistakes
- Touching
onEventreaders. They need no changes —originis additive for anyone reading events. Only literal constructions break. - Adding
sourceinstead oforigin. No published version ever had asourcefield; the field isorigin. - Treating
dynamicas removed. It is deprecated, not removed; builds do not require rewrite 2. - Expecting flow pills without opting in. The default origins are
["channel", "page", "followup"]; flow-driven pills render only when"flow"is included on the host surface. - Skipping the verify step. A clean
bun run typecheckplus greenbun testis the definition of done.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

