@wowok/agent-mcp 2.6.3 → 2.6.6

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 (193) hide show
  1. package/README.md +13 -9
  2. package/dist/customer/customer-advice.d.ts +31 -0
  3. package/dist/customer/customer-advice.js +129 -0
  4. package/dist/customer/index.d.ts +2 -0
  5. package/dist/customer/index.js +2 -0
  6. package/dist/customer/info-puzzle.d.ts +8 -1
  7. package/dist/customer/info-puzzle.js +30 -5
  8. package/dist/customer/order-monitor.d.ts +2 -0
  9. package/dist/customer/order-monitor.js +3 -2
  10. package/dist/customer/post-purchase.d.ts +2 -0
  11. package/dist/customer/post-purchase.js +6 -5
  12. package/dist/customer/preorder-compare.d.ts +24 -0
  13. package/dist/customer/preorder-compare.js +34 -0
  14. package/dist/customer/reminder-system.d.ts +2 -0
  15. package/dist/customer/reminder-system.js +2 -1
  16. package/dist/customer/risk-assessment.js +4 -3
  17. package/dist/customer/types.d.ts +5 -0
  18. package/dist/examples/arbitration-dispute-create.json +41 -0
  19. package/dist/examples/arbitration-vote-weighted.json +35 -0
  20. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  21. package/dist/examples/demand-present-service.json +33 -0
  22. package/dist/examples/gen-passport-verify-guard.json +48 -0
  23. package/dist/examples/guard-template-balance-check.json +36 -15
  24. package/dist/examples/guard-template-time-lock.json +33 -12
  25. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  26. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  27. package/dist/examples/insurance-machine-create-publish.json +75 -0
  28. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  29. package/dist/examples/machine-multisig-threshold.json +86 -0
  30. package/dist/examples/machine-template-7node-rental.json +99 -94
  31. package/dist/examples/payment-scenario-bound.json +45 -0
  32. package/dist/examples/rental-ziroom-machine-create.json +126 -114
  33. package/dist/examples/rental-ziroom-permission-create.json +10 -3
  34. package/dist/examples/rental-ziroom-service-create.json +27 -18
  35. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  36. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  37. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  38. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  39. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  40. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  41. package/dist/examples/retail-myshop-contact-create.json +43 -0
  42. package/dist/examples/retail-myshop-order-create.json +56 -0
  43. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  44. package/dist/examples/retail-myshop-reward-create.json +35 -0
  45. package/dist/examples/service-discount-issue.json +46 -0
  46. package/dist/examples/threebody-guard-create.json +56 -0
  47. package/dist/examples/threebody-machine-create.json +72 -0
  48. package/dist/examples/threebody-permission-create.json +38 -0
  49. package/dist/examples/threebody-service-allocators.json +49 -0
  50. package/dist/examples/travel-guard-time-lock.json +69 -0
  51. package/dist/examples/travel-guard-weather-oracle.json +70 -0
  52. package/dist/examples/travel-machine-create.json +136 -0
  53. package/dist/examples/travel-repository-create.json +47 -0
  54. package/dist/examples/travel-service-create.json +102 -0
  55. package/dist/examples/travel-treasury-create.json +34 -0
  56. package/dist/examples/treasury-deposit.json +37 -0
  57. package/dist/examples/treasury-withdraw.json +38 -0
  58. package/dist/extensions/business-modules.d.ts +49 -0
  59. package/dist/extensions/business-modules.js +287 -0
  60. package/dist/extensions/capability-manifest.js +192 -5
  61. package/dist/extensions/constraint-registry.js +3 -1
  62. package/dist/extensions/modes.js +10 -4
  63. package/dist/extensions/registry.d.ts +14 -9
  64. package/dist/extensions/registry.js +69 -14
  65. package/dist/extensions/types.d.ts +1 -0
  66. package/dist/knowledge/fund-layer.d.ts +67 -1
  67. package/dist/knowledge/fund-layer.js +561 -12
  68. package/dist/knowledge/guard-templates.d.ts +10 -0
  69. package/dist/knowledge/guard-templates.js +50 -0
  70. package/dist/knowledge/index.d.ts +2 -2
  71. package/dist/knowledge/index.js +2 -2
  72. package/dist/knowledge/machine-risk.js +4 -1
  73. package/dist/knowledge/progress-context.js +1 -1
  74. package/dist/knowledge/progress-ledger.js +3 -3
  75. package/dist/knowledge/progress-templates.js +1 -1
  76. package/dist/knowledge/progress-translation.js +1 -1
  77. package/dist/knowledge/safety-rules.d.ts +83 -1
  78. package/dist/knowledge/safety-rules.js +166 -2
  79. package/dist/knowledge/scenario-modes.d.ts +1 -1
  80. package/dist/knowledge/scenario-modes.js +13 -11
  81. package/dist/knowledge/template-registry.d.ts +48 -0
  82. package/dist/knowledge/template-registry.js +341 -0
  83. package/dist/knowledge/tool-constraints.js +6 -6
  84. package/dist/knowledge/tools-reference.js +11 -8
  85. package/dist/participation/merchant-interest.d.ts +32 -0
  86. package/dist/participation/merchant-interest.js +100 -0
  87. package/dist/participation/radar-core.d.ts +104 -0
  88. package/dist/participation/radar-core.js +269 -0
  89. package/dist/project/context-assembly.js +8 -0
  90. package/dist/project/edit-planner.js +27 -56
  91. package/dist/project/evaluation.d.ts +36 -0
  92. package/dist/project/evaluation.js +422 -56
  93. package/dist/project/game-theory.d.ts +43 -0
  94. package/dist/project/game-theory.js +177 -0
  95. package/dist/project/graph-builder.js +1 -0
  96. package/dist/project/handlers.d.ts +38 -0
  97. package/dist/project/handlers.js +65 -35
  98. package/dist/project/intent-analyzer.d.ts +71 -0
  99. package/dist/project/intent-analyzer.js +149 -0
  100. package/dist/project/machine-nodes.d.ts +2 -0
  101. package/dist/project/machine-nodes.js +36 -0
  102. package/dist/project/merchant-guide.d.ts +165 -0
  103. package/dist/project/merchant-guide.js +264 -0
  104. package/dist/project/mode-actions.d.ts +199 -0
  105. package/dist/project/mode-actions.js +309 -0
  106. package/dist/project/participation-radar.d.ts +18 -0
  107. package/dist/project/participation-radar.js +428 -0
  108. package/dist/project/pipeline-actions.d.ts +101 -0
  109. package/dist/project/pipeline-actions.js +109 -0
  110. package/dist/project/semantic-graph.d.ts +95 -0
  111. package/dist/project/semantic-graph.js +245 -0
  112. package/dist/schema/call/allocation.d.ts +11 -11
  113. package/dist/schema/call/allocation.js +11 -1
  114. package/dist/schema/call/arbitration.d.ts +21 -21
  115. package/dist/schema/call/arbitration.js +17 -9
  116. package/dist/schema/call/base.d.ts +2 -2
  117. package/dist/schema/call/base.js +1 -1
  118. package/dist/schema/call/bridge.d.ts +127 -127
  119. package/dist/schema/call/bridge.js +12 -12
  120. package/dist/schema/call/contact.d.ts +3 -3
  121. package/dist/schema/call/demand.d.ts +3 -3
  122. package/dist/schema/call/guard.d.ts +11 -11
  123. package/dist/schema/call/guard.js +1 -1
  124. package/dist/schema/call/machine.d.ts +216 -21
  125. package/dist/schema/call/machine.js +1 -1
  126. package/dist/schema/call/order.d.ts +7 -7
  127. package/dist/schema/call/payment.d.ts +3 -3
  128. package/dist/schema/call/permission.d.ts +3 -3
  129. package/dist/schema/call/personal.d.ts +337 -3
  130. package/dist/schema/call/personal.js +10 -0
  131. package/dist/schema/call/progress.d.ts +177 -9
  132. package/dist/schema/call/progress.js +7 -3
  133. package/dist/schema/call/proof.d.ts +6 -6
  134. package/dist/schema/call/repository.d.ts +3 -3
  135. package/dist/schema/call/reward.d.ts +57 -57
  136. package/dist/schema/call/semantic.js +41 -1
  137. package/dist/schema/call/service.d.ts +114 -114
  138. package/dist/schema/call/service.js +11 -2
  139. package/dist/schema/call/treasury.d.ts +57 -57
  140. package/dist/schema/messenger/index.js +4 -1
  141. package/dist/schema/operations.d.ts +713 -291
  142. package/dist/schema/operations.js +33 -0
  143. package/dist/schema/project/index.d.ts +4635 -100
  144. package/dist/schema/project/index.js +868 -1
  145. package/dist/schema/query/index.d.ts +363 -19
  146. package/dist/schema/query/index.js +25 -3
  147. package/dist/schema/schema-query/index.d.ts +13 -7
  148. package/dist/schema/schema-query/index.js +29 -5
  149. package/dist/schema/trust/index.d.ts +1012 -6
  150. package/dist/schema/trust/index.js +212 -11
  151. package/dist/schema/utils/skills-recommendation.js +1 -0
  152. package/dist/schema-query/index.d.ts +4 -1
  153. package/dist/schema-query/index.js +255 -1
  154. package/dist/schemas/bridge_operation.schema.json +14 -7
  155. package/dist/schemas/guard2file.schema.json +2 -0
  156. package/dist/schemas/index.json +1 -1
  157. package/dist/schemas/machineNode2file.schema.json +2 -0
  158. package/dist/schemas/messenger_operation.schema.json +1 -1
  159. package/dist/schemas/onchain_operations.schema.json +143 -15
  160. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  161. package/dist/schemas/onchain_operations_arbitration.schema.json +7 -5
  162. package/dist/schemas/onchain_operations_contact.schema.json +1 -0
  163. package/dist/schemas/onchain_operations_demand.schema.json +1 -0
  164. package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -0
  165. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  166. package/dist/schemas/onchain_operations_guard.schema.json +578 -0
  167. package/dist/schemas/onchain_operations_machine.schema.json +1 -0
  168. package/dist/schemas/onchain_operations_order.schema.json +4 -3
  169. package/dist/schemas/onchain_operations_payment.schema.json +1 -0
  170. package/dist/schemas/onchain_operations_permission.schema.json +1 -0
  171. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  172. package/dist/schemas/onchain_operations_progress.schema.json +90 -3
  173. package/dist/schemas/onchain_operations_proof.schema.json +1 -0
  174. package/dist/schemas/onchain_operations_repository.schema.json +1 -0
  175. package/dist/schemas/onchain_operations_reward.schema.json +1 -0
  176. package/dist/schemas/onchain_operations_service.schema.json +4 -3
  177. package/dist/schemas/onchain_operations_treasury.schema.json +1 -0
  178. package/dist/schemas/project_operation.output.json +2243 -1
  179. package/dist/schemas/project_operation.schema.json +683 -1
  180. package/dist/schemas/query_toolkit.output.json +1 -1
  181. package/dist/schemas/query_toolkit.schema.json +37 -0
  182. package/dist/schemas/schema_query.output.json +1 -1
  183. package/dist/schemas/schema_query.schema.json +30 -5
  184. package/dist/schemas/trust_score.output.json +392 -1
  185. package/dist/schemas/trust_score.schema.json +275 -1
  186. package/dist/tools/handlers/onchain.js +73 -8
  187. package/dist/tools/handlers/project.js +46 -0
  188. package/dist/tools/handlers/query.js +117 -2
  189. package/dist/tools/handlers/schema-query.js +41 -0
  190. package/dist/tools/handlers/trust.js +192 -6
  191. package/dist/tools/index.js +52 -9
  192. package/dist/tools/wrap.js +194 -15
  193. package/package.json +2 -2
