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 documentation • AFM 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.stringif(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 LIBRARYconst 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 TOOLconst AITool = AILibrary.getClipboardTextTool()*/// INSTANTIATE CLIPBOARD TOOLconst AITool = getClipboardTextTool()// AFM SESSION WITH TOOLconst session = LanguageModel.Session.withTools([AITool],null)// PROMPTconst 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 SCHEMAconst resultSchema = LanguageModel.Schema.fromJSON({name: "summary-points-schema",properties: [{name: "result",schema: {arrayOf: {type: "string"}}}]})// ACTIVATE THE SESSIONconst responseStr = await session.respondWithSchema(prompt,resultSchema)// PROCESS RESULTconsole.log(responseStr)const responseObj = JSON.parse(responseStr)console.log(responseObj.result)// PROMPT USER FOR CONTENT DESTINATIONalertTitle = "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.objectfor (responseItem of responseObj.result){baseItem.addChild(null, item => {item.topic = responseItem})}})} else if (buttonIndex === 1){console.log("Append")baseItem = document.editors[0].rootNode.objectfor (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;})();