@wowok/agent-mcp 2.3.18 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/customer/industry-risks.js +31 -31
- package/dist/customer/order-monitor.js +57 -57
- package/dist/customer/order-strategy.js +89 -89
- package/dist/customer/post-purchase.js +97 -97
- package/dist/customer/reminder-system.js +26 -26
- package/dist/customer/risk-assessment.js +46 -46
- package/dist/customer/types.d.ts +4 -4
- package/dist/customer/types.js +4 -4
- package/dist/customer/user-preferences.js +50 -50
- package/dist/experience/intent-distill.js +6 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -1624
- package/dist/knowledge/acquisition-flywheel.js +64 -64
- package/dist/knowledge/arbitration-trust.js +10 -10
- package/dist/knowledge/demand-matching.js +8 -8
- package/dist/knowledge/dynamic-pricing.js +18 -18
- package/dist/knowledge/flywheel-loop.js +11 -11
- package/dist/knowledge/glossary.js +22 -22
- package/dist/knowledge/guard-ledger.d.ts +1 -1
- package/dist/knowledge/guard-ledger.js +145 -104
- package/dist/knowledge/guard-lint.d.ts +77 -0
- package/dist/knowledge/guard-lint.js +670 -0
- package/dist/knowledge/guard-migration.d.ts +48 -0
- package/dist/knowledge/guard-migration.js +228 -0
- package/dist/knowledge/guard-puzzle.d.ts +109 -14
- package/dist/knowledge/guard-puzzle.js +627 -101
- package/dist/knowledge/guard-risk.d.ts +10 -1
- package/dist/knowledge/guard-risk.js +1634 -292
- package/dist/knowledge/guard-templates.d.ts +38 -0
- package/dist/knowledge/guard-templates.js +605 -0
- package/dist/knowledge/guard-translation.d.ts +14 -2
- package/dist/knowledge/guard-translation.js +825 -194
- package/dist/knowledge/index.d.ts +8 -4
- package/dist/knowledge/index.js +9 -5
- package/dist/knowledge/industry-evolution.js +29 -29
- package/dist/knowledge/industry-generalizer.js +52 -52
- package/dist/knowledge/industry-registry.js +20 -33
- package/dist/knowledge/intent-metrics.js +67 -67
- package/dist/knowledge/process-model.js +80 -80
- package/dist/knowledge/reputation-rules.js +9 -9
- package/dist/knowledge/reward-templates.js +51 -51
- package/dist/knowledge/safety-rules.js +3 -3
- package/dist/knowledge/tool-constraints.js +20 -4
- package/dist/knowledge/trust-metrics.js +26 -26
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/graph.js +27 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +39 -2
- package/dist/project/namespace.d.ts +11 -1
- package/dist/project/namespace.js +27 -2
- package/dist/project/query.d.ts +2 -0
- package/dist/project/query.js +56 -15
- package/dist/rules.d.ts +12 -0
- package/dist/rules.js +9 -0
- package/dist/schema/call/allocation.d.ts +10 -10
- package/dist/schema/call/base.js +19 -19
- package/dist/schema/call/bridge.d.ts +32 -32
- package/dist/schema/call/demand.d.ts +84 -84
- package/dist/schema/call/guard.d.ts +153 -0
- package/dist/schema/call/guard.js +50 -0
- package/dist/schema/call/machine.d.ts +38 -38
- package/dist/schema/call/permission.d.ts +78 -78
- package/dist/schema/call/repository.d.ts +22 -22
- package/dist/schema/call/semantic.js +229 -25
- package/dist/schema/call/service.d.ts +7 -7
- package/dist/schema/local/wip.d.ts +39 -19
- package/dist/schema/local/wip.js +5 -5
- package/dist/schema/messenger/index.d.ts +26 -26
- package/dist/schema/messenger/index.js +2 -2
- package/dist/schema/operations.d.ts +270 -192
- package/dist/schema/query/index.d.ts +184 -184
- package/dist/schema/query/index.js +15 -9
- package/dist/schema/trust/index.d.ts +4 -4
- package/dist/schema/utils/guard-parser.js +4 -4
- package/dist/schema/utils/guard-query-utils.d.ts +7 -0
- package/dist/schema/utils/guard-query-utils.js +14 -1
- package/dist/schema/utils/node-parser.js +14 -14
- package/dist/schemas/bridge_operation.output.json +15 -15
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/messenger_operation.output.json +18 -16
- package/dist/schemas/onchain_events.output.json +15 -15
- package/dist/schemas/onchain_operations.output.json +16 -16
- package/dist/schemas/onchain_operations.schema.json +11 -20
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -10
- package/dist/schemas/onchain_operations_machine.schema.json +2 -5
- package/dist/schemas/onchain_operations_service.schema.json +2 -5
- package/dist/schemas/onchain_table_data.output.json +20 -26
- package/dist/schemas/wip_file.output.json +24 -1
- package/dist/tools/handlers/bridge.d.ts +1 -0
- package/dist/tools/handlers/bridge.js +1 -0
- package/dist/tools/handlers/config.d.ts +2 -0
- package/dist/tools/handlers/config.js +71 -0
- package/dist/tools/handlers/file-export.d.ts +3 -0
- package/dist/tools/handlers/file-export.js +90 -0
- package/dist/tools/handlers/local.d.ts +30 -0
- package/dist/tools/handlers/local.js +27 -0
- package/dist/tools/handlers/messenger.d.ts +16 -0
- package/dist/tools/handlers/messenger.js +187 -0
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +246 -0
- package/dist/tools/handlers/project.d.ts +2 -0
- package/dist/tools/handlers/project.js +53 -0
- package/dist/tools/handlers/query.d.ts +5 -0
- package/dist/tools/handlers/query.js +256 -0
- package/dist/tools/handlers/schema-query.d.ts +2 -0
- package/dist/tools/handlers/schema-query.js +92 -0
- package/dist/tools/handlers/trust.d.ts +2 -0
- package/dist/tools/handlers/trust.js +194 -0
- package/dist/tools/handlers/wip.d.ts +2 -0
- package/dist/tools/handlers/wip.js +44 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +479 -0
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +22 -0
- package/dist/tools/shared.d.ts +29 -0
- package/dist/tools/shared.js +130 -0
- package/dist/tools/types.d.ts +35 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/wrap.d.ts +6 -0
- package/dist/tools/wrap.js +55 -0
- package/package.json +19 -5
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type GuardNodeType = 'logic_or' | 'logic_and' | 'logic_not' | 'logic_equal' | 'logic_string_nocase_equal' | 'logic_as_u256_equal' | 'logic_string_contains' | 'logic_string_nocase_contains' | 'logic_as_u256_greater' | 'logic_as_u256_lesser' | 'logic_as_u256_greater_or_equal' | 'logic_as_u256_lesser_or_equal' | 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool' | 'identifier' | 'query' | 'context' | 'calc_number_add' | 'calc_number_subtract' | 'calc_number_multiply' | 'calc_number_divide' | 'calc_number_mod' | string;
|
|
2
|
+
export interface GuardNode {
|
|
3
|
+
type: GuardNodeType;
|
|
4
|
+
nodes?: GuardNode[];
|
|
5
|
+
node?: GuardNode;
|
|
6
|
+
identifier?: number;
|
|
7
|
+
query?: string | number;
|
|
8
|
+
context?: string;
|
|
9
|
+
object?: {
|
|
10
|
+
identifier?: number;
|
|
11
|
+
convert_witness?: string | number;
|
|
12
|
+
};
|
|
13
|
+
parameters?: unknown[];
|
|
14
|
+
}
|
|
15
|
+
export interface GuardTableEntry {
|
|
16
|
+
identifier: number;
|
|
17
|
+
b_submission?: boolean;
|
|
18
|
+
value_type?: string | number;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
export type VecContainsTarget = 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool';
|
|
23
|
+
export type VecValueType = 'VecString' | 'VecAddress' | 'VecU64' | 'VecU128' | 'VecU256' | 'VecU8' | 'VecU16' | 'VecU32' | 'VecBool';
|
|
24
|
+
export interface ConversionResult {
|
|
25
|
+
convertible: boolean;
|
|
26
|
+
targetOperator?: VecContainsTarget;
|
|
27
|
+
vectorValueType?: VecValueType;
|
|
28
|
+
sharedNode?: GuardNode;
|
|
29
|
+
constants?: Array<{
|
|
30
|
+
identifier: number;
|
|
31
|
+
value: unknown;
|
|
32
|
+
value_type: string;
|
|
33
|
+
}>;
|
|
34
|
+
reasons?: string[];
|
|
35
|
+
}
|
|
36
|
+
export declare function analyzeLogicOrConversion(orNode: GuardNode, table: GuardTableEntry[]): ConversionResult;
|
|
37
|
+
export interface ShorthandResult {
|
|
38
|
+
newRoot: GuardNode;
|
|
39
|
+
removeIdentifiers: number[];
|
|
40
|
+
addEntry: {
|
|
41
|
+
identifier: number;
|
|
42
|
+
b_submission: false;
|
|
43
|
+
value_type: VecValueType;
|
|
44
|
+
value: unknown[];
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export declare function buildShorthand(orNode: GuardNode, result: ConversionResult, newIdentifier: number): ShorthandResult | null;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const EQUAL_OPERATORS = new Set([
|
|
2
|
+
'logic_equal',
|
|
3
|
+
'logic_string_nocase_equal',
|
|
4
|
+
'logic_as_u256_equal',
|
|
5
|
+
]);
|
|
6
|
+
function mapOperatorToTarget(operator, valueType) {
|
|
7
|
+
if (valueType === 'String' || valueType === 2) {
|
|
8
|
+
if (operator === 'logic_string_nocase_equal') {
|
|
9
|
+
return { target: 'vec_contains_string_nocase', vecType: 'VecString' };
|
|
10
|
+
}
|
|
11
|
+
if (operator === 'logic_equal') {
|
|
12
|
+
return { target: 'vec_contains_string', vecType: 'VecString' };
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
if (valueType === 'Address' || valueType === 1) {
|
|
17
|
+
if (operator === 'logic_equal') {
|
|
18
|
+
return { target: 'vec_contains_address', vecType: 'VecAddress' };
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (valueType === 'Bool' || valueType === 0) {
|
|
23
|
+
if (operator === 'logic_equal') {
|
|
24
|
+
return { target: 'vec_contains_bool', vecType: 'VecBool' };
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const numericTypes = new Set([
|
|
29
|
+
'U8', 'U16', 'U32', 'U64', 'U128', 'U256',
|
|
30
|
+
3, 4, 5, 6, 7, 8,
|
|
31
|
+
]);
|
|
32
|
+
if (numericTypes.has(valueType)) {
|
|
33
|
+
if (operator === 'logic_equal' || operator === 'logic_as_u256_equal') {
|
|
34
|
+
return { target: 'vec_contains_number', vecType: 'VecU256' };
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
export function analyzeLogicOrConversion(orNode, table) {
|
|
41
|
+
const reasons = [];
|
|
42
|
+
if (orNode.type !== 'logic_or') {
|
|
43
|
+
return {
|
|
44
|
+
convertible: false,
|
|
45
|
+
reasons: [`Node type is '${orNode.type}', not 'logic_or'. Only logic_or nodes are candidates.`],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const children = orNode.nodes ?? [];
|
|
49
|
+
if (children.length < 2) {
|
|
50
|
+
return {
|
|
51
|
+
convertible: false,
|
|
52
|
+
reasons: [`logic_or has ${children.length} children; need at least 2 to convert.`],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (children.length > 7) {
|
|
56
|
+
return {
|
|
57
|
+
convertible: false,
|
|
58
|
+
reasons: [
|
|
59
|
+
`logic_or has ${children.length} children; vec_contains_* supports at most 7 needles (1 haystack + 7 needles = 8 node limit). Keep the logic_or.`,
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const childOperators = new Set();
|
|
64
|
+
for (const child of children) {
|
|
65
|
+
if (!EQUAL_OPERATORS.has(child.type)) {
|
|
66
|
+
if (child.type === 'logic_string_contains' || child.type === 'logic_string_nocase_contains') {
|
|
67
|
+
reasons.push(`Child uses '${child.type}' (substring match). vec_contains_* is whole-element membership, NOT substring. Cannot convert.`);
|
|
68
|
+
}
|
|
69
|
+
else if (child.type?.startsWith('logic_as_u256_greater') || child.type?.startsWith('logic_as_u256_lesser')) {
|
|
70
|
+
reasons.push(`Child uses '${child.type}' (ordering comparison). vec_contains_* is membership, not ordering. Cannot convert.`);
|
|
71
|
+
}
|
|
72
|
+
else if (child.type === 'logic_and' || child.type === 'logic_or' || child.type === 'logic_not') {
|
|
73
|
+
reasons.push(`Child is a nested logic node ('${child.type}'). Only leaf equal-style comparisons are convertible.`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
reasons.push(`Child uses '${child.type}' which is not an equal-style operator (logic_equal / logic_string_nocase_equal / logic_as_u256_equal).`);
|
|
77
|
+
}
|
|
78
|
+
return { convertible: false, reasons };
|
|
79
|
+
}
|
|
80
|
+
childOperators.add(child.type);
|
|
81
|
+
}
|
|
82
|
+
if (childOperators.size > 1) {
|
|
83
|
+
const opList = Array.from(childOperators).join(', ');
|
|
84
|
+
return {
|
|
85
|
+
convertible: false,
|
|
86
|
+
reasons: [
|
|
87
|
+
`Children use mixed operators: [${opList}]. Mixing case-sensitive (logic_equal) and case-insensitive (logic_string_nocase_equal) comparisons would change semantics. Keep the logic_or.`,
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const sharedOperator = children[0].type;
|
|
92
|
+
for (let i = 0; i < children.length; i++) {
|
|
93
|
+
const childNodes = children[i].nodes ?? [];
|
|
94
|
+
if (childNodes.length !== 2) {
|
|
95
|
+
return {
|
|
96
|
+
convertible: false,
|
|
97
|
+
reasons: [
|
|
98
|
+
`Child ${i} ('${sharedOperator}') has ${childNodes.length} sub-nodes; expected exactly 2 (one constant side + one shared query side).`,
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const constants = [];
|
|
104
|
+
let sharedNode = null;
|
|
105
|
+
let sharedNodeSerial = null;
|
|
106
|
+
for (let i = 0; i < children.length; i++) {
|
|
107
|
+
const childNodes = children[i].nodes;
|
|
108
|
+
const left = childNodes[0];
|
|
109
|
+
const right = childNodes[1];
|
|
110
|
+
const leftIsConstId = left.type === 'identifier' && typeof left.identifier === 'number';
|
|
111
|
+
const rightIsConstId = right.type === 'identifier' && typeof right.identifier === 'number';
|
|
112
|
+
if (!leftIsConstId && !rightIsConstId) {
|
|
113
|
+
return {
|
|
114
|
+
convertible: false,
|
|
115
|
+
reasons: [
|
|
116
|
+
`Child ${i} has no constant identifier side (both sub-nodes are non-identifier). Conversion requires one side to be a constant table entry.`,
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (leftIsConstId && rightIsConstId) {
|
|
121
|
+
return {
|
|
122
|
+
convertible: false,
|
|
123
|
+
reasons: [
|
|
124
|
+
`Child ${i} has two identifier sides. Conversion requires one side to be a non-constant (query/context/calc) node shared across all children.`,
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const constIdNode = leftIsConstId ? left : right;
|
|
129
|
+
const nonConstNode = leftIsConstId ? right : left;
|
|
130
|
+
const tableEntry = table.find((e) => e.identifier === constIdNode.identifier);
|
|
131
|
+
if (!tableEntry) {
|
|
132
|
+
return {
|
|
133
|
+
convertible: false,
|
|
134
|
+
reasons: [
|
|
135
|
+
`Child ${i} references identifier[${constIdNode.identifier}] which is not in the table.`,
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (tableEntry.b_submission !== false) {
|
|
140
|
+
return {
|
|
141
|
+
convertible: false,
|
|
142
|
+
reasons: [
|
|
143
|
+
`Child ${i} references identifier[${constIdNode.identifier}] with b_submission=${tableEntry.b_submission}. Conversion requires compile-time constants (b_submission=false).`,
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (tableEntry.value === undefined || tableEntry.value === null) {
|
|
148
|
+
return {
|
|
149
|
+
convertible: false,
|
|
150
|
+
reasons: [
|
|
151
|
+
`Child ${i} references identifier[${constIdNode.identifier}] which has no 'value' field. Conversion requires explicit constant values.`,
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const nonConstSerial = JSON.stringify(nonConstNode);
|
|
156
|
+
if (sharedNodeSerial === null) {
|
|
157
|
+
sharedNodeSerial = nonConstSerial;
|
|
158
|
+
sharedNode = nonConstNode;
|
|
159
|
+
}
|
|
160
|
+
else if (sharedNodeSerial !== nonConstSerial) {
|
|
161
|
+
return {
|
|
162
|
+
convertible: false,
|
|
163
|
+
reasons: [
|
|
164
|
+
`Child ${i}'s non-constant side differs from child 0's. All children must share the SAME non-constant node (same query, same convert_witness, same parameters). Keep the logic_or.`,
|
|
165
|
+
],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
constants.push({
|
|
169
|
+
identifier: constIdNode.identifier,
|
|
170
|
+
value: tableEntry.value,
|
|
171
|
+
value_type: String(tableEntry.value_type ?? ''),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const valueTypes = new Set(constants.map((c) => c.value_type));
|
|
175
|
+
if (valueTypes.size > 1) {
|
|
176
|
+
return {
|
|
177
|
+
convertible: false,
|
|
178
|
+
reasons: [
|
|
179
|
+
`Constants have mixed value_types: [${Array.from(valueTypes).join(', ')}]. All constants must share the same type to form a single VecXxx.`,
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const sharedValueType = constants[0].value_type;
|
|
184
|
+
const mapping = mapOperatorToTarget(sharedOperator, sharedValueType);
|
|
185
|
+
if (!mapping) {
|
|
186
|
+
return {
|
|
187
|
+
convertible: false,
|
|
188
|
+
reasons: [
|
|
189
|
+
`No vec_contains_* variant maps to operator='${sharedOperator}' with value_type='${sharedValueType}'. ` +
|
|
190
|
+
`Mappable combinations: (logic_string_nocase_equal, String)→vec_contains_string_nocase; ` +
|
|
191
|
+
`(logic_equal, String)→vec_contains_string; (logic_equal, Address)→vec_contains_address; ` +
|
|
192
|
+
`(logic_equal, Bool)→vec_contains_bool; (logic_equal|logic_as_u256_equal, numeric)→vec_contains_number.`,
|
|
193
|
+
],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
convertible: true,
|
|
198
|
+
targetOperator: mapping.target,
|
|
199
|
+
vectorValueType: mapping.vecType,
|
|
200
|
+
sharedNode: sharedNode ?? undefined,
|
|
201
|
+
constants,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export function buildShorthand(orNode, result, newIdentifier) {
|
|
205
|
+
if (!result.convertible || !result.targetOperator || !result.vectorValueType || !result.sharedNode || !result.constants) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const values = result.constants.map((c) => c.value);
|
|
209
|
+
const removeIdentifiers = result.constants.map((c) => c.identifier);
|
|
210
|
+
const newRoot = {
|
|
211
|
+
type: result.targetOperator,
|
|
212
|
+
nodes: [
|
|
213
|
+
{ type: 'identifier', identifier: newIdentifier },
|
|
214
|
+
result.sharedNode,
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
newRoot,
|
|
219
|
+
removeIdentifiers,
|
|
220
|
+
addEntry: {
|
|
221
|
+
identifier: newIdentifier,
|
|
222
|
+
b_submission: false,
|
|
223
|
+
value_type: result.vectorValueType,
|
|
224
|
+
value: values,
|
|
225
|
+
name: 'converted_constants',
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
@@ -10,21 +10,45 @@ export interface BindingPuzzle {
|
|
|
10
10
|
circular_reference: boolean;
|
|
11
11
|
host_object_state: "not_created" | "created_unpublished" | "published_immutable" | "unknown";
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface OnChainConstantEntry {
|
|
14
14
|
identifier: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
value?: string | number | boolean | string[];
|
|
15
|
+
object_address: string;
|
|
16
|
+
object_type: string;
|
|
18
17
|
name: string;
|
|
19
|
-
object_type?: string;
|
|
20
18
|
is_system_address?: boolean;
|
|
21
19
|
}
|
|
22
|
-
export interface
|
|
20
|
+
export interface WitnessDerivedEntry {
|
|
21
|
+
identifier: number;
|
|
22
|
+
source_type: string;
|
|
23
23
|
witness_type: number;
|
|
24
24
|
witness_name: string;
|
|
25
|
-
source_type: string;
|
|
26
25
|
target_type: string;
|
|
27
|
-
|
|
26
|
+
source_b_submission: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SubmittedObjectEntry {
|
|
30
|
+
identifier: number;
|
|
31
|
+
expected_object_type: string;
|
|
32
|
+
value_type: string;
|
|
33
|
+
name: string;
|
|
34
|
+
binding_constraint?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SubmittedValueEntry {
|
|
37
|
+
identifier: number;
|
|
38
|
+
value_type: string;
|
|
39
|
+
name: string;
|
|
40
|
+
binding_constraint?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SystemContextEntry {
|
|
43
|
+
context_type: "Signer" | "Clock" | "Guard";
|
|
44
|
+
usage: string;
|
|
45
|
+
}
|
|
46
|
+
export interface DataSourcePuzzle {
|
|
47
|
+
on_chain_constants: OnChainConstantEntry[];
|
|
48
|
+
witness_derived: WitnessDerivedEntry[];
|
|
49
|
+
submitted_objects: SubmittedObjectEntry[];
|
|
50
|
+
submitted_values: SubmittedValueEntry[];
|
|
51
|
+
system_contexts: SystemContextEntry[];
|
|
28
52
|
}
|
|
29
53
|
export interface QueryPuzzle {
|
|
30
54
|
query_id: number;
|
|
@@ -32,7 +56,13 @@ export interface QueryPuzzle {
|
|
|
32
56
|
object_type: string;
|
|
33
57
|
parameters: string[];
|
|
34
58
|
return_type: string;
|
|
35
|
-
witness?:
|
|
59
|
+
witness?: {
|
|
60
|
+
witness_type: number;
|
|
61
|
+
witness_name: string;
|
|
62
|
+
source_type: string;
|
|
63
|
+
target_type: string;
|
|
64
|
+
scenario: string;
|
|
65
|
+
};
|
|
36
66
|
purpose: string;
|
|
37
67
|
}
|
|
38
68
|
export interface LogicNodePuzzle {
|
|
@@ -59,15 +89,18 @@ export interface ConstraintChecklist {
|
|
|
59
89
|
pitfall_08_rely_rep_true: boolean;
|
|
60
90
|
pitfall_09_voting_weight_numeric: boolean;
|
|
61
91
|
pitfall_10_arbitration_not_paused: boolean;
|
|
92
|
+
runtime_01_guard_immutable: boolean;
|
|
93
|
+
runtime_02_submission_type_match: boolean;
|
|
94
|
+
runtime_03_submission_complete: boolean;
|
|
95
|
+
runtime_04_submission_size: boolean;
|
|
96
|
+
runtime_05_witness_source_valid: boolean;
|
|
97
|
+
runtime_06_query_object_valid: boolean;
|
|
62
98
|
}
|
|
63
99
|
export interface GuardPuzzle {
|
|
64
100
|
current_round: "R1" | "R2" | "R3" | "R4" | "R5" | "R6" | "R7" | "R8" | "R9" | "R10";
|
|
65
101
|
intent?: IntentPuzzle;
|
|
66
102
|
binding?: BindingPuzzle;
|
|
67
|
-
|
|
68
|
-
entries: DataEntryPuzzle[];
|
|
69
|
-
witnesses: WitnessUsagePuzzle[];
|
|
70
|
-
};
|
|
103
|
+
data_sources?: DataSourcePuzzle;
|
|
71
104
|
queries?: QueryPuzzle[];
|
|
72
105
|
logic?: {
|
|
73
106
|
root: LogicNodePuzzle;
|
|
@@ -75,7 +108,7 @@ export interface GuardPuzzle {
|
|
|
75
108
|
};
|
|
76
109
|
constraints?: ConstraintChecklist;
|
|
77
110
|
}
|
|
78
|
-
export type PuzzleDimension = "intent" | "binding" | "
|
|
111
|
+
export type PuzzleDimension = "intent" | "binding" | "data_sources" | "query" | "logic" | "constraints";
|
|
79
112
|
export interface PuzzleCompleteness {
|
|
80
113
|
dimensions: Record<PuzzleDimension, boolean>;
|
|
81
114
|
missing: PuzzleDimension[];
|
|
@@ -91,3 +124,65 @@ export declare function checkPuzzleCompleteness(puzzle: GuardPuzzle): PuzzleComp
|
|
|
91
124
|
export declare function generateConfirmationText(puzzle: GuardPuzzle): string;
|
|
92
125
|
export declare function initPuzzleFromIntent(intent: Partial<IntentPuzzle>): GuardPuzzle;
|
|
93
126
|
export declare function inferBindingFromAction(action: IntentPuzzle["action"]): Partial<BindingPuzzle>;
|
|
127
|
+
export declare function emptyDataSources(): DataSourcePuzzle;
|
|
128
|
+
export declare const WITNESS_NAME_MAP: Record<number, {
|
|
129
|
+
name: string;
|
|
130
|
+
source: string;
|
|
131
|
+
target: string;
|
|
132
|
+
}>;
|
|
133
|
+
export declare function getWitnessInfo(witness_type: number): {
|
|
134
|
+
name: string;
|
|
135
|
+
source: string;
|
|
136
|
+
target: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
export interface RootNodeSnapshot {
|
|
139
|
+
type: string;
|
|
140
|
+
identifier?: number;
|
|
141
|
+
query?: string | number;
|
|
142
|
+
object?: {
|
|
143
|
+
identifier: number;
|
|
144
|
+
convert_witness?: number;
|
|
145
|
+
};
|
|
146
|
+
parameters?: RootNodeSnapshot[];
|
|
147
|
+
context?: "Clock" | "Guard" | "Signer";
|
|
148
|
+
nodes?: RootNodeSnapshot[];
|
|
149
|
+
node?: RootNodeSnapshot;
|
|
150
|
+
nodeLeft?: RootNodeSnapshot;
|
|
151
|
+
nodeRight?: RootNodeSnapshot;
|
|
152
|
+
}
|
|
153
|
+
export type ValueSnapshot = string | number | boolean | string[] | number[] | boolean[];
|
|
154
|
+
export interface TableItemSnapshot {
|
|
155
|
+
identifier: number;
|
|
156
|
+
b_submission: boolean;
|
|
157
|
+
value_type: string | number;
|
|
158
|
+
value?: ValueSnapshot;
|
|
159
|
+
name: string;
|
|
160
|
+
object_type?: string;
|
|
161
|
+
}
|
|
162
|
+
export interface BindingHintSnapshot {
|
|
163
|
+
action: string;
|
|
164
|
+
host_object: string;
|
|
165
|
+
binding_field: string;
|
|
166
|
+
rule_sentence?: string;
|
|
167
|
+
failure_conditions?: string[];
|
|
168
|
+
circular_reference?: boolean;
|
|
169
|
+
}
|
|
170
|
+
export interface DerivePuzzleInput {
|
|
171
|
+
table?: TableItemSnapshot[];
|
|
172
|
+
root?: RootNodeSnapshot;
|
|
173
|
+
rely?: {
|
|
174
|
+
guards: string[];
|
|
175
|
+
logic_or?: boolean;
|
|
176
|
+
};
|
|
177
|
+
binding_hint?: BindingHintSnapshot;
|
|
178
|
+
}
|
|
179
|
+
export declare function derivePuzzleFromCallData(input: DerivePuzzleInput): GuardPuzzle;
|
|
180
|
+
export declare function getPuzzleStatusBooleans(puzzle: GuardPuzzle): {
|
|
181
|
+
intent: boolean;
|
|
182
|
+
binding: boolean;
|
|
183
|
+
data: boolean;
|
|
184
|
+
query: boolean;
|
|
185
|
+
logic: boolean;
|
|
186
|
+
constraints: boolean;
|
|
187
|
+
};
|
|
188
|
+
export declare function getPendingQuestions(puzzle: GuardPuzzle): string[];
|