bailinghub 0.9.0 → 0.9.2

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.
Files changed (139) hide show
  1. package/.dockerignore +6 -0
  2. package/.npmignore +6 -0
  3. package/CONTRIBUTING.md +4 -0
  4. package/GOVERNANCE.md +9 -0
  5. package/README.en.md +7 -6
  6. package/README.md +7 -6
  7. package/SECURITY.md +8 -2
  8. package/THIRD_PARTY_NOTICES.md +17 -17
  9. package/docker-compose.images.yml +2 -2
  10. package/docs/CHANGELOG.en.md +22 -1
  11. package/docs/CHANGELOG.md +22 -1
  12. package/docs/COMPATIBILITY.en.md +4 -0
  13. package/docs/CORE_RELIABILITY.en.md +59 -0
  14. package/docs/CORE_RELIABILITY.md +59 -0
  15. package/docs/DEPLOYMENT_DIAGNOSTICS.en.md +78 -0
  16. package/docs/DEPLOYMENT_DIAGNOSTICS.md +78 -0
  17. package/docs/IMPLEMENTATION_STATUS.en.md +81 -0
  18. package/docs/IMPLEMENTATION_STATUS.md +81 -0
  19. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  20. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  21. package/docs/KERNEL_HOST_API.en.md +20 -0
  22. package/docs/KERNEL_HOST_API.md +20 -0
  23. package/docs/MODEL_BILLING.en.md +4 -0
  24. package/docs/MODEL_BILLING.md +4 -0
  25. package/docs/MODEL_PROCESS_RECOVERY.en.md +32 -0
  26. package/docs/MODEL_PROCESS_RECOVERY.md +37 -0
  27. package/docs/README.en.md +8 -0
  28. package/docs/README.md +8 -0
  29. package/docs/RELEASE_NOTES_NEXT.en.md +3 -3
  30. package/docs/RELEASE_NOTES_NEXT.md +3 -3
  31. package/docs/RELEASE_NOTES_v0.9.1.en.md +38 -0
  32. package/docs/RELEASE_NOTES_v0.9.1.md +38 -0
  33. package/docs/RELEASE_NOTES_v0.9.2.en.md +45 -0
  34. package/docs/RELEASE_NOTES_v0.9.2.md +45 -0
  35. package/docs/UPGRADE_v0.9.1.en.md +39 -0
  36. package/docs/UPGRADE_v0.9.1.md +39 -0
  37. package/docs/UPGRADE_v0.9.2.en.md +62 -0
  38. package/docs/UPGRADE_v0.9.2.md +62 -0
  39. package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +4 -0
  40. package/package.json +10 -5
  41. package/scripts/check-doc-links.mjs +4 -0
  42. package/scripts/check-image-tags.sh +1 -1
  43. package/scripts/check-release-consistency.test.mjs +2 -2
  44. package/scripts/dependency-audit.mjs +134 -0
  45. package/scripts/dependency-audit.test.mjs +125 -0
  46. package/scripts/doctor-deployment.test.ts +419 -0
  47. package/scripts/doctor-deployment.ts +357 -0
  48. package/scripts/doctor.ts +8 -1
  49. package/scripts/install-secrets.test.mjs +185 -0
  50. package/scripts/install.sh +10 -6
  51. package/scripts/osps-results.py +114 -0
  52. package/scripts/publish-images.sh +1 -1
  53. package/scripts/release-audit.mjs +5 -0
  54. package/scripts/verify-github-repo.mjs +5 -0
  55. package/security/dependency-audit-exceptions.json +192 -0
  56. package/sql/065_usage_reconciliation_scan.sql +4 -0
  57. package/sql/066_approval_continuations.sql +15 -0
  58. package/sql/README.md +9 -0
  59. package/src/app/approval-continuations.mysql.test.ts +138 -0
  60. package/src/app/approval-continuations.test.ts +325 -0
  61. package/src/app/approval-continuations.ts +107 -0
  62. package/src/app/http-server.ts +3 -0
  63. package/src/app/kernel-model-process-crash.mysql.test.ts +377 -0
  64. package/src/app/kernel-usage-lifecycle.mysql.test.ts +325 -0
  65. package/src/app/kernel.ts +23 -0
  66. package/src/app/runtime-evidence-maintenance.test.ts +55 -0
  67. package/src/app/runtime-lifecycle-default.ts +7 -0
  68. package/src/app/runtime-lifecycle.ts +39 -0
  69. package/src/core/contracts/approval-continuation.ts +43 -0
  70. package/src/core/contracts/types.ts +2 -0
  71. package/src/core/state/approval-continuation.ts +22 -0
  72. package/src/core/state/state-codec.ts +1 -0
  73. package/src/core/state/state-contracts.ts +3 -0
  74. package/src/infrastructure/config/config-approval-ledger.ts +75 -0
  75. package/src/infrastructure/config/configstore.ts +2 -2
  76. package/src/infrastructure/state/state-jsonl.ts +41 -11
  77. package/src/infrastructure/state/state-mysql.ts +27 -0
  78. package/src/modules/usage/background-work.test.ts +144 -0
  79. package/src/modules/usage/background-work.ts +50 -0
  80. package/src/modules/usage/billing-reconciliation.mysql.test.ts +163 -0
  81. package/src/modules/usage/billing-reconciliation.test.ts +71 -0
  82. package/src/modules/usage/billing-repository.ts +60 -15
  83. package/src/modules/usage/maintenance.test.ts +62 -0
  84. package/src/modules/usage/maintenance.ts +31 -0
  85. package/src/modules/usage/model-gateway.ts +11 -3
  86. package/src/modules/usage/model-tool-gateway.mysql.test.ts +1 -1
  87. package/src/modules/usage/pricing.ts +3 -2
  88. package/src/modules/usage/repository.ts +2 -0
  89. package/src/modules/usage/test-harness.ts +2 -1
  90. package/src/routes/admin-default.ts +2 -2
  91. package/src/routes/admin-runtime-default.ts +2 -2
  92. package/src/routes/admin-runtime.test.ts +1 -1
  93. package/src/routes/admin-runtime.ts +25 -18
  94. package/src/routes/admin.ts +1 -1
  95. package/src/routes/approvals-default.ts +2 -2
  96. package/src/routes/approvals.ts +30 -33
  97. package/src/routes/critical-routes.test.ts +16 -3
  98. package/src/test-support/approval-continuation-crash-child.ts +24 -0
  99. package/src/test-support/model-process-crash-child.ts +78 -0
  100. package/web/console/assets/{Accounts-DnddhY6t.js → Accounts-DKhw_QLr.js} +1 -1
  101. package/web/console/assets/{AgentClients-VInbD7JS.js → AgentClients-CM4_5HaA.js} +1 -1
  102. package/web/console/assets/{AgentTasks-B-1XklBg.js → AgentTasks-CkQgZTU5.js} +1 -1
  103. package/web/console/assets/{Approvals-34qUPHf0.js → Approvals-B9O9TkbO.js} +1 -1
  104. package/web/console/assets/{Audit-BbVgkSm2.js → Audit-2vDC1SPu.js} +1 -1
  105. package/web/console/assets/{BrandLockup-DgscF28e.js → BrandLockup-BgASiRSE.js} +1 -1
  106. package/web/console/assets/{Channels-Bp-yuk8d.js → Channels-A-GvkNBt.js} +1 -1
  107. package/web/console/assets/{ChatEntries-C9Ft60TS.js → ChatEntries-BLxymI67.js} +1 -1
  108. package/web/console/assets/{Clients-NPldD-DD.js → Clients-DeNlmvS6.js} +1 -1
  109. package/web/console/assets/{Cost-DZcuB-EB.js → Cost-CBq_L4Kz.js} +1 -1
  110. package/web/console/assets/{Credentials-RTT7N6zl.js → Credentials-DmtbctNj.js} +1 -1
  111. package/web/console/assets/{Diagnostics-_LeK8cce.js → Diagnostics-BbcRDiA-.js} +1 -1
  112. package/web/console/assets/{Executors-Bi7H8rIm.js → Executors-gGgmQrDt.js} +1 -1
  113. package/web/console/assets/{HelpTip-BfyWrxCE.js → HelpTip-Dtdt2tKR.js} +1 -1
  114. package/web/console/assets/{Kb-BHamz8NP.js → Kb-lgY6OXUz.js} +2 -2
  115. package/web/console/assets/{Login-C1rJR-6w.js → Login-DA6BASZd.js} +1 -1
  116. package/web/console/assets/{Projects-BRA4a48v.js → Projects-DEbmB_sT.js} +1 -1
  117. package/web/console/assets/{Routes-CTC7U-fQ.js → Routes-qS6LLoyS.js} +1 -1
  118. package/web/console/assets/{Runs-B_fa_BlD.js → Runs-DG-VLRSc.js} +1 -1
  119. package/web/console/assets/{Setup-C1_d0mFy.js → Setup-DEpVF5uw.js} +1 -1
  120. package/web/console/assets/{Shell-CHEV6RGC.js → Shell-DgoPgK1E.js} +1 -1
  121. package/web/console/assets/{StorageBuckets-DlG3ojhA.js → StorageBuckets-DJtNN769.js} +1 -1
  122. package/web/console/assets/{SystemSettings-DYo2gg6d.js → SystemSettings-0DEUgeTR.js} +1 -1
  123. package/web/console/assets/{SystemStatus-DKCoUZlq.js → SystemStatus-CR1phiPE.js} +1 -1
  124. package/web/console/assets/{Targets-CdkG6BPR.js → Targets-D65l-IMB.js} +1 -1
  125. package/web/console/assets/{Tools-DVpCt0ox.js → Tools-DqtrINrN.js} +1 -1
  126. package/web/console/assets/{Usage-DWCpLugC.js → Usage-B5njXNjx.js} +1 -1
  127. package/web/console/assets/{UsageAccess-B_Xq7ARW.js → UsageAccess-ChnB4pjb.js} +1 -1
  128. package/web/console/assets/{UsageHelp-t5ZG_f-e.js → UsageHelp-BBKIvbQ5.js} +1 -1
  129. package/web/console/assets/{index-C6W4LWVV.js → index-65JiiUr4.js} +1 -1
  130. package/web/console/assets/{index-H1kfa0Mj.js → index-sLKrJd_p.js} +2 -2
  131. package/web/console/assets/{request-DLsP1_ot.js → request-BpaimqEb.js} +1 -1
  132. package/web/console/assets/{schema-BLOHvAJQ.js → schema-D0Z4kFCZ.js} +1 -1
  133. package/web/console/assets/{util-CGVh2Jvr.js → util-DZYfJ5Zo.js} +1 -1
  134. package/web/console/assets/{vendor-element-BD089KxE.js → vendor-element-8cVcdt5T.js} +1 -1
  135. package/web/console/assets/{vendor-mammoth-Bv-CZhmH.js → vendor-mammoth-CnDA23N0.js} +1 -1
  136. package/web/console/assets/vendor-vue-Co7x2FW6.js +29 -0
  137. package/web/console/index.html +3 -3
  138. package/web-admin/package-lock.json +83 -85
  139. package/web/console/assets/vendor-vue-B2uhHUfE.js +0 -29
