share_app
Invite someone (by Charming handle or email) to one of your apps, OR change the role of someone you already invited. Use this when the user wants to give a specific person access to an app, or to change what an existing collaborator/end-user/viewer can do. Creates a PENDING invitation: the invitee has no access until the eligible signed-in account chooses Open app from the email or Charming Home; that action creates the durable grant before entering the app. Pick a role: collaborator (default) can open, edit, and run the app (shared state, same data); end-user can open the app and write its data (record entries, save state) but cannot edit the app source; viewer can only open and use the read-only surface — viewers cannot edit, run mutating ops, or change anything. If the grantee already has a share, calling this again WITH a role changes their role in place (status updated, no new invitation, no second email) — this is how you flip a collaborator to an end-user and back; re-sharing WITHOUT a role leaves the existing role untouched. No share role can ever share, delete, or transfer the app. The invitee does NOT need a Charming account first — inviting an email with no account stores a pending invitation and emails them a sign-up link; the eligible grant appears after they register and verify that email (an unknown handle still errors, since there is no address to reach). Revoke anytime with unshare_app.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | The access level: `collaborator` (default — edit and run), `end-user` (run + write data, not edit source), or `viewer` (read-only) | |
| app_id | Yes | The app ID (UUID) to share | |
| grantee | Yes | The invitee's Charming handle (e.g. `ada` or `@ada`) or account email |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Indicates success. Errors arrive as content with isError:true. | |
| status | Yes | Sharing creates an invitation, not access. `pending` = the grantee has a Charming account and gets access only when that account chooses Open app. `invited` = the email has no account yet; it becomes a pending share once they register and verify that address. `updated` = the grantee already had a share and re-sharing with a `role` changed it in place (no new invitation, no second email). | |
| grantee | Yes | The resolved grantee (handle when set, else email) the invitation was sent to. | |
| message | Yes | Consequence copy the agent should surface verbatim: the invitee has no access until they choose Open app, and what their role permits after the durable grant succeeds. | |
| advisories | No | Structured non-fatal advisories, including authoring issues and unread staff feedback responses. Each advisory.summary is also appended to the text content for the LLM path. |