feat(mi): make MI aware of all 48 canvas shape types

- Expand MI system prompt "Available shape types" from 20 → 48 shapes,
  organized by category (Core, AI, Creative, Social, Decisions, Travel,
  Tokens, Geo, Video)
- Expand Shape Mapping Rules from 12 → 30 triage rules covering all
  shape types with prop hints
- Expand KNOWN_TRIAGE_SHAPES from 15 → 48 so Gemini triage no longer
  silently downgrades unknown shapes to folk-markdown
- Add 22 missing TOOL_HINTS to mi-tool-schema.ts (travel, tokens, CAD,
  creative, geo, meta shapes) for keyword-based chip suggestions
- Add all 48 shapes to SHAPE_ICONS in mi-triage-panel.ts (was 13)
- Register folk-image-studio and folk-transaction-builder in canvas.html
  (were ghost shapes — imported but never defined/registered)
- Add SHAPE_DEFAULTS for folk-social-thread/campaign/newsletter,
  folk-design-agent, folk-image-studio

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-28 16:45:11 -07:00
parent abc855f34e
commit 5852b91f4c
4 changed files with 138 additions and 15 deletions

View File

@ -41,6 +41,33 @@ const TOOL_HINTS: ToolHint[] = [
{ tagName: "folk-choice-rank", label: "Ranking", icon: "📊", keywords: ["rank", "order", "priority", "sort"] },
{ tagName: "folk-choice-spider", label: "Spider Chart", icon: "🕸️", keywords: ["spider", "radar", "criteria", "evaluate"] },
{ tagName: "folk-spider-3d", label: "3D Spider", icon: "📊", keywords: ["spider", "radar", "3d", "overlap", "membrane", "governance", "permeability"] },
{ tagName: "folk-choice-conviction", label: "Conviction Vote", icon: "🔥", keywords: ["conviction", "stake", "weight", "governance", "token vote"] },
// Travel
{ tagName: "folk-itinerary", label: "Itinerary", icon: "🗓️", keywords: ["itinerary", "trip", "travel", "plan", "schedule"] },
{ tagName: "folk-destination", label: "Destination", icon: "📍", keywords: ["destination", "city", "place", "travel", "visit"] },
{ tagName: "folk-booking", label: "Booking", icon: "🎫", keywords: ["booking", "reservation", "flight", "hotel", "transport"] },
{ tagName: "folk-budget", label: "Budget", icon: "💰", keywords: ["budget", "expense", "cost", "money", "spending"] },
{ tagName: "folk-packing-list", label: "Packing List", icon: "🎒", keywords: ["packing", "list", "luggage", "gear", "pack"] },
// Tokens
{ tagName: "folk-token-mint", label: "Token Mint", icon: "🪙", keywords: ["token", "mint", "create token", "currency", "coin"] },
{ tagName: "folk-token-ledger", label: "Token Ledger", icon: "📒", keywords: ["ledger", "balance", "token", "transactions", "holdings"] },
{ tagName: "folk-transaction-builder", label: "Transaction", icon: "💸", keywords: ["transaction", "transfer", "send", "multisig", "safe"] },
// Creative / CAD
{ tagName: "folk-blender", label: "3D Scene", icon: "🎲", keywords: ["blender", "3d", "render", "scene", "model"] },
{ tagName: "folk-freecad", label: "CAD Part", icon: "🔧", keywords: ["cad", "freecad", "part", "mechanical", "parametric"] },
{ tagName: "folk-kicad", label: "PCB Design", icon: "🔌", keywords: ["pcb", "kicad", "circuit", "schematic", "electronics"] },
{ tagName: "folk-design-agent", label: "Print Design", icon: "🖨️", keywords: ["design", "poster", "flyer", "brochure", "print", "layout", "scribus"] },
// Zine
{ tagName: "folk-zine-gen", label: "Zine", icon: "📰", keywords: ["zine", "magazine", "publication", "pamphlet", "print"] },
// Geo
{ tagName: "folk-holon", label: "Holon", icon: "🌐", keywords: ["holon", "h3", "hexagon", "geospatial", "region"] },
{ tagName: "folk-holon-browser", label: "Holon Browser", icon: "🌍", keywords: ["holon", "browse", "explore", "territory", "map"] },
// Meta
{ tagName: "folk-canvas", label: "Nested Canvas", icon: "🔲", keywords: ["canvas", "nested", "subspace", "embed canvas"] },
{ tagName: "folk-wrapper", label: "Wrapper", icon: "📦", keywords: ["wrapper", "container", "group", "frame"] },
{ tagName: "folk-image", label: "Image", icon: "🖼️", keywords: ["image", "photo", "picture", "png", "jpg"] },
{ tagName: "folk-bookmark", label: "Bookmark", icon: "🔖", keywords: ["bookmark", "link", "save", "reference"] },
{ tagName: "folk-obs-note", label: "Obsidian Note", icon: "📓", keywords: ["obsidian", "note", "vault", "knowledge"] },
// Module content hints (these create content in rApps, not canvas shapes)
{ tagName: "rcal-event", label: "Calendar Event", icon: "📅", keywords: ["event", "meeting", "schedule", "standup", "appointment"], moduleAction: { module: "rcal", contentType: "event" } },
{ tagName: "rtasks-task", label: "Task", icon: "✅", keywords: ["task", "todo", "assign", "deadline", "backlog"], moduleAction: { module: "rtasks", contentType: "task" } },

View File

@ -10,19 +10,62 @@ import type { TriageManager } from "./mi-content-triage";
/** Icon lookup by tagName — matches TOOL_HINTS from mi-tool-schema.ts */
const SHAPE_ICONS: Record<string, { icon: string; label: string }> = {
// Core
"folk-markdown": { icon: "📝", label: "Note" },
"folk-wrapper": { icon: "📦", label: "Wrapper" },
"folk-embed": { icon: "🔗", label: "Embed" },
"folk-calendar": { icon: "📅", label: "Calendar" },
"folk-map": { icon: "🗺️", label: "Map" },
"folk-image": { icon: "🖼️", label: "Image" },
"folk-bookmark": { icon: "🔖", label: "Bookmark" },
"folk-slide": { icon: "🖼️", label: "Slide" },
"folk-chat": { icon: "💬", label: "Chat" },
"folk-piano": { icon: "🎹", label: "Piano" },
"folk-canvas": { icon: "🔲", label: "Canvas" },
"folk-rapp": { icon: "📦", label: "rApp" },
"folk-feed": { icon: "📡", label: "Feed" },
"folk-obs-note": { icon: "📓", label: "Obsidian" },
"folk-workflow-block": { icon: "⚙️", label: "Workflow" },
"folk-google-item": { icon: "🔍", label: "Google" },
// AI
"folk-prompt": { icon: "🤖", label: "AI Chat" },
"folk-image-gen": { icon: "🎨", label: "AI Image" },
"folk-image-studio": { icon: "🖌️", label: "Studio" },
"folk-video-gen": { icon: "🎬", label: "AI Video" },
"folk-zine-gen": { icon: "📰", label: "Zine" },
"folk-transcription": { icon: "🎙️", label: "Transcribe" },
// Creative
"folk-splat": { icon: "💎", label: "3D Splat" },
"folk-drawfast": { icon: "✏️", label: "Drawing" },
"folk-blender": { icon: "🎲", label: "3D Scene" },
"folk-freecad": { icon: "🔧", label: "CAD" },
"folk-kicad": { icon: "🔌", label: "PCB" },
"folk-design-agent": { icon: "🖨️", label: "Design" },
// Social
"folk-social-post": { icon: "📣", label: "Social Post" },
"folk-social-thread": { icon: "🧵", label: "Thread" },
"folk-social-campaign": { icon: "📢", label: "Campaign" },
"folk-social-newsletter": { icon: "📧", label: "Newsletter" },
// Decisions
"folk-choice-vote": { icon: "🗳️", label: "Vote" },
"folk-prompt": { icon: "🤖", label: "AI Chat" },
"folk-image-gen": { icon: "🎨", label: "AI Image" },
"folk-slide": { icon: "🖼️", label: "Slide" },
"folk-choice-rank": { icon: "📊", label: "Ranking" },
"folk-choice-spider": { icon: "🕸️", label: "Spider" },
"folk-choice-conviction": { icon: "🔥", label: "Conviction" },
"folk-spider-3d": { icon: "📊", label: "3D Spider" },
// Travel
"folk-itinerary": { icon: "🗓️", label: "Itinerary" },
"folk-destination": { icon: "📍", label: "Destination" },
"folk-booking": { icon: "🎫", label: "Booking" },
"folk-budget": { icon: "💰", label: "Budget" },
"folk-packing-list": { icon: "🎒", label: "Packing" },
// Tokens
"folk-token-mint": { icon: "🪙", label: "Token Mint" },
"folk-token-ledger": { icon: "📒", label: "Ledger" },
"folk-transaction-builder": { icon: "💸", label: "Transaction" },
// Geo
"folk-calendar": { icon: "📅", label: "Calendar" },
"folk-map": { icon: "🗺️", label: "Map" },
"folk-holon": { icon: "🌐", label: "Holon" },
"folk-holon-browser": { icon: "🌍", label: "Holons" },
"folk-video-chat": { icon: "📹", label: "Video Call" },
};
export class MiTriagePanel {

View File

@ -233,10 +233,17 @@ include action markers in your response. Each marker is on its own line:
[MI_ACTION:{"type":"navigate","path":"/myspace/rspace"}]
Use "$1", "$2", etc. as ref values when creating shapes, then reference them in subsequent connect actions.
Available shape types: folk-markdown, folk-wrapper, folk-image-gen, folk-video-gen, folk-prompt,
folk-embed, folk-calendar, folk-map, folk-chat, folk-slide, folk-obs-note, folk-workflow-block,
folk-social-post, folk-social-thread, folk-social-campaign, folk-social-newsletter,
folk-splat, folk-drawfast, folk-rapp, folk-feed.
Available shape types (grouped by category):
Core: folk-markdown, folk-wrapper, folk-embed, folk-image, folk-bookmark, folk-slide, folk-chat, folk-piano, folk-canvas, folk-rapp, folk-feed, folk-obs-note, folk-workflow-block, folk-google-item.
AI: folk-prompt, folk-image-gen, folk-image-studio, folk-video-gen, folk-zine-gen, folk-transcription.
Creative: folk-splat, folk-drawfast, folk-blender, folk-freecad, folk-kicad, folk-design-agent.
Social: folk-social-post, folk-social-thread, folk-social-campaign, folk-social-newsletter.
Decisions: folk-choice-vote, folk-choice-rank, folk-choice-spider, folk-choice-conviction, folk-spider-3d.
Travel: folk-itinerary, folk-destination, folk-booking, folk-budget, folk-packing-list.
Tokens: folk-token-mint, folk-token-ledger, folk-transaction-builder.
Geo: folk-holon, folk-holon-browser, folk-map, folk-calendar.
Video: folk-video-chat.
## Transforms
When the user asks to align, distribute, or arrange selected shapes:
@ -324,6 +331,25 @@ analyze it and classify each distinct piece into the most appropriate canvas sha
- Marketing campaigns / content plans folk-social-campaign (set title, description, platforms props)
- Newsletters / email campaigns folk-social-newsletter (set subject, listName props)
- Decisions / polls / questions for voting folk-choice-vote (set question prop)
- Ranked choices / priority lists folk-choice-rank (set question prop)
- Multi-criteria evaluation folk-choice-spider (set question prop)
- Travel destinations folk-destination (set destName, country props)
- Trip itineraries folk-itinerary (set tripTitle, itemsJson props)
- Bookings / reservations folk-booking (set bookingType, provider props)
- Budget / expenses folk-budget (set budgetTotal props)
- 3D models / scenes folk-splat or folk-blender (set src prop)
- Circuit / PCB design folk-kicad (set brief prop)
- CAD / 3D parts folk-freecad (set brief prop)
- Print / layout design folk-design-agent (set brief prop)
- AI chat / assistant folk-prompt (start a conversation)
- Image generation requests folk-image-gen (set prompt prop)
- Video generation requests folk-video-gen (set prompt prop)
- Zine / publication content folk-zine-gen (set prompt prop)
- Audio / transcription folk-transcription
- Data feeds from modules folk-feed (set sourceModule, feedId props)
- Embed another rApp folk-rapp (set moduleId prop)
- Token minting folk-token-mint (set tokenName, symbol props)
- Token ledger / balances folk-token-ledger (set tokenId prop)
- Everything else (prose, notes, transcripts, summaries) folk-markdown (set content prop in markdown format)
## Output Format
@ -342,11 +368,28 @@ Return a JSON object with:
- If the content is too short or trivial for multiple shapes, still return at least one shape`;
const KNOWN_TRIAGE_SHAPES = new Set([
"folk-markdown", "folk-embed", "folk-image", "folk-bookmark",
"folk-calendar", "folk-map",
"folk-workflow-block", "folk-social-post", "folk-social-thread",
"folk-social-campaign", "folk-social-newsletter", "folk-choice-vote",
"folk-prompt", "folk-image-gen", "folk-slide",
// Core
"folk-markdown", "folk-wrapper", "folk-embed", "folk-image", "folk-bookmark",
"folk-slide", "folk-chat", "folk-piano", "folk-canvas", "folk-rapp", "folk-feed",
"folk-obs-note", "folk-workflow-block", "folk-google-item",
// AI
"folk-prompt", "folk-image-gen", "folk-image-studio", "folk-video-gen",
"folk-zine-gen", "folk-transcription",
// Creative
"folk-splat", "folk-drawfast", "folk-blender", "folk-freecad", "folk-kicad",
"folk-design-agent",
// Social
"folk-social-post", "folk-social-thread", "folk-social-campaign", "folk-social-newsletter",
// Decisions
"folk-choice-vote", "folk-choice-rank", "folk-choice-spider",
"folk-choice-conviction", "folk-spider-3d",
// Travel
"folk-itinerary", "folk-destination", "folk-booking", "folk-budget", "folk-packing-list",
// Tokens
"folk-token-mint", "folk-token-ledger", "folk-transaction-builder",
// Geo & Video
"folk-map", "folk-calendar", "folk-video-chat",
"folk-holon", "folk-holon-browser",
]);
function sanitizeTriageResponse(raw: any): { shapes: any[]; connections: any[]; summary: string } {

View File

@ -2433,6 +2433,7 @@
FolkCalendar,
FolkMap,
FolkImageGen,
FolkImageStudio,
FolkVideoGen,
FolkPrompt,
FolkZineGen,
@ -2682,6 +2683,7 @@
FolkCalendar.define();
FolkMap.define();
FolkImageGen.define();
FolkImageStudio.define();
FolkVideoGen.define();
FolkPrompt.define();
FolkTranscription.define();
@ -2695,6 +2697,7 @@
FolkBooking.define();
FolkTokenMint.define();
FolkTokenLedger.define();
FolkTransactionBuilder.define();
FolkChoiceVote.define();
FolkChoiceRank.define();
FolkChoiceSpider.define();
@ -2731,6 +2734,7 @@
shapeRegistry.register("folk-calendar", FolkCalendar);
shapeRegistry.register("folk-map", FolkMap);
shapeRegistry.register("folk-image-gen", FolkImageGen);
shapeRegistry.register("folk-image-studio", FolkImageStudio);
shapeRegistry.register("folk-video-gen", FolkVideoGen);
shapeRegistry.register("folk-prompt", FolkPrompt);
shapeRegistry.register("folk-zine-gen", FolkZineGen);
@ -2745,6 +2749,7 @@
shapeRegistry.register("folk-booking", FolkBooking);
shapeRegistry.register("folk-token-mint", FolkTokenMint);
shapeRegistry.register("folk-token-ledger", FolkTokenLedger);
shapeRegistry.register("folk-transaction-builder", FolkTransactionBuilder);
shapeRegistry.register("folk-choice-vote", FolkChoiceVote);
shapeRegistry.register("folk-choice-rank", FolkChoiceRank);
shapeRegistry.register("folk-choice-spider", FolkChoiceSpider);
@ -3937,7 +3942,12 @@ Use real coordinates, YYYY-MM-DD dates, ISO currency codes. Ask clarifying quest
"folk-choice-spider": { width: 440, height: 540 },
"folk-spider-3d": { width: 440, height: 480 },
"folk-choice-conviction": { width: 380, height: 480 },
"folk-social-post": { width: 300, height: 380 },
"folk-social-post": { width: 300, height: 380 },
"folk-social-thread": { width: 280, height: 320 },
"folk-social-campaign": { width: 300, height: 380 },
"folk-social-newsletter": { width: 280, height: 300 },
"folk-design-agent": { width: 450, height: 550 },
"folk-image-studio": { width: 420, height: 520 },
"folk-multisig-email": { width: 400, height: 380 },
"folk-splat": { width: 480, height: 420 },
"folk-blender": { width: 420, height: 520 },