package/.dockerignore CHANGED
@@ -40,3 +40,9 @@ web-admin/src/private/
40
40
  web-admin/src/platform/
41
41
  *.private.*
42
42
  *.enterprise.*
43
+
44
+ # Repository governance metadata; excluded from runtime distributions.
45
+ security-insights.yml
46
+ SECURITY_SELF_ASSESSMENT*.md
47
+ docs/security-assessment*
48
+ docs/security/self-assessment*
package/.npmignore CHANGED
@@ -54,3 +54,9 @@ web-admin/src/private/
54
54
  web-admin/src/platform/
55
55
  *.private.*
56
56
  *.enterprise.*
57
+
58
+ # Repository governance metadata; excluded from runtime distributions.
59
+ security-insights.yml
60
+ SECURITY_SELF_ASSESSMENT*.md
61
+ docs/security-assessment*
62
+ docs/security/self-assessment*
package/CONTRIBUTING.md CHANGED
@@ -69,6 +69,10 @@ Reusable improvements are welcome as Issues, Discussions, or Pull Requests. Stro
69
69
 
70
70
  See [Community Derivatives And Ecosystem Collaboration](docs/ECOSYSTEM.en.md) for the complete policy and [中文说明](docs/ECOSYSTEM.md) for the Chinese version.
71
71
 
72
+ ## Automation-assisted contributions
73
+
74
+ Automation-assisted pull requests are welcome when an accountable human submitter reviews the complete change, explains its purpose, provides relevant validation, and follows the same contribution and security requirements as other contributions. Unattended changes do not bypass maintainer review.
75
+
72
76
  ## License
73
77
 
74
78
  By contributing, you agree that your contributions are licensed under the Apache License 2.0.
