@wowok/agent-mcp 3.0.1 → 3.0.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/LICENSE +0 -3
- package/dist/harness/recover.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/event-semantics.spec.js +1 -1
- package/dist/knowledge/flywheel-loop.d.ts +4 -52
- package/dist/knowledge/flywheel-loop.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/index.d.ts +2 -225
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/migration-preflight.d.ts +27 -0
- package/dist/knowledge/migration-preflight.js +1 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.d.ts +2 -2
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-puzzle.d.ts +4 -4
- package/dist/knowledge/order-puzzle.js +1 -1
- package/dist/knowledge/order-risk.d.ts +1 -0
- package/dist/knowledge/order-risk.js +1 -1
- package/dist/knowledge/order-templates.d.ts +1 -1
- package/dist/knowledge/order-templates.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/service-ledger.js +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/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/normalize.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.d.ts +3 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.d.ts +2 -0
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.d.ts +7 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +19 -0
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/review/machine.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/base.d.ts +12 -3
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +4 -0
- package/dist/schema/call/bridge.js +1 -1
- package/dist/schema/call/error-codes.d.ts +2 -0
- package/dist/schema/call/error-codes.js +1 -0
- package/dist/schema/call/guard.d.ts +4 -4
- package/dist/schema/call/semantic.d.ts +9 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +3 -3
- package/dist/schema/goal/planning.d.ts +2 -2
- package/dist/schema/industry-pack/index.d.ts +46 -4
- package/dist/schema/industry-pack/modes.d.ts +46 -4
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +3 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/local/index.d.ts +558 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +25 -25
- package/dist/schema/operations.d.ts +29 -1
- package/dist/schema/persona/index.d.ts +2 -2
- package/dist/schema/query/bi.d.ts +89 -4
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +48 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/trust/index.d.ts +3 -3
- package/dist/schema/workspace/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +4 -0
- package/dist/schemas/bridge_operation.output.json +4 -0
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +162 -6
- package/dist/schemas/intent_radar.output.json +2 -0
- package/dist/schemas/intent_radar.schema.json +1 -0
- package/dist/schemas/local_history_operation.output.json +1458 -0
- package/dist/schemas/local_history_operation.schema.json +105 -0
- package/dist/schemas/local_info_operation.output.json +4 -0
- package/dist/schemas/local_mark_operation.output.json +4 -0
- package/dist/schemas/onchain_events.output.json +55 -11
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_operations.output.json +4 -1
- package/dist/schemas/onchain_operations.schema.json +30 -10
- package/dist/schemas/onchain_operations_guard.schema.json +30 -10
- package/dist/schemas/onchain_table_data.output.json +41 -0
- package/dist/schemas/query_toolkit.output.json +200 -16
- package/dist/schemas/query_toolkit.schema.json +41 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/local.d.ts +1 -0
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/knowledge/allocation-confirm.d.ts +0 -115
- package/dist/knowledge/allocation-confirm.js +0 -1
- package/dist/knowledge/allocation-context.d.ts +0 -58
- package/dist/knowledge/allocation-context.js +0 -1
- package/dist/knowledge/allocation-translation.d.ts +0 -72
- package/dist/knowledge/allocation-translation.js +0 -1
- package/dist/knowledge/arb-confirm.d.ts +0 -28
- package/dist/knowledge/arb-confirm.js +0 -1
- package/dist/knowledge/arb-translation.d.ts +0 -48
- package/dist/knowledge/arb-translation.js +0 -1
- package/dist/knowledge/arbitration-confirm.d.ts +0 -135
- package/dist/knowledge/arbitration-confirm.js +0 -1
- package/dist/knowledge/arbitration-context.d.ts +0 -81
- package/dist/knowledge/arbitration-context.js +0 -1
- package/dist/knowledge/arbitration-translation.d.ts +0 -91
- package/dist/knowledge/arbitration-translation.js +0 -1
- package/dist/knowledge/bridge-confirm.d.ts +0 -26
- package/dist/knowledge/bridge-confirm.js +0 -1
- package/dist/knowledge/bridge-translation.d.ts +0 -37
- package/dist/knowledge/bridge-translation.js +0 -1
- package/dist/knowledge/contact-confirm.d.ts +0 -27
- package/dist/knowledge/contact-confirm.js +0 -1
- package/dist/knowledge/contact-translation.d.ts +0 -39
- package/dist/knowledge/contact-translation.js +0 -1
- package/dist/knowledge/demand-confirm.d.ts +0 -32
- package/dist/knowledge/demand-confirm.js +0 -1
- package/dist/knowledge/demand-context.d.ts +0 -17
- package/dist/knowledge/demand-context.js +0 -1
- package/dist/knowledge/demand-ledger.d.ts +0 -26
- package/dist/knowledge/demand-ledger.js +0 -1
- package/dist/knowledge/demand-puzzle.d.ts +0 -29
- package/dist/knowledge/demand-puzzle.js +0 -1
- package/dist/knowledge/demand-templates.d.ts +0 -12
- package/dist/knowledge/demand-templates.js +0 -1
- package/dist/knowledge/demand-translation.d.ts +0 -55
- package/dist/knowledge/demand-translation.js +0 -1
- package/dist/knowledge/examples-scanner-cli.d.ts +0 -1
- package/dist/knowledge/examples-scanner-cli.js +0 -1
- package/dist/knowledge/examples-scanner.d.ts +0 -121
- package/dist/knowledge/examples-scanner.js +0 -1
- package/dist/knowledge/glossary.d.ts +0 -18
- package/dist/knowledge/glossary.js +0 -1
- package/dist/knowledge/guard-bytecode-spec.d.ts +0 -82
- package/dist/knowledge/guard-bytecode-spec.js +0 -1
- package/dist/knowledge/guard-confirm.d.ts +0 -86
- package/dist/knowledge/guard-confirm.js +0 -1
- package/dist/knowledge/immutability.d.ts +0 -11
- package/dist/knowledge/immutability.js +0 -1
- package/dist/knowledge/machine-confirm.d.ts +0 -102
- package/dist/knowledge/machine-confirm.js +0 -1
- package/dist/knowledge/machine-context.d.ts +0 -160
- package/dist/knowledge/machine-context.js +0 -1
- package/dist/knowledge/machine-render.d.ts +0 -41
- package/dist/knowledge/machine-render.js +0 -1
- package/dist/knowledge/mcp-schema-audit-cli.d.ts +0 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +0 -1
- package/dist/knowledge/mcp-schema-audit.d.ts +0 -91
- package/dist/knowledge/mcp-schema-audit.js +0 -1
- package/dist/knowledge/messenger-guard-guidance.d.ts +0 -17
- package/dist/knowledge/messenger-guard-guidance.js +0 -1
- package/dist/knowledge/order-confirm.d.ts +0 -115
- package/dist/knowledge/order-confirm.js +0 -1
- package/dist/knowledge/order-context.d.ts +0 -66
- package/dist/knowledge/order-context.js +0 -1
- package/dist/knowledge/order-translation.d.ts +0 -78
- package/dist/knowledge/order-translation.js +0 -1
- package/dist/knowledge/overrides-loader.d.ts +0 -13
- package/dist/knowledge/overrides-loader.js +0 -1
- package/dist/knowledge/passport-confirm.d.ts +0 -130
- package/dist/knowledge/passport-confirm.js +0 -1
- package/dist/knowledge/passport-context.d.ts +0 -59
- package/dist/knowledge/passport-context.js +0 -1
- package/dist/knowledge/passport-puzzle.d.ts +0 -108
- package/dist/knowledge/passport-puzzle.js +0 -1
- package/dist/knowledge/passport-risk.d.ts +0 -70
- package/dist/knowledge/passport-risk.js +0 -1
- package/dist/knowledge/passport-translation.d.ts +0 -68
- package/dist/knowledge/passport-translation.js +0 -1
- package/dist/knowledge/payment-confirm.d.ts +0 -26
- package/dist/knowledge/payment-confirm.js +0 -1
- package/dist/knowledge/payment-translation.d.ts +0 -37
- package/dist/knowledge/payment-translation.js +0 -1
- package/dist/knowledge/permission-confirm.d.ts +0 -110
- package/dist/knowledge/permission-confirm.js +0 -1
- package/dist/knowledge/permission-context.d.ts +0 -69
- package/dist/knowledge/permission-context.js +0 -1
- package/dist/knowledge/permission-translation.d.ts +0 -57
- package/dist/knowledge/permission-translation.js +0 -1
- package/dist/knowledge/personal-confirm.d.ts +0 -29
- package/dist/knowledge/personal-confirm.js +0 -1
- package/dist/knowledge/personal-translation.d.ts +0 -37
- package/dist/knowledge/personal-translation.js +0 -1
- package/dist/knowledge/process-model.d.ts +0 -14
- package/dist/knowledge/process-model.js +0 -1
- package/dist/knowledge/progress-confirm.d.ts +0 -108
- package/dist/knowledge/progress-confirm.js +0 -1
- package/dist/knowledge/progress-context.d.ts +0 -123
- package/dist/knowledge/progress-context.js +0 -1
- package/dist/knowledge/progress-translation.d.ts +0 -52
- package/dist/knowledge/progress-translation.js +0 -1
- package/dist/knowledge/proof-confirm.d.ts +0 -31
- package/dist/knowledge/proof-confirm.js +0 -1
- package/dist/knowledge/proof-context.d.ts +0 -17
- package/dist/knowledge/proof-context.js +0 -1
- package/dist/knowledge/proof-ledger.d.ts +0 -34
- package/dist/knowledge/proof-ledger.js +0 -1
- package/dist/knowledge/proof-puzzle.d.ts +0 -35
- package/dist/knowledge/proof-puzzle.js +0 -1
- package/dist/knowledge/proof-templates.d.ts +0 -22
- package/dist/knowledge/proof-templates.js +0 -1
- package/dist/knowledge/proof-translation.d.ts +0 -52
- package/dist/knowledge/proof-translation.js +0 -1
- package/dist/knowledge/registrar-confirm.d.ts +0 -26
- package/dist/knowledge/registrar-confirm.js +0 -1
- package/dist/knowledge/registrar-translation.d.ts +0 -37
- package/dist/knowledge/registrar-translation.js +0 -1
- package/dist/knowledge/repository-confirm.d.ts +0 -40
- package/dist/knowledge/repository-confirm.js +0 -1
- package/dist/knowledge/repository-context.d.ts +0 -12
- package/dist/knowledge/repository-context.js +0 -1
- package/dist/knowledge/repository-ledger.d.ts +0 -25
- package/dist/knowledge/repository-ledger.js +0 -1
- package/dist/knowledge/repository-puzzle.d.ts +0 -30
- package/dist/knowledge/repository-puzzle.js +0 -1
- package/dist/knowledge/repository-templates.d.ts +0 -14
- package/dist/knowledge/repository-templates.js +0 -1
- package/dist/knowledge/repository-translation.d.ts +0 -58
- package/dist/knowledge/repository-translation.js +0 -1
- package/dist/knowledge/resource-confirm.d.ts +0 -25
- package/dist/knowledge/resource-confirm.js +0 -1
- package/dist/knowledge/resource-translation.d.ts +0 -37
- package/dist/knowledge/resource-translation.js +0 -1
- package/dist/knowledge/reward-confirm.d.ts +0 -116
- package/dist/knowledge/reward-confirm.js +0 -1
- package/dist/knowledge/reward-context.d.ts +0 -127
- package/dist/knowledge/reward-context.js +0 -1
- package/dist/knowledge/reward-translation.d.ts +0 -58
- package/dist/knowledge/reward-translation.js +0 -1
- package/dist/knowledge/service-confirm.d.ts +0 -161
- package/dist/knowledge/service-confirm.js +0 -1
- package/dist/knowledge/service-context.d.ts +0 -66
- package/dist/knowledge/service-context.js +0 -1
- package/dist/knowledge/service-translation.d.ts +0 -103
- package/dist/knowledge/service-translation.js +0 -1
- package/dist/knowledge/treasury-confirm.d.ts +0 -133
- package/dist/knowledge/treasury-confirm.js +0 -1
- package/dist/knowledge/treasury-context.d.ts +0 -64
- package/dist/knowledge/treasury-context.js +0 -1
- package/dist/knowledge/treasury-translation.d.ts +0 -78
- package/dist/knowledge/treasury-translation.js +0 -1
- package/dist/knowledge/util-confirm.d.ts +0 -24
- package/dist/knowledge/util-confirm.js +0 -1
- package/dist/knowledge/util-translation.d.ts +0 -39
- package/dist/knowledge/util-translation.js +0 -1
- package/dist/loop-engineering/aggregate.d.ts +0 -50
- package/dist/loop-engineering/aggregate.js +0 -1
- package/dist/loop-engineering/context-collect.d.ts +0 -7
- package/dist/loop-engineering/context-collect.js +0 -1
- package/dist/loop-engineering/diagnose.d.ts +0 -22
- package/dist/loop-engineering/diagnose.js +0 -1
- package/dist/loop-engineering/improve.d.ts +0 -55
- package/dist/loop-engineering/improve.js +0 -1
- package/dist/loop-engineering/index.d.ts +0 -4
- package/dist/loop-engineering/index.js +0 -1
- package/dist/loop-engineering/pipeline.d.ts +0 -17
- package/dist/loop-engineering/pipeline.js +0 -1
- package/dist/schema/utils/object-type-utils.d.ts +0 -12
- package/dist/schema/utils/object-type-utils.js +0 -1
- package/dist/telemetry/index.d.ts +0 -19
- package/dist/telemetry/index.js +0 -1
- package/dist/telemetry/redact.d.ts +0 -2
- package/dist/telemetry/redact.js +0 -1
- package/dist/telemetry/storage.d.ts +0 -8
- package/dist/telemetry/storage.js +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { type ArbitrationScene, type ArbitrationPermissionEntry, type ArbStatus, type DualGuardMatrix } from "./arbitration-ledger.js";
|
|
2
|
-
import { type ArbitrationTemplate } from "./arbitration-templates.js";
|
|
3
|
-
import { type SemanticToSchemaRule, type ArbitrationConstraintRule } from "./arbitration-translation.js";
|
|
4
|
-
import { type RiskRule, type ArbitrationStakeholder, type ArbitrationRiskAssessment } from "./arbitration-risk.js";
|
|
5
|
-
import { type ArbitrationPuzzle, type PuzzleCompleteness } from "./arbitration-puzzle.js";
|
|
6
|
-
import { type ChecklistItem, type ConfirmationQuestion, type ArbitrationJsonForConfirm } from "./arbitration-confirm.js";
|
|
7
|
-
export declare const ARBITRATION_CONTEXT_VERSION = "1.0.0";
|
|
8
|
-
export type ArbitrationInjectionMode = "initial_design" | "mid_design_review" | "pre_publish" | "post_publish_modify" | "stakeholder_review" | "apply_check";
|
|
9
|
-
export type ArbitrationStakeholderPerspective = ArbitrationStakeholder | "system";
|
|
10
|
-
export interface ArbitrationContextBundle {
|
|
11
|
-
version: string;
|
|
12
|
-
mode: ArbitrationInjectionMode;
|
|
13
|
-
stakeholder_perspective?: ArbitrationStakeholderPerspective;
|
|
14
|
-
matched_scene?: ArbitrationScene;
|
|
15
|
-
matched_template?: ArbitrationTemplate;
|
|
16
|
-
matched_pattern?: SemanticToSchemaRule;
|
|
17
|
-
puzzle_state?: ArbitrationPuzzle;
|
|
18
|
-
puzzle_completeness?: PuzzleCompleteness;
|
|
19
|
-
relevant_risks: RiskRule[];
|
|
20
|
-
risk_assessment?: ArbitrationRiskAssessment;
|
|
21
|
-
relevant_checklist: ChecklistItem[];
|
|
22
|
-
relevant_questions: ConfirmationQuestion[];
|
|
23
|
-
relevant_permissions: ArbitrationPermissionEntry[];
|
|
24
|
-
relevant_constraints: ArbitrationConstraintRule[];
|
|
25
|
-
dual_guard_matrix_entry?: DualGuardMatrix;
|
|
26
|
-
arb_lifecycle_context?: ArbLifecycleContext;
|
|
27
|
-
cross_object_refs: ArbitrationCrossObjectRef[];
|
|
28
|
-
onchain_constraints: ArbitrationOnchainConstraint[];
|
|
29
|
-
rendering_hints: ArbitrationRenderingHints;
|
|
30
|
-
}
|
|
31
|
-
export interface ArbLifecycleContext {
|
|
32
|
-
current_status?: ArbStatus;
|
|
33
|
-
current_status_code?: number;
|
|
34
|
-
is_terminal: boolean;
|
|
35
|
-
valid_next_statuses: ArbStatus[];
|
|
36
|
-
valid_operations_from_here: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface ArbitrationCrossObjectRef {
|
|
39
|
-
object: "Order" | "Service" | "Arb" | "Allocation" | "Treasury" | "Guard" | "Contact" | "Payment";
|
|
40
|
-
field: string;
|
|
41
|
-
scene_id: string;
|
|
42
|
-
description: string;
|
|
43
|
-
direction: "references" | "referenced_by";
|
|
44
|
-
}
|
|
45
|
-
export interface ArbitrationOnchainConstraint {
|
|
46
|
-
name: string;
|
|
47
|
-
value: string | number;
|
|
48
|
-
description: string;
|
|
49
|
-
}
|
|
50
|
-
export interface ArbitrationRenderingHints {
|
|
51
|
-
include_puzzle_template: boolean;
|
|
52
|
-
include_risk_details: boolean;
|
|
53
|
-
include_questions: boolean;
|
|
54
|
-
include_dual_guard_matrix: boolean;
|
|
55
|
-
include_arb_lifecycle: boolean;
|
|
56
|
-
include_immutability_warning: boolean;
|
|
57
|
-
include_indemnity_warning: boolean;
|
|
58
|
-
include_ownership_transfer_warning: boolean;
|
|
59
|
-
max_length: number;
|
|
60
|
-
}
|
|
61
|
-
export interface BuildArbitrationContextInput {
|
|
62
|
-
mode: ArbitrationInjectionMode;
|
|
63
|
-
intent?: string;
|
|
64
|
-
arbitration_json?: ArbitrationJsonForConfirm;
|
|
65
|
-
stakeholder?: ArbitrationStakeholderPerspective;
|
|
66
|
-
target_permission_index?: number;
|
|
67
|
-
target_operation_category?: ArbitrationScene["operation_category"];
|
|
68
|
-
current_arb_status?: ArbStatus;
|
|
69
|
-
voting_guard_empty?: boolean;
|
|
70
|
-
usage_guard_none?: boolean;
|
|
71
|
-
max_length?: number;
|
|
72
|
-
}
|
|
73
|
-
export declare function buildArbitrationContext(input: BuildArbitrationContextInput): ArbitrationContextBundle;
|
|
74
|
-
export declare function buildPromptFromArbitrationContext(bundle: ArbitrationContextBundle): string;
|
|
75
|
-
export declare function getArbitrationContextSummary(bundle: ArbitrationContextBundle): string;
|
|
76
|
-
export { ARBITRATION_LEDGER_VERSION, ARBITRATION_SCENES, ARBITRATION_PERMISSIONS, DUAL_GUARD_MATRIX, ARB_STATUS_CODE, ARB_TERMINAL_STATUSES, findSceneById, findSceneByPermissionIndex, inferSceneFromIntent, getScenesByCategory, getDualGuardMatrixEntry, isValidArbStatusTransition, isTerminalArbStatus, getActiveArbitrationPermissions, getAllArbitrationPermissions, } from "./arbitration-ledger.js";
|
|
77
|
-
export { ARBITRATION_TEMPLATES_VERSION, ARBITRATION_TEMPLATES, suggestTemplateForScene, getTemplatesByScene, getTemplateById, } from "./arbitration-templates.js";
|
|
78
|
-
export { ARBITRATION_TRANSLATION_VERSION, SEMANTIC_TO_SCHEMA_RULES, ARBITRATION_CONSTRAINT_RULES, matchSemanticPattern, explainArbitrationCallData, explainPermissionIndex, explainArbStatus, } from "./arbitration-translation.js";
|
|
79
|
-
export { ARBITRATION_RISK_VERSION, getAllRiskRules, assessArbitrationRisks, } from "./arbitration-risk.js";
|
|
80
|
-
export { ARBITRATION_CONFIRM_VERSION, ARBITRATION_OPERATION_CHECKLIST, ARBITRATION_CONFIRMATION_QUESTIONS, runArbitrationConfirmGate, } from "./arbitration-confirm.js";
|
|
81
|
-
export { initPuzzleFromIntent, checkPuzzleCompleteness, validateConstraints, } from "./arbitration-puzzle.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{ARBITRATION_SCENES,DUAL_GUARD_MATRIX,ARB_STATUS_CODE,ARB_TERMINAL_STATUSES,findSceneByPermissionIndex,inferSceneFromIntent,getScenesByCategory,getDualGuardMatrixEntry,isValidArbStatusTransition,isTerminalArbStatus,getActiveArbitrationPermissions,getAllArbitrationPermissions}from'./arbitration-ledger.js';import{getTemplatesByScene}from'./arbitration-templates.js';import{ARBITRATION_CONSTRAINT_RULES,matchSemanticPattern}from'./arbitration-translation.js';import{getAllRiskRules,assessArbitrationRisks}from'./arbitration-risk.js';import{initPuzzleFromIntent,checkPuzzleCompleteness}from'./arbitration-puzzle.js';import{ARBITRATION_OPERATION_CHECKLIST,ARBITRATION_CONFIRMATION_QUESTIONS}from'./arbitration-confirm.js';export const ARBITRATION_CONTEXT_VERSION='1.0.0';export function buildArbitrationContext(a){const b=a['max_length']??0x1194;let c;if(a['intent'])c=inferSceneFromIntent(a['intent']);else{if(a['target_permission_index']!==undefined)c=findSceneByPermissionIndex(a['target_permission_index']);else{if(a['target_operation_category']){const s=getScenesByCategory(a['target_operation_category']);if(s['length']>0x0)c=s[0x0];}}}let d;if(c){const t=getTemplatesByScene(c['id']);if(t['length']>0x0)d=t[0x0];}let e;if(a['intent']){const u=matchSemanticPattern(a['intent']);if(u['length']>0x0)e=u[0x0];}let f,g;a['mode']==='initial_design'&&a['intent']&&(f=initPuzzleFromIntent({'rule_sentence':a['intent']}),g=checkPuzzleCompleteness(f));const h=filterRiskRules(a['mode'],a['stakeholder'],c);let i;if(a['mode']==='pre_publish'&&a['arbitration_json']){const v={'object':a['arbitration_json']['object'],'description':a['arbitration_json']['description'],'location':a['arbitration_json']['location'],'fee':a['arbitration_json']['fee'],'pause':a['arbitration_json']['pause'],'dispute':a['arbitration_json']['dispute'],'confirm':a['arbitration_json']['confirm'],'voting_deadline_change':a['arbitration_json']['voting_deadline_change'],'vote':a['arbitration_json']['vote'],'feedback':a['arbitration_json']['feedback'],'arbitration':a['arbitration_json']['arbitration'],'reset':a['arbitration_json']['reset'],'arb_withdraw':a['arbitration_json']['arb_withdraw'],'fees_transfer':a['arbitration_json']['fees_transfer'],'usage_guard':a['arbitration_json']['usage_guard'],'voting_guard':a['arbitration_json']['voting_guard'],'um':a['arbitration_json']['um'],'builder':a['arbitration_json']['builder'],'current_arb_status':a['current_arb_status'],'expected_arb_status':a['arbitration_json']['arbitration']?'Arbitrated':a['current_arb_status']};i=assessArbitrationRisks(v);}const j=filterChecklist(a['mode']),k=filterQuestions(a['mode']),l=filterConstraints(a['mode'],c),m=a['stakeholder']==='system'?getAllArbitrationPermissions():getActiveArbitrationPermissions();let n;if(a['voting_guard_empty']!==undefined&&a['usage_guard_none']!==undefined)n=getDualGuardMatrixEntry(a['voting_guard_empty'],a['usage_guard_none']);else{if(c){const w=c['requires_voting_guard']==='empty',x=c['requires_usage_guard']==='none';n=getDualGuardMatrixEntry(w,x);}}const o=buildArbLifecycleContext(a['current_arb_status'],c),p=buildCrossObjectRefs(c),q=buildOnchainConstraints(),r=buildRenderingHints(a['mode'],b,!!a['arbitration_json']?.['arbitration'],!!a['arbitration_json']?.['builder']);return{'version':ARBITRATION_CONTEXT_VERSION,'mode':a['mode'],'stakeholder_perspective':a['stakeholder'],'matched_scene':c,'matched_template':d,'matched_pattern':e,'puzzle_state':f,'puzzle_completeness':g,'relevant_risks':h,'risk_assessment':i,'relevant_checklist':j,'relevant_questions':k,'relevant_permissions':m,'relevant_constraints':l,'dual_guard_matrix_entry':n,'arb_lifecycle_context':o,'cross_object_refs':p,'onchain_constraints':q,'rendering_hints':r};}function filterRiskRules(a,b,c){const d=getAllRiskRules();if(a==='initial_design')return d['filter'](e=>e['category']==='structural'||e['category']==='authority');if(a==='pre_publish')return d;if(a==='stakeholder_review'&&b){if(b==='owner')return d['filter'](e=>e['category']==='authority'||e['category']==='lifecycle'||e['category']==='cross_object');if(b==='arbiter')return d['filter'](e=>e['category']==='authority'||e['category']==='lifecycle');if(b==='voter')return d['filter'](e=>e['category']==='structural'||e['category']==='lifecycle');if(b==='disputant')return d['filter'](e=>e['category']==='semantic'||e['category']==='lifecycle');if(b==='system')return d['filter'](e=>e['category']==='structural'||e['category']==='cross_object');}if(a==='post_publish_modify')return d['filter'](e=>e['category']==='lifecycle'||e['category']==='cross_object');return d;}function filterChecklist(a){if(a==='initial_design')return ARBITRATION_OPERATION_CHECKLIST['filter'](b=>['C-AB-01','C-AB-02','C-AB-03','C-AB-04']['includes'](b['id']));return[...ARBITRATION_OPERATION_CHECKLIST];}function filterQuestions(a){if(a==='pre_publish')return[...ARBITRATION_CONFIRMATION_QUESTIONS];if(a==='post_publish_modify')return ARBITRATION_CONFIRMATION_QUESTIONS['filter'](b=>b['id']!=='QAB5');return[];}function filterConstraints(a,b){if(a==='initial_design')return ARBITRATION_CONSTRAINT_RULES['filter'](d=>d['category']==='structural');if(a==='pre_publish')return[...ARBITRATION_CONSTRAINT_RULES];if(b){const c={'lifecycle':['structural','authority'],'dispute':['semantic','lifecycle'],'voting':['semantic','lifecycle'],'ruling':['authority','lifecycle'],'fund':['cross_object'],'guard':['structural','semantic'],'governance':['authority']},d=c[b['operation_category']]??[];return ARBITRATION_CONSTRAINT_RULES['filter'](e=>d['includes'](e['category']));}return[...ARBITRATION_CONSTRAINT_RULES];}function buildArbLifecycleContext(a,b){if(!a&&!b)return undefined;const c=a?isTerminalArbStatus(a):![],d=[];if(a){const f=['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable','Finished','Withdrawn'];for(const g of f){g!==a&&isValidArbStatusTransition(a,g)&&d['push'](g);}}const e=[];for(const h of ARBITRATION_SCENES){a&&h['required_arb_status']&&h['required_arb_status']['includes'](a)&&e['push'](h['id']);}return{'current_status':a,'current_status_code':a?ARB_STATUS_CODE[a]:undefined,'is_terminal':c,'valid_next_statuses':d,'valid_operations_from_here':e};}function buildCrossObjectRefs(a){const b=[{'object':'Order','field':'dispute.order','scene_id':'arbitration_dispute','description':'dispute()\x20takes\x20Order\x20address\x20—\x20Order\x20is\x20the\x20source\x20of\x20disputes','direction':'references'},{'object':'Arb','field':'dispute\x20(spawns\x20Arb)','scene_id':'arbitration_dispute','description':'Each\x20dispute()\x20creates\x20a\x20new\x20Arb\x20case\x20object\x20with\x207-state\x20lifecycle','direction':'references'},{'object':'Guard','field':'voting_guard\x20/\x20usage_guard','scene_id':'arbitration_voting_guard_config\x20/\x20arbitration_usage_guard_config','description':'voting_guard\x20controls\x20vote\x20weight\x20(max\x2050);\x20usage_guard\x20filters\x20who\x20can\x20file\x20disputes','direction':'references'},{'object':'Allocation','field':'fees_transfer.to.allocation','scene_id':'arbitration_fees_transfer','description':'Withdrawn\x20fees\x20can\x20be\x20routed\x20to\x20Allocation\x20for\x20arbiter\x20compensation\x20distribution','direction':'references'},{'object':'Treasury','field':'fees_transfer.to.treasury','scene_id':'arbitration_fees_transfer','description':'Withdrawn\x20fees\x20can\x20be\x20routed\x20to\x20Treasury\x20as\x20alternative\x20destination','direction':'references'},{'object':'Contact','field':'um','scene_id':'arbitration_um_set','description':'um\x20(Contact\x20object)\x20for\x20arbitrator\x20↔\x20disputant\x20communication\x20channel','direction':'references'},{'object':'Payment','field':'fees_transfer.payment_remark\x20/\x20payment_index','scene_id':'arbitration_fees_transfer','description':'fees_transfer\x20creates\x20Payment\x20object\x20with\x20remark\x20+\x20index\x20for\x20audit\x20trail','direction':'references'}],c=[{'object':'Service','field':'arbitrations\x20(MAX_ARBITRATION_COUNT=20)','scene_id':'service_arbitration_config','description':'Service\x20embeds\x20up\x20to\x2020\x20Arbitration\x20references\x20for\x20dispute\x20resolution\x20per\x20service','direction':'referenced_by'}];if(a){const d=a['id'];return[...b,...c]['filter'](e=>e['scene_id']===d||e['scene_id']['includes'](d['split']('_')[0x1]??''));}return[...b,...c];}function buildOnchainConstraints(){return[{'name':'MAX_VOTING_GUARD_COUNT','value':MAX_VOTING_GUARD_COUNT,'description':'Maximum\x20voting_guard\x20entries\x20per\x20Arbitration\x20(Move\x20source:\x20arbitration.move:25)'},{'name':'ARBITRATION_PERMISSION_INDEX_RANGE','value':'350-368\x20(352\x20reserved)','description':'19\x20built-in\x20permission\x20indexes\x20for\x20Arbitration\x20—\x20most\x20among\x20all\x2022\x20objects'},{'name':'ARB_STATE_COUNT','value':0x7,'description':'Arb\x20has\x207-state\x20lifecycle:\x20Principal_confirming\x20→\x20Arbitrator_confirming\x20→\x20Voting\x20→\x20Arbitrated\x20→\x20Objectionable\x20→\x20Finished/Withdrawn'},{'name':'ARB_TERMINAL_STATUSES','value':ARB_TERMINAL_STATUSES['length'],'description':'Terminal\x20statuses:\x20'+ARB_TERMINAL_STATUSES['join'](',\x20')+'\x20(no\x20further\x20transitions)'},{'name':'DUAL_GUARD_COMBINATIONS','value':DUAL_GUARD_MATRIX['length'],'description':'4\x20dual-Guard\x20combos:\x20(voting_guard\x20empty/non-empty)\x20×\x20(usage_guard\x20none/some)'}];}function buildRenderingHints(a,b,c,d){return{'include_puzzle_template':a==='initial_design','include_risk_details':a==='pre_publish'||a==='stakeholder_review','include_questions':a==='pre_publish','include_dual_guard_matrix':a==='initial_design'||a==='pre_publish','include_arb_lifecycle':a==='pre_publish'||a==='post_publish_modify'||a==='stakeholder_review','include_immutability_warning':a==='post_publish_modify','include_indemnity_warning':c,'include_ownership_transfer_warning':d,'max_length':b};}export function buildPromptFromArbitrationContext(a){const b=[],d=a['rendering_hints'];b['push']('═══\x20Arbitration\x20Context\x20(mode:\x20'+a['mode']+')\x20═══'),b['push']('');a['stakeholder_perspective']&&(b['push']('Stakeholder\x20perspective:\x20'+a['stakeholder_perspective']),b['push'](''));a['matched_scene']&&(b['push']('Scene:\x20'+a['matched_scene']['name']),b['push']('Category:\x20'+a['matched_scene']['operation_category']),b['push']('Permission\x20index:\x20'+a['matched_scene']['permission_index']+'\x20('+a['matched_scene']['permission_name']+')'),a['matched_scene']['required_arb_status']&&a['matched_scene']['required_arb_status']['length']>0x0&&b['push']('Required\x20Arb\x20status:\x20'+a['matched_scene']['required_arb_status']['join']('\x20|\x20')),a['matched_scene']['resulting_arb_status']&&b['push']('Resulting\x20Arb\x20status:\x20'+a['matched_scene']['resulting_arb_status']),b['push']('Has\x20_with_passport\x20variant:\x20'+(a['matched_scene']['has_passport_variant']?'YES':'NO')),b['push'](''));a['matched_template']&&(b['push']('Suggested\x20template:\x20'+a['matched_template']['id']+'\x20—\x20'+a['matched_template']['name']),b['push']('Description:\x20'+a['matched_template']['description']),b['push'](''));a['matched_pattern']&&(b['push']('Matched\x20pattern:\x20'+a['matched_pattern']['id']+'\x20—\x20'+a['matched_pattern']['pattern_name']),b['push']('Intent:\x20'+a['matched_pattern']['semantic_intent']),b['push'](''));if(d['include_puzzle_template']&&a['puzzle_completeness']){const e=a['puzzle_completeness'];b['push']('─\x20Puzzle\x20Completeness\x20──────────────'),b['push']('Complete:\x20'+(e['complete']?'YES':'NO')),e['missing']['length']>0x0&&b['push']('Missing\x20dimensions:\x20'+e['missing']['join'](',\x20')),b['push']('Next\x20step:\x20'+e['next_step']),b['push']('');}if(d['include_dual_guard_matrix']&&a['dual_guard_matrix_entry']){const f=a['dual_guard_matrix_entry'];b['push']('─\x20Dual-Guard\x20Matrix\x20Entry\x20──────────────'),b['push']('Voting\x20guard:\x20'+(f['voting_guard_empty']?'EMPTY\x20(open\x20vote)':'NON-EMPTY\x20(weighted)')),b['push']('Usage\x20guard:\x20'+(f['usage_guard_none']?'NONE\x20(open\x20dispute)':'SOME\x20(filtered\x20dispute)')),b['push']('Vote\x20method:\x20'+f['vote_method']),b['push']('Dispute\x20method:\x20'+f['dispute_method']),b['push']('Scenario:\x20'+f['scenario']),b['push']('');}if(d['include_arb_lifecycle']&&a['arb_lifecycle_context']){const g=a['arb_lifecycle_context'];b['push']('─\x20Arb\x207-State\x20Lifecycle\x20Context\x20──────────────');if(g['current_status']){b['push']('Current\x20Arb\x20status:\x20'+g['current_status']+'\x20(code\x20'+g['current_status_code']+')'),b['push']('Terminal:\x20'+(g['is_terminal']?'YES\x20—\x20no\x20further\x20transitions':'NO'));g['valid_next_statuses']['length']>0x0&&b['push']('Valid\x20next\x20statuses:\x20'+g['valid_next_statuses']['join'](',\x20'));if(g['valid_operations_from_here']['length']>0x0){b['push']('Valid\x20operations\x20from\x20here\x20('+g['valid_operations_from_here']['length']+'):');for(const i of g['valid_operations_from_here']['slice'](0x0,0x6)){b['push']('\x20\x20-\x20'+i);}g['valid_operations_from_here']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(g['valid_operations_from_here']['length']-0x6)+'\x20more');}}else b['push']('No\x20current\x20Arb\x20status\x20provided\x20—\x20lifecycle\x20context\x20inactive');b['push']('');}if(d['include_risk_details']&&a['relevant_risks']['length']>0x0){b['push']('─\x20Relevant\x20Risk\x20Rules\x20('+a['relevant_risks']['length']+')\x20──────────────');for(const j of a['relevant_risks']['slice'](0x0,0x6)){b['push']('\x20\x20'+j['id']+'\x20—\x20'+j['trigger']);}a['relevant_risks']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_risks']['length']-0x6)+'\x20more'),b['push']('');}if(a['risk_assessment']){b['push']('─\x20Risk\x20Assessment\x20──────────────'),b['push']('Overall\x20risk:\x20'+a['risk_assessment']['overall_risk']),b['push']('Detected:\x20'+a['risk_assessment']['risks']['length']+'\x20risk(s)');if(a['risk_assessment']['risks']['length']>0x0){for(const k of a['risk_assessment']['risks']['slice'](0x0,0x3)){b['push']('\x20\x20['+k['level']+']\x20'+k['id']+':\x20'+k['title']);}a['risk_assessment']['risks']['length']>0x3&&b['push']('\x20\x20...\x20and\x20'+(a['risk_assessment']['risks']['length']-0x3)+'\x20more');}b['push']('');}if(a['relevant_permissions']['length']>0x0){b['push']('─\x20Relevant\x20Permissions\x20('+a['relevant_permissions']['length']+')\x20──────────────');for(const l of a['relevant_permissions']['slice'](0x0,0xa)){const n=l['is_reserved']?'\x20[RESERVED]':'';b['push']('\x20\x20['+l['index']+']\x20'+l['name']+n+':\x20'+l['description']);}a['relevant_permissions']['length']>0xa&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_permissions']['length']-0xa)+'\x20more'),b['push']('');}if(a['relevant_constraints']['length']>0x0){b['push']('─\x20Relevant\x20Constraint\x20Rules\x20('+a['relevant_constraints']['length']+')\x20──────────────');for(const o of a['relevant_constraints']['slice'](0x0,0x5)){b['push']('\x20\x20'+o['id']+'\x20['+o['category']+']:\x20'+o['rule']);}a['relevant_constraints']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_constraints']['length']-0x5)+'\x20more'),b['push']('');}d['include_indemnity_warning']&&(b['push']('⚠️\x20INDEMNITY\x20OPERATION\x20DETECTED\x20—\x20arbitration.indemnity\x20transfers\x20WOW\x20from\x20arbiter\x20to\x20disputant'),b['push']('\x20\x20\x20This\x20is\x20IRREVERSIBLE\x20once\x20the\x20ruling\x20is\x20finalized.\x20Verify\x20indemnity\x20amount\x20carefully.'),b['push'](''));d['include_ownership_transfer_warning']&&(b['push']('⚠️\x20OWNERSHIP\x20TRANSFER\x20DETECTED\x20—\x20builder\x20field\x20transfers\x20Arbitration\x20ownership'),b['push']('\x20\x20\x20This\x20is\x20IRREVERSIBLE.\x20Original\x20owner\x20will\x20lose\x20all\x20administrative\x20rights.'),b['push'](''));d['include_immutability_warning']&&(b['push']('ℹ️\x20POST-PUBLISH\x20MODIFICATION\x20—\x20Arbitration\x20is\x20already\x20on-chain'),b['push']('\x20\x20\x20Some\x20fields\x20can\x20be\x20modified\x20(description,\x20location,\x20fee,\x20voting_guard,\x20usage_guard)'),b['push']('\x20\x20\x20but\x20core\x20properties\x20(coin_type,\x20permission\x20object)\x20are\x20immutable.'),b['push'](''));if(a['cross_object_refs']['length']>0x0){b['push']('─\x20Cross-Object\x20References\x20('+a['cross_object_refs']['length']+')\x20──────────────');for(const q of a['cross_object_refs']['slice'](0x0,0x6)){const s=q['direction']==='references'?'→':'←';b['push']('\x20\x20'+s+'\x20'+q['object']+'.'+q['field']+'\x20('+q['direction']+')\x20—\x20'+q['description']);}a['cross_object_refs']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(a['cross_object_refs']['length']-0x6)+'\x20more'),b['push']('');}if(a['onchain_constraints']['length']>0x0){b['push']('─\x20On-chain\x20Constraints\x20──────────────');for(const t of a['onchain_constraints']){b['push']('\x20\x20'+t['name']+'\x20=\x20'+t['value']+'\x20—\x20'+t['description']);}b['push']('');}return b['join']('\x0a');}export function getArbitrationContextSummary(a){const b=['mode='+a['mode'],'scene='+(a['matched_scene']?.['id']??'none'),'risks='+a['relevant_risks']['length'],'permissions='+a['relevant_permissions']['length'],'constraints='+a['relevant_constraints']['length']];if(a['stakeholder_perspective'])b['push']('stakeholder='+a['stakeholder_perspective']);if(a['risk_assessment'])b['push']('overall_risk='+a['risk_assessment']['overall_risk']);a['dual_guard_matrix_entry']&&b['push']('dual_guard='+a['dual_guard_matrix_entry']['vote_method']+'+'+a['dual_guard_matrix_entry']['dispute_method']);a['arb_lifecycle_context']?.['current_status']&&b['push']('arb_status='+a['arb_lifecycle_context']['current_status']);if(a['cross_object_refs']['length']>0x0)b['push']('xrefs='+a['cross_object_refs']['length']);return b['join'](',\x20');}export{ARBITRATION_LEDGER_VERSION,ARBITRATION_SCENES,ARBITRATION_PERMISSIONS,DUAL_GUARD_MATRIX,ARB_STATUS_CODE,ARB_TERMINAL_STATUSES,findSceneById,findSceneByPermissionIndex,inferSceneFromIntent,getScenesByCategory,getDualGuardMatrixEntry,isValidArbStatusTransition,isTerminalArbStatus,getActiveArbitrationPermissions,getAllArbitrationPermissions}from'./arbitration-ledger.js';export{ARBITRATION_TEMPLATES_VERSION,ARBITRATION_TEMPLATES,suggestTemplateForScene,getTemplatesByScene,getTemplateById}from'./arbitration-templates.js';export{ARBITRATION_TRANSLATION_VERSION,SEMANTIC_TO_SCHEMA_RULES,ARBITRATION_CONSTRAINT_RULES,matchSemanticPattern,explainArbitrationCallData,explainPermissionIndex,explainArbStatus}from'./arbitration-translation.js';export{ARBITRATION_RISK_VERSION,getAllRiskRules,assessArbitrationRisks}from'./arbitration-risk.js';export{ARBITRATION_CONFIRM_VERSION,ARBITRATION_OPERATION_CHECKLIST,ARBITRATION_CONFIRMATION_QUESTIONS,runArbitrationConfirmGate}from'./arbitration-confirm.js';export{initPuzzleFromIntent,checkPuzzleCompleteness,validateConstraints}from'./arbitration-puzzle.js';
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { type ArbStatus } from "./arbitration-ledger.js";
|
|
2
|
-
export interface SemanticToSchemaRule {
|
|
3
|
-
id: string;
|
|
4
|
-
pattern_name: string;
|
|
5
|
-
semantic_intent: string;
|
|
6
|
-
match_keywords: string[];
|
|
7
|
-
schema_fields: string[];
|
|
8
|
-
example_json: object;
|
|
9
|
-
reverse_explanation: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SchemaToSemanticRule {
|
|
12
|
-
element_type: "field" | "op" | "index" | "status";
|
|
13
|
-
type_name: string;
|
|
14
|
-
semantic_explanation: string;
|
|
15
|
-
constraints?: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface ArbitrationConstraintRule {
|
|
18
|
-
id: string;
|
|
19
|
-
category: "structural" | "semantic" | "authority" | "lifecycle" | "cross_object";
|
|
20
|
-
rule: string;
|
|
21
|
-
applies_to: string[];
|
|
22
|
-
}
|
|
23
|
-
export declare const SEMANTIC_TO_SCHEMA_RULES: SemanticToSchemaRule[];
|
|
24
|
-
export declare const SCHEMA_TO_SEMANTIC_RULES: SchemaToSemanticRule[];
|
|
25
|
-
export declare const ARBITRATION_CONSTRAINT_RULES: ArbitrationConstraintRule[];
|
|
26
|
-
export declare const ARBITRATION_TRANSLATION_VERSION = "1.0.0";
|
|
27
|
-
export declare function matchSemanticPattern(userIntent: string): SemanticToSchemaRule[];
|
|
28
|
-
export declare function explainArbitrationCallData(data: {
|
|
29
|
-
object?: string | null | object;
|
|
30
|
-
description?: string;
|
|
31
|
-
location?: string;
|
|
32
|
-
fee?: string | number;
|
|
33
|
-
pause?: boolean;
|
|
34
|
-
dispute?: {
|
|
35
|
-
order: string;
|
|
36
|
-
description?: string;
|
|
37
|
-
proposition: string[];
|
|
38
|
-
fee?: unknown;
|
|
39
|
-
namedArb?: unknown;
|
|
40
|
-
};
|
|
41
|
-
confirm?: {
|
|
42
|
-
arb: string;
|
|
43
|
-
voting_deadline: number | null;
|
|
44
|
-
};
|
|
45
|
-
voting_deadline_change?: {
|
|
46
|
-
arb: string;
|
|
47
|
-
voting_deadline: number | null;
|
|
48
|
-
};
|
|
49
|
-
vote?: {
|
|
50
|
-
arb: string;
|
|
51
|
-
votes: number[];
|
|
52
|
-
voting_guard?: string;
|
|
53
|
-
};
|
|
54
|
-
feedback?: {
|
|
55
|
-
arb: string;
|
|
56
|
-
feedback: string;
|
|
57
|
-
};
|
|
58
|
-
arbitration?: {
|
|
59
|
-
arb: string;
|
|
60
|
-
feedback: string;
|
|
61
|
-
indemnity: number;
|
|
62
|
-
};
|
|
63
|
-
reset?: {
|
|
64
|
-
arb: string;
|
|
65
|
-
feedback: string;
|
|
66
|
-
};
|
|
67
|
-
arb_withdraw?: {
|
|
68
|
-
arb: string;
|
|
69
|
-
};
|
|
70
|
-
fees_transfer?: {
|
|
71
|
-
to: {
|
|
72
|
-
allocation?: string;
|
|
73
|
-
treasury?: string;
|
|
74
|
-
};
|
|
75
|
-
payment_remark: string;
|
|
76
|
-
payment_index: number;
|
|
77
|
-
};
|
|
78
|
-
usage_guard?: string | null;
|
|
79
|
-
voting_guard?: {
|
|
80
|
-
op: string;
|
|
81
|
-
guards?: unknown[];
|
|
82
|
-
};
|
|
83
|
-
um?: string | null;
|
|
84
|
-
builder?: string;
|
|
85
|
-
}): string;
|
|
86
|
-
export declare function explainField(fieldName: string): SchemaToSemanticRule | undefined;
|
|
87
|
-
export declare function explainOp(opName: string): SchemaToSemanticRule | undefined;
|
|
88
|
-
export declare function explainStatus(statusName: string): SchemaToSemanticRule | undefined;
|
|
89
|
-
export declare function getConstraintsByCategory(category: ArbitrationConstraintRule["category"]): ArbitrationConstraintRule[];
|
|
90
|
-
export declare function explainPermissionIndex(index: number): string;
|
|
91
|
-
export declare function explainArbStatus(status: ArbStatus): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getPermissionByIndex,findSceneByPermissionIndex}from'./arbitration-ledger.js';export const SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-AB-01','pattern_name':'Create\x20new\x20Arbitration','semantic_intent':'Create\x20a\x20new\x20Arbitration\x20service\x20for\x20a\x20given\x20Coin\x20type','match_keywords':['create','new'],'schema_fields':['object({name,\x20type_parameter,\x20permission})','description'],'example_json':{'object':{'name':'ecommerce_arb','type_parameter':'0x2::wow::WOW','permission':{'name':'arb_permission'}},'description':'E-commerce\x20dispute\x20arbitration'},'reverse_explanation':'object={name,\x20type_parameter,\x20permission}\x20creates\x20a\x20new\x20Arbitration;\x20bPaused\x20defaults\x20to\x20true'},{'id':'P-AB-02','pattern_name':'Configure\x20Arbitration\x20(description/location/fee/pause)','semantic_intent':'Set\x20description,\x20location,\x20dispute\x20fee,\x20or\x20pause/resume','match_keywords':['configure','set','pause','resume','enable'],'schema_fields':['object','description','location','fee','pause'],'example_json':{'object':'ecommerce_arb','location':'Shanghai','fee':'1000000000','pause':![]},'reverse_explanation':'Each\x20field\x20maps\x20to\x20a\x20separate\x20permission\x20index:\x20location(353),\x20fee(357),\x20pause(356)'},{'id':'P-AB-03','pattern_name':'File\x20dispute\x20(create\x20Arb\x20case)','semantic_intent':'File\x20a\x20dispute\x20against\x20an\x20Order\x20—\x20creates\x20a\x20new\x20Arb\x20case','match_keywords':['dispute','file','complaint','initiate'],'schema_fields':['object','dispute({order,\x20description,\x20proposition,\x20fee,\x20namedArb?})'],'example_json':{'object':'ecommerce_arb','dispute':{'order':'order_123','description':'Goods\x20not\x20delivered','proposition':['Seller\x20ships','Seller\x20refunds'],'fee':{'type':'0x2::wow::WOW','balance':'1000000000'},'namedArb':'arb_case_123'}},'reverse_explanation':'dispute\x20creates\x20an\x20independent\x20Arb<T>\x20object;\x20fee\x20must\x20be\x20>=\x20Arbitration.fee\x20(E_FEE_NOT_ENOUGH)'},{'id':'P-AB-04','pattern_name':'Confirm\x20materials\x20(start\x20voting)','semantic_intent':'Confirm\x20principal\x27s\x20submitted\x20materials\x20and\x20start\x20the\x20voting\x20phase','match_keywords':['confirm','materials','start\x20voting'],'schema_fields':['object','confirm({arb,\x20voting_deadline})'],'example_json':{'object':'ecommerce_arb','confirm':{'arb':'arb_case_123','voting_deadline':0x19f80890050}},'reverse_explanation':'Transitions\x20Arb:\x20Principal_confirming\x20→\x20Voting;\x20voting_deadline=null\x20means\x20no\x20deadline'},{'id':'P-AB-05','pattern_name':'Open\x20vote\x20(no\x20voting_guard)','semantic_intent':'Vote\x20on\x20Arb\x20propositions\x20(1\x20person\x201\x20vote,\x20no\x20voting_guard\x20configured)','match_keywords':['vote','open\x20vote','decide'],'schema_fields':['object','vote({arb,\x20votes})'],'example_json':{'object':'ecommerce_arb','vote':{'arb':'arb_case_123','votes':[0x0]}},'reverse_explanation':'vote()\x20requires\x20voting_guard\x20empty\x20(else\x20E_VOTING_GUARD_USED);\x20votes\x20is\x20u8\x20array\x20(proposition\x20indexes)'},{'id':'P-AB-06','pattern_name':'Weighted\x20vote\x20(with\x20voting_guard)','semantic_intent':'Vote\x20using\x20a\x20specific\x20voting_guard\x20for\x20weighted\x20voting','match_keywords':['weighted\x20vote','voting_guard\x20vote'],'schema_fields':['object','vote({arb,\x20votes,\x20voting_guard})'],'example_json':{'object':'ecommerce_arb','vote':{'arb':'arb_case_123','votes':[0x1],'voting_guard':'token_guard'}},'reverse_explanation':'voting_guard\x20must\x20be\x20in\x20Arbitration.voting_guard\x20list\x20(else\x20E_VOTING_GUARD_NOT_FOUND)'},{'id':'P-AB-07','pattern_name':'Make\x20definitive\x20ruling\x20(arbitration)','semantic_intent':'Make\x20a\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity\x20compensation','match_keywords':['ruling','arbitrate','verdict'],'schema_fields':['object','arbitration({arb,\x20feedback,\x20indemnity})'],'example_json':{'object':'ecommerce_arb','arbitration':{'arb':'arb_case_123','feedback':'Buyer\x20wins','indemnity':0xba43b7400}},'reverse_explanation':'Arb\x20transitions\x20to\x20Arbitrated;\x20indemnity\x20paid\x20via\x20order::compensate\x20(public(package)\x20—\x20order-only)'},{'id':'P-AB-08','pattern_name':'Reset\x20arbitration','semantic_intent':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','match_keywords':['reset','restart','resubmit'],'schema_fields':['object','reset({arb,\x20feedback})'],'example_json':{'object':'ecommerce_arb','reset':{'arb':'arb_case_123','feedback':'Principal\x20objects\x20to\x20ruling,\x20resubmitting\x20evidence'}},'reverse_explanation':'Arb\x20transitions\x20from\x20Objectionable/Arbitrated\x20→\x20Principal_confirming;\x20restarts\x20full\x20lifecycle'},{'id':'P-AB-09','pattern_name':'Configure\x20voting_guard','semantic_intent':'Add\x20/\x20set\x20/\x20remove\x20/\x20clear\x20voting_guard\x20entries\x20(controls\x20vote\x20weight)','match_keywords':['voting_guard','voting\x20guard','weight'],'schema_fields':['object','voting_guard({op,\x20guards})'],'example_json':{'object':'ecommerce_arb','voting_guard':{'op':'add','guards':[{'guard':'token_guard','vote_weight':{'FixedValue':0x64}}]}},'reverse_explanation':'op=\x27set\x27=clear+add;\x20\x27add\x27=append;\x20\x27remove\x27=by\x20address;\x20\x27clear\x27=empty\x20all.\x20Max\x2050\x20guards'},{'id':'P-AB-10','pattern_name':'Allocate\x20fees\x20(fees_alloc\x20/\x20fees_transfer)','semantic_intent':'Distribute\x20arbitration\x20fee\x20balance\x20to\x20Allocation\x20or\x20Treasury','match_keywords':['fees_alloc','fees_transfer','allocate','allocate\x20fees'],'schema_fields':['object','fees_transfer({to,\x20payment_remark,\x20payment_index,\x20newPayment?})'],'example_json':{'object':'ecommerce_arb','fees_transfer':{'to':{'allocation':'arb_alloc'},'payment_remark':'arbitration_fee_split','payment_index':0x0}},'reverse_explanation':'to.allocation\x20triggers\x20fees_alloc\x20(365);\x20to.treasury\x20triggers\x20fees_transfer\x20(366).\x20Withdraws\x20ALL\x20balance.'}];export const SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Arbitration\x20object.\x20STRING=operate\x20existing;\x20OBJECT({name,type_parameter,permission})=create\x20new'},{'element_type':'field','type_name':'dispute','semantic_explanation':'File\x20a\x20new\x20dispute\x20—\x20creates\x20Arb<T>\x20case.\x20Requires\x20Order\x20op\x20permission;\x20fee\x20must\x20be\x20>=\x20Arbitration.fee'},{'element_type':'field','type_name':'confirm','semantic_explanation':'Confirm\x20materials\x20→\x20start\x20voting.\x20Transitions\x20Arb\x20to\x20Voting\x20status.\x20voting_deadline=null\x20for\x20no\x20deadline'},{'element_type':'field','type_name':'vote','semantic_explanation':'Vote\x20on\x20propositions.\x20votes=u8[]\x20(proposition\x20indexes).\x20voting_guard\x20optional\x20for\x20weighted\x20voting'},{'element_type':'field','type_name':'arbitration','semantic_explanation':'Make\x20definitive\x20ruling\x20with\x20indemnity.\x20Transitions\x20Arb\x20to\x20Arbitrated.\x20indemnity\x20paid\x20via\x20order::compensate'},{'element_type':'field','type_name':'feedback','semantic_explanation':'Provide\x20feedback\x20on\x20Arb.\x20Informational\x20only\x20—\x20does\x20NOT\x20change\x20Arb\x20status'},{'element_type':'field','type_name':'reset','semantic_explanation':'Reset\x20Arb\x20to\x20Principal_confirming.\x20Requires\x20feedback\x20explaining\x20reset\x20reason.\x20Restarts\x20lifecycle'},{'element_type':'field','type_name':'arb_withdraw','semantic_explanation':'Withdraw\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance.\x20Only\x20allowed\x20in\x20terminal\x20status\x20(Finished/Withdrawn)'},{'element_type':'field','type_name':'fees_transfer','semantic_explanation':'Distribute\x20ALL\x20Arbitration.balance\x20to\x20Allocation\x20(365)\x20or\x20Treasury\x20(366).\x20Creates\x20Payment\x20record'},{'element_type':'field','type_name':'voting_guard','semantic_explanation':'voting_guard\x20list\x20management.\x20op=\x27add\x27|\x27set\x27|\x27remove\x27|\x27clear\x27.\x20vote_weight:\x20GuardIdentifier(u8)\x20|\x20FixedValue(u32)'},{'element_type':'field','type_name':'usage_guard','semantic_explanation':'Set/clear\x20usage_guard\x20(Option<address>).\x20STRING=set\x20guard;\x20null=clear.\x20When\x20set,\x20dispute\x20must\x20use\x20_with_passport'},{'element_type':'field','type_name':'pause','semantic_explanation':'Pause/resume.\x20bPaused=true\x20blocks\x20dispute\x20(E_PAUSED).\x20New\x20Arbitration\x20defaults\x20to\x20paused=true'},{'element_type':'field','type_name':'fee','semantic_explanation':'Set\x20dispute\x20application\x20fee\x20(u64).\x20dispute\x20requires\x20coin\x20value\x20>=\x20this\x20fee'},{'element_type':'field','type_name':'um','semantic_explanation':'User\x20Manager\x20(Contact\x20object\x20address).\x20um=null\x20revokes.\x20UM\x20≠\x20admin\x20—\x20for\x20contact\x20management\x20only'},{'element_type':'op','type_name':'add','semantic_explanation':'voting_guard:\x20append\x20guards\x20to\x20existing\x20list\x20(dedup\x20by\x20address;\x20updates\x20vote_weight\x20if\x20exists)'},{'element_type':'op','type_name':'set','semantic_explanation':'voting_guard:\x20clear\x20then\x20add\x20—\x20replaces\x20entire\x20list'},{'element_type':'op','type_name':'remove','semantic_explanation':'voting_guard:\x20remove\x20by\x20address\x20(guards\x20is\x20string[]\x20of\x20addresses)'},{'element_type':'op','type_name':'clear','semantic_explanation':'voting_guard:\x20empty\x20the\x20entire\x20list'},{'element_type':'status','type_name':'Principal_confirming','semantic_explanation':'Arb\x20state\x200:\x20created,\x20principal\x20submitting\x20materials\x20(after\x20dispute\x20or\x20reset)'},{'element_type':'status','type_name':'Arbitrator_confirming','semantic_explanation':'Arb\x20state\x201:\x20arbitrator\x20reviewing/confirming\x20materials'},{'element_type':'status','type_name':'Voting','semantic_explanation':'Arb\x20state\x202:\x20voting\x20in\x20progress\x20(after\x20confirm).\x20vote/voting_deadline_change\x20allowed'},{'element_type':'status','type_name':'Arbitrated','semantic_explanation':'Arb\x20state\x203:\x20ruling\x20made\x20(after\x20arbitration\x20op).\x20Can\x20transition\x20to\x20Objectionable\x20or\x20Finished'},{'element_type':'status','type_name':'Objectionable','semantic_explanation':'Arb\x20state\x204:\x20objection\x20window\x20—\x20reset\x20allowed\x20to\x20restart\x20lifecycle'},{'element_type':'status','type_name':'Finished','semantic_explanation':'Arb\x20state\x205:\x20terminal\x20—\x20case\x20closed.\x20arb_withdraw\x20allowed'},{'element_type':'status','type_name':'Withdrawn','semantic_explanation':'Arb\x20state\x206:\x20terminal\x20—\x20fees\x20withdrawn.\x20No\x20further\x20operations\x20allowed'}];export const ARBITRATION_CONSTRAINT_RULES=[{'id':'MC-AB-01','category':'structural','rule':'voting_guard\x20count\x20<=\x20MAX_VOTING_GUARD_COUNT\x20(50)','applies_to':['voting_guard.guards']},{'id':'MC-AB-02','category':'structural','rule':'Arbitration\x20is\x20generic\x20<phantom\x20T>;\x20T\x20must\x20be\x20a\x20valid\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)','applies_to':['object.type_parameter']},{'id':'MC-AB-03','category':'structural','rule':'fee\x20(u64)\x20must\x20be\x20>=\x200;\x20dispute\x20requires\x20coin::value(&fee)\x20>=\x20Arbitration.fee','applies_to':['fee','dispute.fee']},{'id':'MC-AB-04','category':'structural','rule':'bPaused\x20defaults\x20to\x20true\x20on\x20creation\x20—\x20must\x20call\x20pause(false)\x20to\x20enable\x20dispute','applies_to':['pause']},{'id':'MC-AB-05','category':'semantic','rule':'VoteValue.GuardIdentifier\x20is\x20u8\x20(0-255);\x20FixedValue\x20is\x20u32\x20(0-4294967295)','applies_to':['voting_guard.guards.vote_weight']},{'id':'MC-AB-06','category':'semantic','rule':'votes\x20array\x20is\x20u8[]\x20—\x20indexes\x20into\x20proposition\x20list\x20(0..N-1)','applies_to':['vote.votes']},{'id':'MC-AB-07','category':'semantic','rule':'When\x20voting_guard\x20is\x20non-empty,\x20vote\x20MUST\x20use\x20vote_with_voting_guard\x20(else\x20E_VOTING_GUARD_USED)','applies_to':['vote']},{'id':'MC-AB-08','category':'semantic','rule':'When\x20usage_guard\x20is\x20Some,\x20dispute\x20MUST\x20use\x20_with_passport\x20variant\x20(else\x20E_NEED_PASSPORT)','applies_to':['dispute']},{'id':'MC-AB-09','category':'authority','rule':'Each\x20operation\x20has\x20dual-path\x20API:\x20xxx()\x20(sender\x20check)\x20and\x20xxx_with_passport()\x20(Passport\x20check)','applies_to':['all\x20operations']},{'id':'MC-AB-10','category':'authority','rule':'19\x20permission\x20indexes\x20(350-368);\x20352\x20is\x20reserved\x20placeholder\x20(ARBITRATION_ENDPOINT,\x20commented\x20out)','applies_to':['permission\x20table']},{'id':'MC-AB-11','category':'lifecycle','rule':'Arb\x207-state\x20flow:\x20Principal_confirming\x20→\x20Arbitrator_confirming\x20→\x20Voting\x20→\x20Arbitrated\x20→\x20Objectionable\x20→\x20Finished/Withdrawn.\x20reset\x20restarts\x20to\x20Principal_confirming','applies_to':['confirm','vote','arbitration','reset','arb_withdraw']},{'id':'MC-AB-12','category':'lifecycle','rule':'Terminal\x20states\x20(Finished,\x20Withdrawn)\x20only\x20allow\x20arb_withdraw;\x20no\x20vote/confirm/arbitration/reset/feedback','applies_to':['vote','confirm','arbitration','reset','feedback','arb_withdraw']},{'id':'MC-AB-13','category':'cross_object','rule':'dispute\x20requires\x20order::assert_op_permission\x20—\x20signer\x20must\x20have\x20Order\x27s\x20dispute\x20operation\x20permission','applies_to':['dispute']},{'id':'MC-AB-14','category':'cross_object','rule':'compensate\x20is\x20public(package)\x20—\x20only\x20order.move\x20can\x20call\x20it;\x20external\x20code\x20cannot\x20trigger\x20compensation\x20directly','applies_to':['arbitration\x20(indemnity\x20payment)']}];export const ARBITRATION_TRANSLATION_VERSION='1.0.0';export function matchSemanticPattern(a){const b=a['toLowerCase']();return SEMANTIC_TO_SCHEMA_RULES['filter'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainArbitrationCallData(b){const e=[];if(b['object']===null||b['object']===undefined)e['push']('Operation:\x20INVALID\x20—\x20object\x20is\x20required');else{if(typeof b['object']==='object'){const g=b['object'];e['push']('Operation:\x20CREATE\x20new\x20Arbitration\x20\x27'+(g['name']??'?')+'\x27\x20(T='+(g['type_parameter']??'?')+')');}else e['push']('Operation:\x20OPERATE\x20existing\x20Arbitration\x20at\x20'+b['object']);}if(b['description'])e['push']('-\x20Set\x20description:\x20\x22'+b['description']+'\x22');if(b['location'])e['push']('-\x20Set\x20location:\x20'+b['location']);if(b['fee']!==undefined)e['push']('-\x20Set\x20fee:\x20'+b['fee']);if(b['pause']!==undefined)e['push']('-\x20'+(b['pause']?'Pause':'Resume\x20(enable\x20disputes)'));if(b['dispute']){const h=b['dispute'];e['push']('-\x20File\x20DISPUTE\x20against\x20Order\x20'+h['order']);if(h['description'])e['push']('\x20\x20Description:\x20\x22'+h['description']+'\x22');e['push']('\x20\x20Propositions\x20('+h['proposition']['length']+'):\x20'+h['proposition']['join']('\x20|\x20'));}if(b['confirm']){const i=b['confirm'],j=i['voting_deadline']===null?'no\x20deadline':'deadline='+i['voting_deadline'];e['push']('-\x20CONFIRM\x20materials\x20on\x20Arb\x20'+i['arb']+'\x20('+j+')\x20—\x20starts\x20voting');}if(b['voting_deadline_change']){const k=b['voting_deadline_change'],l=k['voting_deadline']===null?'no\x20deadline':'deadline='+k['voting_deadline'];e['push']('-\x20Change\x20voting_deadline\x20on\x20Arb\x20'+k['arb']+':\x20'+l);}if(b['vote']){const m=b['vote'],n=m['voting_guard']?'weighted\x20(guard='+m['voting_guard']+')':'open\x20(1\x20person\x201\x20vote)';e['push']('-\x20VOTE\x20on\x20Arb\x20'+m['arb']+'\x20—\x20'+n),e['push']('\x20\x20Votes:\x20['+m['votes']['join'](',\x20')+']\x20(proposition\x20indexes)');}b['feedback']&&e['push']('-\x20FEEDBACK\x20on\x20Arb\x20'+b['feedback']['arb']+':\x20\x22'+b['feedback']['feedback']+'\x22');if(b['arbitration']){const o=b['arbitration'];e['push']('-\x20⚖️\x20RULING\x20on\x20Arb\x20'+o['arb']+':\x20\x22'+o['feedback']+'\x22'),e['push']('\x20\x20Indemnity:\x20'+o['indemnity']+'\x20(paid\x20via\x20order::compensate)');}b['reset']&&e['push']('-\x20↻\x20RESET\x20Arb\x20'+b['reset']['arb']+':\x20\x22'+b['reset']['feedback']+'\x22\x20—\x20restart\x20lifecycle');b['arb_withdraw']&&e['push']('-\x20WITHDRAW\x20fees\x20from\x20Arb\x20'+b['arb_withdraw']['arb']+'\x20→\x20Arbitration.balance');if(b['fees_transfer']){const p=b['fees_transfer'],q=p['to']['allocation']?'Allocation\x20'+p['to']['allocation']:'Treasury\x20'+p['to']['treasury'];e['push']('-\x20💰\x20ALLOCATE\x20fees\x20→\x20'+q),e['push']('\x20\x20Remark:\x20\x22'+p['payment_remark']+'\x22,\x20index:\x20'+p['payment_index']);}b['usage_guard']!==undefined&&e['push'](b['usage_guard']===null?'-\x20usage_guard:\x20CLEAR\x20(dispute\x20no\x20longer\x20requires\x20passport)':'-\x20usage_guard:\x20SET\x20to\x20'+b['usage_guard']+'\x20(dispute\x20requires\x20_with_passport)');if(b['voting_guard']){const r=b['voting_guard'],s=Array['isArray'](r['guards'])?r['guards']['length']:0x0;e['push']('-\x20voting_guard\x20'+r['op']+(r['op']!=='clear'?'\x20('+s+'\x20guard(s))':''));}return b['um']!==undefined&&e['push'](b['um']===null?'-\x20UM:\x20revoke':'-\x20UM:\x20set\x20to\x20'+b['um']),b['builder']&&e['push']('-\x20⚠️\x20TRANSFER\x20ownership\x20to\x20'+b['builder']+'\x20(IRREVERSIBLE)'),e['join']('\x0a');}export function explainField(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='field'&&b['type_name']===a);}export function explainOp(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='op'&&b['type_name']===a);}export function explainStatus(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='status'&&b['type_name']===a);}export function getConstraintsByCategory(a){return ARBITRATION_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainPermissionIndex(a){const b=getPermissionByIndex(a),c=findSceneByPermissionIndex(a);if(b?.['is_reserved'])return b['name']+'\x20('+a+')\x20—\x20RESERVED\x20placeholder,\x20not\x20used\x20on-chain';if(b)return b['name']+'\x20('+a+')\x20—\x20'+b['description']+'\x20[scene:\x20'+(c?.['id']??'unknown')+']';return'Unknown\x20permission\x20index\x20('+a+')\x20—\x20not\x20in\x20ARBITRATION_*\x20range\x20(350-368)';}export function explainArbStatus(a){const b=explainStatus(a);return b?a+':\x20'+b['semantic_explanation']:a+':\x20unknown\x20status';}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const BRIDGE_CONFIRM_VERSION = "1.0.0";
|
|
2
|
-
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
-
export interface BridgeConfirmItem {
|
|
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 BridgeOpCheckInput {
|
|
13
|
-
is_non_mainnet?: boolean;
|
|
14
|
-
unsupported_token?: string;
|
|
15
|
-
idempotency_key_length?: number;
|
|
16
|
-
is_paused?: boolean;
|
|
17
|
-
versioned_upgrade_in_progress?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare function preCheckBridgeOp(input: BridgeOpCheckInput): BridgeConfirmItem[];
|
|
20
|
-
export declare function canProceedBridgeOp(input: BridgeOpCheckInput): {
|
|
21
|
-
canProceed: boolean;
|
|
22
|
-
blockers: BridgeConfirmItem[];
|
|
23
|
-
warnings: BridgeConfirmItem[];
|
|
24
|
-
info: BridgeConfirmItem[];
|
|
25
|
-
};
|
|
26
|
-
export declare function formatBridgeOpSummary(input: BridgeOpCheckInput): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BRIDGE_CURRENT_VERSION,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH}from'@wowok/wowok';export const BRIDGE_CONFIRM_VERSION='1.0.0';const SUPPORTED_TOKENS=['ETH','WETH','WBTC','USDC','USDT'],MAX_IDEMPOTENCY_KEY_LENGTH=0x80;function checkEnvironment(a){if(!a['is_non_mainnet'])return{'id':'C-BRIDGE-01','severity':'info','title':'Bridge\x20is\x20mainnet-only','description':'Cross-chain\x20ops\x20abort\x20with\x20EBridgeUnavailable\x20(8)\x20on\x20testnet.','passed':!![],'evidence':'mainnet\x20assumed'};return{'id':'C-BRIDGE-01','severity':'block','title':'Non-mainnet\x20environment\x20—\x20Bridge\x20unavailable','description':'The\x20Bridge\x20role\x20is\x20only\x20configured\x20on\x20mainnet;\x20testnet\x20ops\x20abort\x20with\x20EBridgeUnavailable\x20(8).','passed':![],'evidence':'is_non_mainnet=true','fix_hint':'Run\x20Bridge\x20ops\x20on\x20mainnet\x20only.'};}function checkToken(a){if(!a['unsupported_token'])return{'id':'C-BRIDGE-02','severity':'info','title':'Token\x20is\x20supported\x20('+SUPPORTED_TOKENS['join'](',\x20')+')','description':'Bridge\x20supports\x20exactly\x20'+SUPPORTED_TOKENS['length']+'\x20tokens.','passed':!![],'evidence':'token\x20supported'};return{'id':'C-BRIDGE-02','severity':'block','title':'Unsupported\x20token\x20—\x20aborts\x20with\x20EUnexpectedTokenType\x20(3)','description':'Bridge\x20supports\x20only\x20'+SUPPORTED_TOKENS['join'](',\x20')+'.','passed':![],'evidence':'unsupported_token='+a['unsupported_token'],'fix_hint':'Filter\x20the\x20token\x20picker\x20to\x20supported\x20tokens;\x20use\x20an\x20alternative\x20bridge\x20for\x20others.'};}function checkIdempotency(a){if(a['idempotency_key_length']===undefined)return{'id':'C-BRIDGE-03','severity':'info','title':'idempotency\x20key\x20≤\x20'+MAX_IDEMPOTENCY_KEY_LENGTH+'\x20chars','description':'BridgeIdempotencyKeySchema\x20accepts\x201-128\x20chars.','passed':!![],'evidence':'not\x20provided'};const b=a['idempotency_key_length']>0x0&&a['idempotency_key_length']<=MAX_IDEMPOTENCY_KEY_LENGTH;return{'id':'C-BRIDGE-03','severity':b?'info':'block','title':'idempotency\x20key\x20≤\x20'+MAX_IDEMPOTENCY_KEY_LENGTH+'\x20chars','description':'Keys\x20longer\x20than\x20'+MAX_IDEMPOTENCY_KEY_LENGTH+'\x20chars\x20are\x20rejected.','passed':b,'evidence':'idempotency_key_length='+a['idempotency_key_length']+',\x20limit='+MAX_IDEMPOTENCY_KEY_LENGTH,'fix_hint':'Generate\x20the\x20key\x20from\x20a\x20hash\x20(66\x20hex)\x20or\x20UUID\x20(36\x20chars).'};}function checkPaused(a){if(!a['is_paused'])return{'id':'C-BRIDGE-04','severity':'info','title':'Bridge\x20is\x20not\x20paused','description':'While\x20paused,\x20no\x20cross-chain\x20ops\x20proceed.','passed':!![],'evidence':'not\x20paused'};return{'id':'C-BRIDGE-04','severity':'warn','title':'Bridge\x20is\x20paused\x20—\x20assets\x20lock\x20during\x20pause','description':'EmergencyOp\x20can\x20pause\x20the\x20Bridge;\x20in-flight\x20claims\x20and\x20new\x20transfers\x20are\x20blocked.','passed':![],'evidence':'is_paused=true','fix_hint':'Surface\x20pause\x20state\x20to\x20users\x20and\x20set\x20recovery\x20expectations.'};}function checkVersion(a){if(!a['versioned_upgrade_in_progress'])return{'id':'C-BRIDGE-05','severity':'info','title':'Versioned\x20upgrade\x20(current='+BRIDGE_CURRENT_VERSION+')','description':'Bridge\x20uses\x20Versioned<BridgeInner>;\x20message_version='+BRIDGE_MESSAGE_VERSION+',\x20EVM\x20address\x20length='+BRIDGE_EVM_ADDRESS_LENGTH+'\x20bytes.','passed':!![],'evidence':'no\x20upgrade\x20in\x20progress'};return{'id':'C-BRIDGE-05','severity':'warn','title':'Versioned\x20upgrade\x20in\x20progress\x20—\x20mishandling\x20can\x20brick\x20the\x20Bridge','description':'A\x20botched\x20BridgeInner\x20migration\x20can\x20lock\x20funds\x20in\x20flight\x20and\x20require\x20a\x20new\x20package\x20version.','passed':![],'evidence':'versioned_upgrade_in_progress=true','fix_hint':'Test\x20on\x20a\x20fork,\x20keep\x20a\x20rollback\x20version,\x20and\x20stage\x20a\x20pause\x20window.'};}export function preCheckBridgeOp(a){return[checkEnvironment(a),checkToken(a),checkIdempotency(a),checkPaused(a),checkVersion(a)];}export function canProceedBridgeOp(a){const b=preCheckBridgeOp(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 formatBridgeOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedBridgeOp(a),e=[b?'✓\x20Bridge\x20operation\x20pre-check\x20PASSED':'✗\x20Bridge\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');}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const BRIDGE_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
-
export interface SemanticToBridgeSchemaRule {
|
|
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_BRIDGE_SCHEMA_RULES: SemanticToBridgeSchemaRule[];
|
|
12
|
-
export interface BridgeFieldTranslation {
|
|
13
|
-
field_name: string;
|
|
14
|
-
value_type: string;
|
|
15
|
-
semantic: string;
|
|
16
|
-
format_example: string;
|
|
17
|
-
validation_rules: string[];
|
|
18
|
-
}
|
|
19
|
-
export declare const BRIDGE_FIELD_TRANSLATIONS: BridgeFieldTranslation[];
|
|
20
|
-
export interface BridgeConstraintRule {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
related_field: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const BRIDGE_CONSTRAINT_RULES: BridgeConstraintRule[];
|
|
27
|
-
export interface BridgeExplainInput {
|
|
28
|
-
token?: string;
|
|
29
|
-
amount?: string | number;
|
|
30
|
-
is_non_mainnet?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface BridgeExplanation {
|
|
33
|
-
summary: string;
|
|
34
|
-
token_status: string;
|
|
35
|
-
warnings: string[];
|
|
36
|
-
}
|
|
37
|
-
export declare function explainBridge(input: BridgeExplainInput): BridgeExplanation;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{BRIDGE_CURRENT_VERSION,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH}from'@wowok/wowok';export const BRIDGE_TRANSLATION_VERSION='1.0.0';export const SEMANTIC_TO_BRIDGE_SCHEMA_RULES=[{'id':'P-BRIDGE-01','pattern_name':'WoW\x20→\x20EVM\x20transfer','semantic_intent':'Transfer\x20an\x20asset\x20from\x20WoW\x20to\x20an\x20EVM\x20chain.','match_keywords':['wow\x20to\x20evm','bridge\x20out','cross\x20chain'],'required_fields':['token','amount','target_evm_address'],'optional_fields':['idempotency_key'],'example':{'token':'USDC','amount':'100000000','target_evm_address':'0x...'}},{'id':'P-BRIDGE-02','pattern_name':'EVM\x20→\x20WoW\x20claim','semantic_intent':'Claim\x20an\x20asset\x20bridged\x20from\x20EVM\x20to\x20WoW.','match_keywords':['evm\x20to\x20wow','claim','bridge\x20in'],'required_fields':['token','amount'],'optional_fields':['idempotency_key'],'example':{'token':'USDC','amount':'100000000'}}];export const BRIDGE_FIELD_TRANSLATIONS=[{'field_name':'message_version','value_type':'u64','semantic':'Current\x20message\x20schema\x20version\x20('+BRIDGE_MESSAGE_VERSION+').','format_example':''+BRIDGE_MESSAGE_VERSION,'validation_rules':['must\x20match\x20current\x20version']},{'field_name':'evm_address_length','value_type':'u64','semantic':'EVM\x20address\x20byte\x20length\x20('+BRIDGE_EVM_ADDRESS_LENGTH+').','format_example':''+BRIDGE_EVM_ADDRESS_LENGTH,'validation_rules':['fixed']},{'field_name':'token','value_type':'token\x20type','semantic':'Supported\x20token:\x20ETH/WETH/WBTC/USDC/USDT.','format_example':'USDC','validation_rules':['EUnexpectedTokenType\x20(3)\x20for\x20others']},{'field_name':'idempotency_key','value_type':'string','semantic':'Deduplication\x20key\x20(1-128\x20chars).','format_example':'keccak256-hex','validation_rules':['≤\x20128\x20chars']}];export const BRIDGE_CONSTRAINT_RULES=[{'id':'BRIDGE_C_01','name':'mainnet\x20only','description':'Bridge\x20unavailable\x20on\x20non-mainnet\x20(EBridgeUnavailable\x208).','related_field':'message_version'},{'id':'BRIDGE_C_02','name':'supported\x20tokens','description':'only\x20ETH/WETH/WBTC/USDC/USDT.','related_field':'token'},{'id':'BRIDGE_C_03','name':'idempotency\x20length','description':'key\x20≤\x20128\x20chars.','related_field':'idempotency_key'},{'id':'BRIDGE_C_04','name':'version','description':'current='+BRIDGE_CURRENT_VERSION+';\x20message_version='+BRIDGE_MESSAGE_VERSION+'.','related_field':'message_version'}];const SUPPORTED_TOKENS=['ETH','WETH','WBTC','USDC','USDT'];export function explainBridge(a){const b=[],c=a['token']??'unknown',d=SUPPORTED_TOKENS['includes'](c);if(!d)b['push']('token\x20'+c+'\x20unsupported\x20(supported:\x20'+SUPPORTED_TOKENS['join'](',')+')');if(a['is_non_mainnet'])b['push']('Bridge\x20is\x20mainnet-only');return{'summary':'Bridge\x20'+c+'\x20'+(a['amount']??'?')+'.\x20'+(d?'token\x20supported':'token\x20unsupported')+'.','token_status':d?'supported':'unsupported','warnings':b};}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const CONTACT_CONFIRM_VERSION = "1.0.0";
|
|
2
|
-
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
-
export interface ContactConfirmItem {
|
|
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 ContactOpCheckInput {
|
|
13
|
-
description?: string;
|
|
14
|
-
location?: string;
|
|
15
|
-
im_count?: number;
|
|
16
|
-
change_status_from_non_member?: boolean;
|
|
17
|
-
bound_to_permission_um?: boolean;
|
|
18
|
-
is_destroy?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare function preCheckContactOp(input: ContactOpCheckInput): ContactConfirmItem[];
|
|
21
|
-
export declare function canProceedContactOp(input: ContactOpCheckInput): {
|
|
22
|
-
canProceed: boolean;
|
|
23
|
-
blockers: ContactConfirmItem[];
|
|
24
|
-
warnings: ContactConfirmItem[];
|
|
25
|
-
info: ContactConfirmItem[];
|
|
26
|
-
};
|
|
27
|
-
export declare function formatContactOpSummary(input: ContactOpCheckInput): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_IM_COUNT}from'@wowok/wowok';export const CONTACT_CONFIRM_VERSION='1.0.0';function checkDescription(a){const b=!!a['description']&&a['description']['length']>0x0;return{'id':'C-CONTACT-01','severity':b?'info':'warn','title':'description\x20is\x20provided\x20and\x20non-empty','description':'description\x20is\x20validated\x20by\x20common::DESCRIPTION\x20at\x20creation\x20(contact.move\x20new_imp).\x20Empty\x20string\x20is\x20technically\x20valid\x20but\x20makes\x20the\x20Contact\x20hard\x20to\x20identify.','passed':b,'evidence':a['description']===undefined?'undefined':'length='+a['description']['length'],'fix_hint':'Provide\x20a\x20one-line\x20summary\x20of\x20this\x20Contact\x27s\x20purpose.'};}function checkLocation(a){if(a['location']===undefined)return{'id':'C-CONTACT-02','severity':'info','title':'location\x20defaults\x20to\x20empty\x20string\x20(unset)','description':'A\x20fresh\x20Contact\x20has\x20location=\x22\x22.\x20Empty\x20means\x20\x27not\x20specified\x27,\x20not\x20\x27global\x27.','passed':!![],'evidence':'unset\x20→\x20empty\x20string'};const b=a['location']['length']>0x0;return{'id':'C-CONTACT-02','severity':b?'info':'warn','title':'location\x20is\x20set\x20(validated\x20by\x20common::LONG_NAME)','description':'location_set\x20uses\x20common::LONG_NAME\x20validation.\x20Empty\x20location\x20is\x20treated\x20as\x20unset.','passed':b,'evidence':'length='+a['location']['length'],'fix_hint':'Set\x20an\x20explicit\x20region\x20via\x20location_set,\x20or\x20leave\x20unset\x20to\x20mean\x20\x27not\x20specified\x27.'};}function checkImCount(a){if(a['im_count']===undefined)return{'id':'C-CONTACT-03','severity':'info','title':'im_count\x20below\x20MAX_IM_COUNT\x20('+MAX_IM_COUNT+')','description':'im_add\x20aborts\x20with\x20E_IM_COUNT_EXCEEDED\x20(1)\x20when\x20the\x20IM\x20list\x20reaches\x20the\x20cap.','passed':!![],'evidence':'not\x20provided'};const b=a['im_count']<MAX_IM_COUNT;return{'id':'C-CONTACT-03','severity':b?'info':'block','title':'im_count\x20below\x20MAX_IM_COUNT\x20('+MAX_IM_COUNT+')','description':'Contact\x20may\x20hold\x20up\x20to\x20MAX_IM_COUNT='+MAX_IM_COUNT+'\x20IM\x20entries.\x20im_add\x20aborts\x20with\x20E_IM_COUNT_EXCEEDED\x20(1)\x20at\x20the\x20boundary.','passed':b,'evidence':'im_count='+a['im_count']+',\x20limit='+MAX_IM_COUNT,'fix_hint':'Remove\x20stale\x20IM\x20entries\x20(im_remove/im_clear)\x20before\x20adding\x20more.'};}function checkChangeStatus(a){if(!a['change_status_from_non_member'])return{'id':'C-CONTACT-04','severity':'info','title':'change_status\x20caller\x20is\x20an\x20IM\x20member','description':'change_status\x20only\x20updates\x20the\x20caller\x27s\x20own\x20status\x20if\x20the\x20caller\x20is\x20in\x20ims[];\x20otherwise\x20it\x20silently\x20succeeds\x20with\x20no\x20state\x20change.','passed':!![],'evidence':'caller\x20assumed\x20member'};return{'id':'C-CONTACT-04','severity':'warn','title':'change_status\x20from\x20non-IM\x20member\x20will\x20be\x20silently\x20ignored','description':'change_status\x20does\x20not\x20abort\x20for\x20non-members\x20—\x20it\x20silently\x20no-ops.\x20The\x20caller\x20gets\x20no\x20feedback.','passed':![],'evidence':'change_status_from_non_member=true','fix_hint':'Pre-validate\x20IM\x20membership\x20before\x20calling\x20change_status.'};}function checkDeleteOrder(a){const b=!!a['bound_to_permission_um'];if(!a['is_destroy'])return{'id':'C-CONTACT-05','severity':b?'info':'info','title':'Contact\x20deletion\x20/\x20Permission.um\x20binding','description':b?'Contact\x20is\x20bound\x20as\x20a\x20Permission.um;\x20unbind\x20before\x20deletion.':'Contact\x20is\x20not\x20bound\x20as\x20a\x20Permission.um.','passed':!![],'evidence':b?'bound_to_permission_um=true':'not\x20bound'};return{'id':'C-CONTACT-05','severity':b?'block':'warn','title':'Deletion\x20order:\x20unbind\x20Permission.um\x20before\x20deleting\x20Contact','description':'permission_um_set\x20creates\x20a\x20bidirectional\x20dependency\x20(Permission.um\x20→\x20Contact,\x20Contact.permission\x20→\x20Permission).\x20Deleting\x20a\x20bound\x20Contact\x20leaves\x20a\x20dangling\x20Permission.um.','passed':!b,'evidence':b?'bound_to_permission_um=true\x20(unbind\x20first)':'not\x20bound','fix_hint':'Call\x20permission_um_set(null)\x20to\x20unbind,\x20then\x20delete\x20the\x20Contact.'};}export function preCheckContactOp(a){return[checkDescription(a),checkLocation(a),checkImCount(a),checkChangeStatus(a),checkDeleteOrder(a)];}export function canProceedContactOp(a){const b=preCheckContactOp(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 formatContactOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedContactOp(a),e=[b?'✓\x20Contact\x20operation\x20pre-check\x20PASSED':'✗\x20Contact\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');}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export declare const CONTACT_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
-
export interface SemanticToContactSchemaRule {
|
|
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_CONTACT_SCHEMA_RULES: SemanticToContactSchemaRule[];
|
|
12
|
-
export interface ContactFieldTranslation {
|
|
13
|
-
field_name: string;
|
|
14
|
-
value_type: string;
|
|
15
|
-
semantic: string;
|
|
16
|
-
format_example: string;
|
|
17
|
-
validation_rules: string[];
|
|
18
|
-
}
|
|
19
|
-
export declare const CONTACT_FIELD_TRANSLATIONS: ContactFieldTranslation[];
|
|
20
|
-
export interface ContactConstraintRule {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
description: string;
|
|
24
|
-
related_field: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const CONTACT_CONSTRAINT_RULES: ContactConstraintRule[];
|
|
27
|
-
export interface ContactExplainInput {
|
|
28
|
-
description?: string;
|
|
29
|
-
location?: string;
|
|
30
|
-
im_count?: number;
|
|
31
|
-
bound_to_permission_um?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface ContactExplanation {
|
|
34
|
-
summary: string;
|
|
35
|
-
location_status: string;
|
|
36
|
-
im_status: string;
|
|
37
|
-
warnings: string[];
|
|
38
|
-
}
|
|
39
|
-
export declare function explainContact(input: ContactExplainInput): ContactExplanation;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_IM_COUNT}from'@wowok/wowok';export const CONTACT_TRANSLATION_VERSION='1.0.0';export const SEMANTIC_TO_CONTACT_SCHEMA_RULES=[{'id':'P-CONTACT-01','pattern_name':'Create\x20contact','semantic_intent':'Create\x20a\x20shared\x20Contact\x20object\x20owned\x20by\x20a\x20Permission\x20(index\x20450).','match_keywords':['create\x20contact','new\x20contact','customer\x20service'],'required_fields':['permission','description'],'optional_fields':[],'example':{'description':'Customer\x20service\x20contact'}},{'id':'P-CONTACT-02','pattern_name':'Add\x20IM\x20member','semantic_intent':'Add\x20an\x20IM\x20entry\x20to\x20the\x20contact\x20list\x20(permission\x20index\x20453).','match_keywords':['add\x20im','add\x20member','add\x20contact\x20im'],'required_fields':['im'],'optional_fields':['description'],'example':{'im':'0x...','description':'support\x20desk'}},{'id':'P-CONTACT-03','pattern_name':'Set\x20location','semantic_intent':'Set\x20the\x20contact\x27s\x20geographic\x20region\x20(permission\x20index\x20452,\x20LONG_NAME).','match_keywords':['set\x20location','update\x20location'],'required_fields':['location'],'optional_fields':[],'example':{'location':'cn-guangdong-shenzhen'}}];export const CONTACT_FIELD_TRANSLATIONS=[{'field_name':'description','value_type':'string','semantic':'Human-readable\x20description\x20of\x20the\x20Contact\x20(common::DESCRIPTION\x20validation).','format_example':'Customer\x20service\x20contact','validation_rules':['common::DESCRIPTION\x20max\x20length']},{'field_name':'location','value_type':'string','semantic':'Geographic\x20region\x20string;\x20defaults\x20to\x20empty\x20(unset).','format_example':'cn-guangdong-shenzhen','validation_rules':['common::LONG_NAME\x20validation','empty\x20means\x20unset']},{'field_name':'ims','value_type':'vector<Im>','semantic':'IM\x20entry\x20list\x20(≤\x20MAX_IM_COUNT\x20'+MAX_IM_COUNT+').\x20Each\x20Im\x20has\x20at/status/join_time/description.','format_example':'[{at,\x20status,\x20join_time,\x20description}]','validation_rules':['im_add\x20aborts\x20E_IM_COUNT_EXCEEDED\x20(1)\x20at\x20cap']},{'field_name':'permission','value_type':'address','semantic':'Owning\x20Permission\x20address\x20(set\x20at\x20creation).','format_example':'0x...permission...','validation_rules':['set\x20via\x20new(permission,\x20…)\x20index\x20450']}];export const CONTACT_CONSTRAINT_RULES=[{'id':'CONTACT_C_01','name':'IM\x20count\x20cap','description':'ims\x20length\x20<\x20MAX_IM_COUNT\x20('+MAX_IM_COUNT+').','related_field':'ims'},{'id':'CONTACT_C_02','name':'description\x20validation','description':'description\x20uses\x20common::DESCRIPTION.','related_field':'description'},{'id':'CONTACT_C_03','name':'location\x20validation','description':'location\x20uses\x20common::LONG_NAME.','related_field':'location'},{'id':'CONTACT_C_04','name':'im\x20description\x20validation','description':'im_add\x20description\x20uses\x20common::LONG_NAME\x20(not\x20DESCRIPTION).','related_field':'ims'},{'id':'CONTACT_C_05','name':'permission\x20gating','description':'create=450,\x20description_set=451,\x20location_set=452,\x20im_add/remove/clear=453,\x20owner_receive=454.','related_field':'permission'}];export function explainContact(a){const b=[],c=a['location']?'location=\x22'+a['location']+'\x22':'location\x20unset\x20(empty\x20string)',d=a['im_count']!==undefined?a['im_count']+'/'+MAX_IM_COUNT+'\x20IM\x20entries':'IM\x20count\x20unknown';return a['im_count']!==undefined&&a['im_count']>=MAX_IM_COUNT&&b['push']('IM\x20list\x20at\x20cap\x20('+MAX_IM_COUNT+');\x20im_add\x20will\x20abort\x20E_IM_COUNT_EXCEEDED'),a['bound_to_permission_um']&&b['push']('Contact\x20is\x20bound\x20as\x20Permission.um;\x20unbind\x20before\x20deletion'),{'summary':'Contact\x20('+(a['description']??'no\x20description')+').\x20'+c+'.\x20'+d+'.','location_status':c,'im_status':d,'warnings':b};}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
2
|
-
export interface DemandConfirmItem {
|
|
3
|
-
id: string;
|
|
4
|
-
severity: ConfirmSeverity;
|
|
5
|
-
title: string;
|
|
6
|
-
description: string;
|
|
7
|
-
passed: boolean;
|
|
8
|
-
evidence?: string;
|
|
9
|
-
fix_hint?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface DemandCreationCheckInput {
|
|
12
|
-
description?: string;
|
|
13
|
-
location?: string;
|
|
14
|
-
rewards?: string[];
|
|
15
|
-
guards?: string[];
|
|
16
|
-
feedback?: string[];
|
|
17
|
-
service_identifier?: number | null;
|
|
18
|
-
by_guard?: string | null;
|
|
19
|
-
permission_set_available?: boolean;
|
|
20
|
-
namedNew?: {
|
|
21
|
-
name: string;
|
|
22
|
-
tag?: string;
|
|
23
|
-
} | null;
|
|
24
|
-
}
|
|
25
|
-
export declare function preCheckDemandCreation(input: DemandCreationCheckInput): DemandConfirmItem[];
|
|
26
|
-
export declare function canCreateDemand(input: DemandCreationCheckInput): {
|
|
27
|
-
canCreate: boolean;
|
|
28
|
-
blockers: DemandConfirmItem[];
|
|
29
|
-
warnings: DemandConfirmItem[];
|
|
30
|
-
info: DemandConfirmItem[];
|
|
31
|
-
};
|
|
32
|
-
export declare function formatDemandCreationSummary(input: DemandCreationCheckInput): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_REWARD_COUNT,MAX_GUARD_COUNT_DEMAND,MAX_DESCRIPTION_LENGTH,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';const MAX_FEEDBACK_COUNT=0x14;function checkDescription(a){const b=a['description']?.['length']??0x0,c=b>0x0&&b<=MAX_DESCRIPTION_LENGTH;return{'id':'C-DEM-01','severity':c?'info':b===0x0?'warn':'block','title':'description\x20non-empty\x20and\x20within\x20MAX_DESCRIPTION_LENGTH\x20('+MAX_DESCRIPTION_LENGTH+'\x20chars)','description':'description\x20is\x20a\x20REQUIRED\x20field.\x20Move\x20contract\x20validates\x20via\x20common::DESCRIPTION\x20(demand.move:157,177).\x20'+'Empty\x20string\x20is\x20technically\x20rejected\x20by\x20common::DESCRIPTION\x20only\x20if\x20NAME_ALLOW_EMPTY\x20is\x20not\x20used;\x20the\x20new_imp\x20'+'path\x20uses\x20common::DESCRIPTION\x20which\x20allows\x20empty\x20but\x20enforces\x20the\x204000-char\x20limit.\x20Non-empty\x20descriptions\x20are\x20'+'strongly\x20recommended\x20for\x20Demand\x20discoverability.','passed':c,'evidence':a['description']===undefined?'undefined':'length='+b+',\x20limit='+MAX_DESCRIPTION_LENGTH,'fix_hint':c?undefined:'Provide\x20a\x20description\x20of\x201..'+MAX_DESCRIPTION_LENGTH+'\x20characters.'};}function checkLocation(a){const b=a['location']?.['length']??0x0,c=b<=MAX_LONG_NAME_LENGTH;return{'id':'C-DEM-02','severity':c?'info':'block','title':'location\x20within\x20MAX_LONG_NAME_LENGTH\x20('+MAX_LONG_NAME_LENGTH+'\x20chars)','description':'location\x20is\x20set\x20via\x20location_set_imp\x20(demand.move:179-182)\x20which\x20validates\x20via\x20common::LONG_NAME.\x20'+'Move\x20aborts\x20with\x20E_LONG_NAME_LENGTH_EXCEEDED\x20(11)\x20on\x20overflow.\x20Empty\x20location\x20(\x22\x22)\x20is\x20valid\x20—\x20new_imp\x20'+'initializes\x20location\x20to\x20empty\x20string.\x20Use\x20location_set\x20to\x20update\x20after\x20creation.','passed':c,'evidence':a['location']===undefined?'undefined':'length='+b+',\x20limit='+MAX_LONG_NAME_LENGTH,'fix_hint':c?undefined:'Trim\x20location\x20to\x20≤\x20'+MAX_LONG_NAME_LENGTH+'\x20characters.'};}function checkRewards(a){const b=a['rewards']?.['length']??0x0,c=b<=MAX_REWARD_COUNT;return{'id':'C-DEM-03','severity':c?'info':'block','title':'rewards\x20count\x20within\x20MAX_REWARD_COUNT\x20('+MAX_REWARD_COUNT+')','description':'Each\x20reward_add_imp\x20(demand.move:184-191)\x20checks\x20`vector::length(&self.rewards)\x20<\x20MAX_REWARD_COUNT`\x20'+'before\x20pushing\x20(after\x20de-duplication).\x20Move\x20aborts\x20with\x20E_MAX_REWARD_COUNT_EXCEEDED\x20(1)\x20on\x20overflow.\x20'+'Rewards\x20are\x20bound\x20via\x20object_linker::affiliation_core\x20—\x20adding/removing\x20triggers\x20binding/unbinding.','passed':c,'evidence':'count='+b+',\x20limit='+MAX_REWARD_COUNT,'fix_hint':c?undefined:'Remove\x20rewards\x20before\x20adding\x20new\x20ones.\x20Limit='+MAX_REWARD_COUNT+'.'};}function checkGuards(a){const b=a['guards']?.['length']??0x0,c=b<=MAX_GUARD_COUNT_DEMAND;return{'id':'C-DEM-04','severity':c?'info':'block','title':'guards\x20count\x20within\x20MAX_GUARD_COUNT_DEMAND\x20('+MAX_GUARD_COUNT_DEMAND+')','description':'Each\x20guard_add_imp\x20(demand.move:213-242)\x20checks\x20`vector::length(&self.guards)\x20<\x20MAX_GUARD_COUNT`\x20'+'before\x20pushing\x20(after\x20duplicate\x20check\x20—\x20duplicates\x20update\x20service_identifier\x20in\x20place).\x20'+'Move\x20aborts\x20with\x20E_MAX_GUARD_COUNT_EXCEEDED\x20(2)\x20on\x20overflow.\x20Guards\x20are\x20bound\x20via\x20object_linker::affiliation_core.','passed':c,'evidence':'count='+b+',\x20limit='+MAX_GUARD_COUNT_DEMAND,'fix_hint':c?undefined:'Remove\x20guards\x20before\x20adding\x20new\x20ones.\x20Limit='+MAX_GUARD_COUNT_DEMAND+'.'};}function checkFeedback(a){const b=a['feedback']?.['length']??0x0,c=b<=MAX_FEEDBACK_COUNT;return{'id':'C-DEM-05','severity':c?'info':'block','title':'feedback\x20batch\x20count\x20within\x20MAX_FEEDBACK_COUNT\x20('+MAX_FEEDBACK_COUNT+')','description':'Move\x20feedback\x20(demand.move:352)\x20updates\x20ONE\x20presenter\x20per\x20call\x20—\x20feedback_imp\x20writes\x20to\x20a\x20single\x20'+'ServiceInfo\x20record.\x20The\x20SDK\x20batches\x20multiple\x20feedback\x20calls\x20and\x20caps\x20the\x20batch\x20at\x20MAX_FEEDBACK_COUNT='+(MAX_FEEDBACK_COUNT+'\x20(SDK-only\x20limit,\x20NOT\x20in\x20onchain-constants.ts).\x20Exceeding\x20the\x20SDK\x20batch\x20limit\x20is\x20')+'rejected\x20before\x20transaction\x20building.\x20Each\x20feedback\x20string\x20is\x20validated\x20by\x20common::DESCRIPTION\x20(4000\x20chars).','passed':c,'evidence':'count='+b+',\x20limit='+MAX_FEEDBACK_COUNT,'fix_hint':c?undefined:'Split\x20feedback\x20into\x20batches\x20of\x20≤\x20'+MAX_FEEDBACK_COUNT+'\x20entries.'};}function checkServiceIdentifier(a){const b=a['service_identifier'];if(b===null||b===undefined)return{'id':'C-DEM-06','severity':'info','title':'service_identifier\x20is\x20null/undefined\x20→\x20Option::none\x20(use\x20supplied\x20service\x20address)','description':'When\x20service_identifier\x20is\x20None,\x20guard_add_imp\x20stores\x20Option::none\x20in\x20ServiceGuard.\x20At\x20present_with_passport\x20'+'time,\x20present_with_passport_imp\x20uses\x20the\x20service\x20parameter\x20(or\x20Option::none\x20for\x20plain\x20present_with_passport).\x20'+'Use\x20None\x20when\x20the\x20Demand\x20does\x20not\x20need\x20to\x20route\x20presentations\x20through\x20a\x20specific\x20Service\x20submission.','passed':!![],'evidence':'null/undefined\x20→\x20Option::none'};const c=typeof b==='number'&&Number['isInteger'](b)&&b>=0x0&&b<=0xff;return{'id':'C-DEM-06','severity':c?'info':'block','title':'service_identifier\x20is\x20a\x20valid\x20u8\x20(0-255)\x20when\x20provided','description':'When\x20provided,\x20service_identifier\x20must\x20be\x20a\x20u8\x20index\x20into\x20the\x20Guard\x27s\x20submission\x20registry.\x20'+'guard_add_imp\x20(demand.move:218-222)\x20calls\x20guard::get_submission_object_type(guard,\x20*i)\x20and\x20'+'common::assert_service_object_type(t)\x20—\x20the\x20submission\x20at\x20that\x20index\x20MUST\x20exist\x20and\x20have\x20type\x20'+'ObjectType::Service.\x20At\x20present_with_passport\x20time,\x20the\x20submission\x20address\x20is\x20extracted\x20from\x20the\x20Passport\x20'+'via\x20passport::submission_get(passport,\x20&g,\x20*service_identifier).','passed':c,'evidence':'service_identifier='+b,'fix_hint':c?undefined:'Provide\x20an\x20integer\x20in\x20[0,\x20255]\x20that\x20indexes\x20a\x20Service-typed\x20submission\x20in\x20the\x20Guard.'};}function checkByGuard(a){const b=a['by_guard'];if(b===null||b===undefined)return{'id':'C-DEM-07','severity':'info','title':'by_guard\x20is\x20null\x20→\x20use\x20plain\x20present\x20(requires\x20empty\x20guards\x20vector)','description':'When\x20by_guard\x20is\x20None,\x20the\x20caller\x20uses\x20plain\x20present\x20(demand.move:100)\x20which\x20asserts\x20'+'`vector::is_empty(&self.guards)`\x20—\x20aborts\x20with\x20E_NEED_PASSPORT\x20(3)\x20if\x20guards\x20exist.\x20Use\x20this\x20path\x20'+'for\x20open\x20Demands\x20(no\x20guards).','passed':!![],'evidence':'null/undefined\x20→\x20plain\x20present\x20path'};if(a['guards']===undefined)return{'id':'C-DEM-07','severity':'info','title':'by_guard\x20provided\x20(cannot\x20verify\x20membership\x20—\x20guards\x20list\x20not\x20supplied)','description':'present_with_passport_imp\x20(demand.move:110-129)\x20iterates\x20the\x20guards\x20vector\x20looking\x20for\x20a\x20matching\x20'+'guard\x20address.\x20If\x20not\x20found,\x20it\x20aborts\x20with\x20E_GUARD_NOT_FOUND\x20(4).\x20The\x20caller\x20must\x20ensure\x20by_guard\x20'+'is\x20in\x20Demand.guards\x20—\x20this\x20check\x20could\x20not\x20verify\x20because\x20the\x20guards\x20list\x20was\x20not\x20supplied.','passed':!![],'evidence':'by_guard='+b['substring'](0x0,0xa)+'...\x20(guards\x20list\x20not\x20supplied)','fix_hint':'Pass\x20input.guards\x20to\x20enable\x20membership\x20verification.'};const c=a['guards']['includes'](b);return{'id':'C-DEM-07','severity':c?'info':'block','title':'by_guard\x20exists\x20in\x20Demand.guards\x20(when\x20specified)','description':'When\x20by_guard\x20is\x20specified,\x20present_with_passport_imp\x20(demand.move:110-129)\x20iterates\x20the\x20guards\x20vector\x20'+'looking\x20for\x20a\x20matching\x20guard\x20address.\x20If\x20not\x20found,\x20it\x20aborts\x20with\x20E_GUARD_NOT_FOUND\x20(4).\x20The\x20caller\x20'+'MUST\x20ensure\x20by_guard\x20was\x20previously\x20added\x20via\x20guard_add.','passed':c,'evidence':'by_guard='+b['substring'](0x0,0xa)+'...,\x20in\x20guards='+c,'fix_hint':c?undefined:'Call\x20guard_add(permission,\x20guard,\x20service_identifier)\x20first.'};}function checkPermissionSetAvailable(a){const b=a['permission_set_available']!==![];return{'id':'C-DEM-08','severity':b?'info':'warn','title':'permission_set\x20available\x20via\x20CallPermission.apply\x20(DE-D-2=A)','description':'The\x20Move\x20permission_set\x20function\x20(demand.move:286)\x20is\x20exposed\x20in\x20the\x20SDK\x20via\x20the\x20CallPermission.apply\x20'+'mechanism\x20(DE-D-2=A).\x20It\x20calls\x20permission::assert_owner(old)\x20and\x20object_linker::affiliation_change_core\x20to\x20migrate\x20'+'the\x20binding.\x20Permission\x20indices\x20for\x20Demand\x20(demand.move:20):\x20400=DEMAND_NEW,\x20401=DEMAND_DESCRIPTION,\x20'+'402=DEMAND_LOCATION,\x20404=DEMAND_GUARD,\x20405=DEMAND_REWARD,\x20406=DEMAND_FEEDBACK,\x20407=DEMAND_OWNER_RECEIVE,\x20'+'408=DEMAND_UM.\x20This\x20is\x20an\x20info\x20check\x20—\x20it\x20confirms\x20the\x20capability\x20is\x20available,\x20not\x20a\x20creation\x20prerequisite.','passed':b,'evidence':b?'exposed\x20via\x20CallPermission.apply':'not\x20available\x20(regression)','fix_hint':b?undefined:'Restore\x20the\x20CallPermission.apply\x20path\x20for\x20permission_set.'};}export function preCheckDemandCreation(a){return[checkDescription(a),checkLocation(a),checkRewards(a),checkGuards(a),checkFeedback(a),checkServiceIdentifier(a),checkByGuard(a),checkPermissionSetAvailable(a)];}export function canCreateDemand(a){const b=preCheckDemandCreation(a);return{'canCreate':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 formatDemandCreationSummary(a){const {canCreate:b,blockers:c,warnings:d,info:e}=canCreateDemand(a),f=[];return f['push'](b?'✓\x20Demand\x20pre-check\x20PASSED':'✗\x20Demand\x20pre-check\x20FAILED'),f['push'](''),c['length']>0x0&&(f['push']('BLOCKERS\x20(must\x20fix\x20before\x20operation):'),c['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),d['length']>0x0&&(f['push']('WARNINGS\x20(review\x20recommended):'),d['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),e['length']>0x0&&(f['push']('INFO:'),e['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']))),f['join']('\x0a');}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type DemandScene } from "./demand-ledger.js";
|
|
2
|
-
export declare const DEMAND_CONTEXT_VERSION = "1.0.0";
|
|
3
|
-
export interface DemandContextBundle {
|
|
4
|
-
scene?: DemandScene;
|
|
5
|
-
rewarded: boolean;
|
|
6
|
-
guarded: boolean;
|
|
7
|
-
summary: string;
|
|
8
|
-
}
|
|
9
|
-
export interface BuildDemandContextInput {
|
|
10
|
-
description?: string;
|
|
11
|
-
reward_count?: number;
|
|
12
|
-
guard_count?: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function buildDemandContext(input: BuildDemandContextInput): DemandContextBundle;
|
|
15
|
-
export declare function getDemandContextSummary(ctx: DemandContextBundle): string;
|
|
16
|
-
export declare function isRewardedDemand(ctx: DemandContextBundle): boolean;
|
|
17
|
-
export declare function getDemandSceneByIdSafe(id: string): DemandScene | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getDemandSceneById}from'./demand-ledger.js';export const DEMAND_CONTEXT_VERSION='1.0.0';export function buildDemandContext(a){const b=(a['reward_count']??0x0)>0x0,c=(a['guard_count']??0x0)>0x0,d=[];return a['description']&&d['push']('demand\x20\x22'+a['description']+'\x22'),d['push'](b?'rewarded':'not\x20rewarded'),d['push'](c?'guarded\x20present':'open\x20present'),{'scene':undefined,'rewarded':b,'guarded':c,'summary':d['join']('\x20·\x20')};}export function getDemandContextSummary(a){return a['summary'];}export function isRewardedDemand(a){return a['rewarded'];}export function getDemandSceneByIdSafe(a){return getDemandSceneById(a);}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const DEMAND_LEDGER_VERSION = "1.0.0";
|
|
2
|
-
export type DemandSceneClassification = "publish" | "present" | "feedback";
|
|
3
|
-
export interface DemandScene {
|
|
4
|
-
id: string;
|
|
5
|
-
classification: DemandSceneClassification;
|
|
6
|
-
semantic: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const DEMAND_SCENES: DemandScene[];
|
|
9
|
-
export interface DemandFieldEntry {
|
|
10
|
-
field: string;
|
|
11
|
-
value_type: string;
|
|
12
|
-
semantic: string;
|
|
13
|
-
required: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare const DEMAND_FIELDS: DemandFieldEntry[];
|
|
16
|
-
export interface DemandErrorEntry {
|
|
17
|
-
code: string;
|
|
18
|
-
value: number;
|
|
19
|
-
description: string;
|
|
20
|
-
}
|
|
21
|
-
export declare const DEMAND_ERROR_CODES: DemandErrorEntry[];
|
|
22
|
-
export declare function getDemandField(field: string): DemandFieldEntry | undefined;
|
|
23
|
-
export declare function getDemandErrorByCode(code: string): DemandErrorEntry | undefined;
|
|
24
|
-
export declare function getDemandErrorByValue(value: number): DemandErrorEntry | undefined;
|
|
25
|
-
export declare function getDemandSceneById(id: string): DemandScene | undefined;
|
|
26
|
-
export declare function inferDemandSceneFromIntent(intent: string): DemandScene | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DEMAND_LEDGER_VERSION='1.0.0';export const DEMAND_SCENES=[{'id':'demand_publish','classification':'publish','semantic':'Create\x20+\x20share\x20the\x20Demand\x20(description\x20+\x20location\x20+\x20rewards\x20+\x20guards).'},{'id':'demand_present','classification':'present','semantic':'A\x20presenter\x20(service/merchant)\x20submits\x20a\x20recommendation\x20to\x20the\x20Demand.'},{'id':'demand_feedback','classification':'feedback','semantic':'Demand\x20owner\x20rates\x20a\x20presenter\x27s\x20submission\x20(acceptance_score\x20+\x20feedback).'}];export const DEMAND_FIELDS=[{'field':'description','value_type':'string','semantic':'Demand\x20description\x20(common::DESCRIPTION\x20validation).','required':!![]},{'field':'location','value_type':'string','semantic':'Geographic\x20region\x20string\x20(structured\x20via\x20region.ts).','required':!![]},{'field':'rewards','value_type':'vector<address>','semantic':'Reward\x20objects\x20offered\x20(≤\x20MAX_REWARD_COUNT\x2020).','required':![]},{'field':'guards','value_type':'vector<ServiceGuard>','semantic':'Guards\x20a\x20presenter\x20must\x20pass\x20to\x20present\x20(≤\x20MAX_GUARD_COUNT\x2020).','required':![]},{'field':'presenters','value_type':'ParentTable<address,\x20ServiceInfo>','semantic':'Presenter\x20submissions\x20(who\x20→\x20recommend/service/acceptance).','required':![]},{'field':'um','value_type':'Option<address>','semantic':'User\x20manager\x20(optional).','required':![]},{'field':'permission','value_type':'address','semantic':'Owning\x20Permission\x20organization.','required':!![]}];export const DEMAND_ERROR_CODES=[{'code':'E_MAX_REWARD_COUNT_EXCEEDED','value':0x1,'description':'rewards\x20>\x20MAX_REWARD_COUNT\x20(20).'},{'code':'E_MAX_GUARD_COUNT_EXCEEDED','value':0x2,'description':'guards\x20>\x20MAX_GUARD_COUNT\x20(20).'},{'code':'E_NEED_PASSPORT','value':0x3,'description':'present\x20requires\x20empty\x20guards\x20(no\x20guard\x20→\x20no\x20passport).'},{'code':'E_GUARD_NOT_FOUND','value':0x4,'description':'Referenced\x20guard\x20not\x20found.'}];export function getDemandField(a){return DEMAND_FIELDS['find'](b=>b['field']===a);}export function getDemandErrorByCode(a){return DEMAND_ERROR_CODES['find'](b=>b['code']===a);}export function getDemandErrorByValue(a){return DEMAND_ERROR_CODES['find'](b=>b['value']===a);}export function getDemandSceneById(a){return DEMAND_SCENES['find'](b=>b['id']===a);}export function inferDemandSceneFromIntent(a){const b=a['toLowerCase']();if(/(publish|post|announce|create|发需求|发布)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='publish');if(/(present|apply|submit|bid|报价|应征)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='present');if(/(feedback|accept|score|rate|评价|采纳)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='feedback');return undefined;}
|