openassistant: data-ify the assistant tool catalogue
- Commit
850b62046f49183fe3903777729ede84d5fd8cc5- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 20:05 UTC (4 days ago)
- Parents
a887537
The 54 tool specifications were written as nested ToolSpec and p() calls spanning 331 lines, most of it repeated constructor boilerplate around a handful of data values (name, description, risk, and up to six parameters). ASSISTANT_TOOL_SPECS is now built from one data row per tool in a raw string, parsed by three small helpers. A row is name|risk|description|params, with a one-letter risk code and ~-joined name^type^required^description parameter entries; the format and its delimiter limits are documented on the catalogue. ToolSpec, ToolParamSpec and the consumers are unchanged. Behaviour is identical: a standalone extraction of the old catalogue (54 tools, 96 parameters, in order, with every name, description, type, required flag and risk) compares exactly against the same extraction from the new data rows. Measured with tools/structure_check.py lines: 1,648,022 to 1,647,795 total source lines (-227), all of it in this file (337 to 110 lines). The other audited candidates were measured flat and skipped. JNI wrappers: NativeLoader already carries the shared guarded load; the 6 platform/*Native.kt files total 673 lines of inherent external declarations and unlike session shapes, and all 27 *Native.kt files total 4,600 lines dominated by MlNative and MapNative declarations. Search plumbing: 20 ScaffoldSearch call sites, only 9 with local remember state, so a state helper would save roughly two lines at those 9 sites against its own cost while the rest bind ViewModel state. Dialog entries: 50 DialogPage entries in 16 files already share DialogPage(); a dialogEntry wrapper would keep each entry at one line and save only the 16 imports. Translate Languages.kt is already one language per line (202 entries in 268 lines), so a data string would not drop lines there either. Verified: :openassistant:compileDevKotlin, :openassistant:lint and the full :openassistant:testDevUnitTest main suite (206 tests, 0 failures) pass, with the two :library:ml cargo tasks excluded because they fail on the pre-existing Cargo.lock --locked error untouched by this change; the native-quarantine testDevUnitTestNative run shows the one pre-existing failure that follows from that missing .so. The touched file has no ktlint or detekt findings; the module-wide ktlint backlog and the 18 pre-existing detekt issues in other files are unchanged. tools/structure_check.py lines passes.
Diff
openassistant/src/main/java/com/vayunmathur/openassistant/domain/AssistantToolSpecs.kt
diff --git a/openassistant/src/main/java/com/vayunmathur/openassistant/domain/AssistantToolSpecs.kt b/openassistant/src/main/java/com/vayunmathur/openassistant/domain/AssistantToolSpecs.ktindex ce05de174b..152905d8bb 100644--- a/openassistant/src/main/java/com/vayunmathur/openassistant/domain/AssistantToolSpecs.kt+++ b/openassistant/src/main/java/com/vayunmathur/openassistant/domain/AssistantToolSpecs.kt@@ -1,337 +1,110 @@ package com.vayunmathur.openassistant.domain -import com.vayunmathur.openassistant.domain.ToolParamType.NUMBER-import com.vayunmathur.openassistant.domain.ToolParamType.STRING-import com.vayunmathur.openassistant.domain.ToolRisk.HANDOFF_PREP-import com.vayunmathur.openassistant.domain.ToolRisk.WRITE_CONFIRM-import com.vayunmathur.openassistant.domain.ToolRisk.WRITE_LIGHT--private fun p(name: String, type: ToolParamType = STRING, description: String = "", required: Boolean = true) =- ToolParamSpec(name, description, type, required)- /** * Every tool the assistant may call, in snake_case as LiteRT-LM's reflection exposed them, * with the descriptions the old `@Tool`/`@ToolParam` annotations carried.+ *+ * The catalogue is data: one tool per row of [TOOL_DATA], in the order below.+ * Row format: `name|risk|description|params`, where risk is `-` for+ * [ToolRisk.READ], `C` for [ToolRisk.WRITE_CONFIRM], `L` for+ * [ToolRisk.WRITE_LIGHT] and `H` for [ToolRisk.HANDOFF_PREP]. The params+ * field is empty for a tool with no parameters, otherwise it is `~`-joined+ * parameter entries of the form `name^type^required^description`, where+ * type is `S` for [ToolParamType.STRING] or `N` for [ToolParamType.NUMBER],+ * required is `1` or `0`, and the description is the remainder of the entry+ * (it may contain `:` but never `|`, `~` or `^`, exactly as the descriptions+ * in this catalogue do). No field contains a newline. */-val ASSISTANT_TOOL_SPECS: List<ToolSpec> = listOf(- ToolSpec("get_notes", "Get a list of all notes"),- ToolSpec(- "create_note",- "Create a new note in the notes app (requires confirmation). Should only be used with EXPLICIT request by user",- listOf(p("title"), p("content")), risk = WRITE_CONFIRM,- ),- ToolSpec(- "get_todos",- "Get the user's open tasks from the todo app. Due times are epoch milliseconds; " +- "each task has an id usable with complete_todo.",- listOf(p("scope", description = "today (default), upcoming, or all", required = false)),- ),- ToolSpec(- "create_todo",- "Create a task in the todo app (requires confirmation). Should only be used with " +- "EXPLICIT request by user. The title may include words like 'tomorrow 6pm' or " +- "'#tag', which are understood when no due time is given.",- listOf(- p("title"),- p("due", NUMBER, "optional due time as epoch milliseconds", required = false),- p("notes", required = false),- p("priority", NUMBER, "optional priority, 1 (highest) to 4", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec(- "complete_todo",- "Mark a task done (requires confirmation). Should only be used with EXPLICIT request by user.",- listOf(- p("id", description = "task id from get_todos", required = false),- p("title", description = "exact task title, used when no id is given", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec("get_contacts", "Get a list of all contacts"),- ToolSpec(- "create_contact",- "Create a new contact (requires confirmation)",- listOf(p("name"), p("phone_number")),- risk = WRITE_CONFIRM,- ),- ToolSpec(- "get_calendar_events",- "Get a list of calendar events. Each event's start and end times are epoch milliseconds.",- ),- ToolSpec(- "create_calendar_event",- "Create a new calendar event (requires confirmation). Start and end times must be epoch milliseconds.",- listOf(- p("title"),- p("start", NUMBER, "start time as epoch milliseconds"),- p("end", NUMBER, "end time as epoch milliseconds"),- p("location", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec("get_family_locations", "Get a list of family members and their current locations"),- ToolSpec(- "create_location_share_link",- "Create a temporary FindFamily link that shares the user's live location (requires confirmation).",- listOf(- p("name", description = "name or label for who the link is for"),- p("duration_millis", NUMBER, "how long the link stays active, in milliseconds"),- ), risk = WRITE_CONFIRM,- ),- ToolSpec("search_music", "Search for music (songs, albums, artists, or playlists)", listOf(p("query"))),- ToolSpec(- "play_music",- "Play music given its id and type (song, album, artist, or playlist) (requires confirmation)",- listOf(p("id", NUMBER), p("type")), risk = WRITE_CONFIRM,- ),- ToolSpec("search_emails", "Search emails by keyword", listOf(p("query"))),- ToolSpec("get_recent_emails", "Get recent emails from the inbox"),- ToolSpec("get_local_current_date_time", "Get the current date and time in the local timezone."),- ToolSpec("get_app_list", "Get a list of installed apps on the device"),- ToolSpec("open_app", "Open an app given its package id", listOf(p("package_id", description = "package id"))),- ToolSpec("send_message", "Send a message", listOf(p("recipient"), p("message"))),- ToolSpec("make_phone_call", "Make a phone call", listOf(p("recipient"))),- ToolSpec(- "set_alarm",- "Set an alarm in the Clock app at a specific hour and minute (24-hour time) (requires confirmation).",- listOf(- p("hour", NUMBER, "hour in 24-hour format, 0-23"),- p("minute", NUMBER, "minute, 0-59"),- p("label", description = "optional label for the alarm", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec(- "set_timer",- "Start a countdown timer in the Clock app for a number of seconds (requires confirmation).",- listOf(- p("seconds", NUMBER, "timer length in seconds"),- p("label", description = "optional label for the timer", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec(- "set_conversation_title",- "Set title of current conversation. Mandatory for first response",- listOf(p("new_title")),- ),- ToolSpec(- "get_weather",- "Get the current weather conditions at a specific latitude/longitude.",- listOf(p("latitude", NUMBER), p("longitude", NUMBER)),- ),- ToolSpec(- "get_weather_by_name",- "Get the current weather conditions for a named place (city, address, landmark).",- listOf(p("location", description = "city or place name")),- ),- ToolSpec(- "render_ui",- "Render a rich UI card (A2UI) attached to your reply. Prefer this over writing a ```a2ui fence. " +- "components_json is a JSON string: {\"components\":[...]} (or a bare component " +- "array) using the RICH UI types; " +- "data_json is an optional JSON object string with initial data values.",- listOf(- p("components_json", description = "A2UI components as a JSON string"),- p("data_json", description = "optional initial data model as a JSON object string", required = false),- ),- ),- ToolSpec(- "get_directions",- "Get directions between two coordinates in the Maps app. Returns distance, duration and segment count.",- listOf(- p("from_lat", NUMBER, "origin latitude"),- p("from_lng", NUMBER, "origin longitude"),- p("to_lat", NUMBER, "destination latitude"),- p("to_lng", NUMBER, "destination longitude"),- p("mode", description = "drive (default), transit, walk, or bicycle", required = false),- ),- ),- ToolSpec(- "get_ride_estimate",- "Get a ride fare and pickup ETA estimate from the Taxi app.",- listOf(- p("pickup_lat", NUMBER, "pickup latitude"),- p("pickup_lng", NUMBER, "pickup longitude"),- p("dest_lat", NUMBER, "destination latitude"),- p("dest_lng", NUMBER, "destination longitude"),- p("pickup_label", description = "optional pickup label", required = false),- p("dest_label", description = "optional destination label", required = false),- ),- ),- ToolSpec(- "food_order_lookup",- "Check whether a named restaurant is orderable near a location via the FoodDelivery app.",- listOf(- p("name", description = "restaurant name"),- p("lat", NUMBER, "latitude"),- p("lng", NUMBER, "longitude"),- p("address", description = "optional address", required = false),- ),- ),- ToolSpec(- "search_contacts",- "Search contacts by name or phone number substring (case-insensitive, max 10 results).",- listOf(p("query", description = "name or phone substring to search for")),- ),- ToolSpec(- "web_search",- "Search the web for current or external facts. Returns numbered results; " +- "use web_read_result to read the most relevant ones before answering.",- listOf(- p("query", description = "search query"),- p("count", NUMBER, "optional result count, 1-10 (default 5)", required = false),- p("kind", description = "optional: text (default) or news", required = false),- ),- ),- ToolSpec(- "web_read",- "Read a web page by URL and return its extracted text.",- listOf(p("url", description = "page URL to read")),- ),- ToolSpec(- "web_read_result",- "Read a result from the last web_search by its 1-based index.",- listOf(- p("index", NUMBER, "1-based index into the last web_search results"),- p("offset", NUMBER, "optional character offset for long pages", required = false),- ),- ),- ToolSpec(- "find_conversations",- "Find messaging conversations in the Communicate app by name, number or text snippet. " +- "Returns thread_key values usable with get_conversation_messages.",- listOf(- p("query", description = "name, number or text to search (blank lists recent)", required = false),- p("limit", NUMBER, "optional max conversations 1-50 (default 5)", required = false),- ),- ),- ToolSpec(- "get_conversation_messages",- "Get recent messages from a messaging conversation by its thread_key from find_conversations.",- listOf(- p("thread_key", description = "thread key like Sim:42 or WhatsApp:[email protected]"),- p("limit", NUMBER, "optional max messages 1-100 (default 10)", required = false),- ),- ),- ToolSpec(- "draft_message",- "Show a message composer card with recipient, line and a draft body. Sends nothing; " +- "the user can edit the body and tap Send, which then asks for confirmation before sending.",- listOf(- p("recipient_name", description = "recipient display name", required = false),- p("address", description = "recipient phone number or address"),- p("line", description = "Sim, Rcs, WhatsApp, Signal, or GoogleVoice"),- p("body", description = "draft message text"),- p("thread_remote_id", description = "optional existing thread id to reply into", required = false),- ),- ),- ToolSpec(- "send_message_v2",- "Send a message via the Communicate app (requires confirmation). Should only be used " +- "with EXPLICIT request by user. GoogleVoice cannot send from here; use draft_message " +- "so the user can open the conversation instead.",- listOf(- p("address", description = "recipient phone number or address"),- p("line", description = "Sim, Rcs, WhatsApp, Signal, or GoogleVoice"),- p("body", description = "message text"),- p("thread_remote_id", description = "optional existing thread id to reply into", required = false),- ), risk = WRITE_CONFIRM,- ),- ToolSpec(- "find_restaurants",- "Find restaurants near a location via the FoodDelivery app, optionally filtered by name or tag.",- listOf(- p("query", description = "optional name or tag filter", required = false),- p("lat", NUMBER, "latitude"),- p("lng", NUMBER, "longitude"),- p("limit", NUMBER, "optional max results (default 5)", required = false),- ),- ),- ToolSpec(- "get_restaurant_menu",- "Get the menu of a restaurant (merchant_id from find_restaurants). Items carry ids, " +- "prices in cents, availability and modifier groups.",- listOf(p("merchant_id", NUMBER, "merchant id from find_restaurants")),- ),- ToolSpec("food_get_cart", "Get the current FoodDelivery cart (items and total)"),- ToolSpec(- "food_set_cart",- "Replace the FoodDelivery cart with items_json: a JSON array like " +- "[{\"itemId\":1,\"qty\":2,\"modifierIds\":[]}]. The cart is re-validated and shown " +- "back to the user right away; no order is placed and no money moves.",- listOf(- p("merchant_id", NUMBER, "merchant id the items belong to"),- p("items_json", description = "JSON array of {itemId, qty, modifierIds}"),- ), risk = WRITE_LIGHT,- ),- ToolSpec(- "food_prepare_order",- "Price the current cart for an order (pickup or delivery) without creating an order. " +- "Returns the summary the user will confirm in the FoodDelivery app.",- listOf(- p("merchant_id", NUMBER, "merchant id of the cart"),- p("is_pickup", NUMBER, "1 for pickup, 0 (default) for delivery", required = false),- p("address_id", description = "optional saved address id", required = false),- p("tip_cents", NUMBER, "optional tip in cents", required = false),- p("promo", description = "optional promo code", required = false),- ),- ),- ToolSpec(- "place_food_order",- "Show the order summary for the current cart. The user places and pays for the order " +- "in the FoodDelivery app itself; this never creates an order or charges a card.",- listOf(p("merchant_id", NUMBER, "merchant id of the cart")),- risk = HANDOFF_PREP,- ),- ToolSpec("get_food_orders", "Get the user's past FoodDelivery orders"),- ToolSpec(- "search_products",- "Search the Shop catalog. Each result is one purchasable variant with its variant_id, " +- "store and exact price.",- listOf(- p("query", description = "search text"),- p("limit", NUMBER, "optional max results (default 5)", required = false),- ),- ),- ToolSpec(- "get_product_detail",- "Get one product's variants with exact prices and availability. Confirm the exact " +- "variant with the user before adding it to the cart.",- listOf(- p("shop_domain", description = "store domain from search_products"),- p("product_id", description = "product id from search_products"),- p("variant_id", description = "optional variant to price", required = false),- ),- ),- ToolSpec("shop_get_cart", "Get the current Shop cart, grouped by store"),- ToolSpec(- "shop_add_to_cart",- "Add an exact variant to the Shop cart. The variant is re-verified before writing " +- "and the cart is shown back to the user; no checkout is started.",- listOf(- p("shop_domain", description = "store domain from search_products"),- p("variant_id", description = "exact variant id from get_product_detail"),- p("quantity", NUMBER, "quantity 1-99 (default 1)", required = false),- ), risk = WRITE_LIGHT,- ),- ToolSpec(- "shop_remove_from_cart",- "Remove a variant from the Shop cart; the cart is shown back to the user.",- listOf(p("variant_id", description = "variant id to remove")),- risk = WRITE_LIGHT,- ),- ToolSpec(- "start_shop_checkout",- "Show the per-store cart summary for one store. The user checks out in the Shop app " +- "itself; this never creates a checkout or charges anything, and opening the cart " +- "is not a paid order.",- listOf(p("shop_domain", description = "store domain to check out")),- risk = HANDOFF_PREP,- ),- ToolSpec("get_shop_orders", "Get the user's Shop order summaries"),- ToolSpec("get_memories", "Get a list of all memories"),- ToolSpec(- "remove_memory",- "Remove a memory by its id (requires confirmation)",- listOf(p("id", NUMBER)),- risk = WRITE_CONFIRM,- ),- ToolSpec("add_to_memory", "Add a new memory to the list of memories", listOf(p("content"))),-)+val ASSISTANT_TOOL_SPECS: List<ToolSpec> = parseToolSpecs()++private fun parseToolSpecs(): List<ToolSpec> {+ val specs = mutableListOf<ToolSpec>()+ for (row in TOOL_DATA.split("\n")) {+ if (row.isBlank()) continue+ val fields = row.split("|")+ specs +=+ ToolSpec(+ name = fields[0],+ description = fields[2],+ params = parseToolParams(fields[3]),+ risk = parseToolRisk(fields[1]),+ )+ }+ return specs+}++private fun parseToolParams(field: String): List<ToolParamSpec> {+ if (field.isEmpty()) return emptyList()+ val params = mutableListOf<ToolParamSpec>()+ for (entry in field.split("~")) {+ val param = entry.split("^", limit = 4)+ val type = if (param[1] == "N") ToolParamType.NUMBER else ToolParamType.STRING+ params += ToolParamSpec(param[0], param[3], type, param[2] == "1")+ }+ return params+}++private fun parseToolRisk(field: String): ToolRisk =+ when (field) {+ "C" -> ToolRisk.WRITE_CONFIRM+ "L" -> ToolRisk.WRITE_LIGHT+ "H" -> ToolRisk.HANDOFF_PREP+ else -> ToolRisk.READ+ }++private const val TOOL_DATA = """+get_notes|-|Get a list of all notes|+create_note|C|Create a new note in the notes app (requires confirmation). Should only be used with EXPLICIT request by user|title^S^1^~content^S^1^+get_todos|-|Get the user's open tasks from the todo app. Due times are epoch milliseconds; each task has an id usable with complete_todo.|scope^S^0^today (default), upcoming, or all+create_todo|C|Create a task in the todo app (requires confirmation). Should only be used with EXPLICIT request by user. The title may include words like 'tomorrow 6pm' or '#tag', which are understood when no due time is given.|title^S^1^~due^N^0^optional due time as epoch milliseconds~notes^S^0^~priority^N^0^optional priority, 1 (highest) to 4+complete_todo|C|Mark a task done (requires confirmation). Should only be used with EXPLICIT request by user.|id^S^0^task id from get_todos~title^S^0^exact task title, used when no id is given+get_contacts|-|Get a list of all contacts|+create_contact|C|Create a new contact (requires confirmation)|name^S^1^~phone_number^S^1^+get_calendar_events|-|Get a list of calendar events. Each event's start and end times are epoch milliseconds.|+create_calendar_event|C|Create a new calendar event (requires confirmation). Start and end times must be epoch milliseconds.|title^S^1^~start^N^1^start time as epoch milliseconds~end^N^1^end time as epoch milliseconds~location^S^0^+get_family_locations|-|Get a list of family members and their current locations|+create_location_share_link|C|Create a temporary FindFamily link that shares the user's live location (requires confirmation).|name^S^1^name or label for who the link is for~duration_millis^N^1^how long the link stays active, in milliseconds+search_music|-|Search for music (songs, albums, artists, or playlists)|query^S^1^+play_music|C|Play music given its id and type (song, album, artist, or playlist) (requires confirmation)|id^N^1^~type^S^1^+search_emails|-|Search emails by keyword|query^S^1^+get_recent_emails|-|Get recent emails from the inbox|+get_local_current_date_time|-|Get the current date and time in the local timezone.|+get_app_list|-|Get a list of installed apps on the device|+open_app|-|Open an app given its package id|package_id^S^1^package id+send_message|-|Send a message|recipient^S^1^~message^S^1^+make_phone_call|-|Make a phone call|recipient^S^1^+set_alarm|C|Set an alarm in the Clock app at a specific hour and minute (24-hour time) (requires confirmation).|hour^N^1^hour in 24-hour format, 0-23~minute^N^1^minute, 0-59~label^S^0^optional label for the alarm+set_timer|C|Start a countdown timer in the Clock app for a number of seconds (requires confirmation).|seconds^N^1^timer length in seconds~label^S^0^optional label for the timer+set_conversation_title|-|Set title of current conversation. Mandatory for first response|new_title^S^1^+get_weather|-|Get the current weather conditions at a specific latitude/longitude.|latitude^N^1^~longitude^N^1^+get_weather_by_name|-|Get the current weather conditions for a named place (city, address, landmark).|location^S^1^city or place name+render_ui|-|Render a rich UI card (A2UI) attached to your reply. Prefer this over writing a ```a2ui fence. components_json is a JSON string: {"components":[...]} (or a bare component array) using the RICH UI types; data_json is an optional JSON object string with initial data values.|components_json^S^1^A2UI components as a JSON string~data_json^S^0^optional initial data model as a JSON object string+get_directions|-|Get directions between two coordinates in the Maps app. Returns distance, duration and segment count.|from_lat^N^1^origin latitude~from_lng^N^1^origin longitude~to_lat^N^1^destination latitude~to_lng^N^1^destination longitude~mode^S^0^drive (default), transit, walk, or bicycle+get_ride_estimate|-|Get a ride fare and pickup ETA estimate from the Taxi app.|pickup_lat^N^1^pickup latitude~pickup_lng^N^1^pickup longitude~dest_lat^N^1^destination latitude~dest_lng^N^1^destination longitude~pickup_label^S^0^optional pickup label~dest_label^S^0^optional destination label+food_order_lookup|-|Check whether a named restaurant is orderable near a location via the FoodDelivery app.|name^S^1^restaurant name~lat^N^1^latitude~lng^N^1^longitude~address^S^0^optional address+search_contacts|-|Search contacts by name or phone number substring (case-insensitive, max 10 results).|query^S^1^name or phone substring to search for+web_search|-|Search the web for current or external facts. Returns numbered results; use web_read_result to read the most relevant ones before answering.|query^S^1^search query~count^N^0^optional result count, 1-10 (default 5)~kind^S^0^optional: text (default) or news+web_read|-|Read a web page by URL and return its extracted text.|url^S^1^page URL to read+web_read_result|-|Read a result from the last web_search by its 1-based index.|index^N^1^1-based index into the last web_search results~offset^N^0^optional character offset for long pages+find_conversations|-|Find messaging conversations in the Communicate app by name, number or text snippet. Returns thread_key values usable with get_conversation_messages.|query^S^0^name, number or text to search (blank lists recent)~limit^N^0^optional max conversations 1-50 (default 5)+get_conversation_messages|-|Get recent messages from a messaging conversation by its thread_key from find_conversations.|thread_key^S^1^thread key like Sim:42 or WhatsApp:[email protected]~limit^N^0^optional max messages 1-100 (default 10)+draft_message|-|Show a message composer card with recipient, line and a draft body. Sends nothing; the user can edit the body and tap Send, which then asks for confirmation before sending.|recipient_name^S^0^recipient display name~address^S^1^recipient phone number or address~line^S^1^Sim, Rcs, WhatsApp, Signal, or GoogleVoice~body^S^1^draft message text~thread_remote_id^S^0^optional existing thread id to reply into+send_message_v2|C|Send a message via the Communicate app (requires confirmation). Should only be used with EXPLICIT request by user. GoogleVoice cannot send from here; use draft_message so the user can open the conversation instead.|address^S^1^recipient phone number or address~line^S^1^Sim, Rcs, WhatsApp, Signal, or GoogleVoice~body^S^1^message text~thread_remote_id^S^0^optional existing thread id to reply into+find_restaurants|-|Find restaurants near a location via the FoodDelivery app, optionally filtered by name or tag.|query^S^0^optional name or tag filter~lat^N^1^latitude~lng^N^1^longitude~limit^N^0^optional max results (default 5)+get_restaurant_menu|-|Get the menu of a restaurant (merchant_id from find_restaurants). Items carry ids, prices in cents, availability and modifier groups.|merchant_id^N^1^merchant id from find_restaurants+food_get_cart|-|Get the current FoodDelivery cart (items and total)|+food_set_cart|L|Replace the FoodDelivery cart with items_json: a JSON array like [{"itemId":1,"qty":2,"modifierIds":[]}]. The cart is re-validated and shown back to the user right away; no order is placed and no money moves.|merchant_id^N^1^merchant id the items belong to~items_json^S^1^JSON array of {itemId, qty, modifierIds}+food_prepare_order|-|Price the current cart for an order (pickup or delivery) without creating an order. Returns the summary the user will confirm in the FoodDelivery app.|merchant_id^N^1^merchant id of the cart~is_pickup^N^0^1 for pickup, 0 (default) for delivery~address_id^S^0^optional saved address id~tip_cents^N^0^optional tip in cents~promo^S^0^optional promo code+place_food_order|H|Show the order summary for the current cart. The user places and pays for the order in the FoodDelivery app itself; this never creates an order or charges a card.|merchant_id^N^1^merchant id of the cart+get_food_orders|-|Get the user's past FoodDelivery orders|+search_products|-|Search the Shop catalog. Each result is one purchasable variant with its variant_id, store and exact price.|query^S^1^search text~limit^N^0^optional max results (default 5)+get_product_detail|-|Get one product's variants with exact prices and availability. Confirm the exact variant with the user before adding it to the cart.|shop_domain^S^1^store domain from search_products~product_id^S^1^product id from search_products~variant_id^S^0^optional variant to price+shop_get_cart|-|Get the current Shop cart, grouped by store|+shop_add_to_cart|L|Add an exact variant to the Shop cart. The variant is re-verified before writing and the cart is shown back to the user; no checkout is started.|shop_domain^S^1^store domain from search_products~variant_id^S^1^exact variant id from get_product_detail~quantity^N^0^quantity 1-99 (default 1)+shop_remove_from_cart|L|Remove a variant from the Shop cart; the cart is shown back to the user.|variant_id^S^1^variant id to remove+start_shop_checkout|H|Show the per-store cart summary for one store. The user checks out in the Shop app itself; this never creates a checkout or charges anything, and opening the cart is not a paid order.|shop_domain^S^1^store domain to check out+get_shop_orders|-|Get the user's Shop order summaries|+get_memories|-|Get a list of all memories|+remove_memory|C|Remove a memory by its id (requires confirmation)|id^N^1^+add_to_memory|-|Add a new memory to the list of memories|content^S^1^+"""