@wowok/agent-mcp 2.7.10 → 3.0.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/extensions/capability-manifest.d.ts +1 -82
- package/dist/extensions/capability-manifest.js +1 -1
- package/dist/extensions/constraint-registry.d.ts +6 -4
- package/dist/extensions/constraint-registry.js +1 -1
- package/dist/extensions/index.d.ts +4 -5
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/metric-registry.d.ts +6 -4
- package/dist/extensions/metric-registry.js +1 -1
- package/dist/extensions/mode-evaluator.d.ts +2 -3
- package/dist/extensions/mode-evaluator.js +1 -1
- package/dist/extensions/registry.d.ts +3 -25
- package/dist/extensions/registry.js +1 -1
- package/dist/extensions/types.d.ts +0 -68
- package/dist/goal/GoalEngine.d.ts +36 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/types.d.ts +4 -0
- package/dist/knowledge/account-marks.d.ts +1 -0
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +13 -9
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/goal-completion.js +1 -1
- package/dist/knowledge/guard-bindings.d.ts +21 -0
- package/dist/knowledge/guard-bindings.js +1 -0
- package/dist/knowledge/index.d.ts +5 -3
- 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/reward-risk.d.ts +1 -1
- package/dist/knowledge/reward-risk.js +1 -1
- package/dist/knowledge/safety-rules.d.ts +2 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-topology.d.ts +43 -0
- package/dist/knowledge/scenario-topology.js +1 -0
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +35 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.d.ts +1 -0
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.d.ts +2 -0
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/monitor/SuggestionBridge.d.ts +38 -0
- package/dist/monitor/SuggestionBridge.js +1 -0
- package/dist/participation/arbitrator-interest.d.ts +20 -0
- package/dist/participation/arbitrator-interest.js +1 -0
- package/dist/participation/demander-interest.d.ts +23 -0
- package/dist/participation/demander-interest.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +20 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +30 -6
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.d.ts +2 -0
- package/dist/playbooks/service-build/relationship-profile.js +1 -0
- package/dist/playbooks/service-build/semantic-graph.d.ts +5 -1
- package/dist/playbooks/service-build/semantic-graph.js +1 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/relationship/derivation.d.ts +88 -0
- package/dist/relationship/derivation.js +1 -0
- package/dist/relationship/incentive.d.ts +38 -0
- package/dist/relationship/incentive.js +1 -0
- package/dist/relationship/index.d.ts +4 -0
- package/dist/relationship/index.js +1 -0
- package/dist/relationship/registry.d.ts +13 -0
- package/dist/relationship/registry.js +1 -0
- package/dist/relationship/types.d.ts +45 -0
- package/dist/relationship/types.js +1 -0
- package/dist/review/progress.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/safety/preview.js +1 -1
- package/dist/schema/call/bridge.d.ts +25 -3
- package/dist/schema/call/bridge.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +40 -14
- package/dist/schema/goal/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +6 -6
- package/dist/schema/industry-pack/index.d.ts +58 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/industry-pack/modes.d.ts +59 -1
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +19 -19
- package/dist/schema/local/index.d.ts +11 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +58 -16
- package/dist/schema/persona/index.d.ts +1 -1
- package/dist/schema/query/bi.d.ts +145 -16
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +2 -2
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +29 -0
- package/dist/schemas/account_operation.schema.json +6 -2
- package/dist/schemas/bridge_operation.output.json +24 -1
- package/dist/schemas/bridge_operation.schema.json +73 -1
- package/dist/schemas/goal_operation.schema.json +76 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +176 -1
- package/dist/schemas/industry_pack_operation.schema.json +19 -0
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +41 -41
- package/dist/schemas/onchain_operations_allocation.schema.json +4 -4
- package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
- package/dist/schemas/onchain_operations_contact.schema.json +2 -2
- package/dist/schemas/onchain_operations_demand.schema.json +2 -2
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_order.schema.json +2 -2
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +2 -2
- package/dist/schemas/onchain_operations_repository.schema.json +2 -2
- package/dist/schemas/onchain_operations_reward.schema.json +6 -6
- package/dist/schemas/onchain_operations_service.schema.json +7 -7
- package/dist/schemas/onchain_operations_treasury.schema.json +6 -6
- package/dist/schemas/onchain_table_data.output.json +53 -0
- package/dist/schemas/query_toolkit.output.json +240 -7
- package/dist/schemas/query_toolkit.schema.json +53 -0
- package/dist/task/ProcessStore.d.ts +18 -1
- package/dist/task/ProcessStore.js +1 -1
- package/dist/task/types.d.ts +24 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/goal.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.d.ts +4 -3
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/rules-hook.d.ts +1 -0
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/package.json +2 -2
- package/dist/mode-market/index.d.ts +0 -3
- package/dist/mode-market/index.js +0 -1
- package/dist/mode-market/registry.d.ts +0 -53
- package/dist/mode-market/registry.js +0 -1
- package/dist/mode-market/review.d.ts +0 -27
- package/dist/mode-market/review.js +0 -1
- package/dist/mode-market/submission.d.ts +0 -25
- package/dist/mode-market/submission.js +0 -1
package/dist/tools/rules-hook.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OnchainOperationsSchema,strictParse,getEnvConfig}from'../schema/index.js';import{buildPendingConfirmation,buildConstraintError}from'./shared.js';import{validateOperation,hasBlockingViolations}from'../knowledge/index.js';import{resolveEffectiveOverrides}from'../persona/index.js';export async function applyOnchainRules(a){let b;try{b=strictParse(OnchainOperationsSchema,a,'onchain_operations\x20input');}catch{return null;}const c=getEnvConfig(b['env']),d=await resolveEffectiveOverrides(c?.['account']),e='data'in b?b['data']:undefined,f=buildPendingConfirmation(b['operation_type'],e,c,d);if(f['structuredContent'])return f;const g=validateOperation(b['operation_type'],e);if(hasBlockingViolations(g))return buildConstraintError(b['operation_type'],g);return null;}
|
|
1
|
+
import{OnchainOperationsSchema,BridgeOperationsSchema,strictParse,getEnvConfig}from'../schema/index.js';import{buildPendingConfirmation,buildConstraintError}from'./shared.js';import{validateOperation,hasBlockingViolations}from'../knowledge/index.js';import{BRIDGE_FUND_OPERATION_TYPES}from'../knowledge/safety-rules.js';import{resolveEffectiveOverrides}from'../persona/index.js';export async function applyOnchainRules(a){let b;try{b=strictParse(OnchainOperationsSchema,a,'onchain_operations\x20input');}catch{return null;}const c=getEnvConfig(b['env']),d=await resolveEffectiveOverrides(c?.['account']),e='data'in b?b['data']:undefined,f=buildPendingConfirmation(b['operation_type'],e,c,d);if(f['structuredContent'])return f;const g=validateOperation(b['operation_type'],e);if(hasBlockingViolations(g))return buildConstraintError(b['operation_type'],g);return null;}export async function applyBridgeRules(a){let b;try{b=strictParse(BridgeOperationsSchema,a,'bridge_operations\x20input');}catch{return null;}const c=b['operation_type'];if(!c||!BRIDGE_FUND_OPERATION_TYPES['includes'](c))return null;const d=b['data'],e=getEnvConfig('env'in b?b['env']:undefined),f=await resolveEffectiveOverrides(e?.['account']),g=buildPendingConfirmation(c,d,e,f);if(g['structuredContent'])return g;return null;}
|
package/dist/tools/shared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{confirmGate}from'../safety/confirm-gate.js';import{renderPreview}from'../safety/preview.js';import{validateOperation,hasBlockingViolations,getWarningViolations}from'../knowledge/index.js';import{getHarness}from'../harness/index.js';import{isEnabled as
|
|
1
|
+
import{confirmGate}from'../safety/confirm-gate.js';import{renderPreview}from'../safety/preview.js';import{validateOperation,hasBlockingViolations,getWarningViolations}from'../knowledge/index.js';import{getHarness}from'../harness/index.js';import{isEnabled as a415a}from'../config/index.js';import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{strictParse}from'../schema/index.js';export function withHarness(a,b,c){if(!a415a('harness'))return a;try{const d=getHarness(),e=d['expect'](b,c,a['operation_type'],a['data']);return{...a,'harness':d,'expected':e,'operation_id':a['operation_type']+'_'+Date['now']()};}catch{return a;}}export function wrapLocalHandler(a){const {schema:b,operationFn:c,parseLabel:d,buildContext:e}=a;return async f=>{let g;try{g=strictParse(b,f,d);const h=await c(g),i=e(g);return{'content':[{'type':'text','text':JSON['stringify'](h)}],'structuredContent':{'result':{'status':'success','data':h},'semantic':buildDataSemantic(h,i)}};}catch(j){const k=j instanceof Error?j['message']:String(j),l=g?e(g):undefined,m=classifyError(k),n={'status':'error','error':k};if(m['error_code']!==undefined)n['error_code']=m['error_code'];if(m['retryable']!==undefined)n['retryable']=m['retryable'];if(m['recovery_hint']!==undefined)n['recovery_hint']=m['recovery_hint'];return{'content':[{'type':'text','text':'Error:\x20'+k}],'structuredContent':{'result':n,'semantic':buildDataSemantic(undefined,l,!![],k)}};}};}export function buildPendingConfirmation(a,b,c,d){const e=confirmGate(a,b,c,c?.['user_intent_phrases'],d);if(e['pass'])return{'content':[],'structuredContent':null};const f=e['preview'],g=renderPreview(f),h={'message':g,'result':{'type':'pending_confirmation','preview':f,'rule_id':e['rule_id']},'semantic':{'intent':a+'_awaiting_confirmation','status':'pending_input','summary':'Operation\x20blocked\x20by\x20ConfirmGate\x20('+e['level']+').\x20Review\x20the\x20preview\x20and\x20re-call\x20with\x20env.confirmed=true\x20to\x20proceed.','next_actions':[{'action':'confirm:\x20re-call\x20the\x20SAME\x20operation\x20with\x20env.confirmed=true','reason':'ConfirmGate\x20rule\x20\x27'+e['rule_id']+'\x27\x20matched.\x20The\x20operation\x20was\x20NOT\x20executed.','tool':'onchain_operations','priority':'required'}],'warnings':f['warnings']??[]}};return{'content':[{'type':'text','text':g}],'structuredContent':h};}export function buildConstraintError(a,b){const c=b['filter'](g=>g['severity']==='error'),d=c['map'](g=>'\x20\x20•\x20['+g['field']+']\x20'+g['message'])['join']('\x0a'),e='Pre-call\x20constraint\x20violations\x20for\x20\x27'+a+'\x27:\x0a'+d+'\x0a\x0aFix\x20the\x20listed\x20field(s)\x20and\x20retry.',f={'message':e,'result':{'type':'error','error':e,'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Review\x20the\x20constraint\x20violations\x20above\x20and\x20correct\x20the\x20corresponding\x20fields.'}};return{'content':[{'type':'text','text':e}],'structuredContent':f};}export function buildClassifiedErrorResult(a,b,c){const d={...a,'error':b};if(c['error_code']!==undefined)d['error_code']=c['error_code'];if(c['retryable']!==undefined)d['retryable']=c['retryable'];if(c['recovery_hint']!==undefined)d['recovery_hint']=c['recovery_hint'];return d;}export{validateOperation,hasBlockingViolations,getWarningViolations};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
53
|
-
"@wowok/wowok": "
|
|
53
|
+
"@wowok/wowok": "3.0.1",
|
|
54
54
|
"lodash": "^4.18.1",
|
|
55
55
|
"zod": "^4.2.0"
|
|
56
56
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from'./registry.js';export*from'./review.js';export*from'./submission.js';
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ScenarioTemplate } from "../harness/types.js";
|
|
2
|
-
export type TemplateStatus = "draft" | "pending_review" | "in_review" | "approved" | "rejected" | "deprecated";
|
|
3
|
-
export type TemplateSource = "official" | "community";
|
|
4
|
-
export interface ReviewRecord {
|
|
5
|
-
review_id: string;
|
|
6
|
-
reviewer: string;
|
|
7
|
-
reviewer_type: "official" | "community";
|
|
8
|
-
rating: number;
|
|
9
|
-
comment: string;
|
|
10
|
-
timestamp: string;
|
|
11
|
-
audit_checklist?: Record<string, boolean>;
|
|
12
|
-
}
|
|
13
|
-
export interface ModeTemplateEntry {
|
|
14
|
-
template_id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
version: string;
|
|
17
|
-
author: string;
|
|
18
|
-
source: TemplateSource;
|
|
19
|
-
status: TemplateStatus;
|
|
20
|
-
submitted_date: string;
|
|
21
|
-
last_updated: string;
|
|
22
|
-
description: string;
|
|
23
|
-
tags: string[];
|
|
24
|
-
scenario: ScenarioTemplate;
|
|
25
|
-
reviews: ReviewRecord[];
|
|
26
|
-
install_count: number;
|
|
27
|
-
average_rating: number;
|
|
28
|
-
download_url?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface RegistryStats {
|
|
31
|
-
total_templates: number;
|
|
32
|
-
approved_count: number;
|
|
33
|
-
pending_count: number;
|
|
34
|
-
community_count: number;
|
|
35
|
-
official_count: number;
|
|
36
|
-
total_installs: number;
|
|
37
|
-
average_rating: number;
|
|
38
|
-
}
|
|
39
|
-
export declare function registerTemplate(entry: Omit<ModeTemplateEntry, "reviews" | "install_count" | "average_rating">): ModeTemplateEntry;
|
|
40
|
-
export declare function getTemplate(id: string): ModeTemplateEntry | undefined;
|
|
41
|
-
export declare function getTemplateByName(name: string): ModeTemplateEntry | undefined;
|
|
42
|
-
export declare function listTemplates(filter?: {
|
|
43
|
-
status?: TemplateStatus;
|
|
44
|
-
source?: TemplateSource;
|
|
45
|
-
tag?: string;
|
|
46
|
-
}): ModeTemplateEntry[];
|
|
47
|
-
export declare function searchTemplates(query: string): ModeTemplateEntry[];
|
|
48
|
-
export declare function updateTemplateStatus(id: string, status: TemplateStatus): ModeTemplateEntry | undefined;
|
|
49
|
-
export declare function recordInstall(id: string): ModeTemplateEntry | undefined;
|
|
50
|
-
export declare function addReview(id: string, review: Omit<ReviewRecord, "timestamp">): ModeTemplateEntry | undefined;
|
|
51
|
-
export declare function getRegistryStats(): RegistryStats;
|
|
52
|
-
export declare function clearRegistry(): void;
|
|
53
|
-
export declare function seedBuiltInTemplates(): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const registry=new Map();export function registerTemplate(a){const b={...a,'reviews':[],'install_count':0x0,'average_rating':0x0};return registry['set'](a['template_id'],b),b;}export function getTemplate(a){return registry['get'](a);}export function getTemplateByName(a){for(const b of registry['values']()){if(b['name']===a)return b;}return undefined;}export function listTemplates(a){const b=Array['from'](registry['values']());if(!a)return b;return b['filter'](c=>{if(a['status']&&c['status']!==a['status'])return![];if(a['source']&&c['source']!==a['source'])return![];if(a['tag']&&!c['tags']['includes'](a['tag']))return![];return!![];});}export function searchTemplates(a){const b=a['toLowerCase']();return Array['from'](registry['values']())['filter'](c=>{return c['name']['toLowerCase']()['includes'](b)||c['description']['toLowerCase']()['includes'](b)||c['tags']['some'](d=>d['toLowerCase']()['includes'](b))||c['scenario']['keywords']['some'](d=>d['toLowerCase']()['includes'](b));});}export function updateTemplateStatus(a,b){const c=registry['get'](a);if(!c)return undefined;return c['status']=b,c['last_updated']=new Date()['toISOString'](),c;}export function recordInstall(a){const b=registry['get'](a);if(!b)return undefined;return b['install_count']++,b;}export function addReview(a,b){const c=registry['get'](a);if(!c)return undefined;const d={...b,'timestamp':new Date()['toISOString']()};c['reviews']['push'](d);const e=c['reviews']['reduce']((f,g)=>f+g['rating'],0x0);return c['average_rating']=e/c['reviews']['length'],c['last_updated']=new Date()['toISOString'](),c;}export function getRegistryStats(){const a=Array['from'](registry['values']()),b=a['filter'](i=>i['status']==='approved'),c=a['filter'](i=>i['status']==='pending_review'||i['status']==='in_review'),d=a['filter'](i=>i['source']==='community'),e=a['filter'](i=>i['source']==='official'),f=a['reduce']((i,j)=>i+j['install_count'],0x0),g=a['filter'](i=>i['reviews']['length']>0x0),h=g['length']>0x0?g['reduce']((i,j)=>i+j['average_rating'],0x0)/g['length']:0x0;return{'total_templates':a['length'],'approved_count':b['length'],'pending_count':c['length'],'community_count':d['length'],'official_count':e['length'],'total_installs':f,'average_rating':h};}export function clearRegistry(){registry['clear']();}import{SCENARIO_REGISTRY}from'../harness/plan.js';export function seedBuiltInTemplates(){const a=[{'source':'official','author':'WoWok\x20Team','tags':['phase1','service']},{'source':'official','author':'WoWok\x20Team','tags':['phase1','rental']},{'source':'official','author':'WoWok\x20Team','tags':['phase2','digital']},{'source':'official','author':'WoWok\x20Team','tags':['phase2','travel']},{'source':'official','author':'WoWok\x20Team','tags':['fallback']}];for(let b=0x0;b<SCENARIO_REGISTRY['length']&&b<a['length'];b++){const c=SCENARIO_REGISTRY[b],d=a[b];registerTemplate({'template_id':'builtin-'+c['name'],'name':c['name'],'version':'1.0.0','author':d['author'],'source':d['source'],'status':'approved','submitted_date':'2026-07-14T00:00:00Z','last_updated':'2026-07-14T00:00:00Z','description':c['description'],'tags':d['tags'],'scenario':c});}}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ModeTemplateEntry } from "./registry.js";
|
|
2
|
-
export interface AuditChecklistItem {
|
|
3
|
-
key: string;
|
|
4
|
-
label: string;
|
|
5
|
-
required: boolean;
|
|
6
|
-
description: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const AUDIT_CHECKLIST: AuditChecklistItem[];
|
|
9
|
-
export interface AuditResult {
|
|
10
|
-
audit_id: string;
|
|
11
|
-
template_id: string;
|
|
12
|
-
auditor: string;
|
|
13
|
-
timestamp: string;
|
|
14
|
-
checklist_results: Record<string, boolean>;
|
|
15
|
-
passed: boolean;
|
|
16
|
-
failed_required_items: string[];
|
|
17
|
-
notes: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function runAudit(entry: ModeTemplateEntry, auditor: string): AuditResult;
|
|
20
|
-
export declare const MIN_COMMUNITY_RATING_FOR_APPROVAL = 3.5;
|
|
21
|
-
export declare const MIN_REVIEWS_FOR_APPROVAL = 1;
|
|
22
|
-
export declare function meetsCommunityRatingThreshold(entry: ModeTemplateEntry): boolean;
|
|
23
|
-
export declare function canApprove(entry: ModeTemplateEntry, audit: AuditResult): boolean;
|
|
24
|
-
export declare function getApprovalEligibility(entry: ModeTemplateEntry, audit: AuditResult): {
|
|
25
|
-
eligible: boolean;
|
|
26
|
-
blockers: string[];
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const AUDIT_CHECKLIST=[{'key':'permission_indexes_valid','label':'Permission\x20indexes\x20are\x20valid\x20(1000-65535\x20range,\x20no\x20conflicts)','required':!![],'description':'All\x20permission\x20indexes\x20in\x20default_permissions\x20must\x20be\x20in\x20the\x20valid\x20range\x20and\x20not\x20conflict\x20with\x20namedOperator\x20assignments.'},{'key':'machine_nodes_min_two','label':'Machine\x20has\x20at\x20least\x202\x20nodes\x20(entry\x20+\x20terminal)','required':!![],'description':'The\x20scenario\x20template\x27s\x20Machine\x20object\x20must\x20define\x20at\x20least\x202\x20nodes.'},{'key':'guards_immutable_flagged','label':'Immutable\x20objects\x20(Guard)\x20are\x20flagged\x20with\x20risk_flags','required':!![],'description':'All\x20Guard\x20objects\x20must\x20have\x20\x27immutable_after_creation\x27\x20in\x20risk_flags.'},{'key':'allocation_sum_correct','label':'Allocation\x20sharing\x20ratios\x20sum\x20to\x2010000\x20basis\x20points','required':!![],'description':'When\x20allocation\x20is\x20defined,\x20the\x20sharing\x20percentages\x20must\x20sum\x20to\x20100%\x20(10000\x20bps).'},{'key':'dependencies_acyclic','label':'Object\x20dependencies\x20form\x20a\x20DAG\x20(no\x20cycles)','required':!![],'description':'The\x20object\x20dependency\x20graph\x20must\x20not\x20contain\x20cycles.'},{'key':'phases_cover_objects','label':'All\x20phases\x20reference\x20valid\x20object\x20types','required':!![],'description':'Every\x20phase\x27s\x20object_types\x20must\x20be\x20a\x20subset\x20of\x20the\x20objects\x20defined\x20in\x20the\x20template.'},{'key':'description_non_empty','label':'Template\x20has\x20a\x20non-empty\x20description','required':![],'description':'The\x20template\x20should\x20have\x20a\x20meaningful\x20description\x20for\x20users.'},{'key':'keywords_non_empty','label':'Template\x20has\x20at\x20least\x203\x20keywords\x20for\x20intent\x20matching','required':![],'description':'Keywords\x20help\x20the\x20Plan\x20Loop\x20match\x20user\x20intent\x20to\x20this\x20template.'},{'key':'arbiter_configured','label':'Arbiter\x20permission\x20is\x20configured','required':![],'description':'The\x20template\x20should\x20specify\x20an\x20arbiter\x20role\x20for\x20dispute\x20resolution.'},{'key':'no_infinite_loops','label':'Machine\x20state\x20graph\x20has\x20no\x20infinite\x20loops\x20(terminal\x20node\x20reachable)','required':!![],'description':'The\x20Machine\x20must\x20have\x20a\x20path\x20to\x20a\x20terminal\x20state\x20from\x20every\x20node.'}];function validatePermissionIndexes(a){const b=a['scenario']['default_permissions'];if(b['provider']!==undefined){if(typeof b['provider']==='number'&&(b['provider']<0x3e8||b['provider']>0xffff))return![];}if(b['arbiter']!==undefined){if(typeof b['arbiter']==='number'&&(b['arbiter']<0x3e8||b['arbiter']>0xffff))return![];}return!![];}function validateMachineNodes(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Machine');if(b['length']===0x0)return!![];return!![];}function validateGuardsFlagged(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Guard');for(const c of b){if(!c['risk_flags']||!c['risk_flags']['includes']('immutable_after_creation'))return![];}return!![];}function validateAllocationSum(a){const b=a['scenario']['objects']['filter'](c=>c['type']==='Allocation');if(b['length']===0x0)return!![];return!![];}function validateDependenciesAcyclic(a){const b=a['scenario']['objects'],c=new Set(),d=new Set();function e(f,g){if(d['has'](f))return!![];if(c['has'](f))return![];c['add'](f),d['add'](f);const h=b['find'](i=>i['type']===f);if(h)for(const i of h['dependencies']){if(g['has'](i))continue;if(e(i,new Set([...g,f])))return!![];}return d['delete'](f),![];}for(const f of b){c['clear'](),d['clear']();if(e(f['type'],new Set()))return![];}return!![];}function validatePhasesCoverObjects(a){const b=new Set(a['scenario']['objects']['map'](c=>c['type']));for(const c of a['scenario']['phases']){for(const d of c['object_types']){if(!b['has'](d))return![];}}return!![];}function validateDescription(a){return!!a['description']&&a['description']['trim']()['length']>0x0;}function validateKeywords(a){return a['scenario']['keywords']['length']>=0x3;}function validateArbiter(a){return a['scenario']['default_permissions']['arbiter']!==undefined;}function validateNoInfiniteLoops(a){return!![];}const VALIDATORS={'permission_indexes_valid':validatePermissionIndexes,'machine_nodes_min_two':validateMachineNodes,'guards_immutable_flagged':validateGuardsFlagged,'allocation_sum_correct':validateAllocationSum,'dependencies_acyclic':validateDependenciesAcyclic,'phases_cover_objects':validatePhasesCoverObjects,'description_non_empty':validateDescription,'keywords_non_empty':validateKeywords,'arbiter_configured':validateArbiter,'no_infinite_loops':validateNoInfiniteLoops};export function runAudit(a,b){const c={},d=[];for(const g of AUDIT_CHECKLIST){const h=VALIDATORS[g['key']],i=h?h(a):!![];c[g['key']]=i,!i&&g['required']&&d['push'](g['key']);}const e='AUDIT-'+Date['now']()+'-'+Math['random']()['toString'](0x24)['slice'](0x2,0x6),f=d['length']===0x0?'All\x20required\x20checklist\x20items\x20passed.':'Failed\x20required\x20items:\x20'+d['join'](',\x20');return{'audit_id':e,'template_id':a['template_id'],'auditor':b,'timestamp':new Date()['toISOString'](),'checklist_results':c,'passed':d['length']===0x0,'failed_required_items':d,'notes':f};}export const MIN_COMMUNITY_RATING_FOR_APPROVAL=3.5;export const MIN_REVIEWS_FOR_APPROVAL=0x1;export function meetsCommunityRatingThreshold(a){if(a['reviews']['length']<MIN_REVIEWS_FOR_APPROVAL)return![];return a['average_rating']>=MIN_COMMUNITY_RATING_FOR_APPROVAL;}export function canApprove(a,b){return b['passed']&&meetsCommunityRatingThreshold(a);}export function getApprovalEligibility(a,b){const c=[];return!b['passed']&&c['push']('Official\x20audit\x20failed:\x20'+b['failed_required_items']['join'](',\x20')),a['reviews']['length']<MIN_REVIEWS_FOR_APPROVAL&&c['push']('Insufficient\x20community\x20reviews:\x20'+a['reviews']['length']+'/'+MIN_REVIEWS_FOR_APPROVAL),a['average_rating']<MIN_COMMUNITY_RATING_FOR_APPROVAL&&c['push']('Community\x20rating\x20too\x20low:\x20'+a['average_rating']['toFixed'](0x1)+'/'+MIN_COMMUNITY_RATING_FOR_APPROVAL),{'eligible':c['length']===0x0,'blockers':c};}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ScenarioTemplate } from "../harness/types.js";
|
|
2
|
-
export interface ModeSubmission {
|
|
3
|
-
submission_id: string;
|
|
4
|
-
submitter: string;
|
|
5
|
-
submitted_date: string;
|
|
6
|
-
template_name: string;
|
|
7
|
-
version: string;
|
|
8
|
-
description: string;
|
|
9
|
-
tags: string[];
|
|
10
|
-
scenario: ScenarioTemplate;
|
|
11
|
-
contact?: string;
|
|
12
|
-
license?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface SubmissionValidationResult {
|
|
15
|
-
valid: boolean;
|
|
16
|
-
errors: string[];
|
|
17
|
-
warnings: string[];
|
|
18
|
-
}
|
|
19
|
-
export declare function validateSubmission(submission: ModeSubmission): SubmissionValidationResult;
|
|
20
|
-
export declare function createSubmission(submitter: string, templateName: string, description: string, scenario: ScenarioTemplate, options?: {
|
|
21
|
-
version?: string;
|
|
22
|
-
tags?: string[];
|
|
23
|
-
contact?: string;
|
|
24
|
-
license?: string;
|
|
25
|
-
}): ModeSubmission;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const VALID_OBJECT_TYPES=['Permission','Service','Machine','Guard','Allocation','Progress','Repository','Treasury','Reward','Demand','Order','Arbitration','Contact','Personal','Payment'];export function validateSubmission(a){const b=[],c=[];(!a['template_name']||a['template_name']['trim']()['length']===0x0)&&b['push']('template_name\x20is\x20required');(!a['submitter']||a['submitter']['trim']()['length']===0x0)&&b['push']('submitter\x20is\x20required');(!a['description']||a['description']['trim']()['length']===0x0)&&b['push']('description\x20is\x20required');!a['scenario']&&b['push']('scenario\x20is\x20required');a['version']&&!/^\d+\.\d+\.\d+$/['test'](a['version'])&&b['push']('version\x20must\x20be\x20in\x20semver\x20format\x20(e.g.,\x20\x271.0.0\x27)');if(a['scenario']){const d=a['scenario'];(!d['name']||d['name']['trim']()['length']===0x0)&&b['push']('scenario.name\x20is\x20required');if(!d['keywords']||d['keywords']['length']===0x0)c['push']('scenario.keywords\x20is\x20empty\x20—\x20intent\x20matching\x20will\x20fail');else d['keywords']['length']<0x3&&c['push']('scenario.keywords\x20has\x20fewer\x20than\x203\x20entries\x20—\x20intent\x20matching\x20may\x20be\x20weak');if(!d['objects']||d['objects']['length']===0x0)b['push']('scenario.objects\x20must\x20have\x20at\x20least\x20one\x20object');else for(const f of d['objects']){!VALID_OBJECT_TYPES['includes'](f['type'])&&b['push']('Invalid\x20object\x20type:\x20\x27'+f['type']+'\x27.\x20Valid\x20types:\x20'+VALID_OBJECT_TYPES['join'](',\x20')),f['dependencies']['includes'](f['type'])&&c['push']('Object\x20type\x20\x27'+f['type']+'\x27\x20depends\x20on\x20itself\x20—\x20may\x20cause\x20issues');}(!d['phases']||d['phases']['length']===0x0)&&c['push']('scenario.phases\x20is\x20empty\x20—\x20no\x20phased\x20execution\x20plan\x20defined');const e=d['default_permissions'];e['provider']!==undefined&&typeof e['provider']==='number'&&((e['provider']<0x3e8||e['provider']>0xffff)&&b['push']('default_permissions.provider\x20index\x20'+e['provider']+'\x20is\x20out\x20of\x20range\x20(1000-65535)')),e['arbiter']!==undefined&&typeof e['arbiter']==='number'&&((e['arbiter']<0x3e8||e['arbiter']>0xffff)&&b['push']('default_permissions.arbiter\x20index\x20'+e['arbiter']+'\x20is\x20out\x20of\x20range\x20(1000-65535)'));}return a['tags']&&a['tags']['length']>0xa&&c['push']('More\x20than\x2010\x20tags\x20—\x20consider\x20trimming\x20for\x20relevance'),{'valid':b['length']===0x0,'errors':b,'warnings':c};}export function createSubmission(a,b,c,d,e){return{'submission_id':'SUB-'+Date['now']()+'-'+Math['random']()['toString'](0x24)['slice'](0x2,0x8),'submitter':a,'submitted_date':new Date()['toISOString'](),'template_name':b,'version':e?.['version']||'1.0.0','description':c,'tags':e?.['tags']||[],'scenario':d,'contact':e?.['contact'],'license':e?.['license']};}
|