@wowok/agent-mcp 2.6.1 → 2.6.4
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/customer-advice.d.ts +31 -0
- package/dist/customer/customer-advice.js +129 -0
- package/dist/customer/index.d.ts +2 -0
- package/dist/customer/index.js +2 -0
- package/dist/customer/info-puzzle.d.ts +9 -2
- package/dist/customer/info-puzzle.js +34 -7
- package/dist/customer/order-monitor.d.ts +2 -0
- package/dist/customer/order-monitor.js +3 -2
- package/dist/customer/post-purchase.d.ts +2 -0
- package/dist/customer/post-purchase.js +6 -5
- package/dist/customer/preorder-compare.d.ts +24 -0
- package/dist/customer/preorder-compare.js +34 -0
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +2 -1
- package/dist/customer/risk-assessment.js +30 -7
- package/dist/customer/types.d.ts +7 -0
- package/dist/examples/arbitration-dispute-create.json +41 -0
- package/dist/examples/arbitration-vote-weighted.json +35 -0
- package/dist/examples/arbitration-voting-guard-add.json +38 -0
- package/dist/examples/demand-present-service.json +33 -0
- package/dist/examples/gen-passport-verify-guard.json +48 -0
- package/dist/examples/guard-template-balance-check.json +59 -0
- package/dist/examples/guard-template-time-lock.json +60 -0
- package/dist/examples/insurance-guard-claim-timelock.json +75 -0
- package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
- package/dist/examples/insurance-machine-create-publish.json +75 -0
- package/dist/examples/insurance-service-allocators-publish.json +56 -0
- package/dist/examples/machine-multisig-threshold.json +86 -0
- package/dist/examples/machine-template-7node-rental.json +119 -0
- package/dist/examples/payment-scenario-bound.json +45 -0
- package/dist/examples/rental-ziroom-machine-create.json +149 -0
- package/dist/examples/rental-ziroom-permission-create.json +42 -0
- package/dist/examples/rental-ziroom-service-create.json +89 -0
- package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
- package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
- package/dist/examples/retail-adv-reward-guard-add.json +51 -0
- package/dist/examples/retail-myshop-allocation-activate.json +55 -0
- package/dist/examples/retail-myshop-arbitration-create.json +40 -0
- package/dist/examples/retail-myshop-contact-create.json +43 -0
- package/dist/examples/retail-myshop-order-create.json +56 -0
- package/dist/examples/retail-myshop-progress-operate.json +38 -0
- package/dist/examples/retail-myshop-reward-create.json +35 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/examples/service-discount-issue.json +46 -0
- package/dist/examples/threebody-guard-create.json +56 -0
- package/dist/examples/threebody-machine-create.json +72 -0
- package/dist/examples/threebody-permission-create.json +38 -0
- package/dist/examples/threebody-service-allocators.json +49 -0
- package/dist/examples/travel-guard-time-lock.json +69 -0
- package/dist/examples/travel-guard-weather-oracle.json +70 -0
- package/dist/examples/travel-machine-create.json +136 -0
- package/dist/examples/travel-repository-create.json +47 -0
- package/dist/examples/travel-service-create.json +102 -0
- package/dist/examples/travel-treasury-create.json +34 -0
- package/dist/examples/treasury-deposit.json +37 -0
- package/dist/examples/treasury-withdraw.json +38 -0
- package/dist/extensions/business-modules.d.ts +49 -0
- package/dist/extensions/business-modules.js +287 -0
- package/dist/extensions/capability-manifest.js +216 -29
- package/dist/extensions/constraint-registry.js +21 -19
- package/dist/extensions/metric-registry.js +14 -14
- package/dist/extensions/mode-evaluator.js +16 -16
- package/dist/extensions/modes.js +141 -49
- package/dist/extensions/registry.d.ts +16 -9
- package/dist/extensions/registry.js +132 -44
- package/dist/extensions/types.d.ts +2 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +138 -0
- package/dist/knowledge/fund-layer.js +969 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/guard-templates.d.ts +10 -0
- package/dist/knowledge/guard-templates.js +50 -0
- package/dist/knowledge/index.d.ts +2 -2
- package/dist/knowledge/index.js +2 -2
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-risk.js +4 -1
- package/dist/knowledge/machine-templates.js +4 -4
- package/dist/knowledge/progress-context.js +1 -1
- package/dist/knowledge/progress-ledger.js +3 -3
- package/dist/knowledge/progress-templates.js +1 -1
- package/dist/knowledge/progress-translation.js +1 -1
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/safety-rules.d.ts +83 -1
- package/dist/knowledge/safety-rules.js +166 -2
- package/dist/knowledge/scenario-modes.d.ts +1 -1
- package/dist/knowledge/scenario-modes.js +13 -11
- package/dist/knowledge/service-confirm.d.ts +1 -1
- package/dist/knowledge/service-confirm.js +3 -3
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/knowledge/template-registry.d.ts +48 -0
- package/dist/knowledge/template-registry.js +341 -0
- package/dist/knowledge/tool-constraints.js +6 -6
- package/dist/knowledge/tools-reference.js +11 -8
- package/dist/participation/merchant-interest.d.ts +32 -0
- package/dist/participation/merchant-interest.js +100 -0
- package/dist/participation/radar-core.d.ts +104 -0
- package/dist/participation/radar-core.js +269 -0
- package/dist/project/context-assembly.js +8 -0
- package/dist/project/deployment-bridge.js +6 -5
- package/dist/project/deployment-doc.js +5 -5
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1342 -0
- package/dist/project/evaluation.d.ts +36 -0
- package/dist/project/evaluation.js +734 -68
- package/dist/project/game-theory.d.ts +43 -0
- package/dist/project/game-theory.js +177 -0
- package/dist/project/graph-builder.js +7 -1
- package/dist/project/handlers.d.ts +137 -2
- package/dist/project/handlers.js +423 -51
- package/dist/project/intent-analyzer.d.ts +71 -0
- package/dist/project/intent-analyzer.js +149 -0
- package/dist/project/machine-nodes.d.ts +2 -0
- package/dist/project/machine-nodes.js +36 -0
- package/dist/project/merchant-guide.d.ts +165 -0
- package/dist/project/merchant-guide.js +264 -0
- package/dist/project/mode-actions.d.ts +199 -0
- package/dist/project/mode-actions.js +309 -0
- package/dist/project/participation-radar.d.ts +18 -0
- package/dist/project/participation-radar.js +428 -0
- package/dist/project/pipeline-actions.d.ts +101 -0
- package/dist/project/pipeline-actions.js +109 -0
- package/dist/project/semantic-graph.d.ts +95 -0
- package/dist/project/semantic-graph.js +245 -0
- package/dist/project/stage-gate.js +4 -4
- package/dist/schema/call/allocation.d.ts +11 -11
- package/dist/schema/call/allocation.js +13 -3
- package/dist/schema/call/arbitration.d.ts +21 -21
- package/dist/schema/call/arbitration.js +30 -9
- package/dist/schema/call/base.d.ts +2 -2
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +127 -127
- package/dist/schema/call/bridge.js +12 -12
- package/dist/schema/call/contact.d.ts +3 -3
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.d.ts +3 -3
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.d.ts +11 -11
- package/dist/schema/call/guard.js +2 -2
- package/dist/schema/call/machine.d.ts +2072 -679
- package/dist/schema/call/machine.js +51 -5
- package/dist/schema/call/order.d.ts +7 -7
- package/dist/schema/call/order.js +3 -6
- package/dist/schema/call/payment.d.ts +3 -3
- package/dist/schema/call/permission.d.ts +3 -3
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/personal.d.ts +337 -3
- package/dist/schema/call/personal.js +10 -0
- package/dist/schema/call/progress.d.ts +177 -9
- package/dist/schema/call/progress.js +7 -3
- package/dist/schema/call/proof.d.ts +6 -6
- package/dist/schema/call/repository.d.ts +3 -3
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.d.ts +57 -57
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.js +48 -2
- package/dist/schema/call/service.d.ts +285 -113
- package/dist/schema/call/service.js +92 -28
- package/dist/schema/call/treasury.d.ts +57 -57
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +2 -0
- package/dist/schema/common/index.js +46 -10
- package/dist/schema/local/index.js +5 -1
- package/dist/schema/messenger/index.js +4 -1
- package/dist/schema/operations.d.ts +1318 -317
- package/dist/schema/operations.js +76 -7
- package/dist/schema/project/index.d.ts +5662 -164
- package/dist/schema/project/index.js +1136 -5
- package/dist/schema/query/index.d.ts +580 -19
- package/dist/schema/query/index.js +88 -36
- package/dist/schema/schema-query/index.d.ts +59 -3
- package/dist/schema/schema-query/index.js +45 -6
- package/dist/schema/trust/index.d.ts +1012 -6
- package/dist/schema/trust/index.js +212 -11
- package/dist/schema/utils/node-parser.js +13 -0
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +77 -0
- package/dist/schema-query/index.d.ts +17 -1
- package/dist/schema-query/index.js +359 -3
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/bridge_operation.schema.json +14 -7
- package/dist/schemas/guard2file.schema.json +2 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +2 -0
- package/dist/schemas/messenger_operation.schema.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +255 -65
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +14 -10
- package/dist/schemas/onchain_operations_contact.schema.json +4 -3
- package/dist/schemas/onchain_operations_demand.schema.json +4 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -2
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
- package/dist/schemas/onchain_operations_guard.schema.json +579 -1
- package/dist/schemas/onchain_operations_machine.schema.json +5 -4
- package/dist/schemas/onchain_operations_order.schema.json +7 -6
- package/dist/schemas/onchain_operations_payment.schema.json +2 -1
- package/dist/schemas/onchain_operations_permission.schema.json +3 -2
- package/dist/schemas/onchain_operations_personal.schema.json +37 -0
- package/dist/schemas/onchain_operations_progress.schema.json +91 -4
- package/dist/schemas/onchain_operations_proof.schema.json +2 -1
- package/dist/schemas/onchain_operations_repository.schema.json +4 -3
- package/dist/schemas/onchain_operations_reward.schema.json +7 -6
- package/dist/schemas/onchain_operations_service.schema.json +80 -19
- package/dist/schemas/onchain_operations_treasury.schema.json +5 -4
- package/dist/schemas/onchain_table_data.output.json +1 -1
- package/dist/schemas/onchain_table_data.schema.json +10 -9
- package/dist/schemas/project_operation.output.json +3318 -57
- package/dist/schemas/project_operation.schema.json +728 -4
- package/dist/schemas/query_toolkit.output.json +16 -16
- package/dist/schemas/query_toolkit.schema.json +40 -3
- package/dist/schemas/schema_query.output.json +65 -2
- package/dist/schemas/schema_query.schema.json +31 -5
- package/dist/schemas/trust_score.output.json +392 -1
- package/dist/schemas/trust_score.schema.json +275 -1
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/onchain.js +636 -6
- package/dist/tools/handlers/project.js +71 -2
- package/dist/tools/handlers/query.js +117 -2
- package/dist/tools/handlers/schema-query.js +65 -1
- package/dist/tools/handlers/trust.js +192 -6
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +229 -15
- package/dist/tools/wrap.js +194 -15
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserModeStorage } from "@wowok/wowok";
|
|
1
2
|
import { CapabilityRegistry } from "./capability-manifest.js";
|
|
2
3
|
import { ModeEvaluator } from "./mode-evaluator.js";
|
|
3
4
|
import { MetricRegistry } from "./metric-registry.js";
|
|
@@ -10,6 +11,8 @@ export class IndustryModeRegistry {
|
|
|
10
11
|
aliases = new Map();
|
|
11
12
|
evaluator;
|
|
12
13
|
initialized = false;
|
|
14
|
+
persistence = new UserModeStorage();
|
|
15
|
+
userModesLoaded = false;
|
|
13
16
|
static Instance() {
|
|
14
17
|
if (!IndustryModeRegistry.instance) {
|
|
15
18
|
IndustryModeRegistry.instance = new IndustryModeRegistry();
|
|
@@ -100,7 +103,8 @@ export class IndustryModeRegistry {
|
|
|
100
103
|
}
|
|
101
104
|
return this.evaluator.evaluateMigration(source, target);
|
|
102
105
|
}
|
|
103
|
-
registerUserMode(mode, userId) {
|
|
106
|
+
async registerUserMode(mode, userId) {
|
|
107
|
+
await this.ensureUserModesLoaded();
|
|
104
108
|
if (!mode.name || !mode.owner || !mode.machine_shape)
|
|
105
109
|
return false;
|
|
106
110
|
if (mode.source !== "custom")
|
|
@@ -116,13 +120,15 @@ export class IndustryModeRegistry {
|
|
|
116
120
|
mode.evolution_history = [{
|
|
117
121
|
version: mode.version || "v1",
|
|
118
122
|
changed_at: Date.now(),
|
|
119
|
-
changes: ["
|
|
123
|
+
changes: ["Initial registration (registerUserMode)"],
|
|
120
124
|
}];
|
|
121
125
|
}
|
|
122
126
|
this.userModes.set(userKey, mode);
|
|
127
|
+
await this.persistUserMode(mode);
|
|
123
128
|
return true;
|
|
124
129
|
}
|
|
125
|
-
deriveMode(sourceMode, modifications, userId, newName, newDisplayName) {
|
|
130
|
+
async deriveMode(sourceMode, modifications, userId, newName, newDisplayName) {
|
|
131
|
+
await this.ensureUserModesLoaded();
|
|
126
132
|
const source = this.getMode(sourceMode);
|
|
127
133
|
if (!source)
|
|
128
134
|
return undefined;
|
|
@@ -161,13 +167,15 @@ export class IndustryModeRegistry {
|
|
|
161
167
|
evolution_history: [{
|
|
162
168
|
version: "v1",
|
|
163
169
|
changed_at: Date.now(),
|
|
164
|
-
changes: [
|
|
170
|
+
changes: [`Derived from builtin '${sourceMode}'`],
|
|
165
171
|
}],
|
|
166
172
|
};
|
|
167
173
|
this.userModes.set(userKey, derived);
|
|
174
|
+
await this.persistUserMode(derived);
|
|
168
175
|
return derived;
|
|
169
176
|
}
|
|
170
|
-
evolveMode(modeName, updates, userId, changeDescription, bumpVersion = true) {
|
|
177
|
+
async evolveMode(modeName, updates, userId, changeDescription, bumpVersion = true) {
|
|
178
|
+
await this.ensureUserModesLoaded();
|
|
171
179
|
const userKey = this.userModeKey(userId, modeName);
|
|
172
180
|
const existing = this.userModes.get(userKey);
|
|
173
181
|
if (!existing)
|
|
@@ -193,9 +201,11 @@ export class IndustryModeRegistry {
|
|
|
193
201
|
version: newVersion,
|
|
194
202
|
};
|
|
195
203
|
this.userModes.set(userKey, evolved);
|
|
204
|
+
await this.persistUserMode(evolved);
|
|
196
205
|
return evolved;
|
|
197
206
|
}
|
|
198
|
-
listUserModes(userId) {
|
|
207
|
+
async listUserModes(userId) {
|
|
208
|
+
await this.ensureUserModesLoaded();
|
|
199
209
|
const result = [];
|
|
200
210
|
for (const mode of this.userModes.values()) {
|
|
201
211
|
if (mode.owner === userId) {
|
|
@@ -204,26 +214,71 @@ export class IndustryModeRegistry {
|
|
|
204
214
|
}
|
|
205
215
|
return result;
|
|
206
216
|
}
|
|
207
|
-
getUserMode(modeName, userId) {
|
|
217
|
+
async getUserMode(modeName, userId) {
|
|
218
|
+
await this.ensureUserModesLoaded();
|
|
208
219
|
const userKey = this.userModeKey(userId, modeName);
|
|
209
220
|
return this.userModes.get(userKey);
|
|
210
221
|
}
|
|
211
|
-
unregisterUserMode(modeName, userId) {
|
|
222
|
+
async unregisterUserMode(modeName, userId) {
|
|
223
|
+
await this.ensureUserModesLoaded();
|
|
212
224
|
const userKey = this.userModeKey(userId, modeName);
|
|
213
|
-
|
|
225
|
+
const removed = this.userModes.delete(userKey);
|
|
226
|
+
if (removed) {
|
|
227
|
+
await this.unpersistUserMode(userId, modeName);
|
|
228
|
+
}
|
|
229
|
+
return removed;
|
|
214
230
|
}
|
|
215
231
|
userModeKey(owner, name) {
|
|
216
232
|
return `${owner}:${name}`;
|
|
217
233
|
}
|
|
234
|
+
async ensureUserModesLoaded() {
|
|
235
|
+
if (this.userModesLoaded)
|
|
236
|
+
return;
|
|
237
|
+
this.userModesLoaded = true;
|
|
238
|
+
try {
|
|
239
|
+
const rows = await this.persistence.list();
|
|
240
|
+
for (const row of rows) {
|
|
241
|
+
try {
|
|
242
|
+
const mode = JSON.parse(row.data);
|
|
243
|
+
if (mode?.name && mode?.owner && mode?.machine_shape) {
|
|
244
|
+
this.userModes.set(this.userModeKey(row.owner, row.name), mode);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
console.warn(`[IndustryModeRegistry] Skipping corrupt user_modes row '${row.owner}:${row.name}'.`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
console.warn("[IndustryModeRegistry] Failed to load persisted user modes:", err.message);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
async persistUserMode(mode) {
|
|
257
|
+
try {
|
|
258
|
+
await this.persistence.save(mode.owner, mode.name, JSON.stringify(mode));
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
console.warn(`[IndustryModeRegistry] Failed to persist user mode '${mode.owner}:${mode.name}':`, err.message);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async unpersistUserMode(owner, name) {
|
|
265
|
+
try {
|
|
266
|
+
await this.persistence.delete(owner, name);
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
console.warn(`[IndustryModeRegistry] Failed to delete persisted user mode '${owner}:${name}':`, err.message);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
218
272
|
bumpPatchVersion(version) {
|
|
219
|
-
const
|
|
273
|
+
const stripped = version.replace(/^v/, "");
|
|
274
|
+
const parts = stripped.split(".");
|
|
220
275
|
if (parts.length < 2)
|
|
221
|
-
return `v${
|
|
276
|
+
return `v${stripped}.1`;
|
|
222
277
|
const patch = parseInt(parts[1] ?? "0", 10);
|
|
223
278
|
parts[1] = String(patch + 1);
|
|
224
279
|
return `v${parts.join(".")}`;
|
|
225
280
|
}
|
|
226
|
-
applyTemplate(name, intent, context) {
|
|
281
|
+
async applyTemplate(name, intent, context) {
|
|
227
282
|
const builtinMode = this.getMode(name);
|
|
228
283
|
if (builtinMode) {
|
|
229
284
|
const blueprint = this.doApplyTemplate(builtinMode, intent, context);
|
|
@@ -232,7 +287,7 @@ export class IndustryModeRegistry {
|
|
|
232
287
|
}
|
|
233
288
|
if (name.includes(":")) {
|
|
234
289
|
const [owner, modeName] = name.split(":", 2);
|
|
235
|
-
const userMode = this.getUserMode(modeName, owner);
|
|
290
|
+
const userMode = await this.getUserMode(modeName, owner);
|
|
236
291
|
if (userMode) {
|
|
237
292
|
const blueprint = this.doApplyTemplate(userMode, intent, context);
|
|
238
293
|
this.recordCapabilitiesUsed(userMode);
|
|
@@ -247,8 +302,8 @@ export class IndustryModeRegistry {
|
|
|
247
302
|
this.recordCapabilitiesUsed(general);
|
|
248
303
|
return blueprint;
|
|
249
304
|
}
|
|
250
|
-
applyUserMode(modeName, userId, intent, context) {
|
|
251
|
-
const userMode = this.getUserMode(modeName, userId);
|
|
305
|
+
async applyUserMode(modeName, userId, intent, context) {
|
|
306
|
+
const userMode = await this.getUserMode(modeName, userId);
|
|
252
307
|
if (!userMode) {
|
|
253
308
|
throw new Error(`User mode '${modeName}' not found for user '${userId}'`);
|
|
254
309
|
}
|
|
@@ -333,22 +388,33 @@ export class IndustryModeRegistry {
|
|
|
333
388
|
const objects = [];
|
|
334
389
|
objects.push(this.makeObject("permission", `${prefix}_permission`, {
|
|
335
390
|
name: `${prefix}_permission`,
|
|
336
|
-
description: `Permission:
|
|
391
|
+
description: `Permission: role permission index (${mode.display_name})`,
|
|
337
392
|
permission_indexes: this.buildPermissionIndexes(mode),
|
|
338
393
|
tags: [`industry:${mode.name}`],
|
|
339
394
|
}));
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
395
|
+
const serviceGuardName = this.getFirstServiceGuardName(mode, prefix);
|
|
396
|
+
for (const guard of mode.guards) {
|
|
397
|
+
const shortName = this.deriveGuardShortName(guard.template_id);
|
|
398
|
+
const guardName = `${prefix}_guard_${shortName}`;
|
|
399
|
+
objects.push(this.makeObject("guard", guardName, {
|
|
400
|
+
name: guardName,
|
|
401
|
+
description: `Guard: ${guard.purpose} (${mode.display_name})`,
|
|
402
|
+
host: guard.host,
|
|
403
|
+
template_id: guard.template_id,
|
|
404
|
+
tags: [`industry:${mode.name}`, `host:${guard.host}`],
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
347
407
|
objects.push(this.makeObject("machine", `${prefix}_machine`, {
|
|
348
408
|
name: `${prefix}_machine`,
|
|
349
|
-
description: `Machine:
|
|
409
|
+
description: `Machine: workflow topology (${mode.display_name}) — ${mode.machine_shape.length} nodes`,
|
|
350
410
|
nodes: mode.machine_shape.map(n => ({ name: n.name, role: n.role })),
|
|
351
|
-
|
|
411
|
+
guard_objects: mode.guards
|
|
412
|
+
.filter(g => g.host === "machine")
|
|
413
|
+
.map(g => ({
|
|
414
|
+
template_id: g.template_id,
|
|
415
|
+
object_name: `${prefix}_guard_${this.deriveGuardShortName(g.template_id)}`,
|
|
416
|
+
purpose: g.purpose,
|
|
417
|
+
})),
|
|
352
418
|
permission: `${prefix}_permission`,
|
|
353
419
|
entry_node_forward_hint: {
|
|
354
420
|
entry_node_name: mode.machine_shape[0]?.name ?? "paid",
|
|
@@ -366,31 +432,32 @@ export class IndustryModeRegistry {
|
|
|
366
432
|
}, true));
|
|
367
433
|
objects.push(this.makeObject("treasury", `${prefix}_treasury`, {
|
|
368
434
|
name: `${prefix}_treasury`,
|
|
369
|
-
description: `Treasury:
|
|
435
|
+
description: `Treasury: fund escrow (${mode.display_name})`,
|
|
370
436
|
owner_receive: true,
|
|
371
437
|
tags: [`industry:${mode.name}`],
|
|
372
438
|
}));
|
|
373
439
|
objects.push(this.makeObject("allocation", `${prefix}_allocation`, {
|
|
374
440
|
name: `${prefix}_allocation`,
|
|
375
|
-
description: `Allocation:
|
|
441
|
+
description: `Allocation: allocation strategy (${mode.display_name}) — ${mode.allocator.description}`,
|
|
376
442
|
strategy: mode.allocator,
|
|
377
443
|
treasury: `${prefix}_treasury`,
|
|
378
|
-
guard:
|
|
444
|
+
guard: serviceGuardName,
|
|
379
445
|
tags: [`industry:${mode.name}`],
|
|
380
446
|
}));
|
|
381
447
|
objects.push(this.makeObject("service", `${prefix}_service`, {
|
|
382
448
|
name: `${prefix}_service`,
|
|
383
|
-
description: `Service:
|
|
449
|
+
description: `Service: business service (${mode.display_name}) — ${intent.slice(0, 100)}`,
|
|
384
450
|
machine: `${prefix}_machine`,
|
|
385
|
-
buy_guard:
|
|
451
|
+
buy_guard: serviceGuardName,
|
|
386
452
|
permission: `${prefix}_permission`,
|
|
387
453
|
order_allocators: [`${prefix}_allocation`],
|
|
388
454
|
compensation_fund_balance: 0,
|
|
389
455
|
compensation_fund_required: mode.risk_constraints?.require_compensation_fund ?? false,
|
|
456
|
+
compensation_fund_coverage_ratio: mode.risk_constraints?.compensation_fund_coverage_ratio ?? 5,
|
|
390
457
|
compensation_fund_add_hint: "Call service.compensation_fund_add with a Coin<T> to deposit. " +
|
|
391
458
|
"The compensation_fund is a Balance<T> (numeric), not a Treasury object reference. " +
|
|
392
459
|
"Without deposit, arbitration rulings that award refunds to buyers cannot be paid out. " +
|
|
393
|
-
|
|
460
|
+
`Recommend ${mode.risk_constraints?.compensation_fund_coverage_ratio ?? 5}× the max single-order amount (P1-1 evaluation rule, industry: ${mode.name}).`,
|
|
394
461
|
arbitrations: [`${prefix}_arb`],
|
|
395
462
|
rewards: [`${prefix}_reward`],
|
|
396
463
|
business_intent: intent,
|
|
@@ -399,25 +466,25 @@ export class IndustryModeRegistry {
|
|
|
399
466
|
}, true));
|
|
400
467
|
objects.push(this.makeObject("progress", `${prefix}_progress`, {
|
|
401
468
|
name: `${prefix}_progress`,
|
|
402
|
-
description: `Progress:
|
|
469
|
+
description: `Progress: order fulfillment progress (${mode.display_name})`,
|
|
403
470
|
parent: `${prefix}_machine`,
|
|
404
471
|
tags: [`industry:${mode.name}`],
|
|
405
472
|
}));
|
|
406
473
|
objects.push(this.makeObject("arb", `${prefix}_arb`, {
|
|
407
474
|
name: `${prefix}_arb`,
|
|
408
|
-
description: `Arbitration:
|
|
475
|
+
description: `Arbitration: arbitration rules (${mode.display_name}) — ${mode.key_risk}`,
|
|
409
476
|
guard: `${prefix}_guard_buy`,
|
|
410
477
|
tags: [`industry:${mode.name}`],
|
|
411
478
|
}));
|
|
412
479
|
objects.push(this.makeObject("reward", `${prefix}_reward`, {
|
|
413
480
|
name: `${prefix}_reward`,
|
|
414
|
-
description: `Reward:
|
|
481
|
+
description: `Reward: incentive rules (${mode.display_name})`,
|
|
415
482
|
claim_guard: `${prefix}_guard_buy`,
|
|
416
483
|
tags: [`industry:${mode.name}`],
|
|
417
484
|
}));
|
|
418
485
|
objects.push(this.makeObject("contact", `${prefix}_contact`, {
|
|
419
486
|
name: `${prefix}_contact`,
|
|
420
|
-
description: `Contact:
|
|
487
|
+
description: `Contact: customer service contact (${mode.display_name})`,
|
|
421
488
|
tags: [`industry:${mode.name}`],
|
|
422
489
|
}));
|
|
423
490
|
return objects;
|
|
@@ -501,21 +568,21 @@ export class IndustryModeRegistry {
|
|
|
501
568
|
?? "";
|
|
502
569
|
const service = find(`${prefix}_service`);
|
|
503
570
|
const machine = find(`${prefix}_machine`);
|
|
504
|
-
const guard = find(`${prefix}_guard_buy`);
|
|
505
571
|
const permission = find(`${prefix}_permission`);
|
|
506
572
|
const allocation = find(`${prefix}_allocation`);
|
|
507
573
|
const treasury = find(`${prefix}_treasury`);
|
|
508
574
|
const arb = find(`${prefix}_arb`);
|
|
509
575
|
const reward = find(`${prefix}_reward`);
|
|
510
576
|
const progress = find(`${prefix}_progress`);
|
|
511
|
-
|
|
577
|
+
const allGuards = objects.filter(o => o.object_type === "guard");
|
|
578
|
+
const serviceGuard = allGuards.find(g => g.config?.host === "service");
|
|
579
|
+
const machineGuards = allGuards.filter(g => g.config?.host === "machine");
|
|
580
|
+
if (!service || !machine || !permission) {
|
|
512
581
|
const missing = [];
|
|
513
582
|
if (!service)
|
|
514
583
|
missing.push("service");
|
|
515
584
|
if (!machine)
|
|
516
585
|
missing.push("machine");
|
|
517
|
-
if (!guard)
|
|
518
|
-
missing.push("guard");
|
|
519
586
|
if (!permission)
|
|
520
587
|
missing.push("permission");
|
|
521
588
|
console.warn(`[buildEdges] Missing core objects: ${missing.join(", ")}. ` +
|
|
@@ -524,7 +591,9 @@ export class IndustryModeRegistry {
|
|
|
524
591
|
return edges;
|
|
525
592
|
}
|
|
526
593
|
edges.push(this.makeEdge(service, machine, "machine", "service.machine", true));
|
|
527
|
-
|
|
594
|
+
if (serviceGuard) {
|
|
595
|
+
edges.push(this.makeEdge(service, serviceGuard, "buy_guard", "service.buy_guard", true));
|
|
596
|
+
}
|
|
528
597
|
edges.push(this.makeEdge(service, permission, "permission", "service.permission", true));
|
|
529
598
|
if (allocation)
|
|
530
599
|
edges.push(this.makeEdge(service, allocation, "order_allocators", "service.order_allocators", true));
|
|
@@ -533,12 +602,15 @@ export class IndustryModeRegistry {
|
|
|
533
602
|
if (reward)
|
|
534
603
|
edges.push(this.makeEdge(service, reward, "rewards", "service.rewards", false));
|
|
535
604
|
edges.push(this.makeEdge(machine, permission, "permission", "machine.permission", false));
|
|
605
|
+
for (const mg of machineGuards) {
|
|
606
|
+
edges.push(this.makeEdge(machine, mg, "guard", "machine.forwards.guard", false));
|
|
607
|
+
}
|
|
536
608
|
if (progress)
|
|
537
609
|
edges.push(this.makeEdge(progress, machine, "parent", "progress.parent", false));
|
|
538
610
|
if (allocation && treasury)
|
|
539
611
|
edges.push(this.makeEdge(allocation, treasury, "treasury", "allocation.treasury", false));
|
|
540
|
-
if (allocation &&
|
|
541
|
-
edges.push(this.makeEdge(allocation,
|
|
612
|
+
if (allocation && serviceGuard)
|
|
613
|
+
edges.push(this.makeEdge(allocation, serviceGuard, "buy_guard", "allocation.guard", false));
|
|
542
614
|
return edges;
|
|
543
615
|
}
|
|
544
616
|
makeEdge(from, to, edge_kind, field_path, required_at_publish) {
|
|
@@ -590,7 +662,7 @@ export class IndustryModeRegistry {
|
|
|
590
662
|
const service = objects.find(o => o.object_type === "service");
|
|
591
663
|
return [{
|
|
592
664
|
scenario_id: `${mode.name}_primary`,
|
|
593
|
-
description: `${mode.display_name}
|
|
665
|
+
description: `${mode.display_name} main flow: ${intent.slice(0, 80)}`,
|
|
594
666
|
primary_object: service?.entry_id ?? "",
|
|
595
667
|
supporting_objects: objects.filter(o => o.object_type !== "service").map(o => o.entry_id),
|
|
596
668
|
}];
|
|
@@ -607,6 +679,22 @@ export class IndustryModeRegistry {
|
|
|
607
679
|
catch {
|
|
608
680
|
}
|
|
609
681
|
}
|
|
682
|
+
deriveGuardShortName(templateId) {
|
|
683
|
+
if (templateId.startsWith("tpl_")) {
|
|
684
|
+
const parts = templateId.split("_");
|
|
685
|
+
return parts[parts.length - 1] || templateId;
|
|
686
|
+
}
|
|
687
|
+
const match = templateId.match(/^([a-z]+)_guard_/);
|
|
688
|
+
if (match)
|
|
689
|
+
return match[1];
|
|
690
|
+
return templateId.split("_")[0] || templateId;
|
|
691
|
+
}
|
|
692
|
+
getFirstServiceGuardName(mode, prefix) {
|
|
693
|
+
const serviceGuard = mode.guards.find(g => g.host === "service");
|
|
694
|
+
if (!serviceGuard)
|
|
695
|
+
return "";
|
|
696
|
+
return `${prefix}_guard_${this.deriveGuardShortName(serviceGuard.template_id)}`;
|
|
697
|
+
}
|
|
610
698
|
makeObject(type, name, config, publish_required = false) {
|
|
611
699
|
return {
|
|
612
700
|
entry_id: `${type}:${name}`,
|
|
@@ -626,4 +714,4 @@ export class IndustryModeRegistry {
|
|
|
626
714
|
export function getIndustryModeRegistry() {
|
|
627
715
|
return IndustryModeRegistry.Instance();
|
|
628
716
|
}
|
|
629
|
-
export const INDUSTRY_MODE_REGISTRY_VERSION = 2.
|
|
717
|
+
export const INDUSTRY_MODE_REGISTRY_VERSION = 2.2;
|
|
@@ -68,6 +68,7 @@ export interface ModeRiskConstraints {
|
|
|
68
68
|
require_compensation_fund: boolean;
|
|
69
69
|
require_wip_evidence: boolean;
|
|
70
70
|
max_single_transaction?: number;
|
|
71
|
+
compensation_fund_coverage_ratio?: number;
|
|
71
72
|
other_constraints?: string[];
|
|
72
73
|
}
|
|
73
74
|
export interface ModeApplicableConditions {
|
|
@@ -110,6 +111,7 @@ export interface IndustryMode {
|
|
|
110
111
|
applicable_conditions: ModeApplicableConditions;
|
|
111
112
|
similar_industries?: string[];
|
|
112
113
|
novel_capabilities?: string[];
|
|
114
|
+
disabled_builtin_constraints?: string[];
|
|
113
115
|
}
|
|
114
116
|
export interface UserDefinedMode extends IndustryMode {
|
|
115
117
|
owner: string;
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,47 @@ import { registerAllTools } from "./tools/index.js";
|
|
|
14
14
|
if (process.env.WOWOK_TELEMETRY === "false" || process.env.WOWOK_TELEMETRY === "0") {
|
|
15
15
|
setTelemetryEnabled(false);
|
|
16
16
|
}
|
|
17
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
18
|
+
const reasonStr = reason instanceof Error
|
|
19
|
+
? `${reason.name}: ${reason.message}\n${reason.stack ?? ""}`
|
|
20
|
+
: String(reason);
|
|
21
|
+
console.error(`[unhandledRejection] ${new Date().toISOString()}`);
|
|
22
|
+
console.error(` reason: ${reasonStr}`);
|
|
23
|
+
});
|
|
24
|
+
process.on("uncaughtException", (error) => {
|
|
25
|
+
console.error(`[uncaughtException] ${new Date().toISOString()}`);
|
|
26
|
+
console.error(` name: ${error.name}`);
|
|
27
|
+
console.error(` message: ${error.message}`);
|
|
28
|
+
console.error(` stack: ${error.stack ?? ""}`);
|
|
29
|
+
});
|
|
30
|
+
process.on("beforeExit", (code) => {
|
|
31
|
+
console.error(`[beforeExit] ${new Date().toISOString()} code=${code} — event loop empty, process would exit`);
|
|
32
|
+
console.error(` active handles: ${process._getActiveHandles?.()?.length ?? "?"}`);
|
|
33
|
+
console.error(` active requests: ${process._getActiveRequests?.()?.length ?? "?"}`);
|
|
34
|
+
});
|
|
35
|
+
process.on("exit", (code) => {
|
|
36
|
+
console.error(`[exit] ${new Date().toISOString()} code=${code} — process exiting`);
|
|
37
|
+
});
|
|
38
|
+
process.stdin.on("end", () => {
|
|
39
|
+
console.error(`[stdin end] ${new Date().toISOString()} — MCP client closed stdin`);
|
|
40
|
+
});
|
|
41
|
+
process.stdin.on("close", () => {
|
|
42
|
+
console.error(`[stdin close] ${new Date().toISOString()} — stdin stream closed`);
|
|
43
|
+
});
|
|
44
|
+
let keepaliveTimer = null;
|
|
45
|
+
function startKeepalive() {
|
|
46
|
+
if (keepaliveTimer)
|
|
47
|
+
return;
|
|
48
|
+
keepaliveTimer = setInterval(() => {
|
|
49
|
+
const mem = process.memoryUsage();
|
|
50
|
+
const heapUsedMB = Math.round(mem.heapUsed / 1024 / 1024);
|
|
51
|
+
const heapTotalMB = Math.round(mem.heapTotal / 1024 / 1024);
|
|
52
|
+
const rssMB = Math.round(mem.rss / 1024 / 1024);
|
|
53
|
+
const level = heapUsedMB > 1200 ? "WARNING" : heapUsedMB > 800 ? "INFO" : "DEBUG";
|
|
54
|
+
console.error(`[memory ${level}] heap=${heapUsedMB}MB/${heapTotalMB}MB rss=${rssMB}MB`);
|
|
55
|
+
}, 60_000);
|
|
56
|
+
}
|
|
57
|
+
startKeepalive();
|
|
17
58
|
const SERVER_DESCRIPTION = `WoWok MCP Server - Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
|
|
18
59
|
|
|
19
60
|
## CRITICAL: Unified Single-Tool Architecture
|
|
@@ -210,5 +251,14 @@ async function main() {
|
|
|
210
251
|
await server.close();
|
|
211
252
|
process.exit(0);
|
|
212
253
|
});
|
|
254
|
+
process.on("SIGTERM", async () => {
|
|
255
|
+
console.error(`[SIGTERM] ${new Date().toISOString()} — graceful shutdown`);
|
|
256
|
+
try {
|
|
257
|
+
await server.close();
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
}
|
|
261
|
+
process.exit(0);
|
|
262
|
+
});
|
|
213
263
|
}
|
|
214
264
|
main().catch(console.error);
|
|
@@ -672,7 +672,7 @@ export function analyzeMachineAndServiceReadiness(input) {
|
|
|
672
672
|
add(findings, "D-20", "warning", `No Service block in the deployment doc includes a compensation_fund_add step. ` +
|
|
673
673
|
`Without deposit, arbitration rulings that award refunds to buyers cannot be paid out from the Service. ` +
|
|
674
674
|
`Industries like freelance may not require this (info), but rental/travel/education typically do.`, "§3.2 / §4.2 Service blocks", `Add a compensation_fund_add step for the Service (e.g., data.compensation_fund_add = {balance: <amount>}). ` +
|
|
675
|
-
`Recommended:
|
|
675
|
+
`Recommended: 3-10× the max single-order amount, depending on industry (subscription: 3×, retail: 5×, rental: 10×). See P1-1 evaluation rule.`);
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ENTRYPOINT } from "@wowok/wowok";
|
|
2
|
+
export interface OfficialTokenEntry {
|
|
3
|
+
type: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export type TokenNetwork = "gas" | "testnet" | "mainnet";
|
|
10
|
+
export declare const OFFICIAL_TOKEN_REGISTRY: Record<TokenNetwork, OfficialTokenEntry[]>;
|
|
11
|
+
export declare function getRegistryForNetwork(network?: string): OfficialTokenEntry[];
|
|
12
|
+
export type TokenSource = "registry" | "cache" | "onchain";
|
|
13
|
+
export interface TokenResolution {
|
|
14
|
+
type: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
name: string;
|
|
18
|
+
source: TokenSource;
|
|
19
|
+
verified: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function findInRegistryByType(tokenType: string, network?: string): OfficialTokenEntry | undefined;
|
|
22
|
+
export declare function findInRegistryBySymbol(symbol: string, network?: string): OfficialTokenEntry[];
|
|
23
|
+
export declare function resolveTokenByType(tokenType: string, network?: ENTRYPOINT): Promise<TokenResolution | undefined>;
|
|
24
|
+
export declare function resolveTokensBySymbol(symbol: string, network?: ENTRYPOINT, preferredType?: string): Promise<TokenResolution[]>;
|
|
25
|
+
export interface ParsedAmount {
|
|
26
|
+
smallestUnit: bigint;
|
|
27
|
+
displayAmount: string;
|
|
28
|
+
originalInput: string | number;
|
|
29
|
+
tokenType: string;
|
|
30
|
+
tokenSymbol: string;
|
|
31
|
+
decimals: number;
|
|
32
|
+
converted: boolean;
|
|
33
|
+
source: TokenSource;
|
|
34
|
+
verified: boolean;
|
|
35
|
+
precision_known: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function isAmountWithSymbol(value: unknown): boolean;
|
|
38
|
+
export declare function parseAmount(amount: string | number, tokenType: string, network?: ENTRYPOINT): Promise<ParsedAmount>;
|
|
39
|
+
export declare function smallestToDisplay(value: bigint, decimals: number): string;
|
|
40
|
+
export declare function displayStringToSmallest(display: string, decimals: number): bigint;
|
|
41
|
+
export interface FundFieldConfirmation {
|
|
42
|
+
path: string;
|
|
43
|
+
displayAmount: string;
|
|
44
|
+
tokenType: string;
|
|
45
|
+
tokenSymbol: string;
|
|
46
|
+
verified: boolean;
|
|
47
|
+
source: TokenSource;
|
|
48
|
+
converted: boolean;
|
|
49
|
+
context: string;
|
|
50
|
+
}
|
|
51
|
+
export interface TokenAmbiguity {
|
|
52
|
+
symbol: string;
|
|
53
|
+
candidates: {
|
|
54
|
+
type: string;
|
|
55
|
+
decimals: number;
|
|
56
|
+
source: TokenSource;
|
|
57
|
+
verified: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
}
|
|
60
|
+
export interface FundConfirmationRequest {
|
|
61
|
+
requiresConfirmation: boolean;
|
|
62
|
+
reason: string;
|
|
63
|
+
fields: FundFieldConfirmation[];
|
|
64
|
+
ambiguities: TokenAmbiguity[];
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function generateFundConfirmation(fields: FundFieldConfirmation[], ambiguities?: TokenAmbiguity[]): FundConfirmationRequest;
|
|
68
|
+
export interface FundProcessResult {
|
|
69
|
+
convertedData: any;
|
|
70
|
+
warnings: string[];
|
|
71
|
+
errors: string[];
|
|
72
|
+
confirmation: FundConfirmationRequest | null;
|
|
73
|
+
}
|
|
74
|
+
export interface FundProcessOptions {
|
|
75
|
+
objectTokenType?: string;
|
|
76
|
+
}
|
|
77
|
+
export declare function processFundOperation(data: any, operationType: string, network?: ENTRYPOINT, options?: FundProcessOptions): Promise<FundProcessResult>;
|
|
78
|
+
export declare function generateSkillsHint(confirmation: FundConfirmationRequest | null): string | null;
|
|
79
|
+
export interface ChainValueDisplay {
|
|
80
|
+
raw: string;
|
|
81
|
+
display: string;
|
|
82
|
+
symbol?: string;
|
|
83
|
+
decimals?: number;
|
|
84
|
+
token_type: string;
|
|
85
|
+
precision_known: boolean;
|
|
86
|
+
text: string;
|
|
87
|
+
}
|
|
88
|
+
export declare function formatChainValue(raw: string | number | bigint, tokenType: string, network?: ENTRYPOINT): Promise<ChainValueDisplay>;
|
|
89
|
+
export interface TokenDisplayHint {
|
|
90
|
+
decimals?: number;
|
|
91
|
+
symbol?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare function registryDisplayHint(tokenType: string | undefined, network?: string): TokenDisplayHint | undefined;
|
|
94
|
+
export declare function clearFundResolutionCaches(): void;
|
|
95
|
+
export declare function knownTokenSuggestions(network?: string): string;
|
|
96
|
+
export declare function formatAmountText(raw: string | number | bigint, decimals?: number, symbol?: string): string;
|
|
97
|
+
export interface TokenValueConversion {
|
|
98
|
+
token_type: string;
|
|
99
|
+
symbol?: string;
|
|
100
|
+
decimals?: number;
|
|
101
|
+
precision_known: boolean;
|
|
102
|
+
direction: "raw_to_unit" | "unit_to_raw";
|
|
103
|
+
input: string;
|
|
104
|
+
output: string;
|
|
105
|
+
error?: string;
|
|
106
|
+
text: string;
|
|
107
|
+
}
|
|
108
|
+
export declare function convertTokenValue(tokenType: string, value: {
|
|
109
|
+
raw?: string | number | bigint;
|
|
110
|
+
unit?: string | number;
|
|
111
|
+
}, network?: ENTRYPOINT): Promise<TokenValueConversion>;
|
|
112
|
+
export declare const TOKEN_GENERIC_OBJECT_TYPES: readonly string[];
|
|
113
|
+
export declare function extractGenericTokenType(typeRaw: string | null | undefined): string | undefined;
|
|
114
|
+
export interface ObjectTokenResolution {
|
|
115
|
+
tokenType?: string;
|
|
116
|
+
objectType?: string;
|
|
117
|
+
typeRaw?: string;
|
|
118
|
+
}
|
|
119
|
+
export declare function resolveObjectTokenType(objectRef: string, network?: ENTRYPOINT): Promise<ObjectTokenResolution | undefined>;
|
|
120
|
+
export declare function resolveOperationObjectTokenType(data: any, operationType: string, network?: ENTRYPOINT): Promise<string | undefined>;
|
|
121
|
+
export interface TokenMatchValidation {
|
|
122
|
+
errors: string[];
|
|
123
|
+
warnings: string[];
|
|
124
|
+
objectTokenType?: string;
|
|
125
|
+
}
|
|
126
|
+
export declare function validateOperationTokenMatch(data: any, operationType: string, objectTokenType?: string, network?: ENTRYPOINT): Promise<TokenMatchValidation>;
|
|
127
|
+
export declare function annotateObjectMonetaryFields(obj: any, network?: ENTRYPOINT): Promise<void>;
|
|
128
|
+
export declare function resolveParentObjectTokenType(parentRef: string, network?: ENTRYPOINT): Promise<string | undefined>;
|
|
129
|
+
export declare function annotateTableItemMonetaryFields(item: any, parentTokenType: string | undefined, network?: ENTRYPOINT): Promise<void>;
|
|
130
|
+
export declare function annotateEventMonetaryFields(event: any, network?: ENTRYPOINT): Promise<void>;
|
|
131
|
+
export declare function annotateEventsMonetaryFields(events: any[], network?: ENTRYPOINT): Promise<void>;
|
|
132
|
+
export declare function annotateBalanceChanges(changes: any[], network?: ENTRYPOINT): Promise<void>;
|
|
133
|
+
export interface PreparedFundOperation extends FundProcessResult {
|
|
134
|
+
matchErrors: string[];
|
|
135
|
+
objectTokenType?: string;
|
|
136
|
+
blockingErrors: string[];
|
|
137
|
+
}
|
|
138
|
+
export declare function prepareFundOperation(data: any, operationType: string, network?: ENTRYPOINT): Promise<PreparedFundOperation>;
|