@wowok/agent-mcp 3.0.0 → 3.0.2
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/communication/evidence.d.ts +6 -0
- package/dist/communication/evidence.js +1 -0
- package/dist/evaluation/acceptance.d.ts +24 -0
- package/dist/evaluation/acceptance.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +3 -2
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/service-risk.d.ts +2 -1
- package/dist/evaluation/builtins/service-risk.js +1 -1
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +1 -1
- package/dist/evaluation/match-operation.d.ts +14 -0
- package/dist/evaluation/match-operation.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/goal/GoalClassifier.js +1 -1
- package/dist/goal/GoalEngine.d.ts +8 -0
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/types.d.ts +1 -1
- package/dist/harness/auto-escalation.d.ts +0 -12
- package/dist/harness/auto-escalation.js +1 -1
- package/dist/harness/index.d.ts +1 -14
- package/dist/harness/index.js +1 -1
- package/dist/harness/types.d.ts +0 -38
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/KeeperScan.d.ts +39 -0
- package/dist/keeper/KeeperScan.js +1 -0
- package/dist/keeper/KeeperStore.d.ts +43 -0
- package/dist/keeper/KeeperStore.js +1 -0
- package/dist/keeper/detectors.d.ts +23 -0
- package/dist/keeper/detectors.js +1 -0
- package/dist/keeper/keeper.spec.d.ts +1 -0
- package/dist/keeper/keeper.spec.js +1 -0
- package/dist/keeper/types.d.ts +65 -0
- package/dist/keeper/types.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -1
- package/dist/knowledge/event-semantics.d.ts +3 -0
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/event-semantics.spec.d.ts +1 -0
- package/dist/knowledge/event-semantics.spec.js +1 -0
- package/dist/knowledge/evidence-review.d.ts +23 -0
- package/dist/knowledge/evidence-review.js +1 -1
- package/dist/knowledge/examples-scanner-cli.js +1 -1
- package/dist/knowledge/examples-scanner.js +1 -1
- package/dist/knowledge/guard-bytecode-spec.d.ts +82 -0
- package/dist/knowledge/guard-bytecode-spec.js +1 -0
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/index.d.ts +10 -6
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -1
- package/dist/knowledge/migration-preflight.d.ts +27 -0
- package/dist/knowledge/migration-preflight.js +1 -0
- package/dist/knowledge/scenario-modes.d.ts +1 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +20 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.d.ts +1 -0
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/monitor/SuggestionBridge.d.ts +1 -1
- package/dist/monitor/SuggestionBridge.js +1 -1
- package/dist/monitor/SuggestionBridge.spec.d.ts +1 -0
- package/dist/monitor/SuggestionBridge.spec.js +1 -0
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.d.ts +0 -1
- package/dist/monitor/types.js +1 -1
- package/dist/participation/employee-kpi.d.ts +12 -0
- package/dist/participation/employee-kpi.js +1 -1
- package/dist/participation/employee-kpi.spec.d.ts +1 -0
- package/dist/participation/employee-kpi.spec.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +19 -6
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/relationship/derivation.d.ts +6 -0
- package/dist/relationship/derivation.js +1 -1
- package/dist/relationship/derivation.spec.d.ts +1 -0
- package/dist/relationship/derivation.spec.js +1 -0
- package/dist/role/index.d.ts +2 -2
- package/dist/role/index.js +1 -1
- package/dist/role/model.d.ts +2 -1
- package/dist/role/model.js +1 -1
- package/dist/role/types.d.ts +5 -0
- package/dist/rules.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +61 -1
- package/dist/schema/employee/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +70 -5
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +43 -7
- package/dist/schema/industry-pack/modes.d.ts +42 -6
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +3 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +475 -0
- package/dist/schema/keeper/index.js +1 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +34 -0
- package/dist/schema/query/bi.d.ts +188 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +48 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +2 -11
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/skills-recommendation.js +1 -1
- package/dist/schema/watch/index.d.ts +4 -0
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +33 -14
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/employee_operation.output.json +100 -0
- package/dist/schemas/employee_operation.schema.json +148 -5
- package/dist/schemas/evaluation_operation.output.json +135 -9
- package/dist/schemas/evaluation_operation.schema.json +176 -7
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +158 -32
- package/dist/schemas/intent_radar.output.json +2 -0
- package/dist/schemas/intent_radar.schema.json +1 -0
- package/dist/schemas/keeper_operation.output.json +1274 -0
- package/dist/schemas/keeper_operation.schema.json +359 -0
- package/dist/schemas/messenger_operation.schema.json +8 -0
- package/dist/schemas/onchain_events.output.json +55 -11
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_table_data.output.json +59 -0
- package/dist/schemas/query_toolkit.output.json +428 -0
- package/dist/schemas/query_toolkit.schema.json +59 -0
- package/dist/schemas/schema_query.output.json +1 -64
- package/dist/schemas/schema_query.schema.json +18 -3
- package/dist/schemas/watch_operation.output.json +21 -1
- package/dist/task/playbook.js +1 -1
- package/dist/task/types.d.ts +1 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/employee.d.ts +6 -0
- package/dist/tools/handlers/employee.js +1 -1
- package/dist/tools/handlers/employee.spec.d.ts +1 -0
- package/dist/tools/handlers/employee.spec.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.d.ts +1 -0
- package/dist/tools/handlers/evaluation.spec.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/keeper.d.ts +12 -0
- package/dist/tools/handlers/keeper.js +1 -0
- package/dist/tools/handlers/messenger.js +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/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.d.ts +2 -0
- package/dist/tools/registry/agent.js +1 -0
- package/dist/tools/registry/bridge.d.ts +2 -0
- package/dist/tools/registry/bridge.js +1 -0
- package/dist/tools/registry/business.d.ts +2 -0
- package/dist/tools/registry/business.js +1 -0
- package/dist/tools/registry/config.d.ts +2 -0
- package/dist/tools/registry/config.js +1 -0
- package/dist/tools/registry/files.d.ts +2 -0
- package/dist/tools/registry/files.js +1 -0
- package/dist/tools/registry/identity.d.ts +2 -0
- package/dist/tools/registry/identity.js +1 -0
- package/dist/tools/registry/local.d.ts +2 -0
- package/dist/tools/registry/local.js +1 -0
- package/dist/tools/registry/messenger.d.ts +2 -0
- package/dist/tools/registry/messenger.js +1 -0
- package/dist/tools/registry/monitor.d.ts +2 -0
- package/dist/tools/registry/monitor.js +1 -0
- package/dist/tools/registry/onchain.d.ts +2 -0
- package/dist/tools/registry/onchain.js +1 -0
- package/dist/tools/registry/query.d.ts +2 -0
- package/dist/tools/registry/query.js +1 -0
- package/dist/tools/registry/trust.d.ts +2 -0
- package/dist/tools/registry/trust.js +1 -0
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/examples/arbitration-dispute-create.json +0 -41
- package/dist/examples/arbitration-vote-weighted.json +0 -35
- package/dist/examples/arbitration-voting-guard-add.json +0 -38
- package/dist/examples/demand-present-service.json +0 -33
- package/dist/examples/education-contact-create.json +0 -40
- package/dist/examples/freelance-contact-create.json +0 -40
- package/dist/examples/gen-passport-verify-guard.json +0 -48
- package/dist/examples/guard-template-balance-check.json +0 -59
- package/dist/examples/guard-template-time-lock.json +0 -60
- package/dist/examples/insurance-guard-claim-timelock.json +0 -75
- package/dist/examples/insurance-guard-withdraw-allocation.json +0 -96
- package/dist/examples/insurance-machine-create.json +0 -75
- package/dist/examples/insurance-service-allocators.json +0 -55
- package/dist/examples/machine-multisig-threshold.json +0 -87
- package/dist/examples/machine-publish.json +0 -30
- package/dist/examples/machine-template-7node-rental.json +0 -119
- package/dist/examples/payment-scenario-bound.json +0 -45
- package/dist/examples/rental-ziroom-machine-create.json +0 -148
- package/dist/examples/rental-ziroom-permission-create.json +0 -41
- package/dist/examples/rental-ziroom-service-create.json +0 -36
- package/dist/examples/retail-adv-guard-customer-win-create.json +0 -80
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +0 -65
- package/dist/examples/retail-adv-guard-reward-timeout-create.json +0 -92
- package/dist/examples/retail-adv-reward-guard-add.json +0 -51
- package/dist/examples/retail-myshop-allocation-activate.json +0 -55
- package/dist/examples/retail-myshop-arbitration-create.json +0 -40
- package/dist/examples/retail-myshop-contact-create.json +0 -43
- package/dist/examples/retail-myshop-order-create.json +0 -56
- package/dist/examples/retail-myshop-progress-operate.json +0 -38
- package/dist/examples/retail-myshop-reward-create.json +0 -35
- package/dist/examples/retail-myshop-service-create.json +0 -38
- package/dist/examples/retail-myshop-service-customer-required.json +0 -31
- package/dist/examples/service-discount-issue.json +0 -46
- package/dist/examples/subscription-contact-create.json +0 -40
- package/dist/examples/threebody-guard-create.json +0 -56
- package/dist/examples/threebody-machine-create.json +0 -71
- package/dist/examples/threebody-permission-create.json +0 -38
- package/dist/examples/threebody-service-allocators.json +0 -48
- package/dist/examples/travel-guard-time-lock.json +0 -69
- package/dist/examples/travel-guard-weather-oracle.json +0 -70
- package/dist/examples/travel-machine-create.json +0 -135
- package/dist/examples/travel-repository-create.json +0 -47
- package/dist/examples/travel-service-create.json +0 -34
- package/dist/examples/travel-treasury-create.json +0 -34
- package/dist/examples/treasury-deposit.json +0 -37
- package/dist/examples/treasury-withdraw.json +0 -38
- package/dist/harness/plan.d.ts +0 -33
- package/dist/harness/plan.js +0 -1
- package/dist/knowledge/demand-matching.d.ts +0 -29
- package/dist/knowledge/demand-matching.js +0 -1
- package/dist/knowledge/guard-context.d.ts +0 -56
- package/dist/knowledge/guard-context.js +0 -1
- package/dist/knowledge/guard-migration.d.ts +0 -48
- package/dist/knowledge/guard-migration.js +0 -1
- package/dist/schemas/guard-node-schema.json +0 -1000
- package/dist/task/stage-gate.d.ts +0 -22
- package/dist/task/stage-gate.js +0 -1
package/dist/harness/plan.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const SCENARIO_REGISTRY=[{'name':'freelance','keywords':['freelance','service','deliverable','client','gig','consult','design','develop'],'description':'Service\x20delivery\x20with\x20escrow:\x20publish\x20→\x20order\x20→\x20deliver\x20→\x20accept\x20→\x20withdraw','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','description','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['state\x20graph','operators'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['guard\x20table','submission\x20fields'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['sharing\x20ratios','allocators'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'rental','keywords':['rent','rental','lease','property','item','deposit','tenant','landlord'],'description':'Item\x20rental\x20with\x20deposit:\x20publish\x20→\x20rent\x20→\x20inspect\x20→\x20return/refund','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','deposit\x20amount','rental\x20terms'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['rental\x20states','return/inspect\x20flow'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['return\x20guard','damage\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['deposit/refund\x20allocation','damage\x20compensation'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'retail','keywords':['retail','shop','store','ecommerce','buy','sell','product','digital','download','ebook','software','license','instant','content'],'description':'Instant\x20digital\x20delivery:\x20publish\x20→\x20buy\x20→\x20instant\x20delivery','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','price','delivery\x20method'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['instant\x20delivery\x20states'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['revenue\x20split'],'estimated_time':'3min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'travel','keywords':['travel','tour','trip','package','booking','itinerary','vacation','hotel'],'description':'Multi-stage\x20service\x20with\x20milestones:\x20publish\x20→\x20book\x20→\x20itinerary\x20→\x20complete','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','package\x20details','pricing\x20tiers'],'estimated_time':'5min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['booking\x20states','milestone\x20flow','cancellation'],'estimated_time':'15min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['booking\x20guard','cancellation\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['milestone\x20payments','refund\x20policy'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'education','keywords':['education','course','training','tutor','teach','learn','school','coach','class','lesson'],'description':'Long-cycle\x20education\x20with\x20milestones:\x20publish\x20→\x20enroll\x20→\x20teach\x20→\x20complete\x20→\x20certificate','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','course\x20details','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['enrollment\x20states','milestone\x20flow','completion'],'estimated_time':'15min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['enrollment\x20guard','completion\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['milestone\x20payments','refund\x20policy'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'subscription','keywords':['subscription','subscribe','membership','recurring','monthly','newsletter','patreon','tier'],'description':'Recurring\x20subscription\x20with\x20renewal:\x20publish\x20→\x20subscribe\x20→\x20renew\x20→\x20cancel','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','subscription\x20tiers','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['subscribe\x20states','renewal\x20flow','cancellation'],'estimated_time':'10min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['revenue\x20split'],'estimated_time':'3min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'general','keywords':[],'description':'Fallback\x20for\x20unmatched\x20scenarios\x20—\x20generic\x20service\x20template','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','description','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['state\x20graph'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['guard\x20requirements'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['sharing'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]}];export function classifyIntent(a){const b=a['toLowerCase']();let c=null,d=0x0,e=[];for(const f of SCENARIO_REGISTRY){if(f['keywords']['length']===0x0)continue;const g=f['keywords']['filter'](h=>b['includes'](h));g['length']>d&&(d=g['length'],c=f,e=g);}if(c&&d>0x0){const h=Math['min'](d/0x3,0x1);return{'scenario':c['name'],'matched_keywords':e,'confidence':h,'fallback':![]};}return{'scenario':'general','matched_keywords':[],'confidence':0.3,'fallback':!![]};}let nodeIdCounter=0x0;function nextNodeId(a){return nodeIdCounter++,a['toLowerCase']()+'_'+nodeIdCounter;}export function generateODG(a,b){const c=classifyIntent(a),d=SCENARIO_REGISTRY['find'](h=>h['name']===c['scenario'])??SCENARIO_REGISTRY[SCENARIO_REGISTRY['length']-0x1],e=d['objects']['map'](h=>({'id':nextNodeId(h['type']),'type':h['type'],'status':'not_created','reversible':h['reversible'],'dependencies':[],'user_decisions':h['user_decisions'],'risk_flags':h['risk_flags'],'estimated_time':h['estimated_time']})),f=new Map();for(const h of e){const i=d['objects']['find'](j=>j['type']===h['type'])?.['dependencies']??[];h['dependencies']=i['map'](j=>f['get'](j))['filter'](j=>j!==undefined),f['set'](h['type'],h['id']);}const g=d['phases']['map'](j=>{const k=e['filter'](l=>j['object_types']['includes'](l['type']))['map'](l=>l['id']);return{'name':j['name'],'objects':k};});return{'task_id':b??'task_'+Date['now'](),'scenario':c['scenario'],'objects':e,'phases':g};}const PROJECT_TO_ODG_TYPE={'service':'Service','machine':'Machine','guard':'Guard','permission':'Permission','reward':'Reward','arb':'Arbitration','progress':'Progress','treasury':'Treasury','demand':'Demand','repository':'Repository','contact':'Contact','order':'Order','allocation':'Allocation','personal':'Personal','payment':'Payment'};function toODGObjectType(a){const b=PROJECT_TO_ODG_TYPE[a];if(b)return b;return a['charAt'](0x0)['toUpperCase']()+a['slice'](0x1);}export function generateODGFromSemanticGraph(a,b){const c=a['nodes']['map'](l=>({'id':l['id'],'type':toODGObjectType(l['type']),'status':l['expectedState']?.['published']?'published':'not_created','reversible':l['type']!=='guard','dependencies':[],'address':l['address']})),d=new Map(c['map'](l=>[l['id'],l]));for(const l of a['edges']){const m=d['get'](l['from']);m&&d['has'](l['to'])&&!m['dependencies']['includes'](l['to'])&&m['dependencies']['push'](l['to']);}const e=new Set(c['map'](n=>n['id'])),f=new Map();for(const n of c){f['set'](n['id'],n['dependencies']['filter'](p=>e['has'](p))['length']);}const g=[];let h=c['filter'](p=>(f['get'](p['id'])??0x0)===0x0)['map'](p=>p['id']);const i=new Set();while(h['length']>0x0){for(const q of h)i['add'](q);g['push']({'name':'Phase\x20'+(g['length']+0x1),'objects':[...h]});const p=[];for(const r of c){if(i['has'](r['id'])||p['includes'](r['id']))continue;const s=r['dependencies']['filter'](t=>e['has'](t)&&!i['has'](t))['length'];if(s===0x0)p['push'](r['id']);}h=p;}const j=c['filter'](t=>!i['has'](t['id']))['map'](t=>t['id']);j['length']>0x0&&g['push']({'name':'Phase\x20'+(g['length']+0x1),'objects':j});const k=classifyIntent(a['businessIntent']?.['description']??'');return{'task_id':b??'task_'+Date['now'](),'scenario':k['scenario'],'objects':c,'phases':g};}export function identifyDecisionPoints(a){const b=[],c=SCENARIO_REGISTRY['find'](e=>e['name']===a['scenario']);b['push']({'round':'R1','question':'I\x27ve\x20classified\x20your\x20intent\x20as\x20\x22'+a['scenario']+'\x22.\x20Is\x20this\x20correct?','options':['Yes,\x20correct','No,\x20let\x20me\x20clarify']}),b['push']({'round':'R2','question':'Do\x20you\x20have\x20existing\x20Permission\x20objects\x20to\x20reuse,\x20or\x20should\x20I\x20create\x20a\x20new\x20one?','options':['Create\x20new','Reuse\x20existing','Show\x20me\x20what\x20I\x20have']}),b['push']({'round':'R3','question':'What\x20is\x20the\x20service\x20name,\x20description,\x20and\x20pricing\x20token?','options':['WOW\x20(default)','USDT','USDC','Custom\x20token'],'default':'WOW\x20(default)'});c?.['default_permissions']['arbiter']&&b['push']({'round':'R4','question':'Permission\x20model:\x20provider=1000,\x20customer\x20uses\x20namedOperator,\x20arbiter=1500.\x20Adjust?','options':['Use\x20defaults','Customize'],'default':'Use\x20defaults'});b['push']({'round':'R5','question':'What\x20are\x20the\x20service\x20states\x20and\x20transitions?\x20(entry\x20→\x20states\x20→\x20terminals)','options':['Use\x20scenario\x20template','Custom\x20design']});const d=a['objects']['filter'](e=>e['type']==='Guard');return d['length']>0x0&&b['push']({'round':'R6','question':d['length']+'\x20Guard(s)\x20needed.\x20What\x20should\x20each\x20Guard\x20verify?','options':['Withdrawal\x20guard','Refund\x20guard','Delivery\x20guard','Custom']}),b['push']({'round':'R7','question':'How\x20should\x20revenue\x20be\x20split?\x20(e.g.,\x20merchant\x2080%,\x20platform\x2020%)','options':['100%\x20to\x20merchant','80/20\x20split','Custom\x20split'],'default':'100%\x20to\x20merchant'}),b;}export function detectCycles(a){const b=new Set(),c=new Set(),d=[];function e(f,g){if(c['has'](f)){const i=g['indexOf'](f);return d['push'](...g['slice'](i),f),!![];}if(b['has'](f))return![];b['add'](f),c['add'](f);const h=a['objects']['find'](j=>j['id']===f);if(h)for(const j of h['dependencies']){if(e(j,[...g,f]))return!![];}return c['delete'](f),![];}for(const f of a['objects']){if(!b['has'](f['id'])){if(e(f['id'],[]))return d;}}return null;}export function identifyMigrationDecisions(a){const b=a?.['current_payment_token']??'WOW',c=a?.['from_network']??'testnet',d=a?.['to_network']??'mainnet';return[{'round':'M1','question':'Your\x20project\x20currently\x20uses\x20\x22'+b+'\x22\x20as\x20the\x20payment\x20token\x20on\x20'+c+'.\x20'+('When\x20migrating\x20to\x20'+d+',\x20do\x20you\x20want\x20to\x20keep\x20\x22'+b+'\x22\x20or\x20switch\x20to\x20a\x20stablecoin\x20')+'(e.g.\x20USDT,\x20available\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge)?','options':['Keep\x20'+b,'Switch\x20to\x20USDT','Switch\x20to\x20USDC','Other\x20stablecoin'],'default':'Keep\x20'+b,'note':'Testnet\x20recommendation:\x20WOW\x20for\x20all\x20merchant\x20and\x20order\x20testing.\x20'+'Mainnet:\x20USDT\x20and\x20other\x20stablecoins\x20are\x20available\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge\x20'+'and\x20are\x20often\x20preferred\x20to\x20avoid\x20price\x20volatility.\x20If\x20switching,\x20the\x20Service\x20/\x20Treasury\x20/\x20'+'Allocation\x20type_parameter\x20must\x20be\x20updated\x20to\x20the\x20stablecoin\x27s\x20WOW\x20type\x20tag\x20before\x20publishing\x20on\x20mainnet.'}];}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface ServiceInfo {
|
|
2
|
-
id: string;
|
|
3
|
-
name?: string;
|
|
4
|
-
tags?: string[];
|
|
5
|
-
price?: string;
|
|
6
|
-
priceToken?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
scenario?: string;
|
|
9
|
-
trustScore?: number;
|
|
10
|
-
location?: string;
|
|
11
|
-
published?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface DemandInfo {
|
|
14
|
-
tags?: string[];
|
|
15
|
-
maxPrice?: string;
|
|
16
|
-
scenario?: string;
|
|
17
|
-
location?: string;
|
|
18
|
-
minTrustScore?: number;
|
|
19
|
-
keywords?: string[];
|
|
20
|
-
}
|
|
21
|
-
export interface DemandMatch {
|
|
22
|
-
service: ServiceInfo;
|
|
23
|
-
score: number;
|
|
24
|
-
reasons: string[];
|
|
25
|
-
warnings: string[];
|
|
26
|
-
}
|
|
27
|
-
export declare const DEMAND_MATCHING_VERSION = 1;
|
|
28
|
-
export declare function matchDemand(demand: DemandInfo, services: ServiceInfo[], limit?: number): DemandMatch[];
|
|
29
|
-
export declare function extractDemandInfo(demandData: any): DemandInfo;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DEMAND_MATCHING_VERSION=0x1;const WEIGHTS={'tags':0x1e,'price':0x14,'scenario':0xf,'trust':0x14,'location':0xa,'keyword':0x5};export function matchDemand(a,b,c=0x5){const d=b['filter'](e=>e['published']!==![])['map'](e=>computeMatchScore(a,e))['filter'](e=>e['score']>=0x3c)['sort']((e,f)=>f['score']-e['score'])['slice'](0x0,c);return d;}function computeMatchScore(a,b){const c=[],d=[];let e=0x0;const f=computeTagScore(a['tags'],b['tags']);e+=f;f>=WEIGHTS['tags']*0.8&&c['push']('High\x20tags\x20match\x20('+f+'/'+WEIGHTS['tags']+')');const g=computePriceScore(a['maxPrice'],b['price']);e+=g;if(g===WEIGHTS['price'])c['push']('Price\x20within\x20budget');else g===0x0&&a['maxPrice']&&b['price']&&d['push']('Price\x20exceeds\x20budget\x20('+b['price']+'\x20>\x20'+a['maxPrice']+')');const h=computeScenarioScore(a['scenario'],b['scenario']);e+=h;h===WEIGHTS['scenario']&&c['push']('Industry\x20scenario\x20matches\x20('+b['scenario']+')');const i=computeTrustScore(b['trustScore'],a['minTrustScore']);e+=i;if(b['trustScore']!==undefined){if(b['trustScore']>=0x4b)c['push']('High\x20trust\x20score\x20('+b['trustScore']+'/100)');else b['trustScore']<0x32&&d['push']('Low\x20trust\x20score\x20('+b['trustScore']+'/100)');}const j=computeLocationScore(a['location'],b['location']);e+=j;j===WEIGHTS['location']&&a['location']&&c['push']('Geographic\x20location\x20matches\x20('+b['location']+')');const k=computeKeywordScore(a['keywords'],b['description']);return e+=k,a['minTrustScore']!==undefined&&b['trustScore']!==undefined&&(b['trustScore']<a['minTrustScore']&&(d['push']('Trust\x20score\x20below\x20requirement\x20('+b['trustScore']+'\x20<\x20'+a['minTrustScore']+')'),e-=0xa)),{'service':b,'score':Math['max'](0x0,Math['min'](0x64,e)),'reasons':c,'warnings':d};}function computeTagScore(a,b){if(!a||!b||a['length']===0x0||b['length']===0x0)return 0x0;const c=new Set(a['map'](f=>f['toLowerCase']())),d=new Set(b['map'](f=>f['toLowerCase']())),e=[...c]['filter'](f=>d['has'](f))['length'];return Math['round'](e/c['size']*WEIGHTS['tags']);}function computePriceScore(a,b){if(!a||!b)return WEIGHTS['price']/0x2;try{const c=BigInt(a),d=BigInt(b);if(d<=c)return WEIGHTS['price'];if(d<=c*0x6en/0x64n)return WEIGHTS['price']*0.5;return 0x0;}catch{return WEIGHTS['price']/0x2;}}function computeScenarioScore(a,b){if(!a||!b)return 0x0;return a['toLowerCase']()===b['toLowerCase']()?WEIGHTS['scenario']:0x0;}function computeTrustScore(a,b){if(a===undefined)return WEIGHTS['trust']/0x2;if(a>=0x4b)return WEIGHTS['trust'];if(a>=0x32)return WEIGHTS['trust']*0.6;if(a>=0x19)return WEIGHTS['trust']*0.3;return 0x0;}function computeLocationScore(a,b){if(!a||!b)return 0x0;return a['toLowerCase']()===b['toLowerCase']()?WEIGHTS['location']:0x0;}function computeKeywordScore(a,b){if(!a||!b||a['length']===0x0)return 0x0;const c=b['toLowerCase'](),d=a['filter'](e=>c['includes'](e['toLowerCase']()));return Math['min'](WEIGHTS['keyword'],d['length']);}export function extractDemandInfo(a){return{'tags':a?.['tags'],'maxPrice':a?.['max_price']??a?.['maxPrice'],'scenario':a?.['scenario'],'location':a?.['location'],'minTrustScore':a?.['min_trust_score']??a?.['minTrustScore'],'keywords':a?.['keywords']};}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type GuardScene } from "./guard-ledger.js";
|
|
2
|
-
import { type GuardTemplate } from "./guard-templates.js";
|
|
3
|
-
import { type SemanticToSchemaRule } from "./guard-translation.js";
|
|
4
|
-
import { type RiskRule, type GuardRiskAssessment, type GuardStakeholder } from "./guard-risk.js";
|
|
5
|
-
import { type GuardPuzzle, type PuzzleCompleteness } from "./guard-puzzle.js";
|
|
6
|
-
import { GUARD_PUBLISH_CHECKLIST, GUARD_CONFIRMATION_QUESTIONS, type GuardJsonForConfirm } from "./guard-confirm.js";
|
|
7
|
-
export declare const GUARD_CONTEXT_VERSION = "1.0.0";
|
|
8
|
-
export type GuardInjectionMode = "initial_design" | "mid_design_review" | "pre_publish" | "post_publish_binding" | "stakeholder_review" | "binding_check";
|
|
9
|
-
export type GuardStakeholderPerspective = GuardStakeholder | "system";
|
|
10
|
-
export interface GuardContextBundle {
|
|
11
|
-
version: string;
|
|
12
|
-
mode: GuardInjectionMode;
|
|
13
|
-
stakeholder_perspective?: GuardStakeholderPerspective;
|
|
14
|
-
matched_scene?: GuardScene;
|
|
15
|
-
matched_template?: GuardTemplate;
|
|
16
|
-
matched_pattern?: SemanticToSchemaRule;
|
|
17
|
-
puzzle_state?: GuardPuzzle;
|
|
18
|
-
puzzle_completeness?: PuzzleCompleteness;
|
|
19
|
-
relevant_risks: RiskRule[];
|
|
20
|
-
risk_assessment?: GuardRiskAssessment;
|
|
21
|
-
relevant_checklist: typeof GUARD_PUBLISH_CHECKLIST;
|
|
22
|
-
relevant_questions: typeof GUARD_CONFIRMATION_QUESTIONS;
|
|
23
|
-
cross_object_refs: GuardCrossObjectRef[];
|
|
24
|
-
onchain_constraints: GuardOnchainConstraint[];
|
|
25
|
-
rendering_hints: GuardRenderingHints;
|
|
26
|
-
}
|
|
27
|
-
export interface GuardCrossObjectRef {
|
|
28
|
-
object: "Machine" | "Service" | "Reward" | "Arbitration" | "Repository" | "Progress" | "Demand";
|
|
29
|
-
field: string;
|
|
30
|
-
scene_id: string;
|
|
31
|
-
description: string;
|
|
32
|
-
}
|
|
33
|
-
export interface GuardOnchainConstraint {
|
|
34
|
-
name: string;
|
|
35
|
-
value: string | number | bigint;
|
|
36
|
-
description: string;
|
|
37
|
-
}
|
|
38
|
-
export interface GuardRenderingHints {
|
|
39
|
-
include_puzzle_template: boolean;
|
|
40
|
-
include_risk_details: boolean;
|
|
41
|
-
include_questions: boolean;
|
|
42
|
-
include_immutability_warning: boolean;
|
|
43
|
-
max_length: number;
|
|
44
|
-
}
|
|
45
|
-
export interface BuildGuardContextInput {
|
|
46
|
-
mode: GuardInjectionMode;
|
|
47
|
-
intent?: string;
|
|
48
|
-
guard_json?: GuardJsonForConfirm;
|
|
49
|
-
stakeholder?: GuardStakeholderPerspective;
|
|
50
|
-
target_host_object?: GuardScene["host_object"];
|
|
51
|
-
target_binding_field?: string;
|
|
52
|
-
max_length?: number;
|
|
53
|
-
}
|
|
54
|
-
export declare function buildGuardContext(input: BuildGuardContextInput): GuardContextBundle;
|
|
55
|
-
export declare function buildPromptFromGuardContext(bundle: GuardContextBundle): string;
|
|
56
|
-
export declare function getGuardContextSummary(bundle: GuardContextBundle): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{GUARD_SCENES,findScene}from'./guard-ledger.js';import{getTemplatesByScene}from'./guard-templates.js';import{matchSemanticPattern}from'./guard-translation.js';import{getAllRiskRules,assessGuardRisks}from'./guard-risk.js';import{initPuzzleFromIntent,checkPuzzleCompleteness}from'./guard-puzzle.js';import{GUARD_PUBLISH_CHECKLIST,GUARD_CONFIRMATION_QUESTIONS}from'./guard-confirm.js';import{MAX_TABLE_SIZE,MAX_DESCRIPTION_LENGTH}from'@wowok/wowok';import{MACHINE_SCENES}from'./machine-ledger.js';export const GUARD_CONTEXT_VERSION='1.0.0';export function buildGuardContext(a){const b=a['max_length']??0xfa0;let c;if(a['intent'])c=findSceneByIntentKeywords(a['intent']);else{if(a['guard_json']?.['binding_scene_id'])c=GUARD_SCENES['find'](o=>o['id']===a['guard_json']['binding_scene_id']);else a['target_host_object']&&a['target_binding_field']&&(c=findScene(a['target_host_object'],a['target_binding_field']));}let d;if(c){const o=getTemplatesByScene(c['id']);if(o['length']>0x0)d=o[0x0];}let e;if(a['intent']){const p=matchSemanticPattern(a['intent']);if(p['length']>0x0)e=p[0x0];}let f,g;if(a['mode']==='initial_design'&&a['intent'])f=initPuzzleFromIntent({'rule_sentence':a['intent']}),g=checkPuzzleCompleteness(f);else a['mode']==='mid_design_review'&&a['guard_json']&&(g=checkPuzzleCompleteness({}));const h=filterRiskRules(a['mode'],a['stakeholder'],c);let i;if(a['mode']==='pre_publish'&&a['guard_json']){const q=a['guard_json']['root'];i=assessGuardRisks({'table':q?.['table']??[],'root':a['guard_json']['root'],'rely':q?.['rely']});}const j=filterChecklist(a['mode']),k=filterQuestions(a['mode']),l=buildCrossObjectRefs(c),m=buildOnchainConstraints(),n=buildRenderingHints(a['mode'],b);return{'version':GUARD_CONTEXT_VERSION,'mode':a['mode'],'stakeholder_perspective':a['stakeholder'],'matched_scene':c,'matched_template':d,'matched_pattern':e,'puzzle_state':f,'puzzle_completeness':g,'relevant_risks':h,'risk_assessment':i,'relevant_checklist':j,'relevant_questions':k,'cross_object_refs':l,'onchain_constraints':m,'rendering_hints':n};}function filterRiskRules(a,b,c){let d=getAllRiskRules();c&&(d=d['filter'](e=>!e['id']['startsWith']('R-X')||!![]));if(b&&b!=='system'){}if(a==='initial_design')return d['filter'](e=>e['id']['startsWith']('R-C1')||e['id']['startsWith']('R-C4'));if(a==='pre_publish')return d;if(a==='stakeholder_review'&&b)return d;return d;}function filterChecklist(a){if(a==='initial_design')return GUARD_PUBLISH_CHECKLIST['filter'](b=>['GC-01','GC-05','GC-12']['includes'](b['id']));if(a==='pre_publish')return GUARD_PUBLISH_CHECKLIST;return GUARD_PUBLISH_CHECKLIST['filter'](b=>!b['id']['startsWith']('GC-0'));}function filterQuestions(a){if(a==='pre_publish')return GUARD_CONFIRMATION_QUESTIONS;if(a==='mid_design_review')return GUARD_CONFIRMATION_QUESTIONS['filter'](b=>b['id']==='QG1'||b['id']==='QG2');return[];}function buildCrossObjectRefs(a){const b=[];for(const c of MACHINE_SCENES){b['push']({'object':'Machine','field':'Forward.guard','scene_id':c['id'],'description':'Machine\x20scene\x20\x22'+c['id']+'\x22\x20can\x20reference\x20Guards\x20via\x20Forward.guard'});}return a&&a['host_object']!=='Standalone'&&b['push']({'object':a['host_object'],'field':a['binding_field'],'scene_id':a['id'],'description':a['validation_scene']}),b;}function buildOnchainConstraints(){return[{'name':'MAX_TABLE_SIZE','value':MAX_TABLE_SIZE,'description':'Maximum\x20entries\x20in\x20Guard\x20table'},{'name':'MAX_DESCRIPTION_LENGTH','value':MAX_DESCRIPTION_LENGTH,'description':'Maximum\x20description\x20length'}];}function buildRenderingHints(a,b){switch(a){case'initial_design':return{'include_puzzle_template':!![],'include_risk_details':![],'include_questions':![],'include_immutability_warning':!![],'max_length':b};case'mid_design_review':return{'include_puzzle_template':![],'include_risk_details':!![],'include_questions':![],'include_immutability_warning':!![],'max_length':b};case'pre_publish':return{'include_puzzle_template':![],'include_risk_details':!![],'include_questions':!![],'include_immutability_warning':!![],'max_length':b};case'stakeholder_review':return{'include_puzzle_template':![],'include_risk_details':!![],'include_questions':![],'include_immutability_warning':![],'max_length':b};default:return{'include_puzzle_template':![],'include_risk_details':![],'include_questions':![],'include_immutability_warning':!![],'max_length':b};}}function findSceneByIntentKeywords(a){const b=a['toLowerCase']();for(const c of GUARD_SCENES){if(c['id']['split']('_')['some'](d=>b['includes'](d)))return c;}return undefined;}export function buildPromptFromGuardContext(a){const b=[],d=a['rendering_hints'];b['push']('═══════════════════════════════════════════════════════════'),b['push']('\x20\x20GUARD\x20CONTEXT\x20(mode:\x20'+a['mode']+')'),b['push']('═══════════════════════════════════════════════════════════');a['matched_scene']&&(b['push'](''),b['push']('Matched\x20Scene:\x20'+a['matched_scene']['name']),b['push']('\x20\x20Host\x20Object:\x20'+a['matched_scene']['host_object']),b['push']('\x20\x20Binding\x20Field:\x20'+a['matched_scene']['binding_field']),b['push']('\x20\x20Validation:\x20'+a['matched_scene']['validation_scene']));a['matched_template']&&(b['push'](''),b['push']('Recommended\x20Template:\x20'+a['matched_template']['name']),b['push']('\x20\x20Patterns:\x20'+a['matched_template']['recommended_patterns']['join'](',\x20')));a['matched_pattern']&&(b['push'](''),b['push']('Semantic\x20Pattern:\x20'+a['matched_pattern']['id']+'\x20—\x20'+a['matched_pattern']['pattern_name']),b['push']('\x20\x20Intent:\x20'+a['matched_pattern']['semantic_intent']));if(d['include_puzzle_template']&&a['puzzle_state']){b['push'](''),b['push']('─\x20Puzzle\x20State\x20──────────────────────────────────────────');const e=a['puzzle_completeness'];e&&(b['push']('Complete:\x20'+(e['complete']?'YES':'NO')),e['missing']['length']>0x0&&b['push']('Missing:\x20'+e['missing']['join'](',\x20')));}if(d['include_risk_details']&&a['relevant_risks']['length']>0x0){b['push'](''),b['push']('─\x20Relevant\x20Risk\x20Rules\x20('+a['relevant_risks']['length']+')\x20──────────────────────');for(const f of a['relevant_risks']['slice'](0x0,0x5)){b['push']('\x20\x20'+f['id']+'\x20—\x20'+f['trigger']);}a['relevant_risks']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_risks']['length']-0x5)+'\x20more');}a['risk_assessment']&&(b['push'](''),b['push']('─\x20Risk\x20Assessment\x20───────────────────────────────────────'),b['push']('Overall:\x20'+a['risk_assessment']['overall_risk']['toUpperCase']()),b['push']('Detected:\x20'+(a['risk_assessment']['risks']?.['length']??0x0)+'\x20risks'));if(d['include_questions']&&a['relevant_questions']['length']>0x0){b['push'](''),b['push']('─\x20Confirmation\x20Questions\x20────────────────────────────────');for(const g of a['relevant_questions']){b['push']('\x20\x20'+g['id']+'\x20(blocking='+g['blocking']+'):\x20'+g['question']);}}if(a['cross_object_refs']['length']>0x0){b['push'](''),b['push']('─\x20Cross-Object\x20References\x20───────────────────────────────');for(const i of a['cross_object_refs']['slice'](0x0,0x3)){b['push']('\x20\x20'+i['object']+'.'+i['field']+'\x20('+i['scene_id']+')');}}if(a['onchain_constraints']['length']>0x0){b['push'](''),b['push']('─\x20On-Chain\x20Constraints\x20──────────────────────────────────');for(const j of a['onchain_constraints']){b['push']('\x20\x20'+j['name']+'\x20=\x20'+j['value']+'\x20('+j['description']+')');}}return d['include_immutability_warning']&&(b['push'](''),b['push']('⚠️\x20\x20Guard\x20is\x20IMMUTABLE\x20after\x20creation\x20—\x20no\x20update\x20path\x20exists.'),b['push']('\x20\x20\x20\x20Review\x20the\x20validation\x20rule\x20twice\x20before\x20publishing.')),b['push'](''),b['push']('═══════════════════════════════════════════════════════════'),b['join']('\x0a');}export function getGuardContextSummary(a){const b=[];b['push']('Guard\x20Context\x20v'+a['version']),b['push']('Mode:\x20'+a['mode']);if(a['matched_scene'])b['push']('Scene:\x20'+a['matched_scene']['id']);if(a['matched_template'])b['push']('Template:\x20'+a['matched_template']['id']);if(a['matched_pattern'])b['push']('Pattern:\x20'+a['matched_pattern']['id']);return b['push']('Risks:\x20'+a['relevant_risks']['length']+'\x20relevant'),b['push']('Checklist:\x20'+a['relevant_checklist']['length']+'\x20items'),b['push']('Questions:\x20'+a['relevant_questions']['length']),b['push']('Cross-refs:\x20'+a['cross_object_refs']['length']),b['join']('\x20|\x20');}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export type GuardNodeType = 'logic_or' | 'logic_and' | 'logic_not' | 'logic_equal' | 'logic_string_nocase_equal' | 'logic_as_u256_equal' | 'logic_string_contains' | 'logic_string_nocase_contains' | 'logic_as_u256_greater' | 'logic_as_u256_lesser' | 'logic_as_u256_greater_or_equal' | 'logic_as_u256_lesser_or_equal' | 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool' | 'identifier' | 'query' | 'context' | 'calc_number_add' | 'calc_number_subtract' | 'calc_number_multiply' | 'calc_number_divide' | 'calc_number_mod' | string;
|
|
2
|
-
export interface GuardNode {
|
|
3
|
-
type: GuardNodeType;
|
|
4
|
-
nodes?: GuardNode[];
|
|
5
|
-
node?: GuardNode;
|
|
6
|
-
identifier?: number;
|
|
7
|
-
query?: string | number;
|
|
8
|
-
context?: string;
|
|
9
|
-
object?: {
|
|
10
|
-
identifier?: number;
|
|
11
|
-
convert_witness?: string | number;
|
|
12
|
-
};
|
|
13
|
-
parameters?: unknown[];
|
|
14
|
-
}
|
|
15
|
-
export interface GuardTableEntry {
|
|
16
|
-
identifier: number;
|
|
17
|
-
b_submission?: boolean;
|
|
18
|
-
value_type?: string | number;
|
|
19
|
-
value?: unknown;
|
|
20
|
-
name?: string;
|
|
21
|
-
}
|
|
22
|
-
export type VecContainsTarget = 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool';
|
|
23
|
-
export type VecValueType = 'VecString' | 'VecAddress' | 'VecU64' | 'VecU128' | 'VecU256' | 'VecU8' | 'VecU16' | 'VecU32' | 'VecBool';
|
|
24
|
-
export interface ConversionResult {
|
|
25
|
-
convertible: boolean;
|
|
26
|
-
targetOperator?: VecContainsTarget;
|
|
27
|
-
vectorValueType?: VecValueType;
|
|
28
|
-
sharedNode?: GuardNode;
|
|
29
|
-
constants?: Array<{
|
|
30
|
-
identifier: number;
|
|
31
|
-
value: unknown;
|
|
32
|
-
value_type: string;
|
|
33
|
-
}>;
|
|
34
|
-
reasons?: string[];
|
|
35
|
-
}
|
|
36
|
-
export declare function analyzeLogicOrConversion(orNode: GuardNode, table: GuardTableEntry[]): ConversionResult;
|
|
37
|
-
export interface ShorthandResult {
|
|
38
|
-
newRoot: GuardNode;
|
|
39
|
-
removeIdentifiers: number[];
|
|
40
|
-
addEntry: {
|
|
41
|
-
identifier: number;
|
|
42
|
-
b_submission: false;
|
|
43
|
-
value_type: VecValueType;
|
|
44
|
-
value: unknown[];
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export declare function buildShorthand(_orNode: GuardNode, result: ConversionResult, newIdentifier: number): ShorthandResult | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const EQUAL_OPERATORS=new Set(['logic_equal','logic_string_nocase_equal','logic_as_u256_equal']);function mapOperatorToTarget(a,b){if(b==='String'||b===0x2){if(a==='logic_string_nocase_equal')return{'target':'vec_contains_string_nocase','vecType':'VecString'};if(a==='logic_equal')return{'target':'vec_contains_string','vecType':'VecString'};return null;}if(b==='Address'||b===0x1){if(a==='logic_equal')return{'target':'vec_contains_address','vecType':'VecAddress'};return null;}if(b==='Bool'||b===0x0){if(a==='logic_equal')return{'target':'vec_contains_bool','vecType':'VecBool'};return null;}const c=new Set(['U8','U16','U32','U64','U128','U256',0x3,0x4,0x5,0x6,0x7,0x8]);if(c['has'](b)){if(a==='logic_equal'||a==='logic_as_u256_equal')return{'target':'vec_contains_number','vecType':'VecU256'};return null;}return null;}export function analyzeLogicOrConversion(a,b){const c=[];if(a['type']!=='logic_or')return{'convertible':![],'reasons':['Node\x20type\x20is\x20\x27'+a['type']+'\x27,\x20not\x20\x27logic_or\x27.\x20Only\x20logic_or\x20nodes\x20are\x20candidates.']};const d=a['nodes']??[];if(d['length']<0x2)return{'convertible':![],'reasons':['logic_or\x20has\x20'+d['length']+'\x20children;\x20need\x20at\x20least\x202\x20to\x20convert.']};if(d['length']>0x7)return{'convertible':![],'reasons':['logic_or\x20has\x20'+d['length']+'\x20children;\x20vec_contains_*\x20supports\x20at\x20most\x207\x20needles\x20(1\x20haystack\x20+\x207\x20needles\x20=\x208\x20node\x20limit).\x20Keep\x20the\x20logic_or.']};const e=new Set();for(const n of d){if(!EQUAL_OPERATORS['has'](n['type'])){if(n['type']==='logic_string_contains'||n['type']==='logic_string_nocase_contains')c['push']('Child\x20uses\x20\x27'+n['type']+'\x27\x20(substring\x20match).\x20vec_contains_*\x20is\x20whole-element\x20membership,\x20NOT\x20substring.\x20Cannot\x20convert.');else{if(n['type']?.['startsWith']('logic_as_u256_greater')||n['type']?.['startsWith']('logic_as_u256_lesser'))c['push']('Child\x20uses\x20\x27'+n['type']+'\x27\x20(ordering\x20comparison).\x20vec_contains_*\x20is\x20membership,\x20not\x20ordering.\x20Cannot\x20convert.');else n['type']==='logic_and'||n['type']==='logic_or'||n['type']==='logic_not'?c['push']('Child\x20is\x20a\x20nested\x20logic\x20node\x20(\x27'+n['type']+'\x27).\x20Only\x20leaf\x20equal-style\x20comparisons\x20are\x20convertible.'):c['push']('Child\x20uses\x20\x27'+n['type']+'\x27\x20which\x20is\x20not\x20an\x20equal-style\x20operator\x20(logic_equal\x20/\x20logic_string_nocase_equal\x20/\x20logic_as_u256_equal).');}return{'convertible':![],'reasons':c};}e['add'](n['type']);}if(e['size']>0x1){const o=Array['from'](e)['join'](',\x20');return{'convertible':![],'reasons':['Children\x20use\x20mixed\x20operators:\x20['+o+'].\x20Mixing\x20case-sensitive\x20(logic_equal)\x20and\x20case-insensitive\x20(logic_string_nocase_equal)\x20comparisons\x20would\x20change\x20semantics.\x20Keep\x20the\x20logic_or.']};}const f=d[0x0]['type'];for(let p=0x0;p<d['length'];p++){const q=d[p]['nodes']??[];if(q['length']!==0x2)return{'convertible':![],'reasons':['Child\x20'+p+'\x20(\x27'+f+'\x27)\x20has\x20'+q['length']+'\x20sub-nodes;\x20expected\x20exactly\x202\x20(one\x20constant\x20side\x20+\x20one\x20shared\x20query\x20side).']};}const g=[];let h=null,j=null;for(let r=0x0;r<d['length'];r++){const s=d[r]['nodes'],t=s[0x0],u=s[0x1],v=t['type']==='identifier'&&typeof t['identifier']==='number',w=u['type']==='identifier'&&typeof u['identifier']==='number';if(!v&&!w)return{'convertible':![],'reasons':['Child\x20'+r+'\x20has\x20no\x20constant\x20identifier\x20side\x20(both\x20sub-nodes\x20are\x20non-identifier).\x20Conversion\x20requires\x20one\x20side\x20to\x20be\x20a\x20constant\x20table\x20entry.']};if(v&&w)return{'convertible':![],'reasons':['Child\x20'+r+'\x20has\x20two\x20identifier\x20sides.\x20Conversion\x20requires\x20one\x20side\x20to\x20be\x20a\x20non-constant\x20(query/context/calc)\x20node\x20shared\x20across\x20all\x20children.']};const x=v?t:u,y=v?u:t,z=b['find'](B=>B['identifier']===x['identifier']);if(!z)return{'convertible':![],'reasons':['Child\x20'+r+'\x20references\x20identifier['+x['identifier']+']\x20which\x20is\x20not\x20in\x20the\x20table.']};if(z['b_submission']!==![])return{'convertible':![],'reasons':['Child\x20'+r+'\x20references\x20identifier['+x['identifier']+']\x20with\x20b_submission='+z['b_submission']+'.\x20Conversion\x20requires\x20compile-time\x20constants\x20(b_submission=false).']};if(z['value']===undefined||z['value']===null)return{'convertible':![],'reasons':['Child\x20'+r+'\x20references\x20identifier['+x['identifier']+']\x20which\x20has\x20no\x20\x27value\x27\x20field.\x20Conversion\x20requires\x20explicit\x20constant\x20values.']};const A=JSON['stringify'](y);if(j===null)j=A,h=y;else{if(j!==A)return{'convertible':![],'reasons':['Child\x20'+r+'\x27s\x20non-constant\x20side\x20differs\x20from\x20child\x200\x27s.\x20All\x20children\x20must\x20share\x20the\x20SAME\x20non-constant\x20node\x20(same\x20query,\x20same\x20convert_witness,\x20same\x20parameters).\x20Keep\x20the\x20logic_or.']};}g['push']({'identifier':x['identifier'],'value':z['value'],'value_type':String(z['value_type']??'')});}const k=new Set(g['map'](B=>B['value_type']));if(k['size']>0x1)return{'convertible':![],'reasons':['Constants\x20have\x20mixed\x20value_types:\x20['+Array['from'](k)['join'](',\x20')+'].\x20All\x20constants\x20must\x20share\x20the\x20same\x20type\x20to\x20form\x20a\x20single\x20VecXxx.']};const l=g[0x0]['value_type'],m=mapOperatorToTarget(f,l);if(!m)return{'convertible':![],'reasons':['No\x20vec_contains_*\x20variant\x20maps\x20to\x20operator=\x27'+f+'\x27\x20with\x20value_type=\x27'+l+'\x27.\x20'+'Mappable\x20combinations:\x20(logic_string_nocase_equal,\x20String)→vec_contains_string_nocase;\x20'+'(logic_equal,\x20String)→vec_contains_string;\x20(logic_equal,\x20Address)→vec_contains_address;\x20'+'(logic_equal,\x20Bool)→vec_contains_bool;\x20(logic_equal|logic_as_u256_equal,\x20numeric)→vec_contains_number.']};return{'convertible':!![],'targetOperator':m['target'],'vectorValueType':m['vecType'],'sharedNode':h??undefined,'constants':g};}export function buildShorthand(a,b,c){if(!b['convertible']||!b['targetOperator']||!b['vectorValueType']||!b['sharedNode']||!b['constants'])return null;const d=b['constants']['map'](g=>g['value']),e=b['constants']['map'](g=>g['identifier']),f={'type':b['targetOperator'],'nodes':[{'type':'identifier','identifier':c},b['sharedNode']]};return{'newRoot':f,'removeIdentifiers':e,'addEntry':{'identifier':c,'b_submission':![],'value_type':b['vectorValueType'],'value':d,'name':'converted_constants'}};}
|