moltlaunch 2.0.2 → 2.1.0

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
@@ -891,14 +891,19 @@ async function register(options) {
891
891
  priceWei: parseEther(options.price),
892
892
  flaunchToken: tokenAddress
893
893
  });
894
+ let registrationStatus = "unknown";
894
895
  try {
895
896
  const agentIdStr = agentResult.agentId.toString();
896
897
  const { signature, timestamp, nonce } = await signAction(wallet2, "register", agentIdStr);
897
- await fetch(`${APIS.MOLTLAUNCH}/api/agents/register`, {
898
+ const regRes = await fetch(`${APIS.MOLTLAUNCH}/api/agents/register`, {
898
899
  method: "POST",
899
900
  headers: { "Content-Type": "application/json" },
900
901
  body: JSON.stringify({ agentId: agentIdStr, signature, timestamp, nonce })
901
902
  });
903
+ if (regRes.ok) {
904
+ const regData = await regRes.json();
905
+ registrationStatus = regData.status === "approved" ? "approved" : "pending";
906
+ }
902
907
  } catch {
903
908
  }
904
909
  if (options.json) {
@@ -917,13 +922,18 @@ async function register(options) {
917
922
  skills,
918
923
  endpoint: options.endpoint,
919
924
  priceEth: options.price,
920
- registry: CONTRACTS.IDENTITY_REGISTRY
925
+ registry: CONTRACTS.IDENTITY_REGISTRY,
926
+ registrationStatus
921
927
  })
922
928
  );
923
929
  return;
924
930
  }
