Browse API 1 documentation
JavaScript objects
Globals, namespaces, runtime context, and calling conventions.
Mango injects window.grove at document start in packaged extension pages. You can use the global grove directly without an import or SDK. This reference describes the current Grove API 1 preview in Mango 3.1; additive members may be absent in older preview builds.
Global objects
| Object | What it provides |
|---|---|
window.grove / grove |
Mango’s native extension API, listed below. |
window, document |
The extension’s WebKit page and DOM, including headless Roots. |
console |
Standard logging; log, info, warn, error, and debug are mirrored into Mango’s Grove Console. |
URL, URLSearchParams, JSON, Promise, Map, Set |
Standard browser JavaScript tools. |
Uint8Array, ArrayBuffer, TextEncoder, TextDecoder, atob, btoa |
Binary data, UTF-8, and base64 conversion. |
fetch, XMLHttpRequest, WebSocket |
Browser networking subject to the package’s host permissions, CSP, and browser rules such as CORS. HTTPS and WSS permissions are separate. |
localStorage, sessionStorage, indexedDB |
Browser storage. The storage capability selects persistent WebKit storage; otherwise expect ephemeral state. |
crypto |
WebKit’s Web Crypto object, distinct from grove.crypto. Feature-detect secure-context APIs on the target OS. |
setTimeout, setInterval |
Browser timers; background throttling and app suspension apply. |
WebKit is a browser runtime: Node.js objects such as process, Buffer, require, and filesystem modules are unavailable. Bundle dependencies for the browser. WebRTC entry points are disabled. There is no raw IRC send, ambient filesystem, native notification, or general native-code API. Standard browser availability depends on the OS WebKit version.
Settings pages receive the facade but have application scope, no IRC routing, and no network host permissions. A packaged page opened by grove.webPane.open receives no Grove facade. See Storage and settings and Security model.
Grove object
The facade, its namespaces, and its context objects are frozen. The presence of a function does not mean the user granted it. Mango checks permissions and scope natively on each operation.
| Member | Purpose |
|---|---|
info |
Read-only extension and scope context described below. |
on, off |
Subscribe to and remove event listeners. |
send, reply, notice, typing, away |
Modeled IRC output and presence. |
composer.complete, composer.upload, composer.close |
Return a composer utility’s result or dismiss it. |
commands.register, card, dismissCard |
Slash commands and native output cards. |
memberActions.register, channelActions.register |
Native context-menu contributions. |
memberBadges.set, channelBadges.set, badges.set |
Native contextual and status indicators. |
webPane.open |
An isolated packaged HTML page beside a joined channel. |
filters.set, protection.set |
Message transforms and persistent protection policy. |
uploads.register, uploads.unregister |
Upload-provider handlers. |
secrets.get/set/delete |
Network-scoped Keychain values. |
secrets.application.get/set/delete |
Application-scoped Keychain values. |
oauth.prepare, oauth.authorize |
Host-generated state and PKCE material; direct and trusted-broker authorization sessions. |
oauth.redirectURI |
Read-only string "mango://grove/oauth". |
network.request |
Bounded native HTTPS requests. |
crypto.blowfish.encrypt/decrypt |
Legacy raw-block interoperability. |
log |
A Grove Console diagnostic. |
Every callable has its own page in the API Reference navigation. Names beginning with __, including native delivery/resolution hooks and window.__groveFilter / window.__groveUpload, are host internals and are not extension APIs.
Function index
| Function | Contract |
|---|---|
| grove.on() | Subscribe to a host event. |
| grove.off() | Remove one previously registered event listener. |
| grove.send() | Send an ordinary IRC message to an authorized conversation. |
| grove.reply() | Reply using a message’s peer, channel, and optional IRC message ID. |
| grove.notice() | Send a one-way IRC NOTICE. |
| grove.typing() | Publish an IRC typing state. |
| grove.away() | Set or clear the connection-wide away message. |
| grove.log() | Write a diagnostic to Mango’s Grove Console. |
| grove.composer.complete() | Insert a utility result into Mango’s draft and close the utility. |
| grove.composer.close() | Dismiss a composer utility without contributing a result. |
| grove.composer.requestFocus() | Hand the already-focused composer to a utility text field. |
| grove.composer.upload() | Hand one in-memory file to Mango’s configured uploader. |
| grove.composer.audio | Record, stop, or discard a bounded native voice recording. |
| grove.commands.register() | Replace the running instance’s slash-command definitions. |
| grove.card() | Show or replace a native command-output card. |
| grove.dismissCard() | Remove a native card owned by this instance. |
| grove.webPane.open() | Open or reuse an isolated packaged HTML page beside a joined channel. |
| grove.memberActions.register() | Replace native member-menu actions and their selected state. |
| grove.channelActions.register() | Replace native joined-channel menu actions. |
| grove.memberBadges.set() | Replace native badges beside channel members. |
| grove.channelBadges.set() | Replace native badges beside joined channels. |
| grove.badges.set() | Replace status-bar indicators published by the instance. |
| grove.secrets.get() | Read an extension/network Keychain value. |
| grove.secrets.set() | Store or replace an extension/network Keychain value. |
| grove.secrets.delete() | Delete an extension/network Keychain value. |
| grove.secrets.application.get() | Read an application Keychain value. |
| grove.secrets.application.set() | Store or replace an application Keychain value. |
| grove.secrets.application.delete() | Delete an application Keychain value. |
| grove.oauth.prepare() | Prepare host-owned state and PKCE for a brokered authorization flow. |
| grove.oauth.authorize() | Run an OAuth session with host-generated state and PKCE material; brokered flows require a trusted broker. |
| grove.network.request() | Make a bounded native HTTPS request outside browser CORS. |
| response.text() | Decode a native network response body as UTF-8. |
| response.json() | Parse a native network response body as JSON. |
| grove.crypto.blowfish.encrypt() | Encrypt raw Blowfish blocks for legacy interoperability. |
| grove.crypto.blowfish.decrypt() | Decrypt raw Blowfish blocks for legacy interoperability. |
| grove.uploads.register() | Register an upload-provider implementation declared by the package. |
| grove.uploads.unregister() | Make an upload provider unavailable for new native requests. |
| file.read() | Read one bounded byte range of the file selected for an active upload. |
| context.progress() | Update native upload progress for the active handler. |
| grove.filters.set() | Replace inbound and outbound message-filter callbacks. |
| grove.protection.set() | Replace persistent host policy requiring a security extension for selected conversations. |
grove.info
interface GroveInfo {
readonly id: string
readonly api: 1
readonly networkID: string
readonly scope: {
readonly kind: 'application' | 'server' | 'channel' | 'query'
readonly target: string | null
}
}
| Property | Meaning |
|---|---|
id |
Immutable manifest extension identifier. |
api |
Bridge API version, currently 1. |
networkID |
Opaque owning network identifier. Empty for application Roots, composer utilities, and settings pages. |
scope.kind |
Bound runtime scope; changing the visible conversation does not rebind it. |
scope.target |
Bound channel name or query nickname; null for application/server scope. |
Context is available synchronously; there is no ready Promise. Register listeners during initial script execution. Application Roots may have multiple mirrored runtimes: globals are local to one runtime, even when storage is shared.
Calling conventions
Signatures in this reference use TypeScript notation to explain JavaScript values; no TypeScript declarations or constructors are installed by Mango. Optional parameters use ?. Supply the documented types even where the facade happens to coerce numbers or strings.
Most methods return undefined immediately. await grove.send(...) does not wait for delivery and cannot catch a native refusal. Promise APIs explicitly document their resolved values and rejections; secret writes and deletes resolve to null, not undefined. Error messages are diagnostic text rather than stable machine-readable codes.
Calls are tied to the current document. Reload, stop, crash, or suspension can interrupt pending work; no API promises durable execution across a restart. Validate inputs before calling, handle Promise failures, and use the Grove Console when a fire-and-forget operation is refused.
Some facade validation throws synchronously, notably composer binary uploads and overlong web-pane values. Malformed values can also be dropped at the native bridge; do not assume every malformed Promise request will settle.
Current request-decoding limitations
An unsupported mode for Blowfish encryption or decryption, or a non-integer offset/length for file.read(), can fail native decoding without rejecting the JavaScript Promise. A catch handler cannot recover from a Promise that never settles. Validate these inputs before calling: use only the literal modes ‘ecb’ or ‘cbc’, and use Number.isSafeInteger for byte offsets and lengths in addition to the documented range checks. The examples on those pages use valid literal modes or integer chunk sizes.
These are current API 1 implementation limitations, not intended guarantees for future versions. A JavaScript timeout may release your UI from waiting, but it does not cancel native work; do not automatically retry a timed-out side effect.
Objects passed to callbacks or returned
Upload handlers receive a frozen file object and context object. Their methods are documented as file.read and context.progress. Native network requests return a frozen response with synchronous text() and json() methods; it is not a browser Response. Events and filter messages are ordinary payload objects; their shapes are documented in the event and filter reference.