@wowok/agent-mcp 2.6.8 → 2.6.9
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.js +1 -0
- package/dist/customer/info-puzzle.js +1 -0
- package/dist/customer/reminder-system.d.ts +1 -0
- package/dist/customer/reminder-system.js +20 -0
- package/dist/customer/types.d.ts +1 -0
- package/dist/examples/{insurance-machine-create-publish.json → insurance-machine-create.json} +9 -9
- package/dist/examples/insurance-service-allocators.json +55 -0
- package/dist/examples/machine-publish.json +30 -0
- package/dist/examples/rental-ziroom-service-create.json +12 -64
- package/dist/examples/retail-myshop-service-create.json +14 -64
- package/dist/examples/retail-myshop-service-customer-required.json +31 -0
- package/dist/examples/threebody-machine-create.json +9 -10
- package/dist/examples/threebody-service-allocators.json +3 -4
- package/dist/examples/travel-machine-create.json +9 -10
- package/dist/examples/travel-service-create.json +11 -79
- package/dist/harness/index.d.ts +6 -1
- package/dist/harness/index.js +4 -1
- package/dist/harness/plan.d.ts +13 -0
- package/dist/harness/plan.js +24 -0
- package/dist/harness/recover.js +2 -2
- package/dist/index.js +10 -0
- package/dist/project/context-assembly.d.ts +9 -0
- package/dist/project/context-assembly.js +122 -6
- package/dist/project/graph-builder.d.ts +6 -1
- package/dist/project/graph-builder.js +1 -1
- package/dist/project/handlers.d.ts +1 -0
- package/dist/project/handlers.js +22 -9
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/payment.d.ts +11 -11
- package/dist/schema/call/payment.js +5 -3
- package/dist/schema/call/semantic.js +10 -1
- package/dist/schema/call/service.d.ts +6 -6
- package/dist/schema/call/service.js +14 -3
- package/dist/schema/operations.d.ts +11 -11
- package/dist/schema/project/index.d.ts +105 -0
- package/dist/schema/project/index.js +53 -0
- package/dist/schema/query/index.d.ts +571 -0
- package/dist/schema/query/index.js +42 -1
- package/dist/schema/sync-layer4.js +25 -4
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +7 -8
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_payment.schema.json +3 -4
- package/dist/schemas/onchain_operations_service.schema.json +3 -3
- package/dist/schemas/project_operation.output.json +79 -0
- package/dist/schemas/project_operation.schema.json +13 -0
- package/dist/schemas/query_toolkit.output.json +39 -1
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/tools/handlers/onchain.js +94 -4
- package/dist/tools/index.js +3 -3
- package/package.json +2 -2
- package/dist/examples/insurance-service-allocators-publish.json +0 -56
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { resolve } from "path";
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
2
|
+
import { resolve, dirname, join } from "path";
|
|
3
|
+
import { getWowMcpDir } from "@wowok/wowok";
|
|
3
4
|
import { CallService, CallMachine, CallProgress, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, CallProof, gen_proof, ResponseData, LocalProject, LocalMark, query_objects, parseGuardFile, formatGuardParseErrors, transformRewardInput, transformPersonalInput, } from "@wowok/wowok";
|
|
4
5
|
import { OnchainOperationsSchema, strictParse, getEnvConfig, handleCallResult, checkClientSchemaCompatibility, parseMachineNodesFromText, formatNodeErrors as formatMachineNodeErrors, transformSubmission, } from "../../schema/index.js";
|
|
5
6
|
import { handlePermissionOperations } from "../../schema/call/permission-handler.js";
|
|
@@ -9,6 +10,86 @@ import { getSkillsHintForOnchain } from "../../schema/utils/skills-recommendatio
|
|
|
9
10
|
import { prepareFundOperation, generateSkillsHint as generateFundSkillsHint } from "../../knowledge/fund-layer.js";
|
|
10
11
|
import { generateGuardSubmissionPrompt, formatSubmissionPrompt } from "../../knowledge/guard-submission-prompt.js";
|
|
11
12
|
import { withHarness } from "../shared.js";
|
|
13
|
+
const REFERRER_FILE = join(getWowMcpDir(), "referrer");
|
|
14
|
+
function readStoredReferrer() {
|
|
15
|
+
try {
|
|
16
|
+
if (!existsSync(REFERRER_FILE))
|
|
17
|
+
return null;
|
|
18
|
+
const v = readFileSync(REFERRER_FILE, "utf8").trim();
|
|
19
|
+
return v || null;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const PROJECT_SKILL_DIRS = [
|
|
26
|
+
".claude/skills",
|
|
27
|
+
".agents/skills",
|
|
28
|
+
".cursor/rules",
|
|
29
|
+
".github/prompts",
|
|
30
|
+
".windsurf/skills",
|
|
31
|
+
".codex/skills",
|
|
32
|
+
".qoder/skills",
|
|
33
|
+
".roo/skills",
|
|
34
|
+
".codebuddy/skills",
|
|
35
|
+
];
|
|
36
|
+
const PROJECT_SKILL_MARKERS = [
|
|
37
|
+
"wowok-provider",
|
|
38
|
+
"wowok-arbitrator",
|
|
39
|
+
"wowok-order",
|
|
40
|
+
"wowok-messenger",
|
|
41
|
+
"wowok-machine",
|
|
42
|
+
"wowok-output",
|
|
43
|
+
"wowok-onboard",
|
|
44
|
+
"wowok-planner",
|
|
45
|
+
"wowok-auditor",
|
|
46
|
+
];
|
|
47
|
+
const SKILLS_HINT_FILE = join(getWowMcpDir(), "skills-hint-asked.json");
|
|
48
|
+
function projectHasSkills(cwd) {
|
|
49
|
+
for (const dir of PROJECT_SKILL_DIRS) {
|
|
50
|
+
for (const marker of PROJECT_SKILL_MARKERS) {
|
|
51
|
+
if (existsSync(join(cwd, dir, marker)))
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
function loadSkillsAsked() {
|
|
58
|
+
try {
|
|
59
|
+
if (!existsSync(SKILLS_HINT_FILE))
|
|
60
|
+
return {};
|
|
61
|
+
return JSON.parse(readFileSync(SKILLS_HINT_FILE, "utf8")) ?? {};
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function persistSkillsAsked(cwd) {
|
|
68
|
+
try {
|
|
69
|
+
const map = loadSkillsAsked();
|
|
70
|
+
map[cwd] = true;
|
|
71
|
+
mkdirSync(dirname(SKILLS_HINT_FILE), { recursive: true });
|
|
72
|
+
writeFileSync(SKILLS_HINT_FILE, JSON.stringify(map, null, 2), "utf8");
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function getProjectSkillsHint() {
|
|
78
|
+
try {
|
|
79
|
+
const cwd = process.cwd();
|
|
80
|
+
if (!cwd || projectHasSkills(cwd))
|
|
81
|
+
return null;
|
|
82
|
+
const asked = loadSkillsAsked();
|
|
83
|
+
if (asked[cwd])
|
|
84
|
+
return null;
|
|
85
|
+
persistSkillsAsked(cwd);
|
|
86
|
+
return ("WoWok skills are not installed in this project. Run `wowok-skills init` " +
|
|
87
|
+
"here to install them (the MCP works regardless; skills improve AI orchestration).");
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
12
93
|
function formatRecipientLabel(recipient) {
|
|
13
94
|
if (!recipient)
|
|
14
95
|
return "unknown";
|
|
@@ -341,6 +422,11 @@ export async function handleOnchainOperations(args) {
|
|
|
341
422
|
}
|
|
342
423
|
validated = strictParse(OnchainOperationsSchema, args, "onchain_operations input");
|
|
343
424
|
const env = getEnvConfig(validated.env);
|
|
425
|
+
if (!env.referrer) {
|
|
426
|
+
const storedReferrer = readStoredReferrer();
|
|
427
|
+
if (storedReferrer)
|
|
428
|
+
env.referrer = storedReferrer;
|
|
429
|
+
}
|
|
344
430
|
const clientSchemaVersion = env.client_schema_version;
|
|
345
431
|
const schemaStrictMode = env.schema_strict_mode;
|
|
346
432
|
const schemaCheck = clientSchemaVersion
|
|
@@ -382,6 +468,10 @@ export async function handleOnchainOperations(args) {
|
|
|
382
468
|
if (skillsHint) {
|
|
383
469
|
constraintWarnings.push(skillsHint);
|
|
384
470
|
}
|
|
471
|
+
const projectSkillsHint = getProjectSkillsHint();
|
|
472
|
+
if (projectSkillsHint) {
|
|
473
|
+
constraintWarnings.push(projectSkillsHint);
|
|
474
|
+
}
|
|
385
475
|
switch (validated.operation_type) {
|
|
386
476
|
case "service": {
|
|
387
477
|
const data = validated.data;
|
|
@@ -907,8 +997,8 @@ export async function handleOnchainOperations(args) {
|
|
|
907
997
|
"CoinWrapper and transferring the underlying coin to tx_context::sender\n" +
|
|
908
998
|
"Requirements:\n" +
|
|
909
999
|
" - You MUST be the CoinWrapper's owner (the recipient specified in the Allocation)\n" +
|
|
910
|
-
" - type_parameter
|
|
911
|
-
"(
|
|
1000
|
+
" - type_parameter is OPTIONAL: when omitted it is auto-derived from the CoinWrapper's " +
|
|
1001
|
+
"own on-chain type (the inner T of CoinWrapper<T>)\n" +
|
|
912
1002
|
" - object can be a CoinWrapper ID (0x...) or a local mark name\n" +
|
|
913
1003
|
"To find received CoinWrappers: call query_toolkit with query_type='onchain_received' " +
|
|
914
1004
|
"and type='CoinWrapper' for your account.\n" +
|
package/dist/tools/index.js
CHANGED
|
@@ -205,11 +205,11 @@ export const TOOL_REGISTRY = [
|
|
|
205
205
|
handler: handleWowokInfo,
|
|
206
206
|
config: {
|
|
207
207
|
title: "ℹ️ WoWok Build-in Information",
|
|
208
|
-
description: "Query WoWok protocol information: 'constants', 'built-in permissions', 'common mistakes', 'guard instructions', 'current network', 'value types',
|
|
208
|
+
description: "Query WoWok protocol information: 'constants', 'built-in permissions', 'common mistakes', 'guard instructions', 'current network', 'value types', 'mainnet bridge tokens', or 'funding guidance'. Use 'common mistakes' to proactively learn known field-name/unit/workflow pitfalls before submitting an operation (e.g. filter operation:\"compensation_fund_add\"). For 'mainnet bridge tokens': returns cross-chain bridge tokens (ETH, WETH, WBTC, USDC, USDT) with each token's symbol, WOW-side type tag (wowTypeTag), EVM address, decimals, and description. The wowTypeTag (format {address}::{module}::{struct}) can be used directly as the `type_parameter` of Service / Treasury / Reward / Allocation objects to set their payment token — e.g. use USDT's wowTypeTag to create a Service that accepts USDT payments. For 'funding guidance': returns how to obtain WOW gas and payment tokens — testnet faucet, mainnet ETH cross-chain bridge flow, and the WOW mainnet airdrop link. Use this when a user asks how to obtain tokens/gas/funds, or as a proactive first-use reminder.",
|
|
209
209
|
inputSchema: ProtocolInfoQuerySchema,
|
|
210
210
|
outputSchema: ProtocolInfoResultSchema,
|
|
211
211
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
212
|
-
_meta: createToolMeta("WoWok info", ["build-in", "constants", "permissions", "guard", "network", "value-types", "bridge-tokens"]),
|
|
212
|
+
_meta: createToolMeta("WoWok info", ["build-in", "constants", "permissions", "guard", "network", "value-types", "bridge-tokens", "funding-guidance", "faucet", "airdrop"]),
|
|
213
213
|
},
|
|
214
214
|
},
|
|
215
215
|
{
|
|
@@ -466,7 +466,7 @@ const WOWOK_TOOL_DESCRIPTION = [
|
|
|
466
466
|
" query_toolkit — Query on-chain objects by ID/type/owner.",
|
|
467
467
|
" onchain_table_data — Query on-chain dynamic field tables with pagination.",
|
|
468
468
|
" onchain_events — Watch on-chain events (arbitration, order, progress, demand).",
|
|
469
|
-
" wowok_buildin_info — Protocol constants, built-in permissions, bridge tokens.",
|
|
469
|
+
" wowok_buildin_info — Protocol constants, built-in permissions, bridge tokens, funding guidance.",
|
|
470
470
|
" schema_query — Query JSON schemas for any sub-tool (action: list/get/get_output/search).",
|
|
471
471
|
" bridge_operation — Cross-chain bridge between WOW and EVM (mainnet only).",
|
|
472
472
|
" project_operation — Project entity management (SQLite) + 3-pathway graph + evaluation engine.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.9",
|
|
4
4
|
"description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
53
|
-
"@wowok/wowok": "2.6.
|
|
53
|
+
"@wowok/wowok": "2.6.9",
|
|
54
54
|
"lodash": "^4.18.1",
|
|
55
55
|
"zod": "^3.25.76",
|
|
56
56
|
"zod-to-json-schema": "^3.25.2"
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "Add Entity-Sharing Order Allocators and Publish Insurance Service",
|
|
3
|
-
"description": "Update the unpublished insurance Service with two alternative order_allocators (Treasury collection and personal collection, first-match-wins) whose sharing recipients are FIXED Entity addresses — the fund-theft-safe pattern — then publish the Service in the same transaction.",
|
|
4
|
-
"tags": ["service", "insurance", "order_allocators", "entity-sharing", "publish"],
|
|
5
|
-
"industry": "insurance",
|
|
6
|
-
"operation_type": "service",
|
|
7
|
-
"source": "docs/examples/Insurance — schema-validated, not chain-verified",
|
|
8
|
-
"verified": false,
|
|
9
|
-
"network": "testnet",
|
|
10
|
-
"call": {
|
|
11
|
-
"tool": "onchain_operations",
|
|
12
|
-
"operation_type": "service",
|
|
13
|
-
"data": {
|
|
14
|
-
"object": "insurance_service_v1",
|
|
15
|
-
"order_allocators": {
|
|
16
|
-
"description": "Insurance order revenue allocation — 2 alternative merchant collection approaches (first-match-wins means only the first passing allocator executes)",
|
|
17
|
-
"threshold": 0,
|
|
18
|
-
"allocators": [
|
|
19
|
-
{
|
|
20
|
-
"guard": "insurance_withdraw_guard_treasury_v1",
|
|
21
|
-
"sharing": [
|
|
22
|
-
{
|
|
23
|
-
"who": { "Entity": { "name_or_address": "insurance_treasury_v1" } },
|
|
24
|
-
"sharing": 10000,
|
|
25
|
-
"mode": "Rate"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"guard": "insurance_withdraw_guard_personal_v1",
|
|
31
|
-
"sharing": [
|
|
32
|
-
{
|
|
33
|
-
"who": { "Entity": { "name_or_address": "insurance_provider_v1" } },
|
|
34
|
-
"sharing": 10000,
|
|
35
|
-
"mode": "Rate"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"publish": true
|
|
42
|
-
},
|
|
43
|
-
"env": {
|
|
44
|
-
"account": "insurance_provider_v1",
|
|
45
|
-
"network": "testnet"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"notes": [
|
|
49
|
-
"Fund-safety pattern the library previously lacked: who = {Entity: {name_or_address: ...}} pins the recipient to a FIXED address (Treasury object or provider account) resolved via LocalMark at build time. Even if the withdraw Guard were bypassed or a forged Order submitted, funds still flow to the fixed Entity — the caller cannot redirect them. NEVER use {Signer: 'signer'} for merchant collection (funds would go to whoever triggers allocation).",
|
|
50
|
-
"first-match-wins: the TWO allocators illustrate the 2 alternative collection designs (Treasury vs personal); only the FIRST allocator whose Guard passes executes. In production pick ONE and delete the other. Each allocator's Guard must be a UNIQUE Guard object — hence two Guards with identical logic in the doc (see sibling insurance-guard-withdraw-allocation example).",
|
|
51
|
-
"Schema check (call/service.ts CallService_DataSchema + query/index.ts AllocatorsSchema/AllocatorSchema/AllocationSharingSchema/RecipientSchema): object is the STRING form (existing service); order_allocators = {description, threshold, allocators[]} with per-allocator {guard: NameOrAddress, sharing: [{who: {Entity: {name_or_address}}, sharing, mode}]}; mode 'Rate' with a single sharing of 10000 satisfies the Rate-sum == 10000 (basis points, 100%) rule with no Surplus item; threshold 0 allows any balance.",
|
|
52
|
-
"IMMUTABILITY (L1-locked): order_allocators can ONLY be set before publish=true (service.move E_ALREADY_PUBLISHED); after publish it is permanently frozen — this call sets allocators and publishes in one transaction, which is the standard finalize step.",
|
|
53
|
-
"PREREQUISITES: insurance_service_v1 created UNPUBLISHED with machine + sales (so its name resolves in the Guards' static tables); both withdraw Guards and insurance_treasury_v1 created; Machine published. This is Step 7 of the Insurance doc flow.",
|
|
54
|
-
"Desensitization: doc payload already uses generic local-mark names only (insurance_service_v1, insurance_treasury_v1, insurance_provider_v1, insurance_withdraw_guard_*_v1); no real personal data present, nothing replaced."
|
|
55
|
-
]
|
|
56
|
-
}
|