925
931
  console.log("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
926
- console.log(" \u2705 Registration Complete!");
932
+ if (registrationStatus === "pending") {
933
+ console.log(" \u23F3 Registration Submitted \u2014 Pending Approval");
934
+ } else {
935
+ console.log(" \u2705 Registration Complete!");
936
+ }
927
937
  console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
928
938
  console.log(`Agent ID: ${agentResult.agentId}`);
929
939
  console.log(`Name: ${options.name}`);
@@ -956,6 +966,11 @@ async function register(options) {
956
966
  }
957
967
  console.log("\nOthers can invest in your agent at:");
958
968
  console.log(` ${flaunchUrl}`);
969
+ if (registrationStatus === "pending") {
970
+ console.log("\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
971
+ console.log("\n\u23F3 Your agent is pending admin approval.");
972
+ console.log(" It will appear in the marketplace once approved.");
973
+ }
959
974
  } catch (err) {
960
975
  const errorMsg = err instanceof Error ? err.message : String(err);
961
976
  if (options.json) {
@@ -1148,6 +1163,20 @@ async function refundTaskRequest(wallet2, taskId, txHash) {
1148
1163
  const data = await response.json();
1149
1164
  return data.task;
1150
1165
  }
1166
+ async function cancelTaskRequest(wallet2, taskId, txHash) {
1167
+ const { signature, timestamp, nonce } = await signAction(wallet2, "cancel", taskId);
1168
+ const response = await fetch(`${API_BASE}/api/tasks/${taskId}/cancel`, {
1169
+ method: "POST",
1170
+ headers: { "Content-Type": "application/json" },
1171
+ body: JSON.stringify({ txHash, signature, timestamp, nonce })
1172
+ });
1173
+ if (!response.ok) {
1174
+ const error = await response.json();
1175
+ throw new Error(error.error || `HTTP ${response.status}`);
1176
+ }
1177
+ const data = await response.json();
1178
+ return data.task;
1179
+ }
1151
1180
  async function rateTask(wallet2, taskId, txHash, score, comment) {
1152
1181
  const { signature, timestamp, nonce } = await signAction(wallet2, "rate", taskId);
1153
1182
  const response = await fetch(`${API_BASE}/api/tasks/${taskId}/rate`, {
@@ -1799,17 +1828,20 @@ import {
1799
1828
  } from "viem";
1800
1829
  import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1801
1830
  import { base as base3 } from "viem/chains";
1802
- var ESCROW_ADDRESS = process.env.ESCROW_ADDRESS || "0x2c46054b4577b4fcdde28cb613dc2ba4b1127b0c";
1831
+ var ESCROW_ADDRESS = process.env.ESCROW_ADDRESS || "0x5Df1ffa02c8515a0Fed7d0e5d6375FcD2c1950Ee";
1803
1832
  var ESCROW_ABI = parseAbi([
1804
1833
  // Write functions
1805
1834
  "function deposit(bytes32 taskId, address agent, address token) external payable",
1835
+ "function markAccepted(bytes32 taskId) external",
1806
1836
  "function markSubmitted(bytes32 taskId) external",
1807
1837
  "function release(bytes32 taskId) external",
1808
1838
  "function refund(bytes32 taskId) external",
1839
+ "function cancel(bytes32 taskId) external",
1809
1840
  "function releaseAfterTimeout(bytes32 taskId) external",
1810
1841
  "function dispute(bytes32 taskId) external payable",
1811
1842
  "function resolveDispute(bytes32 taskId, bool clientWins) external",
1812
1843
  "function setDisputeFeeBps(uint256 bps) external",
1844
+ "function setCancelFeeBps(uint256 bps) external",
1813
1845
  // View functions
1814
1846
  "function isPending(bytes32 taskId) external view returns (bool)",
1815
1847
  "function isTimedOut(bytes32 taskId) external view returns (bool)",
@@ -1817,16 +1849,20 @@ var ESCROW_ABI = parseAbi([
1817
1849
  "function timeUntilTimeout(bytes32 taskId) external view returns (uint256)",
1818
1850
  "function getEscrow(bytes32 taskId) external view returns (address client, address agent, address token, uint256 amount, uint256 depositedAt, uint256 submittedAt, uint256 disputeFee, uint8 status)",
1819
1851
  "function getDisputeFee(bytes32 taskId) external view returns (uint256)",
1852
+ "function getCancelFee(bytes32 taskId) external view returns (uint256)",
1820
1853
  "function getStatus(bytes32 taskId) external view returns (uint8)",
1821
1854
  "function disputeFeeBps() external view returns (uint256)",
1855
+ "function cancelFeeBps() external view returns (uint256)",
1822
1856
  "function TIMEOUT() external view returns (uint256)",
1823
1857
  // Events
1824
1858
  "event Deposited(bytes32 indexed taskId, address indexed client, address indexed token, uint256 amount)",
1859
+ "event Accepted(bytes32 indexed taskId, address indexed agent)",
1825
1860
  "event Submitted(bytes32 indexed taskId, address indexed agent, uint256 deadline)",
1826
1861
  "event Disputed(bytes32 indexed taskId, address indexed client, uint256 disputeFee)",
1827
1862
  "event DisputeResolved(bytes32 indexed taskId, bool clientWins)",
1828
1863
  "event BuybackBurned(bytes32 indexed taskId, address indexed token, uint256 ethAmount)",
1829
1864
  "event Refunded(bytes32 indexed taskId, address indexed client, uint256 amount)",
1865
+ "event Cancelled(bytes32 indexed taskId, address indexed client, uint256 cancelFee)",
1830
1866
  "event FallbackToAgent(bytes32 indexed taskId, address indexed agent, uint256 amount)"
1831
1867
  ]);
1832
1868
  function taskIdToBytes32(taskId) {
@@ -1904,6 +1940,39 @@ async function releaseAfterTimeout(wallet2, taskId) {
1904
1940
  });
1905
1941
  return hash;
1906
1942
  }
1943
+ async function markAccepted(wallet2, taskId) {
1944
+ const walletClient = getWalletClient2(wallet2);
1945
+ const taskIdBytes = taskIdToBytes32(taskId);
1946
+ const hash = await walletClient.writeContract({
1947
+ address: ESCROW_ADDRESS,
1948
+ abi: ESCROW_ABI,
1949
+ functionName: "markAccepted",
1950
+ args: [taskIdBytes]
1951
+ });
1952
+ return hash;
1953
+ }
1954
+ async function cancelEscrow(wallet2, taskId) {
1955
+ const walletClient = getWalletClient2(wallet2);
1956
+ const taskIdBytes = taskIdToBytes32(taskId);
1957
+ const hash = await walletClient.writeContract({
1958
+ address: ESCROW_ADDRESS,
1959
+ abi: ESCROW_ABI,
1960
+ functionName: "cancel",
1961
+ args: [taskIdBytes]
1962
+ });
1963
+ return hash;
1964
+ }
1965
+ async function getCancelFee(taskId) {
1966
+ const publicClient = getPublicClient2();
1967
+ const taskIdBytes = taskIdToBytes32(taskId);
1968
+ const fee = await publicClient.readContract({
1969
+ address: ESCROW_ADDRESS,
1970
+ abi: ESCROW_ABI,
1971
+ functionName: "getCancelFee",
1972
+ args: [taskIdBytes]
1973
+ });
1974
+ return fee;
1975
+ }
1907
1976
  async function isEscrowPending(taskId) {
1908
1977
  const publicClient = getPublicClient2();
1909
1978
  const taskIdBytes = taskIdToBytes32(taskId);
@@ -1973,6 +2042,17 @@ async function getDisputeFee(taskId) {
1973
2042
  });
1974
2043
  return fee;
1975
2044
  }
2045
+ async function getEscrowStatus(taskId) {
2046
+ const publicClient = getPublicClient2();
2047
+ const taskIdBytes = taskIdToBytes32(taskId);
2048
+ const status = await publicClient.readContract({
2049
+ address: ESCROW_ADDRESS,
2050
+ abi: ESCROW_ABI,
2051
+ functionName: "getStatus",
2052
+ args: [taskIdBytes]
2053
+ });
2054
+ return status;
2055
+ }
1976
2056
  async function resolveEscrowDispute(wallet2, taskId, clientWins) {
1977
2057
  const walletClient = getWalletClient2(wallet2);
1978
2058
  const publicClient = getPublicClient2();
@@ -2205,6 +2285,13 @@ Uploading ${filePaths.length} file(s)...`);
2205
2285
  const hasEscrow = !isRevision && await isEscrowPending(options.task);
2206
2286
  let escrowTxHash = null;
2207
2287
  if (hasEscrow) {
2288
+ const onChainStatus = await getEscrowStatus(options.task);
2289
+ if (onChainStatus === 0 /* Active */) {
2290
+ if (!options.json) {
2291
+ console.log("\nMarking accepted onchain...");
2292
+ }
2293
+ await markAccepted(wallet2, options.task);
2294
+ }
2208
2295
  if (!options.json) {
2209
2296
  console.log("\nMarking submission onchain (starts 24h timeout)...");
2210
2297
  }
@@ -2307,7 +2394,7 @@ async function approve(options) {
2307
2394
  if (!escrow) {
2308
2395
  throw new Error("No escrow found for this task. Was it accepted properly?");
2309
2396
  }
2310
- if (escrow.status >= 4 /* Released */) {
2397
+ if (escrow.status >= 5 /* Released */) {
2311
2398
  throw new Error("Escrow already released");
2312
2399
  }
2313
2400
  if (!options.json) {
@@ -2630,13 +2717,13 @@ async function claim(options) {
2630
2717
  if (!escrow) {
2631
2718
  throw new Error("No escrow found for this task");
2632
2719
  }
2633
- if (escrow.status === 4 /* Released */ || escrow.status === 5 /* Refunded */) {
2720
+ if (escrow.status === 5 /* Released */ || escrow.status === 6 /* Refunded */) {
2634
2721
  throw new Error("Payment already released or refunded");
2635
2722
  }
2636
- if (escrow.status !== 1 /* Submitted */) {
2723
+ if (escrow.status !== 2 /* Submitted */) {
2637
2724
  throw new Error("Work not yet submitted. Run 'mltl submit' first.");
2638
2725
  }
2639
- if (escrow.status === 2 /* Disputed */) {
2726
+ if (escrow.status === 3 /* Disputed */) {
2640
2727
  throw new Error("Task is disputed. Cannot claim until dispute is resolved.");
2641
2728
  }
2642
2729
  const priceEth = formatEther9(escrow.amount);
@@ -2735,6 +2822,9 @@ async function refund(options) {
2735
2822
  if (!escrow) {
2736
2823
  throw new Error("No escrow found for this task");
2737
2824
  }
2825
+ if (escrow.status === 1 /* Accepted */) {
2826
+ throw new Error("Agent has started work. Use 'mltl cancel' instead (10% cancel fee applies)");
2827
+ }
2738
2828
  if (escrow.status !== 0 /* Active */) {
2739
2829
  throw new Error("Escrow is not in active state (may be submitted, released, or refunded)");
2740
2830
  }
@@ -2778,8 +2868,76 @@ Refunded: ${formatEther10(escrow.amount)} ETH \u2192 ${wallet2.address}`);
2778
2868
  }
2779
2869
  }
2780
2870
 
2781
- // src/commands/dispute.ts
2871
+ // src/commands/cancel.ts
2782
2872
  import { formatEther as formatEther11 } from "viem";
2873
+ async function cancel(options) {
2874
+ const { wallet: wallet2 } = await loadOrCreateWallet();
2875
+ if (!options.json) {
2876
+ console.log("\nProcessing cancellation...");
2877
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
2878
+ }
2879
+ try {
2880
+ const task = await getTask(options.task);
2881
+ if (task.status !== "accepted") {
2882
+ throw new Error(`Task is ${task.status}, cannot cancel (must be accepted)`);
2883
+ }
2884
+ if (task.clientAddress.toLowerCase() !== wallet2.address.toLowerCase()) {
2885
+ throw new Error("Only the client who created this task can cancel");
2886
+ }
2887
+ const escrow = await getEscrowDetails(task.id);
2888
+ if (!escrow) {
2889
+ throw new Error("No escrow found for this task");
2890
+ }
2891
+ if (escrow.status !== 1 /* Accepted */) {
2892
+ throw new Error(`Escrow is not in accepted state (status: ${escrow.status})`);
2893
+ }
2894
+ const fee = await getCancelFee(task.id);
2895
+ if (!options.json) {
2896
+ console.log(`
2897
+ Task ID: ${task.id}`);
2898
+ console.log(`Escrowed: ${formatEther11(escrow.amount)} ETH`);
2899
+ console.log(`Cancel fee: ${formatEther11(fee)} ETH (10% to agent)`);
2900
+ console.log(`You receive: ${formatEther11(escrow.amount - fee)} ETH`);
2901
+ console.log("\nCancelling...");
2902
+ }
2903
+ const txHash = await cancelEscrow(wallet2, task.id);
2904
+ try {
2905
+ await cancelTaskRequest(wallet2, task.id, txHash);
2906
+ } catch {
2907
+ }
2908
+ if (options.json) {
2909
+ console.log(
2910
+ JSON.stringify({
2911
+ success: true,
2912
+ taskId: task.id,
2913
+ cancelFee: formatEther11(fee),
2914
+ refundedAmount: formatEther11(escrow.amount - fee),
2915
+ txHash
2916
+ })
2917
+ );
2918
+ return;
2919
+ }
2920
+ console.log("\nTask cancelled.");
2921
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
2922
+ console.log(`
2923
+ Cancel fee: ${formatEther11(fee)} ETH \u2192 agent`);
2924
+ console.log(`Refunded: ${formatEther11(escrow.amount - fee)} ETH \u2192 ${wallet2.address}`);
2925
+ console.log(`TX: ${txHash}
2926
+ `);
2927
+ } catch (err) {
2928
+ const errorMsg = err instanceof Error ? err.message : String(err);
2929
+ if (options.json) {
2930
+ console.log(JSON.stringify({ error: errorMsg }));
2931
+ process.exit(1);
2932
+ }
2933
+ console.error(`
2934
+ \u274C Failed to cancel: ${errorMsg}`);
2935
+ process.exit(1);
2936
+ }
2937
+ }
2938
+
2939
+ // src/commands/dispute.ts
2940
+ import { formatEther as formatEther12 } from "viem";
2783
2941
  async function dispute(options) {
2784
2942
  const { wallet: wallet2 } = await loadOrCreateWallet();
2785
2943
  if (!options.json) {
@@ -2798,15 +2956,15 @@ async function dispute(options) {
2798
2956
  if (!escrow) {
2799
2957
  throw new Error("No escrow found for this task");
2800
2958
  }
2801
- if (escrow.status !== 1 /* Submitted */) {
2959
+ if (escrow.status !== 2 /* Submitted */) {
2802
2960
  throw new Error("Escrow is not in submitted state");
2803
2961
  }
2804
2962
  const feeWei = await getDisputeFee(task.id);
2805
- const feeEth = formatEther11(feeWei);
2963
+ const feeEth = formatEther12(feeWei);
2806
2964
  if (!options.json) {
2807
2965
  console.log(`
2808
2966
  Task ID: ${task.id}`);
2809
- console.log(`Escrow: ${formatEther11(escrow.amount)} ETH`);
2967
+ console.log(`Escrow: ${formatEther12(escrow.amount)} ETH`);
2810
2968
  console.log(`Dispute fee: ${feeEth} ETH (10% of escrow)`);
2811
2969
  console.log("\nOpening dispute...");
2812
2970
  }
@@ -2848,7 +3006,7 @@ Fee paid: ${feeEth} ETH`);
2848
3006
  }
2849
3007
 
2850
3008
  // src/commands/resolve.ts
2851
- import { formatEther as formatEther12 } from "viem";
3009
+ import { formatEther as formatEther13 } from "viem";
2852
3010
  async function resolve(options) {
2853
3011
  const { wallet: wallet2 } = await loadOrCreateWallet();
2854
3012
  if (!["client", "agent"].includes(options.winner)) {
@@ -2869,14 +3027,14 @@ async function resolve(options) {
2869
3027
  if (!escrow) {
2870
3028
  throw new Error("No escrow found for this task");
2871
3029
  }
2872
- if (escrow.status !== 2 /* Disputed */) {
3030
+ if (escrow.status !== 3 /* Disputed */) {
2873
3031
  throw new Error("Escrow is not in disputed state");
2874
3032
  }
2875
3033
  if (!options.json) {
2876
3034
  console.log(`
2877
3035
  Task ID: ${task.id}`);
2878
- console.log(`Escrow: ${formatEther12(escrow.amount)} ETH`);
2879
- console.log(`Dispute fee: ${formatEther12(escrow.disputeFee)} ETH`);
3036
+ console.log(`Escrow: ${formatEther13(escrow.amount)} ETH`);
3037
+ console.log(`Dispute fee: ${formatEther13(escrow.disputeFee)} ETH`);
2880
3038
  console.log(`Resolution: ${clientWins ? "CLIENT WINS (refund)" : "AGENT WINS (buyback)"}`);
2881
3039
  console.log("\nCalling resolveDispute on-chain...");
2882
3040
  }
@@ -3063,7 +3221,7 @@ Failed to send message: ${errorMsg}`);
3063
3221
  }
3064
3222
 
3065
3223
  // src/commands/view.ts
3066
- import { formatEther as formatEther13 } from "viem";
3224
+ import { formatEther as formatEther14 } from "viem";
3067
3225
  function formatTimestamp4(ts) {
3068
3226
  return new Date(ts).toLocaleString();
3069
3227
  }
@@ -3090,7 +3248,7 @@ async function view(options) {
3090
3248
  console.log(JSON.stringify({ task }));
3091
3249
  return;
3092
3250
  }
3093
- const priceEth = task.quotedPriceWei ? formatEther13(BigInt(task.quotedPriceWei)) : null;
3251
+ const priceEth = task.quotedPriceWei ? formatEther14(BigInt(task.quotedPriceWei)) : null;
3094
3252
  console.log("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
3095
3253
  console.log(` Task ${task.id}`);
3096
3254
  console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
@@ -3162,7 +3320,7 @@ Failed to fetch task: ${errorMsg}`);
3162
3320
  // src/commands/profile.ts
3163
3321
  async function profile(options) {
3164
3322
  const { agent: agentId } = options;
3165
- const hasUpdates = options.tagline || options.description || options.website || options.twitter || options.github || options.responseTime;
3323
+ const hasUpdates = options.tagline || options.description || options.website || options.twitter || options.github || options.image || options.responseTime;
3166
3324
  if (!hasUpdates) {
3167
3325
  const current = await getProfile(agentId);
3168
3326
  if (options.json) {
@@ -3176,6 +3334,7 @@ async function profile(options) {
3176
3334
  console.log(` Website: ${current?.website || "(not set)"}`);
3177
3335
  console.log(` Twitter: ${current?.twitter || "(not set)"}`);
3178
3336
  console.log(` GitHub: ${current?.github || "(not set)"}`);
3337
+ console.log(` Image: ${current?.image || "(not set)"}`);
3179
3338
  console.log(` Response Time: ${current?.responseTime || "(not set)"}`);
3180
3339
  console.log();
3181
3340
  }
@@ -3189,6 +3348,7 @@ async function profile(options) {
3189
3348
  if (options.website) updates.website = options.website;
3190
3349
  if (options.twitter) updates.twitter = options.twitter;
3191
3350
  if (options.github) updates.github = options.github;
3351
+ if (options.image) updates.image = options.image;
3192
3352
  if (options.responseTime) updates.responseTime = options.responseTime;
3193
3353
  const result = await updateProfile(agentId, updates, signature, timestamp, nonce);
3194
3354
  if (options.json) {
@@ -3362,12 +3522,13 @@ program.command("tasks").description("View your task requests (client)").option(
3362
3522
  program.command("approve").description("Approve submitted work and pay the agent (client)").requiredOption("--task <id>", "Task ID to approve").option("--json", "Output as JSON").action(approve);
3363
3523
  program.command("claim").description("Claim payment after 24h timeout (agent)").requiredOption("--task <id>", "Task ID to claim").option("--json", "Output as JSON").action(claim);
3364
3524
  program.command("refund").description("Refund escrowed funds (only before agent submits work)").requiredOption("--task <id>", "Task ID to refund").option("--json", "Output as JSON").action(refund);
3525
+ program.command("cancel").description("Cancel a task after agent accepted (10% cancel fee to agent)").requiredOption("--task <id>", "Task ID to cancel").option("--json", "Output as JSON").action(cancel);
3365
3526
  program.command("dispute").description("Dispute submitted work (freezes timeout, requires fee)").requiredOption("--task <id>", "Task ID to dispute").option("--json", "Output as JSON").action(dispute);
3366
3527
  program.command("resolve").description("Resolve a dispute (admin only)").requiredOption("--task <id>", "Task ID to resolve").requiredOption("--winner <client|agent>", "Who wins: client or agent").option("--json", "Output as JSON").action(resolve);
3367
3528
  program.command("revise").description("Request revision on submitted work (client)").requiredOption("--task <id>", "Task ID to revise").requiredOption("--reason <text>", "What needs to be changed").option("--json", "Output as JSON").action(revise);
3368
3529
  program.command("view").description("View full task details, files, and message thread").requiredOption("--task <id>", "Task ID").option("--json", "Output as JSON").action(view);
3369
3530
  program.command("message").description("Send or read messages on an active task (client or agent)").requiredOption("--task <id>", "Task ID").option("--content <text>", "Message content (omit to read messages)").option("--json", "Output as JSON").action(message);
3370
- program.command("profile").description("View or update your agent profile").requiredOption("--agent <id>", "Agent ID").option("--tagline <text>", "Set tagline").option("--description <text>", "Set long description").option("--website <url>", "Set website URL").option("--twitter <handle>", "Set Twitter handle").option("--github <handle>", "Set GitHub handle").option("--response-time <text>", "Set response time (e.g. '< 1 hour')").option("--json", "Output as JSON").action(profile);
3531
+ program.command("profile").description("View or update your agent profile").requiredOption("--agent <id>", "Agent ID").option("--tagline <text>", "Set tagline").option("--description <text>", "Set long description").option("--website <url>", "Set website URL").option("--twitter <handle>", "Set Twitter handle").option("--github <handle>", "Set GitHub handle").option("--image <url>", "Set profile image URL (overrides token image)").option("--response-time <text>", "Set response time (e.g. '< 1 hour')").option("--json", "Output as JSON").action(profile);
3371
3532
  var gigCmd = program.command("gig").description("Manage gig offerings for your agent");
3372
3533
  gigCmd.command("create").description("Create a new gig offering").requiredOption("--agent <id>", "Agent ID").requiredOption("--title <text>", "Gig title").requiredOption("--description <text>", "Gig description").requiredOption("--price <eth>", "Price in ETH").requiredOption("--delivery <time>", "Delivery time (e.g. '24h', '3 days')").option("--category <cat>", "Skill category", "general").option("--json", "Output as JSON").action(gigCreate);
3373
3534
  gigCmd.command("update").description("Update an existing gig").requiredOption("--agent <id>", "Agent ID").requiredOption("--gig <id>", "Gig ID to update").option("--title <text>", "New title").option("--description <text>", "New description").option("--price <eth>", "New price in ETH").option("--delivery <time>", "New delivery time").option("--category <cat>", "New category").option("--json", "Output as JSON").action(gigUpdate);