@@ -1051,5 +1051,55 @@ export function validateTemplateParams(templateId, params) {
1051
1051
  .map((p) => p.name);
1052
1052
  return { valid: missing.length === 0, missing };
1053
1053
  }
1054
+ function deepSubstitute(obj, params) {
1055
+ if (typeof obj === "string") {
1056
+ const full = obj.match(/^\$\{(\w+)\}$/);
1057
+ if (full && full[1] in params) {
1058
+ return params[full[1]];
1059
+ }
1060
+ return obj.replace(/\$\{(\w+)\}/g, (_, key) => key in params ? String(params[key]) : `\${${key}}`);
1061
+ }
1062
+ if (Array.isArray(obj)) {
1063
+ return obj.map((item) => deepSubstitute(item, params));
1064
+ }
1065
+ if (obj && typeof obj === "object") {
1066
+ const result = {};
1067
+ for (const [k, v] of Object.entries(obj)) {
1068
+ result[k] = deepSubstitute(v, params);
1069
+ }
1070
+ return result;
1071
+ }
1072
+ return obj;
1073
+ }
1074
+ export function fillGuardTemplate(templateId, params) {
1075
+ const template = getTemplateById(templateId);
1076
+ if (!template) {
1077
+ return { ok: false, error: `Template not found: ${templateId}` };
1078
+ }
1079
+ const { valid, missing } = validateTemplateParams(templateId, params);
1080
+ if (!valid) {
1081
+ return {
1082
+ ok: false,
1083
+ error: `Missing required parameters: ${missing.join(", ")}`,
1084
+ missing,
1085
+ };
1086
+ }
1087
+ const filled = { ...params };
1088
+ for (const p of template.parameters) {
1089
+ if (!(p.name in filled) && p.default !== undefined) {
1090
+ filled[p.name] = p.default;
1091
+ }
1092
+ }
1093
+ const table = deepSubstitute(template.example_table, filled);
1094
+ const root = deepSubstitute(template.example_root, filled);
1095
+ const leftover = JSON.stringify({ table, root }).match(/\$\{(\w+)\}/);
1096
+ if (leftover) {
1097
+ return {
1098
+ ok: false,
1099
+ error: `Unresolved placeholder \${${leftover[1]}} — not declared in template parameters`,
1100
+ };
1101
+ }
1102
+ return { ok: true, table, root };
1103
+ }
1054
1104
  export const GUARD_TEMPLATES_VERSION = "1.0.0";
