bailinghub 0.3.0

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 (716) hide show
  1. package/.dockerignore +42 -0
  2. package/.env.example +83 -0
  3. package/.gitignore +44 -0
  4. package/.npmignore +56 -0
  5. package/CODE_OF_CONDUCT.md +24 -0
  6. package/CONTRIBUTING.md +74 -0
  7. package/Dockerfile +16 -0
  8. package/LICENSE +176 -0
  9. package/LICENSING.md +9 -0
  10. package/NOTICE +23 -0
  11. package/README.en.md +264 -0
  12. package/README.md +279 -0
  13. package/SECURITY.md +30 -0
  14. package/THIRD_PARTY_NOTICES.md +254 -0
  15. package/VISION.md +41 -0
  16. package/assets/architecture-overview.en-dark.png +0 -0
  17. package/assets/architecture-overview.en-dark.svg +57 -0
  18. package/assets/architecture-overview.en.png +0 -0
  19. package/assets/architecture-overview.en.svg +57 -0
  20. package/assets/architecture-overview.zh-CN-dark.png +0 -0
  21. package/assets/architecture-overview.zh-CN-dark.svg +57 -0
  22. package/assets/architecture-overview.zh-CN.png +0 -0
  23. package/assets/architecture-overview.zh-CN.svg +57 -0
  24. package/assets/bailinghub-lockup-dark.png +0 -0
  25. package/assets/bailinghub-lockup-dark.svg +8 -0
  26. package/assets/bailinghub-lockup.png +0 -0
  27. package/assets/bailinghub-lockup.svg +8 -0
  28. package/brain/README.en.md +23 -0
  29. package/brain/README.md +45 -0
  30. package/brain/agents/code-review.md +41 -0
  31. package/brain/agents/triage.md +37 -0
  32. package/brain/profiles.json +114 -0
  33. package/brain/runbooks/ticket-triage.md +24 -0
  34. package/config.example.json +58 -0
  35. package/contracts/client-api/consumers.json +28 -0
  36. package/contracts/client-api/v1/error-response.schema.json +21 -0
  37. package/contracts/client-api/v1/health-response.schema.json +13 -0
  38. package/contracts/client-api/v1/job-response.schema.json +49 -0
  39. package/contracts/client-api/v1/manifest.json +63 -0
  40. package/contracts/client-api/v1/run-request.schema.json +42 -0
  41. package/contracts/client-api/v1/submit-response.schema.json +35 -0
  42. package/contracts/client-api/v1/vectors.json +153 -0
  43. package/demo/business/Dockerfile +8 -0
  44. package/demo/business/server.mjs +483 -0
  45. package/docker-compose.images.yml +67 -0
  46. package/docker-compose.yml +79 -0
  47. package/docs/AI_FRIENDLY_TOOLS.en.md +69 -0
  48. package/docs/AI/345/217/213/345/245/275/345/267/245/345/205/267/350/256/276/350/256/241/346/214/207/345/215/227.md +198 -0
  49. package/docs/ARCHITECTURE.en.md +81 -0
  50. package/docs/ARCHITECTURE.md +795 -0
  51. package/docs/CHANGELOG.en.md +275 -0
  52. package/docs/CHANGELOG.md +279 -0
  53. package/docs/CHANNELS.en.md +35 -0
  54. package/docs/CHANNELS.md +72 -0
  55. package/docs/CLIENT_API.md +89 -0
  56. package/docs/COMPATIBILITY.en.md +103 -0
  57. package/docs/CONTRACT.en.md +254 -0
  58. package/docs/CONTRACT.md +653 -0
  59. package/docs/DEMO.en.md +90 -0
  60. package/docs/DEMO.md +297 -0
  61. package/docs/ECOSYSTEM.en.md +39 -0
  62. package/docs/ECOSYSTEM.md +39 -0
  63. package/docs/INDEPENDENT_VALIDATION.en.md +184 -0
  64. package/docs/INDEPENDENT_VALIDATION.md +184 -0
  65. package/docs/INTEGRATION.en.md +120 -0
  66. package/docs/KERNEL_HOST_API.en.md +59 -0
  67. package/docs/KERNEL_HOST_API.md +59 -0
  68. package/docs/OPERATIONS.en.md +182 -0
  69. package/docs/OPERATIONS.md +231 -0
  70. package/docs/PIPELINE.en.md +74 -0
  71. package/docs/PIPELINE.md +67 -0
  72. package/docs/QUICKSTART.en.md +297 -0
  73. package/docs/QUICKSTART.md +152 -0
  74. package/docs/README.en.md +103 -0
  75. package/docs/README.md +119 -0
  76. package/docs/RELEASE_NOTES_v0.1.0.en.md +46 -0
  77. package/docs/RELEASE_NOTES_v0.1.0.md +66 -0
  78. package/docs/RELEASE_NOTES_v0.1.1.en.md +38 -0
  79. package/docs/RELEASE_NOTES_v0.1.1.md +38 -0
  80. package/docs/RELEASE_NOTES_v0.1.10.en.md +102 -0
  81. package/docs/RELEASE_NOTES_v0.1.10.md +102 -0
  82. package/docs/RELEASE_NOTES_v0.1.11.en.md +99 -0
  83. package/docs/RELEASE_NOTES_v0.1.11.md +99 -0
  84. package/docs/RELEASE_NOTES_v0.1.12.en.md +64 -0
  85. package/docs/RELEASE_NOTES_v0.1.12.md +64 -0
  86. package/docs/RELEASE_NOTES_v0.1.13.en.md +46 -0
  87. package/docs/RELEASE_NOTES_v0.1.13.md +46 -0
  88. package/docs/RELEASE_NOTES_v0.1.14.en.md +55 -0
  89. package/docs/RELEASE_NOTES_v0.1.14.md +55 -0
  90. package/docs/RELEASE_NOTES_v0.1.15.en.md +50 -0
  91. package/docs/RELEASE_NOTES_v0.1.15.md +50 -0
  92. package/docs/RELEASE_NOTES_v0.1.16.en.md +106 -0
  93. package/docs/RELEASE_NOTES_v0.1.16.md +105 -0
  94. package/docs/RELEASE_NOTES_v0.1.2.en.md +39 -0
  95. package/docs/RELEASE_NOTES_v0.1.2.md +39 -0
  96. package/docs/RELEASE_NOTES_v0.1.3.en.md +55 -0
  97. package/docs/RELEASE_NOTES_v0.1.3.md +55 -0
  98. package/docs/RELEASE_NOTES_v0.1.4.en.md +55 -0
  99. package/docs/RELEASE_NOTES_v0.1.4.md +55 -0
  100. package/docs/RELEASE_NOTES_v0.1.5.en.md +49 -0
  101. package/docs/RELEASE_NOTES_v0.1.5.md +49 -0
  102. package/docs/RELEASE_NOTES_v0.1.6.en.md +41 -0
  103. package/docs/RELEASE_NOTES_v0.1.6.md +41 -0
  104. package/docs/RELEASE_NOTES_v0.1.7.en.md +39 -0
  105. package/docs/RELEASE_NOTES_v0.1.7.md +39 -0
  106. package/docs/RELEASE_NOTES_v0.1.8.en.md +88 -0
  107. package/docs/RELEASE_NOTES_v0.1.8.md +88 -0
  108. package/docs/RELEASE_NOTES_v0.1.9.en.md +127 -0
  109. package/docs/RELEASE_NOTES_v0.1.9.md +127 -0
  110. package/docs/RELEASE_NOTES_v0.2.0.en.md +95 -0
  111. package/docs/RELEASE_NOTES_v0.2.0.md +96 -0
  112. package/docs/RELEASE_NOTES_v0.3.0.en.md +77 -0
  113. package/docs/RELEASE_NOTES_v0.3.0.md +77 -0
  114. package/docs/SDK.en.md +177 -0
  115. package/docs/STREAMING.en.md +78 -0
  116. package/docs/STREAMING.md +109 -0
  117. package/docs/TOOLS.en.md +205 -0
  118. package/docs/TOOLS_DESIGN.en.md +142 -0
  119. package/docs/TOOLS_DESIGN.md +466 -0
  120. package/docs/TOOLS_MODEL.en.md +56 -0
  121. package/docs/TOOLS_MODEL.md +903 -0
  122. package/docs/WIDGET_RENDERERS.en.md +133 -0
  123. package/docs/WIDGET_RENDERERS.md +139 -0
  124. package/docs/examples/bailing-tool-verify.mjs +94 -0
  125. package/docs/examples/bailing-tool-verify.php +154 -0
  126. package/docs/examples/bailing-tool-verify.py +107 -0
  127. package/docs/examples/custom-streaming-chat-client.mjs +108 -0
  128. package/docs/examples/widget-chart-renderer-adapter.mjs +44 -0
  129. package/docs/integrations/bailian/README.en.md +181 -0
  130. package/docs/integrations/bailian/README.md +165 -0
  131. package/docs/integrations/bailian/bailian-mcp-config.json +17 -0
  132. package/docs/integrations/bailian/verify_recipe.py +97 -0
  133. package/docs/integrations/deepseek/README.en.md +225 -0
  134. package/docs/integrations/deepseek/README.md +225 -0
  135. package/docs/integrations/deepseek/verify_e2e.py +131 -0
  136. package/docs/integrations/dify/README.en.md +131 -0
  137. package/docs/integrations/dify/README.md +131 -0
  138. package/docs/integrations/dify/bailinghub-control-plane.openapi.json +129 -0
  139. package/docs/integrations/dify/verify_contract.py +88 -0
  140. package/docs/integrations/dify/verify_e2e.py +117 -0
  141. package/docs/integrations/jeecgboot/README.en.md +193 -0
  142. package/docs/integrations/jeecgboot/README.md +161 -0
  143. package/docs/integrations/jeecgboot/adapter-contract.v1.json +94 -0
  144. package/docs/integrations/jeecgboot/jeecgboot-user-adapter.openapi.json +183 -0
  145. package/docs/integrations/jeecgboot/verify_recipe.mjs +97 -0
  146. package/docs/integrations/ruoyi-vue-pro/README.en.md +91 -0
  147. package/docs/integrations/ruoyi-vue-pro/README.md +155 -0
  148. package/docs/integrations/ruoyi-vue-pro/adapter-contract.v1.json +71 -0
  149. package/docs/integrations/ruoyi-vue-pro/ruoyi-vue-pro-trade-adapter.openapi.json +148 -0
  150. package/docs/integrations/ruoyi-vue-pro/verify_recipe.mjs +71 -0
  151. package/docs/user-guide/README.en.md +39 -0
  152. package/docs/user-guide/README.md +40 -0
  153. package/docs/user-guide/concepts.en.md +69 -0
  154. package/docs/user-guide/concepts.md +225 -0
  155. package/docs/user-guide/console-map.en.md +58 -0
  156. package/docs/user-guide/console-map.md +473 -0
  157. package/docs/user-guide/overview.en.md +61 -0
  158. package/docs/user-guide/overview.md +156 -0
  159. package/docs/user-guide/scenarios.en.md +70 -0
  160. package/docs/user-guide/scenarios.md +398 -0
  161. package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +134 -0
  162. package/docs//347/254/254/344/270/211/346/226/271/345/257/271/346/216/245/346/214/207/345/215/227.md +625 -0
  163. package/package.json +119 -0
  164. package/schemas/agent-capability-contract.schema.json +104 -0
  165. package/schemas/api/approval-decision.schema.json +28 -0
  166. package/schemas/api/approval-request.schema.json +31 -0
  167. package/schemas/api/delivery-callback.schema.json +28 -0
  168. package/schemas/api/job-response.schema.json +6 -0
  169. package/schemas/api/kb-doc-upsert.schema.json +21 -0
  170. package/schemas/api/run-request.schema.json +6 -0
  171. package/schemas/api/run-response.schema.json +6 -0
  172. package/schemas/api/tool-spec.schema.json +38 -0
  173. package/schemas/config/alert-rule.schema.json +22 -0
  174. package/schemas/config/channel.schema.json +91 -0
  175. package/schemas/config/chat-entry.schema.json +47 -0
  176. package/schemas/config/client.schema.json +56 -0
  177. package/schemas/config/common.schema.json +215 -0
  178. package/schemas/config/credential.schema.json +48 -0
  179. package/schemas/config/executor-token.schema.json +20 -0
  180. package/schemas/config/page-context.schema.json +21 -0
  181. package/schemas/config/route.schema.json +152 -0
  182. package/schemas/config/storage-bucket.schema.json +31 -0
  183. package/schemas/config/target.schema.json +17 -0
  184. package/schemas/config/tool-provider.schema.json +60 -0
  185. package/schemas/tool-definition.schema.json +188 -0
  186. package/scripts/check-client-api-ecosystem.mjs +69 -0
  187. package/scripts/check-doc-links.mjs +136 -0
  188. package/scripts/check-image-tags.sh +43 -0
  189. package/scripts/check-package-artifact.mjs +185 -0
  190. package/scripts/check-release-consistency.mjs +199 -0
  191. package/scripts/check-release-consistency.test.mjs +63 -0
  192. package/scripts/client-api-contract-test.ts +127 -0
  193. package/scripts/create-admin.ts +27 -0
  194. package/scripts/demo-e2e.ts +133 -0
  195. package/scripts/docker-entrypoint.sh +33 -0
  196. package/scripts/doctor.ts +107 -0
  197. package/scripts/e2e-console.mjs +214 -0
  198. package/scripts/export-oss.mjs +204 -0
  199. package/scripts/generate-readme-assets.mjs +181 -0
  200. package/scripts/generate-third-party-notices.mjs +93 -0
  201. package/scripts/image-release-policy.mjs +75 -0
  202. package/scripts/image-release-policy.test.mjs +58 -0
  203. package/scripts/init-db.ts +21 -0
  204. package/scripts/install.sh +461 -0
  205. package/scripts/oss-boundary-check.mjs +183 -0
  206. package/scripts/publish-images.sh +63 -0
  207. package/scripts/publish-mysql-image.sh +41 -0
  208. package/scripts/release-audit.mjs +348 -0
  209. package/scripts/sdk-contract-test.ts +62 -0
  210. package/scripts/sdk-p1-check.mjs +58 -0
  211. package/scripts/sdk-runtime-test.mjs +106 -0
  212. package/scripts/security-scan.mjs +110 -0
  213. package/scripts/seed-demo.ts +116 -0
  214. package/scripts/selftest.ts +226 -0
  215. package/scripts/smoke.ts +31 -0
  216. package/scripts/validate-examples.mjs +93 -0
  217. package/scripts/verify-bootstrap-admin-restart.ts +66 -0
  218. package/scripts/verify-github-repo.mjs +195 -0
  219. package/scripts/verify-oss-export.mjs +192 -0
  220. package/scripts/verify-routing.ts +29 -0
  221. package/scripts/widget-renderer-test.mjs +206 -0
  222. package/scripts/write-build-info.mjs +29 -0
  223. package/sdk/dotnet/Bailing.Connect/Bailing.Connect.csproj +12 -0
  224. package/sdk/dotnet/Bailing.Connect/BailingConnect.cs +260 -0
  225. package/sdk/dotnet/README.md +32 -0
  226. package/sdk/dotnet/examples/BuildSpec/BuildSpec.csproj +11 -0
  227. package/sdk/dotnet/examples/BuildSpec/Program.cs +36 -0
  228. package/sdk/go/README.md +33 -0
  229. package/sdk/go/bailingconnect/connect.go +367 -0
  230. package/sdk/go/examples/build-spec/main.go +39 -0
  231. package/sdk/go/go.mod +3 -0
  232. package/sdk/java/README.md +43 -0
  233. package/sdk/java/examples/BuildSpec.java +31 -0
  234. package/sdk/java/src/main/java/com/bailing/connect/BailingConnect.java +376 -0
  235. package/sdk/node/README.md +107 -0
  236. package/sdk/node/examples/build-spec.mjs +84 -0
  237. package/sdk/node/package.json +22 -0
  238. package/sdk/node/src/index.mjs +250 -0
  239. package/sdk/php/README.md +204 -0
  240. package/sdk/php/composer.json +18 -0
  241. package/sdk/php/examples/DemoStaffController.php +108 -0
  242. package/sdk/php/examples/build-spec.php +27 -0
  243. package/sdk/php/examples/thinkphp-integration.php +81 -0
  244. package/sdk/php/src/Attributes/AiParam.php +40 -0
  245. package/sdk/php/src/Attributes/AiTool.php +75 -0
  246. package/sdk/php/src/HubClient.php +122 -0
  247. package/sdk/php/src/SpecBuilder.php +328 -0
  248. package/sdk/php/src/SpecServer.php +209 -0
  249. package/sdk/php/src/Ticket.php +37 -0
  250. package/sdk/php/src/Verify.php +178 -0
  251. package/sdk/php7/README.md +191 -0
  252. package/sdk/php7/composer.json +18 -0
  253. package/sdk/php7/examples/build-spec.php +68 -0
  254. package/sdk/php7/examples/well-known.php +33 -0
  255. package/sdk/php7/src/HubClient.php +111 -0
  256. package/sdk/php7/src/SpecServer.php +203 -0
  257. package/sdk/php7/src/Ticket.php +33 -0
  258. package/sdk/php7/src/ToolDef.php +169 -0
  259. package/sdk/php7/src/ToolSpec.php +334 -0
  260. package/sdk/php7/src/Verify.php +165 -0
  261. package/sdk/python/README.md +107 -0
  262. package/sdk/python/bailing_connect/__init__.py +307 -0
  263. package/sdk/python/examples/build_spec.py +90 -0
  264. package/sdk/python/pyproject.toml +24 -0
  265. package/sql/001_init_state.sql +66 -0
  266. package/sql/002_routes.sql +44 -0
  267. package/sql/003_executor.sql +15 -0
  268. package/sql/004_clients.sql +22 -0
  269. package/sql/005_admins.sql +25 -0
  270. package/sql/006_ledger.sql +57 -0
  271. package/sql/007_delivery.sql +8 -0
  272. package/sql/008_kb.sql +66 -0
  273. package/sql/009_rbac.sql +5 -0
  274. package/sql/010_targets.sql +28 -0
  275. package/sql/011_observability.sql +11 -0
  276. package/sql/012_generic.sql +5 -0
  277. package/sql/013_tools.sql +24 -0
  278. package/sql/014_approvals.sql +27 -0
  279. package/sql/015_chat.sql +21 -0
  280. package/sql/016_chat_feedback.sql +19 -0
  281. package/sql/017_provider_autorefresh.sql +6 -0
  282. package/sql/018_kb_ingest.sql +11 -0
  283. package/sql/019_kb_datasources.sql +32 -0
  284. package/sql/022_storage_buckets.sql +25 -0
  285. package/sql/024_channels.sql +15 -0
  286. package/sql/025_chat_appearance.sql +7 -0
  287. package/sql/026_thread_memory.sql +10 -0
  288. package/sql/027_page_contexts.sql +23 -0
  289. package/sql/028_executor_capabilities.sql +4 -0
  290. package/sql/029_executor_tokens.sql +13 -0
  291. package/sql/030_route_permission.sql +5 -0
  292. package/sql/031_tool_embeddings.sql +20 -0
  293. package/sql/032_tool_provider_embed.sql +7 -0
  294. package/sql/033_alert_rules.sql +21 -0
  295. package/sql/034_client_allowed_channels.sql +6 -0
  296. package/sql/035_tool_idempotency.sql +15 -0
  297. package/sql/036_delivery_dlq.sql +15 -0
  298. package/sql/038_audit_trace_shape.sql +15 -0
  299. package/sql/039_runtime_locks.sql +9 -0
  300. package/sql/040_budget_policy.sql +3 -0
  301. package/sql/041_approval_intent.sql +14 -0
  302. package/sql/042_approval_decision_contract.sql +11 -0
  303. package/sql/043_rate_limits.sql +7 -0
  304. package/sql/044_job_run_after.sql +3 -0
  305. package/sql/045_job_claim_lease.sql +7 -0
  306. package/sql/046_tool_authz_probe.sql +5 -0
  307. package/sql/047_route_audience.sql +4 -0
  308. package/sql/048_llm_target.sql +17 -0
  309. package/sql/049_llm_input_shape.sql +11 -0
  310. package/sql/050_operational_metrics_indexes.sql +8 -0
  311. package/sql/051_instance_branding.sql +17 -0
  312. package/sql/052_tool_execution_journal.sql +19 -0
  313. package/sql/053_tool_spec_access_policy.sql +9 -0
  314. package/sql/README.en.md +41 -0
  315. package/sql/README.md +40 -0
  316. package/src/adapters/channels/wecom-api.test.ts +77 -0
  317. package/src/adapters/channels/wecom-api.ts +224 -0
  318. package/src/adapters/channels/wecom-crypto.test.ts +85 -0
  319. package/src/adapters/channels/wecom-crypto.ts +77 -0
  320. package/src/adapters/executors/claudecode.ts +39 -0
  321. package/src/adapters/executors/profiles.ts +86 -0
  322. package/src/adapters/executors/report.ts +35 -0
  323. package/src/adapters/executors/runner.ts +114 -0
  324. package/src/adapters/executors/wecomnotify.ts +63 -0
  325. package/src/adapters/llm/file.test.ts +81 -0
  326. package/src/adapters/llm/file.ts +250 -0
  327. package/src/adapters/llm/openai-chat-stream.test.ts +74 -0
  328. package/src/adapters/llm/openai-chat-stream.ts +154 -0
  329. package/src/adapters/llm/perception.ts +159 -0
  330. package/src/adapters/llm/speech.test.ts +75 -0
  331. package/src/adapters/llm/speech.ts +146 -0
  332. package/src/adapters/storage/object-storage.test.ts +38 -0
  333. package/src/adapters/storage/object-storage.ts +140 -0
  334. package/src/adapters/targets/demo-agent.ts +88 -0
  335. package/src/adapters/targets/llm.test.ts +733 -0
  336. package/src/adapters/targets/llm.ts +862 -0
  337. package/src/app/admin-bootstrap.test.ts +112 -0
  338. package/src/app/admin-bootstrap.ts +48 -0
  339. package/src/app/auth-default.ts +26 -0
  340. package/src/app/auth.test.ts +57 -0
  341. package/src/app/auth.ts +207 -0
  342. package/src/app/builtin-tools-default.ts +17 -0
  343. package/src/app/builtin-tools.test.ts +202 -0
  344. package/src/app/builtin-tools.ts +380 -0
  345. package/src/app/channels-default.ts +8 -0
  346. package/src/app/channels.ts +141 -0
  347. package/src/app/delivery-default.ts +14 -0
  348. package/src/app/delivery.test.ts +46 -0
  349. package/src/app/delivery.ts +215 -0
  350. package/src/app/engine-default.ts +54 -0
  351. package/src/app/engine.ts +427 -0
  352. package/src/app/http-mount.test.ts +27 -0
  353. package/src/app/http-server.test.ts +114 -0
  354. package/src/app/http-server.ts +127 -0
  355. package/src/app/http.test.ts +27 -0
  356. package/src/app/http.ts +118 -0
  357. package/src/app/kernel.test.ts +191 -0
  358. package/src/app/kernel.ts +544 -0
  359. package/src/app/monitor-default.ts +9 -0
  360. package/src/app/monitor.ts +46 -0
  361. package/src/app/operational-metrics.test.ts +73 -0
  362. package/src/app/operational-metrics.ts +124 -0
  363. package/src/app/oss-edition.test.ts +71 -0
  364. package/src/app/oss-edition.ts +108 -0
  365. package/src/app/outbound-default.ts +57 -0
  366. package/src/app/outbound.ts +133 -0
  367. package/src/app/readiness.test.ts +37 -0
  368. package/src/app/readiness.ts +39 -0
  369. package/src/app/runtime-composition.test.ts +51 -0
  370. package/src/app/runtime-composition.ts +73 -0
  371. package/src/app/runtime-context-default.ts +30 -0
  372. package/src/app/runtime-context.test.ts +60 -0
  373. package/src/app/runtime-context.ts +79 -0
  374. package/src/app/runtime-lifecycle-default.ts +48 -0
  375. package/src/app/runtime-lifecycle.test.ts +322 -0
  376. package/src/app/runtime-lifecycle.ts +440 -0
  377. package/src/app/runtime.ts +36 -0
  378. package/src/app/tool-approvals-default.ts +16 -0
  379. package/src/app/tool-approvals.ts +214 -0
  380. package/src/app/tool-assembly-default.ts +11 -0
  381. package/src/app/tool-assembly.test.ts +112 -0
  382. package/src/app/tool-assembly.ts +83 -0
  383. package/src/app/tool-context-default.ts +7 -0
  384. package/src/app/tool-context.test.ts +82 -0
  385. package/src/app/tool-context.ts +109 -0
  386. package/src/app/tool-debug.test.ts +111 -0
  387. package/src/app/tool-debug.ts +152 -0
  388. package/src/app/tool-proxy-default.ts +35 -0
  389. package/src/app/tool-proxy.ts +173 -0
  390. package/src/app/tool-specs-default.ts +33 -0
  391. package/src/app/tool-specs.test.ts +322 -0
  392. package/src/app/tool-specs.ts +555 -0
  393. package/src/app/tools-runtime-default.ts +14 -0
  394. package/src/app/tools-runtime.ts +23 -0
  395. package/src/architecture-boundary.test.ts +119 -0
  396. package/src/core/config/config-codec.test.ts +105 -0
  397. package/src/core/config/config-codec.ts +231 -0
  398. package/src/core/config/config-diagnostics.test.ts +285 -0
  399. package/src/core/config/config-diagnostics.ts +436 -0
  400. package/src/core/config/config-models.test.ts +584 -0
  401. package/src/core/config/config-models.ts +392 -0
  402. package/src/core/config/config-schema.test.ts +153 -0
  403. package/src/core/config/config.test.ts +314 -0
  404. package/src/core/config/config.ts +324 -0
  405. package/src/core/config/route-config.test.ts +232 -0
  406. package/src/core/config/route-config.ts +246 -0
  407. package/src/core/config/target-config.test.ts +139 -0
  408. package/src/core/config/target-config.ts +219 -0
  409. package/src/core/config/tools-config.test.ts +124 -0
  410. package/src/core/config/tools-config.ts +126 -0
  411. package/src/core/contracts/approval-decision.test.ts +67 -0
  412. package/src/core/contracts/approval-decision.ts +93 -0
  413. package/src/core/contracts/openapi-tools.ts +201 -0
  414. package/src/core/contracts/tool-annotations.ts +121 -0
  415. package/src/core/contracts/tool-definition.test.ts +147 -0
  416. package/src/core/contracts/tool-definition.ts +304 -0
  417. package/src/core/contracts/tools-idempotency.test.ts +435 -0
  418. package/src/core/contracts/tools.test.ts +487 -0
  419. package/src/core/contracts/tools.ts +831 -0
  420. package/src/core/contracts/types.ts +408 -0
  421. package/src/core/edition/capabilities.ts +6 -0
  422. package/src/core/edition/context.test.ts +20 -0
  423. package/src/core/edition/context.ts +78 -0
  424. package/src/core/edition/index.ts +4 -0
  425. package/src/core/edition/scope-resolver.ts +24 -0
  426. package/src/core/edition/store-factory.ts +6 -0
  427. package/src/core/observability/openmetrics.test.ts +57 -0
  428. package/src/core/observability/openmetrics.ts +103 -0
  429. package/src/core/platform/content.test.ts +46 -0
  430. package/src/core/platform/content.ts +90 -0
  431. package/src/core/platform/fence.test.ts +31 -0
  432. package/src/core/platform/fence.ts +11 -0
  433. package/src/core/platform/instance-branding.test.ts +65 -0
  434. package/src/core/platform/instance-branding.ts +202 -0
  435. package/src/core/platform/metrics-token.test.ts +31 -0
  436. package/src/core/platform/metrics-token.ts +42 -0
  437. package/src/core/platform/pagecontext.ts +0 -0
  438. package/src/core/platform/password.test.ts +13 -0
  439. package/src/core/platform/password.ts +38 -0
  440. package/src/core/platform/queue.test.ts +59 -0
  441. package/src/core/platform/queue.ts +75 -0
  442. package/src/core/platform/serial.test.ts +73 -0
  443. package/src/core/platform/serial.ts +64 -0
  444. package/src/core/platform/server-token.test.ts +46 -0
  445. package/src/core/platform/server-token.ts +60 -0
  446. package/src/core/platform/signing.test.ts +24 -0
  447. package/src/core/platform/signing.ts +22 -0
  448. package/src/core/platform/time.ts +73 -0
  449. package/src/core/platform/version.test.ts +19 -0
  450. package/src/core/platform/version.ts +90 -0
  451. package/src/core/runtime/budget-runtime.test.ts +93 -0
  452. package/src/core/runtime/budget-runtime.ts +110 -0
  453. package/src/core/runtime/context-runtime.test.ts +106 -0
  454. package/src/core/runtime/context-runtime.ts +95 -0
  455. package/src/core/runtime/credential-resolver.test.ts +129 -0
  456. package/src/core/runtime/credential-resolver.ts +93 -0
  457. package/src/core/runtime/credential-verify.test.ts +76 -0
  458. package/src/core/runtime/credential-verify.ts +161 -0
  459. package/src/core/runtime/debug-report.test.ts +20 -0
  460. package/src/core/runtime/debug-report.ts +100 -0
  461. package/src/core/runtime/execution-runtime.test.ts +350 -0
  462. package/src/core/runtime/execution-runtime.ts +197 -0
  463. package/src/core/runtime/finish-runtime.test.ts +168 -0
  464. package/src/core/runtime/finish-runtime.ts +83 -0
  465. package/src/core/runtime/identity-runtime.test.ts +38 -0
  466. package/src/core/runtime/identity-runtime.ts +104 -0
  467. package/src/core/runtime/inhub-runtime.test.ts +297 -0
  468. package/src/core/runtime/inhub-runtime.ts +198 -0
  469. package/src/core/runtime/job-stream.test.ts +55 -0
  470. package/src/core/runtime/job-stream.ts +187 -0
  471. package/src/core/runtime/knowledge-runtime.test.ts +120 -0
  472. package/src/core/runtime/knowledge-runtime.ts +98 -0
  473. package/src/core/runtime/launch-runtime.test.ts +187 -0
  474. package/src/core/runtime/launch-runtime.ts +182 -0
  475. package/src/core/runtime/memory-runtime.test.ts +85 -0
  476. package/src/core/runtime/memory-runtime.ts +32 -0
  477. package/src/core/runtime/memory.ts +141 -0
  478. package/src/core/runtime/redaction-runtime.test.ts +35 -0
  479. package/src/core/runtime/redaction-runtime.ts +60 -0
  480. package/src/core/runtime/routing-runtime.test.ts +89 -0
  481. package/src/core/runtime/routing-runtime.ts +146 -0
  482. package/src/core/runtime/smoke-runtime.test.ts +65 -0
  483. package/src/core/runtime/smoke-runtime.ts +237 -0
  484. package/src/core/runtime/summary-runtime.test.ts +234 -0
  485. package/src/core/runtime/summary-runtime.ts +153 -0
  486. package/src/core/runtime/trace-runtime.test.ts +234 -0
  487. package/src/core/runtime/trace-runtime.ts +330 -0
  488. package/src/core/state/audit-observability.test.ts +51 -0
  489. package/src/core/state/audit-observability.ts +74 -0
  490. package/src/core/state/state-codec.ts +44 -0
  491. package/src/core/state/state-contracts.ts +59 -0
  492. package/src/core/targets/adapter.ts +69 -0
  493. package/src/core/targets/registry.test.ts +65 -0
  494. package/src/core/targets/registry.ts +153 -0
  495. package/src/core/targets/resolve.ts +21 -0
  496. package/src/executor.ts +201 -0
  497. package/src/extension-api.test.ts +84 -0
  498. package/src/extension-api.ts +194 -0
  499. package/src/infrastructure/config/config-admin-repository.test.ts +193 -0
  500. package/src/infrastructure/config/config-admin-repository.ts +175 -0
  501. package/src/infrastructure/config/config-alert-rule-repository.ts +38 -0
  502. package/src/infrastructure/config/config-approval-ledger.ts +74 -0
  503. package/src/infrastructure/config/config-channel-repository.ts +31 -0
  504. package/src/infrastructure/config/config-chat-repository.ts +83 -0
  505. package/src/infrastructure/config/config-client-repository.ts +46 -0
  506. package/src/infrastructure/config/config-conversation-ledger.ts +222 -0
  507. package/src/infrastructure/config/config-credential-repository.test.ts +32 -0
  508. package/src/infrastructure/config/config-credential-repository.ts +47 -0
  509. package/src/infrastructure/config/config-delivery-dlq-ledger.ts +49 -0
  510. package/src/infrastructure/config/config-executor-ledger.ts +30 -0
  511. package/src/infrastructure/config/config-executor-token-repository.ts +44 -0
  512. package/src/infrastructure/config/config-instance-branding-repository.ts +75 -0
  513. package/src/infrastructure/config/config-knowledge-repository.ts +249 -0
  514. package/src/infrastructure/config/config-observability-ledger.ts +262 -0
  515. package/src/infrastructure/config/config-project-repository.ts +30 -0
  516. package/src/infrastructure/config/config-rate-limit-ledger.ts +56 -0
  517. package/src/infrastructure/config/config-route-repository.ts +41 -0
  518. package/src/infrastructure/config/config-storage-bucket-repository.ts +43 -0
  519. package/src/infrastructure/config/config-target-repository.ts +25 -0
  520. package/src/infrastructure/config/config-tool-call-ledger.ts +142 -0
  521. package/src/infrastructure/config/config-tool-embedding-repository.test.ts +124 -0
  522. package/src/infrastructure/config/config-tool-embedding-repository.ts +78 -0
  523. package/src/infrastructure/config/config-tool-provider-repository.test.ts +71 -0
  524. package/src/infrastructure/config/config-tool-provider-repository.ts +50 -0
  525. package/src/infrastructure/config/configstore.ts +130 -0
  526. package/src/infrastructure/config/local-instance-branding-provider.test.ts +94 -0
  527. package/src/infrastructure/config/local-instance-branding-provider.ts +79 -0
  528. package/src/infrastructure/mysql/pool-owner.test.ts +36 -0
  529. package/src/infrastructure/mysql/pool-owner.ts +56 -0
  530. package/src/infrastructure/schema/core-schema-migrator.test.ts +340 -0
  531. package/src/infrastructure/schema/core-schema-migrator.ts +461 -0
  532. package/src/infrastructure/schema/migration-files.test.ts +18 -0
  533. package/src/infrastructure/schema/migration-files.ts +27 -0
  534. package/src/infrastructure/schema/retired-migrations.ts +35 -0
  535. package/src/infrastructure/state/operational-metrics-storage.test.ts +107 -0
  536. package/src/infrastructure/state/state-jsonl.ts +268 -0
  537. package/src/infrastructure/state/state-mysql-update-plan.test.ts +54 -0
  538. package/src/infrastructure/state/state-mysql-update-plan.ts +63 -0
  539. package/src/infrastructure/state/state-mysql.ts +359 -0
  540. package/src/infrastructure/state/state.test.ts +319 -0
  541. package/src/infrastructure/state/state.ts +11 -0
  542. package/src/kernel-api/v1/artifact.test.ts +46 -0
  543. package/src/kernel-api/v1/artifact.ts +71 -0
  544. package/src/kernel-api/v1/contracts.ts +168 -0
  545. package/src/kernel-api/v1/execution-gate.test.ts +25 -0
  546. package/src/kernel-api/v1/execution-gate.ts +18 -0
  547. package/src/kernel-api/v1/index.ts +51 -0
  548. package/src/openclaw-stdio.test.ts +60 -0
  549. package/src/routes/admin-access-default.ts +20 -0
  550. package/src/routes/admin-access.ts +94 -0
  551. package/src/routes/admin-branding.test.ts +116 -0
  552. package/src/routes/admin-branding.ts +48 -0
  553. package/src/routes/admin-chat-default.ts +12 -0
  554. package/src/routes/admin-chat.ts +84 -0
  555. package/src/routes/admin-default.ts +35 -0
  556. package/src/routes/admin-dispatch-config-default.ts +13 -0
  557. package/src/routes/admin-dispatch-config.ts +121 -0
  558. package/src/routes/admin-format.ts +12 -0
  559. package/src/routes/admin-host.test.ts +56 -0
  560. package/src/routes/admin-infra-default.ts +12 -0
  561. package/src/routes/admin-infra.ts +142 -0
  562. package/src/routes/admin-kb-default.ts +13 -0
  563. package/src/routes/admin-kb.ts +160 -0
  564. package/src/routes/admin-runtime-default.ts +31 -0
  565. package/src/routes/admin-runtime.ts +444 -0
  566. package/src/routes/admin-tool-providers-default.ts +20 -0
  567. package/src/routes/admin-tool-providers.test.ts +114 -0
  568. package/src/routes/admin-tool-providers.ts +186 -0
  569. package/src/routes/admin.ts +246 -0
  570. package/src/routes/approvals-default.ts +32 -0
  571. package/src/routes/approvals.ts +120 -0
  572. package/src/routes/chat-default.ts +61 -0
  573. package/src/routes/chat-mount.test.ts +58 -0
  574. package/src/routes/chat.test.ts +222 -0
  575. package/src/routes/chat.ts +478 -0
  576. package/src/routes/critical-routes.test.ts +292 -0
  577. package/src/routes/executor-default.ts +45 -0
  578. package/src/routes/executor.ts +226 -0
  579. package/src/routes/kb-default.ts +23 -0
  580. package/src/routes/kb.ts +92 -0
  581. package/src/routes/private-default.ts +38 -0
  582. package/src/routes/private-host-auth.test.ts +84 -0
  583. package/src/routes/private.ts +210 -0
  584. package/src/routes/public-default.ts +46 -0
  585. package/src/routes/public.test.ts +504 -0
  586. package/src/routes/public.ts +313 -0
  587. package/src/routes/run-default.ts +25 -0
  588. package/src/routes/run.ts +188 -0
  589. package/src/routes/send-default.ts +24 -0
  590. package/src/routes/send.ts +143 -0
  591. package/src/routes/wecom-default.ts +27 -0
  592. package/src/routes/wecom.ts +307 -0
  593. package/src/server.ts +13 -0
  594. package/src/services/embedding.test.ts +185 -0
  595. package/src/services/embedding.ts +138 -0
  596. package/src/services/kb-repository.ts +79 -0
  597. package/src/services/kb.ts +328 -0
  598. package/src/services/kbsync.ts +166 -0
  599. package/src/services/tool-index-repository.ts +50 -0
  600. package/src/services/tools-index.test.ts +756 -0
  601. package/src/services/tools-index.ts +427 -0
  602. package/tsconfig.json +17 -0
  603. package/web/connect/bailing-connect-php.tgz +0 -0
  604. package/web/connect/bailing-connect-php7.tgz +0 -0
  605. package/web/connect/executor.mjs +152 -0
  606. package/web/connect/openclaw-stdio.mjs +145 -0
  607. package/web/connect/skills/connect-bailinghub-executor/SKILL.md +97 -0
  608. package/web/connect/skills/connect-bailinghub-executor/agents/openai.yaml +4 -0
  609. package/web/connect/skills/connect-bailinghub-executor/references/direct-protocol.md +99 -0
  610. package/web/connect/skills/connect-bailinghub-executor/references/openclaw.md +39 -0
  611. package/web/console/assets/Accounts-B4ePH5jp.css +1 -0
  612. package/web/console/assets/Accounts-Dwzm4D_V.js +3 -0
  613. package/web/console/assets/Approvals-BxhuI0ku.js +1 -0
  614. package/web/console/assets/Approvals-DlTSHl_7.css +1 -0
  615. package/web/console/assets/Audit-CSu6_3oD.css +1 -0
  616. package/web/console/assets/Audit-dFAbGynl.js +1 -0
  617. package/web/console/assets/BrandLockup-BtZyvkM5.js +1 -0
  618. package/web/console/assets/BrandLockup-DKYBYzKU.css +1 -0
  619. package/web/console/assets/Channels-CCn0L1jg.css +1 -0
  620. package/web/console/assets/Channels-Dqg4-_yr.js +105 -0
  621. package/web/console/assets/ChatEntries-BweMx_CU.css +1 -0
  622. package/web/console/assets/ChatEntries-CEGZ3NnJ.js +7 -0
  623. package/web/console/assets/Clients-C0QD1x7g.js +3 -0
  624. package/web/console/assets/Clients-DcTYN-Js.css +1 -0
  625. package/web/console/assets/Cost-BAJqLhpK.js +1 -0
  626. package/web/console/assets/Cost-CjT39DSZ.css +1 -0
  627. package/web/console/assets/Credentials-D_GDRgWi.js +1 -0
  628. package/web/console/assets/Credentials-ioLP0qYN.css +1 -0
  629. package/web/console/assets/Diagnostics-BWYnDxRj.js +1 -0
  630. package/web/console/assets/Diagnostics-Ya05PTDp.css +1 -0
  631. package/web/console/assets/Executors-CjhEM54c.css +1 -0
  632. package/web/console/assets/Executors-Cmryk4Vk.js +1 -0
  633. package/web/console/assets/HelpTip-CA6Bm7Nx.css +1 -0
  634. package/web/console/assets/HelpTip-CT07o3kB.js +1 -0
  635. package/web/console/assets/Kb-BSXQE0Fa.js +5 -0
  636. package/web/console/assets/Kb-CzIzd9xr.css +1 -0
  637. package/web/console/assets/Login-BnBPqC8Z.js +1 -0
  638. package/web/console/assets/Login-xtPwDB5_.css +1 -0
  639. package/web/console/assets/Projects-Bm8AjsNx.css +1 -0
  640. package/web/console/assets/Projects-CNHx4L_7.js +1 -0
  641. package/web/console/assets/Routes-DWGQN5Pv.css +1 -0
  642. package/web/console/assets/Routes-u5cEAEXQ.js +124 -0
  643. package/web/console/assets/Runs-BeFUR77_.js +3 -0
  644. package/web/console/assets/Runs-CUtSsPW-.css +1 -0
  645. package/web/console/assets/Setup-BjZfrmfN.js +1 -0
  646. package/web/console/assets/Setup-QjlHZKdB.css +1 -0
  647. package/web/console/assets/Shell-CbGNTN91.css +1 -0
  648. package/web/console/assets/Shell-EJuYf3OO.js +1 -0
  649. package/web/console/assets/StorageBuckets-DMXRJxUA.js +1 -0
  650. package/web/console/assets/StorageBuckets-GnXnVvF0.css +1 -0
  651. package/web/console/assets/SystemSettings-B72F-loY.js +1 -0
  652. package/web/console/assets/SystemSettings-BjiHyrXO.css +1 -0
  653. package/web/console/assets/SystemStatus-I11I67rw.css +1 -0
  654. package/web/console/assets/SystemStatus-hOj_TPYE.js +1 -0
  655. package/web/console/assets/Targets-DTb5tn6z.css +1 -0
  656. package/web/console/assets/Targets-UVVf7twC.js +1 -0
  657. package/web/console/assets/Tools-A20oaMaQ.css +1 -0
  658. package/web/console/assets/Tools-ihkr9R9x.js +2 -0
  659. package/web/console/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
  660. package/web/console/assets/docs-DPUOCa7R.js +1 -0
  661. package/web/console/assets/index-DZEQL_yy.js +1 -0
  662. package/web/console/assets/index-DxvruykG.js +2 -0
  663. package/web/console/assets/index-Fi9gkGxV.css +1 -0
  664. package/web/console/assets/llm-catalog-HwRIrS94.js +1 -0
  665. package/web/console/assets/request-BisL2T9B.js +1 -0
  666. package/web/console/assets/schema-CzpUpoLk.js +1 -0
  667. package/web/console/assets/util-SiQC2MJh.js +1 -0
  668. package/web/console/assets/vendor-element-D7WRzHhy.js +37 -0
  669. package/web/console/assets/vendor-mammoth-DvgsHdlx.js +231 -0
  670. package/web/console/assets/vendor-turndown-kLzRgxYD.js +61 -0
  671. package/web/console/assets/vendor-vue-B2uhHUfE.js +29 -0
  672. package/web/console/index.html +16 -0
  673. package/web/widget/widget.js +1490 -0
  674. package/web-admin/index.html +13 -0
  675. package/web-admin/package-lock.json +1854 -0
  676. package/web-admin/package.json +25 -0
  677. package/web-admin/src/App.vue +9 -0
  678. package/web-admin/src/branding.ts +90 -0
  679. package/web-admin/src/components/BrandLockup.vue +40 -0
  680. package/web-admin/src/components/HelpTip.vue +51 -0
  681. package/web-admin/src/components/RichText.vue +35 -0
  682. package/web-admin/src/docs.ts +16 -0
  683. package/web-admin/src/layout/Shell.vue +356 -0
  684. package/web-admin/src/llm-catalog.ts +129 -0
  685. package/web-admin/src/main.ts +116 -0
  686. package/web-admin/src/pages/Accounts.vue +162 -0
  687. package/web-admin/src/pages/Approvals.vue +179 -0
  688. package/web-admin/src/pages/Audit.vue +110 -0
  689. package/web-admin/src/pages/Channels.vue +738 -0
  690. package/web-admin/src/pages/ChatEntries.vue +778 -0
  691. package/web-admin/src/pages/Clients.vue +353 -0
  692. package/web-admin/src/pages/Cost.vue +314 -0
  693. package/web-admin/src/pages/Credentials.vue +418 -0
  694. package/web-admin/src/pages/Diagnostics.vue +440 -0
  695. package/web-admin/src/pages/Executors.vue +398 -0
  696. package/web-admin/src/pages/Kb.vue +698 -0
  697. package/web-admin/src/pages/Login.vue +314 -0
  698. package/web-admin/src/pages/Projects.vue +106 -0
  699. package/web-admin/src/pages/Routes.vue +1661 -0
  700. package/web-admin/src/pages/Runs.vue +1113 -0
  701. package/web-admin/src/pages/Setup.vue +354 -0
  702. package/web-admin/src/pages/StorageBuckets.vue +182 -0
  703. package/web-admin/src/pages/SystemSettings.vue +281 -0
  704. package/web-admin/src/pages/SystemStatus.vue +185 -0
  705. package/web-admin/src/pages/Targets.vue +193 -0
  706. package/web-admin/src/pages/Tools.vue +1051 -0
  707. package/web-admin/src/request.ts +18 -0
  708. package/web-admin/src/router.ts +142 -0
  709. package/web-admin/src/runtime-path.ts +27 -0
  710. package/web-admin/src/schema.ts +52 -0
  711. package/web-admin/src/store.ts +35 -0
  712. package/web-admin/src/styles/base.css +272 -0
  713. package/web-admin/src/table-widths.ts +603 -0
  714. package/web-admin/src/util.ts +16 -0
  715. package/web-admin/tsconfig.json +15 -0
  716. package/web-admin/vite.config.ts +35 -0
