Custom Plugins
Section titled “Custom Plugins”Custom plugins implement fetchEvents(config) and return an array of events. The host exposes nunc APIs; sidefy remains a compatibility alias.
AI decisions
Section titled “AI decisions”Use nunc.ai.decide(input, decision) to check a condition, classify content, or rate it against ordered levels. Enable the plugin’s AI Decision permission (requirements.ai_decision: true) and configure Settings → Services → AI Decision. The existing requirements.ai permission only grants nunc.ai.chat() and does not grant decision access. This uses the decision service, separately from the General AI service used by nunc.ai.chat().
const input = { title: 'Xcode update', summary: "A new version of Apple's development tools.",};
const probability = nunc.ai.decide(input, { match: 'About Apple development' });if (probability !== null && probability >= 0.7) { nunc.log('Matched');}
const category = nunc.ai.decide(input, { choice: { news: 'Product news', tutorial: 'Development tutorials', other: 'Other content', },});
const importance = nunc.ai.decide(input, { score: ['General information', 'Worth attention', 'Requires prompt action'],});Parameters and results
Section titled “Parameters and results”input: non-empty text, a JSON object, or a JSON array. An array is shared context for one decision; it does not automatically evaluate each item separately.decision: exactly one ofmatch,choice, orscore. Extra or unknown fields are rejected.match: a non-empty description. Returns the probability of matching, from0to1; choose a threshold suitable for your plugin.choice: at least two option keys mapped to non-empty descriptions. Returns the selected key, such as"tutorial".score: at least two non-empty level descriptions, lowest first. Returns a probability-weighted level index from0to the number of levels minus one. Three levels therefore produce a value from0to2, possibly fractional.
Calls are synchronous inside the plugin’s background execution. Successful responses reuse the application’s decision cache; uncached calls may incur service charges. The configured provider can impose additional input and option limits. Multiple calls share the plugin execution time budget.
Invalid arguments throw TypeError. Missing permission, missing configuration, request failures, timeouts, and invalid service responses return null and write the reason to plugin logs. Always check for null: 0 is a valid decision result. Decide explicitly whether your plugin retains or skips content when the service fails.
Use nunc.ai.chat(text) for generated text such as summaries; use nunc.ai.decide() for these structured decisions.