@wowok/agent-mcp 3.1.7 → 3.2.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.
- package/dist/config/exposure.d.ts +10 -10
- package/dist/config/judgment.d.ts +25 -25
- package/dist/config/rule-engine.d.ts +25 -25
- package/dist/customer/user-preferences.d.ts +2 -2
- package/dist/evaluation/arbitration-game.js +1 -1
- package/dist/evaluation/capability.d.ts +1 -1
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/extensions/industry-pack.d.ts +3 -2
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.js +1 -1
- package/dist/extensions/types.d.ts +1 -0
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/graph/onchain/extract.js +1 -1
- package/dist/graph/onchain/field-manifest.js +1 -1
- package/dist/graph/onchain/project-relationship.js +1 -1
- package/dist/graph/onchain/types.d.ts +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/keeper/KeeperScan.d.ts +2 -1
- package/dist/keeper/KeeperScan.js +1 -1
- package/dist/keeper/detectors.d.ts +9 -0
- package/dist/keeper/detectors.js +1 -1
- package/dist/keeper/keeper.spec.js +1 -1
- package/dist/keeper/types.d.ts +1 -1
- package/dist/keeper/types.js +1 -1
- package/dist/knowledge/allocation-ledger.d.ts +4 -1
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-puzzle.d.ts +2 -0
- package/dist/knowledge/allocation-puzzle.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arb-risk.d.ts +3 -1
- package/dist/knowledge/arb-risk.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/arbitration-templates.d.ts +1 -0
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +13 -2
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/allocation.json +50 -1
- package/dist/knowledge/baselines/rules/arb.json +20 -1
- package/dist/knowledge/baselines/rules/arbitration.json +27 -0
- package/dist/knowledge/baselines/rules/guard.json +75 -2
- package/dist/knowledge/baselines/rules/machine.json +38 -13
- package/dist/knowledge/baselines/rules/order.json +2 -2
- package/dist/knowledge/builtin-templates.d.ts +3 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-anchor-reach.d.ts +19 -0
- package/dist/knowledge/guard-anchor-reach.js +1 -0
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-render.d.ts +6 -0
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +6 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/index.d.ts +4 -4
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.d.ts +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-templates.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-templates.js +1 -1
- package/dist/knowledge/permission-ledger.js +1 -1
- package/dist/knowledge/release-sentinel.d.ts +12 -0
- package/dist/knowledge/release-sentinel.js +1 -0
- package/dist/knowledge/repository-write-semantics.d.ts +27 -0
- package/dist/knowledge/repository-write-semantics.js +1 -0
- package/dist/knowledge/rule-node-analyzers.d.ts +6 -0
- package/dist/knowledge/rule-node-analyzers.js +1 -1
- package/dist/knowledge/safety-rules.d.ts +5 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +10 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/service-allocation-semantics.d.ts +36 -0
- package/dist/knowledge/service-allocation-semantics.js +1 -0
- package/dist/knowledge/strategy-manuals.d.ts +3 -5
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +28 -12
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +26 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/allocation-advice.d.ts +38 -0
- package/dist/participation/allocation-advice.js +1 -0
- package/dist/participation/radar-core.d.ts +2 -0
- package/dist/persona/types.d.ts +3 -2
- package/dist/persona/types.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/intent-analyzer.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +70 -63
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +5 -0
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/semantic-graph.d.ts +1 -0
- package/dist/playbooks/service-build/semantic-graph.js +1 -1
- package/dist/playbooks/service-build/service-quote.d.ts +2 -0
- package/dist/playbooks/service-build/service-quote.js +1 -0
- package/dist/relationship/derivation.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +30 -8
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +6 -3
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/guard.d.ts +8 -8
- package/dist/schema/call/machine.d.ts +56 -0
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +84 -22
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/common/tokentype-short-probe.spec.js +1 -0
- package/dist/schema/evaluation/index.d.ts +8 -80
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +9 -42
- package/dist/schema/goal/planning.d.ts +25 -60
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +2 -20
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/interaction/index.d.ts +1 -1
- package/dist/schema/keeper/index.d.ts +3 -0
- package/dist/schema/keeper/index.js +1 -1
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +74 -14
- package/dist/schema/persona/index.d.ts +279 -384
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +149 -10
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +35 -16
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +4 -4
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/watch/index.d.ts +2 -2
- package/dist/schema-query-impl/index.d.ts +1 -0
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +2 -2
- package/dist/schemas/benchmark_migration_operation.output.json +116 -2
- package/dist/schemas/benchmark_migration_operation.schema.json +2 -10
- package/dist/schemas/bridge_operation.output.json +2 -2
- package/dist/schemas/evaluation_operation.schema.json +7 -70
- package/dist/schemas/goal_operation.schema.json +6 -39
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/intent_radar.output.json +4 -20
- package/dist/schemas/keeper_operation.output.json +2 -2
- package/dist/schemas/keeper_operation.schema.json +9 -4
- package/dist/schemas/local_history_operation.output.json +2 -2
- package/dist/schemas/local_info_operation.output.json +2 -2
- package/dist/schemas/local_mark_operation.output.json +2 -2
- package/dist/schemas/messenger_operation.output.json +2 -2
- package/dist/schemas/monitor_events.output.json +2 -2
- package/dist/schemas/monitor_subscription.output.json +2 -2
- package/dist/schemas/onchain_events.output.json +2 -2
- package/dist/schemas/onchain_operations.output.json +6 -6
- package/dist/schemas/onchain_operations.schema.json +227 -54
- package/dist/schemas/onchain_operations_allocation.schema.json +11 -10
- package/dist/schemas/onchain_operations_arbitration.schema.json +13 -13
- package/dist/schemas/onchain_operations_machine.schema.json +27 -5
- package/dist/schemas/onchain_operations_order.schema.json +1 -1
- package/dist/schemas/onchain_operations_payment.schema.json +2 -2
- package/dist/schemas/onchain_operations_reward.schema.json +1 -1
- package/dist/schemas/onchain_operations_service.schema.json +171 -21
- package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
- package/dist/schemas/onchain_table_data.output.json +57 -4
- package/dist/schemas/persona_operation.output.json +11 -88
- package/dist/schemas/persona_operation.schema.json +4 -32
- package/dist/schemas/query_toolkit.output.json +320 -22
- package/dist/schemas/query_toolkit.schema.json +53 -0
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.spec.js +1 -1
- package/dist/tools/handlers/keeper.d.ts +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/knowledge/alloc-audit-policy.spec.js +0 -1
- package/dist/knowledge/event-semantics.spec.d.ts +0 -1
- package/dist/knowledge/event-semantics.spec.js +0 -1
- package/dist/knowledge/facts-sync.spec.d.ts +0 -1
- package/dist/knowledge/facts-sync.spec.js +0 -1
- package/dist/knowledge/guard-design-patterns.spec.d.ts +0 -1
- package/dist/knowledge/guard-design-patterns.spec.js +0 -1
- package/dist/knowledge/guard-eval.spec.d.ts +0 -1
- package/dist/knowledge/guard-eval.spec.js +0 -1
- package/dist/knowledge/rule-node-analyzers.spec.d.ts +0 -1
- package/dist/knowledge/rule-node-analyzers.spec.js +0 -1
- package/dist/knowledge/safety-rules.extract-amount.spec.d.ts +0 -1
- package/dist/knowledge/safety-rules.extract-amount.spec.js +0 -1
- package/dist/knowledge/template-loader.spec.d.ts +0 -1
- package/dist/knowledge/template-loader.spec.js +0 -1
- package/dist/knowledge/template-scanner.spec.d.ts +0 -1
- package/dist/knowledge/template-scanner.spec.js +0 -1
- /package/dist/{knowledge/alloc-audit-policy.spec.d.ts → schema/common/tokentype-short-probe.spec.d.ts} +0 -0
|
@@ -22,13 +22,13 @@ export declare const SchemaQueryInputSchema: z.ZodObject<{
|
|
|
22
22
|
reward: "reward";
|
|
23
23
|
permission: "permission";
|
|
24
24
|
guard: "guard";
|
|
25
|
-
order: "order";
|
|
26
25
|
service: "service";
|
|
27
|
-
machine: "machine";
|
|
28
|
-
treasury: "treasury";
|
|
29
26
|
arbitration: "arbitration";
|
|
30
|
-
progress: "progress";
|
|
31
27
|
allocation: "allocation";
|
|
28
|
+
treasury: "treasury";
|
|
29
|
+
order: "order";
|
|
30
|
+
machine: "machine";
|
|
31
|
+
progress: "progress";
|
|
32
32
|
passport: "passport";
|
|
33
33
|
}>>;
|
|
34
34
|
params: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as a394a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a394a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a394a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.0.0';export function getSchemaVersions(){return{'sdk':SDK_SCHEMA_VERSION,'mcp':MCP_SCHEMA_VERSION};}export function checkClientSchemaCompatibility(a,b={}){const c=getSchemaVersions(),d={'compatible':!![],'warnings':[],'errors':[],'versions':c,'client_version':a};if(!a)return d;const e=checkSchemaCompatibility(a,c['sdk']);if(!e['compatible']){d['compatible']=![];const g='SDK\x20schema\x20incompatibility:\x20'+e['reason'];b['mode']==='strict'?d['errors']['push'](g):d['warnings']['push'](g);}const f=checkSchemaCompatibility(a,c['mcp']);if(!f['compatible']){d['compatible']=![];const h='MCP\x20schema\x20incompatibility:\x20'+f['reason'];b['mode']==='strict'?d['errors']['push'](h):d['warnings']['push'](h);}return d;}export function attachSchemaWarning(a,b){if(b['warnings']['length']===0x0&&b['errors']['length']===0x0)return a;const c=[];b['warnings']['length']>0x0&&c['push'](...b['warnings']);b['errors']['length']>0x0&&c['push'](...b['errors']);const d=a['semantic']?{...a['semantic'],'warnings':[...a['semantic']['warnings']||[],...c]}:undefined;return{...a,'semantic':d,'schema_warning':{'compatible':b['compatible'],'warnings':c,'client_version':b['client_version'],'server_versions':b['versions']}};}
|
|
@@ -6,9 +6,9 @@ export declare const WatchOperationInputSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
6
6
|
scenario: z.ZodOptional<z.ZodEnum<{
|
|
7
7
|
account: "account";
|
|
8
8
|
permission: "permission";
|
|
9
|
-
order: "order";
|
|
10
9
|
service: "service";
|
|
11
10
|
arbitration: "arbitration";
|
|
11
|
+
order: "order";
|
|
12
12
|
progress: "progress";
|
|
13
13
|
demand: "demand";
|
|
14
14
|
generic: "generic";
|
|
@@ -32,9 +32,9 @@ export declare const WatchOperationInputSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
32
32
|
scenario: z.ZodOptional<z.ZodEnum<{
|
|
33
33
|
account: "account";
|
|
34
34
|
permission: "permission";
|
|
35
|
-
order: "order";
|
|
36
35
|
service: "service";
|
|
37
36
|
arbitration: "arbitration";
|
|
37
|
+
order: "order";
|
|
38
38
|
progress: "progress";
|
|
39
39
|
demand: "demand";
|
|
40
40
|
generic: "generic";
|
|
@@ -64,6 +64,7 @@ export interface GuardSemanticsPartyEvaluation {
|
|
|
64
64
|
is_mutable_onchain: boolean;
|
|
65
65
|
}>;
|
|
66
66
|
query_dependencies: number[];
|
|
67
|
+
unresolved_queries: Array<number | string>;
|
|
67
68
|
has_time_conditions: boolean;
|
|
68
69
|
has_signer_constraints: boolean;
|
|
69
70
|
has_rely_composition: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a407a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';const __filename=fileURLToPath(import.meta.url),__dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),GUARD_TEMPLATES_PATH_SCRIPTS=resolve(__dirname,'../../scripts/guard-templates.json'),GUARD_TEMPLATES_PATH_DIST=resolve(__dirname,'../../dist/schemas/guard-templates.json'),GUARD_TEMPLATES_PATH=existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)?GUARD_TEMPLATES_PATH_SCRIPTS:GUARD_TEMPLATES_PATH_DIST,WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}export function getSchemaIndex(){try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return JSON['parse'](b);}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}export function getSchema(a){try{let b=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(b)&&(b=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getOutputSchema(a){try{const b=join(SCHEMAS_DIR,a+'.output.json');if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getGuardTemplates(a){try{if(!existsSync(GUARD_TEMPLATES_PATH))return null;const b=readFileSync(GUARD_TEMPLATES_PATH,'utf-8'),c=JSON['parse'](b);if(!a)return{'version':c['version'],'description':c['description'],'templates':(c['templates']||[])['map'](e=>({'name':e['name'],'title':e['title'],'description':e['description'],'use_case':e['use_case']})),'query_reference':c['query_reference'],'node_return_types':c['node_return_types']};const d=(c['templates']||[])['find'](e=>e['name']===a);if(!d)return null;return d;}catch{return null;}}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['find'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');l&&b['push']('Common\x20fields\x20per\x20variant:\x20'+Object['keys'](l['properties'])['join'](',\x20')+'\x20—\x20'+'inspect\x20a\x20branch\x20via\x20action=\x27get_field\x27\x20with\x20field_path.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':g?'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found.\x20Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.':'Guard\x20templates\x20file\x20not\x20found.\x20Ensure\x20scripts/guard-templates.json\x20exists.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.','Available\x20template\x20names:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a407a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const O=getOutputSchema(c);if(!O){const Q=listSchemas(),R=Q['find'](T=>T['name']===c);if(R)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20has\x20no\x20output\x20schema\x20file.\x20The\x20tool\x20may\x20not\x20declare\x20an\x20outputSchema,\x20or\x20the\x20schema\x20file\x20was\x20not\x20generated.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const S=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':S['length']>0x0?S['map'](T=>'Did\x20you\x20mean:\x20'+T['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const T=writeResponseToFile(O,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const P=autoOverflowToFile(O,c);if(P)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](P['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':P['absolute_path'],'inline_summary':P['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+P['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+P['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':O,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](j=>({'identifier':j['identifier'],'name':j['name'],'value_type':j['value_type']??'Address','b_submission':j['b_submission']??![],'value':j['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set();let g=![],h=![];walkGuardTree(a['root'],j=>{if(j['type']==='context'){if(j['context']==='Clock')g=!![];if(j['context']==='Signer')h=!![];}j['type']==='query'&&typeof j['query']==='number'&&f['add'](j['query']);});const i={'submission_requirements':(a['table']??[])['filter'](j=>j['b_submission']===!![])['map'](j=>({'identifier':j['identifier'],'value_type':j['value_type'],'object_type':j['object_type'],'name':j['name']})),'data_sources':(a['table']??[])['filter'](j=>j['b_submission']!==!![])['map'](j=>({'identifier':j['identifier'],'kind':j['is_system_address']?'system_address':j['object_type']?'object':'fixed_value','value_type':j['value_type'],'object_type':j['object_type'],'name':j['name'],'is_mutable_onchain':j['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((j,k)=>j-k),'has_time_conditions':g,'has_signer_constraints':h,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':i};}export{formatLintResult};
|
|
1
|
+
import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a405a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';import{getGuardQueryByIdOrName}from'../schema/utils/guard-query-utils.js';const __filename=fileURLToPath(import.meta.url),__dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),GUARD_TEMPLATES_PATH_SCRIPTS=resolve(__dirname,'../../scripts/guard-templates.json'),GUARD_TEMPLATES_PATH_DIST=resolve(__dirname,'../../dist/schemas/guard-templates.json'),GUARD_TEMPLATES_PATH=existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)?GUARD_TEMPLATES_PATH_SCRIPTS:GUARD_TEMPLATES_PATH_DIST,WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}export function getSchemaIndex(){try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return JSON['parse'](b);}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}export function getSchema(a){try{let b=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(b)&&(b=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getOutputSchema(a){try{const b=join(SCHEMAS_DIR,a+'.output.json');if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getGuardTemplates(a){try{if(!existsSync(GUARD_TEMPLATES_PATH))return null;const b=readFileSync(GUARD_TEMPLATES_PATH,'utf-8'),c=JSON['parse'](b);if(!a)return{'version':c['version'],'description':c['description'],'templates':(c['templates']||[])['map'](e=>({'name':e['name'],'title':e['title'],'description':e['description'],'use_case':e['use_case']})),'query_reference':c['query_reference'],'node_return_types':c['node_return_types']};const d=(c['templates']||[])['find'](e=>e['name']===a);if(!d)return null;return d;}catch{return null;}}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['find'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');l&&b['push']('Common\x20fields\x20per\x20variant:\x20'+Object['keys'](l['properties'])['join'](',\x20')+'\x20—\x20'+'inspect\x20a\x20branch\x20via\x20action=\x27get_field\x27\x20with\x20field_path.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':g?'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found.\x20Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.':'Guard\x20templates\x20file\x20not\x20found.\x20Ensure\x20scripts/guard-templates.json\x20exists.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.','Available\x20template\x20names:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a405a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const O=getOutputSchema(c);if(!O){const Q=listSchemas(),R=Q['find'](T=>T['name']===c);if(R)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20has\x20no\x20output\x20schema\x20file.\x20The\x20tool\x20may\x20not\x20declare\x20an\x20outputSchema,\x20or\x20the\x20schema\x20file\x20was\x20not\x20generated.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const S=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':S['length']>0x0?S['map'](T=>'Did\x20you\x20mean:\x20'+T['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const T=writeResponseToFile(O,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const P=autoOverflowToFile(O,c);if(P)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](P['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':P['absolute_path'],'inline_summary':P['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+P['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+P['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':O,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](k=>({'identifier':k['identifier'],'name':k['name'],'value_type':k['value_type']??'Address','b_submission':k['b_submission']??![],'value':k['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set(),g=[];let h=![],i=![];walkGuardTree(a['root'],k=>{if(k['type']==='context'){if(k['context']==='Clock')h=!![];if(k['context']==='Signer')i=!![];}if(k['type']==='query'&&k['query']!==undefined&&k['query']!==null){if(typeof k['query']==='number'){const l=getGuardQueryByIdOrName(k['query']);if(l)f['add'](l['id']);else g['push'](k['query']);}else{const m=getGuardQueryByIdOrName(k['query']);if(m)f['add'](m['id']);else g['push'](k['query']);}}});const j={'submission_requirements':(a['table']??[])['filter'](k=>k['b_submission']===!![])['map'](k=>({'identifier':k['identifier'],'value_type':k['value_type'],'object_type':k['object_type'],'name':k['name']})),'data_sources':(a['table']??[])['filter'](k=>k['b_submission']!==!![])['map'](k=>({'identifier':k['identifier'],'kind':k['is_system_address']?'system_address':k['object_type']?'object':'fixed_value','value_type':k['value_type'],'object_type':k['object_type'],'name':k['name'],'is_mutable_onchain':k['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((k,l)=>k-l),'unresolved_queries':g,'has_time_conditions':h,'has_signer_constraints':i,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':j};}export{formatLintResult};
|
|
@@ -3335,7 +3335,7 @@
|
|
|
3335
3335
|
"description": "Business meaning of advancing to this node. Example: 'Guide starts the day service'"
|
|
3336
3336
|
},
|
|
3337
3337
|
"gains": {
|
|
3338
|
-
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement
|
|
3338
|
+
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement unlocked — funds releasable to provider via an explicit allocation step']",
|
|
3339
3339
|
"type": "array",
|
|
3340
3340
|
"items": {
|
|
3341
3341
|
"type": "string"
|
|
@@ -3582,7 +3582,7 @@
|
|
|
3582
3582
|
"description": "Business meaning of advancing to this node. Example: 'Guide starts the day service'"
|
|
3583
3583
|
},
|
|
3584
3584
|
"gains": {
|
|
3585
|
-
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement
|
|
3585
|
+
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement unlocked — funds releasable to provider via an explicit allocation step']",
|
|
3586
3586
|
"type": "array",
|
|
3587
3587
|
"items": {
|
|
3588
3588
|
"type": "string"
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"type": "string",
|
|
36
36
|
"description": "Business-model variant slug."
|
|
37
37
|
},
|
|
38
|
+
"product_ref": {
|
|
39
|
+
"description": "Benchmark product slug this archetype models (e.g. 'amazon'). The only sanctioned company name; users can pick a template by naming the incumbent product.",
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
38
42
|
"archetype": {
|
|
39
43
|
"type": "string",
|
|
40
44
|
"enum": [
|
|
@@ -141,6 +145,58 @@
|
|
|
141
145
|
"passed": {
|
|
142
146
|
"type": "boolean"
|
|
143
147
|
},
|
|
148
|
+
"finding_count": {
|
|
149
|
+
"type": "number"
|
|
150
|
+
},
|
|
151
|
+
"findings_by_severity": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"propertyNames": {
|
|
154
|
+
"type": "string"
|
|
155
|
+
},
|
|
156
|
+
"additionalProperties": {
|
|
157
|
+
"type": "number"
|
|
158
|
+
},
|
|
159
|
+
"description": "Finding count keyed by severity."
|
|
160
|
+
},
|
|
161
|
+
"findings": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"items": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"properties": {
|
|
166
|
+
"rule_id": {
|
|
167
|
+
"description": "Rule id when known (e.g. 'R-M3-01', 'R1').",
|
|
168
|
+
"type": "string"
|
|
169
|
+
},
|
|
170
|
+
"severity": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"enum": [
|
|
173
|
+
"low",
|
|
174
|
+
"medium",
|
|
175
|
+
"high",
|
|
176
|
+
"critical"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"title": {
|
|
180
|
+
"type": "string"
|
|
181
|
+
},
|
|
182
|
+
"detail": {
|
|
183
|
+
"type": "string"
|
|
184
|
+
},
|
|
185
|
+
"suggestion": {
|
|
186
|
+
"type": "string"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": [
|
|
190
|
+
"severity",
|
|
191
|
+
"title",
|
|
192
|
+
"detail",
|
|
193
|
+
"suggestion"
|
|
194
|
+
],
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"description": "One pre-deploy risk finding."
|
|
197
|
+
},
|
|
198
|
+
"description": "Every finding with its rule id, detail and suggestion."
|
|
199
|
+
},
|
|
144
200
|
"red_flags": {
|
|
145
201
|
"type": "array",
|
|
146
202
|
"items": {
|
|
@@ -151,10 +207,13 @@
|
|
|
151
207
|
"required": [
|
|
152
208
|
"risk_level",
|
|
153
209
|
"passed",
|
|
210
|
+
"finding_count",
|
|
211
|
+
"findings_by_severity",
|
|
212
|
+
"findings",
|
|
154
213
|
"red_flags"
|
|
155
214
|
],
|
|
156
215
|
"additionalProperties": false,
|
|
157
|
-
"description": "Pre-deploy scan summary (generation only runs when passed)."
|
|
216
|
+
"description": "Pre-deploy scan summary (generation/apply only runs when passed)."
|
|
158
217
|
},
|
|
159
218
|
"plan": {
|
|
160
219
|
"type": "object",
|
|
@@ -750,6 +809,58 @@
|
|
|
750
809
|
"passed": {
|
|
751
810
|
"type": "boolean"
|
|
752
811
|
},
|
|
812
|
+
"finding_count": {
|
|
813
|
+
"type": "number"
|
|
814
|
+
},
|
|
815
|
+
"findings_by_severity": {
|
|
816
|
+
"type": "object",
|
|
817
|
+
"propertyNames": {
|
|
818
|
+
"type": "string"
|
|
819
|
+
},
|
|
820
|
+
"additionalProperties": {
|
|
821
|
+
"type": "number"
|
|
822
|
+
},
|
|
823
|
+
"description": "Finding count keyed by severity."
|
|
824
|
+
},
|
|
825
|
+
"findings": {
|
|
826
|
+
"type": "array",
|
|
827
|
+
"items": {
|
|
828
|
+
"type": "object",
|
|
829
|
+
"properties": {
|
|
830
|
+
"rule_id": {
|
|
831
|
+
"description": "Rule id when known (e.g. 'R-M3-01', 'R1').",
|
|
832
|
+
"type": "string"
|
|
833
|
+
},
|
|
834
|
+
"severity": {
|
|
835
|
+
"type": "string",
|
|
836
|
+
"enum": [
|
|
837
|
+
"low",
|
|
838
|
+
"medium",
|
|
839
|
+
"high",
|
|
840
|
+
"critical"
|
|
841
|
+
]
|
|
842
|
+
},
|
|
843
|
+
"title": {
|
|
844
|
+
"type": "string"
|
|
845
|
+
},
|
|
846
|
+
"detail": {
|
|
847
|
+
"type": "string"
|
|
848
|
+
},
|
|
849
|
+
"suggestion": {
|
|
850
|
+
"type": "string"
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
"required": [
|
|
854
|
+
"severity",
|
|
855
|
+
"title",
|
|
856
|
+
"detail",
|
|
857
|
+
"suggestion"
|
|
858
|
+
],
|
|
859
|
+
"additionalProperties": false,
|
|
860
|
+
"description": "One pre-deploy risk finding."
|
|
861
|
+
},
|
|
862
|
+
"description": "Every finding with its rule id, detail and suggestion."
|
|
863
|
+
},
|
|
753
864
|
"red_flags": {
|
|
754
865
|
"type": "array",
|
|
755
866
|
"items": {
|
|
@@ -760,10 +871,13 @@
|
|
|
760
871
|
"required": [
|
|
761
872
|
"risk_level",
|
|
762
873
|
"passed",
|
|
874
|
+
"finding_count",
|
|
875
|
+
"findings_by_severity",
|
|
876
|
+
"findings",
|
|
763
877
|
"red_flags"
|
|
764
878
|
],
|
|
765
879
|
"additionalProperties": false,
|
|
766
|
-
"description": "Pre-deploy scan summary (apply only runs when passed)."
|
|
880
|
+
"description": "Pre-deploy scan summary (generation/apply only runs when passed)."
|
|
767
881
|
},
|
|
768
882
|
"plan": {
|
|
769
883
|
"type": "object",
|
|
@@ -23,16 +23,8 @@
|
|
|
23
23
|
"type": "string"
|
|
24
24
|
},
|
|
25
25
|
"industry": {
|
|
26
|
-
"description": "Industry filter for template_list; industry hint for migration_import.",
|
|
27
|
-
"type": "string"
|
|
28
|
-
"enum": [
|
|
29
|
-
"freelance",
|
|
30
|
-
"rental",
|
|
31
|
-
"education",
|
|
32
|
-
"travel",
|
|
33
|
-
"subscription",
|
|
34
|
-
"retail"
|
|
35
|
-
]
|
|
26
|
+
"description": "Industry filter for template_list; industry hint for migration_import. Any registered industry is accepted (builtin: freelance, rental, education, travel, subscription, retail; plus custom industries registered via industry packs). Aliases are resolved (e.g. 'ecommerce' → 'retail').",
|
|
27
|
+
"type": "string"
|
|
36
28
|
},
|
|
37
29
|
"description": {
|
|
38
30
|
"description": "Natural-language business/competitor description (required for migration_import; used by template_generate as the intent text).",
|
|
@@ -1043,7 +1043,7 @@
|
|
|
1043
1043
|
"description": "Business meaning of advancing to this node. Example: 'Guide starts the day service'"
|
|
1044
1044
|
},
|
|
1045
1045
|
"gains": {
|
|
1046
|
-
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement
|
|
1046
|
+
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement unlocked — funds releasable to provider via an explicit allocation step']",
|
|
1047
1047
|
"type": "array",
|
|
1048
1048
|
"items": {
|
|
1049
1049
|
"type": "string"
|
|
@@ -1290,7 +1290,7 @@
|
|
|
1290
1290
|
"description": "Business meaning of advancing to this node. Example: 'Guide starts the day service'"
|
|
1291
1291
|
},
|
|
1292
1292
|
"gains": {
|
|
1293
|
-
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement
|
|
1293
|
+
"description": "Gains for the caller if this option is chosen (K3 Game G1 gain separation). Example: ['Settlement unlocked — funds releasable to provider via an explicit allocation step']",
|
|
1294
1294
|
"type": "array",
|
|
1295
1295
|
"items": {
|
|
1296
1296
|
"type": "string"
|
|
@@ -253,16 +253,7 @@
|
|
|
253
253
|
},
|
|
254
254
|
"industry": {
|
|
255
255
|
"type": "string",
|
|
256
|
-
"
|
|
257
|
-
"freelance",
|
|
258
|
-
"rental",
|
|
259
|
-
"education",
|
|
260
|
-
"travel",
|
|
261
|
-
"subscription",
|
|
262
|
-
"retail",
|
|
263
|
-
"general",
|
|
264
|
-
"custom"
|
|
265
|
-
],
|
|
256
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
266
257
|
"description": "Industry scenario."
|
|
267
258
|
},
|
|
268
259
|
"industry_confidence": {
|
|
@@ -428,16 +419,7 @@
|
|
|
428
419
|
},
|
|
429
420
|
"industry": {
|
|
430
421
|
"type": "string",
|
|
431
|
-
"
|
|
432
|
-
"freelance",
|
|
433
|
-
"rental",
|
|
434
|
-
"education",
|
|
435
|
-
"travel",
|
|
436
|
-
"subscription",
|
|
437
|
-
"retail",
|
|
438
|
-
"general",
|
|
439
|
-
"custom"
|
|
440
|
-
],
|
|
422
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
441
423
|
"description": "Industry scenario."
|
|
442
424
|
},
|
|
443
425
|
"industry_confidence": {
|
|
@@ -618,16 +600,7 @@
|
|
|
618
600
|
},
|
|
619
601
|
"industry": {
|
|
620
602
|
"type": "string",
|
|
621
|
-
"
|
|
622
|
-
"freelance",
|
|
623
|
-
"rental",
|
|
624
|
-
"education",
|
|
625
|
-
"travel",
|
|
626
|
-
"subscription",
|
|
627
|
-
"retail",
|
|
628
|
-
"general",
|
|
629
|
-
"custom"
|
|
630
|
-
],
|
|
603
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
631
604
|
"description": "Industry scenario."
|
|
632
605
|
},
|
|
633
606
|
"industry_confidence": {
|
|
@@ -795,16 +768,7 @@
|
|
|
795
768
|
},
|
|
796
769
|
"industry": {
|
|
797
770
|
"type": "string",
|
|
798
|
-
"
|
|
799
|
-
"freelance",
|
|
800
|
-
"rental",
|
|
801
|
-
"education",
|
|
802
|
-
"travel",
|
|
803
|
-
"subscription",
|
|
804
|
-
"retail",
|
|
805
|
-
"general",
|
|
806
|
-
"custom"
|
|
807
|
-
],
|
|
771
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
808
772
|
"description": "Industry scenario."
|
|
809
773
|
},
|
|
810
774
|
"industry_confidence": {
|
|
@@ -986,16 +950,7 @@
|
|
|
986
950
|
},
|
|
987
951
|
"industry": {
|
|
988
952
|
"type": "string",
|
|
989
|
-
"
|
|
990
|
-
"freelance",
|
|
991
|
-
"rental",
|
|
992
|
-
"education",
|
|
993
|
-
"travel",
|
|
994
|
-
"subscription",
|
|
995
|
-
"retail",
|
|
996
|
-
"general",
|
|
997
|
-
"custom"
|
|
998
|
-
],
|
|
953
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
999
954
|
"description": "Industry scenario."
|
|
1000
955
|
},
|
|
1001
956
|
"industry_confidence": {
|
|
@@ -1391,16 +1346,7 @@
|
|
|
1391
1346
|
},
|
|
1392
1347
|
"industry": {
|
|
1393
1348
|
"type": "string",
|
|
1394
|
-
"
|
|
1395
|
-
"freelance",
|
|
1396
|
-
"rental",
|
|
1397
|
-
"education",
|
|
1398
|
-
"travel",
|
|
1399
|
-
"subscription",
|
|
1400
|
-
"retail",
|
|
1401
|
-
"general",
|
|
1402
|
-
"custom"
|
|
1403
|
-
],
|
|
1349
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
1404
1350
|
"description": "Industry scenario."
|
|
1405
1351
|
},
|
|
1406
1352
|
"industry_confidence": {
|
|
@@ -2087,16 +2033,7 @@
|
|
|
2087
2033
|
},
|
|
2088
2034
|
"industry": {
|
|
2089
2035
|
"type": "string",
|
|
2090
|
-
"
|
|
2091
|
-
"freelance",
|
|
2092
|
-
"rental",
|
|
2093
|
-
"education",
|
|
2094
|
-
"travel",
|
|
2095
|
-
"subscription",
|
|
2096
|
-
"retail",
|
|
2097
|
-
"general",
|
|
2098
|
-
"custom"
|
|
2099
|
-
],
|
|
2036
|
+
"pattern": "^[a-z][a-z0-9_]*$",
|
|
2100
2037
|
"description": "Industry scenario."
|
|
2101
2038
|
},
|
|
2102
2039
|
"industry_confidence": {
|
|
@@ -623,20 +623,9 @@
|
|
|
623
623
|
"maxLength": 2000
|
|
624
624
|
},
|
|
625
625
|
"project_industry": {
|
|
626
|
-
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do).
|
|
626
|
+
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do). Any registered industry is accepted — builtin: 'general', 'retail', 'retail_d2c', 'service', 'rental', 'freelance', 'education', 'travel', 'subscription', 'custom' — plus custom industries registered via industry packs.",
|
|
627
627
|
"type": "string",
|
|
628
|
-
"
|
|
629
|
-
"general",
|
|
630
|
-
"retail",
|
|
631
|
-
"retail_d2c",
|
|
632
|
-
"service",
|
|
633
|
-
"rental",
|
|
634
|
-
"freelance",
|
|
635
|
-
"education",
|
|
636
|
-
"travel",
|
|
637
|
-
"subscription",
|
|
638
|
-
"custom"
|
|
639
|
-
]
|
|
628
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
640
629
|
},
|
|
641
630
|
"target_objects": {
|
|
642
631
|
"description": "Optional explicit target objects (entry_ids or object_type names). When provided, puzzle snapshots are restricted to these objects.",
|
|
@@ -723,20 +712,9 @@
|
|
|
723
712
|
"maxLength": 2000
|
|
724
713
|
},
|
|
725
714
|
"project_industry": {
|
|
726
|
-
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do).
|
|
715
|
+
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do). Any registered industry is accepted — builtin: 'general', 'retail', 'retail_d2c', 'service', 'rental', 'freelance', 'education', 'travel', 'subscription', 'custom' — plus custom industries registered via industry packs.",
|
|
727
716
|
"type": "string",
|
|
728
|
-
"
|
|
729
|
-
"general",
|
|
730
|
-
"retail",
|
|
731
|
-
"retail_d2c",
|
|
732
|
-
"service",
|
|
733
|
-
"rental",
|
|
734
|
-
"freelance",
|
|
735
|
-
"education",
|
|
736
|
-
"travel",
|
|
737
|
-
"subscription",
|
|
738
|
-
"custom"
|
|
739
|
-
]
|
|
717
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
740
718
|
},
|
|
741
719
|
"severity_threshold": {
|
|
742
720
|
"description": "Severity threshold (default 'high'). Risks at or above this level block deployment (status RISK_BLOCKED).",
|
|
@@ -1090,20 +1068,9 @@
|
|
|
1090
1068
|
"maxLength": 2000
|
|
1091
1069
|
},
|
|
1092
1070
|
"project_industry": {
|
|
1093
|
-
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do).
|
|
1071
|
+
"description": "Industry tag. Drives industry-specific risk calibration (e.g. 'freelance' does NOT require compensation_fund, while 'rental'/'travel' do). Any registered industry is accepted — builtin: 'general', 'retail', 'retail_d2c', 'service', 'rental', 'freelance', 'education', 'travel', 'subscription', 'custom' — plus custom industries registered via industry packs.",
|
|
1094
1072
|
"type": "string",
|
|
1095
|
-
"
|
|
1096
|
-
"general",
|
|
1097
|
-
"retail",
|
|
1098
|
-
"retail_d2c",
|
|
1099
|
-
"service",
|
|
1100
|
-
"rental",
|
|
1101
|
-
"freelance",
|
|
1102
|
-
"education",
|
|
1103
|
-
"travel",
|
|
1104
|
-
"subscription",
|
|
1105
|
-
"custom"
|
|
1106
|
-
]
|
|
1073
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
1107
1074
|
},
|
|
1108
1075
|
"guide_state": {
|
|
1109
1076
|
"description": "Wizard state from a prior merchant_guide result. Pass back UNCHANGED on every subsequent call. The handler re-runs the pipeline deterministically and advances to the furthest reachable step.",
|