1055
1105
  export const GUARD_TEMPLATES_COUNT = GUARD_TEMPLATES.length;
@@ -1,5 +1,5 @@
1
1
  import { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, type GlossaryEntry, type GlossaryCategory, type GlossaryDrift } from "./glossary.js";
2
- import { CONFIRMATION_RULES, SAFETY_RULES_VERSION, type ConfirmationRule, type OperationPreview, type ConfirmLevel } from "./safety-rules.js";
2
+ import { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules, type ConfirmationRule, type OperationPreview, type ConfirmLevel, type ReuseRecommendation, type ObjectReuseRule, type ImmutabilityRule, type OperationClass, type OperationClassMeta, type SafetyRiskItem } from "./safety-rules.js";
3
3
  import { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintSeverity, type FieldConstraint, type OperationConstraint, type ConstraintViolation } from "./tool-constraints.js";
4
4
  import { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, type PermissionScope, type PermissionTypeDef, type GameElementType, type GameElementDef } from "./process-model.js";
5
5
  import { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, type ArbMetrics, type TrustScore, type TrustComponent } from "./arbitration-trust.js";
@@ -105,7 +105,7 @@ import { TOOLS_REFERENCE, getToolReference, searchToolReference, getToolSequence
105
105
  import { SCENARIO_MODES, SCENARIO_MODES_VERSION, MODE_COMPOSITIONS, matchScenarioMode, inferScenarioTraits, getScenarioMode, listScenarioModes, getShippedModes, getModeCompositions, type IndustryModeName, type ScenarioTraits, type ModeAllocatorStrategy, type ModeGuardRef, type ModeMachineNode, type ScenarioMode, type ModeComposition } from "./scenario-modes.js";
106
106
  import { GUARD_DESIGN_PATTERNS, GUARD_DESIGN_PATTERNS_VERSION, VERIFIER_LEVEL_GUIDANCE, getGuardDesignPattern, searchGuardDesignPatterns, getPatternsByHost, getPatternsByIndustry, getPatternsByDataSourceClass, getVerifierLevelGuidance, suggestPatternForRequirement, type GuardDataSourceClass, type VerifierConstraintLevel, type GuardHostObject, type GuardDesignPattern, type VerifierLevelGuidance } from "./guard-design-patterns.js";
107
107
  export { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, type GlossaryEntry, type GlossaryCategory, type GlossaryDrift, };
108
- export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, type ConfirmationRule, type OperationPreview, type ConfirmLevel, };
108
+ export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules, type ConfirmationRule, type OperationPreview, type ConfirmLevel, type ReuseRecommendation, type ObjectReuseRule, type ImmutabilityRule, type OperationClass, type OperationClassMeta, type SafetyRiskItem, };
109
109
  export { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintSeverity, type FieldConstraint, type OperationConstraint, type ConstraintViolation, };
110
110
  export { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, type PermissionScope, type PermissionTypeDef, type GameElementType, type GameElementDef, };
111
111
  export { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, type ArbMetrics, type TrustScore, type TrustComponent, };
@@ -1,5 +1,5 @@
1
1
  import { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields } from "./glossary.js";
2
- import { CONFIRMATION_RULES, SAFETY_RULES_VERSION } from "./safety-rules.js";
2
+ import { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules } from "./safety-rules.js";
3
3
  import { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, } from "./tool-constraints.js";
