App resources
Resources are immutable JSON values packaged with an App release. They are useful for large Tool catalogs, mapping tables and reviewed source data that should not be embedded as executable JavaScript.
Declare every resource
{
"resources": {
"toolCatalog": {
"path": "assets/tool-catalog.json",
"type": "json"
}
}
}Resource names are safe single path components. Paths must remain under assets/, use safe components and match an actual regular file.
Read the frozen value
const toolCatalog = PocketPi.resources.get("toolCatalog");
function findTool(name) {
return toolCatalog.tools.find((tool) => tool.name === name) ?? null;
}The framework deep-freezes parsed resource values before exposing them. Both the Action and View Guest receive the same release data, but they do not share a JavaScript object or heap.
Validation rules
- Only
type: "json"is supported. - Files present under
assets/must exactly equal the paths declared byresources. - One JSON resource is limited to 256 KiB.
- All resources together are limited to 512 KiB.
- The entire
.pocketapp, including resources, is limited to 2 MiB. - Invalid JSON rejects the candidate before activation.
Choose the right storage
| Data | Put it in |
|---|---|
| Reviewed catalog/versioned mapping shipped with source | assets/*.json |
| Mutable product state, history or cached View projection | App-owned SQLite |
| Raw provider credential | Native credential store |
| Executable behavior | actions.js or view.js |
| Agent-authored memory | Pi Agent /workspace |
Robinhood uses a resource for its checked-in provider Tool catalog; see the catalog source ↗.