@agentpactai/mcp-server 0.2.3 → 0.2.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/dist/index.js +75 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -19936,6 +19936,43 @@ var AgentPactAgent = class _AgentPactAgent {
|
|
|
19936
19936
|
console.error(`[Agent] Task declined on-chain: ${txHash}`);
|
|
19937
19937
|
return txHash;
|
|
19938
19938
|
}
|
|
19939
|
+
/**
|
|
19940
|
+
* Create an off-chain delivery record for a task.
|
|
19941
|
+
* Use this before calling `submitDelivery` on-chain.
|
|
19942
|
+
*/
|
|
19943
|
+
async createTaskDelivery(taskId, payload) {
|
|
19944
|
+
const res = await fetch(
|
|
19945
|
+
`${this.platformUrl}/api/tasks/${taskId}/deliveries`,
|
|
19946
|
+
{
|
|
19947
|
+
method: "POST",
|
|
19948
|
+
headers: this.headers(),
|
|
19949
|
+
body: JSON.stringify(payload)
|
|
19950
|
+
}
|
|
19951
|
+
);
|
|
19952
|
+
if (!res.ok) {
|
|
19953
|
+
const errText = await res.text().catch(() => "");
|
|
19954
|
+
throw new Error(`Failed to create task delivery: ${res.status} ${errText}`);
|
|
19955
|
+
}
|
|
19956
|
+
return res.json();
|
|
19957
|
+
}
|
|
19958
|
+
/**
|
|
19959
|
+
* Attach an on-chain transaction hash to an off-chain delivery record.
|
|
19960
|
+
*/
|
|
19961
|
+
async attachDeliveryTxHash(taskId, deliveryId, txHash) {
|
|
19962
|
+
const res = await fetch(
|
|
19963
|
+
`${this.platformUrl}/api/tasks/${taskId}/deliveries/${deliveryId}/submit`,
|
|
19964
|
+
{
|
|
19965
|
+
method: "POST",
|
|
19966
|
+
headers: this.headers(),
|
|
19967
|
+
body: JSON.stringify({ txHash })
|
|
19968
|
+
}
|
|
19969
|
+
);
|
|
19970
|
+
if (!res.ok) {
|
|
19971
|
+
const errText = await res.text().catch(() => "");
|
|
19972
|
+
throw new Error(`Failed to attach delivery tx hash: ${res.status} ${errText}`);
|
|
19973
|
+
}
|
|
19974
|
+
return res.json();
|
|
19975
|
+
}
|
|
19939
19976
|
/**
|
|
19940
19977
|
* Submit delivery materials when task is finished.
|
|
19941
19978
|
* Calls submitDelivery() on-chain → state becomes Delivered.
|
|
@@ -20145,6 +20182,17 @@ var AgentPactAgent = class _AgentPactAgent {
|
|
|
20145
20182
|
const body = await res.json();
|
|
20146
20183
|
return body.data ?? body.task ?? body;
|
|
20147
20184
|
}
|
|
20185
|
+
async rejectInvitation(taskId, reason) {
|
|
20186
|
+
const res = await fetch(
|
|
20187
|
+
`${this.platformUrl}/api/matching/reject-invitation`,
|
|
20188
|
+
{
|
|
20189
|
+
method: "POST",
|
|
20190
|
+
headers: this.headers(),
|
|
20191
|
+
body: JSON.stringify({ taskId, reason })
|
|
20192
|
+
}
|
|
20193
|
+
);
|
|
20194
|
+
if (!res.ok) throw new Error(`Failed to reject invitation: ${res.status}`);
|
|
20195
|
+
}
|
|
20148
20196
|
async sendMessage(taskId, content, type = "GENERAL") {
|
|
20149
20197
|
return this.chat.sendMessage(taskId, content, type);
|
|
20150
20198
|
}
|
|
@@ -34203,7 +34251,7 @@ var sharedLiveTools = [
|
|
|
34203
34251
|
defineTool({
|
|
34204
34252
|
name: "agentpact_fetch_task_details",
|
|
34205
34253
|
title: "Fetch Task Details",
|
|
34206
|
-
description: "Retrieve full task details including confidential materials.
|
|
34254
|
+
description: "Retrieve full task details including confidential materials. Available after you have been selected by the requester or after the task has been claimed on-chain.",
|
|
34207
34255
|
context: "fetch_task_details",
|
|
34208
34256
|
inputSchema: external_exports.object({
|
|
34209
34257
|
taskId: external_exports.string().describe("The task ID to fetch details for")
|
|
@@ -34526,6 +34574,21 @@ var sharedLiveTools = [
|
|
|
34526
34574
|
return { content: [{ type: "text", text: `Bid submitted successfully. Result: ${JSON.stringify(result)}` }] };
|
|
34527
34575
|
}
|
|
34528
34576
|
}),
|
|
34577
|
+
defineTool({
|
|
34578
|
+
name: "agentpact_reject_invitation",
|
|
34579
|
+
title: "Reject Invitation",
|
|
34580
|
+
description: "Decline a task invitation after reviewing confidential materials but before on-chain claim. Use this if the requirements are not feasible or you cannot fulfill the task. Providing a reason is highly recommended.",
|
|
34581
|
+
context: "reject_invitation",
|
|
34582
|
+
inputSchema: external_exports.object({
|
|
34583
|
+
taskId: external_exports.string().describe("The ID of the task to reject"),
|
|
34584
|
+
reason: external_exports.string().optional().describe("Detailed reason for rejection")
|
|
34585
|
+
}).strict(),
|
|
34586
|
+
execute: async (runtime2, params) => {
|
|
34587
|
+
const agent = await runtime2.getAgent();
|
|
34588
|
+
await agent.rejectInvitation(params.taskId, params.reason);
|
|
34589
|
+
return { content: [{ type: "text", text: `Invitation rejected successfully for task ${params.taskId}.` }] };
|
|
34590
|
+
}
|
|
34591
|
+
}),
|
|
34529
34592
|
defineTool({
|
|
34530
34593
|
name: "agentpact_confirm_task",
|
|
34531
34594
|
title: "Confirm Task Execution",
|
|
@@ -34557,19 +34620,27 @@ var sharedLiveTools = [
|
|
|
34557
34620
|
defineTool({
|
|
34558
34621
|
name: "agentpact_submit_delivery",
|
|
34559
34622
|
title: "Submit Delivery",
|
|
34560
|
-
description: "Submit completed work by providing the delivery artifact hash. This
|
|
34623
|
+
description: "Submit completed work by providing the delivery artifact hash and optional content. This writes the delivery details to the platform database and triggers the on-chain submission.",
|
|
34561
34624
|
context: "submit_delivery",
|
|
34562
34625
|
inputSchema: external_exports.object({
|
|
34626
|
+
taskId: external_exports.string().describe("The ID of the task you are submitting delivery for"),
|
|
34563
34627
|
escrowId: external_exports.string().describe("The on-chain escrow ID"),
|
|
34564
|
-
deliveryHash: hashSchema.describe("The 0x-prefixed bytes32 hash/CID of the completed delivery artifacts")
|
|
34628
|
+
deliveryHash: hashSchema.describe("The 0x-prefixed bytes32 hash/CID of the completed delivery artifacts"),
|
|
34629
|
+
content: external_exports.string().optional().describe("Delivery notes or repository/commit references")
|
|
34565
34630
|
}).strict(),
|
|
34566
34631
|
execute: async (runtime2, params) => {
|
|
34567
34632
|
const agent = await runtime2.getAgent();
|
|
34633
|
+
const payload = {
|
|
34634
|
+
deliveryHash: params.deliveryHash,
|
|
34635
|
+
content: params.content || "Delivery submitted via AgentPact MCP."
|
|
34636
|
+
};
|
|
34637
|
+
const result = await agent.createTaskDelivery(params.taskId, payload);
|
|
34568
34638
|
const txHash = await agent.submitDelivery(
|
|
34569
34639
|
BigInt(params.escrowId),
|
|
34570
34640
|
params.deliveryHash
|
|
34571
34641
|
);
|
|
34572
|
-
|
|
34642
|
+
await agent.attachDeliveryTxHash(params.taskId, result.delivery.id, txHash);
|
|
34643
|
+
return { content: [{ type: "text", text: `Delivery submitted successfully. TX: ${txHash}, Delivery ID: ${result.delivery.id}` }] };
|
|
34573
34644
|
}
|
|
34574
34645
|
}),
|
|
34575
34646
|
defineTool({
|
|
@@ -34863,9 +34934,6 @@ function registerMcpLiveTools(server2, runtime2) {
|
|
|
34863
34934
|
}
|
|
34864
34935
|
},
|
|
34865
34936
|
async (params) => {
|
|
34866
|
-
if (typeof global !== "undefined" && global.writeLog) {
|
|
34867
|
-
global.writeLog(`[TOOL CALL] ${tool.name} params=${JSON.stringify(params)}`);
|
|
34868
|
-
}
|
|
34869
34937
|
try {
|
|
34870
34938
|
return await tool.execute(runtime2, params);
|
|
34871
34939
|
} catch (error48) {
|