本页内容
Sommatic 文档
打开控制台

OS Notification

显示系统通知。

以 Markdown 查看
在以下应用中打开
输入与输出 可用 io.desktop.notify 版本 1.0.0 执行方式: async

在运行 worker 的机器上显示操作系统原生通知,并返回通知程序的响应。

工作原理

  1. 解析配置。title、message、icon 和 appName 缺失时回退到输入 payload 中的同名键。
  2. 发送通知,使用 title(默认 Alert)、message、icon,并以 appName 作为应用标识。
  3. 等待通知程序回调:成功时从 out 输出 { response },失败时从 error 输出。

在工作流中

节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。

{
  "node_id": "node-notify-operator",
  "label": "Notify operator",
  "operator_slug": "io.desktop.notify",
  "operator_version": "1.0.0",
  "config": {
    "title": "Batch finished",
    "message": "{{ $json.processed }} documents processed",
    "appName": "Sommatic Orchestrator"
  }
}

配置

title string 可选
message string 必填
icon string 可选

图标路径

appName string 可选

默认值: Sommatic Orchestrator

代码中的行为

除 schema 描述之外,实现代码对这些键的实际处理。

appName
代码不会应用 schema 默认值 Sommatic Orchestrator;为空时不发送应用标识。
message
声明为必填,但 worker 不做校验;请始终设置。

输出端口

out 默认

通知程序已接受通知。response 为平台通知程序返回的值。

数据
{
  "response": "<notifier response>"
}
error

通知程序失败。error 为通知程序传回的错误对象;若调用抛出异常,则为错误消息。

数据
{
  "error": "<notifier error>"
}

在表达式中

后续节点可通过 $("OS Notification").item.json.<路径> 读取此节点输出中的内容(请把 OS Notification 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 out 返回的路径,依据“端口”一节所示的输出。

表达式EditorWorker
$("OS Notification").item.json.responsestring= "<notifier response>"通知发送结果

错误

消息 端口 原因与处理
<notifier error> error 主机没有可用的通知服务(例如无显示器的服务器)。请在有桌面会话的机器上运行该节点。

输入契约

title string 可选
message string 必填
icon string 可选
appName string 可选

输出契约

response string 可选

通知发送结果

契约(JSON Schema)

与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。

{
  "slug": "io.desktop.notify",
  "name": "OS Notification",
  "category": "io",
  "version": "1.0.0",
  "description": "Show system notification.",
  "capabilities": [
    "notification",
    "desktop"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "message": {
        "type": "string"
      },
      "icon": {
        "type": "string",
        "description": "Path to icon"
      },
      "appName": {
        "type": "string",
        "default": "Sommatic Orchestrator"
      }
    },
    "required": [
      "message"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "title": {
        "type": "string"
      },
      "message": {
        "type": "string"
      },
      "icon": {
        "type": "string"
      },
      "appName": {
        "type": "string"
      }
    },
    "required": [
      "message"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "response": {
        "type": "string",
        "description": "Notification dispatch result"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Shown",
      "description": "Notification dispatched",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Notification failed",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "required_resources": [],
  "compatible_worker_pools": [
    "desktop-agent"
  ],
  "tags": [
    "desktop",
    "notification"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

执行

执行方式
async
有状态
否
能力
notificationdesktop
标签
desktopnotification

说明与限制

  • 通知显示在运行编排器 worker 的主机上,而不是 Sommatic AI Web 客户端中。如需通知用户,请使用任务或消息类节点。
  • 持久化时,通知程序返回的错误对象可能被序列化为空对象。

已对照编排器代码核实 · 31e874b · 2026-11-26

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

安装 Sommatic AI CLI,并为检测到的智能体配置合适的插件。

npx @sommatic/cli agent setup
智能体如何读取本文档