MCPcopy Create free account
hub / github.com/EvoMap/evolver / orderService

Function orderService

src/atp/consumerAgent.js:33–51  ·  view source on GitHub ↗

* Place an ATP order for a service. * @param {object} opts * @param {string[]} opts.capabilities - what the order needs * @param {number} opts.budget - credits to spend * @param {string} [opts.routingMode] - fastest | cheapest | auction | swarm * @param {string} [opts.verifyMode] - auto | ai_ju

(opts)

Source from the content-addressed store, hash-verified

31 * @returns {Promise<{ok: boolean, data?: object, error?: string}>}
32 */
33async function orderService(opts) {
34 await ensureInitialized();
35
36 const result = await placeOrder({
37 capabilities: opts.capabilities,
38 budget: Math.max(1, Math.round(Number(opts.budget) || 10)),
39 routingMode: opts.routingMode || 'fastest',
40 verifyMode: opts.verifyMode || 'auto',
41 question: opts.question,
42 signals: opts.signals,
43 minReputation: opts.minReputation,
44 });
45
46 if (result.ok) {
47 console.log('[ATP-Consumer] Order placed:', result.data.order_id, '-> merchant:', result.data.merchant?.node_id);
48 }
49
50 return result;
51}
52
53/**
54 * Confirm delivery of an order (bilateral mode).

Callers 1

orderAndWaitFunction · 0.85

Calls 2

ensureInitializedFunction · 0.85
placeOrderFunction · 0.85

Tested by

no test coverage detected