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
package/.dockerignore ADDED
@@ -0,0 +1,42 @@
1
+ # Exclude hidden local/tooling state from the image context.
2
+ .*
3
+ !.dockerignore
4
+ !.env.example
5
+ node_modules/
6
+ web-admin/node_modules/
7
+ .deploy-backup/
8
+ .oss-dist/
9
+ .oss-publish/
10
+ bailinghub-*.tgz
11
+ *.bak.*
12
+ *.bak.*/
13
+ src.bak.*/
14
+ web/site/
15
+ web/site-dist/
16
+ deploy/
17
+ data/
18
+ config.json
19
+ .env
20
+ .paused
21
+ build-info.json
22
+ *.log
23
+ .DS_Store
24
+ ._*
25
+ web/console/
26
+ web/console.bak.*/
27
+ brain/profiles.local.json
28
+ brain/**/*.local.json
29
+ brain/**/*.local.md
30
+ internal/
31
+ *.internal.md
32
+ *.private.md
33
+ private/
34
+ enterprise/
35
+ src/private/
36
+ src/enterprise/
37
+ sql/private/
38
+ sql/enterprise/
39
+ web-admin/src/private/
40
+ web-admin/src/platform/
41
+ *.private.*
42
+ *.enterprise.*
package/.env.example ADDED
@@ -0,0 +1,83 @@
1
+ # 百灵中枢环境变量示例
2
+ # 本地开发可以只用 config.example.json;生产部署请设置 BAILING_ENV=production,
3
+ # 并把 token、数据库口令、模型 key、webhook 地址等敏感项全部放在环境变量或密钥管理器里。
4
+
5
+ # BAILING_ENV=production
6
+ # BAILING_HOST=127.0.0.1
7
+ # BAILING_PORT=18900
8
+ # BAILING_TOKEN=replace-with-at-least-24-random-characters
9
+
10
+ # Docker demo 对外端口。Compose 不再提供管理 token 默认值;可用
11
+ # `openssl rand -hex 32` 生成 BAILING_TOKEN,或使用一键安装脚本自动生成。
12
+ # BAILING_PUBLIC_PORT=18900
13
+ # BAILING_DEMO_PUBLIC_PORT=19080
14
+ # BAILING_MYSQL_PUBLIC_PORT=3307
15
+
16
+ # 一键安装模式:image=使用官方预构建镜像;source=下载源码后本机构建。
17
+ # BAILING_INSTALL_MODE=image
18
+ # BAILING_SKIP_PORT_CHECK=0
19
+ # BAILING_ALLOW_UNTESTED_ARCH=0
20
+ # BAILING_IMAGE_REGISTRY=crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com
21
+ # BAILING_IMAGE_NAMESPACE=bailinghub
22
+ # BAILING_IMAGE_TAG=0.1.0
23
+ # BAILINGHUB_IMAGE=crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailinghub:0.1.0
24
+ # BAILING_DEMO_BUSINESS_IMAGE=crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-demo-business:0.1.0
25
+ # BAILING_MYSQL_IMAGE=crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-mysql:8.4
26
+ # BAILING_NODE_IMAGE=node:22-bookworm-slim
27
+
28
+ # 状态库:完整能力建议使用 mysql。
29
+ # BAILING_STATE_BACKEND=mysql
30
+ # BAILING_MYSQL_HOST=
31
+ # BAILING_MYSQL_PORT=3306
32
+ # BAILING_MYSQL_DATABASE=bailinghub
33
+ # BAILING_MYSQL_USER=
34
+ # BAILING_MYSQL_PASSWORD=
35
+ # BAILING_MYSQL_CONNECTION_LIMIT=15
36
+ # BAILING_JSON_BODY_MAX_BYTES=1048576
37
+ # BAILING_SHUTDOWN_DRAIN_MS=30000
38
+ # bz_audit 自动保留期,0=不自动删除;生产建议按合规要求设置 90/180/365。
39
+ # BAILING_AUDIT_RETENTION_DAYS=0
40
+
41
+ # OpenMetrics 运维指标,默认关闭。启用时必须使用独立强随机 Token,
42
+ # 不能与 BAILING_TOKEN 复用;抓取超时单位为毫秒。
43
+ # BAILING_METRICS_ENABLED=false
44
+ # BAILING_METRICS_TOKEN=replace-with-an-independent-random-token
45
+ # BAILING_METRICS_SCRAPE_TIMEOUT_MS=5000
46
+
47
+ # 工具语义检索的部署级运行保护(毫秒)。索引/凭证读取或查询向量服务超时时,
48
+ # 本轮改用渐进式工具发现,避免可选的语义检索阻塞整个会话。
49
+ # BAILING_TOOL_INDEX_LOAD_TIMEOUT_MS=5000
50
+ # BAILING_TOOL_QUERY_EMBEDDING_TIMEOUT_MS=15000
51
+
52
+ # 首次管理员启动契约:两个变量必须同时配置。仅在管理员表为空时创建;
53
+ # 后续重启、升级或容器重建只会跳过,不会更新已有账号或密码。
54
+ # BAILING_BOOTSTRAP_ADMIN_USERNAME=admin
55
+ # BAILING_BOOTSTRAP_ADMIN_PASSWORD=replace-with-a-strong-password
56
+
57
+ # Docker demo 内置 MySQL 与 demo 业务系统密钥。一键安装脚本会自动生成强随机值。
58
+ # BAILING_DEMO_ADMIN_PASSWORD=bailing-demo-admin
59
+ # BAILING_DEMO_MYSQL_ROOT_PASSWORD=bailing-root-pass
60
+ # BAILING_DEMO_MYSQL_DATABASE=bailinghub
61
+ # BAILING_DEMO_MYSQL_USER=bailing
62
+ # BAILING_DEMO_MYSQL_PASSWORD=bailing-pass
63
+ # DEMO_TOOL_SECRET=demo-tool-secret-change-me
64
+ # DEMO_CLIENT_TOKEN=bailing-demo-client-token
65
+
66
+ # 展示时区。
67
+ # BAILING_DISPLAY_TZ=Asia/Shanghai
68
+ # BAILING_DISPLAY_TZ_LABEL=北京时间
69
+
70
+ # llm 凭证,JSON 对象,key 为凭证名。
71
+ # BAILING_LLM_CREDENTIALS_JSON={"deepseek":{"base_url":"https://api.deepseek.com","api_key":"replace-me"}}
72
+
73
+ # 自监控告警。type=webhook 时直发 URL;其他 type 走同名 notify 执行器目标。
74
+ # BAILING_ALERTS_TYPE=webhook
75
+ # BAILING_ALERTS_TO=
76
+ # BAILING_ALERTS_URL=
77
+ # BAILING_ALERTS_COOLDOWN_MIN=60
78
+
79
+ # 本地执行器进程读取;hub server 进程可不配。
80
+ # BAILING_HUB_URL=https://your-hub.example.com
81
+ # BAILING_EXECUTOR_TOKEN=
82
+ # BAILING_EXECUTOR_ID=worker-01
83
+ # BAILING_EXECUTOR_CONCURRENCY=1
package/.gitignore ADDED
@@ -0,0 +1,44 @@
1
+ # Exclude hidden local/tooling state by default. Keep public repo metadata tracked.
2
+ .*
3
+ !.dockerignore
4
+ !.env.example
5
+ !.github/
6
+ !.github/**
7
+ !.gitignore
8
+ !.npmignore
9
+
10
+ node_modules/
11
+ data/
12
+ .oss-dist/
13
+ .oss-publish/
14
+ bailinghub-*.tgz
15
+ config.json
16
+ .env
17
+ .paused
18
+ build-info.json
19
+ *.log
20
+ .DS_Store
21
+ web/console/
22
+ web/site/
23
+ web/site-dist/
24
+ deploy/
25
+ targets.local.json
26
+ internal/
27
+
28
+ # 部署方本地定制(brain 叠加层):仓库跟踪默认文件,定制写进同名 .local 兄弟文件,
29
+ # 升级 git pull 只动默认文件、永不碰下面这些,因此不会 merge 冲突。详见 brain/README.md。
30
+ brain/profiles.local.json
31
+ brain/**/*.local.json
32
+ brain/**/*.local.md
33
+
34
+ # Private edition extensions stay outside the public repository by default.
35
+ private/
36
+ enterprise/
37
+ src/private/
38
+ src/enterprise/
39
+ sql/private/
40
+ sql/enterprise/
41
+ web-admin/src/private/
42
+ web-admin/src/platform/
43
+ *.private.*
44
+ *.enterprise.*
package/.npmignore ADDED
@@ -0,0 +1,56 @@
1
+ # Exclude hidden local/tooling state from source packages.
2
+ .*
3
+ !.dockerignore
4
+ !.env.example
5
+ !.gitignore
6
+ !.npmignore
7
+ node_modules/
8
+ web-admin/node_modules/
9
+ .deploy-backup/
10
+ .oss-dist/
11
+ .oss-publish/
12
+ bailinghub-*.tgz
13
+ *.bak.*
14
+ *.bak.*/
15
+ src.bak.*/
16
+
17
+ # Private official site. The open-source package ships the console, widget,
18
+ # schemas, SDKs and demo app, but not the product website.
19
+ web/site/
20
+ web/site-dist/
21
+ deploy/
22
+
23
+ # Local runtime state. The generated console is intentionally included in the
24
+ # npm artifact by the prepack lifecycle; it remains ignored by Git.
25
+ web/console.bak.*/
26
+ data/
27
+ config.json
28
+ .env
29
+ .paused
30
+ build-info.json
31
+ *.log
32
+ .DS_Store
33
+ ._*
34
+
35
+ # Local operator profiles and notes.
36
+ brain/profiles.local.json
37
+ brain/**/*.local.json
38
+ brain/**/*.local.md
39
+ internal/
40
+
41
+ # Internal operating notes, not part of the open-source distribution.
42
+ *.internal.md
43
+ *.private.md
44
+
45
+ # Private edition extensions. The public package may expose neutral
46
+ # edition/scope interfaces, but never ships private implementation code.
47
+ private/
48
+ enterprise/
49
+ src/private/
50
+ src/enterprise/
51
+ sql/private/
52
+ sql/enterprise/
53
+ web-admin/src/private/
54
+ web-admin/src/platform/
55
+ *.private.*
56
+ *.enterprise.*
@@ -0,0 +1,24 @@
1
+ # Code of Conduct
2
+
3
+ This project is for building reliable AI middleware for business systems. We expect contributors to keep discussions technical, respectful, and actionable.
4
+
5
+ ## Expected Behavior
6
+
7
+ - Be direct about risks, tradeoffs, and failures.
8
+ - Critique code and architecture, not people.
9
+ - Share enough context for others to reproduce issues.
10
+ - Remove secrets, private data, and customer data from examples and logs.
11
+ - Respect maintainers' decisions about scope, security, and project direction.
12
+
13
+ ## Unacceptable Behavior
14
+
15
+ - Harassment, threats, personal attacks, or discriminatory language.
16
+ - Publishing private credentials, customer data, or internal deployment details.
17
+ - Repeated off-topic or intentionally disruptive comments.
18
+ - Misrepresenting security impact or exploitability.
19
+
20
+ ## Reporting
21
+
22
+ For security issues, follow [SECURITY.md](SECURITY.md). For conduct concerns in public project spaces, contact the maintainers through the repository owner contact channel.
23
+
24
+ Maintainers may edit, hide, or remove content and may restrict participation when behavior harms the project or its contributors.
@@ -0,0 +1,74 @@
1
+ # Contributing
2
+
3
+ Thanks for helping improve BailingHub.
4
+
5
+ ## Development
6
+
7
+ Requirements:
8
+
9
+ - Node.js 22 or newer;
10
+ - MySQL 8 for full runtime features;
11
+ - Docker Compose for the local demo.
12
+
13
+ Useful commands:
14
+
15
+ ```bash
16
+ npm install
17
+ npm run doctor
18
+ npm run typecheck
19
+ npm test
20
+ npm run sdk:test
21
+ npm run sdk:test7
22
+ docker compose up --build
23
+ ```
24
+
25
+ `npm run doctor` is the default pre-flight check for contributors. It validates local prerequisites, docs/examples, secret hygiene, and open-source package boundaries. Use `BAILING_DOCTOR_FULL=1 npm run doctor` before larger PRs; use `BAILING_DOCTOR_SMOKE=1 npm run doctor` only when a hub is running locally or remotely.
26
+
27
+ ## Pull Request Checklist
28
+
29
+ - Keep core contracts backward-compatible unless the change is intentionally major.
30
+ - Add or update tests for behavior changes.
31
+ - Update docs when changing public APIs, SDK behavior, config shape, database schema, or console workflows.
32
+ - Add new database changes as a new numbered file in `sql/`; do not edit already published migration files.
33
+ - Do not commit secrets, local config, generated logs, or private deployment details.
34
+ - Include validation evidence in the PR description: commands run, important manual checks, and any known gaps.
35
+ - Avoid refactor-only PRs unless the issue or maintainer discussion has already established a concrete architectural goal.
36
+
37
+ ## Contribution Routing
38
+
39
+ | Change type | Expected route |
40
+ |---|---|
41
+ | Bug fix or regression | Issue or PR with reproduction, expected behavior, and validation evidence. |
42
+ | Documentation correction | Direct docs PR is fine if it does not change public contracts. |
43
+ | New channel, model provider, storage backend, or business integration | Prefer `src/adapters`, SDKs, examples, or an external package. Core should only change if a reusable contract is missing. |
44
+ | New core contract or governance primitive | Open an issue first with problem statement, alternatives, compatibility impact, and test plan. |
45
+ | Database schema change | Add a new numbered migration in `sql/`, update docs, and add tests or smoke coverage where practical. |
46
+ | Marketplace or third-party plugin distribution | Deferred until provenance, signing, sandboxing, review, and vulnerability response are designed. |
47
+
48
+ ## Architecture Boundaries
49
+
50
+ - `src/core` contains pure contracts, config models, runtime primitives, platform utilities, state interfaces, and target abstractions.
51
+ - `src/app` composes runtime services, HTTP primitives, scheduling, delivery, tools, and lifecycle.
52
+ - `src/infrastructure` contains storage and repository implementations.
53
+ - `src/adapters` contains concrete integrations.
54
+ - `src/services` contains reusable service modules such as knowledge and tool indexing.
55
+
56
+ Core should not contain private deployment assumptions, hard-coded business channels, provider-specific credentials, or industry-specific workflows. The control plane must remain useful to any traditional system that can expose HTTP tools and consume HTTP callbacks.
57
+
58
+ Run the architecture boundary tests before submitting changes:
59
+
60
+ ```bash
61
+ npm test
62
+ ```
63
+
64
+ ## Community Distributions And Independent Implementations
65
+
66
+ BailingHub welcomes independently maintained distributions, industry adaptations, ecosystem components, and ACC implementations. Community projects may keep their own names, roadmaps, maintainer teams, and governance. They are not required to contribute every modification upstream.
67
+
68
+ Reusable improvements are welcome as Issues, Discussions, or Pull Requests. Strong independent projects may also request a future listing through the official BailingHub ecosystem surface, provided that their origin, maintainers, compatibility, and independent status are clear. A listing is not certification, warranty, endorsement, or a transfer of maintenance responsibility.
69
+
70
+ See [Community Derivatives And Ecosystem Collaboration](docs/ECOSYSTEM.en.md) for the complete policy and [中文说明](docs/ECOSYSTEM.md) for the Chinese version.
71
+
72
+ ## License
73
+
74
+ By contributing, you agree that your contributions are licensed under the Apache License 2.0.
package/Dockerfile ADDED
@@ -0,0 +1,16 @@
1
+ ARG NODE_IMAGE=node:22-bookworm-slim
2
+ FROM ${NODE_IMAGE}
3
+
4
+ WORKDIR /app
5
+
6
+ COPY package*.json ./
7
+ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
8
+
9
+ COPY web-admin/package*.json ./web-admin/
10
+ RUN cd web-admin && if [ -f package-lock.json ]; then npm ci; else npm install; fi
11
+
12
+ COPY . .
13
+ RUN cd web-admin && npm run build
14
+
15
+ EXPOSE 18900
16
+ ENTRYPOINT ["./scripts/docker-entrypoint.sh"]
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/LICENSING.md ADDED
@@ -0,0 +1,9 @@
1
+ # Licensing
2
+
3
+ Unless otherwise noted, this repository is licensed under the Apache License 2.0.
4
+
5
+ - Source code, SDKs, examples, schemas, and documentation are covered by the root `LICENSE`.
6
+ - Contributions are accepted under the same license, as described in `CONTRIBUTING.md`.
7
+ - Product names, project names, logos, and related marks are not licensed as trademarks by the Apache License 2.0. See `NOTICE`.
8
+
9
+ The license is intentionally permissive so developers can embed the SDKs, run the hub in their own environments, and build integrations without negotiating a separate agreement.
package/NOTICE ADDED
@@ -0,0 +1,23 @@
1
+ BailingHub
2
+ Copyright 2026 BailingHub contributors
3
+
4
+ This product includes software developed by BailingHub contributors.
5
+
6
+ The names "BailingHub", "百灵中枢", and related marks
7
+ identify the project and its maintainers. The Apache License 2.0 does
8
+ not grant trademark rights except for reasonable and customary use in
9
+ describing the origin of the work.
10
+
11
+ This product includes material derived from the Agent Capability
12
+ Contract (ACC), available at:
13
+ https://github.com/agent-capability/agent-capability-contract
14
+
15
+ ACC is an open specification for Agent-to-Business capability declaration.
16
+
17
+ BailingHub contributed early implementation experience to the development of
18
+ ACC v1. ACC is maintained as an implementation-neutral open contract.
19
+
20
+ Truthful compatibility statements such as "implements ACC v1" are allowed.
21
+
22
+ Do not imply official ACC certification or maintainer endorsement unless
23
+ explicitly granted.