4
4
  import { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, } from "./process-model.js";
5
5
  import { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, } from "./arbitration-trust.js";
@@ -105,7 +105,7 @@ import { TOOLS_REFERENCE, getToolReference, searchToolReference, getToolSequence
105
105
  import { SCENARIO_MODES, SCENARIO_MODES_VERSION, MODE_COMPOSITIONS, matchScenarioMode, inferScenarioTraits, getScenarioMode, listScenarioModes, getShippedModes, getModeCompositions, } from "./scenario-modes.js";
106
106
  import { GUARD_DESIGN_PATTERNS, GUARD_DESIGN_PATTERNS_VERSION, VERIFIER_LEVEL_GUIDANCE, getGuardDesignPattern, searchGuardDesignPatterns, getPatternsByHost, getPatternsByIndustry, getPatternsByDataSourceClass, getVerifierLevelGuidance, suggestPatternForRequirement, } from "./guard-design-patterns.js";
107
107
  export { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, };
108
- export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, };
108
+ export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules, };
109
109
  export { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, };
110
110
  export { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, };
111
111
  export { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, };
@@ -123,7 +123,10 @@ export const MACHINE_RISK_RULES = [
123
123
  "dispute in the machine (e.g., 'disputed → refunded' forward guarded " +
124
124
  "by Permission index 1500) create dead-end paths because no one has " +
125
125
  "Permission 1500 — arbitrators are NOT Permission holders.",
126
- detection: "Match node names against regex /^(disputed|refunded|arb|arbitration|dispute|refund)$/i",
126
+ detection: "Match node names against regex /(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i " +
127
+ "(catches both exact names like 'refunded' and compound fund-flow terminals like " +
128
+ "'deposit_refunded'/'deposit_deducted'; business states like 'return_approved'/" +
129
+ "'damage_confirmed'/'cancelled'/'returned' do NOT match)",
127
130
  recommendation: "Remove all dispute/refund nodes from the machine. Instead: (1) bind an " +
128
131
  "Arbitration object to the Service via Service.arbitrations, (2) configure " +
129
132
  "arbitrators via Arbitration.voting_guard_add, (3) deposit compensation_fund " +
@@ -336,7 +336,7 @@ export function buildPromptFromProgressContext(bundle) {
336
336
  }
337
337
  if (h.include_terminal_node_note) {
338
338
  lines.push("─ Terminal Node Note ──────────────");
339
- lines.push("At terminal nodes (completed/enforced/deposit_refunded/paid), use progress::owner_receive");
339
+ lines.push("At terminal nodes (completed/enforced/return_approved/paid), use progress::owner_receive");
340
340
  lines.push("to unwrap Receiving<K> / CoinWrapper<T> via Payment.unwrap_with_check.");
341
341
  lines.push("Permission 225 (PROGRESS_OWNER_RECEIVE) required; recipient = Machine.permission owner.");
342
342
  lines.push("");
@@ -177,7 +177,7 @@ export const PROGRESS_SCENES = [
177
177
  industry: ["finance", "treasury", "rental", "freelance"],
178
178
  scenario: "Owner receives Receiving<K> objects or CoinWrapper<T> coins sent to the Progress object. " +
179
179
  "unwrap → permission::owner_receive_inner forwards to Permission owner. " +
180
- "Used at terminal nodes (deposit_refunded, completed, enforced) to disburse funds.",
180
+ "Used at terminal nodes (return_approved, completed, enforced) to disburse funds.",
181
181
  phases: ["owner_receive"],
182
182
  requires_published_machine: true,
183
183
  requires_order_bound: true,
@@ -189,7 +189,7 @@ export const PROGRESS_SCENES = [
189
189
  common_patterns: [
190
190
  "owner_receive unwraps CoinWrapper<T> via Payment.unwrap_with_check (amount validation)",
191
191
  "owner_receive_object receives a generic K:key+store object and forwards to Permission owner",
192
- "Triggered at terminal nodes (e.g. 'deposit_refunded' in rental, 'enforced' in arbitration)",
192
+ "Triggered at terminal nodes (e.g. 'return_approved' in rental, 'enforced' in arbitration)",
193
193
  "Permission owner ≠ Progress creator: receives flow to whoever owns the bound Machine's Permission",
194
194
  ],
195
195
  recommended_templates: ["T-PR-06"],
@@ -326,5 +326,5 @@ export const PROGRESS_CROSS_OBJECT_REFS = [
326
326
  { object: "Passport", phase: "forward_advance", relationship: "Forward.guard (Some) requires Passport + passport::result_for_guard" },
327
327
  { object: "Passport", phase: "unhold_state", relationship: "unhold_with_passport: 224 check via passport (fallback when sender_has_permission_idcheck fails)" },
328
328
  { object: "Payment", phase: "owner_receive", relationship: "owner_receive unwraps CoinWrapper<T> via Payment.unwrap_with_check" },
329
- { object: "Allocation", phase: "completed", relationship: "Terminal node triggers Allocation alloc (e.g. 'completed', 'enforced', 'deposit_refunded')" },
329
+ { object: "Allocation", phase: "completed", relationship: "Terminal node triggers Allocation alloc (e.g. 'completed', 'enforced', 'return_approved')" },
330
330
  ];
@@ -184,7 +184,7 @@ export const PROGRESS_TEMPLATES = [
184
184
  notes: [
185
185
  "Permission 225 (PROGRESS_OWNER_RECEIVE) is required; SDK CallProgress_Data does NOT expose this op",
186
186
  "Recipient is Permission owner (Machine.permission's owner), NOT Progress creator",
187
- "Triggered at terminal nodes: 'deposit_refunded', 'completed', 'enforced', 'paid'",
187
+ "Triggered at terminal nodes: 'return_approved', 'completed', 'enforced', 'paid'",
188
188
  "For coins: Payment.unwrap_with_check validates amount before forwarding to owner",
189
189
  "For objects: generic K:key+store — forwarded directly via permission::owner_receive_inner",
190
190
  ],
@@ -128,7 +128,7 @@ export const PROGRESS_SEMANTIC_TO_SCHEMA_RULES = [
128
128
  arguments: ["progress", "machine", "permission", "received", "payment"],
129
129
  },
130
130
  reverse_explanation: "Calls progress::owner_receive (225 permission). Unwraps CoinWrapper<T> via Payment.unwrap_with_check, " +
131
- "forwards coin/object to Permission owner. Typically triggered at terminal nodes (deposit_refunded, completed, enforced).",
131
+ "forwards coin/object to Permission owner. Typically triggered at terminal nodes (return_approved, completed, enforced).",
132
132
  },
133
133
  ];
134
134
  export const PROGRESS_SCHEMA_TO_SEMANTIC_RULES = [
@@ -33,4 +33,86 @@ export declare function getAmountThreshold(): bigint;
33
33
  export declare function formatAmount(value: string | bigint, precision?: bigint): string;
34
34
  export declare function collectDefaultWarnings(env: any, data: any): string[];
35
35
  export declare const CONFIRMATION_RULES: ConfirmationRule[];
36
- export declare const SAFETY_RULES_VERSION = 1;
36
+ export declare function extractAmount(data: any): string | null;
37
+ export type ReuseRecommendation = "always_reuse" | "strongly_recommended" | "recommended" | "optional";
38
+ export interface ObjectReuseRule {
39
+ rule_id: string;
40
+ object_type: string;
41
+ recommendation: ReuseRecommendation;
42
+ reason: string;
43
+ ask_user: string;
44
+ }
45
+ export declare const OBJECT_REUSE_RULES: readonly ObjectReuseRule[];
46
+ export declare const CREATE_VS_MODIFY_PATTERN: {
47
+ readonly reuse_form: "string";
48
+ readonly create_form: "object";
49
+ readonly resolution_api: "GetObjectExisted";
50
+ readonly note: "String reference = REUSE (name resolution failure is a hard error); object shape = CREATE (always).";
51
+ };
52
+ export interface ImmutabilityRule {
53
+ rule_id: string;
54
+ object_type: string;
55
+ trigger: "create" | "publish";
56
+ immutable_fields: string[];
57
+ mutable_after?: string[];
58
+ message: string;
59
+ }
60
+ export declare const IMMUTABILITY_RULES: readonly ImmutabilityRule[];
61
+ export type OperationClass = "LOCAL_ONLY" | "ONCHAIN" | "QUERY" | "ENCRYPTED";
62
+ export declare const OPERATION_TYPE_CLASSIFICATION: Record<OperationClass, readonly string[]>;
63
+ export interface OperationClassMeta {
64
+ gas: boolean;
65
+ confirmation_required: boolean;
66
+ note: string;
67
+ }
68
+ export declare const OPERATION_CLASS_META: Record<OperationClass, OperationClassMeta>;
69
+ export declare function classifyTool(toolName: string): OperationClass | undefined;
70
+ export declare const NAMING_CONVENTIONS: {
71
+ readonly scheme: "<projectPrefix>_<type>_<purpose>_<version>";
72
+ readonly parts: {
73
+ readonly project_prefix: {
74
+ readonly example: "shopFunny_";
75
+ readonly purpose: "Prevents cross-project collisions";
76
+ };
77
+ readonly type_prefix: {
78
+ readonly example: "machine_ / guard_ / service_";
79
+ readonly purpose: "Clarifies object type";
80
+ };
81
+ readonly purpose_suffix: {
82
+ readonly example: "serviceWithdraw";
83
+ readonly purpose: "Describes function";
84
+ };
85
+ readonly version_suffix: {
86
+ readonly example: "_v2";
87
+ readonly purpose: "Enables iteration without replaceExistName";
88
+ };
89
+ };
90
+ readonly entry_id: {
91
+ readonly pattern: "^<object_type>:<name>$";
92
+ readonly example: "service:myshop_service";
93
+ };
94
+ readonly replace_exist_name: {
95
+ readonly default: false;
96
+ readonly false_effect: "Throws error if name is in use — safe default";
97
+ readonly true_effect: "Existing object/account with the same name is suspended/unbound to free the name";
98
+ readonly account_default_forbidden: "replaceExistName:true on the default account (name='') is FORBIDDEN — use suspend() explicitly";
99
+ readonly recommendation: "DISCOURAGED — prefer versioned names (_v1, _v2) for production";
100
+ };
101
+ readonly recommendations: readonly ["Always provide tags on object creation for filtering and management", "Use names as primary identifiers; use short address form (0x1234...def) only for display", "All cross-object references (Guard tables, Service bindings, Machine forwards) use NAMES — resolved per-network at build time"];
102
+ };
103
+ export interface SafetyRiskItem {
104
+ rule_id: string;
105
+ severity: "info" | "warn";
106
+ message: string;
107
+ }
108
+ export declare function checkObjectReuseRules(planned: readonly {
109
+ object_type: string;
110
+ is_new: boolean;
111
+ name?: string;
112
+ }[]): SafetyRiskItem[];
113
+ export declare function checkImmutabilityRules(ops: readonly {
114
+ object_type: string;
115
+ trigger: "create" | "publish";
116
+ name?: string;
117
+ }[]): SafetyRiskItem[];
118
+ export declare const SAFETY_RULES_VERSION = 2;
@@ -217,7 +217,7 @@ export const CONFIRMATION_RULES = [
217
217
  bypass_on_explicit_intent: ["test guard", "testing guard", "gen passport", "generate passport"],
218
218
  },
219
219
  ];
220
- function extractAmount(data) {
220
+ export function extractAmount(data) {
221
221
  if (!data)
222
222
  return null;
223
223
  const candidates = [
@@ -237,4 +237,168 @@ function extractAmount(data) {
237
237
  }
238
238
  return null;
239
239
  }
240
- export const SAFETY_RULES_VERSION = 1;
240
+ export const OBJECT_REUSE_RULES = [
241
+ {
242
+ rule_id: "REUSE-001",
243
+ object_type: "permission",
244
+ recommendation: "strongly_recommended",
245
+ reason: "Centralized permission control across all services",
246
+ ask_user: "Do you have an existing Permission to reuse? Provide the name or ID.",
247
+ },
248
+ {
249
+ rule_id: "REUSE-002",
250
+ object_type: "machine",
251
+ recommendation: "recommended",
252
+ reason: "Save design time for similar processes",
253
+ ask_user: "Do you have an existing Machine whose workflow fits? Provide the name or ID.",
254
+ },
255
+ {
256
+ rule_id: "REUSE-003",
257
+ object_type: "guard",
258
+ recommendation: "recommended",
259
+ reason: "Avoid redundant validation rules",
260
+ ask_user: "Do you have an existing Guard with matching validation logic? Provide the name or ID.",
261
+ },
262
+ {
263
+ rule_id: "REUSE-004",
264
+ object_type: "contact",
265
+ recommendation: "recommended",
266
+ reason: "Single point of customer-service management",
267
+ ask_user: "Do you have an existing Contact for customer service? Provide the name or ID.",
268
+ },
269
+ {
270
+ rule_id: "REUSE-005",
271
+ object_type: "arbitration",
272
+ recommendation: "always_reuse",
273
+ reason: "Customers choose from established arbiters; creating a new Arbitration is an operator-level decision",
274
+ ask_user: "Which existing Arbitration service should disputes route to? Provide the name or ID.",
275
+ },
276
+ ];
277
+ export const CREATE_VS_MODIFY_PATTERN = {
278
+ reuse_form: "string",
279
+ create_form: "object",
280
+ resolution_api: "GetObjectExisted",
281
+ note: "String reference = REUSE (name resolution failure is a hard error); object shape = CREATE (always).",
282
+ };
283
+ export const IMMUTABILITY_RULES = [
284
+ {
285
+ rule_id: "IMMUT-001",
286
+ object_type: "machine",
287
+ trigger: "publish",
288
+ immutable_fields: ["nodes", "pairs", "forwards"],
289
+ message: "Machine topology is immutable after publish — verify all nodes/forwards via machineNode2file BEFORE publishing",
290
+ },
291
+ {
292
+ rule_id: "IMMUT-002",
293
+ object_type: "service",
294
+ trigger: "publish",
295
+ immutable_fields: ["machine", "order_allocators", "arbitrations"],
296
+ mutable_after: ["sales"],
297
+ message: "Service.machine, order_allocators and arbitrations are frozen after publish; sales remains fully modifiable (L3) without pause",
298
+ },
299
+ {
300
+ rule_id: "IMMUT-003",
301
+ object_type: "guard",
302
+ trigger: "create",
303
+ immutable_fields: ["table", "root", "rely"],
304
+ message: "Guard is CREATE-only and immutable — cannot be edited or deleted after creation. To change: export via guard2file → edit → CREATE new → rebind",
305
+ },
306
+ ];
307
+ export const OPERATION_TYPE_CLASSIFICATION = {
308
+ LOCAL_ONLY: [
309
+ "account_operation",
310
+ "local_mark_operation",
311
+ "local_info_operation",
312
+ "project_operation",
313
+ "config_operation",
314
+ ],
315
+ ONCHAIN: [
316
+ "onchain_operations",
317
+ "wip_file",
318
+ "bridge_operation",
319
+ "messenger_operation",
320
+ ],
321
+ QUERY: [
322
+ "query_toolkit",
323
+ "onchain_table_data",
324
+ "onchain_events",
325
+ "guard2file",
326
+ "machineNode2file",
327
+ "schema_query",
328
+ "wowok_buildin_info",
329
+ "trust_score",
330
+ ],
331
+ ENCRYPTED: [
332
+ "messenger_operation",
333
+ ],
334
+ };
335
+ export const OPERATION_CLASS_META = {
336
+ LOCAL_ONLY: { gas: false, confirmation_required: false, note: "Local state only — no gas, no confirmation needed" },
337
+ ONCHAIN: { gas: true, confirmation_required: true, note: "On-chain write — gas consumed, explicit user confirmation REQUIRED before execution" },
338
+ QUERY: { gas: false, confirmation_required: false, note: "Read-only — no gas, no confirmation needed" },
339
+ ENCRYPTED: { gas: false, confirmation_required: false, note: "Local encryption — no gas, no confirmation needed" },
340
+ };
341
+ export function classifyTool(toolName) {
342
+ if (OPERATION_TYPE_CLASSIFICATION.ENCRYPTED.includes(toolName))
343
+ return "ENCRYPTED";
344
+ for (const cls of ["LOCAL_ONLY", "ONCHAIN", "QUERY"]) {
345
+ if (OPERATION_TYPE_CLASSIFICATION[cls].includes(toolName))
346
+ return cls;
347
+ }
348
+ return undefined;
349
+ }
350
+ export const NAMING_CONVENTIONS = {
351
+ scheme: "<projectPrefix>_<type>_<purpose>_<version>",
352
+ parts: {
353
+ project_prefix: { example: "shopFunny_", purpose: "Prevents cross-project collisions" },
354
+ type_prefix: { example: "machine_ / guard_ / service_", purpose: "Clarifies object type" },
355
+ purpose_suffix: { example: "serviceWithdraw", purpose: "Describes function" },
356
+ version_suffix: { example: "_v2", purpose: "Enables iteration without replaceExistName" },
357
+ },
358
+ entry_id: { pattern: "^<object_type>:<name>$", example: "service:myshop_service" },
359
+ replace_exist_name: {
360
+ default: false,
361
+ false_effect: "Throws error if name is in use — safe default",
362
+ true_effect: "Existing object/account with the same name is suspended/unbound to free the name",
363
+ account_default_forbidden: "replaceExistName:true on the default account (name='') is FORBIDDEN — use suspend() explicitly",
364
+ recommendation: "DISCOURAGED — prefer versioned names (_v1, _v2) for production",
365
+ },
366
+ recommendations: [
367
+ "Always provide tags on object creation for filtering and management",
368
+ "Use names as primary identifiers; use short address form (0x1234...def) only for display",
369
+ "All cross-object references (Guard tables, Service bindings, Machine forwards) use NAMES — resolved per-network at build time",
370
+ ],
371
+ };
372
+ export function checkObjectReuseRules(planned) {
373
+ const risks = [];
374
+ for (const p of planned) {
375
+ if (!p.is_new)
376
+ continue;
377
+ const rule = OBJECT_REUSE_RULES.find((r) => r.object_type === p.object_type);
378
+ if (!rule)
379
+ continue;
380
+ if (rule.recommendation === "always_reuse" || rule.recommendation === "strongly_recommended") {
381
+ risks.push({
382
+ rule_id: rule.rule_id,
383
+ severity: rule.recommendation === "always_reuse" ? "warn" : "info",
384
+ message: `Creating NEW ${p.object_type}${p.name ? ` "${p.name}"` : ""} — reuse is ${rule.recommendation}: ${rule.reason}. ${rule.ask_user}`,
385
+ });
386
+ }
387
+ }
388
+ return risks;
389
+ }
390
+ export function checkImmutabilityRules(ops) {
391
+ const risks = [];
392
+ for (const op of ops) {
393
+ const rule = IMMUTABILITY_RULES.find((r) => r.object_type === op.object_type && r.trigger === op.trigger);
394
+ if (!rule)
395
+ continue;
396
+ risks.push({
397
+ rule_id: rule.rule_id,
398
+ severity: "warn",
399
+ message: `${op.object_type}${op.name ? ` "${op.name}"` : ""} ${op.trigger}: ${rule.message}. Immutable: [${rule.immutable_fields.join(", ")}]${rule.mutable_after ? `. Still mutable: [${rule.mutable_after.join(", ")}]` : ""}`,
400
+ });
401
+ }
402
+ return risks;
403
+ }
404
+ export const SAFETY_RULES_VERSION = 2;
@@ -50,4 +50,4 @@ export declare function getScenarioMode(name: IndustryModeName): ScenarioMode |
50
50
  export declare function listScenarioModes(): ScenarioMode[];
51
51
  export declare function getShippedModes(): ScenarioMode[];
52
52
  export declare function getModeCompositions(name: IndustryModeName): ModeComposition[];
53
- export declare const SCENARIO_MODES_VERSION = 1;
53
+ export declare const SCENARIO_MODES_VERSION = 2;
@@ -18,8 +18,7 @@ export const SCENARIO_MODES = [
18
18
  { name: "delivered", role: "Deliverable available for review" },
19
19
  { name: "accepted", role: "Customer signs acceptance" },
20
20
  { name: "completed", role: "Funds released to provider" },
21
- { name: "refunded", role: "Customer-initiated refund path" },
22
- { name: "cancelled", role: "Pre-delivery cancellation" },
21
+ { name: "cancelled", role: "Pre-delivery cancellation — triggers refund Allocator" },
23
22
  ],
24
23
  guards: [
25
24
  { template_id: "buy_guard_identity", host: "service", purpose: "Customer identity check on purchase" },
@@ -33,13 +32,14 @@ export const SCENARIO_MODES = [
33
32
  recipient: "signer",
34
33
  count: 2,
35
34
  mode: "amount",
36
- description: "100% to provider on accepted; 100% refund to customer on refunded",
35
+ description: "100% to provider on completed; 100% refund to customer on cancelled (refund Allocator, off-Machine fund routing per R-M1-11)",
37
36
  },
38
37
  key_risk: "Customer never accepts delivery — provider cannot get paid",
39
38
  build_notes: [
40
39
  "Use Service `setting_locked_time` to lock rules for the engagement duration",
41
40
  "WIP hash on deliverable is mandatory — protects provider in disputes",
42
41
  "Acceptance gate is the trust pivot — both parties must agree on criteria",
42
+ "R-M1-11: no 'refunded'/'disputed'/'arb' nodes — refunds route via Allocator (100% to OrderHolder) triggered by 'cancelled', disputes via Arbitration",
43
43
  "NEW: Payment exception compensation for delivery delays — provider Treasury auto-compensates customer (§2.13)",
44
44
  ],
45
45
  },
@@ -62,8 +62,9 @@ export const SCENARIO_MODES = [
62
62
  { name: "in_use", role: "Rental period active" },
63
63
  { name: "returned", role: "Customer returns item" },
64
64
  { name: "inspected", role: "Owner inspects returned item" },
65
- { name: "deposit_refunded", role: "No damage — full deposit returned" },
66
- { name: "deposit_deducted", role: "Damage found — deposit partially deducted" },
65
+ { name: "return_approved", role: "No damage — triggers deposit refund Allocator (100% to customer)" },
66
+ { name: "damage_confirmed", role: "Damage confirmed via pre+post WIP diff — triggers deposit deduction Allocator" },
67
+ { name: "completed", role: "Rental finalized — triggers rent Allocator (rent to owner)" },
67
68
  ],
68
69
  guards: [
69
70
  { template_id: "deposit_guard_amount", host: "service", purpose: "Verify deposit amount matches listing" },
@@ -78,13 +79,14 @@ export const SCENARIO_MODES = [
78
79
  recipient: "entity",
79
80
  count: 3,
80
81
  mode: "amount",
81
- description: "Rent to owner; refund to customer; deduction to owner (damage case)",
82
+ description: "Rent to owner on completed; deposit refund to customer on return_approved; deposit deduction to owner on damage_confirmed (fund routing via Allocator per R-M1-11)",
82
83
  },
83
84
  key_risk: "Owner claims damage without pre-rental WIP — customer loses deposit unfairly",
84
85
  build_notes: [
85
86
  "Pre-rental WIP is non-negotiable — without it, damage claims fail",
86
87
  "Deposit must be escrowed, not direct-transferred — enables fair deduction",
87
88
  "Inspection gate prevents customer from denying damage",
89
+ "R-M1-11: no 'deposit_refunded'/'deposit_deducted'/'refunded' nodes — deposit refund/deduction flows through Allocator triggered by return_approved/damage_confirmed business states",
88
90
  "NEW: Payment exception compensation for return delays — Treasury withdraws scene-bound Payment (§2.13)",
89
91
  "NEW: Repository quote_guard for weather/usage data subscription revenue (§2.11)",
90
92
  ],
@@ -106,7 +108,7 @@ export const SCENARIO_MODES = [
106
108
  { name: "paid", role: "Entry: enrollment and tuition paid via Service.buy(); Machine starts here" },
107
109
  { name: "session_N", role: "Per-session attendance (1..N)" },
108
110
  { name: "completed", role: "All sessions delivered" },
109
- { name: "refunded", role: "Institution-approved refund" },
111
+ { name: "withdrawn", role: "Enrollment cancelled mid-course — triggers unearned-tuition refund Allocator" },
110
112
  ],
111
113
  guards: [
112
114
  { template_id: "attendance_guard_signer", host: "machine", purpose: "Per-session student attendance signature" },
@@ -117,7 +119,7 @@ export const SCENARIO_MODES = [
117
119
  recipient: "entity",
118
120
  count: 1,
119
121
  mode: "amount",
120
- description: "1/N of tuition released per session attendance; unearned portion refundable",
122
+ description: "1/N of tuition released per session attendance; unearned portion refunded to student via Allocator on withdrawn (per R-M1-11)",
121
123
  },
122
124
  key_risk: "Tutoring institutions run away with prepaid tuition",
123
125
  build_notes: [
@@ -147,7 +149,7 @@ export const SCENARIO_MODES = [
147
149
  { name: "segment_D2", role: "Segment 2 (e.g., guided tour)" },
148
150
  { name: "returned", role: "Trip completed, customer returns" },
149
151
  { name: "completed", role: "All segments delivered, funds released" },
150
- { name: "refunded", role: "Trip interruption refund" },
152
+ { name: "interrupted", role: "Trip interrupted — triggers refund Allocator (undelivered segments) or Arbitration" },
151
153
  ],
152
154
  guards: [
153
155
  { template_id: "segment_guard_wip", host: "machine", purpose: "Per-segment arrival WIP (hotel check-in, etc.)" },
@@ -160,7 +162,7 @@ export const SCENARIO_MODES = [
160
162
  recipient: "entity",
161
163
  count: 3,
162
164
  mode: "amount",
163
- description: "Deposit 20% to agency, final 80% to agency, then agency-side Allocation splits to hotel/guide/driver per segment",
165
+ description: "Deposit 20% to agency, final 80% to agency, then agency-side Allocation splits to hotel/guide/driver per segment; undelivered segments refunded to customer via Allocator on interrupted (per R-M1-11)",
164
166
  },
165
167
  key_risk: "Paid in full then service shrinks — multi-tier transparency prevents this",
166
168
  build_notes: [
@@ -316,4 +318,4 @@ export function getShippedModes() {
316
318
  export function getModeCompositions(name) {
317
319
  return MODE_COMPOSITIONS.filter((c) => c.modes.includes(name));
318
320
  }
319
- export const SCENARIO_MODES_VERSION = 1;
321
+ export const SCENARIO_MODES_VERSION = 2;
@@ -0,0 +1,48 @@
1
+ export declare const TEMPLATE_REGISTRY_VERSION = 1;
2
+ export type TemplateObjectType = "guard" | "machine" | "service" | "order" | "progress" | "arbitration" | "treasury" | "permission" | "passport" | "allocation" | "reward";
3
+ export declare const TEMPLATE_OBJECT_TYPES: readonly TemplateObjectType[];
4
+ export type UnifiedTemplateParamDefault = string | number | boolean | object | string[];
5
+ export interface UnifiedTemplateParam {
6
+ name: string;
7
+ type: string;
8
+ description: string;
9
+ required: boolean;
10
+ default?: UnifiedTemplateParamDefault;
11
+ constraint?: string;
12
+ }
13
+ export interface UnifiedTemplateMeta {
14
+ id: string;
15
+ object_type: TemplateObjectType;
16
+ name: string;
17
+ description: string;
18
+ scenes: string[];
19
+ industries: string[];
20
+ instantiable: boolean;
21
+ parameters: UnifiedTemplateParam[];
22
+ }
23
+ export type InstantiateTemplateResult = {
24
+ ok: true;
25
+ object_type: TemplateObjectType;
26
+ template_id: string;
27
+ body: unknown;
28
+ notes?: string[];
29
+ } | {
30
+ ok: false;
31
+ object_type: TemplateObjectType | null;
32
+ template_id: string;
33
+ error: string;
34
+ missing_params?: string[];
35
+ guidance?: unknown;
36
+ };
37
+ type AnyParams = Record<string, unknown>;
38
+ export declare function getTemplateIdCollisions(): string[];
39
+ export declare function getTemplateCounts(): Record<TemplateObjectType, number>;
40
+ export declare function listTemplates(objectType?: TemplateObjectType): UnifiedTemplateMeta[];
41
+ export declare function getTemplateDetail(templateId: string): (UnifiedTemplateMeta & {
42
+ raw: unknown;
43
+ notes?: string[];
44
+ guidance?: unknown;
45
+ }) | null;
46
+ export declare function findTemplateObjectType(templateId: string): TemplateObjectType | null;
47
+ export declare function instantiateTemplate(templateId: string, params: AnyParams): InstantiateTemplateResult;
48
+ export {};