@wowok/agent-mcp 2.4.3 → 2.5.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 (317) hide show
  1. package/dist/config/runtime.d.ts +4 -0
  2. package/dist/config/runtime.js +29 -5
  3. package/dist/harness/auto-escalation.d.ts +27 -0
  4. package/dist/harness/auto-escalation.js +68 -0
  5. package/dist/index.js +21 -0
  6. package/dist/knowledge/allocation-confirm.d.ts +115 -0
  7. package/dist/knowledge/allocation-confirm.js +534 -0
  8. package/dist/knowledge/allocation-context.d.ts +58 -0
  9. package/dist/knowledge/allocation-context.js +249 -0
  10. package/dist/knowledge/allocation-ledger.d.ts +67 -0
  11. package/dist/knowledge/allocation-ledger.js +463 -0
  12. package/dist/knowledge/allocation-puzzle.d.ts +135 -0
  13. package/dist/knowledge/allocation-puzzle.js +298 -0
  14. package/dist/knowledge/allocation-risk.d.ts +78 -0
  15. package/dist/knowledge/allocation-risk.js +568 -0
  16. package/dist/knowledge/allocation-templates.d.ts +38 -0
  17. package/dist/knowledge/allocation-templates.js +970 -0
  18. package/dist/knowledge/allocation-translation.d.ts +72 -0
  19. package/dist/knowledge/allocation-translation.js +585 -0
  20. package/dist/knowledge/arb-risk.d.ts +37 -0
  21. package/dist/knowledge/arb-risk.js +210 -0
  22. package/dist/knowledge/arbitration-confirm.d.ts +135 -0
  23. package/dist/knowledge/arbitration-confirm.js +559 -0
  24. package/dist/knowledge/arbitration-context.d.ts +81 -0
  25. package/dist/knowledge/arbitration-context.js +505 -0
  26. package/dist/knowledge/arbitration-ledger.d.ts +62 -0
  27. package/dist/knowledge/arbitration-ledger.js +521 -0
  28. package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
  29. package/dist/knowledge/arbitration-puzzle.js +304 -0
  30. package/dist/knowledge/arbitration-risk.d.ts +112 -0
  31. package/dist/knowledge/arbitration-risk.js +433 -0
  32. package/dist/knowledge/arbitration-templates.d.ts +38 -0
  33. package/dist/knowledge/arbitration-templates.js +276 -0
  34. package/dist/knowledge/arbitration-translation.d.ts +91 -0
  35. package/dist/knowledge/arbitration-translation.js +487 -0
  36. package/dist/knowledge/bridge-risk.d.ts +36 -0
  37. package/dist/knowledge/bridge-risk.js +263 -0
  38. package/dist/knowledge/contact-risk.d.ts +32 -0
  39. package/dist/knowledge/contact-risk.js +200 -0
  40. package/dist/knowledge/demand-confirm.d.ts +32 -0
  41. package/dist/knowledge/demand-confirm.js +206 -0
  42. package/dist/knowledge/demand-risk.d.ts +30 -0
  43. package/dist/knowledge/demand-risk.js +240 -0
  44. package/dist/knowledge/demand-translation.d.ts +55 -0
  45. package/dist/knowledge/demand-translation.js +354 -0
  46. package/dist/knowledge/deployment-scanner.d.ts +63 -0
  47. package/dist/knowledge/deployment-scanner.js +762 -0
  48. package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
  49. package/dist/knowledge/examples-scanner-cli.js +26 -0
  50. package/dist/knowledge/examples-scanner.d.ts +121 -0
  51. package/dist/knowledge/examples-scanner.js +825 -0
  52. package/dist/knowledge/flywheel-loop.d.ts +3 -0
  53. package/dist/knowledge/flywheel-loop.js +32 -3
  54. package/dist/knowledge/glossary.js +3 -1
  55. package/dist/knowledge/guard-confirm.d.ts +86 -0
  56. package/dist/knowledge/guard-confirm.js +406 -0
  57. package/dist/knowledge/guard-context.d.ts +56 -0
  58. package/dist/knowledge/guard-context.js +287 -0
  59. package/dist/knowledge/guard-design-patterns.d.ts +37 -0
  60. package/dist/knowledge/guard-design-patterns.js +257 -0
  61. package/dist/knowledge/guard-puzzle.js +3 -2
  62. package/dist/knowledge/guard-risk.d.ts +1 -1
  63. package/dist/knowledge/guard-risk.js +12 -14
  64. package/dist/knowledge/guard-templates.js +1 -1
  65. package/dist/knowledge/guard-translation.js +6 -5
  66. package/dist/knowledge/index.d.ts +342 -0
  67. package/dist/knowledge/index.js +344 -0
  68. package/dist/knowledge/machine-confirm.d.ts +102 -0
  69. package/dist/knowledge/machine-confirm.js +559 -0
  70. package/dist/knowledge/machine-context.d.ts +160 -0
  71. package/dist/knowledge/machine-context.js +812 -0
  72. package/dist/knowledge/machine-ledger.d.ts +41 -0
  73. package/dist/knowledge/machine-ledger.js +315 -0
  74. package/dist/knowledge/machine-puzzle.d.ts +206 -0
  75. package/dist/knowledge/machine-puzzle.js +494 -0
  76. package/dist/knowledge/machine-risk.d.ts +75 -0
  77. package/dist/knowledge/machine-risk.js +644 -0
  78. package/dist/knowledge/machine-templates.d.ts +92 -0
  79. package/dist/knowledge/machine-templates.js +1592 -0
  80. package/dist/knowledge/machine-topology.d.ts +57 -0
  81. package/dist/knowledge/machine-topology.js +234 -0
  82. package/dist/knowledge/machine-translation.d.ts +96 -0
  83. package/dist/knowledge/machine-translation.js +513 -0
  84. package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
  85. package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
  86. package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
  87. package/dist/knowledge/mcp-schema-audit.js +772 -0
  88. package/dist/knowledge/onchain-constants.d.ts +4 -0
  89. package/dist/knowledge/onchain-constants.js +35 -0
  90. package/dist/knowledge/order-confirm.d.ts +115 -0
  91. package/dist/knowledge/order-confirm.js +573 -0
  92. package/dist/knowledge/order-context.d.ts +66 -0
  93. package/dist/knowledge/order-context.js +390 -0
  94. package/dist/knowledge/order-ledger.d.ts +69 -0
  95. package/dist/knowledge/order-ledger.js +341 -0
  96. package/dist/knowledge/order-puzzle.d.ts +159 -0
  97. package/dist/knowledge/order-puzzle.js +255 -0
  98. package/dist/knowledge/order-risk.d.ts +66 -0
  99. package/dist/knowledge/order-risk.js +653 -0
  100. package/dist/knowledge/order-templates.d.ts +50 -0
  101. package/dist/knowledge/order-templates.js +368 -0
  102. package/dist/knowledge/order-translation.d.ts +78 -0
  103. package/dist/knowledge/order-translation.js +550 -0
  104. package/dist/knowledge/passport-confirm.d.ts +130 -0
  105. package/dist/knowledge/passport-confirm.js +531 -0
  106. package/dist/knowledge/passport-context.d.ts +59 -0
  107. package/dist/knowledge/passport-context.js +306 -0
  108. package/dist/knowledge/passport-ledger.d.ts +48 -0
  109. package/dist/knowledge/passport-ledger.js +282 -0
  110. package/dist/knowledge/passport-puzzle.d.ts +108 -0
  111. package/dist/knowledge/passport-puzzle.js +333 -0
  112. package/dist/knowledge/passport-risk.d.ts +70 -0
  113. package/dist/knowledge/passport-risk.js +450 -0
  114. package/dist/knowledge/passport-templates.d.ts +40 -0
  115. package/dist/knowledge/passport-templates.js +568 -0
  116. package/dist/knowledge/passport-translation.d.ts +68 -0
  117. package/dist/knowledge/passport-translation.js +516 -0
  118. package/dist/knowledge/payment-risk.d.ts +33 -0
  119. package/dist/knowledge/payment-risk.js +182 -0
  120. package/dist/knowledge/permission-confirm.d.ts +110 -0
  121. package/dist/knowledge/permission-confirm.js +426 -0
  122. package/dist/knowledge/permission-context.d.ts +58 -0
  123. package/dist/knowledge/permission-context.js +224 -0
  124. package/dist/knowledge/permission-ledger.d.ts +38 -0
  125. package/dist/knowledge/permission-ledger.js +403 -0
  126. package/dist/knowledge/permission-puzzle.d.ts +122 -0
  127. package/dist/knowledge/permission-puzzle.js +173 -0
  128. package/dist/knowledge/permission-risk.d.ts +76 -0
  129. package/dist/knowledge/permission-risk.js +411 -0
  130. package/dist/knowledge/permission-templates.d.ts +38 -0
  131. package/dist/knowledge/permission-templates.js +234 -0
  132. package/dist/knowledge/permission-translation.d.ts +57 -0
  133. package/dist/knowledge/permission-translation.js +350 -0
  134. package/dist/knowledge/personal-risk.d.ts +36 -0
  135. package/dist/knowledge/personal-risk.js +212 -0
  136. package/dist/knowledge/progress-confirm.d.ts +108 -0
  137. package/dist/knowledge/progress-confirm.js +456 -0
  138. package/dist/knowledge/progress-context.d.ts +123 -0
  139. package/dist/knowledge/progress-context.js +452 -0
  140. package/dist/knowledge/progress-ledger.d.ts +63 -0
  141. package/dist/knowledge/progress-ledger.js +327 -0
  142. package/dist/knowledge/progress-puzzle.d.ts +82 -0
  143. package/dist/knowledge/progress-puzzle.js +219 -0
  144. package/dist/knowledge/progress-risk.d.ts +74 -0
  145. package/dist/knowledge/progress-risk.js +461 -0
  146. package/dist/knowledge/progress-templates.d.ts +38 -0
  147. package/dist/knowledge/progress-templates.js +228 -0
  148. package/dist/knowledge/progress-translation.d.ts +52 -0
  149. package/dist/knowledge/progress-translation.js +401 -0
  150. package/dist/knowledge/proof-confirm.d.ts +31 -0
  151. package/dist/knowledge/proof-confirm.js +187 -0
  152. package/dist/knowledge/proof-risk.d.ts +33 -0
  153. package/dist/knowledge/proof-risk.js +207 -0
  154. package/dist/knowledge/proof-translation.d.ts +52 -0
  155. package/dist/knowledge/proof-translation.js +283 -0
  156. package/dist/knowledge/registrar-risk.d.ts +34 -0
  157. package/dist/knowledge/registrar-risk.js +217 -0
  158. package/dist/knowledge/repository-confirm.d.ts +36 -0
  159. package/dist/knowledge/repository-confirm.js +242 -0
  160. package/dist/knowledge/repository-risk.d.ts +40 -0
  161. package/dist/knowledge/repository-risk.js +312 -0
  162. package/dist/knowledge/repository-translation.d.ts +58 -0
  163. package/dist/knowledge/repository-translation.js +422 -0
  164. package/dist/knowledge/resource-risk.d.ts +32 -0
  165. package/dist/knowledge/resource-risk.js +157 -0
  166. package/dist/knowledge/reward-confirm.d.ts +113 -0
  167. package/dist/knowledge/reward-confirm.js +496 -0
  168. package/dist/knowledge/reward-context.d.ts +127 -0
  169. package/dist/knowledge/reward-context.js +504 -0
  170. package/dist/knowledge/reward-ledger.d.ts +96 -0
  171. package/dist/knowledge/reward-ledger.js +502 -0
  172. package/dist/knowledge/reward-puzzle.d.ts +97 -0
  173. package/dist/knowledge/reward-puzzle.js +288 -0
  174. package/dist/knowledge/reward-risk.d.ts +84 -0
  175. package/dist/knowledge/reward-risk.js +545 -0
  176. package/dist/knowledge/reward-translation.d.ts +58 -0
  177. package/dist/knowledge/reward-translation.js +501 -0
  178. package/dist/knowledge/safety-rules.js +11 -3
  179. package/dist/knowledge/scenario-modes.d.ts +53 -0
  180. package/dist/knowledge/scenario-modes.js +302 -0
  181. package/dist/knowledge/service-confirm.d.ts +152 -0
  182. package/dist/knowledge/service-confirm.js +699 -0
  183. package/dist/knowledge/service-context.d.ts +66 -0
  184. package/dist/knowledge/service-context.js +403 -0
  185. package/dist/knowledge/service-ledger.d.ts +71 -0
  186. package/dist/knowledge/service-ledger.js +609 -0
  187. package/dist/knowledge/service-puzzle.d.ts +158 -0
  188. package/dist/knowledge/service-puzzle.js +236 -0
  189. package/dist/knowledge/service-risk.d.ts +108 -0
  190. package/dist/knowledge/service-risk.js +615 -0
  191. package/dist/knowledge/service-templates.d.ts +39 -0
  192. package/dist/knowledge/service-templates.js +418 -0
  193. package/dist/knowledge/service-translation.d.ts +103 -0
  194. package/dist/knowledge/service-translation.js +622 -0
  195. package/dist/knowledge/tools-reference.d.ts +17 -0
  196. package/dist/knowledge/tools-reference.js +151 -0
  197. package/dist/knowledge/treasury-confirm.d.ts +133 -0
  198. package/dist/knowledge/treasury-confirm.js +512 -0
  199. package/dist/knowledge/treasury-context.d.ts +64 -0
  200. package/dist/knowledge/treasury-context.js +363 -0
  201. package/dist/knowledge/treasury-ledger.d.ts +42 -0
  202. package/dist/knowledge/treasury-ledger.js +300 -0
  203. package/dist/knowledge/treasury-puzzle.d.ts +163 -0
  204. package/dist/knowledge/treasury-puzzle.js +216 -0
  205. package/dist/knowledge/treasury-risk.d.ts +86 -0
  206. package/dist/knowledge/treasury-risk.js +440 -0
  207. package/dist/knowledge/treasury-templates.d.ts +38 -0
  208. package/dist/knowledge/treasury-templates.js +316 -0
  209. package/dist/knowledge/treasury-translation.d.ts +78 -0
  210. package/dist/knowledge/treasury-translation.js +498 -0
  211. package/dist/knowledge/util-risk.d.ts +30 -0
  212. package/dist/knowledge/util-risk.js +135 -0
  213. package/dist/project/business-puzzle.d.ts +47 -0
  214. package/dist/project/business-puzzle.js +372 -0
  215. package/dist/project/deployment-doc.d.ts +61 -0
  216. package/dist/project/deployment-doc.js +432 -0
  217. package/dist/project/risk-aggregator.d.ts +50 -0
  218. package/dist/project/risk-aggregator.js +280 -0
  219. package/dist/project/substep-trace.d.ts +130 -0
  220. package/dist/project/substep-trace.js +332 -0
  221. package/dist/schema/call/allocation.d.ts +34 -34
  222. package/dist/schema/call/arbitration.d.ts +141 -141
  223. package/dist/schema/call/base.d.ts +386 -386
  224. package/dist/schema/call/base.js +3 -3
  225. package/dist/schema/call/bridge-handler.d.ts +5 -2
  226. package/dist/schema/call/bridge.d.ts +159 -159
  227. package/dist/schema/call/contact.d.ts +110 -110
  228. package/dist/schema/call/demand.d.ts +76 -76
  229. package/dist/schema/call/handler.d.ts +2 -3
  230. package/dist/schema/call/handler.js +1 -1
  231. package/dist/schema/call/machine.d.ts +58 -58
  232. package/dist/schema/call/order.d.ts +98 -110
  233. package/dist/schema/call/permission-handler.d.ts +5 -0
  234. package/dist/schema/call/permission-handler.js +54 -0
  235. package/dist/schema/call/permission.d.ts +108 -108
  236. package/dist/schema/call/personal.d.ts +14 -14
  237. package/dist/schema/call/progress.d.ts +57 -72
  238. package/dist/schema/call/progress.js +7 -4
  239. package/dist/schema/call/proof.d.ts +18 -18
  240. package/dist/schema/call/proof.js +12 -7
  241. package/dist/schema/call/repository.d.ts +154 -154
  242. package/dist/schema/call/reward.d.ts +55 -55
  243. package/dist/schema/call/service.d.ts +231 -231
  244. package/dist/schema/call/treasury.d.ts +93 -93
  245. package/dist/schema/config/index.d.ts +178 -5
  246. package/dist/schema/config/index.js +52 -1
  247. package/dist/schema/local/index.d.ts +3554 -836
  248. package/dist/schema/local/index.js +2 -1
  249. package/dist/schema/messenger/index.d.ts +162 -162
  250. package/dist/schema/operations.d.ts +1058 -1074
  251. package/dist/schema/operations.js +7 -1
  252. package/dist/schema/project/index.d.ts +1392 -6
  253. package/dist/schema/project/index.js +426 -2
  254. package/dist/schema/query/index.d.ts +672 -672
  255. package/dist/schema/schema-query/index.d.ts +23 -3
  256. package/dist/schema/schema-query/index.js +13 -2
  257. package/dist/schema/sync-layer4.d.ts +21 -0
  258. package/dist/schema/sync-layer4.js +261 -0
  259. package/dist/schema/trust/index.d.ts +26 -26
  260. package/dist/schemas/account_operation.output.json +718 -0
  261. package/dist/schemas/config_operation.output.json +173 -0
  262. package/dist/schemas/index.json +9 -1
  263. package/dist/schemas/local_info_operation.output.json +718 -0
  264. package/dist/schemas/local_mark_operation.output.json +718 -0
  265. package/dist/schemas/onchain_operations.output.json +3 -2
  266. package/dist/schemas/onchain_operations.schema.json +1802 -313
  267. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  268. package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
  269. package/dist/schemas/onchain_operations_contact.schema.json +2 -1
  270. package/dist/schemas/onchain_operations_demand.schema.json +2 -1
  271. package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
  272. package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
  273. package/dist/schemas/onchain_operations_guard.schema.json +584 -70
  274. package/dist/schemas/onchain_operations_machine.schema.json +2 -1
  275. package/dist/schemas/onchain_operations_order.schema.json +13 -9
  276. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  277. package/dist/schemas/onchain_operations_permission.schema.json +2 -1
  278. package/dist/schemas/onchain_operations_personal.schema.json +2 -1
  279. package/dist/schemas/onchain_operations_progress.schema.json +14 -10
  280. package/dist/schemas/onchain_operations_proof.schema.json +699 -0
  281. package/dist/schemas/onchain_operations_repository.schema.json +2 -1
  282. package/dist/schemas/onchain_operations_reward.schema.json +2 -1
  283. package/dist/schemas/onchain_operations_service.schema.json +2 -1
  284. package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
  285. package/dist/schemas/onchain_table_data.schema.json +32 -1
  286. package/dist/schemas/project_operation.output.json +879 -0
  287. package/dist/schemas/project_operation.schema.json +473 -2
  288. package/dist/schemas/query_toolkit.output.json +14906 -6
  289. package/dist/schemas/schema_query.output.json +38 -1
  290. package/dist/telemetry/index.d.ts +1 -1
  291. package/dist/tools/handlers/config.d.ts +1 -1
  292. package/dist/tools/handlers/config.js +21 -18
  293. package/dist/tools/handlers/file-export.d.ts +2 -2
  294. package/dist/tools/handlers/local.d.ts +3 -30
  295. package/dist/tools/handlers/local.js +14 -3
  296. package/dist/tools/handlers/messenger.d.ts +1 -1
  297. package/dist/tools/handlers/messenger.js +2 -1
  298. package/dist/tools/handlers/onchain.d.ts +1 -1
  299. package/dist/tools/handlers/onchain.js +24 -22
  300. package/dist/tools/handlers/project.d.ts +1 -1
  301. package/dist/tools/handlers/project.js +258 -18
  302. package/dist/tools/handlers/query.d.ts +4 -4
  303. package/dist/tools/handlers/schema-query.d.ts +1 -1
  304. package/dist/tools/handlers/schema-query.js +21 -20
  305. package/dist/tools/handlers/trust.d.ts +1 -1
  306. package/dist/tools/handlers/trust.js +2 -2
  307. package/dist/tools/handlers/wip.d.ts +1 -1
  308. package/dist/tools/handlers/wip.js +1 -1
  309. package/dist/tools/index.d.ts +1 -1
  310. package/dist/tools/index.js +55 -8
  311. package/dist/tools/rules-hook.d.ts +1 -1
  312. package/dist/tools/rules-hook.js +3 -2
  313. package/dist/tools/shared.d.ts +13 -22
  314. package/dist/tools/types.d.ts +5 -5
  315. package/dist/tools/wrap.d.ts +10 -2
  316. package/dist/tools/wrap.js +212 -0
  317. package/package.json +3 -3
