@lucid-agents/taskmarket 1.33.0 → 1.35.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.
Files changed (25) hide show
  1. package/dist/agent-compatibility.json +1 -1
  2. package/dist/{api-J7LB2GAY.js → api-R76D244Y.js} +2 -2
  3. package/dist/{channels-XY4SSEBG.js → channels-SVCU2MU5.js} +4 -4
  4. package/dist/{chunk-ACKPSLIR.js → chunk-54OR2JDT.js} +10 -6
  5. package/dist/{chunk-BESAWMVS.js → chunk-B7W4G3EY.js} +1 -1
  6. package/dist/{chunk-ALTIKIGD.js → chunk-BDKM5JMT.js} +1 -1
  7. package/dist/{chunk-YUYW5N4U.js → chunk-CHX7O7EU.js} +1 -1
  8. package/dist/{chunk-QUIWYQZL.js → chunk-G3U2BQNC.js} +27 -5
  9. package/dist/{chunk-WVHSHZBK.js → chunk-JRWRBSS2.js} +3 -3
  10. package/dist/{chunk-VW7I7J5Q.js → chunk-KHDQRFHG.js} +5 -5
  11. package/dist/{chunk-KGU3CSYK.js → chunk-L6D2CDVQ.js} +14 -9
  12. package/dist/{chunk-TZH4XU62.js → chunk-QAGDCIMU.js} +1690 -1518
  13. package/dist/{chunk-E7HZKIUP.js → chunk-WP7GXSKE.js} +3 -3
  14. package/dist/{chunk-JZ3SUHWV.js → chunk-YGSVDU2D.js} +3 -3
  15. package/dist/{chunk-QQ4PHAPV.js → chunk-YHVP2UNE.js} +1 -1
  16. package/dist/{doctor-LHFMQ737.js → doctor-IIVQFDIB.js} +8 -8
  17. package/dist/index.js +851 -199
  18. package/dist/{launch-B2KFGY2L.js → launch-OC4LIPSS.js} +11 -11
  19. package/dist/pi-extensions/xgate.cjs +2944 -2801
  20. package/dist/{read-auth-P2WTHPWW.js → read-auth-AGP3CUMT.js} +3 -3
  21. package/dist/{reconcile-7AIMC4P3.js → reconcile-H3JIKN2X.js} +4 -4
  22. package/dist/{status-6EYEBSQ6.js → status-SARVECVT.js} +8 -8
  23. package/dist/{sync-pull-XSIEQDGD.js → sync-pull-IUPV57MU.js} +4 -4
  24. package/dist/{task-access-grants-Z32WK3FJ.js → task-access-grants-HALV3NEO.js} +2 -2
  25. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  attestedWorkerAction,
6
6
  claimTask,
7
7
  cliTaskReadContext,
8
+ cliTaskTransport,
8
9
  cliTaskWriteContext,
9
10
  getTask,
10
11
  getTaskTerms,
@@ -13,7 +14,7 @@ import {
13
14
  listWorkerSubmissions,
14
15
  submitTaskFiles,
15
16
  taskRequirementsOf
16
- } from "./chunk-KGU3CSYK.js";
17
+ } from "./chunk-L6D2CDVQ.js";
17
18
  import {
18
19
  ComputeCreditError,
19
20
  applyComputeCreditSetup,
@@ -35,14 +36,14 @@ import {
35
36
  refusedPaidWrite,
36
37
  releasePendingComputePurchase,
37
38
  resolvePendingComputePurchases
38
- } from "./chunk-WVHSHZBK.js";
39
+ } from "./chunk-JRWRBSS2.js";
39
40
  import {
40
41
  signReadAuth
41
- } from "./chunk-ACKPSLIR.js";
42
+ } from "./chunk-54OR2JDT.js";
42
43
  import {
43
44
  saveTaskAccessGrant,
44
45
  taskAccessGrantHeaders
45
- } from "./chunk-YUYW5N4U.js";
46
+ } from "./chunk-CHX7O7EU.js";
46
47
  import {
47
48
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
48
49
  X402PayError,
@@ -60,7 +61,7 @@ import {
60
61
  setX402PolicyRuleEnabled,
61
62
  signSponsoredTempoTransfer,
62
63
  signTaskmarketFeePayment
63
- } from "./chunk-QQ4PHAPV.js";
64
+ } from "./chunk-YHVP2UNE.js";
64
65
  import {
65
66
  ALL_NETWORKS,
66
67
  ApiError,
@@ -94,6 +95,7 @@ import {
94
95
  isNetworkName,
95
96
  isPendingApiError,
96
97
  keystoreExists,
98
+ keystoreLoadFailure,
97
99
  liveNetworkNames,
98
100
  loadKeystore,
99
101
  networkNameForChain,
@@ -122,7 +124,7 @@ import {
122
124
  withErrorContext,
123
125
  withIdempotentWrite,
124
126
  withTapSignature
125
- } from "./chunk-QUIWYQZL.js";
127
+ } from "./chunk-G3U2BQNC.js";
126
128
  import {
127
129
  AGENT_AVATAR_MAX_BYTES,
128
130
  AGENT_HIRES_ROLES,
@@ -162,6 +164,7 @@ import {
162
164
  EcosystemEventsInputSchema,
163
165
  EthAddressSchema,
164
166
  EvaluatorDirectoryResultSchema,
167
+ GRANT_MODE_NAMES,
165
168
  HIRE_AGENT_AT_CAPACITY,
166
169
  HIRE_AGENT_UNAVAILABLE,
167
170
  HIRE_MAX_ACCEPT_WINDOW_SECS,
@@ -306,6 +309,7 @@ import {
306
309
  isTerminalWalletBridgeStatus,
307
310
  marketEventPreferenceChange,
308
311
  needsYouKindForIntent,
312
+ normalizeReferenceCode,
309
313
  parseIsoDurationSeconds,
310
314
  parseScheduleCadence,
311
315
  paymentTokenSymbol,
@@ -337,11 +341,11 @@ import {
337
341
  vaultCallGasLimit7702,
338
342
  verifierProviderId,
339
343
  verifiersUnsupportedOnChain
340
- } from "./chunk-TZH4XU62.js";
344
+ } from "./chunk-QAGDCIMU.js";
341
345
  import "./chunk-S7SJMJ2I.js";
342
346
 
343
347
  // src/index.ts
344
- import { Command as Command145 } from "commander";
348
+ import { Command as Command151 } from "commander";
345
349
  import { createRequire } from "module";
346
350
 
347
351
  // src/commands/init.ts
@@ -5250,14 +5254,14 @@ function createSolanaJsonRpcIntegerOverflowError(methodName, keyPath, value) {
5250
5254
  } else {
5251
5255
  argumentLabel = `\`${keyPath[0].toString()}\``;
5252
5256
  }
5253
- const path8 = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
5257
+ const path9 = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : void 0;
5254
5258
  const error = new SolanaError(SOLANA_ERROR__RPC__INTEGER_OVERFLOW, {
5255
5259
  argumentLabel,
5256
5260
  keyPath,
5257
5261
  methodName,
5258
- optionalPathLabel: path8 ? ` at path \`${path8}\`` : "",
5262
+ optionalPathLabel: path9 ? ` at path \`${path9}\`` : "",
5259
5263
  value,
5260
- ...path8 !== void 0 ? { path: path8 } : void 0
5264
+ ...path9 !== void 0 ? { path: path9 } : void 0
5261
5265
  });
5262
5266
  safeCaptureStackTrace(error, createSolanaJsonRpcIntegerOverflowError);
5263
5267
  return error;
@@ -8445,10 +8449,10 @@ function createSubmissionReviewClient(options) {
8445
8449
  )
8446
8450
  };
8447
8451
  })();