package/GOVERNANCE.md ADDED
@@ -0,0 +1,9 @@
1
+ # Governance
2
+
3
+ ## Current repository responsibility
4
+
5
+ Jingchuan Nie ([@niejingchuan](https://github.com/niejingchuan)) is the current repository administrator and maintainer for [bailinghub/bailinghub](https://github.com/bailinghub/bailinghub). Repository administration includes configuration of repository access, branch and workflow settings, and maintenance of the project's contribution and security-reporting processes.
6
+
7
+ Proposed changes should follow CONTRIBUTING.md. Security-sensitive findings should use the private reporting channel in SECURITY.md. Maintainers review changes for the project's scope and compatibility before acceptance.
8
+
9
+ The repository member list should be reviewed when maintainers or sensitive-resource access change. Maintainers should record a role's scope before granting elevated access and remove access that is no longer required.
package/README.en.md CHANGED
@@ -29,13 +29,13 @@ You choose which business APIs become available. BailingHub connects the convers
29
29
  <img src="assets/readme-product-overview.en.svg" width="100%" alt="BailingHub connects conversational entry points to governed business capabilities while the business system remains the authority">
30
30
  </picture>
31
31
 
32
- ## v0.9.0: model services and shared plan allowances
32
+ ## v0.9.2: secure installation and recovery of persisted evidence
33
33
 
34
- Optionally enable a lightweight model billing gateway for an assistant's conversation models and text-to-image tools. Services share a USD allowance and one plan multiplier. Periodic allowance is separate from sale price; customers see Credits or remaining percentage. The local host continues orchestration, with existing business authority and approvals intact.
34
+ New installations validate secure random credentials. Startup and recurring maintenance advance settlement without new traffic, with fair paging past unpriceable records. A saved approval can complete failed auditing or queue admission using the original decision, without duplicate admission for that approval.
35
35
 
36
- Release pairing: **Core 0.9.0 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**. Reference prices are not provider invoices; generation and settlement have separate states. Verify versions, Tags and artifact digests when upgrading.
36
+ The component set is **Core 0.9.2 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**; independent client packages keep their versions. Explicitly apply migrations **065/066** when upgrading. Shared USD allowance, the unified multiplier and client orchestration remain unchanged. Read-only deployment diagnostics and public process-recovery tests do not establish that a deployment has upgraded.
37
37
 
38
- [Release notes](docs/RELEASE_NOTES_v0.9.0.en.md) · [Upgrade guide](docs/UPGRADE_v0.9.0.en.md) · [Model billing](docs/MODEL_BILLING.en.md) · [Previous release](docs/RELEASE_NOTES_v0.8.0.en.md)
38
+ [Release notes](docs/RELEASE_NOTES_v0.9.2.en.md) · [Upgrade guide](docs/UPGRADE_v0.9.2.en.md) · [Reliability and migrations](docs/CORE_RELIABILITY.en.md) · [Previous release](docs/RELEASE_NOTES_v0.9.1.en.md)
39
39
 
40
40
  ## Operate the System by Conversation
41
41
 
@@ -125,7 +125,7 @@ To explore before installing, use the [online experience](https://trial.bailingh
125
125
  To run the complete disposable loop locally:
126
126
 
127
127
  ```bash
128
- git clone --branch v0.6.1 --depth 1 https://github.com/bailinghub/bailinghub.git
128
+ git clone --branch v0.9.2 --depth 1 https://github.com/bailinghub/bailinghub.git
129
129
  cd bailinghub
130
130
  export BAILING_TOKEN="${BAILING_TOKEN:-$(openssl rand -hex 32)}"
131
131
  docker compose up --build
@@ -201,6 +201,7 @@ Run separate BailingHub deployments for mutually isolated organizations. A `clie
201
201
 
202
202
  ## Documentation
203
203
 
204
+ - [Capabilities and Public Evidence](docs/IMPLEMENTATION_STATUS.en.md) — separate release availability, validation scope, and limitations.
204
205
  - [Quickstart](docs/QUICKSTART.en.md) — deploy and run the first route.
205
206
  - [Docker Demo](docs/DEMO.en.md) — complete the sample business-operation loop.
206
207
  - [Integration Guide](docs/INTEGRATION.en.md) — connect an existing application.
@@ -213,7 +214,7 @@ Run separate BailingHub deployments for mutually isolated organizations. A `clie
213
214
  - [HTTP Contract](docs/CONTRACT.en.md) — stable network and identity boundaries.
214
215
  - [Architecture](docs/ARCHITECTURE.en.md) — runtime layers and dependency direction.
215
216
  - [English Documentation Map](docs/README.en.md) — the complete public documentation index.
216
- - [Changelog](docs/CHANGELOG.en.md) and [v0.9.0](docs/RELEASE_NOTES_v0.9.0.en.md) — current release changes and upgrade notes.
217
+ - [Changelog](docs/CHANGELOG.en.md) and [v0.9.2](docs/RELEASE_NOTES_v0.9.2.en.md) — current release changes and upgrade notes.
217
218
 
218
219
  ## Feedback and Ecosystem
219
220
 
package/README.md CHANGED
@@ -27,13 +27,13 @@
27
27
 
28
28
  在线体验环境只用于了解产品和配置方式。请勿上传生产凭据、敏感数据或接入真实业务;正式使用请自行部署开源版。
29
29
 
30
- ## v0.9.0:模型服务与统一套餐额度
30
+ ## v0.9.2:安全安装与持久证据恢复
31
31
 
32
- 按需启用微型模型计费网关,为业务助手的对话模型与文生图工具配置共享 USD 额度。套餐统一倍率,周期额度与售价分开;客户看到 Credits 或剩余百分比。本地宿主继续编排任务,原业务授权和审批保持。
32
+ 新安装只使用经过校验的安全随机凭据;后台结算在启动和周期维护中自动推进,无法计价的首批记录不再阻塞后续请求。审批已保存但审计或排队失败时,可按原决策补续,避免同一批准重复排队。
33
33
 
34
- 配套为 **Core 0.9.0 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**。参考报价不等于供应商实付费用,生成结果与计费分别处理。升级时核对版本、Tag 与制品摘要。
34
+ 配套为 **Core 0.9.2 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**,独立客户端包不因本补丁升版。升级须显式应用 **065/066** 迁移;共享 USD 额度、统一倍率与客户端编排保持。新增只读部署体检和公开进程恢复专项,不代表具体运行环境已经升级。
35
35
 
36
- [版本说明](docs/RELEASE_NOTES_v0.9.0.md) · [升级指南](docs/UPGRADE_v0.9.0.md) · [模型计费](docs/MODEL_BILLING.md) · [上一版本](docs/RELEASE_NOTES_v0.8.0.md)
36
+ [版本说明](docs/RELEASE_NOTES_v0.9.2.md) · [升级指南](docs/UPGRADE_v0.9.2.md) · [可靠性与迁移](docs/CORE_RELIABILITY.md) · [上一版本](docs/RELEASE_NOTES_v0.9.1.md)
37
37
 
38
38
  ## 适合哪些团队
39
39
 
@@ -115,7 +115,7 @@
115
115
  在本机启动中枢、MySQL、Demo 业务系统、工具源、路由和接入方:
116
116
 
117
117
  ```bash
118
- git clone --branch v0.6.1 --depth 1 https://github.com/bailinghub/bailinghub.git
118
+ git clone --branch v0.9.2 --depth 1 https://github.com/bailinghub/bailinghub.git
119
119
  cd bailinghub
120
120
  export BAILING_TOKEN="${BAILING_TOKEN:-$(openssl rand -hex 32)}"
121
121
  docker compose up --build
@@ -188,6 +188,7 @@ BailingHub Core 是独立服务,只通过稳定网络契约与业务系统协
188
188
 
189
189
  | 我想做什么 | 从这里开始 |
190
190
  |---|---|
191
+ | 区分已发行能力、公开验证与限制 | [能力与证据索引](docs/IMPLEMENTATION_STATUS.md) |
191
192
  | 看懂产品和控制台 | [用户指南](docs/user-guide/README.md) |
192
193
  | 部署完整开源版 | [快速开始](docs/QUICKSTART.md) |
193
194
  | 跑通公开 Demo | [Docker Demo](docs/DEMO.md) |
@@ -198,7 +199,7 @@ BailingHub Core 是独立服务,只通过稳定网络契约与业务系统协
198
199
  | 集中开启本地智能体与工具 | [四步配置指南](docs/LOCAL_AGENT_SETUP.md) · [系统说明](docs/AGENT_SYSTEM_INFO.md) |
199
200
  | 查 API 与边界契约 | [HTTP 契约](docs/CONTRACT.md) · [Client API](docs/CLIENT_API.md) |
200
201
  | 理解架构与长期取舍 | [架构](docs/ARCHITECTURE.md) · [项目愿景](VISION.md) |
201
- | 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.9.0](docs/RELEASE_NOTES_v0.9.0.md) |
202
+ | 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.9.2](docs/RELEASE_NOTES_v0.9.2.md) |
202
203
 
203
204
  完整中英文文档地图见 [docs/README.md](docs/README.md)。公共 API、SDK、Schema、Docker Demo 与代码标识保持语言中立。
204
205
 
package/SECURITY.md CHANGED
@@ -8,7 +8,7 @@ Security fixes are provided for the latest public release line.
8
8
 
9
9
  Please do not open a public issue for suspected vulnerabilities.
10
10
 
11
- Use GitHub private vulnerability reporting if it is enabled for the repository. If it is not available, contact the maintainers through a private channel and mark the report as security-sensitive.
11
+ Use the repository's [private vulnerability reporting](https://github.com/bailinghub/bailinghub/security/advisories/new) channel. Security-sensitive reports should remain private while they are triaged and a fix or coordinated disclosure is prepared. Maintainers will coordinate disclosure with the reporter after triage; reporter credit is preserved unless anonymity is requested.
12
12
 
13
13
  Include:
14
14
 
@@ -18,7 +18,7 @@ Include:
18
18
  - impact assessment;
19
19
  - any relevant logs with secrets removed.
20
20
 
21
- We aim to acknowledge reports within 3 business days.
21
+ We aim to acknowledge reports within 3 business days. This project does not currently operate a paid bug bounty program.
22
22
 
23
23
  ## Security Baseline
24
24
 
@@ -39,3 +39,9 @@ Maintainers can supply deployment-specific markers at audit time through either:
39
39
  - `BAILING_PUBLIC_DENYLIST_FILE`: an absolute path to a JSON array stored outside the repository, preferred for local release rehearsals.
40
40
 
41
41
  For example, a protected test environment may set `BAILING_PUBLIC_DENYLIST_JSON='["DEPLOYMENT_ONLY_MARKER_ALPHA_42"]'`. Audit failures report only the marker index and never echo its value. The external file path is rejected when it resolves inside the repository.
42
+
43
+ ## Time-limited dependency exception
44
+
45
+ [GHSA-hp3w-g68c-fv3c](https://github.com/advisories/GHSA-hp3w-g68c-fv3c) remains open in `sprintf-js`, introduced by the Mammoth command-line dependency chain. No patched release is currently available. The runtime and console use Mammoth library APIs; reviewed DOCX extraction and HTML conversion do not load `argparse` or `sprintf-js`, including when document text contains the reported precision payloads.
46
+
47
+ The [audit policy](security/dependency-audit-exceptions.json) records the exact advisory, dependency versions and paths, reviewed source hashes, owner and expiry of 2026-11-09. `npm run audit:deps` retains the raw findings and blocks new findings, changed dependency or source usage, and expired exceptions. This exception is not a vulnerability fix and does not apply to using Mammoth's command-line interface. Re-review the exception when modifying the DOCX adapters or their dependency chain; remove it when an appropriate upstream fix is available.
@@ -21,8 +21,8 @@ The package license texts and copyright notices remain in the installed package
21
21
  |---|---|---:|---|---|
22
22
  | Console | [@babel/helper-string-parser](https://www.npmjs.com/package/@babel/helper-string-parser) | 7.29.7 | MIT | runtime |
23
23
  | Console | [@babel/helper-validator-identifier](https://www.npmjs.com/package/@babel/helper-validator-identifier) | 7.29.7 | MIT | runtime |
24
- | Console | [@babel/parser](https://www.npmjs.com/package/@babel/parser) | 7.29.7 | MIT | runtime |
25
- | Console | [@babel/types](https://www.npmjs.com/package/@babel/types) | 7.29.7 | MIT | runtime |
24
+ | Console | [@babel/parser](https://www.npmjs.com/package/@babel/parser) | 7.29.9 | MIT | runtime |
25
+ | Console | [@babel/types](https://www.npmjs.com/package/@babel/types) | 7.29.8 | MIT | runtime |
26
26
  | Console | [@ctrl/tinycolor](https://www.npmjs.com/package/@ctrl/tinycolor) | 4.2.0 | MIT | runtime |
27
27
  | Console | [@element-plus/icons-vue](https://www.npmjs.com/package/@element-plus/icons-vue) | 2.3.2 | MIT | runtime |
28
28
  | Console | [@esbuild/aix-ppc64](https://www.npmjs.com/package/@esbuild/aix-ppc64) | 0.25.12 | MIT | build/test |
@@ -54,7 +54,7 @@ The package license texts and copyright notices remain in the installed package
54
54
  | Console | [@floating-ui/core](https://www.npmjs.com/package/@floating-ui/core) | 1.7.5 | MIT | runtime |
55
55
  | Console | [@floating-ui/dom](https://www.npmjs.com/package/@floating-ui/dom) | 1.7.6 | MIT | runtime |
56
56
  | Console | [@floating-ui/utils](https://www.npmjs.com/package/@floating-ui/utils) | 0.2.11 | MIT | runtime |
57
- | Console | [@jridgewell/sourcemap-codec](https://www.npmjs.com/package/@jridgewell/sourcemap-codec) | 1.5.5 | MIT | runtime |
57
+ | Console | [@jridgewell/sourcemap-codec](https://www.npmjs.com/package/@jridgewell/sourcemap-codec) | 1.6.0 | MIT | runtime |
58
58
  | Console | [@mixmark-io/domino](https://www.npmjs.com/package/@mixmark-io/domino) | 2.2.0 | BSD-2-Clause | runtime |
59
59
  | Console | [@popperjs/core](https://www.npmjs.com/package/@popperjs/core) | 2.11.8 | MIT | runtime |
60
60
  | Console | [@rollup/rollup-android-arm-eabi](https://www.npmjs.com/package/@rollup/rollup-android-arm-eabi) | 4.61.1 | MIT | build/test |
@@ -87,16 +87,16 @@ The package license texts and copyright notices remain in the installed package
87
87
  | Console | [@types/lodash-es](https://www.npmjs.com/package/@types/lodash-es) | 4.17.12 | MIT | runtime |
88
88
  | Console | [@types/web-bluetooth](https://www.npmjs.com/package/@types/web-bluetooth) | 0.0.21 | MIT | runtime |
89
89
  | Console | [@vitejs/plugin-vue](https://www.npmjs.com/package/@vitejs/plugin-vue) | 5.2.4 | MIT | build/test |
90
- | Console | [@vue/compiler-core](https://www.npmjs.com/package/@vue/compiler-core) | 3.5.35 | MIT | runtime |
91
- | Console | [@vue/compiler-dom](https://www.npmjs.com/package/@vue/compiler-dom) | 3.5.35 | MIT | runtime |
92
- | Console | [@vue/compiler-sfc](https://www.npmjs.com/package/@vue/compiler-sfc) | 3.5.35 | MIT | runtime |
93
- | Console | [@vue/compiler-ssr](https://www.npmjs.com/package/@vue/compiler-ssr) | 3.5.35 | MIT | runtime |
90
+ | Console | [@vue/compiler-core](https://www.npmjs.com/package/@vue/compiler-core) | 3.5.43 | MIT | runtime |
91
+ | Console | [@vue/compiler-dom](https://www.npmjs.com/package/@vue/compiler-dom) | 3.5.43 | MIT | runtime |
92
+ | Console | [@vue/compiler-sfc](https://www.npmjs.com/package/@vue/compiler-sfc) | 3.5.43 | MIT | runtime |
93
+ | Console | [@vue/compiler-ssr](https://www.npmjs.com/package/@vue/compiler-ssr) | 3.5.43 | MIT | runtime |
94
94
  | Console | [@vue/devtools-api](https://www.npmjs.com/package/@vue/devtools-api) | 6.6.4 | MIT | runtime |
95
- | Console | [@vue/reactivity](https://www.npmjs.com/package/@vue/reactivity) | 3.5.35 | MIT | runtime |
96
- | Console | [@vue/runtime-core](https://www.npmjs.com/package/@vue/runtime-core) | 3.5.35 | MIT | runtime |
97
- | Console | [@vue/runtime-dom](https://www.npmjs.com/package/@vue/runtime-dom) | 3.5.35 | MIT | runtime |
98
- | Console | [@vue/server-renderer](https://www.npmjs.com/package/@vue/server-renderer) | 3.5.35 | MIT | runtime |
99
- | Console | [@vue/shared](https://www.npmjs.com/package/@vue/shared) | 3.5.35 | MIT | runtime |
95
+ | Console | [@vue/reactivity](https://www.npmjs.com/package/@vue/reactivity) | 3.5.43 | MIT | runtime |
96
+ | Console | [@vue/runtime-core](https://www.npmjs.com/package/@vue/runtime-core) | 3.5.43 | MIT | runtime |
97
+ | Console | [@vue/runtime-dom](https://www.npmjs.com/package/@vue/runtime-dom) | 3.5.43 | MIT | runtime |
98
+ | Console | [@vue/server-renderer](https://www.npmjs.com/package/@vue/server-renderer) | 3.5.43 | MIT | runtime |
99
+ | Console | [@vue/shared](https://www.npmjs.com/package/@vue/shared) | 3.5.43 | MIT | runtime |
100
100
  | Console | [@vueuse/core](https://www.npmjs.com/package/@vueuse/core) | 14.3.0 | MIT | runtime |
101
101
  | Console | [@vueuse/metadata](https://www.npmjs.com/package/@vueuse/metadata) | 14.3.0 | MIT | runtime |
102
102
  | Console | [@vueuse/shared](https://www.npmjs.com/package/@vueuse/shared) | 14.3.0 | MIT | runtime |
@@ -128,7 +128,7 @@ The package license texts and copyright notices remain in the installed package
128
128
  | Console | [magic-string](https://www.npmjs.com/package/magic-string) | 0.30.21 | MIT | runtime |
129
129
  | Console | [mammoth](https://www.npmjs.com/package/mammoth) | 1.12.0 | BSD-2-Clause | runtime |
130
130
  | Console | [memoize-one](https://www.npmjs.com/package/memoize-one) | 6.0.0 | MIT | runtime |
131
- | Console | [nanoid](https://www.npmjs.com/package/nanoid) | 3.3.18 | MIT | runtime |
131
+ | Console | [nanoid](https://www.npmjs.com/package/nanoid) | 3.3.20 | MIT | runtime |
132
132
  | Console | [normalize-wheel-es](https://www.npmjs.com/package/normalize-wheel-es) | 1.2.0 | BSD-3-Clause | runtime |
133
133
  | Console | [option](https://www.npmjs.com/package/option) | 0.2.4 | BSD-2-Clause | runtime |
134
134
  | Console | [pako](https://www.npmjs.com/package/pako) | 1.0.11 | (MIT AND Zlib) | runtime |
@@ -136,13 +136,13 @@ The package license texts and copyright notices remain in the installed package
136
136
  | Console | [picocolors](https://www.npmjs.com/package/picocolors) | 1.1.1 | ISC | runtime |
137
137
  | Console | [picomatch](https://www.npmjs.com/package/picomatch) | 4.0.4 | MIT | build/test |
138
138
  | Console | [pinia](https://www.npmjs.com/package/pinia) | 2.3.1 | MIT | runtime |
139
- | Console | [postcss](https://www.npmjs.com/package/postcss) | 8.5.23 | MIT | runtime |
139
+ | Console | [postcss](https://www.npmjs.com/package/postcss) | 8.5.29 | MIT | runtime |
140
140
  | Console | [process-nextick-args](https://www.npmjs.com/package/process-nextick-args) | 2.0.1 | MIT | runtime |
141
141
  | Console | [readable-stream](https://www.npmjs.com/package/readable-stream) | 2.3.8 | MIT | runtime |
142
142
  | Console | [rollup](https://www.npmjs.com/package/rollup) | 4.61.1 | MIT | build/test |
143
143
  | Console | [safe-buffer](https://www.npmjs.com/package/safe-buffer) | 5.1.2 | MIT | runtime |
144
144
  | Console | [setimmediate](https://www.npmjs.com/package/setimmediate) | 1.0.5 | MIT | runtime |
145
- | Console | [source-map-js](https://www.npmjs.com/package/source-map-js) | 1.2.1 | BSD-3-Clause | runtime |
145
+ | Console | [source-map-js](https://www.npmjs.com/package/source-map-js) | 1.2.2 | BSD-3-Clause | runtime |
146
146
  | Console | [sprintf-js](https://www.npmjs.com/package/sprintf-js) | 1.0.3 | BSD-3-Clause | runtime |
147
147
  | Console | [string_decoder](https://www.npmjs.com/package/string_decoder) | 1.1.1 | MIT | runtime |
148
148
  | Console | [tinyglobby](https://www.npmjs.com/package/tinyglobby) | 0.2.17 | MIT | build/test |
@@ -151,7 +151,7 @@ The package license texts and copyright notices remain in the installed package
151
151
  | Console | [underscore](https://www.npmjs.com/package/underscore) | 1.13.8 | MIT | runtime |
152
152
  | Console | [util-deprecate](https://www.npmjs.com/package/util-deprecate) | 1.0.2 | MIT | runtime |
153
153
  | Console | [vite](https://www.npmjs.com/package/vite) | 6.4.3 | MIT | build/test |
154
- | Console | [vue](https://www.npmjs.com/package/vue) | 3.5.35 | MIT | runtime |
154
+ | Console | [vue](https://www.npmjs.com/package/vue) | 3.5.43 | MIT | runtime |
155
155
  | Console | [vue-component-type-helpers](https://www.npmjs.com/package/vue-component-type-helpers) | 3.3.4 | MIT | runtime |
156
156
  | Console | [vue-demi](https://www.npmjs.com/package/vue-demi) | 0.14.10 | MIT | runtime |
157
157
  | Console | [vue-router](https://www.npmjs.com/package/vue-router) | 4.6.4 | MIT | runtime |
@@ -207,7 +207,7 @@ The package license texts and copyright notices remain in the installed package
207
207
  | Hub | [duck](https://www.npmjs.com/package/duck) | 0.1.12 | BSD | runtime |
208
208
  | Hub | [esbuild](https://www.npmjs.com/package/esbuild) | 0.28.1 | MIT | runtime |
209
209
  | Hub | [fast-deep-equal](https://www.npmjs.com/package/fast-deep-equal) | 3.1.3 | MIT | build/test |
210
- | Hub | [fast-uri](https://www.npmjs.com/package/fast-uri) | 3.1.7 | BSD-3-Clause | build/test |
210
+ | Hub | [fast-uri](https://www.npmjs.com/package/fast-uri) | 3.1.8 | BSD-3-Clause | build/test |
211
211
  | Hub | [fsevents](https://www.npmjs.com/package/fsevents) | 2.3.2 | MIT | build/test |
212
212
  | Hub | [fsevents](https://www.npmjs.com/package/fsevents) | 2.3.3 | MIT | runtime |
213
213
  | Hub | [generate-function](https://www.npmjs.com/package/generate-function) | 2.3.1 | MIT | runtime |
@@ -18,7 +18,7 @@ services:
18
18
  retries: 30
19
19
 
20
20
  demo-business:
21
- image: ${BAILING_DEMO_BUSINESS_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-demo-business:0.9.0}
21
+ image: ${BAILING_DEMO_BUSINESS_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-demo-business:0.9.2}
22
22
  environment:
23
23
  DEMO_HOST: 0.0.0.0
24
24
  DEMO_PORT: 19080
@@ -29,7 +29,7 @@ services:
29
29
  - "${BAILING_DEMO_PUBLIC_PORT:-19080}:19080"
30
30
 
31
31
  bailinghub:
32
- image: ${BAILINGHUB_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailinghub:0.9.0}
32
+ image: ${BAILINGHUB_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailinghub:0.9.2}
33
33
  depends_on:
34
34
  mysql:
35
35
  condition: service_healthy
@@ -12,7 +12,7 @@ For the current integration contract, use:
12
12
 
13
13
  ## Recording Rules
14
14
 
15
- Lead each release with a familiar business-assistant or enterprise-service scenario: the previous problem, changed behavior, affected users and developers, upgrade steps, observable checks and limits. Keep English and Chinese facts aligned and distinguish additions, fixes and existing features. See [the release scenario notes](RELEASE_NOTES_v0.9.0.en.md).
15
+ Lead each release with a familiar business-assistant or enterprise-service scenario: the previous problem, changed behavior, affected users and developers, upgrade steps, observable checks and limits. Keep English and Chinese facts aligned and distinguish additions, fixes and existing features. See [the release scenario notes](RELEASE_NOTES_v0.9.2.en.md).
16
16
 
17
17
  Each public version should describe:
18
18
 
@@ -22,6 +22,27 @@ Each public version should describe:
22
22
  - validation commands;
23
23
  - related docs.
24
24
 
25
+ ## v0.9.2 - Secure installation and persisted continuation
26
+
27
+ Version date: 2026-10-13. A patch from Core 0.9.1; MCP / Agent Client SDK 0.7.0 and DSH 0.7.0 remain unchanged. See [release notes](RELEASE_NOTES_v0.9.2.en.md) and the [upgrade guide](UPGRADE_v0.9.2.en.md).
28
+
29
+ - Fix installation secrets: generate six credentials independently from secure randomness; failed or invalid output stops installation without weak credentials or a partial `.env`. Preserve existing configuration.
30
+ - Fix settlement depending on traffic and a blocking fixed first page: startup/existing tick and minute-based maintenance advance cursor pages of up to 50 records with wraparound, per-row failure isolation and database backoff. Use original metering, prices and multiplier; do not redispatch, read result bodies or invent charges.
31
+ - Fix continuation after a saved approval encounters audit or queue failure: atomically persist the decision and continuation, then recover the original job through original-ID retry and background maintenance. Atomically save queue admission and a decision marker, deduplicate lost acknowledgements and process reopening, and recheck consumed state inside admission. Denials only complete auditing; direct Agent calls retain explicit resume; historical decisions without continuations are not backfilled.
32
+ - Add read-only `doctor --deployment` for specified Core public health/version and optional readiness, with explicit declaration identity, unchecked scope and exit codes. Perform no upgrade, rollback or migration.
33
+ - First ship actual model-child SIGKILL and lost MySQL COMMIT-acknowledgement regressions, plus installation, paging, approval concurrency/process recovery and maintenance-close coverage. Added tests do not add model redispatch behavior or establish production acceptance.
34
+ - Add 065's settlement index and 066's continuation table/job markers. Apply explicit migrations and match custom state/config adapters; new maintenance participates in close draining. Rollback retains continuation records and markers. Queue deduplication does not guarantee exactly-once external effects. ACC, independent Hosts and clients release separately and are outside this Core update.
35
+
36
+ ## v0.9.1 - Asynchronous model shutdown and public capability evidence
37
+
38
+ Version date: 2026-10-12. Core patch release; MCP / Agent Client SDK 0.7.0 and DSH 0.7.0 remain unchanged. See [release notes](RELEASE_NOTES_v0.9.1.en.md) and the [upgrade guide](UPGRADE_v0.9.1.en.md).
39
+
40
+ - Fix model-tool completion, late settlement, and other usage background work not being explicitly included in Kernel shutdown drain. Original HTTP 202, request IDs, result/billing states, and business authority remain unchanged.
41
+ - Usage drain shares the original close deadline. A timeout at that stage retains original dependencies and the closing state for same-instance retry without redispatch. Failed settlement can retain durable pending evidence.
42
+ - Add a Chinese/English public capability/evidence index separating releases, source, test scope, independent-component responsibilities, and uncovered cases.
43
+ - Include existing main-branch dependency auditing, pinned Actions sources/minimal permissions, recurring scanning, assessments, and security metadata. Repository governance material is excluded from runtime packages/images; no all-controls-passing claim is made.
44
+ - No new APIs, SQL migrations, plan rules, or client features relative to 0.9.0. Public unit and actual Kernel/MySQL synthetic-provider regressions expose shutdown checks, without replacing live-provider or deployment acceptance.
45
+
25
46
  ## v0.9.0 - Model services, shared allowances and image tools
26
47
 
27
48
  Version date: 2026-09-23. Release pairing: Core 0.9.0 / SDK 0.7.0 / DSH 0.7.0. See [release notes](RELEASE_NOTES_v0.9.0.en.md) and the [upgrade guide](UPGRADE_v0.9.0.en.md).
package/docs/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ## 记录规则
7
7
 
8
- 每次先用业务助手、企业服务等通用场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.9.0.md)。
8
+ 每次先用业务助手、企业服务等通用场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.9.2.md)。
9
9
 
10
10
  每个公开版本至少说明:
11
11
 
@@ -15,6 +15,27 @@
15
15
  - **验证方式**:部署方如何确认该版本运行正常;
16
16
  - **相关文档**:对应的契约、指南或示例。
17
17
 
18
+ ## v0.9.2 - 安全安装与原记录补续
19
+
20
+ 版本日期:2026-10-13。相对 Core 0.9.1 的补丁;MCP / Agent Client SDK 0.7.0、DSH 0.7.0 不变。[版本说明](RELEASE_NOTES_v0.9.2.md)、[升级指南](UPGRADE_v0.9.2.md)。
21
+
22
+ - 修复安装凭据生成:六项凭据独立使用安全随机源,失败或输出不合法时停止,不产生弱凭据或半份 `.env`;已有配置保留。
23
+ - 修复异步结算只靠流量触发与固定首批阻塞:启动/既有 tick 和每分钟维护自动推进,最多 50 条游标分页并回绕,单条异常隔离,数据库故障退避;只使用原计量、价格与统一倍率,不重派、不读结果正文、不猜费用。
24
+ - 修复审批决策保存后审计或入队失败无法补续:事务保存决策与补续,原 ID 重试和后台维护继续原任务;原入队与决策标记原子保存,确认丢失和进程重开不重复入队,入队临界区重验已消费状态。拒绝仅补审计,Agent 直调仍显式 resume,历史无补续决策不回填。
25
+ - 新增只读 `doctor --deployment` 模式,核对指定 Core 的公开健康/版本,按需读取 readiness;明确身份声明、未检查范围和退出码,不执行升级、回滚或迁移。
26
+ - 首次发行实际模型子进程 SIGKILL 和 MySQL COMMIT 确认丢失专项,新增安装、分页、审批并发/进程恢复及维护关闭回归;测试覆盖新增不代表新增模型重派能力或生产验收。
27
+ - 新增 065 待结算索引和 066 补续表/任务标记,必须显式迁移并配套自定义 state/config 仓储;新维护纳入关闭排空。回退保留补续记录与标记,队列去重不等于外部业务恰好一次。ACC、独立 Host 与客户端各自发布,不包含在本次 Core 更新中。
28
+
29
+ ## v0.9.1 - 异步模型工作关闭与公开能力证据
30
+
31
+ 版本日期:2026-10-12。Core 补丁版本,MCP / Agent Client SDK 0.7.0、DSH 0.7.0 不变。[版本说明](RELEASE_NOTES_v0.9.1.md)、[升级指南](UPGRADE_v0.9.1.md)。
32
+
33
+ - 修复模型工具完成、晚登记结算及其他 usage 后台工作没有显式纳入 Kernel 关闭等待的边界;保持原 HTTP 202、请求标识、结果/计费状态与业务权限。
34
+ - usage 排空与原关闭阶段共用时限;该阶段超时保留原实例依赖和 closing 状态,供同实例重试,不重新派发。失败结算仍可保留 durable pending。
35
+ - 新增公开中英能力/证据索引,区分发行、源码、测试范围、独立组件责任及未覆盖项。
36
+ - 纳入已有主分支的依赖审计、固定 Actions 来源/最小权限、定期扫描、自评与安全元数据;仓库治理材料排除在运行包/镜像之外,不声明全部控制通过。
37
+ - 相对 0.9.0 无新增 API、SQL 迁移、套餐或客户端功能。公开单测及实际 Kernel/MySQL 合成供应商回归提供关闭检查入口,不能代替真实供应商与部署验收。
38
+
18
39
  ## v0.9.0 - 模型服务、统一套餐额度与文生图工具
19
40
 
20
41
  版本日期:2026-09-23。配套 Core 0.9.0 / SDK 0.7.0 / DSH 0.7.0。[版本说明](RELEASE_NOTES_v0.9.0.md)、[升级指南](UPGRADE_v0.9.0.md)。
@@ -1,5 +1,9 @@
1
1
  # Compatibility And Upgrade Policy
2
2
 
3
+ ## Core 0.9.1 patch upgrade
4
+
5
+ Relative to 0.9.0, this patch fixes asynchronous usage shutdown and updates public documentation/general security governance. There are no new APIs, SQL, plan rules, or client features. SDK 0.7.0 / DSH 0.7.0 remain unchanged. Old-version close returning does not establish that usage work has finished. Reconcile original requests before replacing artifacts; retry a new-version usage-drain timeout on the original instance. See the [0.9.1 upgrade guide](UPGRADE_v0.9.1.en.md).
6
+
3
7
  ## Core 0.9.0 release pairing
4
8
 
5
9
  Pair Core 0.9.0 with SDK 0.7.0 / DSH 0.7.0 for the optional model billing gateway. Hosts retain orchestration, existing business authority, approvals and original-call recovery. Public 0.8.0 upgrades apply outstanding 063/064 migrations and retain real data, with no test-schema purge. Periodic sale price and allowance are separate; original grant snapshots and ledger remain. Hosts opt into model plans explicitly; existing business-tool-only hosts need not enable billing. See the [0.9.0 upgrade guide](UPGRADE_v0.9.0.en.md).
@@ -0,0 +1,59 @@
1
+ # Installation secrets, settlement maintenance and approval continuation
2
+
3
+ [简体中文](CORE_RELIABILITY.md)
4
+
5
+ This page describes the fixes and checks in Core 0.9.2. The historical v0.9.1 tag, npm package and installation images do not contain these later changes. Verify each deployment's source identity and migration ledger separately.
6
+
7
+ ## Installation secrets
8
+
9
+ When creating `.env`, the installer calls `openssl rand -base64 24` independently for six credentials. Each producer must exit successfully and return exactly 32 valid Base64 characters. Missing secure randomness, execution failure or invalid output stops installation before a partial `.env` is written or services start. Timestamps and digests are not substitutes for randomness.
10
+
11
+ An existing `.env` is preserved, including an operator's changed administrator password. Failed producers' output is not echoed. Install a working OpenSSL implementation before retrying.
12
+
13
+ Run `npm run installer:secrets:test` to check generation, failed producers, malformed output, late failures and configuration preservation. Tests use synthetic commands and temporary directories, without installing a real service.
14
+
15
+ ## Automatic asynchronous settlement
16
+
17
+ standalone schedules an initial maintenance pass after startup and subsequent passes every minute. A new managed Kernel schedules its first pass on its existing `tick`, with subsequent passes driven by the same tick. Its Host must still call tick; no per-Kernel timers are introduced. HTTP uses the same maintenance port as a fallback, so saved usage recovery no longer depends on incoming traffic.
18
+
19
+ Maintenance reads saved metering, reference prices and the original unified multiplier. It does not read generated result bodies, contact providers or dispatch another model request. Pages contain at most 50 records, advance by `(updated_at, id)` and wrap at the end. Unpriceable or individually corrupt rows do not keep later records behind a fixed first page. Missing authoritative metering remains pending/unknown, rather than becoming an invented zero charge.
20
+
21
+ One usage owner shares an active maintenance pass; different owners remain independent. Database failures back off from one minute to a maximum of five minutes, resetting after success. `getReconciliationProgress()` exposes only the latest page's scanned, settled, deferred, failed and hasMore values. It is not a database-wide pending count and contains no result bodies, identifiers or credentials.
22
+
23
+ Maintenance participates in the existing background-work registry and Kernel close drain. standalone stops new maintenance before draining started evidence writes. A timeout retains unfinished work on the same instance for retry; it is not permission to close its stores.
24
+
25
+ ## Approval decisions and continuation
26
+
27
+ External callbacks and the console save the decision and immutable continuation coordinates in one transaction. They bind the original approval, job, request, argument hash and decision identifier. Retrying the original `decision_id` can complete failed auditing or queue admission; background maintenance pages through unfinished continuations by approval identifier and wraps at the end, so in-flight or faulty records do not block later approvals. A saved decision whose continuation fails returns `503` with `decision_recorded=true / continuation_pending=true`. Do not create another approval to recover it.
28
+
29
+ The state adapter atomically writes original-job queue admission and a separate decision marker, rechecking whether the approval was consumed inside the admission critical section. If the queue write succeeds but its acknowledgement is lost, retries, process reopening and a completed new run cannot admit the job again for that decision. Ordinary job updates cannot remove the marker. An original job still in flight waits for later maintenance. Execution retains existing pause, route and tool governance.
30
+
31
+ Denied decisions only complete auditing. Direct Agent invocations remain manual: approval does not launch a Core model loop, and the original local Agent still explicitly resumes the original `invocation_id`. Consumed approvals and historical decisions without new continuation records are not automatically backfilled or requeued.
32
+
33
+ Losing an acknowledgement after a successful audit append may produce another observation with the same `detail.continuation_id`. Queue admission deduplication does not guarantee exactly-once business effects across systems; business services retain their own idempotency and final authorization. JSONL serial writes support one writer, not multiple processes writing the same file.
34
+
35
+ ## Migrations and adapter boundaries
36
+
37
+ - `065_usage_reconciliation_scan.sql` adds the pending-settlement paging index, without recalculating historical charges.
38
+ - `066_approval_continuations.sql` adds the continuation table and `bz_jobs.approval_continuation_keys`, without changing old decisions or customer business data.
39
+
40
+ Use `npm run db:init` or the official explicit Kernel migration port. Runtime startup does not migrate automatically. Apply 066 before using new approval decision paths. A failed continuation insert rolls the decision back rather than leaving an orphaned decision. Coordinate old writers, retain backups and verify migration plus matching state/config adapters before enabling the new paths.
41
+
42
+ Custom adapters must implement the optional continuation ledger methods together with `RuntimeStateStore.requeueApprovedJobOnce`. New decisions are explicitly unavailable without them; there is no fallback to the old unrecoverable queue path. These are Core interfaces. Independent Host platform identities and tenant upgrade orchestration, and client model loops and long-term memory remain separate projects.
43
+
44
+ These migrations are additive. A code rollback must not delete continuation records or markers. Older code does not provide the guarantees on this page. Coordinate stopping decision and job writes, then reconcile saved decisions, queue state and markers; removing markers and resubmitting is not recovery.
45
+
46
+ ## Regression entry points and limits
47
+
48
+ Default `npm test` covers settlement paging, maintenance, approval continuation, state updates and close behavior. MySQL acceptance uses independent random schemas and synthetic providers:
49
+
50
+ ```bash
51
+ BAILING_USAGE_TEST_MYSQL=1 BAILING_APPROVAL_CONTINUATION_TEST_MYSQL=1 \
52
+ node --import tsx --test --test-concurrency=4 \
53
+ 'src/modules/usage/*.test.ts' src/app/kernel-usage-lifecycle.mysql.test.ts \
54
+ src/app/approval-continuations.mysql.test.ts
55
+ ```
56
+
57
+ Fixtures require a dedicated MySQL on local `127.0.0.1:16307`, an empty root password, and permission to create/drop test databases. Never point them at shared or production databases. Approval acceptance includes actual child-process SIGKILL, recovery in a different PID, lost COMMIT acknowledgements, concurrent continuation and missing-migration rollback. This establishes behavior in the fixtures, not real-provider availability, physical power-loss durability or production business acceptance. Skipped database tests do not count as passes.
58
+
59
+ See the [capability and public evidence index](IMPLEMENTATION_STATUS.en.md) for implementation and test links.
@@ -0,0 +1,59 @@
1
+ # 安装凭据、结算维护与审批补续
2
+
3
+ [English](CORE_RELIABILITY.en.md)
4
+
5
+ 本页描述 Core 0.9.2 的修复及检查范围。历史 v0.9.1 Tag、npm 包和安装镜像不包含这些后续修改;具体部署需核对其源码与迁移账本。
6
+
7
+ ## 安装凭据
8
+
9
+ 新建 `.env` 时,安装器为六项凭据分别调用 `openssl rand -base64 24`。每次输出必须是 32 个合法 Base64 字符,生产者必须成功退出。缺少安全随机源、执行失败或输出不合法时停止安装,不生成半份 `.env`,不启动服务。不以时间戳或摘要替代随机源。
10
+
11
+ 已有 `.env` 继续保留,重启和升级不因此覆盖运营者修改的管理员密码。生成失败时不回显生产者输出;运营者需安装可用的 OpenSSL 后重试。
12
+
13
+ 运行 `npm run installer:secrets:test` 可检查正常生成、故障退出、错误输出、后续凭据生成失败和已有配置保留。这些测试使用合成命令与临时目录,不安装真实服务。
14
+
15
+ ## 异步结算自动推进
16
+
17
+ standalone 启动后即安排一次维护,以后每分钟安排一次;managed Kernel 在新实例的首个既有 `tick` 上启动,以后由同一 tick 推进周期维护。managed 模式仍由 Host 调用 tick,不新建每个 Kernel 的独立定时器。HTTP 请求保留同一维护入口作为补充,恢复结算不依赖新流量。
18
+
19
+ 维护只读取原请求已保存的计量、参考价格和统一倍率,不读取生成结果正文,不调用供应商,不重新派发模型。每页最多 50 条,以 `(updated_at, id)` 游标前进并在末尾回绕;无法计价或单条损坏的记录不会一直占据首批而阻塞后面的记录。缺少可靠计量的记录继续保留 pending/unknown,不猜测为零费用。
20
+
21
+ 同一 usage owner 的维护合并为一次进行中的工作,不同 owner 独立。数据库故障采用一分钟起、最多五分钟的退避;成功后恢复正常周期。`getReconciliationProgress()` 只提供最近一页的 scanned、settled、deferred、failed、hasMore,不是全库待结算总数,也不包含请求结果、标识或凭据。
22
+
23
+ 维护纳入既有后台工作登记器和 Kernel 关闭等待。standalone 先停止新的维护,再排空已开始的写账;超时保留同实例的待完成工作以供重试,不能将超时当作关库许可。
24
+
25
+ ## 审批决策与补续
26
+
27
+ 外部回调和控制台将审批决策及不可变的补续坐标放在同一事务中保存。补续绑定原 approval、job、request、args hash 与决策标识。审计或排队失败后,使用原 `decision_id` 重试可以补续;后台维护也会检查尚未完成的补续,按审批标识分页推进并回绕,避免在途或异常记录阻塞后续审批。已保存决策但补续失败时返回 `503` 与 `decision_recorded=true / continuation_pending=true`,不得另造一条审批。
28
+
29
+ 原任务入队与独立的审批决策标记由状态仓储原子写入,并在入队临界区重新核对审批是否已消费。入队成功但确认丢失时,重试、进程重开和新一轮任务完成都不会再因同一决策入队。普通任务更新不能清掉此标记。原任务仍在途时等待后续维护,实际执行沿用既有暂停、路由和工具治理。
30
+
31
+ 拒绝的审批只补审计。Agent 直调保持手动模式:批准不启动中枢模型循环,仍由原本地 Agent 使用原 `invocation_id` 显式续执行。已经消费的审批和没有新补续记录的历史决策不被自动回填或重排。
32
+
33
+ 审计追加成功后确认丢失,可能再次出现同一观察,`detail.continuation_id` 可识别这类重复。入队去重不等于跨业务系统恰好执行一次;业务方仍需保持自己的幂等和最终授权。JSONL 的顺序写入适用于一个 writer,不支持多个进程共同写同一文件。
34
+
35
+ ## 迁移与适配边界
36
+
37
+ - `065_usage_reconciliation_scan.sql`:新增待结算分页索引,不重算历史费用。
38
+ - `066_approval_continuations.sql`:新增补续表及 `bz_jobs.approval_continuation_keys`,不改变旧决策或客户业务数据。
39
+
40
+ 沿用 `npm run db:init` 或 Kernel 的显式官方迁移入口,运行时不自动迁移。使用新审批决策入口前必须应用 066;事务写入补续失败会回滚决策,不能留下仅决策成功的孤立记录。升级时协调旧写入,保留备份,并在启用新入口前确认迁移和配套 state/config 仓储就绪。
41
+
42
+ 自定义仓储需配套实现可选的 continuation ledger 方法与 `RuntimeStateStore.requeueApprovedJobOnce`。未实现时新决策明确 unavailable,不退回不能恢复的旧排队方式。这些接口属于 Core;独立 Host 的平台身份、租户升级编排,以及客户端的模型循环和长期记忆均由各自项目维护。
43
+
44
+ 新增结构是增量迁移,回退代码不应删除补续表或标记。回退到旧代码后,本页的补续保证不再适用;先协调停止决策和任务写入,核对已保存的决策、队列与标记,不能清标记后重投来代替恢复。
45
+
46
+ ## 回归入口与限制
47
+
48
+ 默认 `npm test` 包含结算分页、维护、审批补续、状态更新和关闭单测。真实 MySQL 专项使用独立随机 schema 与合成供应商:
49
+
50
+ ```bash
51
+ BAILING_USAGE_TEST_MYSQL=1 BAILING_APPROVAL_CONTINUATION_TEST_MYSQL=1 \
52
+ node --import tsx --test --test-concurrency=4 \
53
+ 'src/modules/usage/*.test.ts' src/app/kernel-usage-lifecycle.mysql.test.ts \
54
+ src/app/approval-continuations.mysql.test.ts
55
+ ```
56
+
57
+ 数据库 fixture 需要本机 `127.0.0.1:16307` 的专用 MySQL、root 空密码及创建/删除测试库权限,禁止指向共享或生产数据库。审批专项含实际子进程 SIGKILL、不同 PID 恢复、COMMIT 确认丢失、并发补续和缺迁移回滚。测试证明给定 fixture 的机制;不证明真实供应商、物理断电持久性或生产业务已验收。跳过的数据库测试不计为通过。
58
+
59
+ 公开实现和测试入口见[能力与证据索引](IMPLEMENTATION_STATUS.md)。
@@ -0,0 +1,78 @@
1
+ # Read-only deployment diagnostics
2
+
3
+ This deployment mode is available from Core 0.9.2. The historical released `v0.9.1` Tag/npm artifact does not include it. Run the commands below from source or a released artifact that includes `scripts/doctor-deployment.ts`.
4
+
5
+ Deployment diagnostics add a separate mode to `npm run doctor` for an installed Core. Doctor without arguments retains its source, documentation, example and OSS checks. Deployment mode checks the specified instance's public health and version declarations without running the existing check scripts.
6
+
7
+ See [DEPLOYMENT_DIAGNOSTICS.md](DEPLOYMENT_DIAGNOSTICS.md) for Chinese, [OPERATIONS.en.md](OPERATIONS.en.md) for deployment and recovery, and [IMPLEMENTATION_STATUS.en.md](IMPLEMENTATION_STATUS.en.md) for capability and evidence boundaries.
8
+
9
+ ## Usage
10
+
11
+ Run from a Core checkout, source installation or unpacked npm artifact:
12
+
13
+ ```bash
14
+ npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --json
15
+ ```
16
+
17
+ The operator must provide an explicit URL; the tool does not discover targets from `.env`, `config.json` or smoke environment variables. A controlled Core mount prefix such as `https://hub.example.com/core` is supported but is not printed. URLs containing userinfo, query strings or fragments are rejected. The tool accepts no Token argument and performs no login.
18
+
19
+ The default mode sends only `GET /health` and `GET /version`. It does not connect to a database, read configuration contents, call a model, migrate, install, update, roll back, or control containers or services. It checks only whether `config.json` and `.env` exist. Missing files can indicate environment or host injection, so the effective configuration remains `unknown`. Credential safety is `not_checked`; no claim is made about default Tokens or connection strings.
20
+
21
+ For a container installation, run the same command from the installed Core directory inside the container, or use an externally unpacked Core artifact against the public URL. The tool does not run `docker inspect`, read container environments or infer a running image digest. Container startup, permissions and digest verification belong to the deployment procedure.
22
+
23
+ When the local directory is not the artifact to compare, supply a version and commit from a trusted release record. This example checks a historical v0.9.1 instance:
24
+
25
+ ```bash
26
+ npm run --silent doctor -- --deployment --url https://hub.example.com \
27
+ --expect-version 0.9.1 --expect-commit f37df6042b390405a5f7b1630636d3017607db9f --json
28
+ ```
29
+
30
+ Local identity comes from `package.json` and Git HEAD, falling back to the commit in `build-info.json` when Git is unavailable. By default, both local version and commit are compared; commit prefixes must contain at least 12 hexadecimal characters. A separate read-only Git check reports `clean`, `dirty` or `not_checked`, never filenames, with fsmonitor hooks and optional index writes disabled. A dirty or unavailable Git worktree keeps the default local-source comparison incomplete rather than treating uncommitted contents as the HEAD artifact.
31
+
32
+ Without usable local commit metadata, source remains `unknown` and the exit code is 2. Explicit expectations do not manufacture local source identity. Available public results are still reported; the deployment procedure must supply the missing artifact evidence.
33
+
34
+ Explicit expectations change the comparison target without claiming that another local artifact's SQL list matches the instance. Source evidence uses `local_metadata`; runtime evidence uses `reported_metadata`. Both keep `artifact_integrity: not_checked`. A clean worktree and matching version/commit establish consistent declarations, not artifact contents, signatures or digests. A real upgrade still requires an artifact manifest, integrity verification, backups and compatibility checks.
35
+
36
+ ## Health, readiness and database identity
37
+
38
+ | Evidence | Default behavior | What it establishes |
39
+ |---|---|---|
40
+ | `/health` | Read | Instance response, pause flag and public application identity; a pause flag is not process death. |
41
+ | `/version` | Read | Declared application version, build commit and the latest packaged SQL filename and count. |
42
+ | `/health/ready` | `not_checked` | Read only with explicit `--readiness`; the server reads its database and migration ledger. |
43
+ | `/admin/api/version`, `/admin/api/status` | `not_checked`; no request | Protected state and applied migration details require separately authorized evidence. |
44
+
45
+ Opt in to readiness:
46
+
47
+ ```bash
48
+ npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
49
+ ```
50
+
51
+ This option causes the server to execute `SELECT 1` and read its migration ledger. It must not be described as having no database access. The tool itself still opens no direct database connection. `migrations.readiness` records only the public server summary, while `migrations.identity` remains `not_checked`. Zero pending migrations cannot prove the database identity, complete checksums or upgrade/downgrade compatibility. A JSONL backend that skips database checks remains `unknown` for this evidence.
52
+
53
+ A 401/403 response is recorded as `authentication_required` and `not_checked`. No authentication bypass or administrator endpoint request follows. Inconsistent health/version declarations, a mismatched expected commit, and a not-ready response are failures.
54
+
55
+ ## JSON and exit codes
56
+
57
+ The report schema is `bailing.deployment-diagnostics.v1`, with source, runtime, comparison, configuration, database, migrations, protected_endpoints, upgrade, checks and request scope. Identity states distinguish `verified`, `mismatch`, `unknown` and `not_checked`. Verified means the corresponding declaration was obtained and compared; it is not cryptographic artifact certification or production adoption evidence.
58
+
59
+ | Exit code | Meaning |
60
+ |---|---|
61
+ | `0` | Selected checks passed. Configuration, direct database access, applied migration identity and protected endpoints may remain unchecked. |
62
+ | `1` | An observed failure, unreachable target, unexpected response, rejected URL or identity mismatch. |
63
+ | `2` | Incomplete evidence: no URL, missing version/commit, authentication required for a selected public endpoint, or skipped database readiness checks. |
64
+ | `64` | Invalid CLI arguments. |
65
+
66
+ `upgrade.state` is always `not_checked`. Exit 0 grants no automatic upgrade or rollback permission and does not replace pause, drain, backup, migration approval or acceptance. Core diagnostics report only the designated Core's public declarations. Host instance management and client task orchestration belong to their respective projects.
67
+
68
+ Each request defaults to 5000 ms, configurable with `--timeout-ms` from 100 to 30000. The deadline includes body reads, with a 64 KiB decoded response cap. All redirects are rejected, including same-origin redirects; retry using the final Core URL. Requests carry JSON Accept only, with no login Cookie, Authorization or configuration credentials. Output retains only fixed allowlisted fields and reason codes, excluding raw exceptions, response bodies, redirect locations and input credentials. Invalid URLs are not echoed.
69
+
70
+ Without `--json`, a short human-readable result is printed. Automation should use `npm run --silent` for clean JSON and check both the exit code and report scope. Deployment mode ignores `BAILING_DOCTOR_FULL`, `BAILING_DOCTOR_SMOKE`, and smoke URL/Token environment variables.
71
+
72
+ ## Local validation
73
+
74
+ ```bash
75
+ node --import tsx --test scripts/doctor-deployment.test.ts
76
+ ```
77
+
78
+ Tests use temporary directories, loopback HTTP services and the existing public routes. They cover method/path restrictions, identity mismatch, authentication, readiness separation, deadlines, response caps, redirects and credential redaction. They do not connect to a real database, model or production service. Passing tests validate these diagnostic boundaries, not the acceptance of a target deployment.