@@ -0,0 +1,512 @@
1
+ import { assessTreasuryRisks, } from "./treasury-risk.js";
2
+ import { MAX_EXTERNAL_DEPOSIT_GUARD_COUNT, MAX_EXTERNAL_WITHDRAW_GUARD_COUNT, MAX_DESCRIPTION_LENGTH, } from "./treasury-puzzle.js";
3
+ export const TREASURY_PUBLISH_CHECKLIST = [
4
+ { id: "C-T-01", description: "type_parameter (Coin type T) specified and valid", passed: false, message: "" },
5
+ { id: "C-T-02", description: "Permission object configured (new or existing)", passed: false, message: "" },
6
+ { id: "C-T-03", description: "description length <= MAX_DESCRIPTION_LENGTH (4000)", passed: false, message: "" },
7
+ { id: "C-T-04", description: "external_withdraw_guard.identifier provided (u8, required)", passed: false, message: "" },
8
+ { id: "C-T-05", description: "external_deposit_guard count <= MAX_EXTERNAL_DEPOSIT_GUARD_COUNT (100)", passed: false, message: "" },
9
+ { id: "C-T-06", description: "external_withdraw_guard count <= MAX_EXTERNAL_WITHDRAW_GUARD_COUNT (200)", passed: false, message: "" },
10
+ { id: "C-T-07", description: "withdraw recipient address valid", passed: false, message: "" },
11
+ { id: "C-T-08", description: "UM address is valid Contact object reference (or null for revoke)", passed: false, message: "" },
12
+ { id: "C-T-09", description: "withdraw (fixed) / external_withdraw double-confirmed by user", passed: false, message: "" },
13
+ { id: "C-T-10", description: "Permission indexes align with Move on-chain (no stale 259/260)", passed: false, message: "" },
14
+ ];
15
+ function runStaticChecklist(input) {
16
+ const items = TREASURY_PUBLISH_CHECKLIST.map(c => ({ ...c }));
17
+ const data = input.treasury_json;
18
+ const ct01 = items.find(i => i.id === "C-T-01");
19
+ if (typeof data.object === "object" && data.object !== null) {
20
+ const obj = data.object;
21
+ const valid = !!obj.type_parameter && obj.type_parameter.length > 0;
22
+ ct01.passed = valid;
23
+ ct01.message = valid ? "" : "type_parameter missing in object (required for creation)";
24
+ }
25
+ else if (input.type_parameter) {
26
+ ct01.passed = true;
27
+ }
28
+ else if (typeof data.object === "string") {
29
+ ct01.passed = true;
30
+ }
31
+ else {
32
+ ct01.passed = false;
33
+ ct01.message = "Cannot determine type_parameter";
34
+ }
35
+ const ct02 = items.find(i => i.id === "C-T-02");
36
+ if (typeof data.object === "object" && data.object !== null) {
37
+ const obj = data.object;
38
+ const valid = !!obj.permission;
39
+ ct02.passed = valid;
40
+ ct02.message = valid ? "" : "permission missing in object (required for creation)";
41
+ }
42
+ else if (input.permission_address) {
43
+ ct02.passed = true;
44
+ }
45
+ else {
46
+ ct02.passed = true;
47
+ }
48
+ const ct03 = items.find(i => i.id === "C-T-03");
49
+ if (data.description !== undefined) {
50
+ const valid = data.description.length <= MAX_DESCRIPTION_LENGTH;
51
+ ct03.passed = valid;
52
+ ct03.message = valid ? "" : `Description length ${data.description.length} > ${MAX_DESCRIPTION_LENGTH}`;
53
+ }
54
+ else {
55
+ ct03.passed = true;
56
+ }
57
+ const ct04 = items.find(i => i.id === "C-T-04");
58
+ if (data.external_withdraw_guard && (data.external_withdraw_guard.op === "add" || data.external_withdraw_guard.op === "set")) {
59
+ const missing = data.external_withdraw_guard.guards.filter(g => g.identifier === undefined || g.identifier === null);
60
+ const valid = missing.length === 0;
61
+ ct04.passed = valid;
62
+ ct04.message = valid ? "" : `${missing.length} withdraw guard(s) missing identifier (u8 required)`;
63
+ }
64
+ else {
65
+ ct04.passed = true;
66
+ }
67
+ const ct05 = items.find(i => i.id === "C-T-05");
68
+ if (data.external_deposit_guard && (data.external_deposit_guard.op === "add" || data.external_deposit_guard.op === "set")) {
69
+ const current = input.current_external_deposit_guard_count ?? 0;
70
+ const adding = data.external_deposit_guard.guards.length;
71
+ const valid = (data.external_deposit_guard.op === "set" ? adding : current + adding) <= MAX_EXTERNAL_DEPOSIT_GUARD_COUNT;
72
+ ct05.passed = valid;
73
+ ct05.message = valid ? "" : `deposit_guard count ${data.external_deposit_guard.op === "set" ? adding : current + adding} > ${MAX_EXTERNAL_DEPOSIT_GUARD_COUNT}`;
74
+ }
75
+ else {
76
+ ct05.passed = true;
77
+ }
78
+ const ct06 = items.find(i => i.id === "C-T-06");
79
+ if (data.external_withdraw_guard && (data.external_withdraw_guard.op === "add" || data.external_withdraw_guard.op === "set")) {
80
+ const current = input.current_external_withdraw_guard_count ?? 0;
81
+ const adding = data.external_withdraw_guard.guards.length;
82
+ const valid = (data.external_withdraw_guard.op === "set" ? adding : current + adding) <= MAX_EXTERNAL_WITHDRAW_GUARD_COUNT;
83
+ ct06.passed = valid;
84
+ ct06.message = valid ? "" : `withdraw_guard count ${data.external_withdraw_guard.op === "set" ? adding : current + adding} > ${MAX_EXTERNAL_WITHDRAW_GUARD_COUNT}`;
85
+ }
86
+ else {
87
+ ct06.passed = true;
88
+ }
89
+ const ct07 = items.find(i => i.id === "C-T-07");
90
+ if (data.withdraw?.recipient) {
91
+ const valid = data.withdraw.recipient.startsWith("0x") && data.withdraw.recipient.length >= 40;
92
+ ct07.passed = valid;
93
+ ct07.message = valid ? "" : `Recipient ${data.withdraw.recipient} invalid`;
94
+ }
95
+ else if (data.withdraw) {
96
+ ct07.passed = false;
97
+ ct07.message = "withdraw specified without recipient";
98
+ }
99
+ else {
100
+ ct07.passed = true;
101
+ }
102
+ const ct08 = items.find(i => i.id === "C-T-08");
103
+ if (data.um !== undefined) {
104
+ const valid = data.um === null || (typeof data.um === "string" && data.um.startsWith("0x") && data.um.length >= 40);
105
+ ct08.passed = valid;
106
+ ct08.message = valid ? "" : `UM ${data.um} invalid (must be Contact object address or null)`;
107
+ }
108
+ else {
109
+ ct08.passed = true;
110
+ }
111
+ const ct09 = items.find(i => i.id === "C-T-09");
112
+ if (data.withdraw) {
113
+ ct09.passed = false;
114
+ ct09.message = "Pending user confirmation in Layer 3 (QT3/QT4)";
115
+ }
116
+ else {
117
+ ct09.passed = true;
118
+ }
119
+ const ct10 = items.find(i => i.id === "C-T-10");
120
+ const staleIndexes = (input.current_permission_indexes_granted ?? []).filter(i => i === 259 || i === 260);
121
+ const valid = staleIndexes.length === 0;
122
+ ct10.passed = valid;
123
+ ct10.message = valid ? "" : `Stale indexes 259/260 detected: ${staleIndexes.join(",")} (R-T-01 regression)`;
124
+ return {
125
+ all_passed: items.filter(i => i.id !== "C-T-09").every(i => i.passed),
126
+ items,
127
+ };
128
+ }
129
+ function adaptRiskAssessment(input) {
130
+ const ctx = {
131
+ object: typeof input.treasury_json.object === "string" ? input.treasury_json.object : null,
132
+ description: input.treasury_json.description,
133
+ deposit: input.treasury_json.deposit ? {
134
+ coin_balance: input.treasury_json.deposit.coin?.balance,
135
+ coin_object: input.treasury_json.deposit.coin?.coin_object,
136
+ by_external_deposit_guard: input.treasury_json.deposit.by_external_deposit_guard,
137
+ } : undefined,
138
+ withdraw: input.treasury_json.withdraw ? {
139
+ amount_fixed: input.treasury_json.withdraw.amount?.fixed,
140
+ amount_by_external_withdraw_guard: input.treasury_json.withdraw.amount?.by_external_withdraw_guard,
141
+ recipient: input.treasury_json.withdraw.recipient,
142
+ } : undefined,
143
+ external_deposit_guard: input.treasury_json.external_deposit_guard,
144
+ external_withdraw_guard: input.treasury_json.external_withdraw_guard,
145
+ owner_receive: input.treasury_json.owner_receive,
146
+ um: input.treasury_json.um,
147
+ permission_address: input.permission_address,
148
+ type_parameter: input.type_parameter,
149
+ current_balance: input.current_balance,
150
+ current_external_deposit_guard_count: input.current_external_deposit_guard_count,
151
+ current_external_withdraw_guard_count: input.current_external_withdraw_guard_count,
152
+ shared_with_service: input.shared_with_service,
153
+ shared_with_allocator: input.shared_with_allocator,
154
+ shared_with_arbitration: input.shared_with_arbitration,
155
+ current_permission_indexes_granted: input.current_permission_indexes_granted,
156
+ };
157
+ return assessTreasuryRisks(ctx);
158
+ }
159
+ export const TREASURY_CONFIRMATION_QUESTIONS = [
160
+ {
161
+ id: "QT1",
162
+ question: "Is the Coin type T (type_parameter) correct and matching all expected deposit/withdraw operations?",
163
+ requires_explicit_yes: true,
164
+ },
165
+ {
166
+ id: "QT2",
167
+ question: "Is the associated Permission object correctly configured with intended admin/entity/index assignments?",
168
+ requires_explicit_yes: true,
169
+ },
170
+ {
171
+ id: "QT3",
172
+ question: "⚠️ If withdrawing (fixed amount): do you confirm the recipient address and amount are correct? This operation is IRREVERSIBLE.",
173
+ requires_explicit_yes: true,
174
+ related_risk_ids: ["R-T-4-01"],
175
+ },
176
+ {
177
+ id: "QT4",
178
+ question: "⚠️ If external_withdraw via Guard: do you confirm the Guard rules match business intent and the identifier points to the correct amount field? IRREVERSIBLE.",
179
+ requires_explicit_yes: true,
180
+ related_risk_ids: ["R-T-4-02"],
181
+ },
182
+ {
183
+ id: "QT5",
184
+ question: "If configuring external_deposit/withdraw_guard: are the Guard table fields correctly typed (number for identifier, address-compatible for store_from_id)?",
185
+ requires_explicit_yes: true,
186
+ related_risk_ids: ["R-T-1-04"],
187
+ },
188
+ {
189
+ id: "QT6",
190
+ question: "If sharing Permission with a Service or referenced by Allocator/Arbitration: have you verified the cross-object consistency (R-T-5-01 / R-T-5-02)?",
191
+ requires_explicit_yes: false,
192
+ },
193
+ ];
194
+ function processUserConfirmation(input, assessment) {
195
+ const questions = [...TREASURY_CONFIRMATION_QUESTIONS];
196
+ if (!input.treasury_json.withdraw?.amount?.fixed) {
197
+ const idx = questions.findIndex(q => q.id === "QT3");
198
+ if (idx >= 0)
199
+ questions.splice(idx, 1);
200
+ }
201
+ if (!input.treasury_json.withdraw?.amount?.by_external_withdraw_guard) {
202
+ const idx = questions.findIndex(q => q.id === "QT4");
203
+ if (idx >= 0)
204
+ questions.splice(idx, 1);
205
+ }
206
+ if (!input.treasury_json.external_deposit_guard && !input.treasury_json.external_withdraw_guard) {
207
+ const idx = questions.findIndex(q => q.id === "QT5");
208
+ if (idx >= 0)
209
+ questions.splice(idx, 1);
210
+ }
211
+ if (!input.shared_with_service && !input.shared_with_allocator && !input.shared_with_arbitration) {
212
+ const idx = questions.findIndex(q => q.id === "QT6");
213
+ if (idx >= 0)
214
+ questions.splice(idx, 1);
215
+ }
216
+ if (input.skip_user_confirmation) {
217
+ return {
218
+ questions_asked: questions,
219
+ responses: questions.map(q => ({ question_id: q.id, response: "yes" })),
220
+ all_confirmed: true,
221
+ };
222
+ }
223
+ return {
224
+ questions_asked: questions,
225
+ responses: [],
226
+ all_confirmed: false,
227
+ };
228
+ }
229
+ function verifyEnvironment(input) {
230
+ const checks = [];
231
+ if (typeof input.treasury_json.object === "string") {
232
+ checks.push({
233
+ name: "treasury_object_exists",
234
+ passed: true,
235
+ message: `Treasury object ${input.treasury_json.object} assumed to exist`,
236
+ });
237
+ }
238
+ if (input.permission_address || typeof input.treasury_json.object === "object") {
239
+ checks.push({
240
+ name: "permission_object_exists",
241
+ passed: true,
242
+ message: "Permission object exists and is bound to Treasury",
243
+ });
244
+ }
245
+ const requiredPerms = [];
246
+ if (input.treasury_json.deposit && !input.treasury_json.deposit.by_external_deposit_guard) {
247
+ requiredPerms.push(252);
248
+ }
249
+ if (input.treasury_json.withdraw?.amount?.fixed)
250
+ requiredPerms.push(254);
251
+ if (input.treasury_json.external_deposit_guard)
252
+ requiredPerms.push(255);
253
+ if (input.treasury_json.external_withdraw_guard)
254
+ requiredPerms.push(256);
255
+ if (input.treasury_json.owner_receive)
256
+ requiredPerms.push(257);
257
+ if (input.treasury_json.um !== undefined)
258
+ requiredPerms.push(258);
259
+ if (input.treasury_json.receive)
260
+ requiredPerms.push(253);
261
+ if (requiredPerms.length > 0) {
262
+ const granted = input.current_permission_indexes_granted ?? [];
263
+ const missing = requiredPerms.filter(p => !granted.includes(p));
264
+ checks.push({
265
+ name: "signer_has_required_permissions",
266
+ passed: missing.length === 0,
267
+ message: missing.length === 0
268
+ ? `Signer has all required indexes: ${requiredPerms.join(",")}`
269
+ : `Signer missing required indexes: ${missing.join(",")} (granted: ${granted.join(",")})`,
270
+ });
271
+ }
272
+ if (input.treasury_json.deposit?.by_external_deposit_guard ||
273
+ input.treasury_json.withdraw?.amount?.by_external_withdraw_guard) {
274
+ checks.push({
275
+ name: "passport_provided_for_external_ops",
276
+ passed: true,
277
+ message: "External operations require Passport submission (verified at SDK call time)",
278
+ });
279
+ }
280
+ if (input.treasury_json.withdraw?.amount?.fixed && input.current_balance) {
281
+ const amount = BigInt(input.treasury_json.withdraw.amount.fixed);
282
+ const balance = BigInt(input.current_balance);
283
+ const sufficient = amount <= balance;
284
+ checks.push({
285
+ name: "balance_sufficient_for_withdraw",
286
+ passed: sufficient,
287
+ message: sufficient
288
+ ? `Balance ${input.current_balance} >= withdraw ${input.treasury_json.withdraw.amount.fixed}`
289
+ : `Balance ${input.current_balance} < withdraw ${input.treasury_json.withdraw.amount.fixed} (E_WITHDRAW_INSUFFICIENT_AMOUNT)`,
290
+ });
291
+ }
292
+ const allPassed = checks.every(c => c.passed);
293
+ return { passed: allPassed, checks };
294
+ }
295
+ export const TREASURY_CONFIRM_VERSION = "1.0.0";
296
+ export function runTreasuryConfirmGate(input) {
297
+ const layersPassed = [];
298
+ const layersFailed = [];
299
+ const checklist = runStaticChecklist(input);
300
+ if (!checklist.all_passed) {
301
+ layersFailed.push("L1_checklist");
302
+ return {
303
+ status: "blocked_checklist",
304
+ checklist_result: checklist,
305
+ confirmation_text: generateConfirmationText(input, checklist),
306
+ block_reason: `Checklist failed: ${checklist.items.filter(i => !i.passed).map(i => i.id).join(", ")}`,
307
+ decision_record: {
308
+ timestamp: new Date().toISOString(),
309
+ gate_version: TREASURY_CONFIRM_VERSION,
310
+ final_status: "blocked_checklist",
311
+ layers_passed: layersPassed,
312
+ layers_failed: layersFailed,
313
+ },
314
+ };
315
+ }
316
+ layersPassed.push("L1_checklist");
317
+ const assessment = adaptRiskAssessment(input);
318
+ const hasCritical = assessment.risks.some(r => r.level === "CRITICAL");
319
+ if (hasCritical) {
320
+ layersFailed.push("L2_risk");
321
+ return {
322
+ status: "blocked_risk",
323
+ checklist_result: checklist,
324
+ risk_result: assessment,
325
+ confirmation_text: generateConfirmationText(input, checklist, assessment),
326
+ block_reason: `CRITICAL risks: ${assessment.risks.filter(r => r.level === "CRITICAL").map(r => r.id).join(", ")}`,
327
+ decision_record: {
328
+ timestamp: new Date().toISOString(),
329
+ gate_version: TREASURY_CONFIRM_VERSION,
330
+ final_status: "blocked_risk",
331
+ layers_passed: layersPassed,
332
+ layers_failed: layersFailed,
333
+ },
334
+ };
335
+ }
336
+ layersPassed.push("L2_risk");
337
+ const userConf = processUserConfirmation(input, assessment);
338
+ if (!userConf.all_confirmed) {
339
+ if (input.treasury_json.withdraw) {
340
+ const ct09 = checklist.items.find(i => i.id === "C-T-09");
341
+ if (ct09) {
342
+ const qt3 = userConf.responses.find(r => r.question_id === "QT3");
343
+ const qt4 = userConf.responses.find(r => r.question_id === "QT4");
344
+ const relevantResponses = [qt3, qt4].filter(r => r !== undefined);
345
+ if (relevantResponses.length > 0) {
346
+ ct09.passed = relevantResponses.every(r => r?.response === "yes");
347
+ ct09.message = ct09.passed ? "" : "Withdraw not confirmed by user";
348
+ }
349
+ }
350
+ }
351
+ if (input.treasury_json.withdraw) {
352
+ const ct09 = checklist.items.find(i => i.id === "C-T-09");
353
+ if (ct09 && !ct09.passed) {
354
+ layersFailed.push("L3_user");
355
+ return {
356
+ status: "blocked_user",
357
+ checklist_result: checklist,
358
+ risk_result: assessment,
359
+ user_confirmation: userConf,
360
+ confirmation_text: generateConfirmationText(input, checklist, assessment),
361
+ block_reason: "User did not confirm withdraw operation",
362
+ decision_record: {
363
+ timestamp: new Date().toISOString(),
364
+ gate_version: TREASURY_CONFIRM_VERSION,
365
+ final_status: "blocked_user",
366
+ layers_passed: layersPassed,
367
+ layers_failed: layersFailed,
368
+ },
369
+ };
370
+ }
371
+ }
372
+ }
373
+ layersPassed.push("L3_user");
374
+ if (input.skip_environment_check) {
375
+ layersPassed.push("L4_environment");
376
+ }
377
+ else {
378
+ const env = verifyEnvironment(input);
379
+ if (!env.passed) {
380
+ layersFailed.push("L4_environment");
381
+ return {
382
+ status: "blocked_environment",
383
+ checklist_result: checklist,
384
+ risk_result: assessment,
385
+ user_confirmation: userConf,
386
+ environment_result: env,
387
+ confirmation_text: generateConfirmationText(input, checklist, assessment),
388
+ block_reason: `Environment check failed: ${env.checks.filter(c => !c.passed).map(c => c.name).join(", ")}`,
389
+ decision_record: {
390
+ timestamp: new Date().toISOString(),
391
+ gate_version: TREASURY_CONFIRM_VERSION,
392
+ final_status: "blocked_environment",
393
+ layers_passed: layersPassed,
394
+ layers_failed: layersFailed,
395
+ },
396
+ };
397
+ }
398
+ layersPassed.push("L4_environment");
399
+ }
400
+ return {
401
+ status: "approved",
402
+ checklist_result: checklist,
403
+ risk_result: assessment,
404
+ user_confirmation: userConf,
405
+ confirmation_text: generateConfirmationText(input, checklist, assessment),
406
+ decision_record: {
407
+ timestamp: new Date().toISOString(),
408
+ gate_version: TREASURY_CONFIRM_VERSION,
409
+ final_status: "approved",
410
+ layers_passed: layersPassed,
411
+ layers_failed: layersFailed,
412
+ },
413
+ };
414
+ }
415
+ function generateConfirmationText(input, checklist, assessment) {
416
+ const lines = [];
417
+ const data = input.treasury_json;
418
+ lines.push("═══ Treasury Confirmation ═══");
419
+ lines.push("");
420
+ if (typeof data.object === "string") {
421
+ lines.push(`Treasury: ${data.object}`);
422
+ }
423
+ else if (typeof data.object === "object" && data.object !== null) {
424
+ const obj = data.object;
425
+ lines.push(`Treasury: NEW (name=${obj.name ?? "?"}, T=${obj.type_parameter ?? "?"})`);
426
+ }
427
+ else {
428
+ lines.push("Treasury: (invalid object field)");
429
+ }
430
+ if (data.description)
431
+ lines.push(`Description: ${data.description}`);
432
+ if (input.type_parameter)
433
+ lines.push(`Type parameter: ${input.type_parameter}`);
434
+ lines.push("");
435
+ lines.push("─ Checklist ──────────────────");
436
+ for (const item of checklist.items) {
437
+ const mark = item.passed ? "✓" : "✗";
438
+ lines.push(` ${mark} ${item.id}: ${item.description}${item.message ? " — " + item.message : ""}`);
439
+ }
440
+ lines.push("");
441
+ if (assessment) {
442
+ lines.push("─ Risk Assessment ──────────────────");
443
+ lines.push(`Overall: ${assessment.overall_risk}`);
444
+ lines.push(`Detected: ${assessment.risks.length} risk(s)`);
445
+ for (const r of assessment.risks) {
446
+ lines.push(` [${r.level}] ${r.id}: ${r.title}`);
447
+ }
448
+ lines.push("");
449
+ }
450
+ lines.push("─ Operations ──────────────────");
451
+ if (data.deposit) {
452
+ if (data.deposit.by_external_deposit_guard) {
453
+ lines.push(`- External deposit via guard: ${data.deposit.by_external_deposit_guard}`);
454
+ }
455
+ else {
456
+ lines.push(`- Internal deposit (Permission 252)`);
457
+ }
458
+ }
459
+ if (data.withdraw) {
460
+ if (data.withdraw.amount?.fixed) {
461
+ lines.push(`- ⚠️ Internal withdraw (Permission 254): ${data.withdraw.amount.fixed} to ${data.withdraw.recipient ?? "?"}`);
462
+ }
463
+ else if (data.withdraw.amount?.by_external_withdraw_guard) {
464
+ lines.push(`- ⚠️ External withdraw via guard: ${data.withdraw.amount.by_external_withdraw_guard} to ${data.withdraw.recipient ?? "?"}`);
465
+ }
466
+ }
467
+ if (data.receive)
468
+ lines.push(`- Receive CoinWrapper (Permission 253)`);
469
+ if (data.owner_receive)
470
+ lines.push(`- owner_receive forward (Permission 257)`);
471
+ if (data.external_deposit_guard)
472
+ lines.push(`- Manage external_deposit_guard (Permission 255): op=${data.external_deposit_guard.op}`);
473
+ if (data.external_withdraw_guard)
474
+ lines.push(`- Manage external_withdraw_guard (Permission 256): op=${data.external_withdraw_guard.op}`);
475
+ if (data.um !== undefined)
476
+ lines.push(`- UM: ${data.um ?? "(revoke)"}`);
477
+ lines.push("");
478
+ return lines.join("\n");
479
+ }
480
+ export function progressiveTreasuryCheck(input) {
481
+ const checklist = runStaticChecklist(input);
482
+ if (!checklist.all_passed) {
483
+ return {
484
+ stage: "checklist",
485
+ status: "fail",
486
+ message: `Checklist failed: ${checklist.items.filter(i => !i.passed).map(i => i.id).join(", ")}`,
487
+ next_action: "Fix failing checklist items",
488
+ };
489
+ }
490
+ const assessment = adaptRiskAssessment(input);
491
+ if (assessment.risks.some(r => r.level === "CRITICAL")) {
492
+ return {
493
+ stage: "risk",
494
+ status: "fail",
495
+ message: `CRITICAL risks: ${assessment.risks.filter(r => r.level === "CRITICAL").map(r => r.id).join(", ")}`,
496
+ next_action: "Resolve CRITICAL risks before proceeding (especially withdraw irreversibility)",
497
+ };
498
+ }
499
+ if (assessment.needs_human_review) {
500
+ return {
501
+ stage: "confirmation",
502
+ status: "pending",
503
+ message: "Human review required for HIGH risks (withdraw/external operations)",
504
+ next_action: "Confirm risk acceptance via QT1-QT6 questions",
505
+ };
506
+ }
507
+ return {
508
+ stage: "complete",
509
+ status: "pass",
510
+ message: "All checks passed",
511
+ };
512
+ }
@@ -0,0 +1,64 @@
1
+ import { type TreasuryScene, type BuiltinTreasuryPermissionEntry } from "./treasury-ledger.js";
2
+ import { type TreasuryTemplate } from "./treasury-templates.js";
3
+ import { type SemanticToSchemaRule } from "./treasury-translation.js";
4
+ import { type TreasuryRiskRule, type TreasuryRiskAssessment, type TreasuryStakeholder } from "./treasury-risk.js";
5
+ import { type TreasuryPuzzle, type TreasuryPuzzleCompleteness } from "./treasury-puzzle.js";
6
+ import { TREASURY_PUBLISH_CHECKLIST, TREASURY_CONFIRMATION_QUESTIONS, type TreasuryJsonForConfirm } from "./treasury-confirm.js";
7
+ export declare const TREASURY_CONTEXT_VERSION = "1.0.0";
8
+ export type TreasuryInjectionMode = "initial_design" | "mid_design_review" | "pre_publish" | "post_publish_modify" | "stakeholder_review" | "cross_object_check";
9
+ export type TreasuryStakeholderPerspective = TreasuryStakeholder | "system";
10
+ export interface TreasuryContextBundle {
11
+ version: string;
12
+ mode: TreasuryInjectionMode;
13
+ stakeholder_perspective?: TreasuryStakeholderPerspective;
14
+ matched_scene?: TreasuryScene;
15
+ matched_template?: TreasuryTemplate;
16
+ matched_pattern?: SemanticToSchemaRule;
17
+ puzzle_state?: TreasuryPuzzle;
18
+ puzzle_completeness?: TreasuryPuzzleCompleteness;
19
+ relevant_risks: TreasuryRiskRule[];
20
+ risk_assessment?: TreasuryRiskAssessment;
21
+ relevant_checklist: typeof TREASURY_PUBLISH_CHECKLIST;
22
+ relevant_questions: typeof TREASURY_CONFIRMATION_QUESTIONS;
23
+ relevant_builtin_permissions: BuiltinTreasuryPermissionEntry[];
24
+ reserved_builtin_permissions: BuiltinTreasuryPermissionEntry[];
25
+ cross_object_refs: TreasuryCrossObjectRef[];
26
+ onchain_constraints: TreasuryOnchainConstraint[];
27
+ rendering_hints: TreasuryRenderingHints;
28
+ }
29
+ export interface TreasuryCrossObjectRef {
30
+ object: "Permission" | "Guard" | "Passport" | "Payment" | "CoinWrapper" | "Contact" | "Allocator" | "Arbitration" | "Service" | "Registrar" | "Clock";
31
+ field: string;
32
+ description: string;
33
+ collaboration_type: "dependency" | "referenced_by" | "parallel_design";
34
+ }
35
+ export interface TreasuryOnchainConstraint {
36
+ name: string;
37
+ value: string | number;
38
+ description: string;
39
+ }
40
+ export interface TreasuryRenderingHints {
41
+ include_puzzle_template: boolean;
42
+ include_risk_details: boolean;
43
+ include_questions: boolean;
44
+ include_irreversibility_warning: boolean;
45
+ include_external_guard_warning: boolean;
46
+ include_cross_object_warning: boolean;
47
+ max_length: number;
48
+ }
49
+ export interface BuildTreasuryContextInput {
50
+ mode: TreasuryInjectionMode;
51
+ intent?: string;
52
+ treasury_json?: TreasuryJsonForConfirm;
53
+ stakeholder?: TreasuryStakeholderPerspective;
54
+ target_permission_index?: number;
55
+ type_parameter?: string;
56
+ max_length?: number;
57
+ shared_with_service?: boolean;
58
+ shared_with_allocator?: boolean;
59
+ shared_with_arbitration?: boolean;
60
+ current_permission_indexes_granted?: number[];
61
+ }
62
+ export declare function buildTreasuryContext(input: BuildTreasuryContextInput): TreasuryContextBundle;
63
+ export declare function buildPromptFromTreasuryContext(bundle: TreasuryContextBundle): string;
64
+ export declare function getTreasuryContextSummary(bundle: TreasuryContextBundle): string;