bailinghub 0.9.1 → 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 (74) hide show
  1. package/README.en.md +6 -6
  2. package/README.md +6 -6
  3. package/docker-compose.images.yml +2 -2
  4. package/docs/CHANGELOG.en.md +12 -1
  5. package/docs/CHANGELOG.md +12 -1
  6. package/docs/CORE_RELIABILITY.en.md +59 -0
  7. package/docs/CORE_RELIABILITY.md +59 -0
  8. package/docs/DEPLOYMENT_DIAGNOSTICS.en.md +78 -0
  9. package/docs/DEPLOYMENT_DIAGNOSTICS.md +78 -0
  10. package/docs/IMPLEMENTATION_STATUS.en.md +22 -14
  11. package/docs/IMPLEMENTATION_STATUS.md +23 -15
  12. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  13. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  14. package/docs/KERNEL_HOST_API.en.md +2 -0
  15. package/docs/KERNEL_HOST_API.md +2 -0
  16. package/docs/MODEL_BILLING.en.md +4 -0
  17. package/docs/MODEL_BILLING.md +4 -0
  18. package/docs/MODEL_PROCESS_RECOVERY.en.md +32 -0
  19. package/docs/MODEL_PROCESS_RECOVERY.md +37 -0
  20. package/docs/README.en.md +5 -0
  21. package/docs/README.md +5 -0
  22. package/docs/RELEASE_NOTES_v0.9.2.en.md +45 -0
  23. package/docs/RELEASE_NOTES_v0.9.2.md +45 -0
  24. package/docs/UPGRADE_v0.9.2.en.md +62 -0
  25. package/docs/UPGRADE_v0.9.2.md +62 -0
  26. package/package.json +7 -3
  27. package/scripts/check-doc-links.mjs +2 -0
  28. package/scripts/check-image-tags.sh +1 -1
  29. package/scripts/check-release-consistency.test.mjs +2 -2
  30. package/scripts/doctor-deployment.test.ts +419 -0
  31. package/scripts/doctor-deployment.ts +357 -0
  32. package/scripts/doctor.ts +8 -1
  33. package/scripts/install-secrets.test.mjs +185 -0
  34. package/scripts/install.sh +10 -6
  35. package/scripts/publish-images.sh +1 -1
  36. package/scripts/release-audit.mjs +4 -0
  37. package/scripts/verify-github-repo.mjs +4 -0
  38. package/sql/065_usage_reconciliation_scan.sql +4 -0
  39. package/sql/066_approval_continuations.sql +15 -0
  40. package/sql/README.md +9 -0
  41. package/src/app/approval-continuations.mysql.test.ts +138 -0
  42. package/src/app/approval-continuations.test.ts +325 -0
  43. package/src/app/approval-continuations.ts +107 -0
  44. package/src/app/http-server.ts +3 -0
  45. package/src/app/kernel-model-process-crash.mysql.test.ts +377 -0
  46. package/src/app/kernel.ts +13 -0
  47. package/src/app/runtime-evidence-maintenance.test.ts +55 -0
  48. package/src/app/runtime-lifecycle-default.ts +7 -0
  49. package/src/app/runtime-lifecycle.ts +39 -0
  50. package/src/core/contracts/approval-continuation.ts +43 -0
  51. package/src/core/contracts/types.ts +2 -0
  52. package/src/core/state/approval-continuation.ts +22 -0
  53. package/src/core/state/state-codec.ts +1 -0
  54. package/src/core/state/state-contracts.ts +3 -0
  55. package/src/infrastructure/config/config-approval-ledger.ts +75 -0
  56. package/src/infrastructure/config/configstore.ts +2 -2
  57. package/src/infrastructure/state/state-jsonl.ts +41 -11
  58. package/src/infrastructure/state/state-mysql.ts +27 -0
  59. package/src/modules/usage/billing-reconciliation.mysql.test.ts +163 -0
  60. package/src/modules/usage/billing-reconciliation.test.ts +71 -0
  61. package/src/modules/usage/billing-repository.ts +54 -11
  62. package/src/modules/usage/maintenance.test.ts +62 -0
  63. package/src/modules/usage/maintenance.ts +31 -0
  64. package/src/modules/usage/model-gateway.ts +2 -1
  65. package/src/routes/admin-default.ts +2 -2
  66. package/src/routes/admin-runtime-default.ts +2 -2
  67. package/src/routes/admin-runtime.test.ts +1 -1
  68. package/src/routes/admin-runtime.ts +25 -18
  69. package/src/routes/admin.ts +1 -1
  70. package/src/routes/approvals-default.ts +2 -2
  71. package/src/routes/approvals.ts +30 -33
  72. package/src/routes/critical-routes.test.ts +16 -3
  73. package/src/test-support/approval-continuation-crash-child.ts +24 -0
  74. package/src/test-support/model-process-crash-child.ts +78 -0
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.1: asynchronous shutdown and public capability evidence
32
+ ## v0.9.2: secure installation and recovery of persisted evidence
33
33
 
