@dxos/app-toolkit - v0.16.0
    Preparing search index...

    Type Alias ObjectAction<T>

    A menu item one plugin contributes to another plugin's object surface — "analyse this mailbox", "research this sender", "delegate this task to a chat".

    The contributing plugin owns the behaviour and the host owns the surface, so neither has to import the other: the host defines a capability over this shape, and every plugin that wants a place on that surface contributes one.

    export const TaskAction = Capability.make<ObjectAction<Task.Task>>()(`${meta.profile.key}.capability.taskAction`);
    

    Contribute an app-graph action on the subject's node instead, so every contributed action lives in the one graph the app's menus read. The host reads it with graphActions(…, { filter }); a subject that is not an object gets a typed hidden node, as a prompt does (AppNode.makePrompt).

    type ObjectAction<T> = {
        createInvocations: (subject: T) => Invocation[];
        group?: string;
        icon?: string;
        id: string;
        label: string;
        unavailable?: Atom.Atom<string | undefined>;
    }

    Type Parameters

    • T
    Index

    Properties

    createInvocations: (subject: T) => Invocation[]

    What to run, in order — a list, because the useful actions are composites (research, then image) and a contributor should not have to model that as one operation.

    An EMPTY list means the action does not apply to this subject and the host omits the item. One closure decides both applicability and behaviour, so the two cannot disagree.

    A closure rather than value properties: holding an Operation.Definition on the capability value makes the capability atom read recurse.

    group?: string

    Consecutive actions sharing a group are set apart from their neighbours by a separator.

    icon?: string

    Phosphor icon name.

    id: string

    Stable id; the menu item's key, and what the host dispatches on.

    label: string

    Menu item label, shown verbatim.

    unavailable?: Atom.Atom<string | undefined>

    Why the action cannot run right now; the host shows it disabled with this reason.