Skip to main content

Intents overview

Intents are at the core of Picteus extensibility: they let extensions request user interactions through Picteus-managed interfaces, without having to implement those interfaces themselves. The range of interactions available through intents creates opportunities for advanced workflows and, in turn, new features. When a workflow needs a custom interface, extensions can also provide one through a UI intent.

Intent contracts are defined in TypeSpec and maintained as the source of truth for intent definitions, specifications, and documentation. The specification factory also emits their JSON Schema equivalent and generates the typed Python and TypeScript SDK definitions, which extensions use to construct and submit intents.

See their original "Intents" TypeSpec source file on GitHub, which may be used to understand in details the composition and structure of intents.

See its corresponding published "Intents" JSON Schema — its source file being located at docs/static/jsonschema/intents.schema.json.

See the generated intent model reference for the structural contract, properties and inheritance relationships.

Two types of intents exist: front-end and back-end. Front-end intents are forwarded to the Picteus UI, while back-end intents are handled by the server and may delegate to the Electron application for native interactions that the front-end cannot perform.

Submitting intents​

The TypeScript and Python SDKs each expose a dedicated asynchronous function for submitting an intent: communicator.launchIntent(intent) in TypeScript and communicator.launch_intent(intent) in Python. Both functions submit the intent for validation and routing by the back-end, then await the interaction or operation result, which may include user input or a server response.

Intent specifications define the same contract in both languages. The SDKs provide language-specific types and models for constructing the payload, but the intent's fields, requirements, and behavior are the same.

User Interface (UI) & interaction intents​

1. DialogIntent (dialog)​

Displays modal dialog boxes: confirmation questions, information messages, error notices, or dialogs containing embedded frames.

2. FormIntent (form)​

Presents a dynamically generated form based on JSON Schema and returns the user's filled inputs as an object/dictionary.

3. UiIntent (ui)​

Opens a dedicated UI frame in a modal, sidebar, window, or tab, rendering a URL or raw inline HTML.

4. ImagesIntent (images)​

Opens a tab displaying an image gallery with the supplied images and header content.

5. ToastIntent (toast)​

Displays a brief, non-intrusive toast notification in the application.

6. NotificationIntent (notification)​

Sends a notification to the Picteus notification center or system desktop notification manager (isNative: true).


System & navigation intents​

  • ShowIntent (show): navigates the Picteus client to a specific view:
    • IntentShowType.Image: open an image detail page.
    • IntentShowType.Sidebar: open a registered sidebar panel.
    • IntentShowType.ExtensionSettings: open this extension's settings page.
    • IntentShowType.Repository: open a repository view.
  • OpenBrowserIntent (openBrowser): opens an external URL in the user's default web browser.
  • ActionIntent (action): bundles an intent with an executable trigger button inside a dialog or notification.

File & bundle intents​

  • ReadFileIntent (readFile): prompts the user with a native file picker to select a file (with optional extension filters) and returns the file content as a Buffer (TS) or bytearray (Python).
  • WriteFileIntent (writeFile): prompts the user to save a file with suggested name, extension, and binary content.
  • ServeBundleIntent (serveBundle): uploads and serves a zipped HTML/JS web application bundle from the extension to an iframe endpoint hosted by the Picteus server.