opencode-feishu-plugin 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -395,7 +395,7 @@ npm test # vitest (pure logic, no live Feishu)
395
395
  npm run dev # tsup --watch
396
396
  ```
397
397
 
398
- **Architecture**: `src/index.ts` wires everything; the Feishu interaction layer lives in `src/feishu/` (event parsing, card builders, topic routing, wizard state machine, streaming-card reducer — mostly **pure functions** for testability); `src/security/` holds token signing and the allowlist.
398
+ **Architecture**: `src/index.ts` is assembly only (config, gateway, watchdog, hook registration and cleanup); `src/runtime/` holds the unit-testable event dispatch (`event-router.ts`) and card-callback routing (`card-action-router.ts`); the session command orchestration is split under `src/session/` (`session-commands.ts` is a thin facade; implementations live in `session-list.ts` / `setup-wizard.ts` / `session-ops.ts` / `model-perm.ts` / `context.ts`); the Feishu interaction layer lives in `src/feishu/` (event parsing, card builders, topic routing, wizard state machine, streaming-card reducer — mostly **pure functions** for testability); `src/security/` holds token signing and the allowlist.
399
399
 
400
400
  **Implementation notes**
401
401
  - Cards are **JSON 2.0** (buttons directly in `body.elements`, callbacks via `behaviors`; the 1.0 `tag:"action"` container returns HTTP 400 on 2.0). Form cards add: `form` must sit at the root of `body.elements`, interactive `name`s must be globally unique, and at least one button must carry `form_action_type:"submit"`.
package/README.md CHANGED
@@ -401,7 +401,7 @@ npm test # vitest(纯逻辑单测,不连真飞书)
401
401
  npm run dev # tsup --watch
402
402
  ```
403
403
 
404
- **架构**:`src/index.ts` 装配所有部件;飞书交互层在 `src/feishu/`(事件解析、卡片构建、话题路由、向导状态机、流式卡片 reducer 等,**以纯函数为主便于单测**);安全层在 `src/security/`(token 签名、白名单)。
404
+ **架构**:`src/index.ts` 只做装配(配置、gateway、watchdog、hook 注册与 cleanup);`src/runtime/` 放可单测的事件分发(`event-router.ts`)与卡片回调分流(`card-action-router.ts`);会话命令编排拆在 `src/session/`(`session-commands.ts` 为薄门面,实现分在 `session-list.ts` / `setup-wizard.ts` / `session-ops.ts` / `model-perm.ts` / `context.ts`);飞书交互层在 `src/feishu/`(事件解析、卡片构建、话题路由、向导状态机、流式卡片 reducer 等,**以纯函数为主便于单测**);安全层在 `src/security/`(token 签名、白名单)。
405
405
 
406
406
  **设计要点**:
407
407
  - 卡片一律 **JSON 2.0**(按钮直接放 `body.elements`,回调用 `behaviors`;1.0 的 `tag:"action"` 在 2.0 会 400)。表单卡额外约束:`form` 必须在 `body.elements` 根节点、交互组件 `name` 全局唯一、至少一个 `form_action_type:"submit"` 按钮。
@@ -421,7 +421,7 @@ npm run dev # tsup --watch
421
421
  - 只接管**从飞书发起的会话**的审批;本地 TUI 会话不受影响(安全设计)。
422
422
  - 消息去重为 `get-then-set`,非原子:极端并发下理论上可能双处理(正常情况下单实例顺序处理)。
423
423
  - 话题被删除后映射不主动清理(惰性忽略)。
424
- - 建会话只有一条主路径:**`/new` 与 `/form` 等价的表单卡**;`/dir` `/model` `/perm` 仅用于给表单预填字段。旧的目录/模型/权限/确认分步卡已从 `/new` 下线(相关构建函数与兼容回调保留,标注 deprecated)。
424
+ - 建会话只有一条主路径:**`/new` 与 `/form` 等价的表单卡**;`/dir` `/model` `/perm` 仅用于给表单预填字段。旧的目录/模型/权限/确认分步卡已从 `/new` 下线(目录卡的构建函数已彻底移除;模型/权限/确认卡的构建函数与兼容回调保留,标注 deprecated,供仍持有旧卡片的用户点击时继续可用)。
425
425
  - 表单为 JSON 2.0(`form` 置于 `body.elements` 根节点,交互组件 `name` 全局唯一,提交按钮带 `form_action_type:"submit"`);部分老客户端对 `select_static` 有最低版本要求(≥ V3.7.0)。
426
426
 
427
427
  - **话题首条消息可能不带 `thread_id`**:飞书有时在事件里省略 `thread_id`(随后才归属到话题)。若此时你敲了 `/new` 这类仅限主聊天流的命令,它会被当作主聊天流命令执行(例如表单卡发到主聊天流)。遇到这种情况,直接进话题重新发普通消息即可。