@@ -0,0 +1,55 @@
1
+ # v0.1.4 发布说明
2
+
3
+ 百灵中枢 `v0.1.4` 为网页聊天补齐真实的模型增量输出,并定义可重连的 SSE 事件协议。该版本把“模型正在生成”从轮询终态改为可观察的实时过程,同时保持最终结果、会话记录、回调与审计仍以任务库中的权威终态为准。
4
+
5
+ ## 主要变化
6
+
7
+ ### 1. OpenAI-compatible 模型流式调用
8
+
9
+ `llm` 目标默认尝试使用 `stream:true`:
10
+
11
+ - 持续解析提供商返回的文本增量;
12
+ - 将首段延迟、分片数、字符数和结束原因写入 trace 元数据;
13
+ - 不把逐片正文写入 trace、审计或会话总账;
14
+ - 只有提供商明确拒绝 streaming 时,才自动重试一次非流式请求。
15
+
16
+ 如某个兼容端点不适合流式调用,可在对应 `target_config` 中设置 `streaming:false`。
17
+
18
+ ### 2. 可重连 SSE 事件协议
19
+
20
+ 新增 `bailing.chat.stream.v1`,网页聊天流除既有终态事件外,还可以发送:
21
+
22
+ - `phase`:当前执行阶段;
23
+ - `reset`:丢弃尚未完成的临时文本;
24
+ - `delta`:追加一段临时文本;
25
+ - `done`:从任务库最终结果生成的权威终态。
26
+
27
+ 每个任务使用单调递增的事件序号。客户端断线重连时可通过 `Last-Event-ID` 请求短期有界回放;无法完整回放时,服务端发送 `reset`,避免客户端把不连续文本误拼成完整回答。
28
+
29
+ ### 3. 网页组件实时呈现
30
+
31
+ 零依赖网页组件现在可以在任务完成前展示模型输出,并在重连、重置或终态到达时正确收敛。旧客户端无需修改:忽略未知事件并继续只消费 `done` 即可。
32
+
33
+ ## 安全与审计边界
34
+
35
+ - 增量文本是临时传输数据,不是业务终态,也不是审批或授权证据;
36
+ - 会话历史、回调、送达与审计正文不逐片持久化;
37
+ - `done` 始终以任务库最终记录为来源;
38
+ - 业务系统仍保留最终授权权力,streaming 不改变 ACC、工具签名或审批边界。
39
+
40
+ ## 兼容性
41
+
42
+ - 无数据库迁移;
43
+ - `/run`、SDK、工具签名和执行器协议不变;
44
+ - 新 SSE 事件向后兼容,旧客户端可继续只处理终态;
45
+ - 非流式模型目标和现有聊天入口保持原有行为。
46
+
47
+ ## 验证
48
+
49
+ 发布前通过:
50
+
51
+ - `npm run typecheck`
52
+ - `npm test`
53
+ - `npm --prefix web-admin run build`
54
+ - `npm run docs:check`
55
+ - `npm run release:check`
@@ -0,0 +1,49 @@
1
+ # BailingHub v0.1.5: Reliable One-Line Installer Arguments and Clean-Server Compatibility
2
+
3
+ `v0.1.5` is an installer and distribution reliability patch. It does not change BailingHub runtime HTTP contracts, SDKs, signature formats, or database schemas.
4
+
5
+ ## Why this patch is necessary
6
+
7
+ Some custom installer examples previously used this form:
8
+
9
+ ```bash
10
+ BAILING_INSTALL_MODE=source curl -fsSL <installer-url> | sh
11
+ ```
12
+
13
+ In a shell pipeline, that environment variable belongs to the `curl` process. It is not automatically passed to the `sh` process that executes the installer. The command could appear to succeed while silently ignoring the requested install mode, ports, public host, or image overrides.
14
+
15
+ The correct form attaches the variables to the installer process:
16
+
17
+ ```bash
18
+ curl -fsSL https://www.bailinghub.com/install.sh | env BAILING_INSTALL_MODE=source sh
19
+ ```
20
+
21
+ ## Changes
22
+
23
+ - Corrected all custom-argument examples in the README, Quick Start, Demo guide, and installer diagnostics.
24
+ - The installer now detects whether the configured apt repository provides `docker-compose-plugin` or `docker-compose-v2` before installing Docker Compose.
25
+ - Public-address discovery no longer falls back to presenting a private address as a remote access URL. The result explains when `localhost` must be replaced.
26
+ - The GitHub release rehearsal now rejects installer commands that attach `BAILING_*` variables to the downloader rather than the installer process.
27
+
28
+ ## Compatibility and upgrade notes
29
+
30
+ - The default command is unchanged:
31
+
32
+ ```bash
33
+ curl -fsSL https://www.bailinghub.com/install.sh | sh
34
+ ```
35
+
36
+ - Use `curl ... | env ... sh` only when overriding the install mode, ports, public host, image source, or source repository.
37
+ - Existing `v0.1.4` deployments require no database migration.
38
+ - This patch affects new and repeated installations, not existing business integration behavior.
39
+
40
+ ## Validation
41
+
42
+ The release is checked with:
43
+
44
+ - `sh -n scripts/install.sh`;
45
+ - `npm run docs:check`;
46
+ - `npm run release:check`;
47
+ - a default image install on a clean Ubuntu 24.04 server;
48
+ - an isolated install with custom mode, ports, and public host;
49
+ - the 10-check smoke suite, the complete demo E2E flow, and restart persistence.
@@ -0,0 +1,49 @@
1
+ # BailingHub v0.1.5:一键安装参数可靠性与全新服务器兼容性
2
+
3
+ `v0.1.5` 是一个安装与分发可靠性补丁。它不改变 BailingHub 的运行时 HTTP 契约、SDK、签名格式或数据库结构。
4
+
5
+ ## 为什么需要这个补丁
6
+
7
+ 此前部分自定义安装示例采用下面的形式:
8
+
9
+ ```bash
10
+ BAILING_INSTALL_MODE=source curl -fsSL <installer-url> | sh
11
+ ```
12
+
13
+ 在 shell 管道中,这个环境变量只属于 `curl` 进程,不会自动传给右侧执行安装器的 `sh`。命令可能看起来执行成功,但安装模式、端口、公开地址或镜像覆盖等自定义意图会被静默忽略。
14
+
15
+ 正确形式是把变量绑定到安装器进程:
16
+
17
+ ```bash
18
+ curl -fsSL https://www.bailinghub.com/install.sh | env BAILING_INSTALL_MODE=source sh
19
+ ```
20
+
21
+ ## 本次变化
22
+
23
+ - 修正 README、Quick Start、Demo 和安装器错误提示中的全部自定义参数示例;
24
+ - 安装器会先检测 apt 软件源提供的是 `docker-compose-plugin` 还是 `docker-compose-v2`,再安装可用包;
25
+ - 公网地址探测失败时不再展示私网地址,并明确说明远程访问时如何替换 `localhost`;
26
+ - GitHub 发布演练新增命令形态检查,防止错误的环境变量绑定方式重新进入公开版本。
27
+
28
+ ## 兼容性与升级
29
+
30
+ - 默认命令仍然是:
31
+
32
+ ```bash
33
+ curl -fsSL https://www.bailinghub.com/install.sh | sh
34
+ ```
35
+
36
+ - 只有需要自定义安装模式、端口、公开地址、镜像或源码来源时,才需要使用 `curl ... | env ... sh`;
37
+ - 已运行的 `v0.1.4` 实例不需要数据库迁移;
38
+ - 此补丁主要影响新安装和重新安装路径,不改变现有业务接入行为。
39
+
40
+ ## 验证
41
+
42
+ 发布前完成:
43
+
44
+ - `sh -n scripts/install.sh`;
45
+ - `npm run docs:check`;
46
+ - `npm run release:check`;
47
+ - 全新 Ubuntu 24.04 服务器默认镜像安装;
48
+ - 自定义安装模式、端口和公开地址的独立安装;
49
+ - 10 项 smoke、完整 demo E2E、重启与配置持久性验证。
@@ -0,0 +1,41 @@
1
+ # BailingHub v0.1.6: Independent Validation Paths and Post-Install Privilege Hints
2
+
3
+ `v0.1.6` is an installation-experience and independent-validation patch. It does not change BailingHub runtime HTTP contracts, SDKs, signature formats, ACC semantics, or database schemas.
4
+
5
+ ## Why this patch exists
6
+
7
+ During a clean Ubuntu 24.04 regression, the installer correctly used `sudo docker` when the current non-root user did not yet have Docker socket access. The completion screen, however, always printed operator commands without `sudo`. The deployment was healthy, but copying those commands immediately produced a permission error and could make a successful installation look broken.
8
+
9
+ The same review found that the public independent-validation task treated source cloning and building as the only core path, adding unnecessary work for developers who only wanted to reproduce the product loop.
10
+
11
+ ## What changed
12
+
13
+ - The installer prints either `docker compose` or `sudo docker compose` according to the current session's actual access;
14
+ - a fresh Ubuntu/Debian one-line install is now the recommended core independent-validation path;
15
+ - local source reproduction remains an equivalent alternative;
16
+ - the Chinese and English task cards define non-production, credential-protection, and cleanup boundaries;
17
+ - the Issue template separately records one-line installer, source Docker, Dify, and executor validation, with a commit SHA required only for the source path.
18
+
19
+ ## Upgrade and compatibility
20
+
21
+ Existing deployments require no migration. This patch does not add a database migration or change tool signatures, approval, audit, executor, chat, SDK, or ACC contracts.
22
+
23
+ New installations continue to use:
24
+
25
+ ```bash
26
+ curl -fsSL https://www.bailinghub.com/install.sh | sh
27
+ ```
28
+
29
+ After installation, preserve the complete Compose prefix printed under `常用命令`.
30
+
31
+ ## Verification
32
+
33
+ - `sh -n scripts/install.sh`;
34
+ - `npm run docs:check`;
35
+ - `npm run release:check`;
36
+ - isolated Ubuntu 24.04 installation regression;
37
+ - correct `sudo docker compose -f docker-compose.images.yml` output in the current non-root session;
38
+ - passing `/health`, 10-check smoke suite, and complete `demo:e2e` flow;
39
+ - cleanup of isolated containers, network, volumes, directory, and credential-bearing logs while the pre-existing instance remained healthy.
40
+
41
+ See [INDEPENDENT_VALIDATION.en.md](INDEPENDENT_VALIDATION.en.md) for the public task.
@@ -0,0 +1,41 @@
1
+ # BailingHub v0.1.6:独立验证路径与安装后权限提示
2
+
3
+ `v0.1.6` 是一个安装体验与独立验证补丁。它不改变 BailingHub 的运行时 HTTP 契约、SDK、签名格式、ACC 语义或数据库结构。
4
+
5
+ ## 为什么发布这个补丁
6
+
7
+ 在全新 Ubuntu 24.04 服务器回归中,安装器能够在当前非 root 用户尚未获得 Docker socket 权限时,自动使用 `sudo docker` 完成部署;但安装结束页过去固定打印不带 `sudo` 的运维命令。部署本身是健康的,用户照抄命令却会立即得到权限错误,容易误判为安装失败。
8
+
9
+ 同一轮复核还发现,公开独立验证任务把源码克隆和构建当作唯一核心路径,给只想验证产品闭环的开发者增加了不必要门槛。
10
+
11
+ ## 本次变化
12
+
13
+ - 安装器按当前会话真实权限打印 `docker compose` 或 `sudo docker compose`;
14
+ - 全新 Ubuntu/Debian 一键安装成为推荐的核心独立验证路径;
15
+ - 本地源码复现保留为等价替代路径;
16
+ - 中英文任务卡明确非生产环境、凭据保护和清理边界;
17
+ - Issue 模板分别记录一键安装、源码 Docker、Dify 与执行器验证,源码提交号只在源码路径需要。
18
+
19
+ ## 升级与兼容性
20
+
21
+ 已有部署无需迁移。该补丁不新增数据库迁移,不修改工具签名、审批、审计、执行器、聊天或 SDK 契约,也不改变 ACC 的字段与解释。
22
+
23
+ 新安装者继续使用原命令:
24
+
25
+ ```bash
26
+ curl -fsSL https://www.bailinghub.com/install.sh | sh
27
+ ```
28
+
29
+ 安装完成后,应原样使用安装器“常用命令”中打印的 Compose 前缀。
30
+
31
+ ## 验证
32
+
33
+ - `sh -n scripts/install.sh`;
34
+ - `npm run docs:check`;
35
+ - `npm run release:check`;
36
+ - 隔离 Ubuntu 24.04 安装回归;
37
+ - 非 root 当前会话正确打印 `sudo docker compose -f docker-compose.images.yml`;
38
+ - `/health`、10 项 smoke 和完整 `demo:e2e` 通过;
39
+ - 隔离容器、网络、数据卷、目录和含凭据日志完成清理,既有实例保持健康。
40
+
41
+ 独立验证任务见 [INDEPENDENT_VALIDATION.md](INDEPENDENT_VALIDATION.md)。
@@ -0,0 +1,39 @@
1
+ # BailingHub v0.1.7: Versioned Client API and Cross-Ecosystem Compatibility Gates
2
+
3
+ `v0.1.7` turns the public API used by external workflow and agent platforms into an independent, machine-verifiable contract and adds bidirectional compatibility gates for the Dify and n8n adapters.
4
+
5
+ ## Why this patch exists
6
+
7
+ BailingHub, the Dify plugin, and the n8n node could already cooperate through `/run` and `/jobs/{job_id}`, but their constraints were spread across implementation code, documentation, and adapter-specific assumptions. With manual synchronization alone, a core field, status, or validation change could remain undetected until an adapter failed at runtime.
8
+
9
+ This release moves from "the call works today" to "each repository can prove that it remains compatible." The core owns one machine-readable contract, adapters declare the exact fields and statuses they consume, and all three repositories validate each other before merge.
10
+
11
+ ## What changed
12
+
13
+ - Added the `bailing.client-api.v1` machine contract for `GET /health`, `POST /run`, `GET /jobs/{job_id}`, authentication, error classes, and job statuses;
14
+ - published the manifest, JSON Schemas, and behavioral vectors under `/contracts/client-api/v1/`;
15
+ - made core CI validate the current Dify and n8n adapters, while adapter CI validates the target core branch;
16
+ - made Client API requests strictly validate top-level fields, `route`, `metadata`, `callback_url`, `request_id`, and input length;
17
+ - retained the existing `/schemas/api/*` locations as aliases to the versioned contract;
18
+ - documented that the Client API is separate from executor protocols: OpenClaw and portable executors continue to use claim, heartbeat, lease, and result-submission semantics.
19
+
20
+ ## Upgrade and compatibility
21
+
22
+ No database migration is required. Clients following the public contract with `request_id`, `route`, `input`, `metadata`, and `callback_url` require no change. Dify `0.1.2` and n8n `0.1.0` pass the contract checks.
23
+
24
+ Informal integrations that depend on undeclared top-level fields, such as a client-supplied `source`, now receive `400` and should remove those fields. BailingHub derives the source from the authenticated client identity; a caller cannot assert it.
25
+
26
+ The Client API contract version evolves independently from BailingHub, plugin, and node package versions. Additive response fields are compatible. New required request fields, authentication changes, or job-status semantic changes require a new contract major version.
27
+
28
+ ## Verification
29
+
30
+ - `npm run client-api:contract`;
31
+ - `npm run client-api:ecosystem:local`;
32
+ - `npm run client-api:ecosystem:clone`;
33
+ - `npm run typecheck`;
34
+ - `npm test`;
35
+ - `npm run docs:check`;
36
+ - `npm run release:check`;
37
+ - compatibility declarations, tests, and package checks in the Dify and n8n adapter repositories.
38
+
39
+ See [CLIENT_API.md](CLIENT_API.md) for the complete contract.
@@ -0,0 +1,39 @@
1
+ # BailingHub v0.1.7:版本化 Client API 与跨生态兼容门禁
2
+
3
+ `v0.1.7` 将外部工作流与 Agent 平台使用的公开 Client API 收敛为独立、可机器验证的稳定契约,并为 Dify 与 n8n 适配器建立双向兼容门禁。
4
+
5
+ ## 为什么发布这个补丁
6
+
7
+ BailingHub、Dify 插件和 n8n 节点此前已经能够通过 `/run` 与 `/jobs/{job_id}` 协作,但接口约束分散在实现、文档和各适配器中。只靠人工同步,核心服务新增字段、改变状态或收紧校验时,可能直到某个适配器运行失败才发现契约漂移。
8
+
9
+ 这次发布把“能调用”升级为“能证明彼此仍然兼容”:核心服务拥有唯一的机器契约,适配器显式声明自己消费的字段与状态,三个仓库在合并前互相验证。
10
+
11
+ ## 本次变化
12
+
13
+ - 新增 `bailing.client-api.v1` 机器契约,覆盖 `GET /health`、`POST /run`、`GET /jobs/{job_id}`、认证方式、错误分类和任务状态;
14
+ - 通过 `/contracts/client-api/v1/` 公开 manifest、JSON Schema 与行为测试向量;
15
+ - 核心 CI 校验当前 Dify 与 n8n 适配器,适配器 CI 反向校验目标核心分支;
16
+ - Client API 请求现在严格校验顶层字段、`route`、`metadata`、`callback_url`、`request_id` 与输入长度;
17
+ - 旧 `/schemas/api/*` 地址继续存在,并转向版本化契约,避免文档入口分裂;
18
+ - 明确 Client API 与执行器协议的边界:OpenClaw 和便携执行器仍使用独立的 claim、heartbeat、lease 与结果回报协议。
19
+
20
+ ## 升级与兼容性
21
+
22
+ 不需要数据库迁移。按照公开文档使用 `request_id`、`route`、`input`、`metadata` 和 `callback_url` 的客户端无需修改;Dify `0.1.2` 与 n8n `0.1.0` 已通过契约检查。
23
+
24
+ 依赖未声明顶层字段(例如客户端自行传入 `source`)的非正式接入将收到 `400`,应删除该字段。调用来源由中枢根据已认证的 client 身份写入,客户端不能自行声明。
25
+
26
+ Client API 契约版本与 BailingHub、插件、节点的软件版本独立演进。兼容的响应扩展允许新增;新增必填请求字段、认证变化或任务状态语义变化必须进入新的契约主版本。
27
+
28
+ ## 验证
29
+
30
+ - `npm run client-api:contract`;
31
+ - `npm run client-api:ecosystem:local`;
32
+ - `npm run client-api:ecosystem:clone`;
33
+ - `npm run typecheck`;
34
+ - `npm test`;
35
+ - `npm run docs:check`;
36
+ - `npm run release:check`;
37
+ - Dify 插件与 n8n 节点各自的兼容声明、测试和打包检查。
38
+
39
+ 完整契约说明见 [CLIENT_API.md](CLIENT_API.md)。
@@ -0,0 +1,88 @@
1
+ # BailingHub v0.1.8: Create-Once Initial Administrator Bootstrap
2
+
3
+ `v0.1.8` fixes the administrator lifecycle in unattended installation and demo startup paths. The initial administrator is now created only when the administrator table is empty. Restarts, upgrades, container recreation, and reinstallation against the same persistent database never reconcile or overwrite an existing account.
4
+
5
+ ## Why this matters
6
+
7
+ A deployment may create an administrator during first installation, but startup configuration must not remain the authoritative source for that account.
8
+
9
+ If every startup rewrites the account from environment variables, restarting the service after an administrator changes the password can restore an old bootstrap password. That violates operational expectations and gives stale deployment configuration an unintended password-reset capability.
10
+
11
+ `v0.1.8` separates the two actions:
12
+
13
+ - **bootstrap** creates the first administrator for an empty database;
14
+ - **explicit administration** continues to use `npm run admin:create` for later account creation or password reset.
15
+
16
+ ## Main changes
17
+
18
+ ### Create-once bootstrap
19
+
20
+ Configure the paired variables:
21
+
22
+ ```text
23
+ BAILING_BOOTSTRAP_ADMIN_USERNAME
24
+ BAILING_BOOTSTRAP_ADMIN_PASSWORD
25
+ ```
26
+
27
+ Their semantics are:
28
+
29
+ - neither variable configured: skip automatic creation;
30
+ - only one variable configured: fail startup instead of accepting a partial configuration;
31
+ - administrator table empty: create the first enabled account with the `admin` role;
32
+ - any administrator already present: do not modify any username, password, role, or enabled state.
33
+
34
+ ### Safe concurrent cold starts
35
+
36
+ MySQL deployments serialize first creation with a named lock and a transaction. When multiple replicas cold-start together, only one can create the first administrator. Failure to acquire the initialization lock fails startup instead of continuing from an uncertain state.
37
+
38
+ ### One contract for the demo and installer
39
+
40
+ - The one-line installer generates a random initial password and passes it through the bootstrap variables.
41
+ - Demo seeding uses the same create-once logic.
42
+ - Restarting no longer resets an administrator password.
43
+ - Service logs do not print the administrator password.
44
+
45
+ ### Administrator repository compatibility fix
46
+
47
+ When an explicit password update omits the role:
48
+
49
+ - a new account uses `admin` as its insert default;
50
+ - an existing account preserves its current role.
51
+
52
+ This avoids a MySQL non-null rejection before the duplicate-key update can run.
53
+
54
+ ## Upgrade and compatibility
55
+
56
+ - No database migration is required.
57
+ - The Client API, executor protocol, tool signatures, and ACC semantics are unchanged.
58
+ - `npm run admin:create` remains available.
59
+ - Upgrades, reinstalls, and container recreation with the same database preserve existing accounts.
60
+ - Only a genuinely fresh installation after deleting the persistent database creates a new initial administrator.
61
+
62
+ Back up the database and deployment configuration before upgrading as usual. Historical deployments may still retain `BAILING_DEMO_ADMIN_PASSWORD` for compatible demo configuration, but it is no longer an authority that resets an administrator on every startup.
63
+
64
+ ## Validation
65
+
66
+ The release is validated with:
67
+
68
+ ```bash
69
+ npm run typecheck
70
+ npm test
71
+ npm run security:scan
72
+ npm run release:check
73
+ ```
74
+
75
+ Real-MySQL validation also covers:
76
+
77
+ 1. first creation from an empty administrator table;
78
+ 2. password persistence across restart after an explicit password change;
79
+ 3. exactly one initial administrator during concurrent cold starts;
80
+ 4. password redaction from service logs;
81
+ 5. Docker demo CI changing the password, restarting the container, and logging in with the new password.
82
+
83
+ ## Related documentation
84
+
85
+ - [Quickstart](QUICKSTART.en.md)
86
+ - [Production operations](OPERATIONS.en.md)
87
+ - [Compatibility and upgrade policy](COMPATIBILITY.en.md)
88
+ - [Changelog](CHANGELOG.en.md)
@@ -0,0 +1,88 @@
1
+ # BailingHub v0.1.8:首次管理员只创建一次
2
+
3
+ `v0.1.8` 修复无人值守安装与 demo 启动路径中的管理员生命周期问题:首次管理员现在只会在管理员表为空时创建。后续针对同一持久化数据库的服务重启、版本升级、容器重建或重新安装,都不会再次协调或覆盖已有账号。
4
+
5
+ ## 为什么要修
6
+
7
+ 部署系统可以提供“首次安装时创建管理员”的能力,但不能把启动配置永久当成管理员账号的权威来源。
8
+
9
+ 如果每次启动都根据环境变量重写账号,管理员主动改密后,服务重启可能把旧的 bootstrap 密码重新写回数据库。这既破坏运维预期,也会让旧部署配置持续拥有不应保留的密码重置能力。
10
+
11
+ `v0.1.8` 将这两种动作明确分开:
12
+
13
+ - **bootstrap**:只负责空数据库的首次管理员创建;
14
+ - **显式管理**:后续创建账号或重置密码继续使用 `npm run admin:create`。
15
+
16
+ ## 主要变化
17
+
18
+ ### Create-once bootstrap
19
+
20
+ 使用成对环境变量:
21
+
22
+ ```text
23
+ BAILING_BOOTSTRAP_ADMIN_USERNAME
24
+ BAILING_BOOTSTRAP_ADMIN_PASSWORD
25
+ ```
26
+
27
+ 语义如下:
28
+
29
+ - 两个变量都未配置:跳过自动创建;
30
+ - 只配置其中一个:拒绝启动,避免半配置状态;
31
+ - 管理员表为空:创建首个启用的 `admin` 账号;
32
+ - 管理员表已有任何账号:不修改任何账号、密码、角色或启用状态。
33
+
34
+ ### 并发冷启动安全
35
+
36
+ MySQL 模式使用命名锁和事务串行化首次创建。多副本同时冷启动时,只有一个副本能够创建首个管理员;无法取得初始化锁时,服务会失败退出,而不是在不确定状态继续运行。
37
+
38
+ ### demo 与安装器采用同一契约
39
+
40
+ - 一键安装器生成随机首次管理员密码,并通过 bootstrap 环境变量传入;
41
+ - demo seed 使用同一 create-once 逻辑;
42
+ - 重启不会重置管理员密码;
43
+ - 服务日志不再打印管理员密码。
44
+
45
+ ### 管理员仓储兼容修复
46
+
47
+ 显式修改密码时,如果调用方没有提供角色:
48
+
49
+ - 新账号使用 `admin` 作为插入缺省角色;
50
+ - 已有账号保留原角色。
51
+
52
+ 这避免了 MySQL 在执行重复键更新前,先因非空角色列缺值而拒绝请求。
53
+
54
+ ## 升级与兼容性
55
+
56
+ - 不需要数据库迁移;
57
+ - 不改变 Client API、执行器协议、工具签名或 ACC 语义;
58
+ - 既有 `npm run admin:create` 保持可用;
59
+ - 保留数据库的升级、重装和容器重建不会重置账号;
60
+ - 只有删除持久化数据库后的真正全新安装,才会重新创建首个管理员。
61
+
62
+ 升级前仍应按常规流程备份数据库与部署配置。若历史部署继续保留 `BAILING_DEMO_ADMIN_PASSWORD`,它只服务于兼容的 demo 配置,不再构成每次启动重置管理员的依据。
63
+
64
+ ## 验证
65
+
66
+ 发布前执行:
67
+
68
+ ```bash
69
+ npm run typecheck
70
+ npm test
71
+ npm run security:scan
72
+ npm run release:check
73
+ ```
74
+
75
+ 同时在真实 MySQL 上验证:
76
+
77
+ 1. 空管理员表能够首次创建;
78
+ 2. 管理员改密后重启,旧 bootstrap 密码不会恢复;
79
+ 3. 多副本冷启动只创建一个首个管理员;
80
+ 4. 日志不包含首次管理员密码;
81
+ 5. Docker demo CI 在改密并重启后仍能使用新密码登录。
82
+
83
+ ## 相关文档
84
+
85
+ - [快速开始](QUICKSTART.md)
86
+ - [生产运维](OPERATIONS.md)
87
+ - [兼容性与升级](兼容性与升级.md)
88
+ - [发布记录](CHANGELOG.md)
@@ -0,0 +1,127 @@
1
+ # BailingHub v0.1.9: Optional OpenMetrics Operational Metrics
2
+
3
+ `v0.1.9` adds a disabled-by-default OpenMetrics endpoint with independent authentication for self-hosted deployments. It turns queue pressure, executor liveness, approval waits, expired leases, and audit-write failures into stable, low-cardinality metrics that Prometheus-compatible collectors can scrape without parsing logs or reading business payloads.
4
+
5
+ ## Why this matters
6
+
7
+ Logs are useful for investigating an event, and traces are useful for following one execution path. Production operations also need continuous answers to a different set of questions:
8
+
9
+ - How many jobs are queued, running, waiting for approval, or failed?
10
+ - How long has the oldest queued job waited?
11
+ - Are there delayed jobs, expired leases, or blocked threads?
12
+ - Are executors online?
13
+ - Are audit writes failing?
14
+ - Is the runtime paused, and are the metrics collectors themselves healthy?
15
+
16
+ These signals should come from bounded state and control-plane aggregation, not from log bodies, job arguments, or business data.
17
+
18
+ ## Main changes
19
+
20
+ ### Disabled by default and independently authenticated
21
+
22
+ Enable the endpoint with:
23
+
24
+ ```text
25
+ BAILING_METRICS_ENABLED=true
26
+ BAILING_METRICS_TOKEN=<independent random token of at least 24 characters>
27
+ BAILING_METRICS_SCRAPE_TIMEOUT_MS=5000
28
+ ```
29
+
30
+ The security contract is:
31
+
32
+ - `/metrics` is not exposed by default;
33
+ - when enabled, it requires `Authorization: Bearer <token>`;
34
+ - query-string tokens are not accepted;
35
+ - the metrics token cannot reuse the administrative root token;
36
+ - missing, short, or reused tokens cause configuration validation to fail.
37
+
38
+ Generate an independent token with:
39
+
40
+ ```bash
41
+ openssl rand -hex 32
42
+ ```
43
+
44
+ ### Stable, low-cardinality metrics
45
+
46
+ The endpoint exposes only fixed states and bounded classifications, including:
47
+
48
+ - current job-state counts;
49
+ - recent terminal outcomes;
50
+ - oldest queued-job age;
51
+ - delayed jobs, expired leases, and blocked threads;
52
+ - pending approvals;
53
+ - executor online, offline, and stale-heartbeat states;
54
+ - audit-write failures;
55
+ - runtime pause state;
56
+ - state-store and control-plane collector health.
57
+
58
+ Metrics never include job IDs, tenants, principals, routes, arguments, prompts, response bodies, or business payloads as labels.
59
+
60
+ ### Collector fault isolation
61
+
62
+ State-store and control-plane collection run independently with bounded timeouts. If one collector fails:
63
+
64
+ - remaining metrics are still returned;
65
+ - the corresponding collector-health metric reports failure;
66
+ - missing business state is not fabricated as zero;
67
+ - collection failure does not change job execution, approval, or audit behavior.
68
+
69
+ ### Database indexes
70
+
71
+ This release adds:
72
+
73
+ ```text
74
+ sql/050_operational_metrics_indexes.sql
75
+ ```
76
+
77
+ The migration only adds indexes for terminal-window and executor-heartbeat aggregation. It does not change existing columns or business semantics.
78
+
79
+ Official Docker images run `npm run db:init` during startup. Existing deployments that run directly from source, use a custom startup command, or bypass the official entrypoint must run this before starting the upgraded service:
80
+
81
+ ```bash
82
+ npm run db:init
83
+ ```
84
+
85
+ ## Scrape example
86
+
87
+ ```bash
88
+ curl -fsS \
89
+ -H "Authorization: Bearer $BAILING_METRICS_TOKEN" \
90
+ http://127.0.0.1:18900/metrics
91
+ ```
92
+
93
+ Do not place the metrics token in URLs, public configuration, screenshots, or logs.
94
+
95
+ ## Compatibility boundary
96
+
97
+ - `/metrics` is disabled by default, so deployments that do not enable it retain existing public behavior.
98
+ - The Client API, executor protocol, tool signatures, chat protocol, and ACC semantics are unchanged.
99
+ - New state aggregation and control-plane metrics methods are optional extensions; existing third-party implementations may omit them.
100
+ - Metrics are operational observations, not authorization decisions, approval evidence, or final business authority.
101
+
102
+ ## Validation
103
+
104
+ The release is validated with:
105
+
106
+ ```bash
107
+ npm run typecheck
108
+ npm test
109
+ npm run docs:check
110
+ npm run security:scan
111
+ npm run release:check
112
+ ```
113
+
114
+ After deployment, verify that:
115
+
116
+ 1. `npm run db:init` completes and the migration ledger includes `050_operational_metrics_indexes.sql`;
117
+ 2. `/health/ready` reports ready;
118
+ 3. `/metrics` is unavailable while disabled;
119
+ 4. missing or incorrect tokens are rejected when enabled;
120
+ 5. the correct token returns OpenMetrics text;
121
+ 6. output contains no job IDs, principals, arguments, or business payloads.
122
+
123
+ ## Related documentation
124
+
125
+ - [Production operations](OPERATIONS.en.md)
126
+ - [Compatibility and upgrade policy](COMPATIBILITY.en.md)
127
+ - [Changelog](CHANGELOG.en.md)