@wowok/agent-mcp 2.5.4 → 2.5.5
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/README.md +33 -26
- package/dist/knowledge/reward-confirm.d.ts +3 -0
- package/dist/knowledge/reward-confirm.js +30 -0
- package/dist/knowledge/reward-puzzle.d.ts +1 -0
- package/dist/knowledge/reward-puzzle.js +12 -0
- package/dist/knowledge/reward-risk.d.ts +4 -1
- package/dist/knowledge/reward-risk.js +85 -3
- package/dist/knowledge/tools-reference.js +5 -4
- package/dist/project/evaluation.d.ts +53 -0
- package/dist/project/evaluation.js +853 -0
- package/dist/project/graph-builder.d.ts +43 -0
- package/dist/project/graph-builder.js +572 -0
- package/dist/project/handlers.d.ts +152 -0
- package/dist/project/handlers.js +458 -0
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +24 -1
- package/dist/project/query.d.ts +1 -0
- package/dist/project/query.js +2 -0
- package/dist/project/semantic-assembler.d.ts +93 -0
- package/dist/project/semantic-assembler.js +345 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/project/index.d.ts +1558 -3885
- package/dist/schema/project/index.js +357 -961
- package/dist/schema/trust/index.d.ts +14 -14
- package/dist/schemas/bridge_operation.schema.json +1 -1
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +2 -2
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +5 -5
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
- package/dist/schemas/onchain_operations_contact.schema.json +1 -1
- package/dist/schemas/onchain_operations_demand.schema.json +1 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +1 -1
- package/dist/schemas/onchain_operations_order.schema.json +1 -1
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +1 -1
- package/dist/schemas/onchain_operations_personal.schema.json +1 -1
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +1 -1
- package/dist/schemas/onchain_operations_reward.schema.json +1 -1
- package/dist/schemas/onchain_operations_service.schema.json +1 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
- package/dist/schemas/project_operation.output.json +975 -2471
- package/dist/schemas/project_operation.schema.json +207 -534
- package/dist/tools/handlers/onchain.js +97 -19
- package/dist/tools/handlers/project.js +34 -1046
- package/dist/tools/index.js +84 -55
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
2
|
import { resolve } from "path";
|
|
3
|
-
import { CallService, CallMachine, CallProgress, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, CallProof, gen_proof, parseGuardFile, formatGuardParseErrors, transformRewardInput, transformPersonalInput, } from "@wowok/wowok";
|
|
3
|
+
import { CallService, CallMachine, CallProgress, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, CallProof, gen_proof, ResponseData, LocalProject, parseGuardFile, formatGuardParseErrors, transformRewardInput, transformPersonalInput, } from "@wowok/wowok";
|
|
4
4
|
import { OnchainOperationsSchema, strictParse, getEnvConfig, handleCallResult, checkClientSchemaCompatibility, parseMachineNodesFromText, formatNodeErrors as formatMachineNodeErrors, transformSubmission, } from "../../schema/index.js";
|
|
5
5
|
import { handlePermissionOperations } from "../../schema/call/permission-handler.js";
|
|
6
6
|
import { isProjectServiceEnabled, normalize as projectNormalize, } from "../../project/index.js";
|
|
@@ -9,6 +9,41 @@ export async function handleOnchainOperations(args) {
|
|
|
9
9
|
let validated;
|
|
10
10
|
let constraintWarnings = [];
|
|
11
11
|
let projectWarnings = [];
|
|
12
|
+
async function autoAddToProject(projectPrefix, operationType, result) {
|
|
13
|
+
if (!projectPrefix)
|
|
14
|
+
return;
|
|
15
|
+
const creationOps = new Set([
|
|
16
|
+
"service", "machine", "progress", "repository",
|
|
17
|
+
"arbitration", "contact", "treasury", "reward",
|
|
18
|
+
"allocation", "permission", "guard", "personal",
|
|
19
|
+
"demand", "order", "proof",
|
|
20
|
+
]);
|
|
21
|
+
if (!creationOps.has(operationType))
|
|
22
|
+
return;
|
|
23
|
+
if (!result || typeof result !== 'object' || 'error' in result)
|
|
24
|
+
return;
|
|
25
|
+
if (!result.digest)
|
|
26
|
+
return;
|
|
27
|
+
try {
|
|
28
|
+
const lp = LocalProject.Instance();
|
|
29
|
+
const project = await lp.getProjectByPrefix(projectPrefix);
|
|
30
|
+
if (!project) {
|
|
31
|
+
console.warn(`[autoAddToProject] Project with prefix '${projectPrefix}' not found — object not auto-associated. Create the project first via project_operation action='create_project'.`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const rData = ResponseData(result);
|
|
35
|
+
const created = rData.filter((r) => r.change === "created" && r.object);
|
|
36
|
+
for (const obj of created) {
|
|
37
|
+
await lp.addObject(project.id, {
|
|
38
|
+
objectAddress: obj.object,
|
|
39
|
+
objectType: obj.type_raw,
|
|
40
|
+
role: "reference",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
12
47
|
try {
|
|
13
48
|
if (typeof args === 'object' && args !== null
|
|
14
49
|
&& 'description' in args && !('operation_type' in args)) {
|
|
@@ -59,7 +94,9 @@ export async function handleOnchainOperations(args) {
|
|
|
59
94
|
: await callService.call(env);
|
|
60
95
|
const data = validated.data;
|
|
61
96
|
const intent = data?.publish ? "publish service" : data?.bPublished !== undefined ? "modify service" : "create service";
|
|
62
|
-
|
|
97
|
+
const output = handleCallResult(result, withHarness(buildCtx(data), "service", intent));
|
|
98
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
99
|
+
return output;
|
|
63
100
|
}
|
|
64
101
|
case "machine": {
|
|
65
102
|
if (validated.data.node && typeof validated.data.node === 'object' && 'json_or_markdown_file' in validated.data.node) {
|
|
@@ -90,42 +127,54 @@ export async function handleOnchainOperations(args) {
|
|
|
90
127
|
const result = validated.submission
|
|
91
128
|
? await callMachine.call_with_submission(env, await transformSubmission(validated.submission))
|
|
92
129
|
: await callMachine.call(env);
|
|
93
|
-
|
|
130
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
131
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
132
|
+
return output;
|
|
94
133
|
}
|
|
95
134
|
case "progress": {
|
|
96
135
|
const callProgress = new CallProgress(validated.data);
|
|
97
136
|
const result = validated.submission
|
|
98
137
|
? await callProgress.call_with_submission(env, await transformSubmission(validated.submission))
|
|
99
138
|
: await callProgress.call(env);
|
|
100
|
-
|
|
139
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
140
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
141
|
+
return output;
|
|
101
142
|
}
|
|
102
143
|
case "repository": {
|
|
103
144
|
const callRepository = new CallRepository(validated.data);
|
|
104
145
|
const result = validated.submission
|
|
105
146
|
? await callRepository.call_with_submission(env, await transformSubmission(validated.submission))
|
|
106
147
|
: await callRepository.call(env);
|
|
107
|
-
|
|
148
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
149
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
150
|
+
return output;
|
|
108
151
|
}
|
|
109
152
|
case "arbitration": {
|
|
110
153
|
const callArbitration = new CallArbitration(validated.data);
|
|
111
154
|
const result = validated.submission
|
|
112
155
|
? await callArbitration.call_with_submission(env, await transformSubmission(validated.submission))
|
|
113
156
|
: await callArbitration.call(env);
|
|
114
|
-
|
|
157
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
158
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
159
|
+
return output;
|
|
115
160
|
}
|
|
116
161
|
case "contact": {
|
|
117
162
|
const callContact = new CallContact(validated.data);
|
|
118
163
|
const result = validated.submission
|
|
119
164
|
? await callContact.call_with_submission(env, await transformSubmission(validated.submission))
|
|
120
165
|
: await callContact.call(env);
|
|
121
|
-
|
|
166
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
167
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
168
|
+
return output;
|
|
122
169
|
}
|
|
123
170
|
case "treasury": {
|
|
124
171
|
const callTreasury = new CallTreasury(validated.data);
|
|
125
172
|
const result = validated.submission
|
|
126
173
|
? await callTreasury.call_with_submission(env, await transformSubmission(validated.submission))
|
|
127
174
|
: await callTreasury.call(env);
|
|
128
|
-
|
|
175
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
176
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
177
|
+
return output;
|
|
129
178
|
}
|
|
130
179
|
case "reward": {
|
|
131
180
|
const transformedData = transformRewardInput(validated.data);
|
|
@@ -133,17 +182,30 @@ export async function handleOnchainOperations(args) {
|
|
|
133
182
|
const result = validated.submission
|
|
134
183
|
? await callReward.call_with_submission(env, await transformSubmission(validated.submission))
|
|
135
184
|
: await callReward.call(env);
|
|
136
|
-
|
|
185
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
186
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
187
|
+
return output;
|
|
137
188
|
}
|
|
138
189
|
case "allocation": {
|
|
139
190
|
const callAllocation = new CallAllocation(validated.data);
|
|
140
191
|
const result = validated.submission
|
|
141
192
|
? await callAllocation.call_with_submission(env, await transformSubmission(validated.submission))
|
|
142
193
|
: await callAllocation.call(env);
|
|
143
|
-
|
|
194
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
195
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
196
|
+
return output;
|
|
144
197
|
}
|
|
145
198
|
case "permission": {
|
|
146
|
-
|
|
199
|
+
const opType = validated.operation_type;
|
|
200
|
+
const output = handlePermissionOperations(validated.data, env, buildCtx);
|
|
201
|
+
if (output && typeof output === 'object' && 'then' in output) {
|
|
202
|
+
output.then((resolved) => {
|
|
203
|
+
if (resolved?.structuredContent?.result) {
|
|
204
|
+
autoAddToProject(projectEnvPrefix, opType, resolved.structuredContent.result).catch(() => { });
|
|
205
|
+
}
|
|
206
|
+
}).catch(() => { });
|
|
207
|
+
}
|
|
208
|
+
return output;
|
|
147
209
|
}
|
|
148
210
|
case "guard": {
|
|
149
211
|
const validatedData = validated.data;
|
|
@@ -190,47 +252,63 @@ export async function handleOnchainOperations(args) {
|
|
|
190
252
|
}
|
|
191
253
|
const callGuard = new CallGuard(validatedData);
|
|
192
254
|
const result = await callGuard.call(env);
|
|
193
|
-
|
|
255
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
256
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
257
|
+
return output;
|
|
194
258
|
}
|
|
195
259
|
case "personal": {
|
|
196
260
|
const transformedData = transformPersonalInput(validated.data);
|
|
197
261
|
const callPersonal = new CallPersonal(transformedData);
|
|
198
262
|
const result = await callPersonal.call(env);
|
|
199
|
-
|
|
263
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
264
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
265
|
+
return output;
|
|
200
266
|
}
|
|
201
267
|
case "payment": {
|
|
202
268
|
const callPayment = new CallPayment(validated.data);
|
|
203
269
|
const result = await callPayment.call(env);
|
|
204
|
-
|
|
270
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
271
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
272
|
+
return output;
|
|
205
273
|
}
|
|
206
274
|
case "demand": {
|
|
207
275
|
const callDemand = new CallDemand(validated.data);
|
|
208
276
|
const result = validated.submission
|
|
209
277
|
? await callDemand.call_with_submission(env, await transformSubmission(validated.submission))
|
|
210
278
|
: await callDemand.call(env);
|
|
211
|
-
|
|
279
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
280
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
281
|
+
return output;
|
|
212
282
|
}
|
|
213
283
|
case "order": {
|
|
214
284
|
const callOrder = new CallOrder(validated.data);
|
|
215
285
|
const result = validated.submission
|
|
216
286
|
? await callOrder.call_with_submission(env, await transformSubmission(validated.submission))
|
|
217
287
|
: await callOrder.call(env);
|
|
218
|
-
|
|
288
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
289
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
290
|
+
return output;
|
|
219
291
|
}
|
|
220
292
|
case "gen_passport": {
|
|
221
293
|
const result = await gen_passport(env, validated.guard, validated.info);
|
|
222
|
-
|
|
294
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
295
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
296
|
+
return output;
|
|
223
297
|
}
|
|
224
298
|
case "proof": {
|
|
225
299
|
const callProof = new CallProof(validated.data);
|
|
226
300
|
const result = validated.submission
|
|
227
301
|
? await callProof.call_with_submission(env, await transformSubmission(validated.submission))
|
|
228
302
|
: await callProof.call(env);
|
|
229
|
-
|
|
303
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
304
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
305
|
+
return output;
|
|
230
306
|
}
|
|
231
307
|
case "gen_proof": {
|
|
232
308
|
const result = await gen_proof(env, validated.proof, validated.server_pubkey, validated.server_signature, validated.proof_type, validated.description, validated.item_count, validated.about_address);
|
|
233
|
-
|
|
309
|
+
const output = handleCallResult(result, buildCtx(validated.data));
|
|
310
|
+
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
311
|
+
return output;
|
|
234
312
|
}
|
|
235
313
|
}
|
|
236
314
|
const exhaustiveOp = validated;
|