8448
- async function get(path8, schema) {
8449
- return schema.parse(await options.transport.get(path8, await headers()));
8452
+ async function get(path9, schema) {
8453
+ return schema.parse(await options.transport.get(path9, await headers()));
8450
8454
  }
8451
- async function write(action, payload, chainId, path8, schema, key) {
8455
+ async function write(action, payload, chainId, path9, schema, key) {
8452
8456
  const idempotencyKey = z.string().uuid().parse(resolveIdempotencyKey(key)).toLowerCase();
8453
8457
  return withIdempotentWrite(idempotencyKey, async () => {
8454
8458
  const signer = await options.signer();
@@ -8472,7 +8476,7 @@ function createSubmissionReviewClient(options) {
8472
8476
  signature,
8473
8477
  ...["pause", "cancel", "delete"].includes(action) ? { action } : {}
8474
8478
  };
8475
- const result = await options.transport.post(path8, body, idempotencyKey);
8479
+ const result = await options.transport.post(path9, body, idempotencyKey);
8476
8480
  if (result.idempotencyKey !== idempotencyKey)
8477
8481
  throw new Error(
8478
8482
  "Review response has a different request key; recover the original request before retrying."
@@ -8685,9 +8689,9 @@ function cliSubmissionReviewClient() {
8685
8689
  };
8686
8690
  },
8687
8691
  transport: {
8688
- get: (path8, headers) => apiGet(path8, { headers }),
8689
- preview: (path8, body, headers) => apiReadPost(path8, body, { headers }),
8690
- post: (path8, body, idempotencyKey, headers) => apiPost(path8, body, { idempotencyKey, headers })
8692
+ get: (path9, headers) => apiGet(path9, { headers }),
8693
+ preview: (path9, body, headers) => apiReadPost(path9, body, { headers }),
8694
+ post: (path9, body, idempotencyKey, headers) => apiPost(path9, body, { idempotencyKey, headers })
8691
8695
  }
8692
8696
  });
8693
8697
  }
@@ -8970,13 +8974,13 @@ function retryAfterMs(res) {
8970
8974
  const wait = Number.isFinite(seconds) && seconds >= 0 ? seconds : DEFAULT_RETRY_AFTER_SECONDS;
8971
8975
  return Math.min(wait, MAX_RETRY_AFTER_SECONDS) * 1e3;
8972
8976
  }
8973
- async function x402Post(path8, body, options) {
8977
+ async function x402Post(path9, body, options) {
8974
8978
  const sleep4 = options?.sleep ?? ((ms2) => new Promise((resolve) => setTimeout(resolve, ms2)));
8975
8979
  if (paymentProtocolOf(selectedNetwork().chainId) === "mpp")
8976
- return mppPost(path8, body, options);
8980
+ return mppPost(path9, body, options);
8977
8981
  const keystore = await loadKeystore();
8978
8982
  const idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);
8979
- const request = paidWriteRequest(keystore, path8, body, idempotencyKey);
8983
+ const request = paidWriteRequest(keystore, path9, body, idempotencyKey);
8980
8984
  Object.assign(request.headers, options?.headers ?? {});
8981
8985
  return withIdempotentWrite(idempotencyKey, async () => {
8982
8986
  const r1 = await fetch(request.url, {
@@ -8993,7 +8997,7 @@ async function x402Post(path8, body, options) {
8993
8997
  if (r1.ok) {
8994
8998
  return { data: await r1.json(), idempotencyKey };
8995
8999
  }
8996
- throw refusedPaidWrite(path8, r1.status, await readFailureBody(r1), idempotencyKey);
9000
+ throw refusedPaidWrite(path9, r1.status, await readFailureBody(r1), idempotencyKey);
8997
9001
  }
8998
9002
  const requirements = await r1.json();
8999
9003
  const chain = taskmarketChain(selectedNetwork().chainId);
@@ -9030,7 +9034,7 @@ async function x402Post(path8, body, options) {
9030
9034
  await sleep4(retryAfterMs(r2));
9031
9035
  continue;
9032
9036
  }
9033
- throw failedAfterPayment(path8, r2.status, read3, idempotencyKey);
9037
+ throw failedAfterPayment(path9, r2.status, read3, idempotencyKey);
9034
9038
  }
9035
9039
  });
9036
9040
  }
@@ -9304,25 +9308,18 @@ var HOOK_V2_MANIFEST_ABI = [
9304
9308
  var PAYOUT_GATE_ABI = [
9305
9309
  {
9306
9310
  type: "function",
9307
- name: "gateOf",
9311
+ name: "gateDetailsOf",
9308
9312
  stateMutability: "view",
9309
9313
  inputs: [{ name: "taskId", type: "bytes32" }],
9310
9314
  outputs: [
9311
9315
  { name: "gatingTaskId", type: "bytes32" },
9312
9316
  { name: "deadline", type: "uint64" },
9317
+ { name: "maxDeadline", type: "uint64" },
9313
9318
  { name: "gatingPaid", type: "bool" },
9319
+ { name: "gatingFailed", type: "bool" },
9320
+ { name: "relinked", type: "bool" },
9314
9321
  { name: "open", type: "bool" }
9315
9322
  ]
9316
- },
9317
- {
9318
- type: "function",
9319
- name: "linkGatingTask",
9320
- stateMutability: "nonpayable",
9321
- inputs: [
9322
- { name: "taskId", type: "bytes32" },
9323
- { name: "gatingTaskId", type: "bytes32" }
9324
- ],
9325
- outputs: []
9326
9323
  }
9327
9324
  ];
9328
9325
  function parseDurationSeconds(raw) {
@@ -9362,13 +9359,16 @@ function payoutGateAddressOf(registry) {
9362
9359
  return entry ? entry.address.toLowerCase() : null;
9363
9360
  }
9364
9361
  function payoutGateStatus(hook, gate) {
9365
- const [gatingTaskId, deadline, gatingPaid, open] = gate;
9362
+ const [gatingTaskId, deadline, maxDeadline, gatingPaid, gatingFailed, relinked, open] = gate;
9366
9363
  if (deadline === 0n) return null;
9367
9364
  return {
9368
9365
  hook: hook.toLowerCase(),
9369
9366
  gatingTaskId: /^0x0{64}$/.test(gatingTaskId) ? null : gatingTaskId.toLowerCase(),
9370
9367
  deadline: Number(deadline),
9368
+ maxDeadline: Number(maxDeadline),
9371
9369
  gatingPaid,
9370
+ gatingFailed,
9371
+ relinked,
9372
9372
  open
9373
9373
  };
9374
9374
  }
@@ -9432,13 +9432,13 @@ async function settleRecording(data, idempotencyKey, options = {}) {
9432
9432
  `Transaction ${txHash ?? "(unknown)"} is confirmed on chain; recording it is pending. Waiting up to ${Math.round(timeoutMs / 1e3)}s for the backend to record it...`
9433
9433
  );
9434
9434
  const headers = (await signReadAuth())?.headers ?? {};
9435
- const path8 = `/api/intents?idempotencyKey=${encodeURIComponent(idempotencyKey)}`;
9435
+ const path9 = `/api/intents?idempotencyKey=${encodeURIComponent(idempotencyKey)}`;
9436
9436
  const deadline = now() + timeoutMs;
9437
9437
  while (now() < deadline) {
9438
9438
  await sleep4(intervalMs);
9439
9439
  let intent;
9440
9440
  try {
9441
- intent = IntentStatusResponseSchema.safeParse(await apiGet(path8, { headers }));
9441
+ intent = IntentStatusResponseSchema.safeParse(await apiGet(path9, { headers }));
9442
9442
  } catch {
9443
9443
  continue;
9444
9444
  }
@@ -9479,7 +9479,7 @@ async function gateOfOn(hook, id, chainId) {
9479
9479
  const gate = await chainReader(chainId).readContract({
9480
9480
  address: hook,
9481
9481
  abi: PAYOUT_GATE_ABI,
9482
- functionName: "gateOf",
9482
+ functionName: "gateDetailsOf",
9483
9483
  args: [id]
9484
9484
  });
9485
9485
  return payoutGateStatus(hook, gate);
@@ -9522,8 +9522,15 @@ function linkGateRelayPath(taskId) {
9522
9522
  function linkGateRelayBody(taskId, gatingTaskId) {
9523
9523
  return { taskId, gatingTaskId };
9524
9524
  }
9525
+ function extendGateRelayPath(taskId) {
9526
+ return `/api/tasks/${taskId}/extend-gate`;
9527
+ }
9528
+ function extendGateRelayBody(taskId, deadline) {
9529
+ return { taskId, deadline };
9530
+ }
9531
+ var SETTLED_GATE_MESSAGE = "a gate changes only before accept";
9525
9532
  var linkGateCmd = new Command10("link-gate").description(
9526
- "Link the task whose payout this task's payout gate waits on (requester only, once, before accept; relayed by the platform for the standard action fee)"
9533
+ "Link the task whose payout this task's payout gate waits on: once when the gate has none, or to replace a gating task that ended cancelled or expired, once (requester or project operator; relayed by the platform for the standard action fee)"
9527
9534
  ).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption("--gated-by <taskId>", "The gating task ID (0x-prefixed hex)").action(async (taskId, opts) => {
9528
9535
  try {
9529
9536
  const id = assertTaskId(taskId);
@@ -9534,23 +9541,87 @@ var linkGateCmd = new Command10("link-gate").description(
9534
9541
  if (gatingTaskId === id.toLowerCase()) throw new Error("A task cannot gate itself");
9535
9542
  const gate = await readPayoutGate(id);
9536
9543
  if (!gate) throw new Error(`Task ${taskId} has no payout gate`);
9544
+ if (gate.open) {
9545
+ throw new Error(`The payout gate of ${taskId} is already open; it can no longer change`);
9546
+ }
9537
9547
  if (gate.gatingTaskId) {
9538
- throw new Error(`Task ${taskId} is already gated by ${gate.gatingTaskId}; it links once`);
9548
+ if (!gate.gatingFailed) {
9549
+ throw new Error(
9550
+ `Task ${taskId} is already gated by ${gate.gatingTaskId}, which has not been cancelled or expired; it is replaced only after it ends without paying out`
9551
+ );
9552
+ }
9553
+ if (gate.relinked) {
9554
+ throw new Error(
9555
+ `Task ${taskId} already used its one re-link; its payout gate opens at its deadline`
9556
+ );
9557
+ }
9539
9558
  }
9540
- const keystore = await loadKeystore();
9541
9559
  const task = await getTask(cliTaskReadContext(), { taskId: id });
9542
9560
  if (!task) throw new Error(`Task not found: ${taskId}`);
9543
- if (task.requester.toLowerCase() !== keystore.walletAddress.toLowerCase()) {
9561
+ if (SETTLED_STATUSES.has(task.status)) {
9562
+ throw new Error(`Task ${taskId} is ${task.status}; ${SETTLED_GATE_MESSAGE}`);
9563
+ }
9564
+ const { data: result, idempotencyKey } = await x402Post(
9565
+ linkGateRelayPath(id),
9566
+ linkGateRelayBody(id, gatingTaskId),
9567
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
9568
+ );
9569
+ printResult(
9570
+ {
9571
+ ...result,
9572
+ taskId,
9573
+ ...await settleRecording(result, idempotencyKey),
9574
+ payoutGate: {
9575
+ ...gate,
9576
+ gatingTaskId,
9577
+ gatingFailed: false,
9578
+ relinked: Boolean(gate.gatingTaskId)
9579
+ }
9580
+ },
9581
+ { idempotencyKey }
9582
+ );
9583
+ } catch (err) {
9584
+ renderFailure(err);
9585
+ }
9586
+ });
9587
+ function parseGateDeadline(raw, nowSecs) {
9588
+ const trimmed = raw.trim();
9589
+ if (/^\d{9,}$/.test(trimmed)) return Number(trimmed);
9590
+ return nowSecs + parseDurationSeconds(trimmed);
9591
+ }
9592
+ var extendGateCmd = new Command10("extend-gate").description(
9593
+ "Move a task's payout gate deadline later (requester or project operator; upward only, at most 180 days after the task was created, only while the gate is closed; relayed by the platform for the standard action fee)"
9594
+ ).argument("<taskId>", "The gated task ID (0x-prefixed hex)").requiredOption(
9595
+ "--deadline <when>",
9596
+ "The new deadline: a Unix timestamp in seconds, or a duration from now such as 48h or 7d"
9597
+ ).action(async (taskId, opts) => {
9598
+ try {
9599
+ const id = assertTaskId(taskId);
9600
+ const gate = await readPayoutGate(id);
9601
+ if (!gate) throw new Error(`Task ${taskId} has no payout gate`);
9602
+ if (gate.open) {
9603
+ throw new Error(`The payout gate of ${taskId} is already open; it can no longer change`);
9604
+ }
9605
+ const deadline = parseGateDeadline(
9606
+ opts.deadline,
9607
+ await chainNowSecs(selectedNetwork().chainId)
9608
+ );
9609
+ if (deadline <= gate.deadline) {
9610
+ throw new Error(`--deadline must be later than the current deadline (${gate.deadline})`);
9611
+ }
9612
+ if (deadline > gate.maxDeadline) {
9544
9613
  throw new Error(
9545
- `Only the task's requester ${task.requester} can link its gate; this wallet is ${keystore.walletAddress}`
9614
+ `--deadline is past ${gate.maxDeadline}, the latest a gate may run (180 days after the task was created)`
9546
9615
  );
9547
9616
  }
9617
+ const task = await getTask(cliTaskReadContext(), { taskId: id });
9618
+ if (!task) throw new Error(`Task not found: ${taskId}`);
9548
9619
  if (SETTLED_STATUSES.has(task.status)) {
9549
- throw new Error(`Task ${taskId} is ${task.status}; a gate links only before accept`);
9620
+ throw new Error(`Task ${taskId} is ${task.status}; ${SETTLED_GATE_MESSAGE}`);
9550
9621
  }
9551
9622
  const { data: result, idempotencyKey } = await x402Post(
9552
- linkGateRelayPath(id),
9553
- linkGateRelayBody(id, gatingTaskId),
9623
+ extendGateRelayPath(id),
9624
+ extendGateRelayBody(id, deadline),
9554
9625
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
9555
9626
  );
9556
9627
  printResult(
@@ -9558,7 +9629,7 @@ var linkGateCmd = new Command10("link-gate").description(
9558
9629
  ...result,
9559
9630
  taskId,
9560
9631
  ...await settleRecording(result, idempotencyKey),
9561
- payoutGate: { ...gate, gatingTaskId }
9632
+ payoutGate: { ...gate, deadline }
9562
9633
  },
9563
9634
  { idempotencyKey }
9564
9635
  );
@@ -10804,7 +10875,52 @@ var listCmd = new Command12("list").alias("search").description("List available
10804
10875
 
10805
10876
  // src/commands/task/get.ts
10806
10877
  import { Command as Command13 } from "commander";
10807
- var getCmd = new Command13("get").description("Get task details").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
10878
+ var TASK_CODE_PREFIX = /^TSK-/i;
10879
+ function looksLikeTaskCode(value) {
10880
+ return TASK_CODE_PREFIX.test(value.trim());
10881
+ }
10882
+ function normalizeTaskCode(value) {
10883
+ const reference = normalizeReferenceCode(value);
10884
+ return reference?.entity === "task" ? reference.code : null;
10885
+ }
10886
+ async function resolveTaskCode(code) {
10887
+ const page = await listTasks(cliTaskReadContext(), { q: code, status: "ALL", limit: "2" });
10888
+ const match = page.tasks.find((task) => task.referenceCode?.toUpperCase() === code);
10889
+ return match?.id ?? null;
10890
+ }
10891
+ var getCmd = new Command13("get").description(
10892
+ "Get task details, by 0x task ID or by TSK- reference code (codes resolve only for listed tasks)"
10893
+ ).argument("<taskId>", "Task ID (0x-prefixed hex) or task reference code (TSK-XXXXXXXX)").action(async (taskRef) => {
10894
+ let taskId = taskRef;
10895
+ if (looksLikeTaskCode(taskRef)) {
10896
+ const code = normalizeTaskCode(taskRef);
10897
+ if (!code) {
10898
+ return void renderFailure(
10899
+ new Error(
10900
+ `Not a task reference code: ${taskRef.trim()}. A task code is TSK- followed by 8 letters and digits, e.g. TSK-4M0BXQ2E.`
10901
+ ),
10902
+ { details: { code: "invalid_task_code" } }
10903
+ );
10904
+ }
10905
+ let resolved;
10906
+ try {
10907
+ resolved = await resolveTaskCode(code);
10908
+ } catch (err) {
10909
+ return void renderFailure(err);
10910
+ }
10911
+ if (!resolved) {
10912
+ return void renderFailure(
10913
+ new Error(
10914
+ `No listed task has the code ${code}. A code only finds tasks in the public listing, so a private or unlisted task, a task from before the listing cutoff and a mistyped code all look the same here. If you have the task's 0x ID, run: taskmarket task get <taskId>`
10915
+ ),
10916
+ { details: { code: "task_code_not_found", taskCode: code } }
10917
+ );
10918
+ }
10919
+ taskId = resolved;
10920
+ }
10921
+ await printTask(taskId);
10922
+ });
10923
+ async function printTask(taskId) {
10808
10924
  const task = await getTask(cliTaskReadContext(), { taskId });
10809
10925
  if (!task) {
10810
10926
  printError(
@@ -10820,7 +10936,7 @@ var getCmd = new Command13("get").description("Get task details").argument("<tas
10820
10936
  ...await payoutGateOf(taskId, task)
10821
10937
  })
10822
10938
  );
10823
- });
10939
+ }
10824
10940
  function winningSubmissionOf(task) {
10825
10941
  const awards = task.awards ?? [];
10826
10942
  const primary = awards.find((award) => award.isPrimary) ?? [...awards].sort((left, right) => left.rank - right.rank)[0];
@@ -11002,7 +11118,7 @@ var submitCmd = new Command14("submit").description("Submit work for a task").ar
11002
11118
  const { submissionId, idempotencyKey } = await submitTaskFiles(
11003
11119
  cliTaskWriteContext(keystore),
11004
11120
  { taskId },
11005
- opts.file.map((path8) => ({ path: path8, role: opts.role })),
11121
+ opts.file.map((path9) => ({ path: path9, role: opts.role })),
11006
11122
  { idempotencyKey: submissionKey }
11007
11123
  );
11008
11124
  printResult({ submissionId }, { idempotencyKey });
@@ -11582,20 +11698,20 @@ var bidCmd = new Command26("bid").description("Submit a bid on an auction task")
11582
11698
  }
11583
11699
  if (!await confirmUnverifiedHooks("bid", taskId, opts.acceptUnverifiedHooks)) return;
11584
11700
  if (!await confirmStakeTerms("bid", taskId, opts.yes)) return;
11585
- const path8 = `/api/tasks/${taskId}/bids`;
11701
+ const path9 = `/api/tasks/${taskId}/bids`;
11586
11702
  const body = { taskId, price: priceBaseUnits };
11587
11703
  const task = await taskRequirementsOf(taskId);
11588
11704
  const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
11589
11705
  const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
11590
11706
  taskId,
11591
11707
  await loadKeystore(),
11592
- async (tap) => x402Post(path8, body, {
11708
+ async (tap) => x402Post(path9, body, {
11593
11709
  maxAmount: ACTION_FEE_MAX_AMOUNT,
11594
11710
  headers: (await signReadAuth())?.headers ?? {},
11595
11711
  ...tap ? { tap } : {}
11596
11712
  }),
11597
11713
  task
11598
- ) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
11714
+ ) : await x402Post(path9, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
11599
11715
  printResult({ bidId: result.bidId }, { idempotencyKey });
11600
11716
  }
11601
11717
  );
@@ -11615,19 +11731,19 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
11615
11731
  return;
11616
11732
  }
11617
11733
  }
11618
- const path8 = `/api/tasks/${taskId}/bids/accept`;
11734
+ const path9 = `/api/tasks/${taskId}/bids/accept`;
11619
11735
  const task = await taskRequirementsOf(taskId);
11620
11736
  const gated = (task?.identity?.length ?? 0) > 0 || taskRequiresTap(task);
11621
11737
  const { data: result, idempotencyKey } = gated ? await attestedWorkerAction(
11622
11738
  taskId,
11623
11739
  await loadKeystore(),
11624
- async (tap) => x402Post(path8, body, {
11740
+ async (tap) => x402Post(path9, body, {
11625
11741
  maxAmount: ACTION_FEE_MAX_AMOUNT,
11626
11742
  headers: (await signReadAuth())?.headers ?? {},
11627
11743
  ...tap ? { tap } : {}
11628
11744
  }),
11629
11745
  task
11630
- ) : await x402Post(path8, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
11746
+ ) : await x402Post(path9, body, { maxAmount: ACTION_FEE_MAX_AMOUNT });
11631
11747
  const { chainId } = selectedNetwork();
11632
11748
  printResult(
11633
11749
  {
@@ -12610,6 +12726,7 @@ taskCommand2.addCommand(listCmd);
12610
12726
  taskCommand2.addCommand(getCmd);
12611
12727
  taskCommand2.addCommand(payoutGateCmd);
12612
12728
  taskCommand2.addCommand(linkGateCmd);
12729
+ taskCommand2.addCommand(extendGateCmd);
12613
12730
  taskCommand2.addCommand(submitCmd);
12614
12731
  taskCommand2.addCommand(acceptCmd);
12615
12732
  taskCommand2.addCommand(acceptSubmissionsCmd);
@@ -12859,7 +12976,7 @@ async function runAgentCommand(options) {
12859
12976
  try {
12860
12977
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
12861
12978
  const pi = assertAgentCompatibility();
12862
- const { runAgent } = await import("./launch-B2KFGY2L.js");
12979
+ const { runAgent } = await import("./launch-OC4LIPSS.js");
12863
12980
  result = await runAgent({
12864
12981
  model: options.model,
12865
12982
  pi,
@@ -13293,13 +13410,13 @@ function agentManagementCommands() {
13293
13410
  const status = new Command57("status").description(
13294
13411
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
13295
13412
  ).action(async () => {
13296
- const { collectAgentStatus } = await import("./status-6EYEBSQ6.js");
13413
+ const { collectAgentStatus } = await import("./status-SARVECVT.js");
13297
13414
  await run(() => collectAgentStatus());
13298
13415
  });
13299
13416
  const doctor = new Command57("doctor").description(
13300
13417
  "Check that the agent can start: Node and the bundled runtime, wallet and policy, channels, API, sandbox broker, host keys, xgate and RPC. Reads only."
13301
13418
  ).action(async () => {
13302
- const { runDoctor } = await import("./doctor-LHFMQ737.js");
13419
+ const { runDoctor } = await import("./doctor-IIVQFDIB.js");
13303
13420
  const report = await run(() => runDoctor());
13304
13421
  if (report && !report.ok) process.exitCode = 1;
13305
13422
  });
@@ -13310,7 +13427,7 @@ function agentManagementCommands() {
13310
13427
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
13311
13428
  ).action(
13312
13429
  async (invocationId, options) => {
13313
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-7AIMC4P3.js");
13430
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-H3JIKN2X.js");
13314
13431
  const choice = { rail: options.rail, channel: options.channel };
13315
13432
  if (invocationId !== void 0) {
13316
13433
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -13342,7 +13459,7 @@ function agentManagementCommands() {
13342
13459
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
13343
13460
  );
13344
13461
  }
13345
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-XY4SSEBG.js");
13462
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-SVCU2MU5.js");
13346
13463
  const { rails } = await openAgentChannels();
13347
13464
  const result = await requestTopUp(selectRail(rails, options.rail), amount);
13348
13465
  return {
@@ -13362,8 +13479,8 @@ function agentManagementCommands() {
13362
13479
  await run(async () => {
13363
13480
  await requireExperimental();
13364
13481
  const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
13365
- const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-XY4SSEBG.js");
13366
- const { reconcileLeasedPurchase } = await import("./reconcile-7AIMC4P3.js");
13482
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-SVCU2MU5.js");
13483
+ const { reconcileLeasedPurchase } = await import("./reconcile-H3JIKN2X.js");
13367
13484
  const opened = await openAgentChannels();
13368
13485
  const { rail, retired } = selectChannel(opened, options);
13369
13486
  const result = await closeChannel(
@@ -13417,7 +13534,7 @@ function agentManagementCommands() {
13417
13534
  async (options) => {
13418
13535
  await run(async () => {
13419
13536
  await requireExperimental();
13420
- const { runPull } = await import("./sync-pull-XSIEQDGD.js");
13537
+ const { runPull } = await import("./sync-pull-IUPV57MU.js");
13421
13538
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
13422
13539
  return runPull(options, {
13423
13540
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -17324,6 +17441,7 @@ var EVENT_ID2 = /^\d{1,19}$/;
17324
17441
  var RETRY_BASE_MS = 1e3;
17325
17442
  var RETRY_MAX_MS = 3e4;
17326
17443
  var RATE_LIMITED_WAIT_MS = 3e4;
17444
+ var RETRY_JITTER = 0.25;
17327
17445
  var EARLY_EMPTY_MS = MARKET_EVENT_WAIT_MAX_MS / 5;
17328
17446
  var EMPTY_BACKOFF_BASE_MS = 1e3;
17329
17447
  var EMPTY_BACKOFF_MAX_MS = 15e3;
@@ -17361,12 +17479,17 @@ function query3(params) {
17361
17479
  const text = search.toString();
17362
17480
  return text ? `?${text}` : "";
17363
17481
  }
17364
- async function readAuthHeaders() {
17365
- const auth = await signReadAuth();
17482
+ var CAUSE_MAX_CHARS = 200;
17483
+ function shortCause(cause) {
17484
+ return cause.length > CAUSE_MAX_CHARS ? `${cause.slice(0, CAUSE_MAX_CHARS)}...` : cause;
17485
+ }
17486
+ function couldNotSign(cause) {
17487
+ return `Could not sign the read-auth message with this keystore${cause ? ` (${shortCause(cause)})` : ""}.`;
17488
+ }
17489
+ async function readAuthHeaders(signal) {
17490
+ const auth = await signReadAuth(signal);
17366
17491
  if (!auth) throw new Error("No keystore found. Run `taskmarket init` first.");
17367
- if (Object.keys(auth.headers).length === 0) {
17368
- throw new Error("Could not sign the read-auth message with this keystore.");
17369
- }
17492
+ if (Object.keys(auth.headers).length === 0) throw new Error(couldNotSign(auth.error));
17370
17493
  return { wallet: auth.walletAddress, headers: auth.headers };
17371
17494
  }
17372
17495
  async function readHistory(options) {
@@ -17384,8 +17507,8 @@ async function readHistory(options) {
17384
17507
  return;
17385
17508
  }
17386
17509
  const headers = options.task ? (await signReadAuth())?.headers ?? {} : (await readAuthHeaders()).headers;
17387
- const path8 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
17388
- printResult(await apiGet(path8, { headers }));
17510
+ const path9 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
17511
+ printResult(await apiGet(path9, { headers }));
17389
17512
  }
17390
17513
  function warn(message) {
17391
17514
  process.stderr.write(`${JSON.stringify({ ok: true, warning: message })}
@@ -17410,13 +17533,34 @@ function retryable(error) {
17410
17533
  if (error instanceof ApiError) return error.status === 429 || error.status >= 500;
17411
17534
  return error instanceof TypeError;
17412
17535
  }
17536
+ function retryWaitMs(error, failures, random) {
17537
+ if (!retryable(error)) throw error;
17538
+ if (error instanceof ApiError && error.status === 429) {
17539
+ return jittered(RATE_LIMITED_WAIT_MS, random);
17540
+ }
17541
+ return backoffWaitMs(failures, random);
17542
+ }
17543
+ function backoffWaitMs(failures, random) {
17544
+ return jittered(Math.min(RETRY_BASE_MS * 2 ** failures, RETRY_MAX_MS), random);
17545
+ }
17546
+ function jittered(ms2, random) {
17547
+ return Math.round(ms2 * (1 + RETRY_JITTER * random()));
17548
+ }
17413
17549
  async function followMarketEvents(options = {}) {
17414
17550
  const { signal } = options;
17415
17551
  const sleep4 = options.sleep ?? abortableSleep;
17416
17552
  const now = options.now ?? Date.now;
17417
17553
  const stopped = () => signal?.aborted === true || (options.shouldStop?.() ?? false);
17418
17554
  const print = options.print ?? ((event) => printResult(event));
17419
- const { wallet, headers } = await readAuthHeaders();
17555
+ const random = options.random ?? Math.random;
17556
+ let auth;
17557
+ try {
17558
+ auth = await readAuthHeaders(signal);
17559
+ } catch (error) {
17560
+ if (signal?.aborted) return;
17561
+ throw error;
17562
+ }
17563
+ const { wallet, headers } = auth;
17420
17564
  const network = selectedNetwork().name;
17421
17565
  let cursor = options.since ?? await loadMarketEventCursor(wallet, network);
17422
17566
  if (cursor === void 0) {
@@ -17450,9 +17594,7 @@ async function followMarketEvents(options = {}) {
17450
17594
  failures = 0;
17451
17595
  } catch (error) {
17452
17596
  if (signal?.aborted) return;
17453
- if (!retryable(error)) throw error;
17454
- const rateLimited = error instanceof ApiError && error.status === 429;
17455
- const waitMs = rateLimited ? RATE_LIMITED_WAIT_MS : Math.min(RETRY_BASE_MS * 2 ** failures, RETRY_MAX_MS);
17597
+ const waitMs = retryWaitMs(error, failures, random);
17456
17598
  failures += 1;
17457
17599
  warn(
17458
17600
  `Reading market events failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
@@ -17481,6 +17623,145 @@ async function followMarketEvents(options = {}) {
17481
17623
  }
17482
17624
  }
17483
17625
  }
17626
+ var TASK_ID = /^0x[0-9a-fA-F]{1,64}$/;
17627
+ var TASK_FOLLOW_INTERVAL_MS = 5e3;
17628
+ var TASK_FOLLOW_PAGE_GAP_MS = 250;
17629
+ var SIGN_ATTEMPTS = 5;
17630
+ var SIGN_ATTEMPT_TIMEOUT_MS = 15e3;
17631
+ function parseTaskId(taskId) {
17632
+ if (!TASK_ID.test(taskId)) throw new Error("--task must be a task id (0x-prefixed hex)");
17633
+ return taskId;
17634
+ }
17635
+ async function signTaskFollow(startup) {
17636
+ const { signal } = startup;
17637
+ if (await checkTaskFollowKeystore() === "none") return null;
17638
+ for (let failures = 0; ; failures += 1) {
17639
+ if (startup.stopped()) return "stopped";
17640
+ const timeout = AbortSignal.timeout(startup.signTimeoutMs);
17641
+ const auth = await signReadAuth(signal ? AbortSignal.any([signal, timeout]) : timeout);
17642
+ if (signal?.aborted) return "stopped";
17643
+ if (auth === null) throw unreadableKeystore(await keystoreLoadFailure() ?? "it went away");
17644
+ if (Object.keys(auth.headers).length > 0) return auth;
17645
+ if (failures + 1 >= SIGN_ATTEMPTS) throw new Error(couldNotSign(auth.error));
17646
+ const waitMs = backoffWaitMs(failures, startup.random);
17647
+ warn(
17648
+ `Signing the read-auth message failed (${shortCause(auth.error ?? "no reason given")}); retrying in ${Math.round(waitMs / 1e3)}s`
17649
+ );
17650
+ await startup.sleep(waitMs, signal);
17651
+ }
17652
+ }
17653
+ var KEYSTORE_SIGNING_FIELDS = ["walletAddress", "deviceId", "apiToken", "encryptedKey"];
17654
+ async function checkTaskFollowKeystore() {
17655
+ let keystore;
17656
+ try {
17657
+ keystore = await loadKeystore();
17658
+ } catch {
17659
+ const failure = await keystoreLoadFailure();
17660
+ if (failure === null) return "none";
17661
+ throw unreadableKeystore(failure);
17662
+ }
17663
+ const fields = keystore ?? {};
17664
+ const missing = KEYSTORE_SIGNING_FIELDS.filter((field) => typeof fields[field] !== "string");
17665
+ if (missing.length > 0) {
17666
+ throw new Error(
17667
+ `The keystore is missing ${missing.join(", ")}, so this follow cannot read as your wallet.`
17668
+ );
17669
+ }
17670
+ return "present";
17671
+ }
17672
+ function unreadableKeystore(failure) {
17673
+ return new Error(
17674
+ `The keystore could not be checked or read (${failure}), so this follow cannot read as your wallet.`
17675
+ );
17676
+ }
17677
+ async function assertTaskVisible(taskId, auth, options) {
17678
+ const { signal } = options;
17679
+ const context = {
17680
+ ...cliTaskReadContext(),
17681
+ readAuth: async () => auth,
17682
+ transport: {
17683
+ ...cliTaskTransport,
17684
+ get: (path9, headers) => apiGet(path9, { headers, signal })
17685
+ }
17686
+ };
17687
+ let task;
17688
+ for (let failures = 0; ; failures += 1) {
17689
+ if (options.stopped()) return false;
17690
+ try {
17691
+ task = await getTask(context, { taskId });
17692
+ break;
17693
+ } catch (error) {
17694
+ if (signal?.aborted) return false;
17695
+ if (error instanceof ApiError && error.status === 404) break;
17696
+ const waitMs = retryWaitMs(error, failures, options.random);
17697
+ warn(
17698
+ `Reading the task failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
17699
+ );
17700
+ await options.sleep(waitMs, signal);
17701
+ }
17702
+ }
17703
+ if (signal?.aborted) return false;
17704
+ if (!task) {
17705
+ throw new Error(
17706
+ `Task not found: ${taskId} (or this is a private task you don't have access to -- if you have a password for it, run: taskmarket task unlock ${taskId} --password <password>)`
17707
+ );
17708
+ }
17709
+ return true;
17710
+ }
17711
+ async function followTaskMarketEvents(options) {
17712
+ const { signal, taskId } = options;
17713
+ const sleep4 = options.sleep ?? abortableSleep;
17714
+ const stopped = () => signal?.aborted === true || (options.shouldStop?.() ?? false);
17715
+ const print = options.print ?? ((event) => printResult(event));
17716
+ const random = options.random ?? Math.random;
17717
+ const pageSize = options.limit ?? MARKET_EVENT_PAGE_MAX;
17718
+ const startup = {
17719
+ signal,
17720
+ stopped,
17721
+ sleep: sleep4,
17722
+ random,
17723
+ signTimeoutMs: options.signTimeoutMs ?? SIGN_ATTEMPT_TIMEOUT_MS
17724
+ };
17725
+ const auth = await signTaskFollow(startup);
17726
+ if (auth === "stopped") return;
17727
+ const headers = auth?.headers ?? {};
17728
+ if (!await assertTaskVisible(taskId, auth, startup)) return;
17729
+ let cursor = options.since;
17730
+ let catchingUp = cursor === void 0;
17731
+ let failures = 0;
17732
+ while (!stopped()) {
17733
+ let page;
17734
+ try {
17735
+ page = await apiGet(
17736
+ `/api/market-events/tasks/${encodeURIComponent(taskId)}${query3({ since: cursor, limit: pageSize })}`,
17737
+ { headers, signal }
17738
+ );
17739
+ failures = 0;
17740
+ } catch (error) {
17741
+ if (signal?.aborted) return;
17742
+ const waitMs = retryWaitMs(error, failures, random);
17743
+ failures += 1;
17744
+ warn(
17745
+ `Reading the task's events failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s`
17746
+ );
17747
+ await sleep4(waitMs, signal);
17748
+ continue;
17749
+ }
17750
+ const after = cursor === void 0 ? -1n : BigInt(cursor);
17751
+ const fresh = page.events.filter((event) => BigInt(event.id) > after);
17752
+ if (!catchingUp) {
17753
+ for (const event of fresh) print(event);
17754
+ }
17755
+ const last = fresh.at(-1)?.id;
17756
+ if (last !== void 0) cursor = last;
17757
+ if (page.events.length >= pageSize && fresh.length > 0) {
17758
+ if (!stopped()) await sleep4(TASK_FOLLOW_PAGE_GAP_MS, signal);
17759
+ continue;
17760
+ }
17761
+ catchingUp = false;
17762
+ if (!stopped()) await sleep4(TASK_FOLLOW_INTERVAL_MS, signal);
17763
+ }
17764
+ }
17484
17765
  async function untilInterrupted(follow) {
17485
17766
  const controller = new AbortController();
17486
17767
  const stop = () => controller.abort();
@@ -17529,7 +17810,10 @@ function createSeenCommand() {
17529
17810
  function createEventsCommand() {
17530
17811
  return new Command78("events").description(
17531
17812
  "Read your market events, oldest first (or newest first with --newest), or one task's timeline; --follow waits for new ones and resumes after a restart"
17532
- ).option("--since <id>", "Only events after this event id (overrides the stored cursor)").option("--limit <n>", `Events per read, 1 to ${MARKET_EVENT_PAGE_MAX}`).option("--task <taskId>", "One task's timeline instead of your own events").option("--newest", "Read your own events newest first, as the web Activity tab does").option("--before <id>", "With --newest, only events before this event id (the next page)").option(
17813
+ ).option("--since <id>", "Only events after this event id (overrides the stored cursor)").option("--limit <n>", `Events per read, 1 to ${MARKET_EVENT_PAGE_MAX}`).option(
17814
+ "--task <taskId>",
17815
+ "One task's timeline instead of your own events; with --follow, its new events as they happen"
17816
+ ).option("--newest", "Read your own events newest first, as the web Activity tab does").option("--before <id>", "With --newest, only events before this event id (the next page)").option(
17533
17817
  "--follow",
17534
17818
  "Keep reading: print each new event with your pending actions on its task, from a cursor stored under ~/.taskmarket"
17535
17819
  ).action(async (options) => {
@@ -17537,10 +17821,16 @@ function createEventsCommand() {
17537
17821
  await readHistory(options);
17538
17822
  return;
17539
17823
  }
17540
- if (options.task) throw new Error("--follow reads your own events; it cannot take --task");
17541
17824
  assertOrderOptions(options);
17542
17825
  const since = parseSince(options.since);
17543
17826
  const limit = parseLimit(options.limit);
17827
+ if (options.task !== void 0) {
17828
+ const taskId = parseTaskId(options.task);
17829
+ await untilInterrupted(
17830
+ (signal) => followTaskMarketEvents({ taskId, since, limit, signal })
17831
+ );
17832
+ return;
17833
+ }
17544
17834
  await untilInterrupted((signal) => followMarketEvents({ since, limit, signal }));
17545
17835
  }).addCommand(createSeenCommand());
17546
17836
  }
@@ -17714,8 +18004,100 @@ async function agentEmailAddress(walletAddress, signal) {
17714
18004
  return result.emailAddress ?? null;
17715
18005
  }
17716
18006
 
18007
+ // src/lib/bug-follow.ts
18008
+ import { promises as fs9 } from "fs";
18009
+ import path7 from "path";
18010
+ function bugCursorPath(walletAddress, network) {
18011
+ return path7.join(
18012
+ getTaskmarketHome(),
18013
+ "bug-cursor",
18014
+ `${network}-${walletAddress.toLowerCase()}.json`
18015
+ );
18016
+ }
18017
+ async function loadBugCursor(file) {
18018
+ try {
18019
+ const record = JSON.parse(await fs9.readFile(file, "utf-8"));
18020
+ return record.reports && typeof record.reports === "object" ? record.reports : void 0;
18021
+ } catch {
18022
+ return void 0;
18023
+ }
18024
+ }
18025
+ async function saveBugCursor(file, reports) {
18026
+ await fs9.mkdir(path7.dirname(file), { recursive: true });
18027
+ const temp = `${file}.${process.pid}.tmp`;
18028
+ await fs9.writeFile(temp, JSON.stringify({ reports }, null, 2), { mode: 384 });
18029
+ await fs9.rename(temp, file);
18030
+ }
18031
+ function bugLine(report) {
18032
+ return {
18033
+ source: "bugs",
18034
+ id: report.id,
18035
+ number: report.number,
18036
+ title: report.title,
18037
+ status: report.status,
18038
+ updatedAt: report.updatedAt,
18039
+ command: `taskmarket bug show ${report.id}`
18040
+ };
18041
+ }
18042
+ function diffBugReports(reports, cursor) {
18043
+ const lines = [];
18044
+ const next = {};
18045
+ for (const report of reports) {
18046
+ const seen = cursor?.[report.id];
18047
+ if (cursor && report.status !== (seen?.status ?? report.status)) {
18048
+ lines.push({
18049
+ ...bugLine(report),
18050
+ type: "bug.status_changed",
18051
+ previousStatus: seen.status
18052
+ });
18053
+ }
18054
+ let replyAt = seen?.replyAt ?? null;
18055
+ if (report.unread && replyAt !== report.updatedAt) {
18056
+ lines.push({ ...bugLine(report), type: "bug.reply" });
18057
+ replyAt = report.updatedAt;
18058
+ }
18059
+ next[report.id] = { status: report.status, replyAt };
18060
+ }
18061
+ return { lines, cursor: next };
18062
+ }
18063
+ var BUG_POLL_INTERVAL_MS = 6e4;
18064
+ var BUG_RETRY_MAX_MS = 15 * 6e4;
18065
+ var BUG_PAGE_SIZE = 100;
18066
+ async function followBugs(options) {
18067
+ const { signal } = options;
18068
+ const sleep4 = options.sleep ?? abortableSleep2;
18069
+ const file = bugCursorPath(options.walletAddress, selectedNetwork().name);
18070
+ let cursor = await loadBugCursor(file);
18071
+ let failures = 0;
18072
+ while (!signal?.aborted) {
18073
+ let waitMs = BUG_POLL_INTERVAL_MS;
18074
+ try {
18075
+ const auth = await signReadAuth();
18076
+ const result = await apiGet(`/api/bug-reports/mine?limit=${BUG_PAGE_SIZE}`, {
18077
+ headers: auth?.headers ?? {},
18078
+ signal
18079
+ });
18080
+ const diff = diffBugReports(result.reports, cursor);
18081
+ for (const line of diff.lines) options.print(line);
18082
+ if (JSON.stringify(diff.cursor) !== JSON.stringify(cursor)) {
18083
+ cursor = diff.cursor;
18084
+ await saveBugCursor(file, cursor);
18085
+ }
18086
+ failures = 0;
18087
+ } catch (error) {
18088
+ if (signal?.aborted) return;
18089
+ waitMs = Math.min(BUG_POLL_INTERVAL_MS * 2 ** (failures + 1), BUG_RETRY_MAX_MS);
18090
+ failures += 1;
18091
+ warn2(
18092
+ `Reading your bug reports failed (${error instanceof Error ? error.message : String(error)}); retrying in ${Math.round(waitMs / 1e3)}s.`
18093
+ );
18094
+ }
18095
+ await sleep4(waitMs, signal);
18096
+ }
18097
+ }
18098
+
17717
18099
  // src/commands/daemon.ts
17718
- var DAEMON_SOURCES = ["market", "xmtp", "email"];
18100
+ var DAEMON_SOURCES = ["market", "xmtp", "email", "bugs"];
17719
18101
  function parseDaemonSources(value) {
17720
18102
  const names = value.split(",").map((name) => name.trim()).filter(Boolean);
17721
18103
  const unknown = names.filter((name) => !DAEMON_SOURCES.includes(name));
@@ -17848,7 +18230,7 @@ function createDaemonCommand(seams = {}) {
17848
18230
  emailMissing = `Could not check for an agent email (${err instanceof Error ? err.message : String(err)}).`;
17849
18231
  }
17850
18232
  }
17851
- const othersRun = (source) => source !== "market" && sources.has("market") || source !== "xmtp" && xmtpAvailable || source !== "email" && emailAvailable;
18233
+ const othersRun = (source) => source !== "market" && sources.has("market") || source !== "xmtp" && xmtpAvailable || source !== "email" && emailAvailable || source !== "bugs" && sources.has("bugs");
17852
18234
  if (xmtpUnsupported) {
17853
18235
  if (!othersRun("xmtp")) throw xmtpUnsupported;
17854
18236
  process.stderr.write(
@@ -17953,8 +18335,22 @@ function createDaemonCommand(seams = {}) {
17953
18335
  stop();
17954
18336
  });
17955
18337
  };
18338
+ const bugsLoop = async () => {
18339
+ if (!sources.has("bugs")) return;
18340
+ await followBugs({
18341
+ walletAddress: keystore.walletAddress,
18342
+ signal: abortController.signal,
18343
+ print: (line) => printResult(line)
18344
+ });
18345
+ };
17956
18346
  try {
17957
- await Promise.allSettled([xmtpLoop(), heartbeatLoop(), eventsLoop(), emailLoop()]);
18347
+ await Promise.allSettled([
18348
+ xmtpLoop(),
18349
+ heartbeatLoop(),
18350
+ eventsLoop(),
18351
+ emailLoop(),
18352
+ bugsLoop()
18353
+ ]);
17958
18354
  } finally {
17959
18355
  xmtpPolicy?.stop();
17960
18356
  }
@@ -17998,8 +18394,8 @@ var listCommand = new Command80("list").description(
17998
18394
  const channel = parseChannel(options.channel);
17999
18395
  const headers = await walletHeaders();
18000
18396
  if (!headers) return;
18001
- const path8 = channel === "email" ? PREFERENCES_PATH : `${PREFERENCES_PATH}?channel=${channel}`;
18002
- printResult(await apiGet(path8, { headers }));
18397
+ const path9 = channel === "email" ? PREFERENCES_PATH : `${PREFERENCES_PATH}?channel=${channel}`;
18398
+ printResult(await apiGet(path9, { headers }));
18003
18399
  } catch (err) {
18004
18400
  renderFailure(err);
18005
18401
  }
@@ -18900,7 +19296,7 @@ async function walk(root) {
18900
19296
  const names = (await readdir(dir)).sort();
18901
19297
  for (const name of names) {
18902
19298
  const full = join(dir, name);
18903
- const path8 = relative(root, full).split(sep).join("/");
19299
+ const path9 = relative(root, full).split(sep).join("/");
18904
19300
  const info = await lstat(full);
18905
19301
  if (info.isDirectory()) {
18906
19302
  await visit(full);
@@ -18909,7 +19305,7 @@ async function walk(root) {
18909
19305
  if (entries.length >= MAX_ENTRIES)
18910
19306
  throw new Error(`The skill directory has more than ${MAX_ENTRIES} files`);
18911
19307
  const mode = info.isSymbolicLink() ? USER_SKILL_GIT_MODES.symlink : !info.isFile() ? "other" : info.mode & 73 ? USER_SKILL_GIT_MODES.executable : USER_SKILL_GIT_MODES.file;
18912
- entries.push({ path: path8, mode, full });
19308
+ entries.push({ path: path9, mode, full });
18913
19309
  }
18914
19310
  };
18915
19311
  await visit(root);
@@ -19098,15 +19494,15 @@ skillsCommand.addCommand(archiveCommand);
19098
19494
 
19099
19495
  // src/commands/brief.ts
19100
19496
  import { randomUUID as randomUUID5 } from "crypto";
19101
- import fs9 from "fs/promises";
19102
- import path7 from "path";
19497
+ import fs10 from "fs/promises";
19498
+ import path8 from "path";
19103
19499
  import { Command as Command103 } from "commander";
19104
19500
  var BRIEF_COOKIE = "taskmarket_brief";
19105
19501
  var CREDENTIAL_PATTERN = /^[0-9a-f-]{36}\.[0-9a-f]{64}$/;
19106
- var credentialFile = () => path7.join(getTaskmarketHome(), "brief.json");
19502
+ var credentialFile = () => path8.join(getTaskmarketHome(), "brief.json");
19107
19503
  async function readCredentials() {
19108
19504
  try {
19109
- const parsed = JSON.parse(await fs9.readFile(credentialFile(), "utf8"));
19505
+ const parsed = JSON.parse(await fs10.readFile(credentialFile(), "utf8"));
19110
19506
  return parsed && typeof parsed === "object" ? parsed : {};
19111
19507
  } catch {
19112
19508
  return {};
@@ -19116,8 +19512,8 @@ async function writeCredential(value) {
19116
19512
  const all = await readCredentials();
19117
19513
  if (value) all[apiUrl()] = value;
19118
19514
  else delete all[apiUrl()];
19119
- await fs9.mkdir(getTaskmarketHome(), { recursive: true, mode: 448 });
19120
- await fs9.writeFile(credentialFile(), JSON.stringify(all, null, 2), { mode: 384 });
19515
+ await fs10.mkdir(getTaskmarketHome(), { recursive: true, mode: 448 });
19516
+ await fs10.writeFile(credentialFile(), JSON.stringify(all, null, 2), { mode: 384 });
19121
19517
  }
19122
19518
  async function savedCredential() {
19123
19519
  const value = (await readCredentials())[apiUrl()];
@@ -19348,7 +19744,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
19348
19744
  );
19349
19745
 
19350
19746
  // src/commands/x402/policy.ts
19351
- import { promises as fs10 } from "fs";
19747
+ import { promises as fs11 } from "fs";
19352
19748
  import { Command as Command108 } from "commander";
19353
19749
  import { createInterface as createInterface6 } from "readline";
19354
19750
  async function confirmUnattendedRule(rule) {
@@ -19390,7 +19786,7 @@ x402PolicyCommand.command("validate").description("Validate the policy file").ac
19390
19786
  });
19391
19787
  x402PolicyCommand.command("schema").description("Print the policy JSON Schema").action(() => printResult(X402_POLICY_JSON_SCHEMA));
19392
19788
  x402PolicyCommand.command("add").description("Add one rule from a JSON file").requiredOption("--rule-file <path>", "JSON file containing one policy rule").action(async (options) => {
19393
- const rule = JSON.parse(await fs10.readFile(options.ruleFile, "utf8"));
19789
+ const rule = JSON.parse(await fs11.readFile(options.ruleFile, "utf8"));
19394
19790
  const policy = await addX402PolicyRule(rule, getX402PolicyPath(), confirmUnattendedRule);
19395
19791
  printResult({ path: getX402PolicyPath(), policy });
19396
19792
  });
@@ -24832,14 +25228,14 @@ function describeSolanaAwards(awards, vaultAddress, solanaChainId, taskId) {
24832
25228
  function isRetryableClaimConflict(err) {
24833
25229
  return err instanceof ApiError && (err.status === 409 || err.status >= 500) && /retry/i.test(err.message);
24834
25230
  }
24835
- async function postClaimWithRetry(path8, body, options = {}) {
25231
+ async function postClaimWithRetry(path9, body, options = {}) {
24836
25232
  const sleep4 = options.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
24837
25233
  const deadline = Date.now() + (options.budgetMs ?? CLAIM_RETRY_BUDGET_MS);
24838
25234
  const idempotencyKey = resolveIdempotencyKey();
24839
25235
  let delayMs = 500;
24840
25236
  for (; ; ) {
24841
25237
  try {
24842
- return await apiPost(path8, body, { idempotencyKey });
25238
+ return await apiPost(path9, body, { idempotencyKey });
24843
25239
  } catch (err) {
24844
25240
  if (!isRetryableClaimConflict(err) || Date.now() + delayMs > deadline) throw err;
24845
25241
  await sleep4(delayMs);
@@ -25190,7 +25586,7 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
25190
25586
  sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
25191
25587
 
25192
25588
  // src/commands/project/index.ts
25193
- import { Command as Command139 } from "commander";
25589
+ import { Command as Command145 } from "commander";
25194
25590
 
25195
25591
  // src/commands/project/accept.ts
25196
25592
  import { Command as Command127 } from "commander";
@@ -25204,7 +25600,7 @@ function parseProjectId(value) {
25204
25600
  return Number(value);
25205
25601
  }
25206
25602
  var DURATION = /^([0-9]+(?:\.[0-9]+)?)(h|d)$/;
25207
- function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
25603
+ function parseEndsAt(value, now = /* @__PURE__ */ new Date(), flag = "--ends-at") {
25208
25604
  const trimmed = value.trim();
25209
25605
  const duration = DURATION.exec(trimmed);
25210
25606
  let at;
@@ -25214,10 +25610,10 @@ function parseEndsAt(value, now = /* @__PURE__ */ new Date()) {
25214
25610
  } else {
25215
25611
  at = new Date(trimmed);
25216
25612
  if (Number.isNaN(at.getTime()) || !/^\d{4}-\d{2}-\d{2}/.test(trimmed)) {
25217
- return { error: "--ends-at must be an ISO 8601 time or a duration such as 72h or 30d" };
25613
+ return { error: `${flag} must be an ISO 8601 time or a duration such as 72h or 30d` };
25218
25614
  }
25219
25615
  }
25220
- if (at.getTime() <= now.getTime()) return { error: "--ends-at must be in the future" };
25616
+ if (at.getTime() <= now.getTime()) return { error: `${flag} must be in the future` };
25221
25617
  return at.toISOString();
25222
25618
  }
25223
25619
  var MAX_TASK_GRACE_SECS = 90 * 24 * 3600;
@@ -25243,9 +25639,9 @@ function parseAmount(value, flag) {
25243
25639
  }
25244
25640
 
25245
25641
  // src/commands/project/write.ts
25246
- async function postProjectWrite(path8, body, options) {
25642
+ async function postProjectWrite(path9, body, options) {
25247
25643
  const { data: result, idempotencyKey } = await x402Post(
25248
- path8,
25644
+ path9,
25249
25645
  { chainId: selectedNetwork().chainId, ...body },
25250
25646
  { maxAmount: options.maxAmount }
25251
25647
  );
@@ -25316,7 +25712,7 @@ function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date())
25316
25712
  );
25317
25713
  return { warning };
25318
25714
  }
25319
- var TASK_ID = /^0x[0-9a-fA-F]{1,78}$/;
25715
+ var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
25320
25716
  var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
25321
25717
  var INPUTS_MAX = 20;
25322
25718
  function parseContinuation(flags) {
@@ -25328,7 +25724,7 @@ function parseContinuation(flags) {
25328
25724
  return { continuation: null };
25329
25725
  }
25330
25726
  const parentTaskId = flags.parent.trim();
25331
- if (!TASK_ID.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
25727
+ if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
25332
25728
  const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
25333
25729
  if (bad !== void 0) {
25334
25730
  return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
@@ -25394,9 +25790,93 @@ projectAddTaskCommand.action(async (id, opts) => {
25394
25790
  }
25395
25791
  });
25396
25792
 
25397
- // src/commands/project/claim.ts
25793
+ // src/commands/project/automations.ts
25398
25794
  import { Command as Command129 } from "commander";
25399
- var projectClaimCommand = new Command129("claim").description(
25795
+ function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
25796
+ if (opts.cap === void 0) {
25797
+ return { error: "--cap is required: the most the automations may draw from the budget" };
25798
+ }
25799
+ const cap = parseAmount(opts.cap, "--cap");
25800
+ if (typeof cap !== "string") return cap;
25801
+ if (BigInt(cap) <= 0n) return { error: "--cap must be greater than zero" };
25802
+ const body = { projectId, cap };
25803
+ if (opts.expires !== void 0) {
25804
+ const at = parseEndsAt(opts.expires, now, "--expires");
25805
+ if (typeof at !== "string") return at;
25806
+ body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
25807
+ }
25808
+ if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
25809
+ return { error: "--period-budget and --period go together: pass both or neither" };
25810
+ }
25811
+ if (opts.periodBudget !== void 0 && opts.period !== void 0) {
25812
+ if (opts.period !== "weekly" && opts.period !== "monthly") {
25813
+ return { error: "--period must be weekly or monthly" };
25814
+ }
25815
+ const periodCap = parseAmount(opts.periodBudget, "--period-budget");
25816
+ if (typeof periodCap !== "string") return periodCap;
25817
+ if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
25818
+ body.periodCap = periodCap;
25819
+ body.period = opts.period;
25820
+ }
25821
+ return body;
25822
+ }
25823
+ var projectAutomationsOnCommand = new Command129("on").description(
25824
+ "Turn the project's automations on, so its schedules and workflows run. Grants the platform runner of the project's chain, which you never name, with a cap: the most the automations may draw from the budget in total, net of refunds (payouts keep counting). The cap is required. On a project whose automations are on, a higher cap raises it and a lower one is refused; turning them on again after off, or raising the cap, needs a chain on contract revision 29 and is refused before payment otherwise. Optional limits (contract revision 29): --expires, and --period-budget with --period; on states them whole, so none stated clears an expiry and a period budget. Schedules paused by off stay paused: resume each one (costs 0.001 in the payment token)"
25825
+ ).argument("<projectId>", "Project id").option(
25826
+ "--cap <amount>",
25827
+ "Required: the most the automations may draw from the budget in total, in the payment token (for example 150). Checked here so a missing cap is a JSON error"
25828
+ ).option(
25829
+ "--expires <time>",
25830
+ "Optional limit: the automations cannot draw after this time, an ISO 8601 time or a duration such as 30d (contract revision 29 or later)"
25831
+ ).option(
25832
+ "--period-budget <amount>",
25833
+ "Optional limit: the most the automations may draw in one period, in the payment token. Needs --period"
25834
+ ).option(
25835
+ "--period <period>",
25836
+ "The period of --period-budget: weekly (7 days) or monthly (30 days)"
25837
+ ).action(
25838
+ async (id, opts) => {
25839
+ const projectId = parseProjectId(id);
25840
+ if (typeof projectId !== "number") return void printError(projectId.error);
25841
+ const body = automationsOnBody(projectId, opts);
25842
+ if ("error" in body) return void printError(String(body.error));
25843
+ await postProjectWrite(`/api/projects/${projectId}/automations`, body, {
25844
+ maxAmount: ACTION_FEE_MAX_AMOUNT,
25845
+ extra: {
25846
+ note: `The runner accepts the grant within moments; read it with: taskmarket project automations status ${projectId}`
25847
+ }
25848
+ });
25849
+ }
25850
+ );
25851
+ var projectAutomationsOffCommand = new Command129("off").description(
25852
+ "Turn the project's automations off: revokes the platform runner's grant and pauses the project's schedules and workflow schedules (reason automations_off). Their definitions stay, tasks already started finish under you, and turning automations on again does not resume them (costs 0.001 in the payment token)"
25853
+ ).argument("<projectId>", "Project id").action(async (id) => {
25854
+ const projectId = parseProjectId(id);
25855
+ if (typeof projectId !== "number") return void printError(projectId.error);
25856
+ await postProjectWrite(
25857
+ `/api/projects/${projectId}/automations/off`,
25858
+ { projectId },
25859
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
25860
+ );
25861
+ });
25862
+ var projectAutomationsStatusCommand = new Command129("status").description(
25863
+ "Whether the project's schedules and workflows can run: state on, off, pending (granted, the runner has not accepted yet) or unavailable (no runner on the chain), with the cap, what is spent and what remains, and whether it can be turned on again or its cap raised (free)"
25864
+ ).argument("<projectId>", "Project id").action(async (id) => {
25865
+ const projectId = parseProjectId(id);
25866
+ if (typeof projectId !== "number") return void printError(projectId.error);
25867
+ try {
25868
+ printResult(await apiGet(withChainId(`/api/projects/${projectId}/automations`)));
25869
+ } catch (err) {
25870
+ renderFailure(err);
25871
+ }
25872
+ });
25873
+ var projectAutomationsCommand = new Command129("automations").description(
25874
+ "The project's automations: one switch for its schedules and workflows. `on --cap <amount>` grants the platform runner of the project chain for you, `off` revokes it and pauses schedules, `status` reads it. `project runner` and `project grant` remain for advanced use"
25875
+ ).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
25876
+
25877
+ // src/commands/project/claim.ts
25878
+ import { Command as Command130 } from "commander";
25879
+ var projectClaimCommand = new Command130("claim").description(
25400
25880
  "Pay a backer its share of a closed or ended project's leftovers: what was unspent plus every later refund, in proportion to its pool shares, less what it already claimed. Anyone may trigger it; the money always goes to the backer. Refused before payment when nothing is owed (costs 0.001 in the payment token)"
25401
25881
  ).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
25402
25882
  const projectId = parseProjectId(id);
@@ -25416,8 +25896,8 @@ var projectClaimCommand = new Command129("claim").description(
25416
25896
  });
25417
25897
 
25418
25898
  // src/commands/project/close.ts
25419
- import { Command as Command130 } from "commander";
25420
- var projectCloseCommand = new Command130("close").description(
25899
+ import { Command as Command131 } from "commander";
25900
+ var projectCloseCommand = new Command131("close").description(
25421
25901
  "Close a project: its unspent budget becomes the backers' pot, which each backer, the owner included, claims with `project claim`. The owner may close it any time, anyone once it is past its end date; tasks already funded run on and their refunds join the pot (costs 0.001 in the payment token)"
25422
25902
  ).argument("<projectId>", "Project id").action(async (id) => {
25423
25903
  const projectId = parseProjectId(id);
@@ -25430,8 +25910,8 @@ var projectCloseCommand = new Command130("close").description(
25430
25910
  });
25431
25911
 
25432
25912
  // src/commands/project/create.ts
25433
- import { Command as Command131 } from "commander";
25434
- var projectCreateCommand = new Command131("create").description(
25913
+ import { Command as Command132 } from "commander";
25914
+ var projectCreateCommand = new Command132("create").description(
25435
25915
  "Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
25436
25916
  ).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
25437
25917
  "--ends-at <time>",
@@ -25465,9 +25945,29 @@ var projectCreateCommand = new Command131("create").description(
25465
25945
  }
25466
25946
  );
25467
25947
 
25948
+ // src/commands/project/extend.ts
25949
+ import { Command as Command133 } from "commander";
25950
+ var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
25951
+ var projectExtendCommand = new Command133("extend").description(
25952
+ "Move an open project's end date later, as the project owner (costs 0.001 in the payment token). The new date must be later than the current one and at most 365 days from now. A closed project, or one past its end date, cannot be extended. Backers' shares and the pool's value do not change; a backer whose pot is still open claims at the new date"
25953
+ ).argument("<projectId>", "Project id").requiredOption("--ends <time>", "The new end date: ISO 8601 or a duration from now such as 90d").action(async (id, opts) => {
25954
+ const projectId = parseProjectId(id);
25955
+ if (typeof projectId !== "number") return void printError(projectId.error);
25956
+ const endsAt = parseEndsAt(opts.ends, /* @__PURE__ */ new Date(), "--ends");
25957
+ if (typeof endsAt !== "string") return void printError(endsAt.error);
25958
+ if (new Date(endsAt).getTime() > Date.now() + MAX_EXTENSION_MS) {
25959
+ return void printError("--ends must be at most 365 days from now");
25960
+ }
25961
+ await postProjectWrite(
25962
+ `/api/projects/${projectId}/extend`,
25963
+ { projectId, endsAt },
25964
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
25965
+ );
25966
+ });
25967
+
25468
25968
  // src/commands/project/fund.ts
25469
- import { Command as Command132 } from "commander";
25470
- var projectFundCommand = new Command132("fund").description(
25969
+ import { Command as Command134 } from "commander";
25970
+ var projectFundCommand = new Command134("fund").description(
25471
25971
  "Back an open project: pay into its funding pool, from any wallet. You (or --on-behalf-of) become a backer holding shares bought at the pool's current value (what it holds plus what its live tasks hold), and once the project is closed or past its end date each backer claims its share of what is left with `project claim` (costs the amount, in the payment token)"
25472
25972
  ).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
25473
25973
  "--on-behalf-of <address>",
@@ -25489,7 +25989,7 @@ var projectFundCommand = new Command132("fund").description(
25489
25989
  });
25490
25990
 
25491
25991
  // src/commands/project/grant.ts
25492
- import { Command as Command133 } from "commander";
25992
+ import { Command as Command135 } from "commander";
25493
25993
  function grantBody(projectId, opts) {
25494
25994
  if (!ADDRESS.test(opts.operator)) {
25495
25995
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -25512,8 +26012,8 @@ function grantBody(projectId, opts) {
25512
26012
  revokeRemovesControl: opts.revokeRemovesControl
25513
26013
  };
25514
26014
  }
25515
- var projectGrantCommand = new Command133("grant").description(
25516
- "Grant a wallet (an agent or a person) the right to create tasks from the project's budget under the terms below. It can spend only after it accepts, which freezes the terms; until then a new grant replaces them (costs 0.001 in the payment token)"
26015
+ var projectGrantCommand = new Command135("grant").description(
26016
+ "Grant a wallet (an agent or a person) the right to create tasks from the project's budget under the terms below. It can spend only after it accepts, which freezes the terms; until then a new grant replaces them, and a revoked operator can be granted again, back to pending (costs 0.001 in the payment token)"
25517
26017
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
25518
26018
  "--cap <amount>",
25519
26019
  "The most the operator's tasks may draw from the budget in total, net of refunds (payouts keep counting, refunds free it), in the payment token (default: no cap beyond the budget)"
@@ -25538,7 +26038,7 @@ var projectGrantCommand = new Command133("grant").description(
25538
26038
  });
25539
26039
 
25540
26040
  // src/commands/project/review.ts
25541
- import { Command as Command134 } from "commander";
26041
+ import { Command as Command136 } from "commander";
25542
26042
  function reviewEvaluator(opts) {
25543
26043
  if (opts.evaluator !== void 0 && opts.off) {
25544
26044
  return { error: "Pass --evaluator <address> or --off, not both" };
@@ -25553,7 +26053,7 @@ function reviewEvaluator(opts) {
25553
26053
  }
25554
26054
  return opts.evaluator;
25555
26055
  }
25556
- var projectReviewCommand = new Command134("review").description(
26056
+ var projectReviewCommand = new Command136("review").description(
25557
26057
  "Read, set or clear the project's review default, as its owner. With an evaluator set, every task created through the API from the project gets that evaluator, and a project task that names a different one is refused. Enforced by the API, not the contract. Setting or clearing costs 0.001 in the payment token; reading is free"
25558
26058
  ).argument("<projectId>", "Project id").option("--evaluator <address>", "The evaluator every project task gets").option("--off", "Turn the review default off: each task's requester reviews it again").action(async (id, opts) => {
25559
26059
  const projectId = parseProjectId(id);
@@ -25594,9 +26094,113 @@ async function ownerEvaluatorWarnings(evaluator) {
25594
26094
  ];
25595
26095
  }
25596
26096
 
26097
+ // src/commands/project/raise-cap.ts
26098
+ import { Command as Command137 } from "commander";
26099
+ var projectRaiseCapCommand = new Command137("raise-cap").description(
26100
+ "Advanced. Raise any operator's spending cap in place, as the project owner (costs 0.001 in the payment token). For the platform runner use `project automations on --cap <higher amount>`, which takes the same path. The new cap must be above the current one, which must be set; a cap is never lowered, and a revoked operator is granted again instead"
26101
+ ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to raise").requiredOption("--cap <amount>", "The new cap in the payment token, above the current cap").action(async (id, opts) => {
26102
+ const projectId = parseProjectId(id);
26103
+ if (typeof projectId !== "number") return void printError(projectId.error);
26104
+ if (!ADDRESS.test(opts.operator)) {
26105
+ return void printError("--operator must be a wallet address (0x + 40 hex chars)");
26106
+ }
26107
+ const cap = parseAmount(opts.cap, "--cap");
26108
+ if (typeof cap !== "string") return void printError(cap.error);
26109
+ await postProjectWrite(
26110
+ `/api/projects/${projectId}/grants/${opts.operator}/cap`,
26111
+ { projectId, operator: opts.operator, cap },
26112
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26113
+ );
26114
+ });
26115
+
26116
+ // src/commands/project/lower-cap.ts
26117
+ import { Command as Command138 } from "commander";
26118
+ var projectLowerCapCommand = new Command138("lower-cap").description(
26119
+ "Advanced. Lower an operator's lifetime spending cap in place, as the project owner (costs 0.001 in the payment token; contract revision 29 or later). The new cap must be below the current one (any cap lowers a grant that has none) and at least what the operator already draws (committed). To raise a cap use `project raise-cap`; for the platform runner, `project automations on --cap`"
26120
+ ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
26121
+ "--cap <amount>",
26122
+ "The new lifetime cap in the payment token, below the current cap"
26123
+ ).action(async (id, opts) => {
26124
+ const projectId = parseProjectId(id);
26125
+ if (typeof projectId !== "number") return void printError(projectId.error);
26126
+ if (!ADDRESS.test(opts.operator)) {
26127
+ return void printError("--operator must be a wallet address (0x + 40 hex chars)");
26128
+ }
26129
+ const cap = parseAmount(opts.cap, "--cap");
26130
+ if (typeof cap !== "string") return void printError(cap.error);
26131
+ if (BigInt(cap) <= 0n) return void printError("--cap must be greater than zero");
26132
+ await postProjectWrite(
26133
+ `/api/projects/${projectId}/grants/${opts.operator}/cap/lower`,
26134
+ { projectId, operator: opts.operator, cap },
26135
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26136
+ );
26137
+ });
26138
+
26139
+ // src/commands/project/limits.ts
26140
+ import { Command as Command139 } from "commander";
26141
+ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26142
+ if (!ADDRESS.test(opts.operator)) {
26143
+ return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
26144
+ }
26145
+ const body = { projectId, operator: opts.operator };
26146
+ if (opts.expires !== void 0) {
26147
+ const at = parseEndsAt(opts.expires, now, "--expires");
26148
+ if (typeof at !== "string") return at;
26149
+ body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
26150
+ }
26151
+ if (opts.modes !== void 0) {
26152
+ const modes = opts.modes.split(",").map((m) => m.trim().toLowerCase());
26153
+ const unknown = modes.filter((m) => !GRANT_MODE_NAMES.includes(m));
26154
+ if (modes.length === 0 || unknown.length > 0) {
26155
+ return { error: `--modes takes a comma-separated list of: ${GRANT_MODE_NAMES.join(", ")}` };
26156
+ }
26157
+ body.allowedModes = [...new Set(modes)];
26158
+ }
26159
+ if (opts.maxReward !== void 0) {
26160
+ const max = parseAmount(opts.maxReward, "--max-reward");
26161
+ if (typeof max !== "string") return max;
26162
+ if (BigInt(max) <= 0n) return { error: "--max-reward must be greater than zero" };
26163
+ body.maxRewardPerTask = max;
26164
+ }
26165
+ if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
26166
+ return { error: "--period-budget and --period go together: pass both or neither" };
26167
+ }
26168
+ if (opts.periodBudget !== void 0 && opts.period !== void 0) {
26169
+ if (opts.period !== "weekly" && opts.period !== "monthly") {
26170
+ return { error: "--period must be weekly or monthly" };
26171
+ }
26172
+ const periodCap = parseAmount(opts.periodBudget, "--period-budget");
26173
+ if (typeof periodCap !== "string") return periodCap;
26174
+ if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
26175
+ body.periodCap = periodCap;
26176
+ body.period = opts.period;
26177
+ }
26178
+ return body;
26179
+ }
26180
+ var projectLimitsCommand = new Command139("limits").description(
26181
+ "Advanced. Set all of an operator's limits as the project owner, stated whole: a flag you leave out is no limit of that kind (costs 0.001 in the payment token; contract revision 29 or later). The limits bound the operator on top of its cap: an expiry, the task modes it may create, the most one task may hold, and a budget per week or month. For the platform runner, `project automations on` takes --expires, --period-budget and --period"
26182
+ ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
26183
+ "--expires <time>",
26184
+ "The operator cannot draw after this time: ISO 8601 or a duration such as 30d"
26185
+ ).option(
26186
+ "--modes <list>",
26187
+ `Task modes the operator may create, comma separated (${GRANT_MODE_NAMES.join(", ")}); default every mode`
26188
+ ).option(
26189
+ "--max-reward <amount>",
26190
+ "The most one task may hold from the budget (reward plus evaluator stake), in the payment token"
26191
+ ).option("--period-budget <amount>", "The most the operator may draw per period. Needs --period").option("--period <period>", "weekly (7 days) or monthly (30 days). Needs --period-budget").action(async (id, opts) => {
26192
+ const projectId = parseProjectId(id);
26193
+ if (typeof projectId !== "number") return void printError(projectId.error);
26194
+ const body = limitsBody(projectId, opts);
26195
+ if ("error" in body) return void printError(String(body.error));
26196
+ await postProjectWrite(`/api/projects/${projectId}/grants/${opts.operator}/limits`, body, {
26197
+ maxAmount: ACTION_FEE_MAX_AMOUNT
26198
+ });
26199
+ });
26200
+
25597
26201
  // src/commands/project/revoke.ts
25598
- import { Command as Command135 } from "commander";
25599
- var projectRevokeCommand = new Command135("revoke").description(
26202
+ import { Command as Command140 } from "commander";
26203
+ var projectRevokeCommand = new Command140("revoke").description(
25600
26204
  "End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
25601
26205
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
25602
26206
  const projectId = parseProjectId(id);
@@ -25615,7 +26219,7 @@ var projectRevokeCommand = new Command135("revoke").description(
25615
26219
  });
25616
26220
 
25617
26221
  // src/commands/project/schedule.ts
25618
- import { Command as Command137 } from "commander";
26222
+ import { Command as Command142 } from "commander";
25619
26223
 
25620
26224
  // src/lib/owner-list.ts
25621
26225
  import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
@@ -25656,27 +26260,27 @@ function ownerListQuery(owner, opts, statuses) {
25656
26260
 
25657
26261
  // src/commands/workflow-template.ts
25658
26262
  import { readFile as readFile4 } from "fs/promises";
25659
- import { Command as Command136 } from "commander";
26263
+ import { Command as Command141 } from "commander";
25660
26264
  var UUID2 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
25661
26265
  var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
25662
26266
  var FILE_MAX_BYTES = 256 * 1024;
25663
26267
  var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
25664
- async function readJsonFile(path8, what = "template") {
25665
- if (!path8) return { error: `Pass the ${what} with --file <path> (JSON)` };
26268
+ async function readJsonFile(path9, what = "template") {
26269
+ if (!path9) return { error: `Pass the ${what} with --file <path> (JSON)` };
25666
26270
  let text;
25667
26271
  try {
25668
- const buffer = await readFile4(path8);
26272
+ const buffer = await readFile4(path9);
25669
26273
  if (buffer.length > FILE_MAX_BYTES) {
25670
- return { error: `${path8} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
26274
+ return { error: `${path9} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
25671
26275
  }
25672
26276
  text = buffer.toString("utf8");
25673
26277
  } catch (error) {
25674
- return { error: `Unable to read ${path8}: ${error.message}` };
26278
+ return { error: `Unable to read ${path9}: ${error.message}` };
25675
26279
  }
25676
26280
  try {
25677
26281
  return { document: JSON.parse(text) };
25678
26282
  } catch (error) {
25679
- return { error: `${path8} is not valid JSON: ${error.message}` };
26283
+ return { error: `${path9} is not valid JSON: ${error.message}` };
25680
26284
  }
25681
26285
  }
25682
26286
  function templateChoice(value) {
@@ -25729,8 +26333,8 @@ function parseParams(pairs) {
25729
26333
  return { params };
25730
26334
  }
25731
26335
  var collect6 = (value, previous = []) => [...previous, value];
25732
- async function readValidTemplate(path8) {
25733
- const parsed = await readJsonFile(path8);
26336
+ async function readValidTemplate(path9) {
26337
+ const parsed = await readJsonFile(path9);
25734
26338
  if ("error" in parsed) {
25735
26339
  printError(parsed.error);
25736
26340
  return null;
@@ -25747,7 +26351,7 @@ async function readValidTemplate(path8) {
25747
26351
  }
25748
26352
  return parsed.document;
25749
26353
  }
25750
- var createCommand3 = new Command136("create").description(
26354
+ var createCommand3 = new Command141("create").description(
25751
26355
  "Save a workflow template from a JSON file: a workflow document whose strings use {{param}} placeholders, with each parameter declared (type string, integer, amount or list; a default; bounds). It is checked with every parameter at its minimum and its maximum before it is saved. Costs 0.001 in the payment token"
25752
26356
  ).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
25753
26357
  const template = await readValidTemplate(opts.file);
@@ -25758,7 +26362,7 @@ var createCommand3 = new Command136("create").description(
25758
26362
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
25759
26363
  );
25760
26364
  });
25761
- var updateCommand = new Command136("update").description(
26365
+ var updateCommand = new Command141("update").description(
25762
26366
  "Replace a saved template with a JSON file, as the wallet that saved it; workflows already made from it keep their document. Costs 0.001 in the payment token"
25763
26367
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
25764
26368
  const choice = templateChoice(value);
@@ -25778,7 +26382,7 @@ var updateCommand = new Command136("update").description(
25778
26382
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
25779
26383
  );
25780
26384
  });
25781
- var listCommand6 = new Command136("list").description(
26385
+ var listCommand6 = new Command141("list").description(
25782
26386
  "List the official templates (official: true, ids official:<slug>), the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given). Any wallet may make a workflow from any of them (free)"
25783
26387
  ).option("--owner <address>", "The wallet whose templates to list").option(
25784
26388
  "--mine",
@@ -25822,7 +26426,7 @@ var listCommand6 = new Command136("list").description(
25822
26426
  renderFailure(err);
25823
26427
  }
25824
26428
  });
25825
- var showCommand3 = new Command136("show").description(
26429
+ var showCommand3 = new Command141("show").description(
25826
26430
  "Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its parameters, steps and worst case (free)"
25827
26431
  ).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
25828
26432
  const choice = templateChoice(value);
@@ -25835,7 +26439,7 @@ var showCommand3 = new Command136("show").description(
25835
26439
  renderFailure(err);
25836
26440
  }
25837
26441
  });
25838
- var deleteCommand2 = new Command136("delete").description(
26442
+ var deleteCommand2 = new Command141("delete").description(
25839
26443
  "Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
25840
26444
  ).argument("<templateId>", "Template id").action(async (value) => {
25841
26445
  const choice = templateChoice(value);
@@ -25852,7 +26456,7 @@ var deleteCommand2 = new Command136("delete").description(
25852
26456
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
25853
26457
  );
25854
26458
  });
25855
- var workflowTemplateCommand = new Command136("template").description(
26459
+ var workflowTemplateCommand = new Command141("template").description(
25856
26460
  "Workflow templates: a workflow saved once with declared parameters ({{reward}}, {{topic}}) and made into a workflow on any of your projects with `taskmarket workflow create <projectId> --template <id|official:slug|preset> --param name=value`. Any wallet may use any template; only the wallet that saved one may update or delete it. Official templates: see `taskmarket workflow template list`. Presets: code, content, research"
25857
26461
  ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(deleteCommand2);
25858
26462
  async function createWorkflowFromTemplate(projectId, template, pairs) {
@@ -26058,14 +26662,14 @@ function scheduleSettingsBody(projectId, opts) {
26058
26662
  function scheduleId(value) {
26059
26663
  return UUID3.test(value.trim()) ? value.trim().toLowerCase() : { error: "The schedule id must be a UUID" };
26060
26664
  }
26061
- async function read(path8) {
26665
+ async function read(path9) {
26062
26666
  try {
26063
- printResult(await apiGet(path8));
26667
+ printResult(await apiGet(path9));
26064
26668
  } catch (err) {
26065
26669
  renderFailure(err);
26066
26670
  }
26067
26671
  }
26068
- var createCommand4 = new Command137("create").description(
26672
+ var createCommand4 = new Command142("create").description(
26069
26673
  "Create a schedule that opens a task from the project's budget on a cadence, or starts a run of a workflow (--workflow or --workflow-file), as the project's owner. The platform runner creates each task or run under your grant to it, and pays the action fee: grant it first (see `taskmarket project runner`). A slot is skipped while the previous task is open or the previous run is not settled, and failures in a row (3 by default) pause the schedule. Costs 0.001 in the payment token"
26070
26674
  ).argument("<projectId>", "Project id").requiredOption(
26071
26675
  "--cadence <cadence>",
@@ -26104,7 +26708,7 @@ var createCommand4 = new Command137("create").description(
26104
26708
  });
26105
26709
  });
26106
26710
  var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
26107
- var listCommand7 = new Command137("list").description(
26711
+ var listCommand7 = new Command142("list").description(
26108
26712
  "List a project's schedules, its schedule limits and the platform runner; or, with --mine or --owner, a wallet's schedules across every project it owns, failing ones first, each with its next and last run (free)"
26109
26713
  ).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's schedules across the projects it owns").option("--owner <address>", "List this wallet's schedules across the projects it owns").option(
26110
26714
  "--status <status>",
@@ -26137,7 +26741,7 @@ var listCommand7 = new Command137("list").description(
26137
26741
  const query4 = params.toString();
26138
26742
  await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
26139
26743
  });
26140
- var showCommand4 = new Command137("show").description(
26744
+ var showCommand4 = new Command142("show").description(
26141
26745
  "Show a schedule (its target, task or workflow, with workflowId and template) and its newest runs: opened, skipped with the reason, or failed, each with its task or workflowRunId (free)"
26142
26746
  ).argument("<scheduleId>", "Schedule id").action(async (value) => {
26143
26747
  const id = scheduleId(value);
@@ -26145,7 +26749,7 @@ var showCommand4 = new Command137("show").description(
26145
26749
  await read(`/api/project-schedules/${id}`);
26146
26750
  });
26147
26751
  function actionCommand(action, description) {
26148
- return new Command137(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
26752
+ return new Command142(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
26149
26753
  const id = scheduleId(value);
26150
26754
  if (typeof id !== "string") return void printError(id.error);
26151
26755
  await postProjectWrite(
@@ -26155,7 +26759,7 @@ function actionCommand(action, description) {
26155
26759
  );
26156
26760
  });
26157
26761
  }
26158
- var settingsCommand = new Command137("settings").description(
26762
+ var settingsCommand = new Command142("settings").description(
26159
26763
  "Read or set the project's schedule limits, as its owner: the shortest gap between two runs (PT30M to P7D, default PT30M) and the failures in a row that pause a schedule (1 to 10, default 3). Setting costs 0.001 in the payment token; reading is free"
26160
26764
  ).argument("<projectId>", "Project id").option("--min-interval <duration>", "The shortest gap between runs, as an ISO 8601 duration").option("--pause-after <failures>", "Failures in a row that pause a schedule").action(async (id, opts) => {
26161
26765
  const projectId = parseProjectId(id);
@@ -26177,8 +26781,8 @@ var settingsCommand = new Command137("settings").description(
26177
26781
  maxAmount: ACTION_FEE_MAX_AMOUNT
26178
26782
  });
26179
26783
  });
26180
- var projectScheduleCommand = new Command137("schedule").description(
26181
- "Schedules: a task from the project's budget on a cadence, created by the platform runner under your grant to it"
26784
+ var projectScheduleCommand = new Command142("schedule").description(
26785
+ "Schedules: a task from the project's budget on a cadence, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
26182
26786
  ).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand4).addCommand(
26183
26787
  actionCommand(
26184
26788
  "pause",
@@ -26200,15 +26804,57 @@ var projectScheduleCommand = new Command137("schedule").description(
26200
26804
  "Stop automatic payouts and review acceptance on a workflow schedule, for good: every run it starts, and its runs still going, wait for the owner's confirmation; the runner sends nothing. Refused on a schedule that opens tasks (costs 0.001 in the payment token)"
26201
26805
  )
26202
26806
  ).addCommand(settingsCommand);
26203
- var projectRunnerCommand = new Command137("runner").description(
26204
- "The platform runner's address on the selected network's chain, and every chain's runner (free). Each chain has its own runner wallet: grant the one on the project's chain before scheduling, `taskmarket project grant <projectId> --operator <address> --cap <amount>`. Its cap bounds what scheduled tasks draw in total, net of refunds (payouts keep counting); the runner pays each action fee"
26807
+ var projectRunnerCommand = new Command142("runner").description(
26808
+ "Advanced. The platform runner's address on the selected network's chain, and every chain's runner (free). To run schedules and workflows turn automations on instead, `taskmarket project automations on <projectId> --cap <amount>`, which grants the right runner for you. Granting it by hand with `taskmarket project grant` works too; the runner pays each action fee"
26205
26809
  ).action(async () => {
26206
26810
  await read(withChainId("/api/project-runner"));
26207
26811
  });
26208
26812
 
26813
+ // src/commands/project/transfer.ts
26814
+ import { Command as Command143 } from "commander";
26815
+ var proposeCommand = new Command143("propose").description(
26816
+ "Propose a new owner for a project, as the project owner (costs 0.001 in the payment token). Nothing changes until that wallet runs `project transfer accept`; a new proposal replaces the old one, and `project transfer cancel` withdraws it. Only an open project can be handed over. On accept, the owner's own share of the project's pool moves to the new owner; other backers' shares never move, and the grants stay"
26817
+ ).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
26818
+ const projectId = parseProjectId(id);
26819
+ if (typeof projectId !== "number") return void printError(projectId.error);
26820
+ if (!ADDRESS.test(opts.to)) {
26821
+ return void printError("--to must be a wallet address (0x + 40 hex chars)");
26822
+ }
26823
+ await postProjectWrite(
26824
+ `/api/projects/${projectId}/owner/propose`,
26825
+ { projectId, newOwner: opts.to },
26826
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26827
+ );
26828
+ });
26829
+ var acceptCommand2 = new Command143("accept").description(
26830
+ "Take over a project its owner proposed to this wallet (costs 0.001 in the payment token). Read the project first (`project show`): you receive it as it stands, with its grants and tasks, and the previous owner's share of its pool. Only an open project can be accepted"
26831
+ ).argument("<projectId>", "Project id").action(async (id) => {
26832
+ const projectId = parseProjectId(id);
26833
+ if (typeof projectId !== "number") return void printError(projectId.error);
26834
+ await postProjectWrite(
26835
+ `/api/projects/${projectId}/owner/accept`,
26836
+ { projectId },
26837
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26838
+ );
26839
+ });
26840
+ var cancelCommand = new Command143("cancel").description(
26841
+ "Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
26842
+ ).argument("<projectId>", "Project id").action(async (id) => {
26843
+ const projectId = parseProjectId(id);
26844
+ if (typeof projectId !== "number") return void printError(projectId.error);
26845
+ await postProjectWrite(
26846
+ `/api/projects/${projectId}/owner/cancel`,
26847
+ { projectId },
26848
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26849
+ );
26850
+ });
26851
+ var projectTransferCommand = new Command143("transfer").description(
26852
+ "Hand a project to another wallet in two steps: the owner proposes, the new owner accepts, and the owner can cancel before it does"
26853
+ ).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
26854
+
26209
26855
  // src/commands/project/show.ts
26210
- import { Command as Command138 } from "commander";
26211
- var projectShowCommand = new Command138("show").description(
26856
+ import { Command as Command144 } from "commander";
26857
+ var projectShowCommand = new Command144("show").description(
26212
26858
  "Show a project: its budget, funding pool, newest backers with what each can claim, grants, tasks and its tasks grouped into chains of versions (free)"
26213
26859
  ).argument("<projectId>", "Project id").action(async (id) => {
26214
26860
  const projectId = parseProjectId(id);
@@ -26217,7 +26863,7 @@ var projectShowCommand = new Command138("show").description(
26217
26863
  printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
26218
26864
  });
26219
26865
  var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
26220
- var projectBackersCommand = new Command138("backers").description(
26866
+ var projectBackersCommand = new Command144("backers").description(
26221
26867
  "List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
26222
26868
  ).argument("<projectId>", "Project id").option("--limit <count>", "Backers per page (1-100, default 50)").option("--before <cursor>", "The next page: the previous page's nextBefore").action(async (id, opts) => {
26223
26869
  const projectId = parseProjectId(id);
@@ -26236,13 +26882,13 @@ var projectBackersCommand = new Command138("backers").description(
26236
26882
  await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
26237
26883
  );
26238
26884
  });
26239
- var projectForTaskCommand = new Command138("for-task").description("The project a task was funded from, or null when it was not (free)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
26885
+ var projectForTaskCommand = new Command144("for-task").description("The project a task was funded from, or null when it was not (free)").argument("<taskId>", "Task ID (0x-prefixed hex)").action(async (taskId) => {
26240
26886
  if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
26241
26887
  return void printError("The task id must be 0x-prefixed hex");
26242
26888
  }
26243
26889
  printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
26244
26890
  });
26245
- var projectListCommand = new Command138("list").description(
26891
+ var projectListCommand = new Command144("list").description(
26246
26892
  "List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
26247
26893
  ).option(
26248
26894
  "--funding",
@@ -26293,7 +26939,7 @@ var projectListCommand = new Command138("list").description(
26293
26939
  );
26294
26940
 
26295
26941
  // src/commands/project/index.ts
26296
- var projectCommand = new Command139("project").description(
26942
+ var projectCommand = new Command145("project").description(
26297
26943
  "Projects: one crowdfunded budget that funds tasks of any mode, spent by its owner and the operators it grants; anyone may back an open project, and backers claim back what is left"
26298
26944
  );
26299
26945
  projectCommand.addCommand(projectCreateCommand);
@@ -26302,7 +26948,13 @@ projectCommand.addCommand(projectAddTaskCommand);
26302
26948
  projectCommand.addCommand(projectGrantCommand);
26303
26949
  projectCommand.addCommand(projectAcceptCommand);
26304
26950
  projectCommand.addCommand(projectRevokeCommand);
26951
+ projectCommand.addCommand(projectRaiseCapCommand);
26952
+ projectCommand.addCommand(projectLowerCapCommand);
26953
+ projectCommand.addCommand(projectLimitsCommand);
26954
+ projectCommand.addCommand(projectTransferCommand);
26955
+ projectCommand.addCommand(projectExtendCommand);
26305
26956
  projectCommand.addCommand(projectReviewCommand);
26957
+ projectCommand.addCommand(projectAutomationsCommand);
26306
26958
  projectCommand.addCommand(projectScheduleCommand);
26307
26959
  projectCommand.addCommand(projectRunnerCommand);
26308
26960
  projectCommand.addCommand(projectCloseCommand);
@@ -26314,7 +26966,7 @@ projectCommand.addCommand(projectForTaskCommand);
26314
26966
 
26315
26967
  // src/commands/workflow.ts
26316
26968
  import { readFile as readFile5 } from "fs/promises";
26317
- import { Command as Command140 } from "commander";
26969
+ import { Command as Command146 } from "commander";
26318
26970
  var UUID4 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
26319
26971
  var FILE_MAX_BYTES2 = 256 * 1024;
26320
26972
  function parseWorkflowText(text) {
@@ -26324,19 +26976,19 @@ function parseWorkflowText(text) {
26324
26976
  return { error: `The file is not valid JSON: ${error.message}` };
26325
26977
  }
26326
26978
  }
26327
- async function readDocument(path8) {
26328
- if (!path8) return { error: "Pass the workflow document with --file <path> (JSON)" };
26979
+ async function readDocument(path9) {
26980
+ if (!path9) return { error: "Pass the workflow document with --file <path> (JSON)" };
26329
26981
  let text;
26330
26982
  try {
26331
- const buffer = await readFile5(path8);
26983
+ const buffer = await readFile5(path9);
26332
26984
  if (buffer.length > FILE_MAX_BYTES2) {
26333
26985
  return {
26334
- error: `${path8} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
26986
+ error: `${path9} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
26335
26987
  };
26336
26988
  }
26337
26989
  text = buffer.toString("utf8");
26338
26990
  } catch (error) {
26339
- return { error: `Unable to read ${path8}: ${error.message}` };
26991
+ return { error: `Unable to read ${path9}: ${error.message}` };
26340
26992
  }
26341
26993
  return parseWorkflowText(text);
26342
26994
  }
@@ -26352,9 +27004,9 @@ function stepKey(value) {
26352
27004
  }
26353
27005
  return trimmed;
26354
27006
  }
26355
- async function read2(path8) {
27007
+ async function read2(path9) {
26356
27008
  try {
26357
- printResult(await apiGet(path8));
27009
+ printResult(await apiGet(path9));
26358
27010
  } catch (err) {
26359
27011
  renderFailure(err);
26360
27012
  }
@@ -26378,7 +27030,7 @@ async function projectContext(projectId) {
26378
27030
  runner
26379
27031
  };
26380
27032
  }
26381
- var validateCommand = new Command140("validate").description(
27033
+ var validateCommand = new Command146("validate").description(
26382
27034
  "Check a workflow document (JSON) before anything is spent: the patterns, ids, named inputs and outputs, bounds (maxItems, maxRounds, maxAttempts), contest modes, branch conditions and gate conditions; with --project, also the project step limit and the worst-case spend (every branch on its costliest case, every fallback attempt) against the project's available budget and the runner grant's remaining cap. Every error names a JSON pointer, a code and a message (free)"
26383
27035
  ).argument("[file]", "The document, JSON (or pass --file)").option("--file <path>", "The document, JSON").option("--project <projectId>", "Check it against this project").action(async (file, opts) => {
26384
27036
  const parsed = await readDocument(opts.file ?? file);
@@ -26421,7 +27073,7 @@ var validateCommand = new Command140("validate").description(
26421
27073
  document: result.document
26422
27074
  });
26423
27075
  });
26424
- var createCommand5 = new Command140("create").description(
27076
+ var createCommand5 = new Command146("create").description(
26425
27077
  "Create a workflow on a project, as its owner, from a JSON document (--file) or from a saved template, an official template or a preset (--template <id|official:slug|preset> with --param name=value for each value; a parameter left out takes its default). The API validates it again, worst case included, before saving; nothing runs until `taskmarket workflow run`. Grant the platform runner first (`taskmarket project runner`). Costs 0.001 in the payment token"
26426
27078
  ).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
26427
27079
  "--template <template>",
@@ -26464,7 +27116,7 @@ var createCommand5 = new Command140("create").description(
26464
27116
  );
26465
27117
  });
26466
27118
  var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
26467
- var listCommand8 = new Command140("list").description(
27119
+ var listCommand8 = new Command146("list").description(
26468
27120
  "List a project's workflows, newest first, with its workflow limits and the platform runner; or, with --mine or --owner, a wallet's workflows across every project it owns, those waiting on the owner first (free)"
26469
27121
  ).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's workflows across the projects it owns").option("--owner <address>", "List this wallet's workflows across the projects it owns").option(
26470
27122
  "--status <status>",
@@ -26494,12 +27146,12 @@ var listCommand8 = new Command140("list").description(
26494
27146
  const query4 = params.toString();
26495
27147
  await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
26496
27148
  });
26497
- var showCommand5 = new Command140("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
27149
+ var showCommand5 = new Command146("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
26498
27150
  const id = uuid(value, "workflow");
26499
27151
  if (typeof id !== "string") return void printError(id.error);
26500
27152
  await read2(`/api/project-workflows/${id}`);
26501
27153
  });
26502
- var runsCommand = new Command140("runs").description("Page through a workflow's runs, newest first (free)").argument("<workflowId>", "Workflow id").option("--limit <count>", "Runs per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (value, opts) => {
27154
+ var runsCommand = new Command146("runs").description("Page through a workflow's runs, newest first (free)").argument("<workflowId>", "Workflow id").option("--limit <count>", "Runs per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (value, opts) => {
26503
27155
  const id = uuid(value, "workflow");
26504
27156
  if (typeof id !== "string") return void printError(id.error);
26505
27157
  if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
@@ -26511,14 +27163,14 @@ var runsCommand = new Command140("runs").description("Page through a workflow's
26511
27163
  const query4 = params.toString();
26512
27164
  await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
26513
27165
  });
26514
- var statusCommand3 = new Command140("status").description(
27166
+ var statusCommand3 = new Command146("status").description(
26515
27167
  "Show a run: its outline, each step with its state (pending, open, accepted, failed or skipped), round, item or attempt, autoAccept for a gating review the runner accepts itself, and the next action (free)"
26516
27168
  ).argument("<runId>", "Run id").action(async (value) => {
26517
27169
  const id = uuid(value, "run");
26518
27170
  if (typeof id !== "string") return void printError(id.error);
26519
27171
  await read2(`/api/project-workflow-runs/${id}`);
26520
27172
  });
26521
- var runCommand2 = new Command140("run").description(
27173
+ var runCommand2 = new Command146("run").description(
26522
27174
  "Start a run of a workflow, as the project's owner. The API checks the worst case against the budget and the runner grant's cap again; then the platform runner creates each step's task when it is ready and you review them as usual. Costs 0.001 in the payment token"
26523
27175
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
26524
27176
  const id = uuid(value, "workflow");
@@ -26530,7 +27182,7 @@ var runCommand2 = new Command140("run").description(
26530
27182
  );
26531
27183
  });
26532
27184
  function stepCommand(action, description) {
26533
- return new Command140(action).description(description).argument("<runId>", "Run id").requiredOption(
27185
+ return new Command146(action).description(description).argument("<runId>", "Run id").requiredOption(
26534
27186
  "--step <key>",
26535
27187
  "The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
26536
27188
  ).action(async (value, opts) => {
@@ -26545,7 +27197,7 @@ function stepCommand(action, description) {
26545
27197
  );
26546
27198
  });
26547
27199
  }
26548
- var cancelCommand = new Command140("cancel").description(
27200
+ var cancelCommand2 = new Command146("cancel").description(
26549
27201
  "Cancel a run, as the owner: nothing more is created, and tasks it opened stay open until they end or you cancel them. Costs 0.001 in the payment token"
26550
27202
  ).argument("<runId>", "Run id").action(async (value) => {
26551
27203
  const id = uuid(value, "run");
@@ -26556,7 +27208,7 @@ var cancelCommand = new Command140("cancel").description(
26556
27208
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26557
27209
  );
26558
27210
  });
26559
- var stopAutoPayoutCommand = new Command140("stop-auto-payout").description(
27211
+ var stopAutoPayoutCommand = new Command146("stop-auto-payout").description(
26560
27212
  "Stop automatic payouts and automatic review acceptance on a run, as the owner, at once and for good: from then on every pending step's review waits for you to accept it and every payout becomes a proposal you confirm (`taskmarket workflow payout confirm`); the runner sends nothing. A second stop changes nothing; refused on a completed or cancelled run. Costs 0.001 in the payment token"
26561
27213
  ).argument("<runId>", "Run id").action(async (value) => {
26562
27214
  const id = uuid(value, "run");
@@ -26567,7 +27219,7 @@ var stopAutoPayoutCommand = new Command140("stop-auto-payout").description(
26567
27219
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26568
27220
  );
26569
27221
  });
26570
- var deleteCommand3 = new Command140("delete").description(
27222
+ var deleteCommand3 = new Command146("delete").description(
26571
27223
  "Delete a workflow, as the owner, so it no longer counts toward the project limit of 50. Refused while a run is running or failed (cancel it first); ended runs go with it, and tasks they opened are not touched. Costs 0.001 in the payment token"
26572
27224
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
26573
27225
  const id = uuid(value, "workflow");
@@ -26578,32 +27230,32 @@ var deleteCommand3 = new Command140("delete").description(
26578
27230
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26579
27231
  );
26580
27232
  });
26581
- async function ownerGet(path8) {
27233
+ async function ownerGet(path9) {
26582
27234
  const auth = await signReadAuth();
26583
- return apiGet(path8, { headers: auth?.headers ?? {} });
27235
+ return apiGet(path9, { headers: auth?.headers ?? {} });
26584
27236
  }
26585
- async function ownerRead(path8) {
27237
+ async function ownerRead(path9) {
26586
27238
  try {
26587
- printResult(await ownerGet(path8));
27239
+ printResult(await ownerGet(path9));
26588
27240
  } catch (err) {
26589
27241
  renderFailure(err);
26590
27242
  }
26591
27243
  }
26592
- var payoutListCommand = new Command140("list").description(
27244
+ var payoutListCommand = new Command146("list").description(
26593
27245
  "A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId) or unavailable (free)"
26594
27246
  ).argument("<runId>", "Run id").action(async (value) => {
26595
27247
  const id = uuid(value, "run");
26596
27248
  if (typeof id !== "string") return void printError(id.error);
26597
27249
  await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
26598
27250
  });
26599
- var payoutShowCommand = new Command140("show").description(
27251
+ var payoutShowCommand = new Command146("show").description(
26600
27252
  "Show a payout proposal: its status (pending, confirmed, auto_paid or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends; owner and operators only (free)"
26601
27253
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
26602
27254
  const id = uuid(value, "payout proposal");
26603
27255
  if (typeof id !== "string") return void printError(id.error);
26604
27256
  await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
26605
27257
  });
26606
- var payoutConfirmCommand = new Command140("confirm").description(
27258
+ var payoutConfirmCommand = new Command146("confirm").description(
26607
27259
  "Confirm a pending payout proposal, as the project's owner: sends exactly the accept it shows (`taskmarket workflow payout show` prints the winners and shares first), paying the gated task out. Refused unless the proposal is pending (an auto_paid one was already sent by the runner). Costs the accept, paid like `task accept-submissions`"
26608
27260
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
26609
27261
  const id = uuid(value, "payout proposal");
@@ -26626,10 +27278,10 @@ var payoutConfirmCommand = new Command140("confirm").description(
26626
27278
  { maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
26627
27279
  );
26628
27280
  });
26629
- var payoutCommand = new Command140("payout").description(
27281
+ var payoutCommand = new Command146("payout").description(
26630
27282
  "Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
26631
27283
  ).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
26632
- var settingsCommand2 = new Command140("settings").description(
27284
+ var settingsCommand2 = new Command146("settings").description(
26633
27285
  `Read or set the project's workflow step limit, as its owner: the most task steps one workflow may hold (${WORKFLOW_STEP_LIMIT_MIN} to ${WORKFLOW_STEP_LIMIT_MAX}, default 6). Setting costs 0.001 in the payment token; reading is free`
26634
27286
  ).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
26635
27287
  const projectId = parseProjectId(id);
@@ -26660,7 +27312,7 @@ var settingsCommand2 = new Command140("settings").description(
26660
27312
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26661
27313
  );
26662
27314
  });
26663
- var workflowCommand = new Command140("workflow").description(
27315
+ var workflowCommand = new Command146("workflow").description(
26664
27316
  "Workflows: project tasks composed from named patterns (sequence, parallel, forEach, reviewLoop, gate, contest, branch, fallback), run by the platform runner under your grant to it. A gate waits for your approval, a step verdict or a time. A workflow is the document; a run is one execution of it"
26665
27317
  ).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
26666
27318
  stepCommand(
@@ -26672,11 +27324,11 @@ var workflowCommand = new Command140("workflow").description(
26672
27324
  "retry",
26673
27325
  "Retry a failed step the run waits on, as a new attempt, as the owner; a forEach that failed over_budget recounts its list, and one that failed too_many_items is refused (costs 0.001 in the payment token)"
26674
27326
  )
26675
- ).addCommand(cancelCommand).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27327
+ ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
26676
27328
 
26677
27329
  // src/commands/drops.ts
26678
- import { Command as Command141 } from "commander";
26679
- var listCommand9 = new Command141("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").action(async (opts) => {
27330
+ import { Command as Command147 } from "commander";
27331
+ var listCommand9 = new Command147("list").description("List public Task Drops, ones accepting work first").option("--limit <n>", "Maximum drops to return (1-48)", "24").option("--cursor <cursor>", "nextCursor from a previous page").action(async (opts) => {
26680
27332
  try {
26681
27333
  const input = parseInput(TaskDropDirectoryInputSchema, {
26682
27334
  limit: optionalInt(opts.limit),
@@ -26689,7 +27341,7 @@ var listCommand9 = new Command141("list").description("List public Task Drops, o
26689
27341
  renderFailure(err);
26690
27342
  }
26691
27343
  });
26692
- var showCommand6 = new Command141("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
27344
+ var showCommand6 = new Command147("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
26693
27345
  try {
26694
27346
  const input = parseInput(TaskDropGetInputSchema, { taskDropId });
26695
27347
  const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
@@ -26701,7 +27353,7 @@ var showCommand6 = new Command141("show").description("Show a Task Drop and its
26701
27353
  renderFailure(err);
26702
27354
  }
26703
27355
  });
26704
- var subscribeCommand = new Command141("subscribe").description("Subscribe an email to one Task Drop, or with --official to every official drop").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to notify").option("--official", "Subscribe to all official Task Drops").option("--wallet <address>", "Wallet address to associate with the subscription").action(
27356
+ var subscribeCommand = new Command147("subscribe").description("Subscribe an email to one Task Drop, or with --official to every official drop").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to notify").option("--official", "Subscribe to all official Task Drops").option("--wallet <address>", "Wallet address to associate with the subscription").action(
26705
27357
  async (taskDropId, opts) => {
26706
27358
  try {
26707
27359
  if (opts.official) {
@@ -26729,7 +27381,7 @@ var subscribeCommand = new Command141("subscribe").description("Subscribe an ema
26729
27381
  }
26730
27382
  }
26731
27383
  );
26732
- var statusCommand4 = new Command141("status").description("Check whether an email is subscribed to a Task Drop, or with --official to all").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to check").option("--official", "Check the all-official-drops subscription").action(async (taskDropId, opts) => {
27384
+ var statusCommand4 = new Command147("status").description("Check whether an email is subscribed to a Task Drop, or with --official to all").argument("[taskDropId]", "Task Drop ID (omit with --official)").requiredOption("--email <email>", "Email address to check").option("--official", "Check the all-official-drops subscription").action(async (taskDropId, opts) => {
26733
27385
  try {
26734
27386
  if (opts.official) {
26735
27387
  if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
@@ -26746,10 +27398,10 @@ var statusCommand4 = new Command141("status").description("Check whether an emai
26746
27398
  renderFailure(err);
26747
27399
  }
26748
27400
  });
26749
- var dropsCommand = new Command141("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
27401
+ var dropsCommand = new Command147("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
26750
27402
 
26751
27403
  // src/commands/hooks.ts
26752
- import { Command as Command142 } from "commander";
27404
+ import { Command as Command148 } from "commander";
26753
27405
  import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
26754
27406
  function withV2Declarations(entry) {
26755
27407
  const mask = capabilitiesOf(entry);
@@ -26785,7 +27437,7 @@ async function probeHookVersion(entry, chainId) {
26785
27437
  return reverted ? { ...entry, hookVersion: 1 } : entry;
26786
27438
  }
26787
27439
  }
26788
- var listCommand10 = new Command142("list").description(
27440
+ var listCommand10 = new Command148("list").description(
26789
27441
  "List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
26790
27442
  ).option("--limit <n>", "Maximum unlisted observed hooks to return (1-100)", "50").option("--observed", "Return the raw onchain observation index instead of the registry view").option(
26791
27443
  "--cursor <cursor>",
@@ -26824,7 +27476,7 @@ var listCommand10 = new Command142("list").description(
26824
27476
  }
26825
27477
  }
26826
27478
  );
26827
- var showCommand7 = new Command142("show").description(
27479
+ var showCommand7 = new Command148("show").description(
26828
27480
  "Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
26829
27481
  ).argument("<address>", "Hook contract address").action(async (address3) => {
26830
27482
  try {
@@ -26844,7 +27496,7 @@ var showCommand7 = new Command142("show").description(
26844
27496
  renderFailure(err);
26845
27497
  }
26846
27498
  });
26847
- var encodeConfigCommand = new Command142("encode-config").description(
27499
+ var encodeConfigCommand = new Command148("encode-config").description(
26848
27500
  "Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
26849
27501
  ).argument("<address>", "Hook contract address").requiredOption(
26850
27502
  "--values <json>",
@@ -26873,7 +27525,7 @@ var encodeConfigCommand = new Command142("encode-config").description(
26873
27525
  renderFailure(err);
26874
27526
  }
26875
27527
  });
26876
- var attachmentConfigCommand = new Command142("attachment-config").description(
27528
+ var attachmentConfigCommand = new Command148("attachment-config").description(
26877
27529
  "Show the protocol-default hook order and maximum hooks per task on the selected --network"
26878
27530
  ).action(async () => {
26879
27531
  try {
@@ -26882,12 +27534,12 @@ var attachmentConfigCommand = new Command142("attachment-config").description(
26882
27534
  renderFailure(err);
26883
27535
  }
26884
27536
  });
26885
- var hooksCommand = new Command142("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand);
27537
+ var hooksCommand = new Command148("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand);
26886
27538
 
26887
27539
  // src/commands/tap.ts
26888
- import { promises as fs11 } from "fs";
26889
- import { Command as Command143 } from "commander";
26890
- var tapCommand = new Command143("tap").description(
27540
+ import { promises as fs12 } from "fs";
27541
+ import { Command as Command149 } from "commander";
27542
+ var tapCommand = new Command149("tap").description(
26891
27543
  "Manage the TAP signing key used on tasks that require TAP verification"
26892
27544
  );
26893
27545
  tapCommand.command("import").description(
@@ -26907,7 +27559,7 @@ tapCommand.command("import").description(
26907
27559
  try {
26908
27560
  const keyId = validateTapKeyId(opts.keyId);
26909
27561
  const signatureAgent = opts.signatureAgent === void 0 ? void 0 : validateTapSignatureAgent(opts.signatureAgent);
26910
- const text = opts.keyFile === "-" ? await textOrStdin("-") : await fs11.readFile(opts.keyFile, "utf8");
27562
+ const text = opts.keyFile === "-" ? await textOrStdin("-") : await fs12.readFile(opts.keyFile, "utf8");
26911
27563
  if (!text) throw new Error("No TAP key given: pass --key-file <path> or pipe it on stdin");
26912
27564
  const key = parseTapPrivateKey(text, opts.alg);
26913
27565
  const keystore = await loadKeystore();
@@ -27046,7 +27698,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
27046
27698
  });
27047
27699
 
27048
27700
  // src/commands/hire.ts
27049
- import { Command as Command144 } from "commander";
27701
+ import { Command as Command150 } from "commander";
27050
27702
  var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
27051
27703
  async function lookupListedService(worker, serviceId) {
27052
27704
  let listing;
@@ -27078,7 +27730,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
27078
27730
  }
27079
27731
  return null;
27080
27732
  }
27081
- var hireCommand = new Command144("hire").description(
27733
+ var hireCommand = new Command150("hire").description(
27082
27734
  "Hire a worker, a human or an agent: create a claim task only that worker may accept or decline before the accept window ends (costs the reward, in the payment token). Private visibility and every settlement terms flag of task create apply."
27083
27735
  ).argument("<worker>", "The worker's wallet address (a human or an agent)").option("--service <id>", "The listed service this hire is for (from the worker's listing)").option(
27084
27736
  "--requires-evaluator",
@@ -27141,7 +27793,7 @@ hireCommand.action(async (worker, opts) => {
27141
27793
  // src/index.ts
27142
27794
  var require2 = createRequire(import.meta.url);
27143
27795
  var { version } = require2("../package.json");
27144
- var program = new Command145();
27796
+ var program = new Command151();
27145
27797
  setLastErrorCliVersion(version);
27146
27798
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
27147
27799
  program.option(