v1.11.0 β AI hooks: describe β shape / patch π€
AI hooks β "describe β shape / patch." KMPMedia's vector primitives are just data, so a language model can produce them. New com.solidkey.painpoints.ai.OGAiVector is a provider-agnostic JSON interop layer: it hands a model the exact contract and turns the reply back into a live clip shape or SVG patch.
polygonPrompt(instruction)/svgPatchPrompt(instruction, nodeIds)β build a prompt stating the JSON schema.decodePolygon/decodeSvgPatch(+β¦OrNull) β a model's reply βOGPolygonShapeforclipShape, orMap<String, OGSvgNodeOverride>forOGSVGView(overrides = β¦). Tolerant of the ```json fences + prose models add.encodePolygon/encodeSvgPatchβ serialize the other way (persist a lasso, seed a prompt).OGPolygonSpec/OGNodeOverrideSpec/OGSvgPatchSpecβ@SerializableDTOs.
No network calls and no AI SDK in the library β it defines the contract and does the JSON; you own the model and the call. Purely additive (new package), zero-dependency beyond the serialization family already in use. Colors reuse the SVG color parser (#RGB/#RRGGBB/#AARRGGBB/rgb()/name). All work happens at generate/patch time, never per frame. 12 tests green on JVM + iOS.
First shipped piece of Bet 1 β Runtime & AI-editable vector's "AI hooks" item. See docs/AI_HOOKS.md.
implementation("se.solidkey:kmpmedia-lib:1.11.0")