Plug-In: Outline the Clipboard

REQUIRES: macOS 26, iOS 26, iPados 26, visionOS 26 • OmniOutliner 6.0+

This plug-in uses the on-device Apple Foundation Models (AFM) frameworks and AI Tools to generate an outline summary of the clipboard text in OmniOutliner.

Related Links: AFM and Omni Automation documentationAFM Plug-In Collection

AI • Outline the Clipboard
  

/*{ "type": "action", "targets": ["omnioutliner"], "author": "Otto Automator", "identifier": "com.omni-automation.oo.summary-points-from-clipboard", "version": "1.0", "description": "This plug-in uses the Apple Foundation Models framework, and the “Omni AI Tools Library” to generate an outline of the key summary points from the text content on the clipboard.", "label": "AI • Outline Clipboard", "shortLabel": "Clip Outline", "paletteLabel": "Clip Outline", "image": "apple.intelligence" }*/ (() => { const getClipboardTextTool = function(){ console.log("getClipboardTextTool() function called"); toolObject = new LanguageModel.Tool( "getClipboardText", "This tool is used to extract the text from the general clipboard.", null, async () => { console.log("getClipboardText…") clipboardText = Pasteboard.general.string if(clipboardText){console.log(clipboardText)} return clipboardText } ); console.log("“getClipboardText” tool created"); return toolObject; } const action = new PlugIn.Action(async function(selection, sender){ try { /* USE IF AI TOOL IS LOADED FROM INSTALLED LIBRARY // LOCATE AND LOAD THE AI TOOLS LIBRARY const AILibraryPlugIn = PlugIn.find("com.omni-automation.all.ai-tools-library") if (!AILibraryPlugIn){throw new Error("The “AI Tools Library” plug-in is not installed.")} const AILibrary = AILibraryPlugIn.library(AILibraryPlugIn.displayName) console.log("AI Lib Version:", AILibrary.version.versionString) // INSTANTIATE CLIPBOARD TOOL const AITool = AILibrary.getClipboardTextTool() */ // INSTANTIATE CLIPBOARD TOOL const AITool = getClipboardTextTool() // AFM SESSION WITH TOOL const session = LanguageModel.Session.withTools( [AITool], null ) // PROMPT const prompt = "The text on the clipboard needs to be summarized into key points. Each point should be concise and accurately reflect the main ideas of the original text." // RESPONSE SCHEMA const resultSchema = LanguageModel.Schema.fromJSON({ name: "summary-points-schema", properties: [ { name: "result", schema: { arrayOf: { type: "string" } } } ] }) // ACTIVATE THE SESSION const responseStr = await session.respondWithSchema( prompt, resultSchema ) // PROCESS RESULT console.log(responseStr) const responseObj = JSON.parse(responseStr) console.log(responseObj.result) // PROMPT USER FOR CONTENT DESTINATION alertTitle = "Outline is Ready" alertMessage = "The text has been summarized." alert = new Alert(alertTitle, alertMessage) alert.addOption("Create New Outline") alert.addOption("Append to Outline") alert.addOption("Cancel") buttonIndex = await alert.show() if (buttonIndex === 0){ console.log("New") Document.makeNewAndShow(newDoc => { baseItem = newDoc.editors[0].rootNode.object for (responseItem of responseObj.result){ baseItem.addChild(null, item => {item.topic = responseItem}) } }) } else if (buttonIndex === 1){ console.log("Append") baseItem = document.editors[0].rootNode.object for (responseItem of responseObj.result){ baseItem.addChild(null, item => {item.topic = responseItem}) } } else { console.log("user cancelled") } } catch(err){ if(!err.causedByUserCancelling){ await new Alert(err.name, err.message).show() } } }); action.validate = function(selection, sender){ return (Pasteboard.general.hasStrings) }; return action; })();