@agentpactai/mcp-server 0.2.4 → 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 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.
@@ -34214,7 +34251,7 @@ var sharedLiveTools = [
34214
34251
  defineTool({
34215
34252
  name: "agentpact_fetch_task_details",
34216
34253
  title: "Fetch Task Details",
34217
- description: "Retrieve full task details including confidential materials. Only available after the task has been claimed on-chain.",
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.",
34218
34255
  context: "fetch_task_details",
34219
34256
  inputSchema: external_exports.object({
34220
34257
  taskId: external_exports.string().describe("The task ID to fetch details for")
@@ -34537,6 +34574,21 @@ var sharedLiveTools = [
34537
34574
  return { content: [{ type: "text", text: `Bid submitted successfully. Result: ${JSON.stringify(result)}` }] };
34538
34575
  }
34539
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
+ }),
34540
34592
  defineTool({
34541
34593
  name: "agentpact_confirm_task",
34542
34594
  title: "Confirm Task Execution",
@@ -34568,19 +34620,27 @@ var sharedLiveTools = [
34568
34620
  defineTool({
34569
34621
  name: "agentpact_submit_delivery",
34570
34622
  title: "Submit Delivery",
34571
- description: "Submit completed work by providing the delivery artifact hash. This is an on-chain transaction that records the delivery hash immutably.",
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.",
34572
34624
  context: "submit_delivery",
34573
34625
  inputSchema: external_exports.object({
34626
+ taskId: external_exports.string().describe("The ID of the task you are submitting delivery for"),
34574
34627
  escrowId: external_exports.string().describe("The on-chain escrow ID"),
34575
- 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")
34576
34630
  }).strict(),
34577
34631
  execute: async (runtime2, params) => {
34578
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);
34579
34638
  const txHash = await agent.submitDelivery(
34580
34639
  BigInt(params.escrowId),
34581
34640
  params.deliveryHash
34582
34641
  );
34583
- return { content: [{ type: "text", text: `Delivery submitted on-chain. TX: ${txHash}` }] };
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}` }] };
34584
34644
  }
34585
34645
  }),
34586
34646
  defineTool({
@@ -34874,9 +34934,6 @@ function registerMcpLiveTools(server2, runtime2) {
34874
34934
  }
34875
34935
  },
34876
34936
  async (params) => {
34877
- if (typeof global !== "undefined" && global.writeLog) {
34878
- global.writeLog(`[TOOL CALL] ${tool.name} params=${JSON.stringify(params)}`);
34879
- }
34880
34937
  try {
34881
34938
  return await tool.execute(runtime2, params);
34882
34939
  } catch (error48) {