Initial team BPM workspace with managed connections, scanning and mail templates
This commit is contained in:
commit
34770ed338
101 files changed
+6499
No files matched your search
@@ -0,0 +1,40 @@
|
||||
# PDF Export Tool Implementation Plan
|
||||
|
||||
> **For agentic workers:** Execute inline using executing-plans. No delegation required.
|
||||
|
||||
**Goal:** Reuse a logged-in Chrome order tab to export a named PDF without a print dialog.
|
||||
|
||||
**Architecture:** MV3 extension captures a static visible form and permitted assets, then POSTs it to a paired loopback Node service. An isolated offline Chromium process renders the PDF, with exclusive filename reservation preventing overwrite.
|
||||
|
||||
**Tech Stack:** Node.js 22+, playwright-core, Chrome MV3, node:test.
|
||||
|
||||
**Spec:** docs/tool-design.md
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- No remote debugging port or account credential persistence.
|
||||
- Only user-triggered captures of https://bpm.skyworthdigital.com/.
|
||||
- Local helper listens on 127.0.0.1:18765; requests need extension Origin and random pairing token.
|
||||
- Four naming fields required; existing files preserved.
|
||||
- Browser renderer has scripts and network disabled.
|
||||
|
||||
## Task 1: Export core
|
||||
|
||||
- [x] Write tests for missing fields, Windows-safe names, collision preservation and real PDF bytes.
|
||||
- [x] Run `node --test tests/core.test.cjs` and confirm missing functionality fails.
|
||||
- [x] Implement `src/exporter.cjs`: `buildFilename(metadata)`, `renderSnapshot(snapshot, options)` and offline browser lifecycle.
|
||||
- [x] Run tests using installed Chrome and local fixture markup.
|
||||
|
||||
## Task 2: Browser capture and bridge
|
||||
|
||||
- [x] Write DOM fixture tests for `captureOrder()` bindings, live values and hidden secrets removal; write HTTP tests for origin, token and size checks.
|
||||
- [x] Confirm tests fail before implementation.
|
||||
- [x] Implement extension capture, asset bundling and popup; implement `src/server.cjs` with authenticated POST `/export` and GET `/health`.
|
||||
- [x] Run tests; malformed submissions must never start a renderer or write a file.
|
||||
|
||||
## Task 3: Packaging and acceptance
|
||||
|
||||
- [x] Add direct Node Windows command launcher, configuration example, dependency setup and Chinese README.
|
||||
- [x] Run full tests and real captured-page regression, render the resulting PDF and inspect pages.
|
||||
- [x] Check extension manifest and scripts; document that live extension loading requires user action and is not yet verified.
|
||||
- [x] Deliver startup and extension-loading paths, output naming and exact verification limits.
|
||||
@@ -0,0 +1,62 @@
|
||||
# Application Framework Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development. Steps use checkbox syntax for tracking.
|
||||
|
||||
**Goal:** 搭建可运行、可演示的多人订单工作台框架,暂不执行订单处理规则。
|
||||
|
||||
**Architecture:** 既有 dashboard 账号认证保护新增 workspace API。SQLite 保存业务日历、异常和连接元数据;独立浏览器模块渲染新增页面;隔离演示服务提供可查看的样例。
|
||||
|
||||
**Tech Stack:** Node.js >=22.13、CJS、node:sqlite、Tabler 1.6.1、原生浏览器 JS。
|
||||
|
||||
**Spec:** docs/superpowers/specs/2026-10-16-application-framework-design.md
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- 知会不自动处理,业务规则后续确定;自动发送永远关闭。
|
||||
- 新 BPM 主站 bpmn.skyworthdigital.com,详情 bpm.skyworthdigital.com。
|
||||
- 没有 Git 仓库,直接在已指定工作目录开发;不虚构提交或分支。
|
||||
- 真实登录画面、凭据存储、ZCode 和通知本次只保留接入边界,不能显示已成功连接。
|
||||
- 不写入或提取用户当前 BPM 会话。
|
||||
|
||||
## 接口合同
|
||||
|
||||
`GET /api/workspace` 返回 `{calendar:{version,overrides},exceptions,connections,supervisor:{version,defaultOwner,notifyChannel,maxAttempts},audit,members,capabilities:{remoteLogin:false,zcode:false,automaticProcessing:false},stats}`。
|
||||
|
||||
`POST /api/calendar` 管理员保存 `{version,overrides:[{date,kind,scan,send,note}]}`,kind 为 workday/restday/pause,返回 calendar。
|
||||
|
||||
`POST /api/exceptions` 操作员/管理员提交 `{title,component,priority,description,owner}`,返回 exception。component 为 bpm/pdf/archive/mail/system/rules;priority 为 normal/high/critical。
|
||||
|
||||
`POST /api/exceptions/:id/action` 提交 `{version,action,owner?,note?}`,action 为 claim/transfer/verify/resolve/reopen,返回 exception。owner 使用 username。
|
||||
|
||||
`POST /api/connections` 管理员创建 `{name,owner}`,返回 connection,status 固定 disconnected;`POST /api/connections/:id/disable` 停用;不提供伪造登录态接口。
|
||||
|
||||
`POST /api/supervisor` 管理员保存 `{version,defaultOwner,notifyChannel,maxAttempts}`,渠道 none/manual,次数 0–3,均为策略草稿;返回 supervisor。GET 中 members 为 `{username,role}` 列表。
|
||||
|
||||
### Task 1: Backend workspace ledger and protected APIs
|
||||
|
||||
Files: src/workspace-store.cjs, src/workspace-api.cjs, src/dashboard.cjs, src/schedule.cjs, tests/workspace.test.cjs, tests/workspace-http.test.cjs.
|
||||
|
||||
- [x] 先写并运行持久化、日期覆盖、并发认领、权限和同源测试,确认缺失行为失败。
|
||||
- [x] 实现 SQLite 事务、有效值校验、版本冲突、独立审计。构造 `new WorkspaceStore(dir)`,提供 `snapshot(members)`、`saveCalendar(input,actor)`、`createException(input,actor,members)`、`actOnException(id,input,actor,members)`、`createConnection(input,actor,members)`、`disableConnection(id,actor)`、`saveSupervisor(input,actor,members)`、`close()`。
|
||||
- [x] dashboard 允许 `{workspace,previewUserId}` 选项;`GET /api/bootstrap/status` 额外返回 preview 布尔值;预览登录仅在配置 previewUserId 且 loopback 时由同源 `POST /api/preview-login` 签入该用户。正式实例没有此捷径。
|
||||
- [x] `nextSlots(schedule,from,count,overrides=[])` 使用 send 覆盖,另导出 dayPolicy(date,schedule,overrides) 返回 `{scan,send,kind,note}`。
|
||||
- [x] 运行新增与原测试,交付更改清单和测试证据。
|
||||
|
||||
### Task 2: Functional workspace UI
|
||||
|
||||
Files: web/workspace.js, web/app.js, web/index.html, web/app.css.
|
||||
|
||||
- [x] 复用当前认证与视图路由,独立 `window.WorkspaceViews` 提供 overview/calendar/exceptions/bpm/supervisor 渲染器,调用 `configure({api,esc,formatDate,notify,user})`,每个渲染器接受 `(container,isActive)`,防止过期响应覆盖。
|
||||
- [x] 新总览展示能力状态、日历、异常、连接及最近活动,示例数据显式标识;保留 PDF 列表入口。calendar 月历可翻月、选日期、编辑公司覆盖、恢复默认并保存。
|
||||
- [x] 异常建立/搜索筛选/认领/转交/提交验证/填写核验依据关闭,显示历史和负责人。连接创建/停用可用,远程登录按钮禁用并解释接入状态。监管可保存草稿,无真实 AI/通知开关。
|
||||
- [x] 首页保留普通账号登录;仅 preview=true 时提供“进入演示空间”按钮调用 preview-login。
|
||||
- [x] 原导航测试与浏览器表单回归。
|
||||
|
||||
### Task 3: Runtime, isolated preview and verification
|
||||
|
||||
Files: src/server.cjs, scripts/preview.cjs, package.json, README.md, 启动看板预览.cmd.
|
||||
|
||||
- [x] 正式服务本地数据目录初始化 WorkspaceStore 并注入,退出时释放;新增 npm run preview。
|
||||
- [x] 演示数据独立目录,生成随机预览账号密码,不输出凭据;只在演示进程注入 previewUserId,绑定 loopback,预置虚构异常和连接,显式示例。
|
||||
- [x] 运行全套 node tests 和 JS 语法检查,启动正式和演示服务,浏览器验证日历保存及异常流转,截图并打开成品。
|
||||
- [x] 更新 README 的能力范围、端口、运行方法和未接入边界。
|
||||
@@ -0,0 +1,22 @@
|
||||
# SDD ledger — plan: docs/superpowers/plans/2026-10-16-bpm-credentials.md
|
||||
|
||||
Authorization: user explicitly said '可以的,账号也需要托管。' after first real login deployment.
|
||||
Ruling: extend encrypted vault to host BPM account/password; previous no-password-persistence stance is superseded by this explicit request. Password never returned/logged or captured implicitly from remote typing.
|
||||
Ruling (superseded): initial fill-only restriction replaced by explicit user requirement for automatic custody and no repeated login. Cookie-first ensure, verified SSO auto-submit, challenge-only manual intervention; business processing remains later scope.
|
||||
Ruling: current designated non-Git workspace is implementation destination; no worktree/commits.
|
||||
|
||||
| Interface/task | Check | Outcome |
|
||||
|---|---|---|
|
||||
| 1 ↔ 2 | account GET/POST, clear and fill verbs/shapes | exact shared contract above |
|
||||
| 1 ↔ 3 | no secret metadata/audit, restart/disable lifecycle | explicit tests and review |
|
||||
| Task 1 | reuse vault no plaintext credential storage | consistent |
|
||||
| Task 2 | write-only password form, stale-page guards | consistent |
|
||||
| Task 3 | production user enters credentials | no need agent account access |
|
||||
|
||||
Existing deployed first-step baseline: 54/54 tests, actual service PID42884 ports18765/18766, no preview listener, one real admin and BPM主连接 preserved; pending actual user login.
|
||||
|
||||
Parent implementation: dashboard-sessions.cjs persists hashed workbench tokens for 30 sliding days and revocation across restarts; RED missing module/restart401 -> GREEN2/2. bpm-custodian.cjs startup and 5-minute sequential ensure, no overlap, interactive/disabled skip, stop waits; RED absent -> GREEN2/2. Runtime lifecycle integrated. Backend/UI independent tasks implement credential encryption, safe metadata, exact forms, automatic reuse/cooldown, interface password clearing and navigation lifecycle. Full regression/review/deployment pending.
|
||||
|
||||
Final: all three implementation tasks and independent review complete. Full final suite 76/76 PASS; syntax38/38 PASS; backend focused27/27 PASS. Review P2 partial portal state loss reproduced and fixed; repeated ensure/restart now retains portal without repeated password submission. Whole UI+server+real local browser integration covers account save after manual login, positive cookie reuse, no secret metadata/password DOM return. Actual production restarted once after all checks: PID23632 ports18765/18766, required=false/preview=false, stderr empty. Original user and connection kept; no real managed credential entered by agent, actual BPM authenticated renewal/30 elapsed days not claimed. User only needs initial account entry in product; no repeated permission/login prompts introduced.
|
||||
|
||||
Latest user ruling: only new BPM, no legacy maintenance. Removed legacy auth origin/form/probe/navigation/UI/check and partial results. Portal positive identity alone is connected. Added transactional connection metadata migration preserving owner/identity/lastConnectedAt and stripping old fields. RED portal-only/detail rejection/old-origin regressions -> GREEN; final complete suite79/79, syntax39/39, independent delta review29/29 approved. Production PID18800 ports18765/18766 healthy, stderr empty, one existing user and one connection retained, no legacy fields. Cookie custody/automatic checks/30-day workbench sessions retained. No real credentials or business mutations.
|
||||
@@ -0,0 +1,58 @@
|
||||
# BPM Account Custody Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task.
|
||||
|
||||
**Goal:** 为实际 BPM 连接增加加密账号托管、Cookie 复用、自动保活/续登及持久 30 天工作台登录。
|
||||
**Architecture:** 复用 AES-GCM/DPAPI vault 的独立 account:id 条目,API 只返回账号元数据,远程浏览器只在已验证登录控件填入。
|
||||
**Tech Stack:** Existing Node CJS/Playwright/Tabler/vault.
|
||||
**Spec:** docs/superpowers/specs/2026-10-16-bpm-login-design.md 已授权的账号托管补充。
|
||||
|
||||
**最新范围(取代下文旧版/双入口描述)**:用户明确只维护新版 BPM。仅 bpmn.skyworthdigital.com 与其 sso 登录跳转;移除旧版域名白名单、表单、导航、检查与 UI,portal 正向验证即 connected,checks 仅 portal,不再 partial。现有连接迁移去除旧字段,保留负责人、会话和业务数据。新版托管、30 天工作台会话、5 分钟保活与验证码人工介入继续适用。
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- 用户已明确要求账号托管;不创建、重置或显示真实密码;用户在产品页面自行输入。
|
||||
- 不记录密码或截图;按用户后续明确要求自动托管,仅在正向确认需登录的已验证 SSO 表单提交凭据;不代解验证码,不修改 BPM 业务。
|
||||
- 继续保留正式管理员/主连接;不得动现有用户浏览器 Cookie。
|
||||
- 在当前非 Git 工作区工作,先有失败测试再实现;产品页面不出现设计思考文案。
|
||||
|
||||
## Task 1: Managed account backend and fill
|
||||
|
||||
Files: src/bpm-session-manager.cjs, src/bpm-api.cjs, tests/bpm-account.test.cjs, tests/bpm-http.test.cjs (add tests, preserve existing).
|
||||
|
||||
Interfaces: manager.account(connection,principal) -> {configured,username,updatedAt}; manager.saveAccount(connection,principal,{username,password}) -> metadata; manager.clearAccount(connection,principal) -> {configured:false,username:'',updatedAt:null}; manager.fillAccount(connection,principal) -> {filled:boolean,message:string}. Same owner/admin authorization and perconnection serialization; save validates strict keys username nonempty<=150 chars/password nonempty<=256 chars, no trim of password. account:id vault entry stores username/password/updatedAt; return no password. manager.disable also removes account entry. save/clear don't require active browser; fill requires current session lease and drains queue. Production fill selectors only exact https://sso.skyworthdigital.com #username/#password and https://bpm.skyworthdigital.com #_txtUserId/#_txtPassword (allow injected fixture selectors through known-host constructor testing configuration only, never API). Fill only visible text/password input expected types, bounded wait, NEVER click submit. create/navigate internally attempt saved fill, unknown form no-op. When no account fill returns concise actionable error. Do not write back browser-field edits into account vault implicitly.
|
||||
|
||||
API: /api/connections/:id/account GET metadata, POST username/password save; /account/clear POST empty; /login/fill-account POST empty. Same role, same-origin POST and secureBpmTransport guards. GET metadata only authorized owner/admin. Only username metadata returned; no raw vault errors. Record audit save/clear using connection name (no password). Existing routes must remain unchanged.
|
||||
|
||||
- [ ] Write failing persistence/auth/unknown-host/DOM-type/submit-never-called tests.
|
||||
- [ ] Implement methods and API routes.
|
||||
- [ ] Verify ciphertext contains neither username nor password, restart metadata/fill works, disable removes both, no secret response/audit.
|
||||
- [ ] Run focused tests and self-review.
|
||||
|
||||
## Task 2: Account UI
|
||||
|
||||
Files: web/bpm.js, web/app.css, tests/bpm-ui.test.cjs.
|
||||
|
||||
Add 管理账号 to authorized connection cards. GET /connections/:id/account to show configured username or 未托管; an inline editor asks BPM账号 and 托管密码 (password type, autocomplete new-password, never prefilled stored value). 保存账号 POST same route; clear fields after success. Existing configured account updating requires entering a new password; placeholder 输入新密码以更新. 清除托管 POST account/clear; no account controls for viewers/unrelated operator/disabled connections. Remote toolbar offers 填入托管账号 when metadata says configured; serialize after input queue, track operation for disposal, standard busy/error controls. UI copy concise user actions only; no technical/internal disclaimers. Preserve all current input/lifecycle/CSP behavior.
|
||||
|
||||
- [ ] Add meaningful failing UI tests for permissions, password handling and API body.
|
||||
- [ ] Implement form, metadata and fill action.
|
||||
- [ ] Verify no saved-password DOM value, no password in cards/localStorage, stale forms do not mount after navigation; run existing UI tests.
|
||||
|
||||
## Task 3: Review, regression and deployment
|
||||
|
||||
Files: README.md, docs/verification.md, this plan ledger.
|
||||
|
||||
- [ ] Independent read-only security/correctness review of account backend + UI.
|
||||
- [ ] Full suite and syntax pass; restart only verified project process and preserve existing data.
|
||||
- [ ] Show actual account management page. User enters actual account/password once; automatic checks and renewal operate thereafter, challenge handling remains in remote window. No test users in production.
|
||||
|
||||
## Subsequent authorized scope: automatic custody and thirty days
|
||||
|
||||
用户明确要求“不要每一次都登入”“至少要30天有效”。以下规则取代前述任务中仅填入而不提交的限制:
|
||||
|
||||
- manager.ensure 先验证已有 Cookie,健康时持久保存刷新状态,不提交凭据。只有正向确认登录页才尝试受限自动提交。网络失败、身份冲突、未知表单、验证码均不盲目重登;提交前持久化 15 分钟冷却。
|
||||
- 首次托管/同一托管账号更新密码保留有效会话;更换已托管用户名清除旧身份与会话。清除账号只删除托管凭据;停用删除会话与凭据。
|
||||
- 新增 BpmCustodian:启动即检查,每 5 分钟顺序检查,跳过人工操作租约和停用连接,关闭服务等待检查结束。没有业务动作或外部通知。
|
||||
- 新增 SessionStore:SQLite 仅持久 token 哈希,30 天滑动有效期,每日活动续期,重启可恢复,退出撤销。隔离演示/正式空间。
|
||||
- 外部 BPM 服务端有权撤销/强制过期,不伪造 Cookie 期限;使用保活和自动续登达到持续托管。实际 30 天运行尚需时间验证。
|
||||
@@ -0,0 +1,35 @@
|
||||
# SDD ledger — plan: docs/superpowers/plans/2026-10-16-bpm-login.md
|
||||
|
||||
User authorization: first real BPM login step approved; admin creation confirmed by user.
|
||||
|
||||
Ruling: use designated non-Git workspace and document progress here — no repository exists, so commits/worktree helper do not apply.
|
||||
Ruling: keep dev-only preview fixture for existing regression tests, stop its service and remove product/demo entry plus root preview launcher — preserve all user data.
|
||||
Ruling: verify old portal login separately but do not open old orders automatically — individual detail permission belongs to the later collection task.
|
||||
|
||||
| Pair/task | Interface/content check | Outcome |
|
||||
|---|---|---|
|
||||
| 1 ↔ 2 | manager signatures + principal session identity | exact shared contract above |
|
||||
| 2 ↔ 3 | route verbs, JSON and JPEG | exact shared contract above |
|
||||
| 1 ↔ 4 | constructor stateDir + shutdown | local protected storage and graceful close |
|
||||
| 3 ↔ 4 | static asset /bpm.js | integrator verifies route registration |
|
||||
| Task 1 | browser auth fixtures test isolation and restart | consistent |
|
||||
| Task 2 | metadata not trusted from request; role + transport tests | consistent |
|
||||
| Task 3 | frame stream disposal and ordered input | consistent |
|
||||
| Task 4 | deployment preserves administrator/data | consistent |
|
||||
|
||||
Preview service PID 3284 verified project scripts/preview.cjs and stopped; demo tab closed. Existing formal tab confirms admin signed in.
|
||||
|
||||
Ruling: include exact HTTPS sso.skyworthdigital.com — dedicated new browser observed bpmn redirect to company SSO with username/password controls; required for already-authorized primary portal login. No wildcard hosts.
|
||||
Ruling: private in-process CDP request guard may enforce all redirect hops; no CDP endpoint exposed — Playwright routes alone miss redirected browser requests.
|
||||
|
||||
Task 2: complete — HTTP/store/role/transport/restart focused checks 16/16 passed. Cross-layer review dispatched.
|
||||
Task 4 integration: real formal-dashboard-to-isolated-BPM-fixture test passed under production CSP; exercised typed login, JPEG display, save, close, reload, restored check. Runtime restart/admin preservation test passed in Task 2 focused run.
|
||||
TDD runtime red: main export absent; implemented isolated startup/stop and manager wiring.
|
||||
|
||||
Task 1: complete initial implementation — 9/9 focused checks; actual new dedicated browser reached SSO username/password and legacy username/password/captcha fields with JPEG output, no credentials entered. Review fixes under execution.
|
||||
Task 3: complete initial implementation — 9/9 UI/navigation checks. Final review found pending-open unload cleanup skipped close; implementer reproduced real unload and is fixing synchronous keepalive cleanup.
|
||||
Task 2 review: API approved after partial task fix — initial partial creates none, previously connected partial creates a check task, repeated partial/login_required dedup, wording does not assert network failure means expired. Focused re-review10/10 passed.
|
||||
Ruling: partial after previous connected warrants owner attention, title 'BPM 连接需要检查' rather than an expiry claim — correct prior brief to match plan's attention requirement and avoid false statuses.
|
||||
Task 1 review: parent whole UI integration exposed immediate save racing login reload; reviewer reproduced both read-only verification navigations interrupted by login navigation. Implementer added CDP lifecycle settling and bounded interrupted-navigation retry, no replay of login submissions.
|
||||
|
||||
Final first-step regression: 54/54 passed, 0 skipped/failures; all changed JS syntax checks passed. Independent API/UI and browser/vault/runtime reviewers approved after fixes. Formal service restarted as verified PID42884, 18765 localhost + 18766 shared dashboard, no18776 listener. Production bootstrap required=false; existing one admin and BPM主连接 preserved. Formal browser tab reloaded to normal login screen; user asked to self-login/check/save. User instead added account托管 requirement, continued under docs/superpowers/plans/2026-10-16-bpm-credentials.md.
|
||||
@@ -0,0 +1,55 @@
|
||||
# BPM Login Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task.
|
||||
|
||||
**Goal:** 在正式工作台完成独立 BPM 登录、加密保存、恢复及续登。
|
||||
**Architecture:** 独立浏览器会话管理器 + 鉴权路由 + JPEG 远程登录界面。
|
||||
**Tech Stack:** Node CJS、node:sqlite、Playwright、Windows DPAPI、原生 Web。
|
||||
**Spec:** docs/superpowers/specs/2026-10-16-bpm-login-design.md
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- 保留已有管理员及业务数据;不发送通知或修改 BPM 流程。
|
||||
- 产品页面不出现设计思考、内部免责声明。
|
||||
- 无 Git 仓库,在当前指定工作区修改,不提交。
|
||||
- 所有新行为先写测试,观察缺失行为失败,再实现;最后完整测试与审查。
|
||||
|
||||
## Task 1: Browser manager and encrypted vault
|
||||
|
||||
Files: src/bpm-session-manager.cjs, src/bpm-vault.cjs, tests/bpm-session.test.cjs, tests/bpm-vault.test.cjs.
|
||||
|
||||
Interface: BpmSessionManager({stateDir, browserFactory?, urls?, allowedOrigins?, probe?}) supports async open(connection,principal), frame(id,principal), input(id,principal,action), navigate(id,principal,{target}), save(connection,principal), check(connection,principal), close(id,principal), releaseSession(sessionId), disable(id), shutdown(). principal={user:{id,username,role},sessionId}. open/frame/input require exclusive session, TTL 10min, 3 slots max. open returns {active:true,viewport:{width:1280,height:800},expiresAt,host}. frame returns JPEG Buffer. input types click{x,y}, text{text}, key{key}, scroll{deltaX,deltaY}. key allowlist supports Tab/Enter/Backspace/Delete/arrows/Home/End/Escape/Control+A; text max 2000. navigate target main/detail/reload/back, no arbitrary URL. save/check return {status,identity,checkedAt,checks:{portal:{ok,message},detail:{ok,message}}}. statuses connected/partial/login_required/error. Failed verification must not replace previously saved auth state. Errors safe status-coded without secrets. Only exact BPM HTTPS origins by default; injected localhost origins for tests only. vault authenticated encryption atomic writes and Windows DPAPI-protected key. Browser tests use local fixture, demonstrate save, manager shutdown/restart/recheck, isolated connections, expired lease, malicious navigation/input, encryption corruption.
|
||||
|
||||
- [ ] Write failing tests and record red result.
|
||||
- [ ] Implement manager/vault against interfaces.
|
||||
- [ ] Run focused tests; report API deviations and pass evidence.
|
||||
|
||||
## Task 2: Authenticated API and persisted metadata
|
||||
|
||||
Files: src/bpm-api.cjs, src/dashboard.cjs, src/workspace-api.cjs, src/workspace-store.cjs, tests/bpm-http.test.cjs, tests/workspace.test.cjs.
|
||||
|
||||
Consumes manager Task1 interface. createDashboard receives optional bpmSessions and trustedProxy boolean; async bpmApi runs after auth before workspaceApi. Routes /api/connections/:id/login/{open,frame,input,navigate,save,close} and /api/connections/:id/check; GET frame JPEG, others POST. /disable closes manager before Store metadata. Authorize admin or exact owner operator; block viewer and unrelated operator. principal.sessionId is dashboard token, never response. Check/save persist manager result via internal WorkspaceStore updateConnectionSession(id,result,actor), not user-supplied status. Internal getConnection and startup markSessionChecksPending reset connected/partial to unchecked while preserving safe last-check metadata. snapshot capability remoteLogin true only with active manager wiring. Deduplicated expiry exception for connection from partial/login_required check when previous saved connected; check failure doesn't auto-close task. Release manager on logout. Remote credentials endpoints only encrypted socket, loopback Host+remoteAddress, or configured local proxy with X-Forwarded-Proto:https. Do not trust arbitrary proxy headers.
|
||||
|
||||
- [ ] Write failing HTTP tests for owner/session/origin/transport and persistence.
|
||||
- [ ] Implement authenticated routes and metadata, preserve original tests.
|
||||
- [ ] Run focused tests and provide review notes.
|
||||
|
||||
## Task 3: Actual BPM remote login UI
|
||||
|
||||
Files: web/bpm.js, web/workspace.js, web/app.js, web/index.html, web/app.css, tests/bpm-ui.test.cjs.
|
||||
|
||||
Expose window.BpmLogin.mount(container,{api,esc,formatDate,notify,user,isActive}) and .dispose(). WorkspaceViews.bpm delegates mount. API routes Task2; API helper supports JSON POST/GET; GET frame fetched separately as blob. Connection cards show statuses disconnected/unchecked/login_required/partial/connected/disabled/error; only admin or owner operator has login/check actions; create admin only. Remote login image frame with click scaling, ordered keyboard/text/paste/IME input, scroll. Preserve password secrecy (no localStorage/logging), no persistent screenshot. Navigation buttons 新版门户/旧版入口/刷新; 检查并保存/关闭. Poll with no overlap; dispose releases remote lease and objectURLs, stops timers and stale navigation. Disable refresh/navigation while save in progress as needed. Proper concise statuses and errors; no claims unverified. Remove demo UI entry and branding from formal app; legacy dev preview fixture may remain test-only. Adapt overview login summary. Product must stay usable at narrow viewport.
|
||||
|
||||
- [ ] Write focused meaningful lifecycle/coordinate/input tests before implementation.
|
||||
- [ ] Implement page and remote login controls.
|
||||
- [ ] Run syntax/UI tests and report completion.
|
||||
|
||||
## Task 4: Integration, real deployment, review
|
||||
|
||||
Files: src/server.cjs, README.md, docs/verification.md, config.example.json and plan ledger.
|
||||
|
||||
- [ ] Instantiate manager in local stateDir/bpm-sessions, reset stale metadata; close it on shutdown/error.
|
||||
- [ ] Stop existing preview process only; remove user-facing preview launch emphasis.
|
||||
- [ ] Full test suite, syntax checks, independent read-only code review and fixes.
|
||||
- [ ] Restart verified formal project process, preserve data, inspect actual Web and BPM login screen.
|
||||
- [ ] Report running URL, completed behavior and any real login still requiring user interaction.
|
||||
@@ -0,0 +1,7 @@
|
||||
# 实施计划
|
||||
|
||||
1. 测试先行:本地 HTTP 列表模拟、日期解析与 SQLite 去重/持久化/原子性。
|
||||
2. 新门户只读 API 适配器与 BpmSessionManager 互斥接入,会话失效使用既有续登。
|
||||
3. 扫描数据库、生命周期、日历调度、手动扫描与权限路由。
|
||||
4. 每日分区视图与真实接入状态,保留 PDF 记录。
|
||||
5. 专项和全量测试、代码审查、重启正式服务、真实扫描和浏览器验证。
|
||||
@@ -0,0 +1,21 @@
|
||||
# SDD ledger — plan: docs/superpowers/plans/2026-10-16-application-framework.md
|
||||
|
||||
Ruling: 用户已明确要求先实现并运行框架,继续本会话执行 — 不重复询问设计批准 — 规则变动仍可后续调整。
|
||||
Ruling: 非 Git 工作目录直接开发,不创建仓库或 worktree — 保持用户指定启动目录 — 需依赖文件和测试审查。
|
||||
Ruling: Web 远程登录本轮提供诚实接入边界,先交付可运行管理框架 — 用户明确先框架 — 实际远程登录另需联调。
|
||||
|
||||
| 任务/接口 | 检查结论 |
|
||||
|---|---|
|
||||
| Task1/Task2 workspace API | 共享接口如计划合同,前端不依赖数据库细节 |
|
||||
| Task1/Task3 dashboard 参数 | workspace、previewUserId 注入,正式启动不配置预览用户 |
|
||||
| Task2/Task3 示例标识 | bootstrap/status.preview 驱动,示例数据与正式独立 |
|
||||
| Task1 内部 | 事务/版本、权限、日历测试分别覆盖 |
|
||||
| Task2 内部 | 独立模块、当前页面检查、功能与禁用边界一致 |
|
||||
| Task3 内部 | loopback 预览与正式 LAN 服务分开,文档如实说明 |
|
||||
|
||||
Task 1: complete — SQLite/API、权限/同源、日期与版本冲突已测试;后端独立审查通过。
|
||||
Task 2: complete — 五个实际工作页面与表单、角色限制、审计、示例标识;前端独立审查通过。
|
||||
Task 3: complete — 正式服务及 loopback 演示已启动;27/27 回归与语法检查通过;浏览器保存/转交/关闭/重启保留验证通过;README 与验证记录更新。
|
||||
|
||||
Ruling: 演示与正式空间 Cookie 使用不同名字 — 浏览器 Cookie 不按端口隔离,原同名会互相覆盖 — 回归已覆盖。
|
||||
Ruling: 目录不是 Git 仓库,finishing 分支/合并菜单不适用 — 交付运行文件和可访问页面,不创建虚构提交。
|
||||
@@ -0,0 +1,10 @@
|
||||
# 邮件接入实施计划
|
||||
|
||||
1. 测试驱动 MIME 解析:中文、HTML/CID、附件、指令主题、来源授权、大小限制。
|
||||
2. 测试驱动 SQLite 邮箱/游标/模板版本/发送记录:密文、唯一邮箱、配置版本、幂等、人工确认冲突、历史。
|
||||
3. 实现 SMTP 验证、IMAP 只读收信、每分钟轮询、停止释放,以及明确操作的测试发信。
|
||||
4. 接入登录/同源/角色约束的 API;服务生命周期与总览读取真实状态。
|
||||
5. 新增邮箱管理与模板审核 UI,保留收件群组,迁移旧草稿;浏览器操作验证。
|
||||
6. 执行全部测试、依赖审计、更新说明,重启并核验正式服务。
|
||||
|
||||
工作区无 Git;直接在现有目录实施,凭据仅由用户在 Web 配置。
|
||||
@@ -0,0 +1,18 @@
|
||||
# Web Dashboard Implementation Plan
|
||||
|
||||
> Execute inline. Reuse Tabler UI; preserve the existing extension bridge.
|
||||
|
||||
**Goal:** Deploy a shared authenticated LAN dashboard with persistent settings and export records.
|
||||
|
||||
**Spec:** docs/web-dashboard-design.md
|
||||
|
||||
**Architecture:** Separate dashboard HTTP server, local persistent store, existing loopback exporter with record callback; locally hosted Tabler assets.
|
||||
|
||||
- [x] Write and run failing store tests: defaults, two times validation, optimistic concurrency, user roles and password hashing, persistent job records.
|
||||
- [x] Implement `src/dashboard-store.cjs` and `src/schedule.cjs`; run store tests.
|
||||
- [x] Write and run failing HTTP tests: loopback-only bootstrap, sessions, authorization, same-origin mutation, configuration restart persistence and PDF download containment.
|
||||
- [x] Implement `src/dashboard.cjs`, connect export status callbacks in `src/server.cjs`.
|
||||
- [x] Install pinned `@tabler/core`; adapt existing Tabler sidebar/cards/tables/forms in `web/`, preserve license.
|
||||
- [x] Add login/bootstrap, overview, export records, sending plan, templates/groups, users and audit pages with real API bindings.
|
||||
- [x] Verify full test suite, launch local dashboard, inspect desktop layout and actual save/reload via browser. Narrow viewport override did not change the IAB dimensions; mobile acceptance remains pending.
|
||||
- [x] Document LAN host/port, deployment-machine setup and pending table/template integration. Do not enable mail sending.
|
||||
@@ -0,0 +1,15 @@
|
||||
# 订单通知中心应用框架
|
||||
|
||||
用户已授权先搭建运行框架,处理规则后续确定;知会不自动处理。沿用 Node.js/CJS、Tabler 和既有账号/PDF 能力。
|
||||
|
||||
本次交付:可运行的工作台;持久业务日历;异常建立、认领、转交、待验证、人工确认关闭;BPM 连接元数据管理;监管策略草稿;本机独立演示空间。真实 BPM 远程浏览器、Cookie 保存、自动扫描、ZCode 调用、对外通知和邮件发送保留接口边界,界面明确尚未接入,不制造成功状态。
|
||||
|
||||
多人通过同一服务器访问。viewer 只读,operator 处理异常,admin 管理连接、日历与监管配置。沿用登录、同源校验和审计。连接主站固定新版 bpmn.skyworthdigital.com,详情 bpm.skyworthdigital.com;元数据不接收密码、Cookie 或任意站点 URL。
|
||||
|
||||
新增业务框架使用本机 SQLite,既有用户/模板/PDF JSON 保留兼容。日历与监管配置有版本号,异常流转使用版本校验和事务,拒绝并发覆盖。日期必须真实存在;公司显式日期覆盖每周默认规则,采集和发送分别计算;实际发送始终关闭。
|
||||
|
||||
异常 status 为 open/in_progress/verifying/resolved。认领仅限未认领,转交须有效团队账号及原因;处理者或管理员提交验证,待验证后以记录人工核验依据关闭;记录每次流转。人工核验只代表工具内记录,不声称对外系统结果已自动验证。
|
||||
|
||||
Web 增加工作总览、业务日历、异常待办、BPM 连接、运行监管。保留导出、模板、团队和审计。演示空间绑定 127.0.0.1 独立端口 18776,显著标识示例数据,使用独立本地数据目录和预置虚构数据,不连接业务系统;正式服务仍使用 18766 和账号登录。
|
||||
|
||||
验收:日历跨周末覆盖和停发预览;异常重启持久、重复认领冲突、转交审计、只读限制;连接不能伪造已登录;监管设置不能开启实际自动执行;原测试回归;浏览器查看页面及表单提交,截图交付。
|
||||
@@ -0,0 +1,21 @@
|
||||
# BPM Web 登录与会话
|
||||
|
||||
用户已确认多人在各自电脑访问一台服务器,并明确只维护新版 BPM。唯一业务入口为 https://bpmn.skyworthdigital.com,登录跳转为 https://sso.skyworthdigital.com;不访问、不检查、不提供旧版入口。账号密码由用户在工作台托管表单输入,验证码在远程登录画面完成,不导入现有浏览器 Cookie。
|
||||
|
||||
每个连接使用独立 Playwright context,工作台通过受鉴权的 JPEG 帧和有限输入事件控制服务器浏览器。仅连接负责人及管理员可登录或检查。同一连接一次只允许一个工作台登录会话控制,空闲 10 分钟关闭,最多同时 3 个;退出工作台释放其控制。不得暴露 CDP、任意脚本执行、任意网址或 Cookie 接口。生产仅允许新版门户和 SSO 两个 HTTPS 域名,禁止下载和文件上传。
|
||||
|
||||
使用 AES-256-GCM 加密 Playwright storageState(含 IndexedDB)和相关 sessionStorage;Windows 主密钥使用当前服务用户的 DPAPI 加密,文件存放本机 LOCALAPPDATA,限制目录权限。远程输入不写入日志、审计、截图文件或连接记录。截图不持久化。恢复会话后必须重新检查。
|
||||
|
||||
用户点击“检查并保存”后以新版可观察的已登录账号控件作正向验证,新版验证成功即 connected;没有足够证据显示待登录或检查失败,不存在双入口的 partial 状态。检查不自动点击知会、已阅、审批、发送等动作。需要人工验证建立去重待办,不发送外部通知。旧连接元数据自动去除 detailUrl/checks.detail,旧 partial 转 unchecked,保留负责人、身份及其他业务数据。
|
||||
|
||||
远程登录仅允许本机访问或经过明确配置的本机 HTTPS 反向代理,防止通过局域网明文输入密码。普通工作台仍可局域网访问。界面只包含用户操作、状态和简短错误,不展示设计思考或免责声明。
|
||||
|
||||
演示服务停止,正式入口继续为 18766,保留已有管理员和业务数据,不创建或重置用户密码。
|
||||
|
||||
## 已授权的账号托管补充
|
||||
|
||||
用户在正式登录功能部署后明确要求“账号也需要托管”。新增每个连接的 BPM 用户名/密码托管表单,只允许负责人和管理员在本机或可信 HTTPS 访问。用户名、密码整体加密存于独立 vault 条目,不混入会话状态或 SQLite。接口可返回是否配置、用户名和更新时间,绝不返回已保存密码。保存与清除记审计,但不记录密码。
|
||||
|
||||
打开登录时,有托管账号则填入已验证的 SSO #username/#password;也提供“填入托管账号”按钮。禁止向其他域名/未知表单填入凭据。停用连接同时关闭浏览器并清除会话和托管账号。
|
||||
|
||||
用户随后明确要求无需重复登录与至少 30 天的持续托管。工作台登录改为 30 天持久会话,服务重启继续有效,每日活动续期,退出立即撤销。BPM 由后台启动即检查并每 5 分钟保活,优先恢复有效 Cookie 并保存刷新状态。只有已确认登录过期、可识别且无验证码的正式 SSO 表单才自动提交托管凭据;网络错误或身份冲突不重登。自动提交前持久化 15 分钟冷却,验证码或额外验证转人工窗口;不自动解验证码。新 SSO 实测表单为 #kc-form-login、POST 同源 /realms/skyworthdigital/login-actions/authenticate、button[type="submit"]。外部服务端强制会话期限不可由本工具延长;通过 Cookie 复用及失效续登持续运行。
|
||||
@@ -0,0 +1,13 @@
|
||||
# BPM 自动扫描与到达日期视图
|
||||
|
||||
日期口径:流程到达当前账号的 startTime,按 Asia/Shanghai 分日。不得用发起日期、流水号中的日期或扫描时间替代。缺失日期拒绝本次扫描,不制造日期。
|
||||
|
||||
新版门户公开列表模块经认证实测:GET /skyworth/todo/v2/workflow/get_process_of_inform_v4 与 GET /bpm/worklist/informlist,page/start/limit 分页,响应 total/children。两者均属于新版门户入口,不增加旧网站支持。门户 HTML 提供当前客户端 Bearer,使用服务端加密 Cookie 取回,只在内存使用。
|
||||
|
||||
当前待阅仅为临时来源,存储 source 与真实 processName 分开;不预设订单类型过滤,后续用业务表格配置正式范围。扫描仅查询列表,不打开详情、不标记已阅、不审批、不发送邮件。
|
||||
|
||||
SQLite 保存到达记录、扫描设置及运行结果。每连接扫描全部分页成功后一次事务入库,连接/source/taskId 唯一;失败不提交半批数据,不删除列表已消失的历史记录。默认每 5 分钟,按业务日历允许扫描的日期运行。允许管理员配置,管理员及连接负责人手动扫描,只读成员查看。连接操作与现有托管互斥;有效 Cookie 优先,仅认证失效才调用既有续登。
|
||||
|
||||
订单记录页新增每日分区、到达时间、流水号、流程、当前节点、标题、发起人和连接。日期降序,支持连接/文字过滤、分页加载日期。PDF 导出记录独立保留。显示扫描状态、最近成功、失败原因,不把扫描成功等同业务处理完成。
|
||||
|
||||
验证覆盖真实 HTTP 分页/认证/禁止跨域跳转,日期与去重、重启恢复、失败原子性、并发与权限、调度日历;完成后回归全部测试、正式服务扫描与浏览器点击验证。
|
||||
@@ -0,0 +1,21 @@
|
||||
# 公司邮箱与邮件模板
|
||||
|
||||
用户已指定公司邮箱 SMTP/IMAP;模板必须先解析预览,在 Web 确认后生效。
|
||||
|
||||
## 流程
|
||||
|
||||
服务接入维护多个邮箱,各自配置 SMTP、IMAP、TLS、登录账号和授权密码、模板发件人白名单。密码加密,状态持久化到部署机 SQLite。检查连接只验证 SMTP/IMAP,不发送邮件。后台每分钟检查启用邮箱;手动检查同样复用去重游标。首次及 UIDVALIDITY 变化只扫描近 7 天,普通邮件保持原状,不标记已读。
|
||||
|
||||
主题 `[模板][产品线]发信标题` 导入指定产品线;`[模板]发信标题` 导入默认模板。只接受完整标记、直接发送而非回复/转发、单一授权发件人、投递到本邮箱的邮件。主题去除指令标记,MIME 解码得到正文和附件。HTML 消毒、阻断远程资源,CID 图片本地化;保留原始 EML。每封上限 10 MB,每轮最多 50 封,逐 UID 提交游标,失败可重试且不重复导入。
|
||||
|
||||
模板导入为待确认版本,展示标题、范围、正文、图片、附件、来源;管理员可以修改标题、范围和纯文本正文、确认或忽略。确认按相同邮箱和范围归档旧版,保留历史。确认使用导入时的活动版本进行冲突检查,避免多人或旧邮件覆盖新版本。正文调整将切换到纯文本并保留附件。无 AI 自动推断产品线或收件人,模板邮件里的 To/Cc 不会变成业务收件群组。
|
||||
|
||||
保留现有产品线群组;旧模板草稿一次性迁入待确认列表。发送接口只使用已确认版本,变量为明确的 `{{产品线}}`、`{{订单号}}`、`{{日期}}`、`{{订单列表}}`,不执行表达式。提供明确点击的发送测试到本邮箱,发送前落库,不自动重试不确定结果。订单批量发送仍由后续业务规则接入。
|
||||
|
||||
## 实现
|
||||
|
||||
采用 Nodemailer(SMTP)、ImapFlow(IMAP)、MailParser(MIME)、sanitize-html。独立 MailStore/ MailService/ mail API,接入现有认证、同源保护、管理员配置权限和服务启动停止。密钥复用现有 DPAPI/AES-GCM vault 编解码,邮箱和原文内容独立数据库。定时器不重入;邮箱配置修改后检查/收信结果不得写入新版本配置。
|
||||
|
||||
## 验证
|
||||
|
||||
先写失败测试覆盖 MIME、附件、HTML、授权、去重、确认冲突、密文、重启游标、SMTP 本地实际传输、API 权限。全量回归后部署正式服务,并通过浏览器验证邮箱表单、模板列表及预览操作。真实公司邮箱连接需要用户在网页填写参数后验证。
|
||||
Reference in new issue
Block a user