bailinghub 0.10.0 → 0.11.1

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 (259) hide show
  1. package/CONTRIBUTING.md +20 -0
  2. package/README.en.md +6 -6
  3. package/README.md +6 -6
  4. package/SECURITY.md +20 -0
  5. package/THIRD_PARTY_NOTICES.md +2 -2
  6. package/docker-compose.images.yml +2 -2
  7. package/docs/AGENT_CONVERSATION_AUDIT.en.md +8 -2
  8. package/docs/AGENT_CONVERSATION_AUDIT.md +8 -1
  9. package/docs/CHANGELOG.en.md +29 -1
  10. package/docs/CHANGELOG.md +29 -1
  11. package/docs/IMPLEMENTATION_STATUS.en.md +12 -3
  12. package/docs/IMPLEMENTATION_STATUS.md +12 -3
  13. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  14. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  15. package/docs/MODEL_CONTINUATION.en.md +8 -0
  16. package/docs/MODEL_CONTINUATION.md +8 -0
  17. package/docs/MODEL_OUTPUT_BUDGET.en.md +1 -0
  18. package/docs/MODEL_OUTPUT_BUDGET.md +1 -0
  19. package/docs/README.en.md +6 -0
  20. package/docs/README.md +6 -0
  21. package/docs/RELEASE_NOTES_v0.10.1.en.md +41 -0
  22. package/docs/RELEASE_NOTES_v0.10.1.md +41 -0
  23. package/docs/RELEASE_NOTES_v0.11.0.en.md +19 -0
  24. package/docs/RELEASE_NOTES_v0.11.0.md +19 -0
  25. package/docs/RELEASE_NOTES_v0.11.1.en.md +25 -0
  26. package/docs/RELEASE_NOTES_v0.11.1.md +25 -0
  27. package/docs/UPGRADE_v0.10.1.en.md +66 -0
  28. package/docs/UPGRADE_v0.10.1.md +66 -0
  29. package/docs/UPGRADE_v0.11.0.en.md +24 -0
  30. package/docs/UPGRADE_v0.11.0.md +24 -0
  31. package/docs/UPGRADE_v0.11.1.en.md +28 -0
  32. package/docs/UPGRADE_v0.11.1.md +28 -0
  33. package/docs/security/GRC_EVIDENCE.md +54 -0
  34. package/docs/user-guide/console-map.md +2 -2
  35. package/package.json +5 -3
  36. package/scripts/check-doc-links.mjs +6 -0
  37. package/scripts/check-image-tags.sh +1 -1
  38. package/scripts/check-php-sdk-artifacts.mjs +152 -0
  39. package/scripts/check-php-sdk-artifacts.test.mjs +99 -0
  40. package/scripts/check-release-consistency.test.mjs +2 -2
  41. package/scripts/copy-acr-platform-image.sh +42 -0
  42. package/scripts/e2e-console-runtime-audit.mjs +7 -0
  43. package/scripts/e2e-console-troubleshooting-extra.mjs +4 -4
  44. package/scripts/e2e-console.mjs +90 -23
  45. package/scripts/install.sh +1 -1
  46. package/scripts/notification-console-test.mjs +2 -1
  47. package/scripts/publish-images.sh +1 -1
  48. package/scripts/release-audit.mjs +13 -1
  49. package/scripts/restore-ghcr-version.sh +48 -0
  50. package/scripts/sdk-declaration-contract-test.ts +34 -0
  51. package/scripts/sdk-p1-check.mjs +62 -26
  52. package/scripts/test-acr-platform-copy.sh +152 -0
  53. package/scripts/verify-github-repo.mjs +12 -0
  54. package/sdk/dotnet/Bailing.Connect/BailingConnect.cs +4 -4
  55. package/sdk/dotnet/README.md +8 -0
  56. package/sdk/dotnet/tests/Declaration/Declaration.csproj +11 -0
  57. package/sdk/dotnet/tests/Declaration/Program.cs +74 -0
  58. package/sdk/go/README.md +8 -0
  59. package/sdk/go/bailingconnect/connect.go +5 -5
  60. package/sdk/go/bailingconnect/declaration_test.go +107 -0
  61. package/sdk/java/README.md +13 -0
  62. package/sdk/java/src/main/java/com/bailing/connect/BailingConnect.java +4 -4
  63. package/sdk/java/tests/DeclarationTest.java +70 -0
  64. package/sdk/node/README.md +8 -0
  65. package/sdk/node/src/index.mjs +4 -4
  66. package/sdk/node/tests/declaration.test.mjs +41 -0
  67. package/sdk/php/README.md +16 -0
  68. package/sdk/php/src/Attributes/AiTool.php +4 -4
  69. package/sdk/php/src/SpecBuilder.php +8 -8
  70. package/sdk/php/tests/declaration-serialization.php +103 -0
  71. package/sdk/php7/README.md +14 -0
  72. package/sdk/php7/src/ToolDef.php +3 -3
  73. package/sdk/php7/src/ToolSpec.php +8 -13
  74. package/sdk/php7/tests/declaration-serialization.php +103 -0
  75. package/sdk/python/README.md +8 -0
  76. package/sdk/python/bailing_connect/__init__.py +6 -6
  77. package/sdk/python/tests/test_declaration.py +61 -0
  78. package/src/core/config/console-task-location.test.ts +12 -24
  79. package/src/core/contracts/explicit-capability-values.test.ts +62 -0
  80. package/src/core/contracts/openapi-tools.ts +2 -2
  81. package/src/core/contracts/tool-annotations.ts +4 -4
  82. package/src/core/runtime/credential-resolver.ts +3 -3
  83. package/src/infrastructure/config/config-agent-conversation-audit-repository.test.ts +29 -0
  84. package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +142 -9
  85. package/src/infrastructure/config/config-conversation-feed.integration.test.ts +134 -0
  86. package/src/infrastructure/config/config-conversation-ledger.test.ts +47 -1
  87. package/src/infrastructure/config/config-conversation-ledger.ts +24 -8
  88. package/src/infrastructure/config/config-observability-ledger.ts +32 -4
  89. package/src/infrastructure/config/config-recent-jobs.integration.test.ts +45 -0
  90. package/src/infrastructure/config/configstore.ts +4 -4
  91. package/src/infrastructure/config/conversation-delivery-message.ts +12 -0
  92. package/src/modules/usage/contracts.ts +1 -0
  93. package/src/modules/usage/model-context.test.ts +106 -0
  94. package/src/modules/usage/model-context.ts +54 -0
  95. package/src/modules/usage/model-continuation.test.ts +27 -0
  96. package/src/modules/usage/provider.test.ts +40 -0
  97. package/src/modules/usage/provider.ts +21 -3
  98. package/src/modules/usage/repository.ts +2 -1
  99. package/src/routes/admin-conversation-audit.ts +20 -3
  100. package/src/routes/admin-history-cursor.ts +12 -0
  101. package/src/routes/admin-runtime.test.ts +47 -0
  102. package/src/routes/admin-runtime.ts +32 -3
  103. package/src/routes/admin-usage.ts +12 -1
  104. package/src/routes/admin.ts +6 -1
  105. package/src/routes/agent-conversation-audit.test.ts +47 -3
  106. package/src/test-support/agent-conversation-audit-fixture.ts +9 -1
  107. package/web/connect/bailing-connect-php.tgz +0 -0
  108. package/web/connect/bailing-connect-php7.tgz +0 -0
  109. package/web/console/assets/{Accounts-Dhyw-7wF.js → Accounts-B1Ne8Xx2.js} +1 -1
  110. package/web/console/assets/AgentClients-CiGQ-n2i.js +1 -0
  111. package/web/console/assets/AgentClients-xEIfsj7w.css +1 -0
  112. package/web/console/assets/AgentTasks-CaCeYv60.css +1 -0
  113. package/web/console/assets/AgentTasks-CylHZHHq.js +2 -0
  114. package/web/console/assets/{Approvals-CQx1YWxW.js → Approvals-wD4Iv80G.js} +1 -1
  115. package/web/console/assets/{Audit--QcdVlMh.js → Audit-BStlxkPw.js} +1 -1
  116. package/web/console/assets/{BrandLockup-DQcaW4Nt.js → BrandLockup-BAhrPnhy.js} +1 -1
  117. package/web/console/assets/Channels-DAlIgNxo.js +105 -0
  118. package/web/console/assets/Channels-WwRHFKJn.css +1 -0
  119. package/web/console/assets/ChatEntries-CPx-E9aJ.js +7 -0
  120. package/web/console/assets/ChatEntries-DALYfRDP.css +1 -0
  121. package/web/console/assets/Clients-gqNFusNW.css +1 -0
  122. package/web/console/assets/Clients-w97QPpFD.js +3 -0
  123. package/web/console/assets/Cost-CNDZaif-.css +1 -0
  124. package/web/console/assets/Cost-CxtN0mca.js +1 -0
  125. package/web/console/assets/Credentials-6c6aktzZ.css +1 -0
  126. package/web/console/assets/Credentials-BhpoH-hR.js +1 -0
  127. package/web/console/assets/{Diagnostics-CyoM1XrZ.js → Diagnostics-DnC-ODuy.js} +1 -1
  128. package/web/console/assets/Executors-CCTYuZf4.js +1 -0
  129. package/web/console/assets/Executors-CQ8iw3kK.css +1 -0
  130. package/web/console/assets/{HelpTip-DLlhaGQp.js → HelpTip-piedkqU-.js} +1 -1
  131. package/web/console/assets/Kb-CFCa-7LY.css +1 -0
  132. package/web/console/assets/Kb-DKp3mwWB.js +2 -0
  133. package/web/console/assets/Login-g_aZWHQd.js +1 -0
  134. package/web/console/assets/Login-krXZsvoF.css +1 -0
  135. package/web/console/assets/Projects-BexeaCxT.css +1 -0
  136. package/web/console/assets/Projects-DurExYV9.js +1 -0
  137. package/web/console/assets/Routes-CKoIjkCM.css +1 -0
  138. package/web/console/assets/Routes-CX7Q7bkz.js +138 -0
  139. package/web/console/assets/Runs-C48kdEwk.css +1 -0
  140. package/web/console/assets/Runs-CQKEDsrH.js +3 -0
  141. package/web/console/assets/Setup-CtWCXXpj.css +1 -0
  142. package/web/console/assets/Setup-DzI8rEAc.js +1 -0
  143. package/web/console/assets/Shell-BQ-g_O7K.js +1 -0
  144. package/web/console/assets/Shell-Y2fZK5LV.css +1 -0
  145. package/web/console/assets/StorageBuckets-CWxzIh0x.css +1 -0
  146. package/web/console/assets/StorageBuckets-DoZIzA7B.js +1 -0
  147. package/web/console/assets/SystemSettings-C3pFFzAQ.js +1 -0
  148. package/web/console/assets/SystemSettings-C5nv0K2a.css +1 -0
  149. package/web/console/assets/SystemStatus-Bbxu2dp4.css +1 -0
  150. package/web/console/assets/SystemStatus-BgekIK52.js +1 -0
  151. package/web/console/assets/Targets-CbLq7rgm.css +1 -0
  152. package/web/console/assets/Targets-DH1ZcK0J.js +1 -0
  153. package/web/console/assets/Tools-CMS1wVOm.js +5 -0
  154. package/web/console/assets/Tools-Qk1c5Rp8.css +1 -0
  155. package/web/console/assets/Usage-C0OkK7Jg.js +1 -0
  156. package/web/console/assets/Usage-Cue7CYnT.css +1 -0
  157. package/web/console/assets/UsageAccess-CHdWXvE8.js +1 -0
  158. package/web/console/assets/UsageAccess-nOa03hGb.css +1 -0
  159. package/web/console/assets/{UsageHelp-BmuiE1Ew.js → UsageHelp-BkIsuFUj.js} +1 -1
  160. package/web/console/assets/{console-location-Csv-xsnl.js → console-location-C_az_xHo.js} +1 -1
  161. package/web/console/assets/index-CbI5fbiD.js +2 -0
  162. package/web/console/assets/{index-B_5UfiTw.js → index-DwlsLKwM.js} +1 -1
  163. package/web/console/assets/request-WgSVj8ie.js +1 -0
  164. package/web/console/assets/{schema-o3mK4mid.js → schema-rb4T_2cj.js} +1 -1
  165. package/web/console/assets/task-page-location-BGxGar7H.js +1 -0
  166. package/web/console/assets/{use-list-location-cIPy2cKM.js → use-list-location-DeVfTTII.js} +1 -1
  167. package/web/console/assets/{use-unsaved-form-DScKD0h9.js → use-unsaved-form-B10XHC-n.js} +1 -1
  168. package/web/console/assets/{util-B40VqOwl.js → util-C0YJ70YU.js} +1 -1
  169. package/web/console/assets/{vendor-element-BT8tHCFk.js → vendor-element-BCC2kYn_.js} +7 -7
  170. package/web/console/assets/{vendor-mammoth-CVIXVxTN.js → vendor-mammoth-C7l0Q30g.js} +1 -1
  171. package/web/console/index.html +2 -2
  172. package/web-admin/package-lock.json +4 -4
  173. package/web-admin/package.json +1 -1
  174. package/web-admin/scripts/agent-task-control-smoke.mjs +26 -3
  175. package/web-admin/src/components/AgentSetupPanel.vue +19 -15
  176. package/web-admin/src/components/ChannelThread.vue +441 -0
  177. package/web-admin/src/components/ClientConversations.vue +397 -134
  178. package/web-admin/src/components/ConversationSourceTag.vue +24 -0
  179. package/web-admin/src/components/JobStatusTag.vue +18 -0
  180. package/web-admin/src/components/NotificationOutboxPanel.vue +5 -2
  181. package/web-admin/src/components/UsageServiceReferences.vue +6 -24
  182. package/web-admin/src/components/conversation-audit.ts +67 -2
  183. package/web-admin/src/components/conversation-reading-position.ts +27 -0
  184. package/web-admin/src/layout/Shell.vue +15 -17
  185. package/web-admin/src/onboarding-state.ts +5 -5
  186. package/web-admin/src/pages/AgentClients.vue +33 -27
  187. package/web-admin/src/pages/AgentTasks.vue +88 -43
  188. package/web-admin/src/pages/Channels.vue +15 -41
  189. package/web-admin/src/pages/ChatEntries.vue +13 -51
  190. package/web-admin/src/pages/Clients.vue +2 -2
  191. package/web-admin/src/pages/Cost.vue +10 -51
  192. package/web-admin/src/pages/Credentials.vue +1 -1
  193. package/web-admin/src/pages/Executors.vue +4 -3
  194. package/web-admin/src/pages/Kb.vue +4 -4
  195. package/web-admin/src/pages/Login.vue +7 -8
  196. package/web-admin/src/pages/Projects.vue +1 -1
  197. package/web-admin/src/pages/Routes.vue +46 -83
  198. package/web-admin/src/pages/Runs.vue +239 -567
  199. package/web-admin/src/pages/Setup.vue +20 -20
  200. package/web-admin/src/pages/StorageBuckets.vue +1 -1
  201. package/web-admin/src/pages/SystemSettings.vue +1 -2
  202. package/web-admin/src/pages/SystemStatus.vue +4 -6
  203. package/web-admin/src/pages/Targets.vue +0 -2
  204. package/web-admin/src/pages/Tools.vue +31 -22
  205. package/web-admin/src/pages/Usage.vue +110 -60
  206. package/web-admin/src/pages/UsageAccess.vue +2 -5
  207. package/web-admin/src/request.ts +5 -1
  208. package/web-admin/src/task-page-location.ts +6 -12
  209. package/web-admin/src/task-trace-presentation.ts +143 -0
  210. package/web-admin/tests/conversation-audit.test.mjs +23 -1
  211. package/web-admin/tests/model-context.browser.mjs +238 -0
  212. package/web-admin/tests/model-output-budget.browser.mjs +1 -0
  213. package/web/console/assets/AgentClients-BA0M26-I.css +0 -1
  214. package/web/console/assets/AgentClients-DWxb8-ko.js +0 -1
  215. package/web/console/assets/AgentTasks-DOyxANnx.css +0 -1
  216. package/web/console/assets/AgentTasks-DUHD4dzr.js +0 -2
  217. package/web/console/assets/Channels-DJJU3ksE.css +0 -1
  218. package/web/console/assets/Channels-cGS5WfQ-.js +0 -105
  219. package/web/console/assets/ChatEntries-BYpji27B.css +0 -1
  220. package/web/console/assets/ChatEntries-nh23Iz5O.js +0 -7
  221. package/web/console/assets/Clients-CX5EeYio.js +0 -3
  222. package/web/console/assets/Clients-CbZAou8E.css +0 -1
  223. package/web/console/assets/Cost-C6oQvz9P.css +0 -1
  224. package/web/console/assets/Cost-DOZfdNS9.js +0 -1
  225. package/web/console/assets/Credentials--aHs57yV.css +0 -1
  226. package/web/console/assets/Credentials-sy6W9Sac.js +0 -1
  227. package/web/console/assets/Executors-2Upi6bOS.css +0 -1
  228. package/web/console/assets/Executors-BQqqiFwt.js +0 -1
  229. package/web/console/assets/Kb-5R3ce4UU.js +0 -5
  230. package/web/console/assets/Kb-BM_PYi11.css +0 -1
  231. package/web/console/assets/Login-YKeUwdgo.js +0 -1
  232. package/web/console/assets/Login-xtPwDB5_.css +0 -1
  233. package/web/console/assets/Projects-DHwHrPT9.css +0 -1
  234. package/web/console/assets/Projects-Grgb6fOv.js +0 -1
  235. package/web/console/assets/Routes-DR_Yf02e.css +0 -1
  236. package/web/console/assets/Routes-DYgrXlRJ.js +0 -138
  237. package/web/console/assets/Runs-CwTddJJj.js +0 -3
  238. package/web/console/assets/Runs-D4FOvNfu.css +0 -1
  239. package/web/console/assets/Setup-Ca0b1d1-.css +0 -1
  240. package/web/console/assets/Setup-D_xUPNDq.js +0 -1
  241. package/web/console/assets/Shell-BTg8Vw_L.css +0 -1
  242. package/web/console/assets/Shell-Dfam2Uoj.js +0 -1
  243. package/web/console/assets/StorageBuckets-7QLBpV4a.css +0 -1
  244. package/web/console/assets/StorageBuckets-CP6e50wI.js +0 -1
  245. package/web/console/assets/SystemSettings-BRYKyJNa.js +0 -1
  246. package/web/console/assets/SystemSettings-HsXGx0aH.css +0 -1
  247. package/web/console/assets/SystemStatus-B-VfRsQd.css +0 -1
  248. package/web/console/assets/SystemStatus-CbPsDsGt.js +0 -1
  249. package/web/console/assets/Targets-1j4-g6rC.css +0 -1
  250. package/web/console/assets/Targets-C2LkR2AF.js +0 -1
  251. package/web/console/assets/Tools-C9HPJqJb.css +0 -1
  252. package/web/console/assets/Tools-C9JNJUS0.js +0 -2
  253. package/web/console/assets/Usage-D1Mv6vGY.js +0 -1
  254. package/web/console/assets/Usage-DMOzUsqh.css +0 -1
  255. package/web/console/assets/UsageAccess-77LmGCm6.js +0 -1
  256. package/web/console/assets/UsageAccess-C6ZGxEgJ.css +0 -1
  257. package/web/console/assets/index-MjZJEFIN.js +0 -2
  258. package/web/console/assets/request-rqm6MT0s.js +0 -1
  259. package/web/console/assets/task-page-location-DWiGtAln.js +0 -1
