@wowok/agent-mcp 2.7.2 → 2.7.3
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/runtime.js +1 -1
- package/dist/customer/account-events.d.ts +32 -0
- package/dist/customer/account-events.js +1 -0
- package/dist/customer/customer-advice.d.ts +1 -0
- package/dist/customer/customer-advice.js +1 -1
- package/dist/customer/info-puzzle.js +1 -1
- package/dist/customer/order-strategy.d.ts +1 -1
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +1 -1
- package/dist/customer/risk-assessment.d.ts +1 -0
- package/dist/customer/risk-assessment.js +1 -1
- package/dist/customer/types.d.ts +2 -0
- package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +1 -0
- package/dist/evaluation/builtins/index.js +1 -1
- package/dist/evaluation/category-match-rules.d.ts +30 -0
- package/dist/evaluation/category-match-rules.js +1 -0
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +1 -1
- package/dist/evaluation/location-match.d.ts +42 -0
- package/dist/evaluation/location-match.js +1 -0
- package/dist/evaluation/path-reasoning.d.ts +35 -0
- package/dist/evaluation/path-reasoning.js +1 -0
- package/dist/evaluation/region.d.ts +6 -0
- package/dist/evaluation/region.js +1 -1
- package/dist/evaluation/types.d.ts +17 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/experience/user-profile.d.ts +1 -1
- package/dist/extensions/index.d.ts +6 -0
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-layers.d.ts +75 -0
- package/dist/extensions/industry-layers.js +1 -0
- package/dist/extensions/industry-pack.d.ts +105 -0
- package/dist/extensions/industry-pack.js +1 -0
- package/dist/extensions/metric-registry.js +1 -1
- package/dist/extensions/mode-evaluator.d.ts +1 -1
- package/dist/extensions/registry.d.ts +1 -0
- package/dist/extensions/registry.js +1 -1
- package/dist/graph/base.d.ts +8 -0
- package/dist/graph/base.js +1 -0
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -1
- package/dist/harness/plan.d.ts +2 -0
- package/dist/harness/plan.js +1 -1
- package/dist/harness/recover.d.ts +1 -1
- package/dist/harness/types.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/knowledge/allocation-confirm.js +1 -1
- package/dist/knowledge/anti-cheat.d.ts +37 -0
- package/dist/knowledge/anti-cheat.js +1 -0
- package/dist/knowledge/arb-confirm.d.ts +28 -0
- package/dist/knowledge/arb-confirm.js +1 -0
- package/dist/knowledge/arb-translation.d.ts +48 -0
- package/dist/knowledge/arb-translation.js +1 -0
- package/dist/knowledge/arbitration-context.js +1 -1
- package/dist/knowledge/bridge-confirm.d.ts +26 -0
- package/dist/knowledge/bridge-confirm.js +1 -0
- package/dist/knowledge/bridge-translation.d.ts +37 -0
- package/dist/knowledge/bridge-translation.js +1 -0
- package/dist/knowledge/contact-confirm.d.ts +27 -0
- package/dist/knowledge/contact-confirm.js +1 -0
- package/dist/knowledge/contact-translation.d.ts +39 -0
- package/dist/knowledge/contact-translation.js +1 -0
- package/dist/knowledge/demand-context.d.ts +17 -0
- package/dist/knowledge/demand-context.js +1 -0
- package/dist/knowledge/demand-ledger.d.ts +26 -0
- package/dist/knowledge/demand-ledger.js +1 -0
- package/dist/knowledge/demand-puzzle.d.ts +29 -0
- package/dist/knowledge/demand-puzzle.js +1 -0
- package/dist/knowledge/demand-templates.d.ts +12 -0
- package/dist/knowledge/demand-templates.js +1 -0
- package/dist/knowledge/demand-translation.js +1 -1
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/evidence-review.d.ts +12 -0
- package/dist/knowledge/evidence-review.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -1
- package/dist/knowledge/examples-scanner.js +1 -1
- package/dist/knowledge/flywheel-loop.d.ts +0 -1
- package/dist/knowledge/flywheel-loop.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-migration.d.ts +1 -1
- package/dist/knowledge/index.d.ts +71 -3
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/machine-render.js +1 -1
- package/dist/knowledge/market-metrics.d.ts +12 -0
- package/dist/knowledge/market-metrics.js +1 -0
- package/dist/knowledge/market-operations.d.ts +46 -0
- package/dist/knowledge/market-operations.js +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
- package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
- package/dist/knowledge/mcp-schema-audit.js +1 -1
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/payment-confirm.d.ts +26 -0
- package/dist/knowledge/payment-confirm.js +1 -0
- package/dist/knowledge/payment-translation.d.ts +37 -0
- package/dist/knowledge/payment-translation.js +1 -0
- package/dist/knowledge/permission-ledger.d.ts +11 -0
- package/dist/knowledge/permission-ledger.js +1 -1
- package/dist/knowledge/personal-confirm.d.ts +29 -0
- package/dist/knowledge/personal-confirm.js +1 -0
- package/dist/knowledge/personal-translation.d.ts +37 -0
- package/dist/knowledge/personal-translation.js +1 -0
- package/dist/knowledge/process-model.d.ts +1 -11
- package/dist/knowledge/process-model.js +1 -1
- package/dist/knowledge/proof-context.d.ts +17 -0
- package/dist/knowledge/proof-context.js +1 -0
- package/dist/knowledge/proof-ledger.d.ts +34 -0
- package/dist/knowledge/proof-ledger.js +1 -0
- package/dist/knowledge/proof-puzzle.d.ts +35 -0
- package/dist/knowledge/proof-puzzle.js +1 -0
- package/dist/knowledge/proof-templates.d.ts +22 -0
- package/dist/knowledge/proof-templates.js +1 -0
- package/dist/knowledge/registrar-confirm.d.ts +26 -0
- package/dist/knowledge/registrar-confirm.js +1 -0
- package/dist/knowledge/registrar-translation.d.ts +37 -0
- package/dist/knowledge/registrar-translation.js +1 -0
- package/dist/knowledge/repository-context.d.ts +12 -0
- package/dist/knowledge/repository-context.js +1 -0
- package/dist/knowledge/repository-ledger.d.ts +25 -0
- package/dist/knowledge/repository-ledger.js +1 -0
- package/dist/knowledge/repository-puzzle.d.ts +30 -0
- package/dist/knowledge/repository-puzzle.js +1 -0
- package/dist/knowledge/repository-templates.d.ts +14 -0
- package/dist/knowledge/repository-templates.js +1 -0
- package/dist/knowledge/resource-confirm.d.ts +25 -0
- package/dist/knowledge/resource-confirm.js +1 -0
- package/dist/knowledge/resource-translation.d.ts +37 -0
- package/dist/knowledge/resource-translation.js +1 -0
- package/dist/knowledge/reward-context.d.ts +2 -2
- package/dist/knowledge/safety-rules.d.ts +1 -0
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/universal-template.d.ts +22 -0
- package/dist/knowledge/universal-template.js +1 -0
- package/dist/knowledge/util-confirm.d.ts +24 -0
- package/dist/knowledge/util-confirm.js +1 -0
- package/dist/knowledge/util-translation.d.ts +38 -0
- package/dist/knowledge/util-translation.js +1 -0
- package/dist/knowledge/workflow-guidance.d.ts +116 -0
- package/dist/knowledge/workflow-guidance.js +1 -0
- package/dist/participation/employee-kpi.d.ts +25 -0
- package/dist/participation/employee-kpi.js +1 -0
- package/dist/participation/employee-store.d.ts +16 -0
- package/dist/participation/employee-store.js +1 -0
- package/dist/participation/index.d.ts +2 -0
- package/dist/participation/index.js +1 -0
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/index.d.ts +9 -2
- package/dist/persona/index.js +1 -1
- package/dist/persona/local-region.d.ts +20 -0
- package/dist/persona/local-region.js +1 -0
- package/dist/persona/model.js +1 -1
- package/dist/persona/overrides.d.ts +10 -0
- package/dist/persona/overrides.js +1 -0
- package/dist/persona/pack-personae.d.ts +11 -0
- package/dist/persona/pack-personae.js +1 -0
- package/dist/persona/strategy-intent.d.ts +20 -0
- package/dist/persona/strategy-intent.js +1 -0
- package/dist/persona/types.d.ts +3 -1
- package/dist/project/business-puzzle.d.ts +1 -1
- package/dist/project/business-puzzle.js +1 -1
- package/dist/project/deployment-doc.js +1 -1
- package/dist/project/edit-planner.js +1 -1
- package/dist/project/evaluation.d.ts +37 -1
- package/dist/project/evaluation.js +1 -1
- package/dist/project/graph.d.ts +3 -6
- package/dist/project/handlers.d.ts +33 -2
- package/dist/project/handlers.js +1 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -1
- package/dist/project/merchant-guide.d.ts +19 -0
- package/dist/project/merchant-guide.js +1 -1
- package/dist/project/mode-actions.js +1 -1
- package/dist/project/rollback-policy.js +1 -1
- package/dist/project/semantic-graph.d.ts +3 -5
- package/dist/project/workflow-design-assessment.d.ts +24 -0
- package/dist/project/workflow-design-assessment.js +1 -0
- package/dist/safety/confirm-gate.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +186 -1385
- package/dist/schema/call/arbitration.d.ts +272 -1871
- package/dist/schema/call/base.d.ts +1831 -9076
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +911 -3171
- package/dist/schema/call/contact.d.ts +135 -931
- package/dist/schema/call/demand.d.ts +164 -1194
- package/dist/schema/call/guard.d.ts +298 -1140
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +459 -5403
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +137 -844
- package/dist/schema/call/payment.d.ts +74 -561
- package/dist/schema/call/permission.d.ts +335 -2791
- package/dist/schema/call/personal.d.ts +227 -1814
- package/dist/schema/call/progress.d.ts +140 -843
- package/dist/schema/call/proof.d.ts +42 -258
- package/dist/schema/call/repository.d.ts +324 -2222
- package/dist/schema/call/reward.d.ts +153 -1183
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +376 -3431
- package/dist/schema/call/treasury.d.ts +252 -2158
- package/dist/schema/common/index.d.ts +222 -697
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/config/index.d.ts +18 -161
- package/dist/schema/employee/index.d.ts +99 -0
- package/dist/schema/employee/index.js +1 -0
- package/dist/schema/evaluation/index.d.ts +1035 -3918
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +132 -0
- package/dist/schema/industry-pack/index.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +92 -245
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/local/index.d.ts +2045 -18080
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/local/wip.d.ts +61 -651
- package/dist/schema/local/wip.js +1 -1
- package/dist/schema/messenger/index.d.ts +949 -5557
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +2969 -26518
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +469 -1820
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/project/index.d.ts +1023 -8450
- package/dist/schema/project/index.js +1 -1
- package/dist/schema/query/index.d.ts +12042 -75678
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +35 -98
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/task-status.d.ts +26 -132
- package/dist/schema/trust/index.d.ts +194 -1290
- package/dist/schema/utils/guard-parser.js +1 -1
- package/dist/schema/utils/node-parser.js +1 -1
- package/dist/schema/utils/skills-recommendation.d.ts +1 -0
- package/dist/schema/utils/skills-recommendation.js +1 -1
- package/dist/schema/workspace/index.d.ts +69 -0
- package/dist/schema/workspace/index.js +1 -0
- package/dist/{schema-query → schema-query-impl}/index.js +1 -1
- package/dist/schemas/account_operation.output.json +3147 -1655
- package/dist/schemas/account_operation.schema.json +225 -218
- package/dist/schemas/bridge_operation.output.json +1168 -653
- package/dist/schemas/bridge_operation.schema.json +736 -504
- package/dist/schemas/config_operation.output.json +185 -179
- package/dist/schemas/config_operation.schema.json +21 -26
- package/dist/schemas/employee_operation.output.json +207 -0
- package/dist/schemas/employee_operation.schema.json +176 -0
- package/dist/schemas/evaluation_operation.output.json +2268 -601
- package/dist/schemas/evaluation_operation.schema.json +2919 -787
- package/dist/schemas/guard2file.output.json +58 -64
- package/dist/schemas/guard2file.schema.json +79 -81
- package/dist/schemas/index.json +29 -11
- package/dist/schemas/industry_pack_operation.output.json +594 -0
- package/dist/schemas/industry_pack_operation.schema.json +55 -0
- package/dist/schemas/intent_radar.output.json +275 -203
- package/dist/schemas/intent_radar.schema.json +124 -126
- package/dist/schemas/local_info_operation.output.json +1174 -660
- package/dist/schemas/local_info_operation.schema.json +119 -125
- package/dist/schemas/local_mark_operation.output.json +1239 -692
- package/dist/schemas/local_mark_operation.schema.json +91 -96
- package/dist/schemas/machineNode2file.output.json +63 -69
- package/dist/schemas/machineNode2file.schema.json +79 -81
- package/dist/schemas/messenger_operation.output.json +2722 -1531
- package/dist/schemas/messenger_operation.schema.json +1482 -1264
- package/dist/schemas/onchain_events.output.json +2590 -978
- package/dist/schemas/onchain_events.schema.json +117 -99
- package/dist/schemas/onchain_operations.output.json +3957 -2312
- package/dist/schemas/onchain_operations.schema.json +20799 -9285
- package/dist/schemas/onchain_operations_allocation.schema.json +171 -107
- package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
- package/dist/schemas/onchain_operations_contact.schema.json +129 -90
- package/dist/schemas/onchain_operations_demand.schema.json +170 -112
- package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
- package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
- package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
- package/dist/schemas/onchain_operations_machine.schema.json +536 -163
- package/dist/schemas/onchain_operations_order.schema.json +126 -96
- package/dist/schemas/onchain_operations_payment.schema.json +82 -67
- package/dist/schemas/onchain_operations_permission.schema.json +331 -93
- package/dist/schemas/onchain_operations_personal.schema.json +636 -96
- package/dist/schemas/onchain_operations_progress.schema.json +125 -92
- package/dist/schemas/onchain_operations_proof.schema.json +76 -69
- package/dist/schemas/onchain_operations_repository.schema.json +636 -249
- package/dist/schemas/onchain_operations_reward.schema.json +218 -108
- package/dist/schemas/onchain_operations_service.schema.json +678 -220
- package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
- package/dist/schemas/onchain_table_data.output.json +6018 -2433
- package/dist/schemas/onchain_table_data.schema.json +544 -430
- package/dist/schemas/persona_operation.output.json +1568 -268
- package/dist/schemas/persona_operation.schema.json +346 -205
- package/dist/schemas/project_operation.output.json +6922 -5132
- package/dist/schemas/project_operation.schema.json +1050 -1020
- package/dist/schemas/query_task_status.output.json +195 -99
- package/dist/schemas/query_task_status.schema.json +12 -18
- package/dist/schemas/query_toolkit.output.json +18862 -14561
- package/dist/schemas/query_toolkit.schema.json +614 -522
- package/dist/schemas/schema_query.output.json +127 -129
- package/dist/schemas/schema_query.schema.json +64 -69
- package/dist/schemas/trust_score.output.json +678 -587
- package/dist/schemas/trust_score.schema.json +289 -277
- package/dist/schemas/wip_file.output.json +116 -124
- package/dist/schemas/wip_file.schema.json +142 -143
- package/dist/schemas/workspace_operation.output.json +277 -0
- package/dist/schemas/workspace_operation.schema.json +45 -0
- package/dist/schemas/wowok_buildin_info.output.json +1682 -844
- package/dist/schemas/wowok_buildin_info.schema.json +576 -526
- package/dist/tools/handlers/bridge.d.ts +8 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/employee.d.ts +2 -0
- package/dist/tools/handlers/employee.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/file-export.js +1 -1
- package/dist/tools/handlers/industry-pack.d.ts +2 -0
- package/dist/tools/handlers/industry-pack.js +1 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/project.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/trust.js +1 -1
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/handlers/workspace.d.ts +2 -0
- package/dist/tools/handlers/workspace.js +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/types.d.ts +2 -1
- package/package.json +4 -5
- package/dist/knowledge/arbitration-trust.d.ts +0 -24
- package/dist/knowledge/arbitration-trust.js +0 -1
- package/dist/schema/call/bridge-handler.d.ts +0 -8
- package/dist/schema/call/bridge-handler.js +0 -1
- package/dist/schema/sync-layer4.d.ts +0 -21
- package/dist/schema/sync-layer4.js +0 -1
- /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const PERSONAL_CONFIRM_VERSION = "1.0.0";
|
|
2
|
+
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
+
export interface PersonalConfirmItem {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: ConfirmSeverity;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
evidence?: string;
|
|
10
|
+
fix_hint?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PersonalOpCheckInput {
|
|
13
|
+
information_entries?: Array<{
|
|
14
|
+
name: string;
|
|
15
|
+
value: unknown;
|
|
16
|
+
}>;
|
|
17
|
+
is_mark_destroy?: boolean;
|
|
18
|
+
is_mark_transfer?: boolean;
|
|
19
|
+
information_count?: number;
|
|
20
|
+
singleton_enforced?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function preCheckPersonalOp(input: PersonalOpCheckInput): PersonalConfirmItem[];
|
|
23
|
+
export declare function canProceedPersonalOp(input: PersonalOpCheckInput): {
|
|
24
|
+
canProceed: boolean;
|
|
25
|
+
blockers: PersonalConfirmItem[];
|
|
26
|
+
warnings: PersonalConfirmItem[];
|
|
27
|
+
info: PersonalConfirmItem[];
|
|
28
|
+
};
|
|
29
|
+
export declare function formatPersonalOpSummary(input: PersonalOpCheckInput): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_RECORD_COUNT_REGISTRAR}from'@wowok/wowok';export const PERSONAL_CONFIRM_VERSION='1.0.0';function detectSensitive(a){const b=[];for(const c of a){const d=typeof c['value']==='string'?c['value']:String(c['value']??'');if(/^\+?\d{10,15}$/['test'](d))b['push'](c['name']+'=phone-like');if(/[^\s@]+@[^\s@]+\.[^\s@]+/['test'](d))b['push'](c['name']+'=email-like');if(/^(0x)?[0-9a-fA-F]{64}$/['test'](d))b['push'](c['name']+'=private-key-like');if(/^([a-z]{3,8}\s){11,23}[a-z]{3,8}$/['test'](d['trim']()))b['push'](c['name']+'=mnemonic-like');if(/private[_-]?key|secret|mnemonic|seed/i['test'](c['name']))b['push'](c['name']+'=secret-named');}return b;}function checkSensitive(a){if(!a['information_entries']||a['information_entries']['length']===0x0)return{'id':'C-PERSONAL-01','severity':'info','title':'No\x20sensitive\x20information\x20written\x20on-chain','description':'On-chain\x20records\x20are\x20permanent\x20and\x20public.\x20Phone/email/private-key/mnemonic\x20must\x20never\x20be\x20stored.','passed':!![],'evidence':'no\x20information\x20entries'};const b=detectSensitive(a['information_entries']),c=b['length']===0x0;return{'id':'C-PERSONAL-01','severity':c?'info':'block','title':'Sensitive\x20information\x20detected\x20—\x20on-chain\x20data\x20is\x20permanent','description':'information\x20is\x20stored\x20as\x20on-chain\x20Records\x20with\x20no\x20delete.\x20Once\x20written,\x20phone/email/private-key/mnemonic\x20is\x20public\x20forever.','passed':c,'evidence':c?'no\x20sensitive\x20patterns':'sensitive\x20patterns:\x20'+b['join'](';\x20'),'fix_hint':'Use\x20the\x20\x27local\x27\x20tool\x20for\x20private\x20data;\x20re-confirm\x20before\x20writing\x20on-chain.'};}function checkSingleton(a){if(a['singleton_enforced']!==![])return{'id':'C-PERSONAL-02','severity':'info','title':'Singleton\x20invariant\x20enforced','description':'Each\x20user\x20has\x20exactly\x20one\x20Entity\x20record\x20+\x20one\x20Resource\x20mark\x20via\x20entity_register\x20idempotency.','passed':!![],'evidence':'singleton\x20enforced'};return{'id':'C-PERSONAL-02','severity':'warn','title':'Singleton\x20invariant\x20not\x20enforced\x20—\x20duplicate\x20identity\x20risk','description':'entity_register_with_resource_forced\x20can\x20create\x20a\x20second\x20Resource\x20mark,\x20invalidating\x20the\x20old\x20address.','passed':![],'evidence':'singleton_enforced=false','fix_hint':'Refuse\x20entity_register_with_resource_forced\x20unless\x20the\x20user\x20explicitly\x20opts\x20in.'};}function checkDestroy(a){if(!a['is_mark_destroy'])return{'id':'C-PERSONAL-03','severity':'info','title':'mark\x20destroy\x20is\x20irreversible','description':'Destroying\x20the\x20mark\x20Resource\x20permanently\x20removes\x20the\x20user\x27s\x20on-chain\x20identity\x20mark.','passed':!![],'evidence':'not\x20destroying'};return{'id':'C-PERSONAL-03','severity':'warn','title':'mark\x20destroy\x20is\x20irreversible\x20—\x20identity\x20mark\x20permanently\x20lost','description':'After\x20destroy,\x20the\x20user\x20has\x20no\x20on-chain\x20identity\x20mark\x20until\x20re-created,\x20breaking\x20downstream\x20services\x20keyed\x20on\x20the\x20old\x20Resource.','passed':![],'evidence':'is_mark_destroy=true','fix_hint':'Prefer\x20a\x20\x27replace\x27\x20alternative\x20that\x20swaps\x20the\x20Resource\x20without\x20losing\x20continuity.'};}function checkTransfer(a){if(!a['is_mark_transfer'])return{'id':'C-PERSONAL-04','severity':'info','title':'mark\x20transfer\x20detaches\x20source\x20address','description':'Transferring\x20the\x20mark\x20moves\x20the\x20Resource\x20to\x20a\x20new\x20address;\x20the\x20source\x20loses\x20the\x20binding.','passed':!![],'evidence':'not\x20transferring'};return{'id':'C-PERSONAL-04','severity':'warn','title':'mark\x20transfer\x20will\x20detach\x20the\x20mark\x20from\x20this\x20address','description':'Services\x20keyed\x20on\x20the\x20source\x20address\x20lose\x20the\x20binding;\x20no\x20forwarding\x20stub\x20is\x20left\x20behind.','passed':![],'evidence':'is_mark_transfer=true','fix_hint':'Warn\x20the\x20user\x20that\x20old-address\x20logins\x20will\x20break;\x20track\x20marks\x20by\x20Resource\x20address.'};}function checkRecordCount(a){if(a['information_count']===undefined)return{'id':'C-PERSONAL-05','severity':'info','title':'information_count\x20below\x20MAX_RECORD_COUNT_REGISTRAR\x20('+MAX_RECORD_COUNT_REGISTRAR+')','description':'Personal\x20inherits\x20Entity\x27s\x20record\x20cap.','passed':!![],'evidence':'not\x20provided'};const b=a['information_count']<MAX_RECORD_COUNT_REGISTRAR;return{'id':'C-PERSONAL-05','severity':b?'info':'warn','title':'information_count\x20below\x20MAX_RECORD_COUNT_REGISTRAR\x20('+MAX_RECORD_COUNT_REGISTRAR+')','description':'Entity\x27s\x20record\x20cap\x20is\x20MAX_RECORD_COUNT_REGISTRAR='+MAX_RECORD_COUNT_REGISTRAR+'.','passed':b,'evidence':'information_count='+a['information_count']+',\x20limit='+MAX_RECORD_COUNT_REGISTRAR,'fix_hint':'Self-limit\x20profile\x20data;\x20store\x20bulk\x20data\x20off-chain\x20via\x20Repository/Proof.'};}export function preCheckPersonalOp(a){return[checkSensitive(a),checkSingleton(a),checkDestroy(a),checkTransfer(a),checkRecordCount(a)];}export function canProceedPersonalOp(a){const b=preCheckPersonalOp(a);return{'canProceed':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatPersonalOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedPersonalOp(a),e=[b?'✓\x20Personal\x20operation\x20pre-check\x20PASSED':'✗\x20Personal\x20operation\x20pre-check\x20FAILED',''];return c['length']>0x0&&(e['push']('BLOCKERS:'),c['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??''))),e['push']('')),d['length']>0x0&&(e['push']('WARNINGS:'),d['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??'')))),e['join']('\x0a');}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const PERSONAL_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
+
export interface SemanticToPersonalSchemaRule {
|
|
3
|
+
id: string;
|
|
4
|
+
pattern_name: string;
|
|
5
|
+
semantic_intent: string;
|
|
6
|
+
match_keywords: string[];
|
|
7
|
+
required_fields: string[];
|
|
8
|
+
optional_fields: string[];
|
|
9
|
+
example: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare const SEMANTIC_TO_PERSONAL_SCHEMA_RULES: SemanticToPersonalSchemaRule[];
|
|
12
|
+
export interface PersonalFieldTranslation {
|
|
13
|
+
field_name: string;
|
|
14
|
+
value_type: string;
|
|
15
|
+
semantic: string;
|
|
16
|
+
format_example: string;
|
|
17
|
+
validation_rules: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const PERSONAL_FIELD_TRANSLATIONS: PersonalFieldTranslation[];
|
|
20
|
+
export interface PersonalConstraintRule {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
related_field: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const PERSONAL_CONSTRAINT_RULES: PersonalConstraintRule[];
|
|
27
|
+
export interface PersonalExplainInput {
|
|
28
|
+
description?: string;
|
|
29
|
+
information_count?: number;
|
|
30
|
+
has_mark?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface PersonalExplanation {
|
|
33
|
+
summary: string;
|
|
34
|
+
mark_status: string;
|
|
35
|
+
warnings: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function explainPersonal(input: PersonalExplainInput): PersonalExplanation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PERSONAL_TRANSLATION_VERSION='1.0.0';export const SEMANTIC_TO_PERSONAL_SCHEMA_RULES=[{'id':'P-PERSONAL-01','pattern_name':'Register\x20identity','semantic_intent':'Create\x20a\x20user\x20identity\x20(Entity\x20record\x20+\x20Resource\x20mark)\x20via\x20entity_register.','match_keywords':['register','create\x20identity','open\x20account'],'required_fields':[],'optional_fields':['referrer'],'example':{'referrer':'0x...'}},{'id':'P-PERSONAL-02','pattern_name':'Add\x20information','semantic_intent':'Add\x20a\x20named\x20record\x20to\x20the\x20user\x27s\x20Entity\x20(never\x20store\x20sensitive\x20data).','match_keywords':['add\x20info','set\x20profile','add\x20record'],'required_fields':['name','typed_value'],'optional_fields':[],'example':{'name':'preferences','typed_value':'0x...'}}];export const PERSONAL_FIELD_TRANSLATIONS=[{'field_name':'information','value_type':'vector<Record>\x20(via\x20Entity)','semantic':'User\x20profile\x20records;\x20Record{name,\x20typed_value}.','format_example':'[{name,\x20typed_value}]','validation_rules':['never\x20store\x20phone/email/private-key','record\x20cap\x20via\x20Entity']},{'field_name':'mark','value_type':'address\x20(Resource)','semantic':'Identity\x20mark\x20—\x20a\x20Resource\x20holding\x20tags.','format_example':'0x...resource...','validation_rules':['singleton\x20per\x20user','transfer\x20detaches\x20source']},{'field_name':'referrer','value_type':'Option<address>','semantic':'Self-attested\x20referrer\x20(not\x20a\x20verified\x20trust\x20signal).','format_example':'0x...referrer...','validation_rules':['unverified\x20—\x20treat\x20as\x20hint']},{'field_name':'description','value_type':'string','semantic':'User\x20description\x20(Entity).','format_example':'merchant\x20in\x20Shenzhen','validation_rules':['common::DESCRIPTION']}];export const PERSONAL_CONSTRAINT_RULES=[{'id':'PERSONAL_C_01','name':'sensitive\x20data','description':'no\x20phone/email/private-key/mnemonic\x20on-chain.','related_field':'information'},{'id':'PERSONAL_C_02','name':'singleton','description':'one\x20Entity\x20record\x20+\x20one\x20Resource\x20mark\x20per\x20user.','related_field':'mark'},{'id':'PERSONAL_C_03','name':'referrer\x20unverified','description':'referrer\x20is\x20self-attested,\x20not\x20consent-verified.','related_field':'referrer'}];export function explainPersonal(a){const b=[],c=a['has_mark']?'has\x20identity\x20mark':'no\x20identity\x20mark';if(!a['has_mark'])b['push']('user\x20has\x20no\x20Resource\x20mark;\x20register\x20before\x20on-chain\x20identity\x20ops');return{'summary':'Personal\x20('+(a['description']??'no\x20description')+').\x20'+c+'.\x20'+(a['information_count']??'?')+'\x20information\x20records.','mark_status':c,'warnings':b};}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
export type PermissionScope
|
|
2
|
-
export interface PermissionTypeDef {
|
|
3
|
-
name: "Permission" | "NamedOperator" | "OrderHolder";
|
|
4
|
-
scope: PermissionScope;
|
|
5
|
-
definedOn: string;
|
|
6
|
-
controls: string;
|
|
7
|
-
grantedBy: string;
|
|
8
|
-
example: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const PERMISSION_TYPES: PermissionTypeDef[];
|
|
1
|
+
export { PERMISSION_TYPES, getPermissionType, type PermissionScope, type PermissionTypeDef, } from "./permission-ledger.js";
|
|
11
2
|
export type GameElementType = "player" | "strategy" | "payoff" | "utility" | "equilibrium" | "information" | "sequence" | "repetition" | "commitment" | "punishment" | "reward" | "reputation" | "signaling" | "screening" | "bargaining" | "auction" | "mechanism" | "constraint" | "uncertainty" | "cooperation";
|
|
12
3
|
export interface GameElementDef {
|
|
13
4
|
id: number;
|
|
@@ -18,7 +9,6 @@ export interface GameElementDef {
|
|
|
18
9
|
onChainMechanism: string;
|
|
19
10
|
}
|
|
20
11
|
export declare const GAME_ELEMENTS: GameElementDef[];
|
|
21
|
-
export declare function getPermissionType(name: string): PermissionTypeDef | undefined;
|
|
22
12
|
export declare function getGameElement(id: number): GameElementDef | undefined;
|
|
23
13
|
export declare function getGameElementsByType(type: GameElementType): GameElementDef[];
|
|
24
14
|
export declare const PROCESS_MODEL_VERSION = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PERMISSION_TYPES=[{'name':'Permission','scope':'organization','definedOn':'Permission\x20Object\x20(standalone\x20on-chain\x20object,\x20referenced\x20by\x20service/machine/etc.)','controls':'Who\x20can\x20modify\x20the\x20bound\x20object\x27s\x20settings,\x20publish\x20it,\x20manage\x20its\x20funds,\x20etc.','grantedBy':'The\x20object\x27s\x20creator\x20(owner)\x20or\x20anyone\x20the\x20creator\x20delegates\x20to','example':'A\x20shop\x20owner\x20creates\x20a\x20Permission\x20allowing\x20only\x20their\x20staff\x20to\x20modify\x20the\x20Service\x27s\x20price.'},{'name':'NamedOperator','scope':'order','definedOn':'Per-order\x20(specified\x20in\x20the\x20order\x20creation/modification\x20by\x20the\x20service)','controls':'Who\x20can\x20operate\x20on\x20a\x20specific\x20order:\x20advance\x20progress,\x20settle,\x20refund,\x20etc.','grantedBy':'The\x20service\x20(via\x20its\x20order_allocators\x20or\x20explicit\x20named\x20operators)','example':'A\x20delivery\x20service\x20assigns\x20Alice\x20as\x20the\x20NamedOperator\x20for\x20order\x20#123\x20—\x20only\x20Alice\x20can\x20mark\x20it\x20delivered.'},{'name':'OrderHolder','scope':'order_holder','definedOn':'Per-order\x20(the\x20\x27\x27\x20empty\x20string\x20address\x20=\x20the\x20order\x27s\x20current\x20holder)','controls':'Who\x20currently\x20holds\x20the\x20order\x20and\x20can\x20perform\x20holder-specific\x20actions\x20(accept,\x20reject,\x20pay)','grantedBy':'Implicitly\x20assigned\x20when\x20an\x20order\x20is\x20created\x20or\x20transferred','example':'Bob\x20places\x20an\x20order\x20—\x20he\x20becomes\x20the\x20OrderHolder.\x20He\x20can\x20accept\x20delivery\x20or\x20request\x20arbitration.'}];export const GAME_ELEMENTS=[{'id':0x1,'type':'player','name':'Merchant\x20vs\x20Customer','description':'The\x20basic\x20participants\x20of\x20the\x20game:\x20the\x20merchant\x20providing\x20the\x20service\x20and\x20the\x20customer\x20purchasing\x20the\x20service.','wowokApplication':'Service\x20creator\x20(merchant)\x20and\x20Order\x20creator\x20(customer).','onChainMechanism':'Service\x20+\x20Order\x20objects,\x20each\x20with\x20an\x20independent\x20on-chain\x20address.'},{'id':0x2,'type':'player','name':'Arbitrator','description':'Third-party\x20arbitrators\x20participate\x20in\x20the\x20dispute\x20resolution\x20game.','wowokApplication':'NamedOperator\x20of\x20the\x20Arb\x20object,\x20designated\x20by\x20the\x20Service.','onChainMechanism':'Arbitration\x20object\x20+\x20NamedOperator\x20permission.'},{'id':0x3,'type':'strategy','name':'Cooperation\x20vs\x20Deception','description':'The\x20merchant\x20can\x20choose\x20honest\x20fulfillment\x20(cooperation)\x20or\x20fraud\x20(deception).\x20The\x20customer\x20can\x20choose\x20to\x20trust\x20or\x20refuse.','wowokApplication':'Merchant\x20ships\x20vs\x20doesn\x27t\x20ship;\x20customer\x20pays\x20vs\x20refuses\x20to\x20pay.','onChainMechanism':'Progress\x20node\x20advancement\x20+\x20immutable\x20on-chain\x20state.'},{'id':0x4,'type':'payoff','name':'Fulfillment\x20payoff\x20vs\x20Fraud\x20payoff','description':'Honest\x20fulfillment\x20yields\x20sustained\x20income\x20+\x20reputation;\x20fraud\x20yields\x20one-time\x20income\x20but\x20loses\x20reputation\x20and\x20compensation\x20fund.','wowokApplication':'compensation_fund\x20as\x20economic\x20penalty\x20for\x20fraud;\x20repeat\x20business\x20as\x20long-term\x20payoff\x20for\x20cooperation.','onChainMechanism':'Service.compensation_fund\x20+\x20Treasury\x20locked\x20funds.'},{'id':0x5,'type':'utility','name':'Reputation\x20utility','description':'Merchant\x27s\x20total\x20utility\x20=\x20immediate\x20income\x20+\x20reputation-discounted\x20future\x20income\x20-\x20expected\x20penalty.','wowokApplication':'Merchants\x20with\x20high\x20reputation\x20scores\x20get\x20more\x20orders\x20(Demand\x20matching\x20priority).','onChainMechanism':'ReviewRepository\x20(on-chain\x20public\x20reviews)\x20+\x20Demand\x20matching\x20engine.'},{'id':0x6,'type':'equilibrium','name':'Nash\x20equilibrium:\x20mutual\x20cooperation','description':'When\x20penalties\x20are\x20large\x20enough\x20and\x20reputation\x20is\x20important\x20enough,\x20the\x20strategy\x20profile\x20of\x20mutual\x20cooperation\x20becomes\x20a\x20Nash\x20equilibrium.','wowokApplication':'compensation_fund\x20large\x20enough\x20+\x20immutable\x20on-chain\x20reputation\x20->\x20cooperation\x20becomes\x20the\x20optimal\x20strategy.','onChainMechanism':'Guard\x20verifies\x20compensation_fund\x20amount\x20+\x20ReviewRepository\x20public.'},{'id':0x7,'type':'information','name':'Incomplete\x20information','description':'Customers\x20don\x27t\x20fully\x20understand\x20the\x20merchant\x27s\x20service\x20quality;\x20merchants\x20don\x27t\x20fully\x20understand\x20the\x20customer\x27s\x20payment\x20capacity.','wowokApplication':'Service.description\x20+\x20Guard\x20verification\x20as\x20signals;\x20customer\x20wallet\x20balance\x20is\x20queryable\x20on-chain.','onChainMechanism':'Guard\x20+\x20Personal\x20object\x20+\x20on-chain\x20transaction\x20history.'},{'id':0x8,'type':'sequence','name':'Sequential\x20game','description':'Customer\x20places\x20order\x20and\x20pays\x20first,\x20merchant\x20fulfills\x20later\x20—\x20this\x20is\x20a\x20typical\x20sequential\x20game.','wowokApplication':'Order\x20creation\x20->\x20Progress\x20advancement\x20->\x20Acceptance/Arbitration.','onChainMechanism':'Machine\x20node\x20sequence\x20+\x20Progress\x20state\x20machine.'},{'id':0x9,'type':'repetition','name':'Repeated\x20game','description':'Merchants\x20and\x20customers\x20may\x20transact\x20multiple\x20times;\x20repeated\x20games\x20make\x20cooperation\x20strategies\x20superior.','wowokApplication':'Customer\x20repeat\x20purchases\x20+\x20Demand\x20matching\x20prioritizes\x20high-reputation\x20merchants.','onChainMechanism':'ReviewRepository\x20accumulates\x20reviews\x20+\x20Demand\x20matching\x20engine.'},{'id':0xa,'type':'commitment','name':'Compensation\x20fund\x20commitment','description':'Merchants\x20make\x20a\x20credible\x20commitment\x20by\x20locking\x20compensation_fund,\x20reducing\x20customers\x27\x20risk\x20perception.','wowokApplication':'Service.compensation_fund\x20locks\x20funds;\x20customers\x20can\x20claim\x20compensation\x20in\x20case\x20of\x20fraud.','onChainMechanism':'Treasury\x20object\x20+\x20Guard\x20verifies\x20amount\x20+\x20withdrawal\x20rules.'},{'id':0xb,'type':'punishment','name':'Compensation\x20fund\x20penalty','description':'When\x20a\x20merchant\x20commits\x20fraud,\x20the\x20compensation\x20fund\x20is\x20transferred\x20to\x20the\x20customer,\x20constituting\x20economic\x20punishment.','wowokApplication':'Arbitration\x20verdict\x20->\x20compensation_fund\x20withdrawal\x20->\x20customer\x20receives\x20compensation.','onChainMechanism':'Arbitration\x20verdict\x20+\x20Treasury\x20withdrawal\x20rules.'},{'id':0xc,'type':'reward','name':'Reward\x20marketing\x20incentive','description':'Merchants\x20issue\x20rewards\x20via\x20Reward\x20objects,\x20incentivizing\x20customer\x20behavior\x20(first\x20order,\x20referral,\x20loyalty).','wowokApplication':'Reward\x20object\x20+\x20Guard\x20verifies\x20claim\x20conditions\x20(e.g.,\x20completed\x20first\x20order).','onChainMechanism':'Reward\x20object\x20+\x20Guard\x20claim\x20conditions\x20+\x20Allocation\x20distribution.'},{'id':0xd,'type':'reputation','name':'On-chain\x20public\x20reputation','description':'All\x20transactions\x20and\x20reviews\x20are\x20recorded\x20on-chain,\x20forming\x20an\x20immutable\x20reputation\x20system.','wowokApplication':'ReviewRepository\x20stores\x20like/dislike/review\x20tags,\x20queryable\x20on-chain.','onChainMechanism':'Repository\x20object\x20+\x20Guard\x20anti-spam\x20+\x20address-keyed\x20review\x20records.'},{'id':0xe,'type':'signaling','name':'Quality\x20signal','description':'Merchants\x20send\x20quality\x20signals\x20via\x20Guard\x20verification,\x20compensation_fund\x20amount,\x20and\x20Machine\x20transparency.','wowokApplication':'buy_guard\x20verification\x20->\x20signal;\x20compensation_fund\x20amount\x20->\x20signal;\x20Machine\x20public\x20->\x20signal.','onChainMechanism':'Guard\x20+\x20Treasury\x20+\x20Machine\x20object\x27s\x20on-chain\x20public\x20data.'},{'id':0xf,'type':'screening','name':'Customer\x20screening','description':'Merchants\x20screen\x20customers\x20via\x20Guard\x20(e.g.,\x20verify\x20identity,\x20credit\x20score,\x20wallet\x20balance).','wowokApplication':'Service.buy_guard\x20verifies\x20customer\x20eligibility.','onChainMechanism':'Guard\x20object\x20+\x20gen_passport\x20verifies\x20credentials.'},{'id':0x10,'type':'bargaining','name':'Price\x20bargaining','description':'Customers\x20and\x20merchants\x20can\x20bargain\x20via\x20Messenger;\x20the\x20final\x20price\x20is\x20submitted\x20via\x20Demand.','wowokApplication':'Messenger\x20encrypted\x20communication\x20->\x20Demand\x20submits\x20demand\x20with\x20reward.','onChainMechanism':'Contact\x20+\x20Messenger\x20+\x20Demand\x20objects.'},{'id':0x11,'type':'auction','name':'Demand\x20bidding','description':'Multiple\x20service\x20providers\x20can\x20compete\x20for\x20the\x20same\x20Demand,\x20forming\x20a\x20bidding\x20mechanism.','wowokApplication':'Demand\x20publishes\x20demand\x20->\x20multiple\x20Services\x20submit\x20proposals\x20->\x20customer\x20chooses.','onChainMechanism':'Demand\x20object\x20+\x20order\x20creation\x20+\x20Progress\x20advancement.'},{'id':0x12,'type':'mechanism','name':'Mechanism\x20design','description':'WoWok\x27s\x20overall\x20architecture\x20is\x20mechanism\x20design:\x20incentivizing\x20cooperation\x20and\x20punishing\x20fraud\x20via\x20on-chain\x20rules.','wowokApplication':'compensation_fund\x20+\x20Arbitration\x20+\x20ReviewRepository\x20combine\x20to\x20form\x20a\x20trust\x20mechanism.','onChainMechanism':'Move\x20contract-level\x20object\x20composition\x20+\x20Guard\x20verification\x20+\x20immutability.'},{'id':0x13,'type':'constraint','name':'Fund\x20constraint','description':'compensation_fund\x20and\x20Reward\x20fund\x20locks\x20constitute\x20economic\x20constraints,\x20limiting\x20the\x20merchant\x27s\x20incentive\x20to\x20commit\x20fraud.','wowokApplication':'Fund\x20lock\x20>\x20fraud\x20payoff\x20->\x20cooperation\x20is\x20the\x20rational\x20choice.','onChainMechanism':'Treasury\x20+\x20Allocation\x20fund\x20lock.'},{'id':0x14,'type':'cooperation','name':'Supply\x20chain\x20collaboration','description':'Multiple\x20merchants\x20combine\x20via\x20Machine\x20to\x20form\x20a\x20supply\x20chain,\x20cooperating\x20to\x20fulfill\x20complex\x20orders\x20(sub-orders).','wowokApplication':'Service\x27s\x20order_allocators\x20supports\x20multi-supplier\x20allocation;\x20Machine\x20node\x20forwards\x20combine.','onChainMechanism':'Allocation\x20+\x20Machine\x20Forward\x20+\x20Progress\x20cross-object\x20composition.'}];const PERMISSION_INDEX=new Map(PERMISSION_TYPES['map'](a=>[a['name'],a])),GAME_ELEMENT_INDEX=new Map(GAME_ELEMENTS['map'](a=>[a['id'],a]));export function getPermissionType(a){return PERMISSION_INDEX['get'](a);}export function getGameElement(a){return GAME_ELEMENT_INDEX['get'](a);}export function getGameElementsByType(a){return GAME_ELEMENTS['filter'](b=>b['type']===a);}export const PROCESS_MODEL_VERSION=0x1;
|
|
1
|
+
export{PERMISSION_TYPES,getPermissionType}from'./permission-ledger.js';export const GAME_ELEMENTS=[{'id':0x1,'type':'player','name':'Merchant\x20vs\x20Customer','description':'The\x20basic\x20participants\x20of\x20the\x20game:\x20the\x20merchant\x20providing\x20the\x20service\x20and\x20the\x20customer\x20purchasing\x20the\x20service.','wowokApplication':'Service\x20creator\x20(merchant)\x20and\x20Order\x20creator\x20(customer).','onChainMechanism':'Service\x20+\x20Order\x20objects,\x20each\x20with\x20an\x20independent\x20on-chain\x20address.'},{'id':0x2,'type':'player','name':'Arbitrator','description':'Third-party\x20arbitrators\x20participate\x20in\x20the\x20dispute\x20resolution\x20game.','wowokApplication':'NamedOperator\x20of\x20the\x20Arb\x20object,\x20designated\x20by\x20the\x20Service.','onChainMechanism':'Arbitration\x20object\x20+\x20NamedOperator\x20permission.'},{'id':0x3,'type':'strategy','name':'Cooperation\x20vs\x20Deception','description':'The\x20merchant\x20can\x20choose\x20honest\x20fulfillment\x20(cooperation)\x20or\x20fraud\x20(deception).\x20The\x20customer\x20can\x20choose\x20to\x20trust\x20or\x20refuse.','wowokApplication':'Merchant\x20ships\x20vs\x20doesn\x27t\x20ship;\x20customer\x20pays\x20vs\x20refuses\x20to\x20pay.','onChainMechanism':'Progress\x20node\x20advancement\x20+\x20immutable\x20on-chain\x20state.'},{'id':0x4,'type':'payoff','name':'Fulfillment\x20payoff\x20vs\x20Fraud\x20payoff','description':'Honest\x20fulfillment\x20yields\x20sustained\x20income\x20+\x20reputation;\x20fraud\x20yields\x20one-time\x20income\x20but\x20loses\x20reputation\x20and\x20compensation\x20fund.','wowokApplication':'compensation_fund\x20as\x20economic\x20penalty\x20for\x20fraud;\x20repeat\x20business\x20as\x20long-term\x20payoff\x20for\x20cooperation.','onChainMechanism':'Service.compensation_fund\x20+\x20Treasury\x20locked\x20funds.'},{'id':0x5,'type':'utility','name':'Reputation\x20utility','description':'Merchant\x27s\x20total\x20utility\x20=\x20immediate\x20income\x20+\x20reputation-discounted\x20future\x20income\x20-\x20expected\x20penalty.','wowokApplication':'Merchants\x20with\x20high\x20reputation\x20scores\x20get\x20more\x20orders\x20(Demand\x20matching\x20priority).','onChainMechanism':'ReviewRepository\x20(on-chain\x20public\x20reviews)\x20+\x20Demand\x20matching\x20engine.'},{'id':0x6,'type':'equilibrium','name':'Nash\x20equilibrium:\x20mutual\x20cooperation','description':'When\x20penalties\x20are\x20large\x20enough\x20and\x20reputation\x20is\x20important\x20enough,\x20the\x20strategy\x20profile\x20of\x20mutual\x20cooperation\x20becomes\x20a\x20Nash\x20equilibrium.','wowokApplication':'compensation_fund\x20large\x20enough\x20+\x20immutable\x20on-chain\x20reputation\x20->\x20cooperation\x20becomes\x20the\x20optimal\x20strategy.','onChainMechanism':'Guard\x20verifies\x20compensation_fund\x20amount\x20+\x20ReviewRepository\x20public.'},{'id':0x7,'type':'information','name':'Incomplete\x20information','description':'Customers\x20don\x27t\x20fully\x20understand\x20the\x20merchant\x27s\x20service\x20quality;\x20merchants\x20don\x27t\x20fully\x20understand\x20the\x20customer\x27s\x20payment\x20capacity.','wowokApplication':'Service.description\x20+\x20Guard\x20verification\x20as\x20signals;\x20customer\x20wallet\x20balance\x20is\x20queryable\x20on-chain.','onChainMechanism':'Guard\x20+\x20Personal\x20object\x20+\x20on-chain\x20transaction\x20history.'},{'id':0x8,'type':'sequence','name':'Sequential\x20game','description':'Customer\x20places\x20order\x20and\x20pays\x20first,\x20merchant\x20fulfills\x20later\x20—\x20this\x20is\x20a\x20typical\x20sequential\x20game.','wowokApplication':'Order\x20creation\x20->\x20Progress\x20advancement\x20->\x20Acceptance/Arbitration.','onChainMechanism':'Machine\x20node\x20sequence\x20+\x20Progress\x20state\x20machine.'},{'id':0x9,'type':'repetition','name':'Repeated\x20game','description':'Merchants\x20and\x20customers\x20may\x20transact\x20multiple\x20times;\x20repeated\x20games\x20make\x20cooperation\x20strategies\x20superior.','wowokApplication':'Customer\x20repeat\x20purchases\x20+\x20Demand\x20matching\x20prioritizes\x20high-reputation\x20merchants.','onChainMechanism':'ReviewRepository\x20accumulates\x20reviews\x20+\x20Demand\x20matching\x20engine.'},{'id':0xa,'type':'commitment','name':'Compensation\x20fund\x20commitment','description':'Merchants\x20make\x20a\x20credible\x20commitment\x20by\x20locking\x20compensation_fund,\x20reducing\x20customers\x27\x20risk\x20perception.','wowokApplication':'Service.compensation_fund\x20locks\x20funds;\x20customers\x20can\x20claim\x20compensation\x20in\x20case\x20of\x20fraud.','onChainMechanism':'Treasury\x20object\x20+\x20Guard\x20verifies\x20amount\x20+\x20withdrawal\x20rules.'},{'id':0xb,'type':'punishment','name':'Compensation\x20fund\x20penalty','description':'When\x20a\x20merchant\x20commits\x20fraud,\x20the\x20compensation\x20fund\x20is\x20transferred\x20to\x20the\x20customer,\x20constituting\x20economic\x20punishment.','wowokApplication':'Arbitration\x20verdict\x20->\x20compensation_fund\x20withdrawal\x20->\x20customer\x20receives\x20compensation.','onChainMechanism':'Arbitration\x20verdict\x20+\x20Treasury\x20withdrawal\x20rules.'},{'id':0xc,'type':'reward','name':'Reward\x20marketing\x20incentive','description':'Merchants\x20issue\x20rewards\x20via\x20Reward\x20objects,\x20incentivizing\x20customer\x20behavior\x20(first\x20order,\x20referral,\x20loyalty).','wowokApplication':'Reward\x20object\x20+\x20Guard\x20verifies\x20claim\x20conditions\x20(e.g.,\x20completed\x20first\x20order).','onChainMechanism':'Reward\x20object\x20+\x20Guard\x20claim\x20conditions\x20+\x20Allocation\x20distribution.'},{'id':0xd,'type':'reputation','name':'On-chain\x20public\x20reputation','description':'All\x20transactions\x20and\x20reviews\x20are\x20recorded\x20on-chain,\x20forming\x20an\x20immutable\x20reputation\x20system.','wowokApplication':'ReviewRepository\x20stores\x20like/dislike/review\x20tags,\x20queryable\x20on-chain.','onChainMechanism':'Repository\x20object\x20+\x20Guard\x20anti-spam\x20+\x20address-keyed\x20review\x20records.'},{'id':0xe,'type':'signaling','name':'Quality\x20signal','description':'Merchants\x20send\x20quality\x20signals\x20via\x20Guard\x20verification,\x20compensation_fund\x20amount,\x20and\x20Machine\x20transparency.','wowokApplication':'buy_guard\x20verification\x20->\x20signal;\x20compensation_fund\x20amount\x20->\x20signal;\x20Machine\x20public\x20->\x20signal.','onChainMechanism':'Guard\x20+\x20Treasury\x20+\x20Machine\x20object\x27s\x20on-chain\x20public\x20data.'},{'id':0xf,'type':'screening','name':'Customer\x20screening','description':'Merchants\x20screen\x20customers\x20via\x20Guard\x20(e.g.,\x20verify\x20identity,\x20credit\x20score,\x20wallet\x20balance).','wowokApplication':'Service.buy_guard\x20verifies\x20customer\x20eligibility.','onChainMechanism':'Guard\x20object\x20+\x20gen_passport\x20verifies\x20credentials.'},{'id':0x10,'type':'bargaining','name':'Price\x20bargaining','description':'Customers\x20and\x20merchants\x20can\x20bargain\x20via\x20Messenger;\x20the\x20final\x20price\x20is\x20submitted\x20via\x20Demand.','wowokApplication':'Messenger\x20encrypted\x20communication\x20->\x20Demand\x20submits\x20demand\x20with\x20reward.','onChainMechanism':'Contact\x20+\x20Messenger\x20+\x20Demand\x20objects.'},{'id':0x11,'type':'auction','name':'Demand\x20bidding','description':'Multiple\x20service\x20providers\x20can\x20compete\x20for\x20the\x20same\x20Demand,\x20forming\x20a\x20bidding\x20mechanism.','wowokApplication':'Demand\x20publishes\x20demand\x20->\x20multiple\x20Services\x20submit\x20proposals\x20->\x20customer\x20chooses.','onChainMechanism':'Demand\x20object\x20+\x20order\x20creation\x20+\x20Progress\x20advancement.'},{'id':0x12,'type':'mechanism','name':'Mechanism\x20design','description':'WoWok\x27s\x20overall\x20architecture\x20is\x20mechanism\x20design:\x20incentivizing\x20cooperation\x20and\x20punishing\x20fraud\x20via\x20on-chain\x20rules.','wowokApplication':'compensation_fund\x20+\x20Arbitration\x20+\x20ReviewRepository\x20combine\x20to\x20form\x20a\x20trust\x20mechanism.','onChainMechanism':'Move\x20contract-level\x20object\x20composition\x20+\x20Guard\x20verification\x20+\x20immutability.'},{'id':0x13,'type':'constraint','name':'Fund\x20constraint','description':'compensation_fund\x20and\x20Reward\x20fund\x20locks\x20constitute\x20economic\x20constraints,\x20limiting\x20the\x20merchant\x27s\x20incentive\x20to\x20commit\x20fraud.','wowokApplication':'Fund\x20lock\x20>\x20fraud\x20payoff\x20->\x20cooperation\x20is\x20the\x20rational\x20choice.','onChainMechanism':'Treasury\x20+\x20Allocation\x20fund\x20lock.'},{'id':0x14,'type':'cooperation','name':'Supply\x20chain\x20collaboration','description':'Multiple\x20merchants\x20combine\x20via\x20Machine\x20to\x20form\x20a\x20supply\x20chain,\x20cooperating\x20to\x20fulfill\x20complex\x20orders\x20(sub-orders).','wowokApplication':'Service\x27s\x20order_allocators\x20supports\x20multi-supplier\x20allocation;\x20Machine\x20node\x20forwards\x20combine.','onChainMechanism':'Allocation\x20+\x20Machine\x20Forward\x20+\x20Progress\x20cross-object\x20composition.'}];const GAME_ELEMENT_INDEX=new Map(GAME_ELEMENTS['map'](a=>[a['id'],a]));export function getGameElement(a){return GAME_ELEMENT_INDEX['get'](a);}export function getGameElementsByType(a){return GAME_ELEMENTS['filter'](b=>b['type']===a);}export const PROCESS_MODEL_VERSION=0x1;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ProofScene } from "./proof-ledger.js";
|
|
2
|
+
export declare const PROOF_CONTEXT_VERSION = "1.0.0";
|
|
3
|
+
export interface ProofContextBundle {
|
|
4
|
+
scene?: ProofScene;
|
|
5
|
+
binding: "entity_bound" | "free_standing";
|
|
6
|
+
immutable: true;
|
|
7
|
+
summary: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BuildProofContextInput {
|
|
10
|
+
proof_type?: number | bigint | string;
|
|
11
|
+
about_address?: string | null;
|
|
12
|
+
description?: string;
|
|
13
|
+
proof?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildProofContext(input: BuildProofContextInput): ProofContextBundle;
|
|
16
|
+
export declare function getProofContextSummary(ctx: ProofContextBundle): string;
|
|
17
|
+
export declare function isWtsProof(proofType: number | bigint | string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';import{getProofSceneByType}from'./proof-ledger.js';export const PROOF_CONTEXT_VERSION='1.0.0';export function buildProofContext(a){const b=a['proof_type']!==undefined?getProofSceneByType(a['proof_type']):undefined,c=a['about_address']?'entity_bound':'free_standing',d=[];return b?d['push']('proof_type\x20'+b['proof_type_range']+'\x20('+b['semantic']+')'):d['push']('proof_type\x20not\x20classified'),a['description']&&d['push']('description\x20\x22'+a['description']+'\x22'),d['push'](c==='entity_bound'?'bound\x20to\x20on-chain\x20entity':'free-standing\x20attestation'),d['push']('immutable\x20(freeze_object)'),{'scene':b,'binding':c,'immutable':!![],'summary':d['join']('\x20·\x20')};}export function getProofContextSummary(a){return a['summary'];}export function isWtsProof(a){const b=typeof a==='string'?BigInt(a):BigInt(a);return b===BigInt(WOWOK_WTS_PROOF_TYPE);}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const PROOF_LEDGER_VERSION = "1.0.0";
|
|
2
|
+
export type ProofFieldMutability = "immutable";
|
|
3
|
+
export interface ProofFieldEntry {
|
|
4
|
+
field: string;
|
|
5
|
+
move_field?: string;
|
|
6
|
+
value_type: string;
|
|
7
|
+
semantic: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
mutability: ProofFieldMutability;
|
|
10
|
+
error_code?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PROOF_FIELDS: ProofFieldEntry[];
|
|
13
|
+
export interface ProofErrorEntry {
|
|
14
|
+
code: string;
|
|
15
|
+
value: number;
|
|
16
|
+
description: string;
|
|
17
|
+
related_field: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const PROOF_ERROR_CODES: ProofErrorEntry[];
|
|
20
|
+
export type ProofSceneClassification = "wts" | "custom_reserved" | "custom_user";
|
|
21
|
+
export interface ProofScene {
|
|
22
|
+
id: string;
|
|
23
|
+
classification: ProofSceneClassification;
|
|
24
|
+
proof_type_range: string;
|
|
25
|
+
semantic: string;
|
|
26
|
+
recommended: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const PROOF_SCENES: ProofScene[];
|
|
29
|
+
export declare function getProofField(field: string): ProofFieldEntry | undefined;
|
|
30
|
+
export declare function getProofFieldsCount(): number;
|
|
31
|
+
export declare function getProofErrorByCode(code: string): ProofErrorEntry | undefined;
|
|
32
|
+
export declare function getProofErrorByValue(value: number): ProofErrorEntry | undefined;
|
|
33
|
+
export declare function getProofSceneByType(proofType: number | bigint | string): ProofScene | undefined;
|
|
34
|
+
export declare function inferProofSceneFromIntent(intent: string): ProofScene | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WOWOK_WTS_PROOF_TYPE,MAX_PROOF_SIZE,MAX_SERVER_PUBKEY_SIZE,MAX_SERVER_SIGNATURE_SIZE}from'@wowok/wowok';export const PROOF_LEDGER_VERSION='1.0.0';export const PROOF_FIELDS=[{'field':'description','value_type':'string','semantic':'Human-readable\x20one-line\x20summary\x20(audit/discoverability).','required':!![],'mutability':'immutable'},{'field':'proof','value_type':'string\x20(hex-encoded)','semantic':'Cryptographic\x20proof\x20content\x20(merkle\x20root\x20/\x20hash\x20digest\x20/\x20compact\x20attestation).','required':!![],'mutability':'immutable','error_code':'E_MAX_PROOF_SIZE'},{'field':'server_pubkey','value_type':'string\x20(hex-encoded)','semantic':'Raw\x20public\x20key\x20of\x20the\x20off-chain\x20signing\x20server\x20(not\x20a\x20certificate).','required':!![],'mutability':'immutable','error_code':'E_MAX_SERVER_PUBKEY_SIZE'},{'field':'server_signature','value_type':'string\x20(hex-encoded)','semantic':'Signature\x20produced\x20by\x20the\x20off-chain\x20server\x20over\x20`proof`\x20(or\x20documented\x20pre-image).','required':!![],'mutability':'immutable','error_code':'E_MAX_SERVER_SIGNATURE_SIZE'},{'field':'proof_type','value_type':'u64','semantic':'Proof\x20verification\x20classification\x20(1=WTS,\x202-100\x20reserved,\x20>100\x20user-defined).','required':!![],'mutability':'immutable'},{'field':'about_address','move_field':'about','value_type':'Option<address>','semantic':'On-chain\x20entity\x20this\x20proof\x20attests\x20to;\x20null\x20=\x20free-standing\x20statement.','required':![],'mutability':'immutable'},{'field':'item_count','move_field':'item_count','value_type':'Option<u64>','semantic':'Optional\x20count\x20of\x20items\x20in\x20the\x20off-chain\x20data\x20structure\x20(e.g.\x20merkle\x20leaf\x20count).','required':![],'mutability':'immutable'},{'field':'signer','value_type':'address','semantic':'The\x20tx\x20sender\x20who\x20created\x20the\x20proof\x20(frozen\x20at\x20creation).','required':!![],'mutability':'immutable'},{'field':'time','value_type':'u64\x20(timestamp\x20ms)','semantic':'Creation\x20timestamp\x20(clock::timestamp_ms).','required':!![],'mutability':'immutable'}];export const PROOF_ERROR_CODES=[{'code':'E_MAX_PROOF_SIZE','value':0x1,'description':'proof\x20string\x20length\x20exceeds\x20MAX_PROOF_SIZE\x20('+MAX_PROOF_SIZE+'\x20bytes).','related_field':'proof'},{'code':'E_MAX_SERVER_PUBKEY_SIZE','value':0x2,'description':'server_pubkey\x20length\x20exceeds\x20MAX_SERVER_PUBKEY_SIZE\x20('+MAX_SERVER_PUBKEY_SIZE+'\x20bytes).','related_field':'server_pubkey'},{'code':'E_MAX_SERVER_SIGNATURE_SIZE','value':0x3,'description':'server_signature\x20length\x20exceeds\x20MAX_SERVER_SIGNATURE_SIZE\x20('+MAX_SERVER_SIGNATURE_SIZE+'\x20bytes).','related_field':'server_signature'}];export const PROOF_SCENES=[{'id':'proof_wts','classification':'wts','proof_type_range':''+WOWOK_WTS_PROOF_TYPE,'semantic':'Wowok\x20Will-To-Sign:\x20an\x20off-chain\x20server\x20attests\x20to\x20a\x20fact\x20and\x20signs\x20it\x20(server_pubkey\x20+\x20server_signature).','recommended':!![]},{'id':'proof_custom_reserved','classification':'custom_reserved','proof_type_range':'2-100','semantic':'Custom\x20proof\x20in\x20Wowok\x20reserved\x20range\x20—\x20NOT\x20recommended\x20(future\x20protocol\x20upgrades\x20may\x20reassign).','recommended':![]},{'id':'proof_custom_user','classification':'custom_user','proof_type_range':'>100','semantic':'User-defined\x20application-specific\x20proof\x20—\x20creator\x20documents\x20the\x20off-chain\x20verification\x20logic.','recommended':!![]}];export function getProofField(a){return PROOF_FIELDS['find'](b=>b['field']===a);}export function getProofFieldsCount(){return PROOF_FIELDS['length'];}export function getProofErrorByCode(a){return PROOF_ERROR_CODES['find'](b=>b['code']===a);}export function getProofErrorByValue(a){return PROOF_ERROR_CODES['find'](b=>b['value']===a);}export function getProofSceneByType(a){const b=typeof a==='string'?BigInt(a):BigInt(a);if(b===BigInt(WOWOK_WTS_PROOF_TYPE))return PROOF_SCENES['find'](c=>c['classification']==='wts');if(b>0x1n&&b<=0x64n)return PROOF_SCENES['find'](c=>c['classification']==='custom_reserved');if(b>0x64n)return PROOF_SCENES['find'](c=>c['classification']==='custom_user');return undefined;}export function inferProofSceneFromIntent(a){const b=a['toLowerCase']();if(/(wts|will.?to.?sign|server.?signed|attestation|merkle|kyc|timestamp)/['test'](b))return PROOF_SCENES['find'](c=>c['classification']==='wts');if(/(reserved|wowok.?defined|protocol.?reserved)/['test'](b))return PROOF_SCENES['find'](c=>c['classification']==='custom_reserved');if(/(custom|user.?defined|application.?specific)/['test'](b))return PROOF_SCENES['find'](c=>c['classification']==='custom_user');return undefined;}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ProofScene } from "./proof-ledger.js";
|
|
2
|
+
export declare const PROOF_PUZZLE_VERSION = "1.0.0";
|
|
3
|
+
export type ProofPuzzleDimension = "intent" | "fields";
|
|
4
|
+
export interface ProofIntentPuzzle {
|
|
5
|
+
scene?: ProofScene;
|
|
6
|
+
proof_type?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ProofFieldState {
|
|
9
|
+
field: string;
|
|
10
|
+
present: boolean;
|
|
11
|
+
required: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ProofPuzzle {
|
|
14
|
+
intent: ProofIntentPuzzle;
|
|
15
|
+
fields: ProofFieldState[];
|
|
16
|
+
}
|
|
17
|
+
export interface ProofPuzzleCompleteness {
|
|
18
|
+
complete: boolean;
|
|
19
|
+
missing_required: string[];
|
|
20
|
+
missing_optional: string[];
|
|
21
|
+
reason: string;
|
|
22
|
+
}
|
|
23
|
+
export interface InitProofPuzzleInput {
|
|
24
|
+
intent: string;
|
|
25
|
+
proof_type?: number;
|
|
26
|
+
description?: string;
|
|
27
|
+
proof?: string;
|
|
28
|
+
server_pubkey?: string;
|
|
29
|
+
server_signature?: string;
|
|
30
|
+
about_address?: string | null;
|
|
31
|
+
item_count?: number | bigint | string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function initProofPuzzleFromIntent(input: InitProofPuzzleInput): ProofPuzzle;
|
|
34
|
+
export declare function checkProofPuzzleCompleteness(puzzle: ProofPuzzle): ProofPuzzleCompleteness;
|
|
35
|
+
export declare function generateProofConfirmationText(puzzle: ProofPuzzle): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';import{PROOF_FIELDS,inferProofSceneFromIntent}from'./proof-ledger.js';export const PROOF_PUZZLE_VERSION='1.0.0';export function initProofPuzzleFromIntent(a){const b=inferProofSceneFromIntent(a['intent']),c=a['proof_type']??(b?.['classification']==='wts'?WOWOK_WTS_PROOF_TYPE:undefined),d={'description':!!a['description'],'proof':!!a['proof'],'server_pubkey':!!a['server_pubkey'],'server_signature':!!a['server_signature'],'proof_type':c!==undefined,'about_address':a['about_address']!=null&&a['about_address']!=='','item_count':a['item_count']!=null&&a['item_count']!==''},e=PROOF_FIELDS['filter'](g=>g['field']in d||g['field']==='signer'||g['field']==='time')['map'](g=>{if(g['field']==='signer'||g['field']==='time')return{'field':g['field'],'present':!![],'required':g['required']};return{'field':g['field'],'present':!!d[g['field']],'required':g['required']};});return{'intent':{'scene':b,'proof_type':c},'fields':e};}export function checkProofPuzzleCompleteness(a){const b=a['fields']['filter'](e=>e['required']&&!e['present'])['map'](e=>e['field']),c=a['fields']['filter'](e=>!e['required']&&!e['present'])['map'](e=>e['field']),d=b['length']===0x0;return{'complete':d,'missing_required':b,'missing_optional':c,'reason':d?'All\x20required\x20proof\x20fields\x20present.':'Missing\x20required:\x20'+b['join'](',\x20')+'.'};}export function generateProofConfirmationText(a){const b=checkProofPuzzleCompleteness(a),d=a['intent']['scene'],e=d?'Scene:\x20'+d['id']+'\x20(proof_type\x20'+d['proof_type_range']+')':'Scene:\x20not\x20classified\x20(provide\x20more\x20intent)';return[e,b['reason']]['join']('\x0a');}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const PROOF_TEMPLATES_VERSION = "1.0.0";
|
|
2
|
+
export type ProofTemplateParamType = "string" | "u64" | "address" | "number";
|
|
3
|
+
export interface ProofTemplateParam {
|
|
4
|
+
name: string;
|
|
5
|
+
type: ProofTemplateParamType;
|
|
6
|
+
required: boolean;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProofTemplate {
|
|
10
|
+
id: string;
|
|
11
|
+
scene_id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
proof_type: number;
|
|
15
|
+
params: ProofTemplateParam[];
|
|
16
|
+
about_address_required: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const PROOF_TEMPLATES: ProofTemplate[];
|
|
19
|
+
export declare function getProofTemplateById(id: string): ProofTemplate | undefined;
|
|
20
|
+
export declare function getProofTemplatesByScene(sceneId: string): ProofTemplate[];
|
|
21
|
+
export declare function suggestProofTemplateForScene(sceneId: string): ProofTemplate | undefined;
|
|
22
|
+
export declare function listProofTemplates(): ProofTemplate[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';export const PROOF_TEMPLATES_VERSION='1.0.0';export const PROOF_TEMPLATES=[{'id':'proof_wts_kyc','scene_id':'proof_wts','name':'WTS\x20KYC\x20attestation','description':'An\x20off-chain\x20server\x20attests\x20to\x20a\x20user\x27s\x20identity\x20(merkle\x20root\x20of\x20N\x20leaves).','proof_type':WOWOK_WTS_PROOF_TYPE,'params':[{'name':'proof','type':'string','required':!![],'description':'Merkle\x20root\x20hex'},{'name':'server_pubkey','type':'string','required':!![],'description':'Server\x20public\x20key\x20hex'},{'name':'server_signature','type':'string','required':!![],'description':'Server\x20signature\x20hex'},{'name':'description','type':'string','required':!![],'description':'One-line\x20summary'},{'name':'item_count','type':'u64','required':![],'description':'Merkle\x20leaf\x20count'},{'name':'about_address','type':'address','required':![],'description':'Attested\x20user\x20address'}],'about_address_required':!![]},{'id':'proof_wts_timestamp','scene_id':'proof_wts','name':'WTS\x20timestamp\x20attestation','description':'A\x20free-standing\x20server\x20timestamp\x20(no\x20on-chain\x20entity\x20binding).','proof_type':WOWOK_WTS_PROOF_TYPE,'params':[{'name':'proof','type':'string','required':!![],'description':'Timestamp\x20hash\x20hex'},{'name':'server_pubkey','type':'string','required':!![],'description':'Server\x20public\x20key\x20hex'},{'name':'server_signature','type':'string','required':!![],'description':'Server\x20signature\x20hex'},{'name':'description','type':'string','required':!![],'description':'One-line\x20summary'}],'about_address_required':![]},{'id':'proof_custom_attestation','scene_id':'proof_custom_user','name':'Custom\x20attestation','description':'Application-specific\x20proof\x20with\x20creator-documented\x20verification\x20logic.','proof_type':0xc8,'params':[{'name':'proof','type':'string','required':!![],'description':'Application-specific\x20proof\x20format'},{'name':'server_pubkey','type':'string','required':!![],'description':'Signer\x20public\x20key\x20hex'},{'name':'server_signature','type':'string','required':!![],'description':'Signer\x20signature\x20hex'},{'name':'description','type':'string','required':!![],'description':'One-line\x20summary'},{'name':'proof_type','type':'number','required':!![],'description':'>100\x20user-defined'},{'name':'about_address','type':'address','required':![],'description':'Optional\x20entity\x20binding'}],'about_address_required':![]}];export function getProofTemplateById(a){return PROOF_TEMPLATES['find'](b=>b['id']===a);}export function getProofTemplatesByScene(a){return PROOF_TEMPLATES['filter'](b=>b['scene_id']===a);}export function suggestProofTemplateForScene(a){return PROOF_TEMPLATES['find'](b=>b['scene_id']===a);}export function listProofTemplates(){return PROOF_TEMPLATES;}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const REGISTRAR_CONFIRM_VERSION = "1.0.0";
|
|
2
|
+
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
+
export interface RegistrarConfirmItem {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: ConfirmSeverity;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
evidence?: string;
|
|
10
|
+
fix_hint?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RegistrarOpCheckInput {
|
|
13
|
+
typed_value_first_byte?: number;
|
|
14
|
+
typed_value_length?: number;
|
|
15
|
+
address_count?: number;
|
|
16
|
+
expects_fresh_resource_on_register?: boolean;
|
|
17
|
+
is_resource_transfer?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function preCheckRegistrarOp(input: RegistrarOpCheckInput): RegistrarConfirmItem[];
|
|
20
|
+
export declare function canProceedRegistrarOp(input: RegistrarOpCheckInput): {
|
|
21
|
+
canProceed: boolean;
|
|
22
|
+
blockers: RegistrarConfirmItem[];
|
|
23
|
+
warnings: RegistrarConfirmItem[];
|
|
24
|
+
info: RegistrarConfirmItem[];
|
|
25
|
+
};
|
|
26
|
+
export declare function formatRegistrarOpSummary(input: RegistrarOpCheckInput): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH}from'@wowok/wowok';export const REGISTRAR_CONFIRM_VERSION='1.0.0';function checkTypedValue(a){if(a['typed_value_first_byte']===undefined)return{'id':'C-REGISTRAR-01','severity':'info','title':'Record.typed_value\x20first\x20byte\x20is\x20a\x20known\x20ValueType','description':'The\x20first\x20byte\x20encodes\x20ValueType;\x20the\x20Move\x20layer\x20only\x20checks\x20non-empty,\x20not\x20validity.','passed':!![],'evidence':'not\x20provided'};const b=a['typed_value_first_byte']!==0x0&&a['typed_value_first_byte']!==0xff;return{'id':'C-REGISTRAR-01','severity':b?'info':'warn','title':'Record.typed_value\x20first\x20byte\x20is\x20a\x20known\x20ValueType','description':'Move\x20validates\x20only\x20that\x20typed_value\x20is\x20non-empty;\x20a\x20misencoded\x20first\x20byte\x20deserializes\x20to\x20garbage\x20without\x20an\x20abort.','passed':b,'evidence':'first_byte=0x'+a['typed_value_first_byte']['toString'](0x10),'fix_hint':'Validate\x20the\x20first\x20byte\x20against\x20the\x20ValueType\x20enum\x20before\x20submitting.'};}function checkRecordLength(a){if(a['typed_value_length']===undefined)return{'id':'C-REGISTRAR-02','severity':'info','title':'typed_value\x20length\x20≤\x20MAX_RECORD_LENGTH\x20('+MAX_RECORD_LENGTH+')','description':'record()\x20aborts\x20with\x20ERecordLengthExceeded\x20(2)\x20above\x20the\x20cap.','passed':!![],'evidence':'not\x20provided'};const b=a['typed_value_length']>0x0&&a['typed_value_length']<=MAX_RECORD_LENGTH;return{'id':'C-REGISTRAR-02','severity':b?'info':'block','title':'typed_value\x20length\x20in\x20(0,\x20MAX_RECORD_LENGTH]\x20('+MAX_RECORD_LENGTH+')','description':'record()\x20requires\x20a\x20non-empty\x20typed_value\x20≤\x20MAX_RECORD_LENGTH='+MAX_RECORD_LENGTH+';\x20empty\x20aborts\x20with\x20ERecordTypeEmpty\x20(3).','passed':b,'evidence':'typed_value_length='+a['typed_value_length']+',\x20limit='+MAX_RECORD_LENGTH,'fix_hint':'Trim\x20the\x20record\x20payload\x20or\x20store\x20bulk\x20data\x20off-chain.'};}function checkAddressCount(a){if(a['address_count']===undefined)return{'id':'C-REGISTRAR-03','severity':'info','title':'address_count\x20below\x20MAX_ADDRESS_COUNT\x20('+MAX_ADDRESS_COUNT+')','description':'Entity/Registrar\x20ParentTables\x20are\x20bounded\x20by\x20MAX_ADDRESS_COUNT.','passed':!![],'evidence':'not\x20provided'};const b=a['address_count']<MAX_ADDRESS_COUNT;return{'id':'C-REGISTRAR-03','severity':b?'info':'warn','title':'address_count\x20below\x20MAX_ADDRESS_COUNT\x20('+MAX_ADDRESS_COUNT+')','description':'Registration\x20aborts\x20when\x20the\x20address\x20cap\x20MAX_ADDRESS_COUNT='+MAX_ADDRESS_COUNT+'\x20is\x20reached;\x20raising\x20it\x20needs\x20a\x20package\x20upgrade.','passed':b,'evidence':'address_count='+a['address_count']+',\x20limit='+MAX_ADDRESS_COUNT,'fix_hint':'Monitor\x20address_count\x20and\x20plan\x20a\x20package\x20upgrade\x20before\x20hitting\x20the\x20cap.'};}function checkIdempotency(a){if(!a['expects_fresh_resource_on_register'])return{'id':'C-REGISTRAR-04','severity':'info','title':'entity_register\x20is\x20idempotent','description':'entity_register\x20returns\x20the\x20existing\x20Resource\x20for\x20an\x20already-registered\x20user.','passed':!![],'evidence':'idempotency\x20understood'};return{'id':'C-REGISTRAR-04','severity':'warn','title':'entity_register\x20returns\x20the\x20existing\x20Resource\x20(not\x20a\x20fresh\x20one)','description':'After\x20a\x20forced\x20destroy,\x20use\x20entity_register_with_resource_forced\x20to\x20re-allocate;\x20entity_register\x20would\x20return\x20the\x20old\x20(now-invalid)\x20address.','passed':![],'evidence':'expects_fresh_resource_on_register=true','fix_hint':'Use\x20entity_register_with_resource_forced\x20only\x20when\x20the\x20old\x20Resource\x20is\x20truly\x20gone.'};}function checkTransfer(a){if(!a['is_resource_transfer'])return{'id':'C-REGISTRAR-05','severity':'info','title':'entity_resource_transfer\x20detaches\x20source\x20address','description':'Transferring\x20the\x20Resource\x20moves\x20it\x20to\x20a\x20new\x20address;\x20the\x20source\x20loses\x20the\x20binding.','passed':!![],'evidence':'not\x20transferring'};return{'id':'C-REGISTRAR-05','severity':'warn','title':'entity_resource_transfer\x20will\x20detach\x20Resource\x20from\x20source\x20address','description':'Downstream\x20services\x20keyed\x20on\x20the\x20source\x20address\x20lose\x20the\x20binding;\x20no\x20forwarding\x20stub\x20is\x20left\x20behind.','passed':![],'evidence':'is_resource_transfer=true','fix_hint':'Warn\x20that\x20old-address\x20bindings\x20break;\x20track\x20users\x20by\x20Resource\x20address.'};}export function preCheckRegistrarOp(a){return[checkTypedValue(a),checkRecordLength(a),checkAddressCount(a),checkIdempotency(a),checkTransfer(a)];}export function canProceedRegistrarOp(a){const b=preCheckRegistrarOp(a);return{'canProceed':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatRegistrarOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedRegistrarOp(a),e=[b?'✓\x20Registrar\x20operation\x20pre-check\x20PASSED':'✗\x20Registrar\x20operation\x20pre-check\x20FAILED',''];return c['length']>0x0&&(e['push']('BLOCKERS:'),c['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??''))),e['push']('')),d['length']>0x0&&(e['push']('WARNINGS:'),d['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??'')))),e['join']('\x0a');}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const REGISTRAR_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
+
export interface SemanticToRegistrarSchemaRule {
|
|
3
|
+
id: string;
|
|
4
|
+
pattern_name: string;
|
|
5
|
+
semantic_intent: string;
|
|
6
|
+
match_keywords: string[];
|
|
7
|
+
required_fields: string[];
|
|
8
|
+
optional_fields: string[];
|
|
9
|
+
example: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare const SEMANTIC_TO_REGISTRAR_SCHEMA_RULES: SemanticToRegistrarSchemaRule[];
|
|
12
|
+
export interface RegistrarFieldTranslation {
|
|
13
|
+
field_name: string;
|
|
14
|
+
value_type: string;
|
|
15
|
+
semantic: string;
|
|
16
|
+
format_example: string;
|
|
17
|
+
validation_rules: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const REGISTRAR_FIELD_TRANSLATIONS: RegistrarFieldTranslation[];
|
|
20
|
+
export interface RegistrarConstraintRule {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
related_field: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const REGISTRAR_CONSTRAINT_RULES: RegistrarConstraintRule[];
|
|
27
|
+
export interface RegistrarExplainInput {
|
|
28
|
+
typed_value_first_byte?: number;
|
|
29
|
+
record_length?: number;
|
|
30
|
+
info?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface RegistrarExplanation {
|
|
33
|
+
summary: string;
|
|
34
|
+
vote_flags: string;
|
|
35
|
+
warnings: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function explainRegistrar(input: RegistrarExplainInput): RegistrarExplanation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH}from'@wowok/wowok';export const REGISTRAR_TRANSLATION_VERSION='1.0.0';export const SEMANTIC_TO_REGISTRAR_SCHEMA_RULES=[{'id':'P-REGISTRAR-01','pattern_name':'Register\x20entity','semantic_intent':'Register\x20a\x20user\x20Entity\x20record\x20+\x20Resource\x20mark\x20(idempotent).','match_keywords':['register\x20entity','register\x20user','affiliate'],'required_fields':[],'optional_fields':['referrer'],'example':{'referrer':'0x...'}},{'id':'P-REGISTRAR-02','pattern_name':'Vote\x20(like/dislike/affiliation)','semantic_intent':'Cast\x20a\x20like/dislike/affiliation\x20vote\x20via\x20the\x20Vote.info\x20bitmask.','match_keywords':['like','dislike','affiliate','vote'],'required_fields':['who'],'optional_fields':['info'],'example':{'who':'0x...','info':0x2}}];export const REGISTRAR_FIELD_TRANSLATIONS=[{'field_name':'table','value_type':'ParentTable<address,\x20Votes\x20|\x20AddressInfo>','semantic':'Registrar:\x20who\x20→\x20Votes;\x20Entity:\x20who\x20→\x20AddressInfo.','format_example':'{0x...:\x20Votes}','validation_rules':['bounded\x20by\x20MAX_ADDRESS_COUNT\x20('+MAX_ADDRESS_COUNT+')']},{'field_name':'typed_value','value_type':'vector<u8>','semantic':'Record\x20value;\x20first\x20byte\x20encodes\x20ValueType.','format_example':'0x01...','validation_rules':['ERecordTypeEmpty\x20(3)\x20when\x20empty','≤\x20MAX_RECORD_LENGTH\x20('+MAX_RECORD_LENGTH+')']},{'field_name':'info','value_type':'u8','semantic':'Vote\x20bitmask:\x20LIKE=0x02,\x20DISLIKE=0x04,\x20AFFILIATION=0x08;\x20bits\x204-7\x20reserved.','format_example':'0x02\x20(like)','validation_rules':['mask\x20to\x20bits\x200-3\x20today']},{'field_name':'referrer','value_type':'Option<address>','semantic':'Self-attested\x20referrer\x20(unverified).','format_example':'0x...referrer...','validation_rules':['treat\x20as\x20hint,\x20not\x20trust\x20signal']}];export const REGISTRAR_CONSTRAINT_RULES=[{'id':'REGISTRAR_C_01','name':'record\x20type','description':'typed_value\x20non-empty;\x20first\x20byte\x20is\x20ValueType.','related_field':'typed_value'},{'id':'REGISTRAR_C_02','name':'record\x20length','description':'typed_value\x20≤\x20MAX_RECORD_LENGTH\x20('+MAX_RECORD_LENGTH+').','related_field':'typed_value'},{'id':'REGISTRAR_C_03','name':'address\x20cap','description':'Entity/Registrar\x20tables\x20bounded\x20by\x20MAX_ADDRESS_COUNT\x20('+MAX_ADDRESS_COUNT+').','related_field':'table'},{'id':'REGISTRAR_C_04','name':'vote\x20bitmask','description':'bits\x204-7\x20reserved;\x20mask\x20to\x200-3.','related_field':'info'}];export function explainRegistrar(a){const b=[],c=[];if(a['info']!==undefined){if((a['info']&0x2)===0x2)c['push']('like');if((a['info']&0x4)===0x4)c['push']('dislike');if((a['info']&0x8)===0x8)c['push']('affiliation');if((a['info']&0xf0)!==0x0)b['push']('reserved\x20bits\x204-7\x20set\x20(forward-incompatible)');}return a['record_length']!==undefined&&a['record_length']>MAX_RECORD_LENGTH&&b['push']('record\x20length\x20'+a['record_length']+'\x20>\x20'+MAX_RECORD_LENGTH),{'summary':'Registrar\x20record.\x20Vote\x20flags:\x20'+(c['join'](',')||'none')+'.','vote_flags':c['join'](',')||'none','warnings':b};}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RepositoryIdFromMode } from "./repository-ledger.js";
|
|
2
|
+
export declare const REPOSITORY_CONTEXT_VERSION = "1.0.0";
|
|
3
|
+
export interface RepositoryContextBundle {
|
|
4
|
+
idFromMode?: RepositoryIdFromMode;
|
|
5
|
+
summary: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BuildRepositoryContextInput {
|
|
8
|
+
id_from?: number;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildRepositoryContext(input: BuildRepositoryContextInput): RepositoryContextBundle;
|
|
12
|
+
export declare function getRepositoryContextSummary(ctx: RepositoryContextBundle): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getRepositoryIdFrom}from'./repository-ledger.js';export const REPOSITORY_CONTEXT_VERSION='1.0.0';export function buildRepositoryContext(a){const b=a['id_from']!==undefined?getRepositoryIdFrom(a['id_from']):undefined,c=[];return a['name']&&c['push']('policy\x20\x22'+a['name']+'\x22'),b?c['push']('id_from='+b['mode']+'\x20('+b['semantic']+')'):c['push']('id_from\x20not\x20classified'),{'idFromMode':b?.['mode'],'summary':c['join']('\x20·\x20')};}export function getRepositoryContextSummary(a){return a['summary'];}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const REPOSITORY_LEDGER_VERSION = "1.0.0";
|
|
2
|
+
export type RepositoryIdFromMode = "none" | "clock" | "signer";
|
|
3
|
+
export interface RepositoryIdFromEntry {
|
|
4
|
+
value: number;
|
|
5
|
+
mode: RepositoryIdFromMode;
|
|
6
|
+
semantic: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const REPOSITORY_ID_FROM: RepositoryIdFromEntry[];
|
|
9
|
+
export interface RepositoryFieldEntry {
|
|
10
|
+
field: string;
|
|
11
|
+
value_type: string;
|
|
12
|
+
semantic: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const REPOSITORY_POLICY_FIELDS: RepositoryFieldEntry[];
|
|
16
|
+
export interface RepositoryErrorEntry {
|
|
17
|
+
code: string;
|
|
18
|
+
value: number;
|
|
19
|
+
description: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const REPOSITORY_ERROR_CODES: RepositoryErrorEntry[];
|
|
22
|
+
export declare function getRepositoryIdFrom(value: number): RepositoryIdFromEntry | undefined;
|
|
23
|
+
export declare function getRepositoryErrorByCode(code: string): RepositoryErrorEntry | undefined;
|
|
24
|
+
export declare function getRepositoryErrorByValue(value: number): RepositoryErrorEntry | undefined;
|
|
25
|
+
export declare function getRepositoryErrorsCount(): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const REPOSITORY_LEDGER_VERSION='1.0.0';export const REPOSITORY_ID_FROM=[{'value':0x0,'mode':'none','semantic':'No\x20auto-id\x20—\x20caller\x20supplies\x20the\x20id\x20(write_guard\x20required,\x20E_POLICY_WRITE_GUARD_REQUIRED).'},{'value':0x1,'mode':'clock','semantic':'Id\x20is\x20auto-generated\x20from\x20clock\x20(timestamp-derived).'},{'value':0x2,'mode':'signer','semantic':'Id\x20is\x20auto-generated\x20from\x20the\x20tx\x20signer\x20address.'}];export const REPOSITORY_POLICY_FIELDS=[{'field':'name','value_type':'string','semantic':'Policy\x20name\x20(unique\x20key\x20within\x20the\x20repository).','required':!![]},{'field':'description','value_type':'string','semantic':'Policy\x20description\x20(≤\x20MAX_POLICY_DESCRIPTION_LEN\x20500\x20bytes).','required':!![]},{'field':'write_guard','value_type':'vector<PolicyGuard>','semantic':'Guards\x20that\x20must\x20pass\x20to\x20write\x20a\x20record\x20(≤\x20MAX_POLICY_GUARD_COUNT\x2010).','required':![]},{'field':'quote_guard','value_type':'Option<address>','semantic':'Guard\x20that\x20must\x20pass\x20to\x20read/quote\x20a\x20record.','required':![]},{'field':'id_from','value_type':'u8','semantic':'Id\x20derivation\x20mode\x20(0=none,\x201=clock,\x202=signer).','required':!![]},{'field':'value_type','value_type':'u8','semantic':'Data\x20value\x20type\x20(VALUE_TYPE).','required':!![]}];export const REPOSITORY_ERROR_CODES=[{'code':'E_POLICY_DESCRIPTION_EXCEEDED','value':0x1,'description':'Policy\x20description\x20>\x20MAX_POLICY_DESCRIPTION_LEN\x20(500).'},{'code':'E_POLICY_GUARD_COUNT_EXCEEDED','value':0x2,'description':'write_guard\x20count\x20>\x20MAX_POLICY_GUARD_COUNT\x20(10).'},{'code':'E_POLICY_COUNT_EXCEEDED','value':0x3,'description':'policy\x20count\x20>\x20MAX_POLICY_COUNT\x20(50).'},{'code':'E_DATA_EXCEEDED','value':0x4,'description':'data\x20size\x20>\x20MAX_DATA_SIZE\x20(40960\x20bytes).'},{'code':'E_ID_COUNT_EXCEEDED','value':0x5,'description':'id\x20count\x20>\x20MAX_ID_COUNT_ONCE\x20(100).'},{'code':'E_QUANTITIES_NOT_EQUAL','value':0x6,'description':'ids\x20and\x20data\x20vector\x20lengths\x20mismatch.'},{'code':'E_POLICY_NOT_FOUND','value':0x7,'description':'Referenced\x20policy\x20name\x20not\x20found.'},{'code':'E_POLICY_ID_FROM_NONE','value':0x8,'description':'Policy\x20id_from\x20is\x20None\x20but\x20caller\x20supplied\x20an\x20id.'},{'code':'E_NEED_PASSPORT','value':0x9,'description':'Operation\x20requires\x20a\x20passport\x20(usage\x20guard).'},{'code':'E_DATA_TYPE_NOT_MATCH','value':0xa,'description':'Data\x20value\x20type\x20does\x20not\x20match\x20policy\x20value_type.'},{'code':'E_GUARD_SPECIFIED_ID_FROM_SUBMISSION','value':0xb,'description':'Guard-specified\x20id_from_submission\x20conflict.'},{'code':'E_NOT_IMPACT_GUARD_IN_PASSPORT','value':0xc,'description':'Guard\x20not\x20marked\x20impactful\x20in\x20passport.'},{'code':'E_GUARD_SPECIFIED_NOT_IN_POLICY','value':0xd,'description':'Guard\x20not\x20in\x20policy\x20write_guard.'},{'code':'E_ID_VECTOR_NOT_ENOUGH','value':0xe,'description':'Not\x20enough\x20ids\x20supplied.'},{'code':'E_DATA_VECTOR_NOT_ENOUGH','value':0xf,'description':'Not\x20enough\x20data\x20supplied.'},{'code':'E_INVALID_ID_IN_GUARD_TABLE','value':0x10,'description':'Invalid\x20id\x20identifier\x20in\x20guard\x20table.'},{'code':'E_INVALID_DATA_IN_GUARD_TABLE','value':0x11,'description':'Invalid\x20data\x20identifier\x20in\x20guard\x20table.'},{'code':'E_INVALID_ID_FROM','value':0x12,'description':'id_from\x20is\x20not\x200/1/2.'},{'code':'E_MAX_REWARD_COUNT_EXCEEDED','value':0x13,'description':'reward\x20count\x20>\x20MAX_REWARD_COUNT\x20(20).'},{'code':'E_GUARD_NOT_SPECIFIED_ID_FROM_SUBMISSION','value':0x14,'description':'Guard\x20id_from_submission\x20missing\x20when\x20required.'},{'code':'E_NEED_DEPENDENT_GUARD','value':0x15,'description':'Dependent\x20guard\x20not\x20satisfied.'},{'code':'E_POLICY_WRITE_GUARD_REQUIRED','value':0x16,'description':'write_guard\x20empty\x20when\x20id_from\x20is\x20None.'},{'code':'E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN','value':0x17,'description':'id_from_submission\x20forbidden\x20when\x20id_from\x20is\x20Clock/Signer.'}];export function getRepositoryIdFrom(a){return REPOSITORY_ID_FROM['find'](b=>b['value']===a);}export function getRepositoryErrorByCode(a){return REPOSITORY_ERROR_CODES['find'](b=>b['code']===a);}export function getRepositoryErrorByValue(a){return REPOSITORY_ERROR_CODES['find'](b=>b['value']===a);}export function getRepositoryErrorsCount(){return REPOSITORY_ERROR_CODES['length'];}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type RepositoryIdFromMode } from "./repository-ledger.js";
|
|
2
|
+
export declare const REPOSITORY_PUZZLE_VERSION = "1.0.0";
|
|
3
|
+
export interface RepositoryIntentPuzzle {
|
|
4
|
+
idFromMode?: RepositoryIdFromMode;
|
|
5
|
+
}
|
|
6
|
+
export interface RepositoryFieldState {
|
|
7
|
+
field: string;
|
|
8
|
+
present: boolean;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RepositoryPuzzle {
|
|
12
|
+
intent: RepositoryIntentPuzzle;
|
|
13
|
+
fields: RepositoryFieldState[];
|
|
14
|
+
}
|
|
15
|
+
export interface RepositoryPuzzleCompleteness {
|
|
16
|
+
complete: boolean;
|
|
17
|
+
missing_required: string[];
|
|
18
|
+
reason: string;
|
|
19
|
+
}
|
|
20
|
+
export interface InitRepositoryPuzzleInput {
|
|
21
|
+
intent: string;
|
|
22
|
+
id_from?: number;
|
|
23
|
+
name?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
value_type?: number;
|
|
26
|
+
write_guard_count?: number;
|
|
27
|
+
quote_guard?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function initRepositoryPuzzleFromIntent(input: InitRepositoryPuzzleInput): RepositoryPuzzle;
|
|
30
|
+
export declare function checkRepositoryPuzzleCompleteness(puzzle: RepositoryPuzzle): RepositoryPuzzleCompleteness;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{REPOSITORY_ID_FROM,REPOSITORY_POLICY_FIELDS}from'./repository-ledger.js';export const REPOSITORY_PUZZLE_VERSION='1.0.0';export function initRepositoryPuzzleFromIntent(a){const b=a['id_from']!==undefined?REPOSITORY_ID_FROM['find'](e=>e['value']===a['id_from']):undefined,c={'name':!!a['name'],'description':!!a['description'],'id_from':a['id_from']!==undefined,'value_type':a['value_type']!==undefined,'write_guard':(a['write_guard_count']??0x0)>0x0,'quote_guard':a['quote_guard']!=null&&a['quote_guard']!==''},d=REPOSITORY_POLICY_FIELDS['map'](e=>({'field':e['field'],'present':!!c[e['field']],'required':e['required']}));return{'intent':{'idFromMode':b?.['mode']},'fields':d};}export function checkRepositoryPuzzleCompleteness(a){const b=a['fields']['filter'](d=>d['required']&&!d['present'])['map'](d=>d['field']),c=b['length']===0x0;return{'complete':c,'missing_required':b,'reason':c?'All\x20required\x20policy\x20fields\x20present.':'Missing\x20required:\x20'+b['join'](',\x20')+'.'};}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const REPOSITORY_TEMPLATES_VERSION = "1.0.0";
|
|
2
|
+
export interface RepositoryTemplate {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
id_from: number;
|
|
7
|
+
value_type: number;
|
|
8
|
+
write_guard_required: boolean;
|
|
9
|
+
quote_guard_required: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const REPOSITORY_TEMPLATES: RepositoryTemplate[];
|
|
12
|
+
export declare function getRepositoryTemplateById(id: string): RepositoryTemplate | undefined;
|
|
13
|
+
export declare function listRepositoryTemplates(): RepositoryTemplate[];
|
|
14
|
+
export declare function suggestRepositoryTemplateForMode(mode: string): RepositoryTemplate | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{REPOSITORY_ID_FROM}from'./repository-ledger.js';export const REPOSITORY_TEMPLATES_VERSION='1.0.0';export const REPOSITORY_TEMPLATES=[{'id':'repo_timestamp_log','name':'Append-only\x20timestamp\x20log','description':'Id\x20auto-derived\x20from\x20clock;\x20write\x20protected\x20by\x20a\x20signer\x20guard.','id_from':0x1,'value_type':0x0,'write_guard_required':!![],'quote_guard_required':![]},{'id':'repo_signer_owned','name':'Signer-owned\x20record','description':'Id\x20auto-derived\x20from\x20signer\x20address;\x20write\x20protected\x20by\x20ownership.','id_from':0x2,'value_type':0x0,'write_guard_required':!![],'quote_guard_required':![]},{'id':'repo_caller_supplied','name':'Caller-supplied\x20id','description':'Caller\x20supplies\x20the\x20id;\x20write_guard\x20is\x20mandatory\x20(id_from=None).','id_from':0x0,'value_type':0x0,'write_guard_required':!![],'quote_guard_required':![]}];export function getRepositoryTemplateById(a){return REPOSITORY_TEMPLATES['find'](b=>b['id']===a);}export function listRepositoryTemplates(){return REPOSITORY_TEMPLATES;}export function suggestRepositoryTemplateForMode(a){const b=REPOSITORY_ID_FROM['find'](c=>c['mode']===a);return b?REPOSITORY_TEMPLATES['find'](c=>c['id_from']===b['value']):undefined;}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const RESOURCE_CONFIRM_VERSION = "1.0.0";
|
|
2
|
+
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
+
export interface ResourceConfirmItem {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: ConfirmSeverity;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
evidence?: string;
|
|
10
|
+
fix_hint?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ResourceOpCheckInput {
|
|
13
|
+
tags_count?: number;
|
|
14
|
+
tag_set_return_ignored?: boolean;
|
|
15
|
+
is_destroy?: boolean;
|
|
16
|
+
expects_resource_permission?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function preCheckResourceOp(input: ResourceOpCheckInput): ResourceConfirmItem[];
|
|
19
|
+
export declare function canProceedResourceOp(input: ResourceOpCheckInput): {
|
|
20
|
+
canProceed: boolean;
|
|
21
|
+
blockers: ResourceConfirmItem[];
|
|
22
|
+
warnings: ResourceConfirmItem[];
|
|
23
|
+
info: ResourceConfirmItem[];
|
|
24
|
+
};
|
|
25
|
+
export declare function formatResourceOpSummary(input: ResourceOpCheckInput): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_TAGS_COUNT}from'@wowok/wowok';export const RESOURCE_CONFIRM_VERSION='1.0.0';function checkTagsCount(a){if(a['tags_count']===undefined)return{'id':'C-RESOURCE-01','severity':'info','title':'tags_count\x20below\x20MAX_TAGS_COUNT\x20('+MAX_TAGS_COUNT+')','description':'add_object_tags\x20aborts\x20with\x20E_TAGS_COUNT_EXCEEDED\x20(1)\x20at\x20the\x20boundary.','passed':!![],'evidence':'not\x20provided'};const b=a['tags_count']<MAX_TAGS_COUNT;return{'id':'C-RESOURCE-01','severity':b?'info':'block','title':'tags_count\x20below\x20MAX_TAGS_COUNT\x20('+MAX_TAGS_COUNT+')','description':'A\x20single\x20object\x27s\x20AddressTag.tags\x20may\x20hold\x20up\x20to\x20MAX_TAGS_COUNT='+MAX_TAGS_COUNT+'\x20entries.\x20add_object_tags\x20aborts\x20with\x20E_TAGS_COUNT_EXCEEDED\x20(1).','passed':b,'evidence':'tags_count='+a['tags_count']+',\x20limit='+MAX_TAGS_COUNT,'fix_hint':'Remove\x20stale\x20tags\x20or\x20shard\x20across\x20multiple\x20Resource\x20objects.'};}function checkTagSetReturn(a){const b=!!a['tag_set_return_ignored'];return{'id':'C-RESOURCE-02','severity':b?'warn':'info','title':'tag_set\x20return\x20value\x20is\x20surfaced\x20(duplicate\x20detection)','description':'tag_set\x20returns\x20bool:\x20true=new\x20tag\x20added,\x20false=duplicate\x20skipped.\x20Ignoring\x20it\x20masks\x20idempotency\x20intent.','passed':!b,'evidence':b?'tag_set_return_ignored=true':'return\x20value\x20consumed','fix_hint':'Expose\x20tag_set\x27s\x20bool\x20to\x20the\x20caller;\x20surface\x20\x27tag\x20already\x20existed\x27\x20when\x20false.'};}function checkDestroy(a){if(!a['is_destroy'])return{'id':'C-RESOURCE-03','severity':'info','title':'destroy\x20is\x20irreversible\x20—\x20confirm\x20no\x20live\x20references','description':'Resource.destroy\x20deletes\x20the\x20object\x20and\x20its\x20ParentTable\x20in\x20place\x20(no\x20archive/rollback).','passed':!![],'evidence':'not\x20destroying'};return{'id':'C-RESOURCE-03','severity':'warn','title':'destroy\x20is\x20irreversible\x20—\x20no\x20recovery\x20mechanism','description':'Once\x20destroyed,\x20the\x20Resource\x20id\x20is\x20permanently\x20invalid\x20and\x20all\x20tags\x20are\x20lost.\x20Confirm\x20no\x20Personal/Entity\x20reference\x20it.','passed':![],'evidence':'is_destroy=true','fix_hint':'Verify\x20no\x20owner\x20references\x20remain\x20before\x20calling\x20destroy.'};}function checkPermission(a){const b=!!a['expects_resource_permission'];return{'id':'C-RESOURCE-04','severity':b?'warn':'info','title':'Resource\x20has\x20no\x20own\x20Permission\x20—\x20caller\x20must\x20gate\x20access','description':'All\x20Resource\x20functions\x20are\x20public(package)/public\x20with\x20no\x20on-chain\x20permission\x20check;\x20the\x20calling\x20module\x20(Personal/Entity)\x20enforces\x20its\x20own\x20gate.','passed':!b,'evidence':b?'expects_resource_permission=true\x20(none\x20exists)':'caller-side\x20gating\x20assumed','fix_hint':'Enforce\x20permission\x20in\x20the\x20calling\x20module\x20before\x20invoking\x20Resource\x20functions.'};}export function preCheckResourceOp(a){return[checkTagsCount(a),checkTagSetReturn(a),checkDestroy(a),checkPermission(a)];}export function canProceedResourceOp(a){const b=preCheckResourceOp(a);return{'canProceed':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatResourceOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedResourceOp(a),e=[b?'✓\x20Resource\x20operation\x20pre-check\x20PASSED':'✗\x20Resource\x20operation\x20pre-check\x20FAILED',''];return c['length']>0x0&&(e['push']('BLOCKERS:'),c['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??''))),e['push']('')),d['length']>0x0&&(e['push']('WARNINGS:'),d['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??'')))),e['join']('\x0a');}
|