From 146d62c80b3b039d1b8060a0650f5389d09c38f2 Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Mon, 17 Aug 2026 07:50:15 +0000 Subject: [PATCH] docs(skill): document sendNotification action (7 actions total) + CLI support - skill: SKILL.md (7 actions in description + routing table entry), action-types.md (new section #4 sendNotification: config keys, variables, system-in-app semantics), automation-guide.md/cli-reference.md (--to-user/--title/--message/--severity/--path), development.md (7 actions), metadata.json abstract - cli: action add --type sendNotification now builds config from granular flags (toUserId/title/message/severity/path); ACTION_TYPES includes sendNotification; live-verified via workflow create + action add + delete --- .agents/skills/inkreach-teable/SKILL.md | 8 ++-- .../api-reference/action-types.md | 41 ++++++++++++++++--- .../guides/automation-guide.md | 1 + .../inkreach-teable/guides/cli-reference.md | 1 + .../inkreach-teable/guides/development.md | 2 +- .agents/skills/inkreach-teable/metadata.json | 2 +- dist/commands/workflow.js | 19 +++++++++ src/commands/workflow.ts | 14 +++++++ 8 files changed, 76 insertions(+), 12 deletions(-) diff --git a/.agents/skills/inkreach-teable/SKILL.md b/.agents/skills/inkreach-teable/SKILL.md index f7bf014..725d375 100644 --- a/.agents/skills/inkreach-teable/SKILL.md +++ b/.agents/skills/inkreach-teable/SKILL.md @@ -4,8 +4,8 @@ description: >- Operate a deployed inkreach-teable instance (a Teable fork with a self-built automation engine). Configure tables, fields, records, views, and automations (8 triggers incl. recordCreated/Updated/Condition, formSubmitted, scheduledTime, - buttonClick, webhook; 6 actions: script, sendEmail, httpRequest, createRecord, - updateRecord, getRecords), plus secrets, execution history, and dynamic plugins + buttonClick, webhook; 7 actions: script, sendEmail, httpRequest, createRecord, + updateRecord, getRecords, sendNotification), plus secrets, execution history, and dynamic plugins (install/uninstall, base-level mount nodes, developer whitelist, CSP apiOrigins). Trigger when the user wants to manage tables/fields/records/views, build or configure automations/workflows, set up button-field triggers, schedule jobs, @@ -69,7 +69,7 @@ Respond in the user's language. Keep answers concise and action-oriented. | Receive external HTTP | Trigger `webhook`; fire via `fire webhook` | Expecting auth (backend ignores it) | | Schedule recurring job | Trigger `scheduledTime` (only type+interval work) | Passing triggerTime/weekdays (backend ignores) | | Per-row AI / transformation | Action `script` reading `triggerInput` | Manual row-by-row via record API | -| Send notification | Action `sendEmail` or `httpRequest` | — | +| Send notification | Action `sendNotification` (system in-app) | `sendEmail` (needs SMTP) unless email is truly required | | Add a custom UI / view / panel | Plugins: `plugin install --position base` | Manually editing DB rows | | Allow a user to upload plugins | Plugins: `plugin dev allow ` (admin only) | — | | Plugin needs external API access | Plugins: declare `apiOrigins` in `plugin.json` manifest | Editing CSP in next.config.js (global) | @@ -152,7 +152,7 @@ These differ from official teable and from the (stale) `docs/automation/triggers Files in `api-reference/`, read when you need exact config formats: - **[trigger-types.md](api-reference/trigger-types.md)** — all 8 triggers: type string, config keys, output variables. -- **[action-types.md](api-reference/action-types.md)** — all 6 actions: config keys, sandbox globals, variable references. +- **[action-types.md](api-reference/action-types.md)** — all 7 actions: config keys, sandbox globals, variable references. - **[field-types.md](api-reference/field-types.md)** — Teable field types, aliases, and option shapes (incl. Button field with `workflowId`). ## 7. Instance Access diff --git a/.agents/skills/inkreach-teable/api-reference/action-types.md b/.agents/skills/inkreach-teable/api-reference/action-types.md index a253fa6..25aafba 100644 --- a/.agents/skills/inkreach-teable/api-reference/action-types.md +++ b/.agents/skills/inkreach-teable/api-reference/action-types.md @@ -1,13 +1,13 @@ # Action Types Reference -All 6 actions of the inkreach-teable automation engine. Actions run in topological order after the trigger; each receives the merged upstream output. +All 7 actions of the inkreach-teable automation engine. Actions run in topological order after the trigger; each receives the merged upstream output. An action node: ```json { "id": "node-2", "type": "action", - "category": "", + "category": "", "config": { ... }, "name": null } @@ -158,11 +158,40 @@ inkreach-teable action add --type httpRequest \ - GET/HEAD do not send a body. **Output:** `{ "statusCode": 200, "headers": {...}, "body": }` -- Non-2xx still returns output but the node status is `failed`. --- -## 4. createRecord — Create records +## 4. sendNotification — System in-app notification (站内信,非邮件) + +```bash +inkreach-teable action add --type sendNotification \ + --to-user usr4ioKJl6XpZgyFhxW \ + --title '新工单' --message '工单 {{n0.record.id}} 已创建' \ + --severity info +``` + +**Config:** +```json +{ + "toUserId": "usr4ioKJl6XpZgyFhxW", + "title": "新工单", + "message": "工单 {{n0.record.id}} 已创建", + "path": "/base/bseX/table/tblY", + "severity": "info" +} +``` +- `toUserId`: recipient user ID (required). Can reference the trigger user with `{{n0.user.id}}` (submitter/operator — only populated on user-initiated triggers; scheduled/webhook resolve to empty). +- `title` + `message`: notification text; both support `{{nodeId.path}}` variables. If title set, rendered as `title\nmessage`. +- `path` (optional): click-through URL in the notification center. +- `severity`: `info` (default) | `warning` | `critical`. + +**IMPORTANT**: this is a **system in-app notification** (bell badge + notification center + realtime socket push). It calls `NotificationService.sendCommonNotify` with `type=system` and **no email config — no email is sent**. Prefer it over `sendEmail` unless an actual email is required. + +**Output:** `{ "sentCount": 1, "invalidUserIds": [], "toUserId": "usr..." }` + +--- + +## 5. createRecord — Create records ```bash inkreach-teable action add --type createRecord \ @@ -184,7 +213,7 @@ inkreach-teable action add --type createRecord \ --- -## 5. updateRecord — Update records +## 6. updateRecord — Update records ```bash inkreach-teable action add --type updateRecord \ @@ -206,7 +235,7 @@ inkreach-teable action add --type updateRecord \ --- -## 6. getRecords — Query records +## 7. getRecords — Query records ```bash inkreach-teable action add --type getRecords \ diff --git a/.agents/skills/inkreach-teable/guides/automation-guide.md b/.agents/skills/inkreach-teable/guides/automation-guide.md index bc58361..d7f23b0 100644 --- a/.agents/skills/inkreach-teable/guides/automation-guide.md +++ b/.agents/skills/inkreach-teable/guides/automation-guide.md @@ -63,6 +63,7 @@ Full config details: [trigger-types.md](../api-reference/trigger-types.md). | Create records | `createRecord` | `--target-table `, `--records ` | | Update records | `updateRecord` | `--target-table `, `--records ` | | Query records | `getRecords` | `--target-table `, `--query ` | +| Send system notification (站内信) | `sendNotification` | `--to-user `, `--title`, `--message`, `--severity`, `--path` | Full config details: [action-types.md](../api-reference/action-types.md). diff --git a/.agents/skills/inkreach-teable/guides/cli-reference.md b/.agents/skills/inkreach-teable/guides/cli-reference.md index 525d981..91a316e 100644 --- a/.agents/skills/inkreach-teable/guides/cli-reference.md +++ b/.agents/skills/inkreach-teable/guides/cli-reference.md @@ -123,6 +123,7 @@ Per-type options: | `createRecord` | `--target-table `, `--records ` | | `updateRecord` | `--target-table `, `--records ` | | `getRecords` | `--target-table `, `--query ` | +| `sendNotification` | `--to-user `, `--title `, `--message `, `--severity `, `--path ` | Details: [action-types.md](../api-reference/action-types.md). diff --git a/.agents/skills/inkreach-teable/guides/development.md b/.agents/skills/inkreach-teable/guides/development.md index 64a858a..e161e15 100644 --- a/.agents/skills/inkreach-teable/guides/development.md +++ b/.agents/skills/inkreach-teable/guides/development.md @@ -117,7 +117,7 @@ CLI for automations. See [SKILL.md § Key Constraints](../SKILL.md#3-key-constra Automation E2E tests live in `scripts/automation-test/`: ```bash -node scripts/automation-test/run-all.js # 59 cases: 8 triggers + 6 actions + cross-features +node scripts/automation-test/run-all.js # 59 cases: 8 triggers + 7 actions + cross-features node scripts/stress-test/stress-test.js # concurrency stress test ``` Lib framework: `scripts/automation-test/lib.js`. Uses Node `http` (not fetch) diff --git a/.agents/skills/inkreach-teable/metadata.json b/.agents/skills/inkreach-teable/metadata.json index be69dfc..ea8d43f 100644 --- a/.agents/skills/inkreach-teable/metadata.json +++ b/.agents/skills/inkreach-teable/metadata.json @@ -3,7 +3,7 @@ "organization": "inkreach", "authors": ["inkreach"], "tags": ["database", "teable", "no-code", "automation", "self-hosted"], - "abstract": "Operate a deployed inkreach-teable instance — configure tables, fields, records, views, and the self-built automation engine (8 triggers + 6 actions), plus development/deployment knowledge. Uses the inkreach-teable CLI which targets the project's own automation contract (not official teable CLI compatible).", + "abstract": "Operate a deployed inkreach-teable instance — configure tables, fields, records, views, and the self-built automation engine (8 triggers + 7 actions), plus development/deployment knowledge. Uses the inkreach-teable CLI which targets the project's own automation contract (not official teable CLI compatible).", "engines": { "inkreachTeableCli": ">=0.1" }, diff --git a/dist/commands/workflow.js b/dist/commands/workflow.js index 6fe9a7e..54b60e6 100644 --- a/dist/commands/workflow.js +++ b/dist/commands/workflow.js @@ -367,6 +367,7 @@ const ACTION_TYPES = [ 'createRecord', 'updateRecord', 'getRecords', + 'sendNotification', ]; function actionCommand() { const cmd = new commander_1.Command('action'); @@ -390,6 +391,11 @@ function actionCommand() { .option('--target-table ', 'Target table id (createRecord/updateRecord/getRecords)') .option('--records ', 'Records JSON array (createRecord/updateRecord)') .option('--query ', 'Query JSON (getRecords)') + .option('--to-user ', 'Recipient user id (sendNotification)') + .option('--title ', 'Notification title (sendNotification)') + .option('--message ', 'Notification message (sendNotification)') + .option('--severity ', 'Notification severity info|warning|critical (sendNotification)') + .option('--path ', 'Click-through path, e.g. /base/xx/table/yy (sendNotification)') .option('--name ', 'Optional node display name') .option('--base-id ', 'Base id (overrides default)') .action((0, ctx_1.run)(async (ctx, args, o) => { @@ -606,6 +612,19 @@ function buildActionConfig(opts) { config.query = JSON.parse(opts.query); break; } + case 'sendNotification': { + if (opts.toUser) + config.toUserId = opts.toUser; + if (opts.title) + config.title = opts.title; + if (opts.message) + config.message = opts.message; + if (opts.severity) + config.severity = opts.severity; + if (opts.path) + config.path = opts.path; + break; + } default: break; } diff --git a/src/commands/workflow.ts b/src/commands/workflow.ts index 28d83d6..14f66e2 100644 --- a/src/commands/workflow.ts +++ b/src/commands/workflow.ts @@ -417,6 +417,7 @@ const ACTION_TYPES = [ 'createRecord', 'updateRecord', 'getRecords', + 'sendNotification', ] as const; export function actionCommand(): Command { @@ -445,6 +446,11 @@ export function actionCommand(): Command { .option('--target-table ', 'Target table id (createRecord/updateRecord/getRecords)') .option('--records ', 'Records JSON array (createRecord/updateRecord)') .option('--query ', 'Query JSON (getRecords)') + .option('--to-user ', 'Recipient user id (sendNotification)') + .option('--title ', 'Notification title (sendNotification)') + .option('--message ', 'Notification message (sendNotification)') + .option('--severity ', 'Notification severity info|warning|critical (sendNotification)') + .option('--path ', 'Click-through path, e.g. /base/xx/table/yy (sendNotification)') .option('--name ', 'Optional node display name') .option('--base-id ', 'Base id (overrides default)') .action( @@ -652,6 +658,14 @@ export function buildActionConfig(opts: Record): Record