34
- Core shutdown now waits within its original deadline for model completion, settlement, and related usage background work. Usage-drain timeouts retain the original instance for retry without redispatch. This patch also provides a public capability/evidence index and general security-governance updates.
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.1 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**. Independent client packages are not bumped for this patch. Shared USD allowances, the uniform multiplier, periodic price/allowance, and business authority remain unchanged, with no new APIs, SQL, or plan rules. 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.1.en.md) · [Upgrade guide](docs/UPGRADE_v0.9.1.en.md) · [Model billing](docs/MODEL_BILLING.en.md) · [Previous release](docs/RELEASE_NOTES_v0.9.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.9.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
@@ -214,7 +214,7 @@ Run separate BailingHub deployments for mutually isolated organizations. A `clie
214
214
  - [HTTP Contract](docs/CONTRACT.en.md) — stable network and identity boundaries.
215
215
  - [Architecture](docs/ARCHITECTURE.en.md) — runtime layers and dependency direction.
216
216
  - [English Documentation Map](docs/README.en.md) — the complete public documentation index.
217
- - [Changelog](docs/CHANGELOG.en.md) and [v0.9.1](docs/RELEASE_NOTES_v0.9.1.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.
218
218
 
219
219
  ## Feedback and Ecosystem
220
220
 
package/README.md CHANGED
@@ -27,13 +27,13 @@
27
27
 
28
28
  在线体验环境只用于了解产品和配置方式。请勿上传生产凭据、敏感数据或接入真实业务;正式使用请自行部署开源版。
29
29
 
30
- ## v0.9.1:异步工作关闭与公开能力证据
30
+ ## v0.9.2:安全安装与持久证据恢复
31
31
 
32
- 关闭 Core 时,在原时限内等待模型完成、结算及相关 usage 后台工作;usage 排空超时保留原实例供重试,不重派原请求。本版同时提供公开能力与证据索引,纳入通用安全治理。
32
+ 新安装只使用经过校验的安全随机凭据;后台结算在启动和周期维护中自动推进,无法计价的首批记录不再阻塞后续请求。审批已保存但审计或排队失败时,可按原决策补续,避免同一批准重复排队。
33
33
 
34
- 配套为 **Core 0.9.1 + MCP / Agent Client SDK 0.7.0 + DSH 0.7.0**,独立客户端包不因本补丁升版。已有共享 USD 额度、统一倍率、周期售价/额度与业务权限保持;没有新增 API、SQL 或套餐规则。升级时核对版本、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.1.md) · [升级指南](docs/UPGRADE_v0.9.1.md) · [模型计费](docs/MODEL_BILLING.md) · [上一版本](docs/RELEASE_NOTES_v0.9.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.9.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
@@ -199,7 +199,7 @@ BailingHub Core 是独立服务,只通过稳定网络契约与业务系统协
199
199
  | 集中开启本地智能体与工具 | [四步配置指南](docs/LOCAL_AGENT_SETUP.md) · [系统说明](docs/AGENT_SYSTEM_INFO.md) |
200
200
  | 查 API 与边界契约 | [HTTP 契约](docs/CONTRACT.md) · [Client API](docs/CLIENT_API.md) |
201
201
  | 理解架构与长期取舍 | [架构](docs/ARCHITECTURE.md) · [项目愿景](VISION.md) |
202
- | 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.9.1](docs/RELEASE_NOTES_v0.9.1.md) |
202
+ | 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.9.2](docs/RELEASE_NOTES_v0.9.2.md) |
203
203
 
204
204
  完整中英文文档地图见 [docs/README.md](docs/README.md)。公共 API、SDK、Schema、Docker Demo 与代码标识保持语言中立。
205
205
 
@@ -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.1}
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.1}
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.1.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,17 @@ 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
+
25
36
  ## v0.9.1 - Asynchronous model shutdown and public capability evidence
26
37
 
27
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).
package/docs/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ## 记录规则
7
7
 
8
- 每次先用业务助手、企业服务等通用场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.9.1.md)。
8
+ 每次先用业务助手、企业服务等通用场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.9.2.md)。
9
9
 
10
10
  每个公开版本至少说明:
11
11
 
@@ -15,6 +15,17 @@
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
+
18
29
  ## v0.9.1 - 异步模型工作关闭与公开能力证据
19
30
 
20
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)。
@@ -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.
@@ -0,0 +1,78 @@
1
+ # 只读部署诊断
2
+
3
+ 本页部署模式从 Core 0.9.2 提供;历史正式 `v0.9.1` Tag/npm 不包含该模式。请从包含 `scripts/doctor-deployment.ts` 的源码或正式制品执行以下命令。
4
+
5
+ 部署诊断沿用 `npm run doctor`,增加一个面向已安装 Core 的独立模式。原有不带参数的 doctor 继续检查源码、文档、示例和开源边界;部署模式只核对指定实例的公开健康与版本信息,不执行原有 doctor 的检查脚本。
6
+
7
+ 英文版见 [DEPLOYMENT_DIAGNOSTICS.en.md](DEPLOYMENT_DIAGNOSTICS.en.md)。部署与恢复步骤见 [OPERATIONS.md](OPERATIONS.md),能力和证据范围见 [IMPLEMENTATION_STATUS.md](IMPLEMENTATION_STATUS.md)。
8
+
9
+ ## 使用
10
+
11
+ 在 Core 源码、源码安装目录或已解包的 npm 制品目录执行:
12
+
13
+ ```bash
14
+ npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --json
15
+ ```
16
+
17
+ URL 必须由操作者显式提供,不从 `.env`、`config.json` 或 smoke 环境变量猜测目标。支持受控的 Core 挂载前缀,例如 `https://hub.example.com/core`;输出不显示这个前缀。URL 不能包含用户名、密码、query 或 fragment,诊断不接收 Token 参数,也不自动登录。
18
+
19
+ 默认仅发送 `GET /health` 和 `GET /version`。它不连接数据库、不读配置内容、不调用模型,也不执行迁移、安装、升级、回滚、容器或服务操作。仅检查 `config.json` 和 `.env` 是否存在;文件缺失可能表示由环境或宿主注入配置,因此有效配置仍标为 `unknown`。凭据安全性标为 `not_checked`,不会假装完成默认 Token 或数据库连接串检查。
20
+
21
+ 容器部署可在容器中已安装的 Core 目录执行相同命令,也可在外部解包的 Core 制品目录诊断公开 URL。工具不会运行 `docker inspect`、读取容器环境或推断正在运行的镜像 digest;容器启动、权限和 digest 须由部署流程另行核对。
22
+
23
+ 若本地目录不是要对照的制品,可显式指定受信任发行记录中的版本和提交。下面以核对历史 v0.9.1 实例为例:
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
+ 本地身份来自 `package.json` 与 Git HEAD;无 Git 时才使用 `build-info.json` 的提交。默认比较本地版本与提交,提交可按至少 12 位十六进制前缀匹配。Git 工作树另行只读检查并标为 `clean`、`dirty` 或 `not_checked`,不会输出文件名,也会禁用 fsmonitor hook 与可选 index 写入。默认对照本地源码时,dirty 或无法检查的 Git 工作树保留不完整结果,不把未提交内容当作 HEAD 对应制品。
31
+
32
+ 安装目录没有可用提交元数据时,source 保留 `unknown`,退出码为 2;显式期待值也不会补造本地源码身份。工具仍会输出已取得的公开结果,后续由部署流程提供缺失的制品证据。
33
+
34
+ 显式期待值只改变对照对象,不将另一个本地制品的 SQL 列表强行视为运行实例的列表。source 的依据是 `local_metadata`,runtime 的依据是 `reported_metadata`;两者的 `artifact_integrity` 均为 `not_checked`。即使工作树 clean、版本和提交完全匹配,也只证明声明一致,不能证明部署制品的内容、签名或 digest。正式升级仍须核验制品清单、完整性、备份和兼容性。
35
+
36
+ ## 健康、readiness 与数据库身份
37
+
38
+ | 证据 | 默认行为 | 能说明什么 |
39
+ |---|---|---|
40
+ | `/health` | 读取 | 实例响应、暂停标记与公开应用身份;暂停标记不等于进程死亡。 |
41
+ | `/version` | 读取 | 实例声明的应用版本、构建提交与制品所带 SQL 最新文件和数量。 |
42
+ | `/health/ready` | `not_checked` | 只有显式 `--readiness` 才读取;服务端会只读检查数据库及迁移账本。 |
43
+ | `/admin/api/version`、`/admin/api/status` | `not_checked`,不发送请求 | 受保护状态和已应用迁移明细需另行取得授权证据。 |
44
+
45
+ 显式检查 readiness:
46
+
47
+ ```bash
48
+ npm run --silent doctor -- --deployment --url http://127.0.0.1:18900 --readiness --json
49
+ ```
50
+
51
+ 此选项会让服务端执行 `SELECT 1` 和迁移账本读取,不应称为“无数据库访问”。工具本身仍不直接连接数据库。报告中 `migrations.readiness` 仅记录服务端公开摘要;`migrations.identity` 始终是 `not_checked`,不会以 pending 为零证明实际数据库身份、全量 checksum 或 SQL 升降级兼容。JSONL 后端跳过数据库检查时保留 `unknown`,不会写成数据库已验证。
52
+
53
+ 公开端点返回 401/403 时记录 `authentication_required` 和 `not_checked`,不尝试绕过权限或调用管理员端点。health 和 version 声明不一致、期待提交不符或 readiness 不就绪均作为失败证据。
54
+
55
+ ## JSON 与退出码
56
+
57
+ JSON 的 `schema` 为 `bailing.deployment-diagnostics.v1`,包含 source、runtime、comparison、configuration、database、migrations、protected_endpoints、upgrade、checks 和请求 scope。身份状态区分 `verified`、`mismatch`、`unknown`、`not_checked`;`verified` 表示取得且核对了对应声明,不是密码学制品认证或生产采用证明。
58
+
59
+ | 退出码 | 含义 |
60
+ |---|---|
61
+ | `0` | 本次选择的检查通过;配置、直接数据库连接、已应用迁移身份和受保护端点仍可能未检查。 |
62
+ | `1` | 实际失败、不可达、非预期响应、拒绝的 URL 或身份不一致。 |
63
+ | `2` | 证据不完整,例如未提供 URL、版本/提交缺失、所选公开端点需认证,或 readiness 跳过数据库。 |
64
+ | `64` | CLI 参数无效。 |
65
+
66
+ `upgrade.state` 始终是 `not_checked`。退出 0 不允许工具自行升级或回滚,也不替代暂停、排空、备份、迁移审批和上线验收。Core 诊断只核对指定 Core 的公开声明;宿主实例管理与客户端任务编排由各自项目负责。
67
+
68
+ 每个请求默认限时 5000 ms,可用 `--timeout-ms 100` 至 `--timeout-ms 30000` 调整;包含响应体读取,最多读取 64 KiB 解码后的内容。所有重定向均拒绝,包括同 origin 跳转,使用最终 Core URL 重试。请求只携带 JSON Accept,不携带登录 Cookie、Authorization 或配置凭据。输出只保留固定白名单字段和原因码,不输出异常正文、响应正文、重定向目标或输入中的凭据;错误 URL 不会原样打印。
69
+
70
+ 不带 `--json` 时输出简短可读结果。自动化应使用 `npm run --silent` 得到纯 JSON,并同时检查退出码与报告范围;`BAILING_DOCTOR_FULL`、`BAILING_DOCTOR_SMOKE` 和 smoke 的 URL/Token 环境变量不影响部署模式。
71
+
72
+ ## 本地验证
73
+
74
+ ```bash
75
+ node --import tsx --test scripts/doctor-deployment.test.ts
76
+ ```
77
+
78
+ 测试使用临时目录、临时 loopback HTTP 服务和现有公共路由,覆盖方法与路径白名单、身份不一致、权限、readiness 区分、超时、响应大小、重定向和凭据脱敏。测试不连接真实数据库、模型或生产服务。测试通过只说明这些诊断边界通过验证,不能替代目标部署的验收。
@@ -6,10 +6,10 @@ This index separates **ownership, release availability, public evidence, and lim
6
6
 
7
7
  ## Version and evidence conventions
8
8
 
9
- - Formal release baseline: [v0.9.1](https://github.com/bailinghub/bailinghub/releases/tag/v0.9.1), with the [v0.9.1 source Tag](https://github.com/bailinghub/bailinghub/tree/v0.9.1). The existing mechanisms below and the shutdown fix described later belong to this version. This does not mean that every optional feature is enabled by a default installation.
9
+ - Formal release baseline: [v0.9.2](https://github.com/bailinghub/bailinghub/releases/tag/v0.9.2), with the [v0.9.2 source Tag](https://github.com/bailinghub/bailinghub/tree/v0.9.2). The existing mechanisms below and the shutdown fix described later belong to this version. This does not mean that every optional feature is enabled by a default installation.
10
10
  - Historical baseline: [v0.9.0](https://github.com/bailinghub/bailinghub/releases/tag/v0.9.0), commit [`dae5260ede6565080d21e94ae63d52f3a7d23556`](https://github.com/bailinghub/bailinghub/tree/dae5260ede6565080d21e94ae63d52f3a7d23556). Its asynchronous shutdown gap remains documented below. Verify source, npm, images, and deployments separately; updated documentation does not fix old artifacts.
11
11
  - Test links identify **public test source and the conditions it checks**, not passing runs newly produced by this page. Unit tests, simulated provider responses, MySQL integration tests, and the complete demo have different scopes. Skipped or unexecuted tests are not passing evidence, and do not make an existing mechanism a planned feature.
12
- - Use the [v0.9.1 release notes](RELEASE_NOTES_v0.9.1.en.md) and [upgrade guide](UPGRADE_v0.9.1.en.md) for release contents and prerequisites. Compatible clients, application migrations, provider credentials, storage, and business authorization still require their own configuration and acceptance.
12
+ - Use the [v0.9.2 release notes](RELEASE_NOTES_v0.9.2.en.md) and [upgrade guide](UPGRADE_v0.9.2.en.md) for release contents and prerequisites. Compatible clients, application migrations, provider credentials, storage, and business authorization still require their own configuration and acceptance.
13
13
 
14
14
  ## Ownership and release availability
15
15
 
@@ -17,18 +17,18 @@ Core defaults to one organization's management and audit domain. Clients, routes
17
17
 
18
18
  | Capability and owner | Release availability | Public implementation and evidence | Scope and limitations |
19
19
  |---|---|---|---|
20
- | Declarations, tool discovery, and governed calls: Core parses/governs; the business system executes | Included in Core v0.9.1 | [Tool model](TOOLS_MODEL.en.md); [tool-index source](../src/services/tools-index.ts) / [tests](../src/services/tools-index.test.ts); [execution governance tests](../src/core/runtime/execution-runtime.test.ts) | Discoverability is not permission to call. The receiving API must verify the signature and recheck the subject, tenant, permissions, and business state. A declaration cannot create authority the caller did not have. |
21
- | Agent Auth: Core binds client sessions; the business authorization page supplies trusted identity | Included in Core v0.9.1 | [Agent Auth contract](AGENT_AUTH_API.en.md); [route source](../src/routes/agent-auth.ts); [lifecycle HTTP tests](../src/routes/agent-auth-lifecycle-http.test.ts) / [race tests](../src/infrastructure/config/config-agent-auth-lifecycle-race.test.ts) | PKCE, authorization binding, refresh, and revocation are implemented. They do not replace business login, role management, or final authorization, or let the model choose a trusted principal through text. |
22
- | Agent Client Runtime: Core exposes workspaces, turns, discovery, and tool invocation | Included in Core v0.9.1 | [Runtime API](AGENT_CLIENT_RUNTIME_API.en.md); [runtime source](../src/app/agent-client-runtime.ts) / [tests](../src/app/agent-client-runtime.test.ts); [invocation tests](../src/app/agent-tool-invocations.test.ts) | The local Agent host owns model selection, its reasoning loop, and tool orchestration. Core's existing `/run` pipeline is a separate public integration path; the two must not be presented as one client execution mode. |
23
- | Approvals, original invocation snapshots, and read-only receipts: Core governs; the business system owns the outcome | Included in Core v0.9.1 | [Receipts versus recovery](INVOCATION_RECEIPTS.md); [invocation source](../src/app/agent-tool-invocations.ts) / [tests](../src/app/agent-tool-invocations.test.ts); [approval-ledger tests](../src/infrastructure/config/config-approval-ledger.test.ts) | Reading an original receipt differs from resume, which may continue execution. Unknown outcomes do not permit replaying a write, and missing historical arguments must not be invented. Approval does not prove business success or guarantee rollback of a distributed business transaction. |
24
- | Cross-turn task controls: Core persists original members, write-call allowance, and concurrency occupancy | Included in Core v0.9.1 (introduced in v0.8.0) | [Task control contract](AGENT_TASK_CONTROL.en.md); [runtime source](../src/core/runtime/agent-task-control.ts) / [tests](../src/core/runtime/agent-task-control.test.ts); [MySQL journal integration tests](../src/infrastructure/config/config-agent-task-control-journal-mysql.test.ts) | These controls govern business invocations, not model-turn subscriptions. Write-call counts are not refund amounts, successful transactions, or Tokens. Pause/cancel cannot undo a permitted or completed business effect. |
25
- | Visible conversation audit: the client explicitly uploads; Core validates members and persists events | Included in Core v0.9.1 | [Conversation audit contract](AGENT_CONVERSATION_AUDIT.en.md); [runtime tests](../src/core/runtime/agent-conversation-audit.test.ts) | Hidden reasoning is not collected. Membership confirmation and a write API do not prove all history was uploaded. Audit archives do not merge authorization, sessions, or runtime memory. Cross-binding use retains the same-Hub and individual-identity boundaries. |
26
- | Current-thread context and optional rolling summaries: Core route/thread mechanisms | Included in Core v0.9.1 | [Memory configuration/rendering](../src/core/runtime/memory.ts); [thread injection source](../src/core/runtime/memory-runtime.ts) / [tests](../src/core/runtime/memory-runtime.test.ts); [summary tests](../src/core/runtime/summary-runtime.test.ts) | Summaries are disabled by default and still read from the original thread when enabled. This is not a complete user-level memory system across new conversations. Visible audit archives do not automatically enter model context. |
27
- | Attachment space: the host supplies approved images; Core uploads and returns usable URLs | Included in Core v0.9.1 (introduced in v0.8.0) | [Image attachment contract](GENERATED_ARTIFACTS.en.md); [artifact source](../src/app/agent-artifacts.ts) / [tests](../src/app/agent-artifacts.test.ts) | The first increment accepts PNG/JPEG/WebP, not documents or video. Operators configure storage and retention. Core cannot read the client's filesystem. Uploading an image and changing a business record with its URL are separate actions. |
28
- | Optional model gateway and USD allowance settlement: Core connects/meters; the client host orchestrates | Included in Core v0.9.1 | [Model billing contract](MODEL_BILLING.en.md); [gateway source](../src/modules/usage/model-gateway.ts); [model-gateway MySQL tests](../src/modules/usage/model-gateway.mysql.test.ts); [ledger unit tests](../src/modules/usage/billing-ledger.test.ts) | Shared USD allowances use a uniform multiplier and separate periodic price from allowance. They do not restore turn/step billing. Reference prices are not provider invoices; raw Tokens are not the allowance denominator. Missing authoritative usage does not permit inventing Tokens or fees. |
29
- | Model-tool directory, text-to-image, and original-request lookup: optional Core gateway extensions | Included in Core v0.9.1 | [Tool-description source](../src/modules/usage/model-tools.ts) / [tests](../src/modules/usage/model-tools.test.ts); [provider adapter tests](../src/modules/usage/model-tool-provider.test.ts); [asynchronous-image MySQL tests](../src/modules/usage/model-tool-gateway.mysql.test.ts) | Executable adapters include Alibaba-compatible Images, native DashScope, and OpenRouter Images. A video, voice, or custom-service directory declaration does not provide an execution adapter. The completion/shutdown boundary is described below. |
30
- | Kernel Host API, explicit migrations, and managed lifecycle: Core provides an embedding entry point; the Host manages processes and isolation | Included in Core v0.9.1 | [Kernel Host API](KERNEL_HOST_API.en.md); [Kernel source](../src/app/kernel.ts) / [tests](../src/app/kernel.test.ts); [artifact-manifest tests](../src/kernel-api/v1/artifact.test.ts); [migration tests](../src/infrastructure/schema/core-schema-migrator.test.ts) | Separate MySQL schemas/runtimeRoots, trusted instanceKeys, explicit migrations, and Host-owned tick/close calls are prerequisites. The API does not provide tenant signup, platform plans, cluster directories, or multi-replica upgrade orchestration. The optional usage gateway is not the Host's platform billing product. |
31
- | Installation, smoke checks, and optional operational metrics: Core provides entry points; operators configure and accept deployments | Included in Core v0.9.1 | [Quickstart](QUICKSTART.en.md); [installer](../scripts/install.sh); [smoke script](../scripts/smoke.ts); [OpenMetrics tests](../src/core/observability/openmetrics.test.ts); [independent reproduction task](INDEPENDENT_VALIDATION.en.md) | A health response does not establish that all business operations/providers are available. Metrics require explicit enablement and access protection. Installation/diagnostic entry points do not establish continuous monitoring, staffed alerts, or acceptance of a particular deployment. |
20
+ | Declarations, tool discovery, and governed calls: Core parses/governs; the business system executes | Included in Core v0.9.2 | [Tool model](TOOLS_MODEL.en.md); [tool-index source](../src/services/tools-index.ts) / [tests](../src/services/tools-index.test.ts); [execution governance tests](../src/core/runtime/execution-runtime.test.ts) | Discoverability is not permission to call. The receiving API must verify the signature and recheck the subject, tenant, permissions, and business state. A declaration cannot create authority the caller did not have. |
21
+ | Agent Auth: Core binds client sessions; the business authorization page supplies trusted identity | Included in Core v0.9.2 | [Agent Auth contract](AGENT_AUTH_API.en.md); [route source](../src/routes/agent-auth.ts); [lifecycle HTTP tests](../src/routes/agent-auth-lifecycle-http.test.ts) / [race tests](../src/infrastructure/config/config-agent-auth-lifecycle-race.test.ts) | PKCE, authorization binding, refresh, and revocation are implemented. They do not replace business login, role management, or final authorization, or let the model choose a trusted principal through text. |
22
+ | Agent Client Runtime: Core exposes workspaces, turns, discovery, and tool invocation | Included in Core v0.9.2 | [Runtime API](AGENT_CLIENT_RUNTIME_API.en.md); [runtime source](../src/app/agent-client-runtime.ts) / [tests](../src/app/agent-client-runtime.test.ts); [invocation tests](../src/app/agent-tool-invocations.test.ts) | The local Agent host owns model selection, its reasoning loop, and tool orchestration. Core's existing `/run` pipeline is a separate public integration path; the two must not be presented as one client execution mode. |
23
+ | Approvals, original invocation snapshots, and read-only receipts: Core governs; the business system owns the outcome | Included in Core v0.9.2 | [Receipts versus recovery](INVOCATION_RECEIPTS.md); [invocation source](../src/app/agent-tool-invocations.ts) / [tests](../src/app/agent-tool-invocations.test.ts); [approval-ledger tests](../src/infrastructure/config/config-approval-ledger.test.ts) | Reading an original receipt differs from resume, which may continue execution. Unknown outcomes do not permit replaying a write, and missing historical arguments must not be invented. Approval does not prove business success or guarantee rollback of a distributed business transaction. |
24
+ | Cross-turn task controls: Core persists original members, write-call allowance, and concurrency occupancy | Included in Core v0.9.2 (introduced in v0.8.0) | [Task control contract](AGENT_TASK_CONTROL.en.md); [runtime source](../src/core/runtime/agent-task-control.ts) / [tests](../src/core/runtime/agent-task-control.test.ts); [MySQL journal integration tests](../src/infrastructure/config/config-agent-task-control-journal-mysql.test.ts) | These controls govern business invocations, not model-turn subscriptions. Write-call counts are not refund amounts, successful transactions, or Tokens. Pause/cancel cannot undo a permitted or completed business effect. |
25
+ | Visible conversation audit: the client explicitly uploads; Core validates members and persists events | Included in Core v0.9.2 | [Conversation audit contract](AGENT_CONVERSATION_AUDIT.en.md); [runtime tests](../src/core/runtime/agent-conversation-audit.test.ts) | Hidden reasoning is not collected. Membership confirmation and a write API do not prove all history was uploaded. Audit archives do not merge authorization, sessions, or runtime memory. Cross-binding use retains the same-Hub and individual-identity boundaries. |
26
+ | Current-thread context and optional rolling summaries: Core route/thread mechanisms | Included in Core v0.9.2 | [Memory configuration/rendering](../src/core/runtime/memory.ts); [thread injection source](../src/core/runtime/memory-runtime.ts) / [tests](../src/core/runtime/memory-runtime.test.ts); [summary tests](../src/core/runtime/summary-runtime.test.ts) | Summaries are disabled by default and still read from the original thread when enabled. This is not a complete user-level memory system across new conversations. Visible audit archives do not automatically enter model context. |
27
+ | Attachment space: the host supplies approved images; Core uploads and returns usable URLs | Included in Core v0.9.2 (introduced in v0.8.0) | [Image attachment contract](GENERATED_ARTIFACTS.en.md); [artifact source](../src/app/agent-artifacts.ts) / [tests](../src/app/agent-artifacts.test.ts) | The first increment accepts PNG/JPEG/WebP, not documents or video. Operators configure storage and retention. Core cannot read the client's filesystem. Uploading an image and changing a business record with its URL are separate actions. |
28
+ | Optional model gateway and USD allowance settlement: Core connects/meters; the client host orchestrates | Included in Core v0.9.2 | [Model billing contract](MODEL_BILLING.en.md); [gateway source](../src/modules/usage/model-gateway.ts); [model-gateway MySQL tests](../src/modules/usage/model-gateway.mysql.test.ts); [ledger unit tests](../src/modules/usage/billing-ledger.test.ts) | Shared USD allowances use a uniform multiplier and separate periodic price from allowance. They do not restore turn/step billing. Reference prices are not provider invoices; raw Tokens are not the allowance denominator. Missing authoritative usage does not permit inventing Tokens or fees. |
29
+ | Model-tool directory, text-to-image, and original-request lookup: optional Core gateway extensions | Included in Core v0.9.2 | [Tool-description source](../src/modules/usage/model-tools.ts) / [tests](../src/modules/usage/model-tools.test.ts); [provider adapter tests](../src/modules/usage/model-tool-provider.test.ts); [asynchronous-image MySQL tests](../src/modules/usage/model-tool-gateway.mysql.test.ts) | Executable adapters include Alibaba-compatible Images, native DashScope, and OpenRouter Images. A video, voice, or custom-service directory declaration does not provide an execution adapter. The completion/shutdown boundary is described below. |
30
+ | Kernel Host API, explicit migrations, and managed lifecycle: Core provides an embedding entry point; the Host manages processes and isolation | Included in Core v0.9.2 | [Kernel Host API](KERNEL_HOST_API.en.md); [Kernel source](../src/app/kernel.ts) / [tests](../src/app/kernel.test.ts); [artifact-manifest tests](../src/kernel-api/v1/artifact.test.ts); [migration tests](../src/infrastructure/schema/core-schema-migrator.test.ts) | Separate MySQL schemas/runtimeRoots, trusted instanceKeys, explicit migrations, and Host-owned tick/close calls are prerequisites. The API does not provide tenant signup, platform plans, cluster directories, or multi-replica upgrade orchestration. The optional usage gateway is not the Host's platform billing product. |
31
+ | Installation, smoke checks, and optional operational metrics: Core provides entry points; operators configure and accept deployments | Included in Core v0.9.2 | [Quickstart](QUICKSTART.en.md); [installer](../scripts/install.sh); [smoke script](../scripts/smoke.ts); [OpenMetrics tests](../src/core/observability/openmetrics.test.ts); [independent reproduction task](INDEPENDENT_VALIDATION.en.md) | A health response does not establish that all business operations/providers are available. Metrics require explicit enablement and access protection. Installation/diagnostic entry points do not establish continuous monitoring, staffed alerts, or acceptance of a particular deployment. |
32
32
 
33
33
  ## What the public validation paths establish
34
34
 
@@ -71,3 +71,11 @@ A version field or this page does not substitute for artifact checks. Evaluate n
71
71
  - Complete user-level long-term memory, media tools without executable adapters, and real providers/business systems not accepted through the public paths listed here are not validated capabilities of this index. This page creates no new product timetable for them.
72
72
 
73
73
  Keep this page and its Chinese companion aligned. Retain the distinction between formal Tags and main, and update a capability's availability or validation scope only when its corresponding public evidence changes.
74
+
75
+ ## Additional process-recovery regressions in Core v0.9.2
76
+
77
+ [Process crash and lost acknowledgements](MODEL_PROCESS_RECOVERY.en.md) use real SIGKILL, replacement PIDs and withheld MySQL COMMIT acknowledgements to check original requests, provider call counts, results and USD ledgers. These opt-in tests are included in Core v0.9.2, not in the historical v0.9.1 Tag. The link states coverage, not a new execution, real-provider or production-crash acceptance claim.
78
+
79
+ ## Reliability fixes in Core v0.9.2
80
+
81
+ [Installation secrets, settlement maintenance and approval continuation](CORE_RELIABILITY.en.md) covers failing closed without secure installation randomness, settlement without new traffic and durable continuation of approval decisions. It adds incremental migrations 065/066. Public checks include [installer failure tests](../scripts/install-secrets.test.mjs), [settlement MySQL acceptance](../src/modules/usage/billing-reconciliation.mysql.test.ts), [approval continuation tests](../src/app/approval-continuations.test.ts) and [approval MySQL/process acceptance](../src/app/approval-continuations.mysql.test.ts). These describe Core v0.9.2 implementation and coverage; they do not expand the historical v0.9.1 artifact guarantees.