@@ -57,6 +57,18 @@ const requiredRepoFiles = [
57
57
  'docs/RELEASE_NOTES_v0.10.0.en.md',
58
58
  'docs/UPGRADE_v0.10.0.md',
59
59
  'docs/UPGRADE_v0.10.0.en.md',
60
+ 'docs/RELEASE_NOTES_v0.10.1.md',
61
+ 'docs/RELEASE_NOTES_v0.10.1.en.md',
62
+ 'docs/UPGRADE_v0.10.1.md',
63
+ 'docs/UPGRADE_v0.10.1.en.md',
64
+ 'docs/RELEASE_NOTES_v0.11.1.md',
65
+ 'docs/RELEASE_NOTES_v0.11.1.en.md',
66
+ 'docs/UPGRADE_v0.11.1.md',
67
+ 'docs/UPGRADE_v0.11.1.en.md',
68
+ 'docs/RELEASE_NOTES_v0.11.0.md',
69
+ 'docs/RELEASE_NOTES_v0.11.0.en.md',
70
+ 'docs/UPGRADE_v0.11.0.md',
71
+ 'docs/UPGRADE_v0.11.0.en.md',
60
72
  'docs/RELEASE_NOTES_v0.6.1.md',
61
73
  'docs/RELEASE_NOTES_v0.6.0.md',
62
74
  'docs/CHANGELOG.md',
@@ -179,7 +191,7 @@ function assertRepoEntrance() {
179
191
  for (const required of ['npm run release:consistency', 'npm run release:consistency:test', 'npm run images:policy:test']) {
180
192
  if (!releaseAudit.includes(required)) findings.push(`package.json: release:audit must include ${required}`);
181
193
  }
182
- for (const required of ['npm run notices:check', 'npm run assets:check', 'npm run audit:deps', 'npm run client-api:contract', 'npm run client-api:ecosystem:clone', 'npm run typecheck', 'npm test', 'npm run widget:renderer:test', 'npm run web-admin:check', 'npm run docs:check', 'npm run examples:check', 'npm run sdk:test', 'npm run sdk:test7', 'npm run sdk:test-node', 'npm run sdk:test-python', 'npm run sdk:test-runtime', 'npm run sdk:test-p1', 'npm run release:audit', 'npm run oss:verify']) {
194
+ for (const required of ['npm run notices:check', 'npm run assets:check', 'npm run audit:deps', 'npm run client-api:contract', 'npm run client-api:ecosystem:clone', 'npm run typecheck', 'npm test', 'npm run widget:renderer:test', 'npm run web-admin:check', 'npm run docs:check', 'npm run examples:check', 'npm run sdk:test', 'npm run sdk:test7', 'npm run sdk:test-node', 'npm run sdk:test-python', 'npm run sdk:test-runtime', 'npm run sdk:test-p1', 'npm run sdk:test-declarations', 'npm run sdk:artifacts:check', 'npm run release:audit', 'npm run oss:verify']) {
183
195
  if (!releaseCheck.includes(required)) findings.push(`package.json: release:check must include ${required}`);
184
196
  }
185
197
  const imagesWorkflow = readText('.github/workflows/images.yml');
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+ # Return the verified GHCR version digest. Existing version tags keep their full index.
3
+ set -euo pipefail
4
+
5
+ acr_repo=${1:?ACR repository required}
6
+ ghcr_repo=${2:?GHCR repository required}
7
+ version=${3:?version required}
8
+
9
+ manifest_digest() {
10
+ local checksum
11
+ checksum=$(skopeo inspect --retry-times 3 --raw "docker://$1" | sha256sum) || return
12
+ printf 'sha256:%s\n' "${checksum%% *}"
13
+ }
14
+
15
+ runtime_config() {
16
+ # Older mirrors may use a different manifest media type. Compare the complete runnable config,
17
+ # including the ordered rootfs diff IDs, rather than treating the index itself as the platform.
18
+ skopeo --override-os linux --override-arch amd64 inspect --retry-times 3 --config "docker://$1" |
19
+ jq -ceS --arg version "$version" '
20
+ select(.os == "linux" and .architecture == "amd64" and
21
+ .config.Labels["org.opencontainers.image.version"] == $version and
22
+ (.config.Labels["org.opencontainers.image.revision"] | test("^[0-9a-f]{40}$")) and
23
+ (.rootfs.diff_ids | type == "array" and length > 0))' |
24
+ sha256sum | cut -d ' ' -f 1
25
+ }
26
+
27
+ acr_digest=$(manifest_digest "$acr_repo:$version")
28
+ expected=$(runtime_config "$acr_repo@$acr_digest")
29
+ probe_error=$(mktemp)
30
+ trap 'rm -f "$probe_error"' EXIT
31
+ if ! ghcr_digest=$(manifest_digest "$ghcr_repo:$version" 2>"$probe_error"); then
32
+ if ! grep -Eiq '(: |")manifest unknown([: "].*)?$' "$probe_error"; then
33
+ cat "$probe_error" >&2
34
+ exit 1
35
+ fi
36
+ # Require a successful authenticated tag listing as a second check before creating a missing tag.
37
+ skopeo list-tags --retry-times 3 "docker://$ghcr_repo" |
38
+ jq -e --arg version "$version" '.Tags | type == "array" and index($version) == null' >/dev/null
39
+ skopeo copy --retry-times 3 --all --preserve-digests "docker://$acr_repo@$acr_digest" "docker://$ghcr_repo:$version" >&2
40
+ ghcr_digest=$(manifest_digest "$ghcr_repo:$version")
41
+ [[ "$ghcr_digest" == "$acr_digest" ]] || { echo "Restored GHCR version digest differs from ACR." >&2; exit 1; }
42
+ fi
43
+ actual=$(runtime_config "$ghcr_repo@$ghcr_digest")
44
+ if [[ "$actual" != "$expected" ]]; then
45
+ echo "GHCR $version and ACR $version have different runnable configurations; stopping recovery." >&2
46
+ exit 1
47
+ fi
48
+ printf '%s\n' "$ghcr_digest"
@@ -0,0 +1,34 @@
1
+ // Consume actual generator JSON, then exercise the production OpenAPI compiler.
2
+ import { readFileSync } from 'node:fs';
3
+ import assert from 'node:assert/strict';
4
+ import { compileOpenApiTools } from '../src/core/contracts/openapi-tools';
5
+
6
+ const report = JSON.parse(readFileSync(0, 'utf8'));
7
+ assert.equal(report.passed, true, JSON.stringify(report.errors));
8
+ assert.equal(report.matrix.length, 24);
9
+ assert.equal(report.idempotence.length, 6);
10
+ const seen = new Set<string>();
11
+ for (const row of [...report.matrix, ...report.idempotence]) {
12
+ const capability = row.capability;
13
+ const result = compileOpenApiTools(JSON.stringify({
14
+ openapi: '3.0.0', info: { title: 'SDK contract fixture', version: '1' },
15
+ paths: { '/fixture': { [row.method.toLowerCase()]: {
16
+ operationId: 'sdk_fixture', summary: 'SDK generated declaration',
17
+ parameters: [{ name: 'record_id', in: 'query', schema: { type: 'integer' } }],
18
+ 'x-agent-capability': capability,
19
+ } } },
20
+ }));
21
+ assert.equal(result.tools.length, 1, JSON.stringify(result.diagnostics));
22
+ assert.equal(result.diagnostics.filter(d => d.severity === 'error').length, 0);
23
+ const tool = result.tools[0]!;
24
+ if (Object.hasOwn(row, 'readonly')) {
25
+ seen.add(JSON.stringify([row.method, row.readonly, row.risk]));
26
+ const readonly = row.readonly ?? (row.method === 'GET');
27
+ assert.equal(tool.readonly, readonly);
28
+ assert.equal(tool.risk, row.risk ?? (readonly ? 'low' : 'medium'));
29
+ } else {
30
+ assert.equal(tool.idempotent, row.idempotent ?? (row.method === 'GET'));
31
+ }
32
+ }
33
+ assert.equal(seen.size, 24, 'Each input combination must be represented once');
34
+ console.log(`${report.sdk}: 24 generated declarations + 6 idempotency cases consumed by Core`);
@@ -1,11 +1,19 @@
1
- import { existsSync, rmSync } from 'node:fs';
1
+ import { cpSync, mkdtempSync, rmSync } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
- import { join, resolve } from 'node:path';
3
+ import { basename, join, resolve } from 'node:path';
4
4
  import { spawnSync } from 'node:child_process';
5
5
 
6
6
  const root = resolve(import.meta.dirname, '..');
7
+ const args = process.argv.slice(2);
8
+ if (args.some((arg) => arg !== '--require-all')) {
9
+ console.error('Usage: node scripts/sdk-p1-check.mjs [--require-all]');
10
+ process.exit(2);
11
+ }
12
+ const requireAll = args.includes('--require-all');
13
+ const matrixMarker = 'PASS: 24 readonly/risk combinations + 6 idempotent combinations';
7
14
  let pass = 0;
8
15
  let fail = 0;
16
+ let skipped = 0;
9
17
 
10
18
  function ok(name, cond, extra = '') {
11
19
  if (cond) {
@@ -17,42 +25,70 @@ function ok(name, cond, extra = '') {
17
25
  }
18
26
  }
19
27
 
20
- function has(cmd) {
21
- return spawnSync('sh', ['-lc', `command -v ${cmd}`], { encoding: 'utf8' }).status === 0;
28
+ function details(result) {
29
+ return [result.error?.message, result.stderr, result.stdout].filter(Boolean).join('\n').trim();
30
+ }
31
+
32
+ function run(cmd, args, cwd = root, timeout = 300_000) {
33
+ return spawnSync(cmd, args, { cwd, encoding: 'utf8', timeout, maxBuffer: 10 * 1024 * 1024 });
22
34
  }
23
35
 
24
- function run(cmd, args, cwd = root) {
25
- return spawnSync(cmd, args, { cwd, encoding: 'utf8' });
36
+ function toolchain(name, probes) {
37
+ // Probe the actual executables with the same inherited PATH as every test.
38
+ // A login shell can replace PATH and accidentally validate a different toolchain.
39
+ const unavailable = probes.map(([cmd, probeArgs]) => ({ cmd, result: run(cmd, probeArgs, root, 15_000) }))
40
+ .filter(({ result }) => result.status !== 0);
41
+ if (!unavailable.length) return true;
42
+ skipped++;
43
+ console.log(` SKIP ${name} example and declaration matrix: ${unavailable.map(({ cmd, result }) => `${cmd}: ${details(result) || `exit ${result.status}`}`).join('; ')}`);
44
+ if (requireAll) ok(`${name} toolchain required (--require-all)`, false);
45
+ return false;
26
46
  }
27
47
 
28
48
  console.log('— P1 SDK checks');
29
49
 
30
- const javaOut = join(tmpdir(), `bailing-java-${Date.now()}`);
31
- if (has('javac') && has('java')) {
32
- const compile = run('javac', ['-d', javaOut, 'sdk/java/src/main/java/com/bailing/connect/BailingConnect.java', 'sdk/java/examples/BuildSpec.java']);
33
- ok('Java SDK compiles', compile.status === 0, compile.stderr);
34
- if (compile.status === 0) {
35
- const out = run('java', ['-cp', javaOut, 'BuildSpec']);
36
- ok('Java example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi":"3.0.0"'), out.stderr || out.stdout);
50
+ if (toolchain('Java', [['javac', ['-version']], ['java', ['-version']]])) {
51
+ const javaOut = mkdtempSync(join(tmpdir(), 'bailing-java-'));
52
+ try {
53
+ const compile = run('javac', ['-d', javaOut, 'sdk/java/src/main/java/com/bailing/connect/BailingConnect.java', 'sdk/java/examples/BuildSpec.java', 'sdk/java/tests/DeclarationTest.java']);
54
+ ok('Java SDK, example and declaration matrix compile', compile.status === 0, details(compile));
55
+ if (compile.status === 0) {
56
+ const out = run('java', ['-cp', javaOut, 'BuildSpec']);
57
+ ok('Java example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi":"3.0.0"'), details(out));
58
+ const matrix = run('java', ['-cp', javaOut, 'DeclarationTest']);
59
+ ok('Java declaration matrix: 24 readonly/risk + 6 idempotent', matrix.status === 0 && matrix.stdout.includes(matrixMarker), details(matrix));
60
+ }
61
+ } finally {
62
+ rmSync(javaOut, { recursive: true, force: true });
37
63
  }
38
- rmSync(javaOut, { recursive: true, force: true });
39
- } else {
40
- ok('Java SDK source present', existsSync(resolve(root, 'sdk/java/src/main/java/com/bailing/connect/BailingConnect.java')));
41
64
  }
42
65
 
43
- if (has('go')) {
66
+ if (toolchain('Go', [['go', ['version']]])) {
44
67
  const out = run('go', ['run', './examples/build-spec'], resolve(root, 'sdk/go'));
45
- ok('Go example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi": "3.0.0"'), out.stderr || out.stdout);
46
- } else {
47
- ok('Go SDK source present', existsSync(resolve(root, 'sdk/go/bailingconnect/connect.go')));
68
+ ok('Go example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi": "3.0.0"'), details(out));
69
+ const matrix = run('go', ['test', '-count=1', '-v', './bailingconnect'], resolve(root, 'sdk/go'));
70
+ ok('Go declaration matrix: 24 readonly/risk + 6 idempotent', matrix.status === 0
71
+ && matrix.stdout.includes('--- PASS: TestDeclarationReadonlyRiskMatrix (')
72
+ && matrix.stdout.includes('--- PASS: TestDeclarationIdempotentPresence ('), details(matrix));
48
73
  }
49
74
 
50
- if (has('dotnet')) {
51
- const out = run('dotnet', ['run', '--project', 'sdk/dotnet/examples/BuildSpec/BuildSpec.csproj']);
52
- ok('.NET example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi": "3.0.0"'), out.stderr || out.stdout);
53
- } else {
54
- ok('.NET SDK source present', existsSync(resolve(root, 'sdk/dotnet/Bailing.Connect/BailingConnect.cs')));
75
+ if (toolchain('.NET', [['dotnet', ['--version']]])) {
76
+ const dotnetRoot = mkdtempSync(join(tmpdir(), 'bailing-dotnet-'));
77
+ try {
78
+ // dotnet writes bin/obj next to each project. Keep them out of SDK sources
79
+ // and distribution archives, and do not reuse stale local build outputs.
80
+ cpSync(resolve(root, 'sdk/dotnet'), dotnetRoot, {
81
+ recursive: true,
82
+ filter: (source) => !['bin', 'obj'].includes(basename(source)),
83
+ });
84
+ const out = run('dotnet', ['run', '--project', 'examples/BuildSpec/BuildSpec.csproj'], dotnetRoot);
85
+ ok('.NET example emits OpenAPI', out.status === 0 && out.stdout.includes('"openapi": "3.0.0"'), details(out));
86
+ const matrix = run('dotnet', ['run', '--project', 'tests/Declaration/Declaration.csproj'], dotnetRoot);
87
+ ok('.NET declaration matrix: 24 readonly/risk + 6 idempotent', matrix.status === 0 && matrix.stdout.includes(matrixMarker), details(matrix));
88
+ } finally {
89
+ rmSync(dotnetRoot, { recursive: true, force: true });
90
+ }
55
91
  }
56
92
 
57
- console.log(`\n结果:通过 ${pass} / 失败 ${fail}`);
93
+ console.log(`\n结果:通过 ${pass} / 失败 ${fail} / 跳过工具链 ${skipped}${requireAll ? '(不允许跳过)' : ''}`);
58
94
  process.exit(fail ? 1 : 0);
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env bash
2
+ # Exercise release image copying with two disposable loopback-only TLS registries.
3
+ set -euo pipefail
4
+
5
+ here=$(cd "$(dirname "$0")" && pwd)
6
+ tmp=$(mktemp -d)
7
+ registries=()
8
+ cleanup() {
9
+ for container in "${registries[@]}"; do docker rm -fv "$container" >/dev/null; done
10
+ rm -rf "$tmp"
11
+ }
12
+ trap cleanup EXIT
13
+ openssl req -x509 -newkey rsa:2048 -nodes -days 1 -subj '/CN=localhost' \
14
+ -addext 'subjectAltName=IP:127.0.0.1' -keyout "$tmp/key.pem" -out "$tmp/cert.pem" 2>/dev/null
15
+ export SSL_CERT_FILE="$tmp/cert.pem" REGISTRY_AUTH_FILE="$tmp/auth.json"
16
+ printf '{"auths":{}}\n' > "$REGISTRY_AUTH_FILE"
17
+
18
+ for side in source target; do
19
+ container=$(docker create -p 127.0.0.1::5000 \
20
+ -e REGISTRY_HTTP_TLS_CERTIFICATE=/etc/docker/registry/cert.pem \
21
+ -e REGISTRY_HTTP_TLS_KEY=/etc/docker/registry/key.pem \
22
+ registry:2.8.3@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373)
23
+ registries+=("$container")
24
+ docker cp "$tmp/cert.pem" "$container:/etc/docker/registry/cert.pem"
25
+ docker cp "$tmp/key.pem" "$container:/etc/docker/registry/key.pem"
26
+ docker start "$container" >/dev/null
27
+ endpoint=$(docker port "$container" 5000/tcp)
28
+ curl -fsS --cacert "$SSL_CERT_FILE" --retry 15 --retry-all-errors --retry-delay 1 "https://$endpoint/v2/" >/dev/null
29
+ printf -v "${side}_repo" '%s/test/image' "$endpoint"
30
+ done
31
+
32
+ version=v1.2.3
33
+ revision=1234567890abcdef1234567890abcdef12345678
34
+ # A deterministic OCI layout with two platforms and BuildKit-style provenance.
35
+ python3 - "$tmp" "$version" "$revision" <<'PY'
36
+ import gzip, hashlib, io, json, pathlib, sys, tarfile
37
+ root = pathlib.Path(sys.argv[1]) / 'layout'
38
+ blobs = root / 'blobs' / 'sha256'
39
+ blobs.mkdir(parents=True)
40
+ oci = 'application/vnd.oci.image.'
41
+ def encode(obj):
42
+ return json.dumps(obj, separators=(',', ':')).encode()
43
+ def blob(media, data):
44
+ if not isinstance(data, bytes):
45
+ data = encode(data)
46
+ key = hashlib.sha256(data).hexdigest()
47
+ (blobs / key).write_bytes(data)
48
+ return {'mediaType': media, 'digest': 'sha256:' + key, 'size': len(data)}
49
+ def manifest(config, layers, **properties):
50
+ media = oci + 'manifest.v1+json'
51
+ return blob(media, {'schemaVersion': 2, 'mediaType': media, 'config': config, 'layers': layers, **properties})
52
+
53
+ payload = b'platform copy test\n'
54
+ tar = io.BytesIO()
55
+ with tarfile.open(fileobj=tar, mode='w') as archive:
56
+ entry = tarfile.TarInfo('fixture.txt')
57
+ entry.size = len(payload)
58
+ archive.addfile(entry, io.BytesIO(payload))
59
+ raw = tar.getvalue()
60
+ layer = blob(oci + 'layer.v1.tar+gzip', gzip.compress(raw, mtime=0))
61
+ images = []
62
+ for arch in ['amd64', 'arm64']:
63
+ platform = {'os': 'linux', 'architecture': arch}
64
+ config = blob(oci + 'config.v1+json', {**platform, 'rootfs': {'type':'layers','diff_ids':['sha256:' + hashlib.sha256(raw).hexdigest()]},
65
+ 'config': {'Labels': {'org.opencontainers.image.version':sys.argv[2], 'org.opencontainers.image.revision':sys.argv[3]}}})
66
+ images.append({**manifest(config, [layer]), 'platform': platform})
67
+ proof = blob('application/vnd.in-toto+json', {'_type':'https://in-toto.io/Statement/v0.1', 'subject':[{'name':'fixture','digest':{'sha256':images[0]['digest'][7:]}}],
68
+ 'predicateType':'https://slsa.dev/provenance/v0.2', 'predicate':{}})
69
+ unknown = {'os':'unknown', 'architecture':'unknown'}
70
+ config = blob('application/vnd.oci.empty.v1+json', {})
71
+ subject = {key: images[0][key] for key in ['mediaType', 'digest', 'size']}
72
+ artifact = manifest(config, [proof], artifactType='application/vnd.docker.attestation.manifest.v1+json', subject=subject)
73
+ attestation = {**artifact, 'platform':unknown, 'annotations':{'vnd.docker.reference.type':'attestation-manifest','vnd.docker.reference.digest':images[0]['digest']}}
74
+ index = {'schemaVersion':2, 'mediaType':oci+'index.v1+json', 'manifests':[*images, attestation]}
75
+ descriptor = blob(index['mediaType'], index)
76
+ (root/'oci-layout').write_text('{"imageLayoutVersion":"1.0.0"}')
77
+ (root/'index.json').write_bytes(encode({**index,'manifests':[{**descriptor,'annotations':{'org.opencontainers.image.ref.name':'fixture'}}]}))
78
+ PY
79
+ skopeo copy --all --preserve-digests "oci:$tmp/layout:fixture" "docker://$source_repo:$version" >/dev/null
80
+
81
+ # Read the v2 registry protocol directly for independent verification.
82
+ request() {
83
+ local repo=$1 path=$2
84
+ curl -fsS --cacert "$SSL_CERT_FILE" \
85
+ -H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
86
+ "https://${repo%%/*}/v2/${repo#*/}/$path"
87
+ }
88
+ digest() { printf 'sha256:%s\n' "$(sha256sum "$1" | cut -d ' ' -f 1)"; }
89
+ request "$source_repo" "manifests/$version" > "$tmp/index"
90
+ index_digest=$(digest "$tmp/index")
91
+ runtime=$(jq -er '.manifests[] | select(.platform.architecture == "amd64") | .digest' "$tmp/index")
92
+ other=$(jq -er '.manifests[] | select(.platform.architecture == "arm64") | .digest' "$tmp/index")
93
+ proof=$(jq -er --arg runtime "$runtime" '.manifests[] | select(.annotations["vnd.docker.reference.type"] == "attestation-manifest" and .annotations["vnd.docker.reference.digest"] == $runtime) | .digest' "$tmp/index")
94
+ request "$source_repo" "manifests/$runtime" > "$tmp/runtime"
95
+ for tag in "$version" latest; do
96
+ "$here/copy-acr-platform-image.sh" "$source_repo" "$index_digest" "$target_repo" "$tag" "$revision" "$version"
97
+ request "$target_repo" "manifests/$tag" > "$tmp/published"
98
+ cmp "$tmp/runtime" "$tmp/published"
99
+ for blob in $(jq -r '.config.digest, .layers[].digest' "$tmp/runtime"); do
100
+ request "$target_repo" "blobs/$blob" > "$tmp/blob"
101
+ [[ $(digest "$tmp/blob") == "$blob" ]]
102
+ done
103
+ done
104
+ # Existing single-platform Docker schema 2 images must also copy unchanged.
105
+ skopeo copy --format v2s2 "docker://$source_repo@$runtime" "docker://$source_repo:legacy" >/dev/null
106
+ request "$source_repo" manifests/legacy > "$tmp/legacy"
107
+ jq -e '.mediaType == "application/vnd.docker.distribution.manifest.v2+json"' "$tmp/legacy" >/dev/null
108
+ "$here/copy-acr-platform-image.sh" "$source_repo" "$(digest "$tmp/legacy")" "$target_repo" legacy "$revision" "$version"
109
+ request "$target_repo" manifests/legacy > "$tmp/published"
110
+ cmp "$tmp/legacy" "$tmp/published"
111
+
112
+ for scenario in wrong-platform wrong-revision wrong-version; do
113
+ input=$index_digest want_revision=$revision want_version=$version
114
+ case "$scenario" in
115
+ wrong-platform) input=$other ;;
116
+ wrong-revision) want_revision=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ;;
117
+ wrong-version) want_version=v2.0.0 ;;
118
+ esac
119
+ if "$here/copy-acr-platform-image.sh" "$source_repo" "$input" "$target_repo" "$scenario" "$want_revision" "$want_version"; then
120
+ echo "Unexpectedly accepted $scenario" >&2; exit 1
121
+ fi
122
+ done
123
+ request "$target_repo" tags/list | jq -e --arg version "$version" '.tags | sort == ([$version, "latest", "legacy"] | sort)' >/dev/null
124
+ for absent in "$index_digest" "$proof" "$other"; do
125
+ status=$(curl -sS --cacert "$SSL_CERT_FILE" -o /dev/null -w '%{http_code}' \
126
+ -H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.oci.image.manifest.v1+json' \
127
+ "https://${target_repo%%/*}/v2/${target_repo#*/}/manifests/$absent")
128
+ [[ $status == 404 ]] || { echo "Unexpected destination response for $absent: $status" >&2; exit 1; }
129
+ done
130
+ request "$source_repo" "manifests/$version" > "$tmp/after"
131
+ cmp "$tmp/index" "$tmp/after"
132
+ request "$source_repo" "manifests/$proof" > "$tmp/attestation"
133
+ [[ $(digest "$tmp/attestation") == "$proof" ]]
134
+ jq -e --arg runtime "$runtime" '.config.mediaType == "application/vnd.oci.empty.v1+json" and
135
+ .artifactType == "application/vnd.docker.attestation.manifest.v1+json" and .subject.digest == $runtime' "$tmp/attestation" >/dev/null
136
+ request "$source_repo" "blobs/$(jq -er '.layers[0].digest' "$tmp/attestation")" | jq -e '.predicateType | startswith("https://slsa.dev/provenance/")' >/dev/null
137
+ # Recovery must leave an existing full index intact when its fallback is flattened.
138
+ restored=$("$here/restore-ghcr-version.sh" "$target_repo" "$source_repo" "$version")
139
+ [[ $restored == "$index_digest" ]]
140
+ request "$source_repo" "manifests/$version" > "$tmp/recovered"
141
+ cmp "$tmp/index" "$tmp/recovered"
142
+ # A historical fallback may itself be an index. Seed an existing repository missing this version.
143
+ recovery_repo="${target_repo%%/*}/test/recovery"
144
+ skopeo copy --preserve-digests "docker://$source_repo@$runtime" "docker://$recovery_repo:prior" >/dev/null
145
+ restored=$("$here/restore-ghcr-version.sh" "$source_repo" "$recovery_repo" "$version")
146
+ [[ $restored == "$index_digest" ]]
147
+ request "$recovery_repo" "manifests/$version" > "$tmp/recovered"
148
+ cmp "$tmp/index" "$tmp/recovered"
149
+ request "$recovery_repo" "manifests/$proof" > "$tmp/recovered"
150
+ cmp "$tmp/attestation" "$tmp/recovered"
151
+ printf 'PASS: source index %s and attestation %s retained; target %s and latest share runnable %s; legacy, rejection and recovery checks passed\n' \
152
+ "$index_digest" "$proof" "$version" "$runtime"
@@ -149,6 +149,18 @@ const requiredFiles = [
149
149
  'docs/RELEASE_NOTES_v0.10.0.en.md',
150
150
  'docs/UPGRADE_v0.10.0.md',
151
151
  'docs/UPGRADE_v0.10.0.en.md',
152
+ 'docs/RELEASE_NOTES_v0.10.1.md',
153
+ 'docs/RELEASE_NOTES_v0.10.1.en.md',
154
+ 'docs/UPGRADE_v0.10.1.md',
155
+ 'docs/UPGRADE_v0.10.1.en.md',
156
+ 'docs/RELEASE_NOTES_v0.11.1.md',
157
+ 'docs/RELEASE_NOTES_v0.11.1.en.md',
158
+ 'docs/UPGRADE_v0.11.1.md',
159
+ 'docs/UPGRADE_v0.11.1.en.md',
160
+ 'docs/RELEASE_NOTES_v0.11.0.md',
161
+ 'docs/RELEASE_NOTES_v0.11.0.en.md',
162
+ 'docs/UPGRADE_v0.11.0.md',
163
+ 'docs/UPGRADE_v0.11.0.en.md',
152
164
  'docs/RELEASE_NOTES_v0.6.1.md',
153
165
  'docs/RELEASE_NOTES_v0.6.0.md',
154
166
  'docs/CHANGELOG.md',
@@ -140,7 +140,7 @@ public static class BailingConnect
140
140
  private static Dictionary<string, object?> BuildCapability(Tool t, string method)
141
141
  {
142
142
  var capability = new Dictionary<string, object?> { ["version"] = 1, ["enabled"] = true, ["scope"] = t.Scope };
143
- if (!string.IsNullOrEmpty(t.Risk) && t.Risk != "low") capability["risk"] = new Dictionary<string, object?> { ["level"] = t.Risk };
143
+ if (!string.IsNullOrEmpty(t.Risk)) capability["risk"] = new Dictionary<string, object?> { ["level"] = t.Risk };
144
144
  if (t.Confirm || t.ConfirmWhen.Count > 0 || !string.IsNullOrEmpty(t.ConfirmPrompt))
145
145
  {
146
146
  var approval = new Dictionary<string, object?>();
@@ -151,8 +151,8 @@ public static class BailingConnect
151
151
  }
152
152
  if (t.RequiresSubject) capability["subject"] = new Dictionary<string, object?> { ["required"] = true };
153
153
  var execution = new Dictionary<string, object?>();
154
- if (t.Readonly == true && method != "GET") execution["readonly"] = true;
155
- if (t.Idempotent == true && method != "GET") execution["idempotent"] = true;
154
+ if (t.Readonly.HasValue) execution["readonly"] = t.Readonly.Value;
155
+ if (t.Idempotent.HasValue) execution["idempotent"] = t.Idempotent.Value;
156
156
  var rateLimit = NormalizeRateLimit(t.RateLimit);
157
157
  if (rateLimit is not null) execution["rate_limit"] = rateLimit;
158
158
  if (t.TimeoutMs is not null) execution["timeout_ms"] = t.TimeoutMs;
@@ -200,7 +200,7 @@ public sealed class Tool
200
200
  public string Scope { get; init; } = "";
201
201
  public string Path { get; init; } = "";
202
202
  public string Method { get; init; } = "GET";
203
- public string Risk { get; init; } = "low";
203
+ public string Risk { get; init; } = "";
204
204
  public bool Confirm { get; init; }
205
205
  public List<Dictionary<string, object?>> ConfirmWhen { get; init; } = [];
206
206
  public bool? Readonly { get; init; }
@@ -30,3 +30,11 @@ var ok = BailingConnect.VerifyToolCall(secret, method, pathWithQuery, rawBody, t
30
30
  ```
31
31
 
32
32
  Verification proves the call came from the hub. Your business service must still authorize `onBehalfOf` against its own permission table.
33
+
34
+ ## Omitted and explicit declaration values
35
+
36
+ Unspecified `risk`, `readonly`, and `idempotent` fields stay absent from ACC. Explicit low/medium/high risk and both boolean values are preserved, including false on GET. With risk omitted, the ACC OpenAPI binding gives an explicit readonly value precedence over the HTTP method: GET without a readonly declaration defaults to low; other non-readonly operations default to medium. Risk does not replace approval or final business authorization.
37
+
38
+ Regenerate and compare declarations when upgrading; do not turn previously omitted risk into explicit low for all operations. The default `Tool.Risk` is now the empty string rather than `"low"`; it represents omission and retains the existing string property type. `Readonly` and `Idempotent` continue to use null for omission.
39
+
40
+ Run `dotnet run --project sdk/dotnet/tests/Declaration/Declaration.csproj` for 24 readonly/risk combinations and 6 idempotency combinations.
@@ -0,0 +1,11 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+ <PropertyGroup>
3
+ <OutputType>Exe</OutputType>
4
+ <TargetFramework>net8.0</TargetFramework>
5
+ <ImplicitUsings>enable</ImplicitUsings>
6
+ <Nullable>enable</Nullable>
7
+ </PropertyGroup>
8
+ <ItemGroup>
9
+ <ProjectReference Include="../../Bailing.Connect/Bailing.Connect.csproj" />
10
+ </ItemGroup>
11
+ </Project>
@@ -0,0 +1,74 @@
1
+ using System.Text.Json;
2
+ using Bailing.Connect;
3
+
4
+ static JsonElement Capability(Tool tool)
5
+ {
6
+ var spec = BailingConnect.BuildOpenApiSpec("Fixture", "1", [tool]);
7
+ using var json = JsonDocument.Parse(BailingConnect.ToJson(spec));
8
+ return json.RootElement.GetProperty("paths").GetProperty("/fixture")
9
+ .GetProperty(tool.Method.ToLowerInvariant()).GetProperty("x-agent-capability").Clone();
10
+ }
11
+
12
+ static void Check(bool condition, string message)
13
+ {
14
+ if (!condition) throw new InvalidOperationException(message);
15
+ }
16
+
17
+ static Tool Fixture(string method, bool? readonlyValue = null, string risk = "", bool? idempotent = null)
18
+ {
19
+ // Exercise the real property default when risk is omitted.
20
+ if (risk == "") return new Tool
21
+ {
22
+ Name = "serialization_fixture", Description = "Declaration serialization fixture",
23
+ Scope = "fixture.write", Path = "/fixture", Method = method,
24
+ Readonly = readonlyValue, Idempotent = idempotent,
25
+ Params = [new Param { Name = "fixture" }]
26
+ };
27
+ return new Tool
28
+ {
29
+ Name = "serialization_fixture", Description = "Declaration serialization fixture",
30
+ Scope = "fixture.write", Path = "/fixture", Method = method,
31
+ Readonly = readonlyValue, Risk = risk, Idempotent = idempotent,
32
+ Params = [new Param { Name = "fixture" }]
33
+ };
34
+ }
35
+
36
+ int matrix = 0, idempotency = 0;
37
+ foreach (var method in new[] { "GET", "POST" })
38
+ {
39
+ foreach (bool? readonlyValue in new bool?[] { null, false, true })
40
+ {
41
+ foreach (var risk in new[] { "", "low", "medium", "high" })
42
+ {
43
+ var cap = Capability(Fixture(method, readonlyValue, risk));
44
+ var hasExecution = cap.TryGetProperty("execution", out var execution);
45
+ JsonElement readonlyJson = default;
46
+ var hasReadonly = hasExecution && execution.TryGetProperty("readonly", out readonlyJson);
47
+ var label = $"{method} readonly={readonlyValue} risk={risk}";
48
+ Check(hasReadonly == readonlyValue.HasValue, label + " readonly presence");
49
+ if (readonlyValue.HasValue) Check(readonlyJson.GetBoolean() == readonlyValue.Value, label + " readonly value");
50
+ var hasRisk = cap.TryGetProperty("risk", out var riskJson);
51
+ Check(hasRisk == (risk != ""), label + " risk presence");
52
+ if (hasRisk) Check(riskJson.GetProperty("level").GetString() == risk, label + " risk value");
53
+ var expectedReadonly = readonlyValue ?? (method == "GET");
54
+ var expectedRisk = risk != "" ? risk : (expectedReadonly ? "low" : "medium");
55
+ var effectiveReadonly = hasReadonly ? readonlyJson.GetBoolean() : method == "GET";
56
+ var effectiveRisk = hasRisk ? riskJson.GetProperty("level").GetString() : (effectiveReadonly ? "low" : "medium");
57
+ Check(effectiveRisk == expectedRisk, label + " effective risk");
58
+ Check(cap.GetProperty("version").GetInt32() == 1, label + " declaration version");
59
+ matrix++;
60
+ }
61
+ }
62
+ foreach (bool? value in new bool?[] { null, false, true })
63
+ {
64
+ var cap = Capability(Fixture(method, idempotent: value));
65
+ var hasExecution = cap.TryGetProperty("execution", out var execution);
66
+ JsonElement idempotentJson = default;
67
+ var present = hasExecution && execution.TryGetProperty("idempotent", out idempotentJson);
68
+ Check(present == value.HasValue, method + " idempotent presence");
69
+ if (value.HasValue) Check(idempotentJson.GetBoolean() == value.Value, method + " idempotent value");
70
+ idempotency++;
71
+ }
72
+ }
73
+ Check(matrix == 24 && idempotency == 6, "matrix completeness");
74
+ Console.WriteLine("PASS: 24 readonly/risk combinations + 6 idempotent combinations");
package/sdk/go/README.md CHANGED
@@ -31,3 +31,11 @@ ok := bailingconnect.VerifyToolCall(secret, method, pathWithQuery, rawBody, time
31
31
  ```
32
32
 
33
33
  Verification proves the call came from the hub. Your business service must still authorize `onBehalfOf` against its own permission table.
34
+
35
+ ## Omitted and explicit declaration values
36
+
37
+ Unspecified `risk`, `readonly`, and `idempotent` fields stay absent from ACC. Explicit low/medium/high risk and both boolean values are preserved, including false on GET. With risk omitted, the ACC OpenAPI binding gives an explicit readonly value precedence over the HTTP method: GET without a readonly declaration defaults to low; other non-readonly operations default to medium. Risk does not replace approval or final business authorization.
38
+
39
+ Regenerate and compare declarations when upgrading; do not turn previously omitted risk into explicit low for all operations. `Tool.Risk == ""` remains the omission marker; `Readonly` and `Idempotent` use nil for omission and pointers for explicit values.
40
+
41
+ Run `go test ./...` from `sdk/go` for the 24 readonly/risk cases and 6 idempotency cases.
@@ -129,7 +129,7 @@ func normalizeRateLimit(value string) map[string]any {
129
129
 
130
130
  func buildCapability(t Tool, method string) map[string]any {
131
131
  capability := map[string]any{"version": 1, "enabled": true, "scope": t.Scope}
132
- if t.Risk != "" && t.Risk != "low" {
132
+ if t.Risk != "" {
133
133
  capability["risk"] = map[string]any{"level": t.Risk}
134
134
  }
135
135
  if t.Confirm || len(t.ConfirmWhen) > 0 || t.ConfirmPrompt != "" {
@@ -149,11 +149,11 @@ func buildCapability(t Tool, method string) map[string]any {
149
149
  capability["subject"] = map[string]any{"required": true}
150
150
  }
151
151
  execution := map[string]any{}
152
- if t.Readonly != nil && *t.Readonly && method != "GET" {
153
- execution["readonly"] = true
152
+ if t.Readonly != nil {
153
+ execution["readonly"] = *t.Readonly
154
154
  }
155
- if t.Idempotent != nil && *t.Idempotent && method != "GET" {
156
- execution["idempotent"] = true
155
+ if t.Idempotent != nil {
156
+ execution["idempotent"] = *t.Idempotent
157
157
  }
158
158
  if rl := normalizeRateLimit(t.RateLimit); rl != nil {
159
159
  execution["rate_limit"] = rl