@lucid-agents/taskmarket 1.29.0 → 1.30.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-4UFXNF3X.js → api-JLEPMDTE.js} +2 -2
  3. package/dist/{channels-UJ32F6KT.js → channels-BUVR2LSZ.js} +4 -4
  4. package/dist/{chunk-6QD7LE3R.js → chunk-5YR4AZAD.js} +3 -3
  5. package/dist/{chunk-VABTHZFQ.js → chunk-6C63PTFL.js} +8 -8
  6. package/dist/{chunk-BXZHXNZZ.js → chunk-CJS2PHFX.js} +225 -43
  7. package/dist/{chunk-LLDTXUHC.js → chunk-CPYULZB3.js} +3 -3
  8. package/dist/{chunk-LRCJQWAT.js → chunk-E7HXLN2A.js} +2 -2
  9. package/dist/{chunk-44AGKANB.js → chunk-HET5ZDJT.js} +1 -1
  10. package/dist/{chunk-A4M344DT.js → chunk-J27HWZ7Y.js} +1 -1
  11. package/dist/{chunk-XUBYHJMJ.js → chunk-MSTGI2YG.js} +1 -1
  12. package/dist/{chunk-CLFA6AAX.js → chunk-QS4JQF6W.js} +5 -5
  13. package/dist/{chunk-FQIK5KSR.js → chunk-RY4U7U45.js} +2538 -2110
  14. package/dist/{chunk-R7FABEN6.js → chunk-S52R3ZY5.js} +1 -1
  15. package/dist/{chunk-6QUNPM4S.js → chunk-VE4GYPEZ.js} +1 -1
  16. package/dist/{doctor-HRIWE4JV.js → doctor-RYO3E7UL.js} +15 -11
  17. package/dist/index.js +583 -164
  18. package/dist/{launch-ZER5DDN3.js → launch-5NLS7GTY.js} +20 -155
  19. package/dist/pi-extensions/xgate.cjs +473 -130
  20. package/dist/{read-auth-D5OASV5M.js → read-auth-GIBB7BSS.js} +3 -3
  21. package/dist/{reconcile-VEEAEVG7.js → reconcile-YEIABUC6.js} +4 -4
  22. package/dist/{status-BDVDZCU2.js → status-K3CANP2J.js} +8 -8
  23. package/dist/{sync-pull-QXN3V4MI.js → sync-pull-JK2V7ZZF.js} +4 -4
  24. package/dist/{task-access-grants-RS4O6LUB.js → task-access-grants-FS7OSOE2.js} +2 -2
  25. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  listWorkerSubmissions,
14
14
  submitTaskFiles,
15
15
  taskRequirementsOf
16
- } from "./chunk-VABTHZFQ.js";
16
+ } from "./chunk-6C63PTFL.js";
17
17
  import {
18
18
  ComputeCreditError,
19
19
  applyComputeCreditSetup,
@@ -35,14 +35,14 @@ import {
35
35
  refusedPaidWrite,
36
36
  releasePendingComputePurchase,
37
37
  resolvePendingComputePurchases
38
- } from "./chunk-6QD7LE3R.js";
38
+ } from "./chunk-5YR4AZAD.js";
39
39
  import {
40
40
  signReadAuth
41
- } from "./chunk-LRCJQWAT.js";
41
+ } from "./chunk-E7HXLN2A.js";
42
42
  import {
43
43
  saveTaskAccessGrant,
44
44
  taskAccessGrantHeaders
45
- } from "./chunk-XUBYHJMJ.js";
45
+ } from "./chunk-MSTGI2YG.js";
46
46
  import {
47
47
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
48
48
  X402PayError,
@@ -60,7 +60,7 @@ import {
60
60
  setX402PolicyRuleEnabled,
61
61
  signSponsoredTempoTransfer,
62
62
  signTaskmarketFeePayment
63
- } from "./chunk-6QUNPM4S.js";
63
+ } from "./chunk-VE4GYPEZ.js";
64
64
  import {
65
65
  ApiError,
66
66
  KeystoreExistsError,
@@ -116,12 +116,13 @@ import {
116
116
  withErrorContext,
117
117
  withIdempotentWrite,
118
118
  withTapSignature
119
- } from "./chunk-44AGKANB.js";
119
+ } from "./chunk-HET5ZDJT.js";
120
120
  import {
121
121
  AGENT_AVATAR_MAX_BYTES,
122
122
  AGENT_HIRES_ROLES,
123
123
  AGENT_LISTING_LIMITS,
124
124
  AGENT_LISTING_REPORT_REASONS,
125
+ AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES,
125
126
  ActivityFeedInputSchema,
126
127
  ActivityHeatmapInputSchema,
127
128
  ActorType,
@@ -135,6 +136,8 @@ import {
135
136
  AgentMessageEnvelopeSchema,
136
137
  AgentServiceRecordsResponseSchema,
137
138
  AgentTimeSeriesInputSchema,
139
+ AgentUserSkillArchiveWriteSchema,
140
+ AgentUserSkillBundleWriteSchema,
138
141
  BUG_REPORT_SEVERITIES,
139
142
  BUG_REPORT_STATUSES,
140
143
  BUG_REPORT_VISIBILITIES,
@@ -193,6 +196,8 @@ import {
193
196
  SubmissionReviewAssessmentInputSchema,
194
197
  SubmissionReviewAssessmentOutputSchema,
195
198
  SubmissionReviewCorrectionSchema,
199
+ SubmissionReviewFeedbackInputSchema,
200
+ SubmissionReviewFeedbackOutputSchema,
196
201
  SubmissionReviewHistoryInputSchema,
197
202
  SubmissionReviewHistoryOutputSchema,
198
203
  SubmissionReviewJobStatusSchema,
@@ -222,6 +227,9 @@ import {
222
227
  TaskTermsError,
223
228
  TaskVerifierRequirement,
224
229
  TermsPresetName,
230
+ USER_SKILL_GIT_MODES,
231
+ USER_SKILL_LIMITS,
232
+ USER_SKILL_SANDBOX_LIMITS,
225
233
  WALLET_BRIDGE_ORIGIN_CHAIN_ID,
226
234
  WALLET_BRIDGE_TEMPO_CHAIN_ID,
227
235
  WORKFLOW_PRESET_NAMES,
@@ -253,6 +261,7 @@ import {
253
261
  buildWithdrawDreamsMessage,
254
262
  capabilityRejectionReason,
255
263
  claimStakeToPost,
264
+ classifyUserSkillEntry,
256
265
  clientValidityWindowSeconds,
257
266
  compareSubmissionVersionsNewestFirst,
258
267
  coreChains,
@@ -291,21 +300,25 @@ import {
291
300
  settlerModeContracts,
292
301
  signSponsoredVault7702Call,
293
302
  solanaTaskChainIds,
303
+ splitUserSkill,
294
304
  sponsoredVaultRelayKind,
295
305
  svmChain,
296
306
  taskmarketChain,
297
307
  unknownCapabilityMessage,
298
308
  usdcToBaseUnits,
309
+ userSkillArchiveWriteChange,
310
+ userSkillCreateWriteChange,
311
+ userSkillVersionWriteChange,
299
312
  validateWorkflowDocument,
300
313
  validateWorkflowTemplate,
301
314
  vaultCallGasLimit7702,
302
315
  verifierProviderId,
303
316
  verifiersUnsupportedOnChain
304
- } from "./chunk-FQIK5KSR.js";
317
+ } from "./chunk-RY4U7U45.js";
305
318
  import "./chunk-S7SJMJ2I.js";
306
319
 
307
320
  // src/index.ts
308
- import { Command as Command138 } from "commander";
321
+ import { Command as Command139 } from "commander";
309
322
  import { createRequire } from "module";
310
323
 
311
324
  // src/commands/init.ts
@@ -6841,6 +6854,7 @@ import { Command as Command7, Option } from "commander";
6841
6854
  import { z as z2 } from "zod";
6842
6855
 
6843
6856
  // src/lib/submission-reviews.ts
6857
+ import { randomUUID } from "crypto";
6844
6858
  import { z } from "zod";
6845
6859
  var controlOutput = z.object({
6846
6860
  runId: z.string().uuid(),
@@ -6850,6 +6864,7 @@ var correctionOutput = z.object({
6850
6864
  correctionId: z.string().uuid(),
6851
6865
  createdAt: z.string().datetime()
6852
6866
  });
6867
+ var FEEDBACK_GRANT_SECONDS = 240;
6853
6868
  var query2 = (values) => {
6854
6869
  const params = new URLSearchParams();
6855
6870
  for (const [key, value] of Object.entries(values))
@@ -7039,6 +7054,52 @@ function createSubmissionReviewClient(options) {
7039
7054
  key
7040
7055
  );
7041
7056
  },
7057
+ async feedback(input, key) {
7058
+ const checked = SubmissionReviewFeedbackInputSchema.pick({
7059
+ runId: true,
7060
+ chainId: true,
7061
+ submissionId: true,
7062
+ assessmentId: true,
7063
+ target: true,
7064
+ verdict: true,
7065
+ note: true
7066
+ }).parse(input);
7067
+ const idempotencyKey = z.string().uuid().parse(resolveIdempotencyKey(key)).toLowerCase();
7068
+ return withIdempotentWrite(idempotencyKey, async () => {
7069
+ const signer = await options.signer();
7070
+ const grantId = randomUUID();
7071
+ const grantExpiresAt = Math.floor(now() / 1e3) + FEEDBACK_GRANT_SECONDS;
7072
+ const grantSignature = await signer.signMessage(
7073
+ buildSubmissionReviewActionMessage({
7074
+ action: "feedback",
7075
+ payload: { runId: checked.runId },
7076
+ chainId: checked.chainId,
7077
+ requester: signer.address,
7078
+ idempotencyKey: grantId,
7079
+ expiresAt: grantExpiresAt
7080
+ })
7081
+ );
7082
+ const { runId, ...body } = SubmissionReviewFeedbackInputSchema.parse({
7083
+ ...checked,
7084
+ requesterAddress: signer.address,
7085
+ idempotencyKey,
7086
+ grantId,
7087
+ grantExpiresAt,
7088
+ grantSignature
7089
+ });
7090
+ const result = await options.transport.post(
7091
+ `${runPath(runId)}/feedback`,
7092
+ body,
7093
+ idempotencyKey,
7094
+ await headers()
7095
+ );
7096
+ if (result.idempotencyKey !== idempotencyKey)
7097
+ throw new Error(
7098
+ "Review response has a different request key; recover the original request before retrying."
7099
+ );
7100
+ return { data: SubmissionReviewFeedbackOutputSchema.parse(result.data), idempotencyKey };
7101
+ });
7102
+ },
7042
7103
  async *watch(input, settings = {}) {
7043
7104
  const { intervalSeconds, timeoutSeconds } = z.object({
7044
7105
  intervalSeconds: z.number().int().min(1).max(60).default(5),
@@ -7067,7 +7128,7 @@ function cliSubmissionReviewClient() {
7067
7128
  transport: {
7068
7129
  get: (path7, headers) => apiGet(path7, { headers }),
7069
7130
  preview: (path7, body, headers) => apiReadPost(path7, body, { headers }),
7070
- post: (path7, body, idempotencyKey) => apiPost(path7, body, { idempotencyKey })
7131
+ post: (path7, body, idempotencyKey, headers) => apiPost(path7, body, { idempotencyKey, headers })
7071
7132
  }
7072
7133
  });
7073
7134
  }
@@ -7302,6 +7363,36 @@ function createReviewCommand() {
7302
7363
  }
7303
7364
  )
7304
7365
  );
7366
+ group.addCommand(
7367
+ runCommand(
7368
+ "feedback",
7369
+ "Record agree or disagree on one finding or quality score; never changes findings or ranking"
7370
+ ).argument("<assessmentId>", "Assessment ID from results or assessment output").requiredOption("--submission-id <id>", "Exact submission version ID").option("--requirement-id <id>", "Checklist requirement (a finding) to give feedback on").addOption(
7371
+ new Option("--dimension <dimension>", "Quality score to give feedback on").choices([
7372
+ "clarity",
7373
+ "visual_coherence",
7374
+ "distinctiveness",
7375
+ "finish"
7376
+ ])
7377
+ ).addOption(
7378
+ new Option("--verdict <verdict>", "Agree or disagree").choices(["agree", "disagree"]).makeOptionMandatory()
7379
+ ).option("--note <text>", "Optional note, up to 280 characters").action(
7380
+ async (runId, assessmentId, options) => {
7381
+ if (Boolean(options.requirementId) === Boolean(options.dimension))
7382
+ throw new Error("Give exactly one of --requirement-id or --dimension.");
7383
+ const result = await cliSubmissionReviewClient().feedback({
7384
+ runId,
7385
+ chainId: options.chainId,
7386
+ submissionId: options.submissionId,
7387
+ assessmentId,
7388
+ target: options.requirementId ? { kind: "finding", requirementId: options.requirementId } : { kind: "quality", dimension: options.dimension },
7389
+ verdict: options.verdict,
7390
+ ...options.note !== void 0 ? { note: options.note } : {}
7391
+ });
7392
+ printResult(result.data, { idempotencyKey: result.idempotencyKey });
7393
+ }
7394
+ )
7395
+ );
7305
7396
  return group;
7306
7397
  }
7307
7398
  var reviewCmd = createReviewCommand();
@@ -10376,7 +10467,7 @@ async function runAgentCommand(options) {
10376
10467
  try {
10377
10468
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
10378
10469
  const pi = assertAgentCompatibility();
10379
- const { runAgent } = await import("./launch-ZER5DDN3.js");
10470
+ const { runAgent } = await import("./launch-5NLS7GTY.js");
10380
10471
  result = await runAgent({
10381
10472
  model: options.model,
10382
10473
  pi,
@@ -10810,13 +10901,13 @@ function agentManagementCommands() {
10810
10901
  const status = new Command53("status").description(
10811
10902
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
10812
10903
  ).action(async () => {
10813
- const { collectAgentStatus } = await import("./status-BDVDZCU2.js");
10904
+ const { collectAgentStatus } = await import("./status-K3CANP2J.js");
10814
10905
  await run(() => collectAgentStatus());
10815
10906
  });
10816
10907
  const doctor = new Command53("doctor").description(
10817
10908
  "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."
10818
10909
  ).action(async () => {
10819
- const { runDoctor } = await import("./doctor-HRIWE4JV.js");
10910
+ const { runDoctor } = await import("./doctor-RYO3E7UL.js");
10820
10911
  const report = await run(() => runDoctor());
10821
10912
  if (report && !report.ok) process.exitCode = 1;
10822
10913
  });
@@ -10827,7 +10918,7 @@ function agentManagementCommands() {
10827
10918
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
10828
10919
  ).action(
10829
10920
  async (invocationId, options) => {
10830
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-VEEAEVG7.js");
10921
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-YEIABUC6.js");
10831
10922
  const choice = { rail: options.rail, channel: options.channel };
10832
10923
  if (invocationId !== void 0) {
10833
10924
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -10859,7 +10950,7 @@ function agentManagementCommands() {
10859
10950
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
10860
10951
  );
10861
10952
  }
10862
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-UJ32F6KT.js");
10953
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-BUVR2LSZ.js");
10863
10954
  const { rails } = await openAgentChannels();
10864
10955
  const result = await requestTopUp(selectRail(rails, options.rail), amount);
10865
10956
  return {
@@ -10879,8 +10970,8 @@ function agentManagementCommands() {
10879
10970
  await run(async () => {
10880
10971
  await requireExperimental();
10881
10972
  const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
10882
- const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-UJ32F6KT.js");
10883
- const { reconcileLeasedPurchase } = await import("./reconcile-VEEAEVG7.js");
10973
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-BUVR2LSZ.js");
10974
+ const { reconcileLeasedPurchase } = await import("./reconcile-YEIABUC6.js");
10884
10975
  const opened = await openAgentChannels();
10885
10976
  const { rail, retired } = selectChannel(opened, options);
10886
10977
  const result = await closeChannel(
@@ -10934,7 +11025,7 @@ function agentManagementCommands() {
10934
11025
  async (options) => {
10935
11026
  await run(async () => {
10936
11027
  await requireExperimental();
10937
- const { runPull } = await import("./sync-pull-QXN3V4MI.js");
11028
+ const { runPull } = await import("./sync-pull-JK2V7ZZF.js");
10938
11029
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
10939
11030
  return runPull(options, {
10940
11031
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -11006,7 +11097,7 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
11006
11097
  ).option("--specialty <specialty>", "Filter listed workers by specialty, as a label or slug").option("--skill <tag>", "Deprecated alias of --specialty").option(
11007
11098
  "--capability <slug>",
11008
11099
  "Filter listed agents by capability slug (see `taskmarket capabilities`)"
11009
- ).option("--role <role>", "Filter listed workers by role: worker or evaluator").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").option("--min-rating <n>", `Only workers rated at least this: ${MIN_RATINGS.join(", ")}`).option(
11100
+ ).option("--role <role>", "Filter listed workers by role: worker or evaluator").option("--search <query>", "Search by agentId or wallet address").option("--limit <n>", "Maximum results to return", "20").option("--offset <n>", "Skip this many results, to page past --limit (0 to 10000)").option("--min-rating <n>", `Only workers rated at least this: ${MIN_RATINGS.join(", ")}`).option(
11010
11101
  "--min-tasks <n>",
11011
11102
  `Only workers with at least this many completed tasks: ${MIN_TASKS.join(", ")}`
11012
11103
  ).option(
@@ -11027,6 +11118,9 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
11027
11118
  allowListed("--min-rating", opts.minRating, MIN_RATINGS);
11028
11119
  allowListed("--min-tasks", opts.minTasks, MIN_TASKS);
11029
11120
  allowListed("--availability", opts.availability, AVAILABILITIES);
11121
+ if (opts.offset !== void 0 && (!/^\d+$/.test(opts.offset) || Number(opts.offset) > 1e4)) {
11122
+ throw new Error("--offset must be a whole number from 0 to 10000");
11123
+ }
11030
11124
  kind = opts.kind === void 0 ? void 0 : parseInput(ActorType, opts.kind);
11031
11125
  role = opts.role === void 0 ? void 0 : parseInput(AgentListingRoleSchema, opts.role);
11032
11126
  if (opts.capability !== void 0 && !isCapabilitySlug(opts.capability)) {
@@ -11050,6 +11144,7 @@ var agentsCommand = new Command55("agents").description("Browse the worker direc
11050
11144
  if (role) params.set("role", role);
11051
11145
  if (opts.search) params.set("search", opts.search);
11052
11146
  if (opts.limit) params.set("limit", opts.limit);
11147
+ if (opts.offset) params.set("offset", String(Number(opts.offset)));
11053
11148
  if (opts.minRating) params.set("minRating", String(Number(opts.minRating)));
11054
11149
  if (opts.minTasks) params.set("minTasks", String(Number(opts.minTasks)));
11055
11150
  if (kind) params.set("actorType", kind);
@@ -12187,7 +12282,10 @@ async function pollBridgeStatus(requestId) {
12187
12282
  }
12188
12283
  var walletBridgeCommand = new Command67("bridge").description(
12189
12284
  "Move free USDC on Base to OUSD at the same address on Tempo (gasless, through Relay)"
12190
- ).requiredOption("--to <chain>", 'Destination chain (only "tempo")').argument("<amount>", "Amount of USDC in whole tokens (minimum 1, e.g. 25)").action(async (amount, opts) => {
12285
+ ).requiredOption("--to <chain>", 'Destination chain (only "tempo")').option(
12286
+ "--recipient <address>",
12287
+ "Deliver the OUSD to this ready Tempo mainnet swarm wallet (a hosted agent wallet) instead of your own address; a refund still goes to your wallet on Base"
12288
+ ).argument("<amount>", "Amount of USDC in whole tokens (minimum 1, e.g. 25)").action(async (amount, opts) => {
12191
12289
  if (opts.to !== "tempo") {
12192
12290
  printError('Invalid --to: the only bridge destination is "tempo"');
12193
12291
  return;
@@ -12196,6 +12294,10 @@ var walletBridgeCommand = new Command67("bridge").description(
12196
12294
  printError("Invalid amount: must be a positive number with at most 6 decimals (e.g. 25)");
12197
12295
  return;
12198
12296
  }
12297
+ if (opts.recipient !== void 0 && !EthAddressSchema.safeParse(opts.recipient).success) {
12298
+ printError("Invalid --recipient: must be a 0x-prefixed 20-byte address");
12299
+ return;
12300
+ }
12199
12301
  const [whole, fraction = ""] = amount.split(".");
12200
12302
  const amountBaseUnits = (BigInt(whole) * 1000000n + BigInt(fraction.padEnd(6, "0"))).toString();
12201
12303
  let keystore;
@@ -12206,19 +12308,21 @@ var walletBridgeCommand = new Command67("bridge").description(
12206
12308
  return;
12207
12309
  }
12208
12310
  const from = keystore.walletAddress;
12311
+ const expectedRecipient = opts.recipient ?? from;
12209
12312
  let quote;
12210
12313
  try {
12211
12314
  ({ data: quote } = await apiPost("/api/wallet/bridge-quote", {
12212
12315
  chainId: WALLET_BRIDGE_ORIGIN_CHAIN_ID,
12213
12316
  from,
12214
12317
  to: "tempo",
12215
- amountBaseUnits
12318
+ amountBaseUnits,
12319
+ ...opts.recipient !== void 0 ? { recipient: opts.recipient } : {}
12216
12320
  }));
12217
12321
  } catch (err) {
12218
12322
  renderFailure(err);
12219
12323
  return;
12220
12324
  }
12221
- if (!sameAddress2(quote.recipient, from) || !sameAddress2(quote.refundTo, from) || !sameAddress2(quote.authorization.message.to, quote.depositAddress) || quote.amountBaseUnits !== amountBaseUnits || quote.authorization.message.value !== amountBaseUnits || quote.destinationChainId !== WALLET_BRIDGE_TEMPO_CHAIN_ID) {
12325
+ if (!sameAddress2(quote.recipient, expectedRecipient) || !sameAddress2(quote.refundTo, from) || !sameAddress2(quote.authorization.message.to, quote.depositAddress) || quote.amountBaseUnits !== amountBaseUnits || quote.authorization.message.value !== amountBaseUnits || quote.destinationChainId !== WALLET_BRIDGE_TEMPO_CHAIN_ID) {
12222
12326
  printError("The bridge quote does not match this request; nothing was signed");
12223
12327
  return;
12224
12328
  }
@@ -12693,16 +12797,16 @@ import { Command as Command72 } from "commander";
12693
12797
  // src/lib/xmtp-client.ts
12694
12798
  import fs6 from "fs";
12695
12799
  import path4 from "path";
12696
- import { randomUUID as randomUUID2, hkdfSync as hkdfSync2 } from "crypto";
12800
+ import { randomUUID as randomUUID3, hkdfSync as hkdfSync2 } from "crypto";
12697
12801
  import { privateKeyToAccount as privateKeyToAccount3 } from "viem/accounts";
12698
12802
 
12699
12803
  // src/lib/xmtp-envelope.ts
12700
- import { randomUUID } from "crypto";
12804
+ import { randomUUID as randomUUID2 } from "crypto";
12701
12805
  function buildEnvelope(input) {
12702
12806
  return AgentMessageEnvelopeSchema.parse({
12703
12807
  schemaVersion: 1,
12704
12808
  type: input.type,
12705
- requestId: input.requestId ?? randomUUID(),
12809
+ requestId: input.requestId ?? randomUUID2(),
12706
12810
  replyToRequestId: input.replyToRequestId,
12707
12811
  senderInboxId: input.senderInboxId,
12708
12812
  senderAddress: input.senderAddress,
@@ -13097,7 +13201,7 @@ function createFileBus(dir) {
13097
13201
  }
13098
13202
  async function createDevClient(input) {
13099
13203
  const inboxId = input.existingInboxId ?? `dev-inbox-${input.walletAddress.slice(2, 10).toLowerCase()}`;
13100
- const installationId = input.existingInstallationId ?? randomUUID2();
13204
+ const installationId = input.existingInstallationId ?? randomUUID3();
13101
13205
  const dbPath = input.existingDbPath ?? defaultDbPath(input.walletAddress);
13102
13206
  const busDir = process.env.TASKMARKET_XMTP_MEMORY_DIR?.trim();
13103
13207
  const fileBus = busDir ? createFileBus(busDir) : void 0;
@@ -13113,7 +13217,7 @@ async function createDevClient(input) {
13113
13217
  },
13114
13218
  async sendMessage(toInboxId, body) {
13115
13219
  const message = {
13116
- id: randomUUID2(),
13220
+ id: randomUUID3(),
13117
13221
  toInboxId,
13118
13222
  body,
13119
13223
  senderInboxId: inboxId,
@@ -13630,7 +13734,7 @@ async function createProductionClient(input, env) {
13630
13734
  "non-retryable"
13631
13735
  );
13632
13736
  }
13633
- const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input.existingInstallationId ?? randomUUID2();
13737
+ const installationId = extractString(client, ["installationId", "installationID"]) ?? extractString(asObject(client)?.installation, ["id", "installationId"]) ?? input.existingInstallationId ?? randomUUID3();
13634
13738
  const cursor = loadXmtpCursor(xmtpCursorPath(defaultXmtpDbDir(), input.walletAddress));
13635
13739
  const inboxIdForAddress = cachedInboxLookup(async (address2) => {
13636
13740
  const lookup = asObject(client)?.fetchInboxIdByIdentifier;
@@ -14419,6 +14523,19 @@ function parseSince(since) {
14419
14523
  if (!EVENT_ID2.test(since)) throw new Error("--since must be an event id (a whole number)");
14420
14524
  return since;
14421
14525
  }
14526
+ function parseEventId(flag, value) {
14527
+ if (!EVENT_ID2.test(value)) throw new Error(`${flag} must be an event id (a whole number)`);
14528
+ return value;
14529
+ }
14530
+ function assertOrderOptions(options) {
14531
+ if (options.before !== void 0 && !options.newest) {
14532
+ throw new Error("--before needs --newest");
14533
+ }
14534
+ if (!options.newest) return;
14535
+ if (options.since !== void 0) throw new Error("--newest cannot take --since; use --before");
14536
+ if (options.follow) throw new Error("--follow reads oldest first; it cannot take --newest");
14537
+ if (options.task) throw new Error("--newest reads your own events; it cannot take --task");
14538
+ }
14422
14539
  function parseLimit(limit) {
14423
14540
  if (limit === void 0) return void 0;
14424
14541
  const value = Number(limit);
@@ -14444,8 +14561,19 @@ async function readAuthHeaders() {
14444
14561
  return { wallet: auth.walletAddress, headers: auth.headers };
14445
14562
  }
14446
14563
  async function readHistory(options) {
14564
+ assertOrderOptions(options);
14447
14565
  const since = parseSince(options.since);
14448
14566
  const limit = parseLimit(options.limit);
14567
+ if (options.newest) {
14568
+ const before = options.before === void 0 ? void 0 : parseEventId("--before", options.before);
14569
+ const { headers: headers2 } = await readAuthHeaders();
14570
+ printResult(
14571
+ await apiGet(`/api/market-events${query3({ order: "newest", before, limit })}`, {
14572
+ headers: headers2
14573
+ })
14574
+ );
14575
+ return;
14576
+ }
14449
14577
  const headers = options.task ? (await signReadAuth())?.headers ?? {} : (await readAuthHeaders()).headers;
14450
14578
  const path7 = options.task ? `/api/market-events/tasks/${encodeURIComponent(options.task)}${query3({ since, limit })}` : `/api/market-events${query3({ since, limit })}`;
14451
14579
  printResult(await apiGet(path7, { headers }));
@@ -14556,10 +14684,43 @@ async function untilInterrupted(follow) {
14556
14684
  process.off("SIGTERM", stop);
14557
14685
  }
14558
14686
  }
14687
+ var LAST_SEEN_PATH = "/api/market-events/last-seen";
14688
+ async function readOrMarkSeen(options) {
14689
+ const mark = options.mark === void 0 || options.mark === "latest" ? options.mark : parseEventId("--mark", options.mark);
14690
+ const { headers } = await readAuthHeaders();
14691
+ if (mark === void 0) {
14692
+ printResult(await apiGet(LAST_SEEN_PATH, { headers }));
14693
+ return;
14694
+ }
14695
+ let eventId = mark;
14696
+ if (mark === "latest") {
14697
+ const newest = await apiGet(`/api/market-events${query3({ order: "newest", limit: 1 })}`, {
14698
+ headers
14699
+ });
14700
+ eventId = newest.events[0]?.id;
14701
+ }
14702
+ if (eventId === void 0) {
14703
+ printResult(await apiGet(LAST_SEEN_PATH, { headers }));
14704
+ return;
14705
+ }
14706
+ const { data, idempotencyKey } = await apiPut(
14707
+ LAST_SEEN_PATH,
14708
+ { eventId },
14709
+ { headers }
14710
+ );
14711
+ printResult(data, { idempotencyKey });
14712
+ }
14713
+ function createSeenCommand() {
14714
+ return new Command73("seen").description(
14715
+ "Show the newest event you have seen and how many are unread (the web Inbox's Activity count); --mark moves it forward"
14716
+ ).option("--mark <id>", "Mark events up to this event id as seen, or `latest` for all of them").action(async (options) => {
14717
+ await readOrMarkSeen(options);
14718
+ });
14719
+ }
14559
14720
  function createEventsCommand() {
14560
14721
  return new Command73("events").description(
14561
- "Read your market events, oldest first, or one task's timeline; --follow waits for new ones and resumes after a restart"
14562
- ).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(
14722
+ "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"
14723
+ ).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(
14563
14724
  "--follow",
14564
14725
  "Keep reading: print each new event with your pending actions on its task, from a cursor stored under ~/.taskmarket"
14565
14726
  ).action(async (options) => {
@@ -14568,10 +14729,11 @@ function createEventsCommand() {
14568
14729
  return;
14569
14730
  }
14570
14731
  if (options.task) throw new Error("--follow reads your own events; it cannot take --task");
14732
+ assertOrderOptions(options);
14571
14733
  const since = parseSince(options.since);
14572
14734
  const limit = parseLimit(options.limit);
14573
14735
  await untilInterrupted((signal) => followMarketEvents({ since, limit, signal }));
14574
- });
14736
+ }).addCommand(createSeenCommand());
14575
14737
  }
14576
14738
  var eventsCommand = createEventsCommand();
14577
14739
 
@@ -15889,12 +16051,222 @@ bookmarkCommand.addCommand(removeCommand);
15889
16051
  bookmarkCommand.addCommand(listCommand4);
15890
16052
  bookmarkCommand.addCommand(collectionCommand);
15891
16053
 
16054
+ // src/commands/skills/index.ts
16055
+ import { randomUUID as randomUUID4 } from "crypto";
16056
+ import { Command as Command97 } from "commander";
16057
+
16058
+ // src/lib/skill-directory.ts
16059
+ import { lstat, readdir, readFile as readFile3 } from "fs/promises";
16060
+ import { join, relative, sep } from "path";
16061
+ var MAX_ENTRIES = USER_SKILL_LIMITS.files + USER_SKILL_SANDBOX_LIMITS.files + 300;
16062
+ async function walk(root) {
16063
+ const entries = [];
16064
+ const visit = async (dir) => {
16065
+ const names = (await readdir(dir)).sort();
16066
+ for (const name of names) {
16067
+ const full = join(dir, name);
16068
+ const path7 = relative(root, full).split(sep).join("/");
16069
+ const info = await lstat(full);
16070
+ if (info.isDirectory()) {
16071
+ await visit(full);
16072
+ continue;
16073
+ }
16074
+ if (entries.length >= MAX_ENTRIES)
16075
+ throw new Error(`The skill directory has more than ${MAX_ENTRIES} files`);
16076
+ 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;
16077
+ entries.push({ path: path7, mode, full });
16078
+ }
16079
+ };
16080
+ await visit(root);
16081
+ return entries;
16082
+ }
16083
+ async function readSkillDirectory(root, options = {}) {
16084
+ const info = await lstat(root).catch(() => null);
16085
+ if (!info?.isDirectory()) throw new Error(`${root} is not a directory`);
16086
+ const files = [];
16087
+ const sandboxFiles = [];
16088
+ const excluded = [];
16089
+ for (const entry2 of await walk(root)) {
16090
+ const kind = classifyUserSkillEntry({ path: entry2.path, mode: entry2.mode });
16091
+ if (kind.kind === "excluded") {
16092
+ excluded.push({ path: entry2.path, reason: kind.reason });
16093
+ continue;
16094
+ }
16095
+ const bytes = await readFile3(entry2.full);
16096
+ if (kind.kind === "readable") {
16097
+ files.push({ path: entry2.path, content: bytes.toString("utf8") });
16098
+ } else if (kind.encoding === "base64") {
16099
+ sandboxFiles.push({
16100
+ path: entry2.path,
16101
+ encoding: "base64",
16102
+ content: bytes.toString("base64"),
16103
+ size: bytes.length,
16104
+ executable: kind.executable
16105
+ });
16106
+ } else {
16107
+ sandboxFiles.push({
16108
+ path: entry2.path,
16109
+ encoding: "utf8",
16110
+ content: bytes.toString("utf8"),
16111
+ executable: kind.executable
16112
+ });
16113
+ }
16114
+ }
16115
+ const entry = files.find((file) => file.path === "SKILL.md");
16116
+ if (!entry) throw new Error(`${root} has no SKILL.md at its root`);
16117
+ const meta = splitUserSkill(entry.content);
16118
+ return {
16119
+ bundle: {
16120
+ name: options.name ?? meta.name,
16121
+ description: options.description ?? meta.description,
16122
+ files,
16123
+ ...sandboxFiles.length ? { sandboxFiles } : {}
16124
+ },
16125
+ excluded
16126
+ };
16127
+ }
16128
+
16129
+ // src/commands/skills/index.ts
16130
+ function excludedError(excluded) {
16131
+ const list2 = excluded.map((file) => `${file.path} (${file.reason})`).join("; ");
16132
+ return new Error(
16133
+ `These files are not allowed in a skill and would be left out: ${list2}. Remove them, or pass --skip-excluded to save the skill without them`
16134
+ );
16135
+ }
16136
+ var SkillRequestTooLargeError = class extends Error {
16137
+ constructor(bytes, limitBytes) {
16138
+ super(
16139
+ `The skill request is ${bytes} bytes once serialized, over the API's limit of ${limitBytes} bytes (1 MiB). Shrink the skill directory: remove or trim large references, scripts or assets (binary assets grow by a third as base64)`
16140
+ );
16141
+ this.bytes = bytes;
16142
+ this.limitBytes = limitBytes;
16143
+ }
16144
+ code = "skill_request_too_large";
16145
+ };
16146
+ function fail(error) {
16147
+ if (error instanceof SkillRequestTooLargeError)
16148
+ return renderFailure(error, {
16149
+ details: { code: error.code, bytes: error.bytes, limitBytes: error.limitBytes }
16150
+ });
16151
+ return renderFailure(error);
16152
+ }
16153
+ function assertBodySize(body) {
16154
+ const PROOF_ALLOWANCE = 512;
16155
+ const bytes = Buffer.byteLength(JSON.stringify(body), "utf8") + PROOF_ALLOWANCE;
16156
+ if (bytes > AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES)
16157
+ throw new SkillRequestTooLargeError(bytes, AGENT_SKILL_REQUEST_BODY_LIMIT_BYTES);
16158
+ }
16159
+ async function bundleWrite(action, dir, skillId, opts) {
16160
+ const { bundle, excluded } = await readSkillDirectory(dir, {
16161
+ name: opts.name,
16162
+ description: opts.description
16163
+ });
16164
+ if (excluded.length && !opts.skipExcluded) throw excludedError(excluded);
16165
+ const keystore = await loadKeystore();
16166
+ const unsigned = {
16167
+ walletAddress: keystore.walletAddress,
16168
+ agentId: opts.agent,
16169
+ skillId,
16170
+ requestKey: opts.requestKey ?? randomUUID4(),
16171
+ bundle,
16172
+ note: opts.note ?? ""
16173
+ };
16174
+ const parsed = parseInput(AgentUserSkillBundleWriteSchema, unsigned);
16175
+ assertBodySize(parsed);
16176
+ const change = action === "create" ? userSkillCreateWriteChange(parsed) : userSkillVersionWriteChange(parsed);
16177
+ const proof = await signWalletWrite("user-skill", change);
16178
+ return { body: { ...parsed, ...proof }, excluded };
16179
+ }
16180
+ function summary(body, excluded) {
16181
+ return {
16182
+ files: body.bundle.files.map((file) => file.path).sort(),
16183
+ sandboxFiles: (body.bundle.sandboxFiles ?? []).map((file) => ({
16184
+ path: file.path,
16185
+ executable: file.executable ?? false
16186
+ })),
16187
+ excluded
16188
+ };
16189
+ }
16190
+ var bundleOptions = (command) => command.requiredOption("--agent <agentId>", "The hosted agent writing the skill (its agent ID)").option("--name <name>", "Skill name (default: SKILL.md's frontmatter name)").option("--description <text>", "Skill description (default: SKILL.md's frontmatter)").option("--note <text>", "A note for this version, up to 500 characters").option(
16191
+ "--skip-excluded",
16192
+ "Save without the files that are not allowed (listed in the output) instead of refusing"
16193
+ ).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice");
16194
+ var SIZE_NOTE = "The whole request, files included (binary assets as base64), must fit in 1 MiB; a larger one is refused before signing";
16195
+ var createCommand2 = bundleOptions(
16196
+ new Command97("create").description(
16197
+ `Create a skill in your owner's library from a skill directory (SKILL.md, references, sandbox-only scripts and assets), as its first version. ${SIZE_NOTE}`
16198
+ ).argument("<dir>", "The skill directory, with SKILL.md at its root").option("--skill-id <uuid>", "The new skill ID (default: a new random ID)")
16199
+ ).action(async (dir, opts) => {
16200
+ try {
16201
+ const { body, excluded } = await bundleWrite("create", dir, opts.skillId ?? randomUUID4(), opts);
16202
+ const { data, idempotencyKey } = await apiPost("/api/agents/skills", body, {
16203
+ idempotencyKey: body.requestKey
16204
+ });
16205
+ printResult(
16206
+ { ...data, ...summary(body, excluded) },
16207
+ { idempotencyKey }
16208
+ );
16209
+ } catch (error) {
16210
+ return fail(error);
16211
+ }
16212
+ });
16213
+ var versionCommand = bundleOptions(
16214
+ new Command97("version").description(`Save a new version of a skill you authored from a skill directory. ${SIZE_NOTE}`).argument("<skillId>", "The skill ID").argument("<dir>", "The skill directory, with SKILL.md at its root")
16215
+ ).action(async (skillId, dir, opts) => {
16216
+ try {
16217
+ const { body, excluded } = await bundleWrite("version", dir, skillId, opts);
16218
+ const { data, idempotencyKey } = await apiPost(
16219
+ `/api/agents/skills/${encodeURIComponent(body.skillId)}/versions`,
16220
+ body,
16221
+ { idempotencyKey: body.requestKey }
16222
+ );
16223
+ printResult(
16224
+ { ...data, ...summary(body, excluded) },
16225
+ { idempotencyKey }
16226
+ );
16227
+ } catch (error) {
16228
+ return fail(error);
16229
+ }
16230
+ });
16231
+ var archiveCommand = new Command97("archive").description("Archive a skill you authored; it stays in the library, archived").argument("<skillId>", "The skill ID").requiredOption("--agent <agentId>", "The hosted agent that authored the skill (its agent ID)").option(
16232
+ "--remove-assignments",
16233
+ "Also remove the skill from this agent's assignments; archiving is refused while other agents have it assigned"
16234
+ ).option("--request-key <uuid>", "Reuse to resend the same write without applying it twice").action(
16235
+ async (skillId, opts) => {
16236
+ try {
16237
+ const keystore = await loadKeystore();
16238
+ const parsed = parseInput(AgentUserSkillArchiveWriteSchema, {
16239
+ walletAddress: keystore.walletAddress,
16240
+ agentId: opts.agent,
16241
+ skillId,
16242
+ requestKey: opts.requestKey ?? randomUUID4(),
16243
+ removeAssignments: Boolean(opts.removeAssignments)
16244
+ });
16245
+ const proof = await signWalletWrite("user-skill", userSkillArchiveWriteChange(parsed));
16246
+ const { data, idempotencyKey } = await apiPost(
16247
+ `/api/agents/skills/${encodeURIComponent(parsed.skillId)}/archive`,
16248
+ { ...parsed, ...proof },
16249
+ { idempotencyKey: parsed.requestKey }
16250
+ );
16251
+ printResult(data, { idempotencyKey });
16252
+ } catch (error) {
16253
+ return renderFailure(error);
16254
+ }
16255
+ }
16256
+ );
16257
+ var skillsCommand = new Command97("skills").description(
16258
+ "Skills in your owner's library that you, a hosted agent, author: create, version and archive"
16259
+ );
16260
+ skillsCommand.addCommand(createCommand2);
16261
+ skillsCommand.addCommand(versionCommand);
16262
+ skillsCommand.addCommand(archiveCommand);
16263
+
15892
16264
  // src/commands/requester/index.ts
15893
- import { Command as Command98 } from "commander";
16265
+ import { Command as Command99 } from "commander";
15894
16266
 
15895
16267
  // src/commands/requester/stats.ts
15896
- import { Command as Command97 } from "commander";
15897
- var requesterStatsCmd = new Command97("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address2) => {
16268
+ import { Command as Command98 } from "commander";
16269
+ var requesterStatsCmd = new Command98("stats").description("Get requester reputation stats for an address").argument("<address>", "Wallet address of the requester").action(async (address2) => {
15898
16270
  if (!/^0x[0-9a-fA-F]{40}$/.test(address2)) {
15899
16271
  printError("Address must be a 0x-prefixed 20-byte hex string");
15900
16272
  return;
@@ -15908,23 +16280,23 @@ var requesterStatsCmd = new Command97("stats").description("Get requester reputa
15908
16280
  });
15909
16281
 
15910
16282
  // src/commands/requester/index.ts
15911
- var requesterCmd = new Command98("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
16283
+ var requesterCmd = new Command99("requester").description("Requester reputation commands").addCommand(requesterStatsCmd);
15912
16284
 
15913
16285
  // src/commands/capabilities.ts
15914
- import { Command as Command99 } from "commander";
16286
+ import { Command as Command100 } from "commander";
15915
16287
  async function fetchCapabilities(category) {
15916
16288
  const input = parseInput(CapabilitiesListInputSchema, { category });
15917
16289
  const query4 = input.category ? `?category=${encodeURIComponent(input.category)}` : "";
15918
16290
  return CapabilitiesListResponseSchema.parse(await apiGet(`/api/capabilities${query4}`));
15919
16291
  }
15920
- var listCommand5 = new Command99("list").description("List the capability registry, optionally for one category").option("--category <id>", "Only this category (for example onchain or web-data)").action(async (opts) => {
16292
+ var listCommand5 = new Command100("list").description("List the capability registry, optionally for one category").option("--category <id>", "Only this category (for example onchain or web-data)").action(async (opts) => {
15921
16293
  try {
15922
16294
  printResult(await fetchCapabilities(opts.category));
15923
16295
  } catch (err) {
15924
16296
  renderFailure(err);
15925
16297
  }
15926
16298
  });
15927
- var showCommand2 = new Command99("show").description("Show one capability by slug").argument("<slug>", "Capability slug, for example web-search").action(async (slug) => {
16299
+ var showCommand2 = new Command100("show").description("Show one capability by slug").argument("<slug>", "Capability slug, for example web-search").action(async (slug) => {
15928
16300
  try {
15929
16301
  const { capabilities } = await fetchCapabilities();
15930
16302
  const entry = capabilities.find((item) => item.slug === slug);
@@ -15934,13 +16306,13 @@ var showCommand2 = new Command99("show").description("Show one capability by slu
15934
16306
  renderFailure(err);
15935
16307
  }
15936
16308
  });
15937
- var capabilitiesCommand = new Command99("capabilities").description("Read the listing capability registry").addCommand(listCommand5).addCommand(showCommand2);
16309
+ var capabilitiesCommand = new Command100("capabilities").description("Read the listing capability registry").addCommand(listCommand5).addCommand(showCommand2);
15938
16310
 
15939
16311
  // src/commands/x402/index.ts
15940
- import { Command as Command103 } from "commander";
16312
+ import { Command as Command104 } from "commander";
15941
16313
 
15942
16314
  // src/commands/x402/payments.ts
15943
- import { Command as Command100, Option as Option5 } from "commander";
16315
+ import { Command as Command101, Option as Option5 } from "commander";
15944
16316
  import { createInterface as createInterface5 } from "readline";
15945
16317
  var PAYMENT_STATES = [
15946
16318
  "reserved",
@@ -15966,7 +16338,7 @@ async function confirmManualResolution() {
15966
16338
  readline.close();
15967
16339
  return answer.trim().toLowerCase() === "resolve";
15968
16340
  }
15969
- var x402PaymentsCommand = new Command100("payments").description(
16341
+ var x402PaymentsCommand = new Command101("payments").description(
15970
16342
  "Inspect and reconcile X402 Pay payment records"
15971
16343
  );
15972
16344
  x402PaymentsCommand.command("list").description("List current payment records").addOption(new Option5("--state <state>", "Filter by state").choices(PAYMENT_STATES)).action(async (options) => {
@@ -15995,7 +16367,7 @@ x402PaymentsCommand.command("resolve").description("Manually record an externall
15995
16367
 
15996
16368
  // src/commands/x402/policy.ts
15997
16369
  import { promises as fs9 } from "fs";
15998
- import { Command as Command101 } from "commander";
16370
+ import { Command as Command102 } from "commander";
15999
16371
  import { createInterface as createInterface6 } from "readline";
16000
16372
  async function confirmUnattendedRule(rule) {
16001
16373
  if (!process.stdin.isTTY) {
@@ -16021,7 +16393,7 @@ async function confirmUnattendedRule(rule) {
16021
16393
  readline.close();
16022
16394
  return answer.trim().toLowerCase() === "authorize";
16023
16395
  }
16024
- var x402PolicyCommand = new Command101("policy").description(
16396
+ var x402PolicyCommand = new Command102("policy").description(
16025
16397
  "Manage local X402 Pay spending policy"
16026
16398
  );
16027
16399
  x402PolicyCommand.command("init").description("Create a deny-all policy file").action(async () => {
@@ -16057,14 +16429,14 @@ for (const enabled of [true, false]) {
16057
16429
  }
16058
16430
 
16059
16431
  // src/commands/x402/request.ts
16060
- import { Command as Command102, Option as Option6 } from "commander";
16432
+ import { Command as Command103, Option as Option6 } from "commander";
16061
16433
  function collect4(value, previous) {
16062
16434
  return [...previous, value];
16063
16435
  }
16064
16436
  function confirm(lines) {
16065
16437
  return confirmAtTerminal(lines, "use --non-interactive with policy");
16066
16438
  }
16067
- var x402RequestCommand = new Command102("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option6("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
16439
+ var x402RequestCommand = new Command103("request").description("Request and pay for a direct x402 HTTP resource (X402 Pay)").argument("<url>", "HTTPS resource URL").addOption(new Option6("--method <method>", "HTTP method").choices(["GET", "POST"]).default("GET")).option("--json <json>", "Inline JSON POST body").option("--body-file <path>", "Read JSON POST body from a file").option("--headers-file <path>", "Read request headers from an owner-only JSON file").option(
16068
16440
  "--header-env <header=ENV_VAR>",
16069
16441
  "Read one request header from an environment variable (repeatable)",
16070
16442
  collect4,
@@ -16112,7 +16484,7 @@ var x402RequestCommand = new Command102("request").description("Request and pay
16112
16484
  );
16113
16485
 
16114
16486
  // src/commands/x402/index.ts
16115
- var x402Command = new Command103("x402").description(
16487
+ var x402Command = new Command104("x402").description(
16116
16488
  "Pay x402 services with local spending policies (X402 Pay)"
16117
16489
  );
16118
16490
  x402Command.addCommand(x402RequestCommand);
@@ -16120,10 +16492,10 @@ x402Command.addCommand(x402PolicyCommand);
16120
16492
  x402Command.addCommand(x402PaymentsCommand);
16121
16493
 
16122
16494
  // src/commands/sponsored-task/index.ts
16123
- import { Command as Command119 } from "commander";
16495
+ import { Command as Command120 } from "commander";
16124
16496
 
16125
16497
  // src/commands/sponsored-task/create.ts
16126
- import { Command as Command104 } from "commander";
16498
+ import { Command as Command105 } from "commander";
16127
16499
  import { toHex as toHex4 } from "viem";
16128
16500
 
16129
16501
  // ../../packages/contracts/evm/abi/generated/SponsoredTasksVaultV2.ts
@@ -20315,7 +20687,7 @@ async function createOnSolana(opts, keystore) {
20315
20687
  renderFailure(err);
20316
20688
  }
20317
20689
  }
20318
- var sponsoredTaskCreateCommand = new Command104("create").description("Create a new Sponsored Task vault for a project token").option(
20690
+ var sponsoredTaskCreateCommand = new Command105("create").description("Create a new Sponsored Task vault for a project token").option(
20319
20691
  "--factory <address>",
20320
20692
  "SponsoredTaskFactory contract address (EVM chains; defaults to the chain's newest factory, or the settler-mode factory on Robinhood Chain)"
20321
20693
  ).requiredOption(
@@ -20438,7 +20810,7 @@ Token risk: ${TOKEN_RISK}`
20438
20810
  );
20439
20811
 
20440
20812
  // src/commands/sponsored-task/fund.ts
20441
- import { Command as Command105 } from "commander";
20813
+ import { Command as Command106 } from "commander";
20442
20814
  function isValidAddress5(addr) {
20443
20815
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
20444
20816
  }
@@ -20472,7 +20844,7 @@ async function fundOnSolana(opts, keystore) {
20472
20844
  renderFailure(err);
20473
20845
  }
20474
20846
  }
20475
- var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").option(
20847
+ var sponsoredTaskFundCommand = new Command106("fund").description("Fund a Sponsored Task vault with its project token (base units)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").option(
20476
20848
  "--token <address>",
20477
20849
  "Project ERC-20 token address (EVM chains; Solana reads the vault's mint)"
20478
20850
  ).requiredOption(
@@ -20495,6 +20867,10 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
20495
20867
  printError("Invalid Ethereum address for --vault or --token");
20496
20868
  return;
20497
20869
  }
20870
+ if (!/^\d+$/.test(opts.amount) || BigInt(opts.amount) === 0n) {
20871
+ printError("--amount must be a whole number of token base units, more than zero");
20872
+ return;
20873
+ }
20498
20874
  let keystore;
20499
20875
  try {
20500
20876
  keystore = await loadKeystore();
@@ -20505,6 +20881,15 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
20505
20881
  const chainId = opts.chainId;
20506
20882
  const { account, publicClient, walletClient, relay } = await createSponsoredTaskVaultChainClients(keystore, chainId);
20507
20883
  const amount = BigInt(opts.amount);
20884
+ const vaultToken = await publicClient.readContract({
20885
+ address: opts.vault,
20886
+ abi: SponsoredTasksVaultV2ABI,
20887
+ functionName: "token"
20888
+ });
20889
+ if (vaultToken.toLowerCase() !== opts.token.toLowerCase()) {
20890
+ printError(`--token does not match the vault's token ${vaultToken}`);
20891
+ return;
20892
+ }
20508
20893
  await approveSponsoredTaskSpend({
20509
20894
  account,
20510
20895
  publicClient,
@@ -20533,7 +20918,7 @@ var sponsoredTaskFundCommand = new Command105("fund").description("Fund a Sponso
20533
20918
  });
20534
20919
 
20535
20920
  // src/commands/sponsored-task/managers.ts
20536
- import { Command as Command106 } from "commander";
20921
+ import { Command as Command107 } from "commander";
20537
20922
 
20538
20923
  // src/lib/solana-payout-binding.ts
20539
20924
  var PROGRAM_ID_ENV = "TASKMARKET_SOLANA_SPONSORED_TASKS_PROGRAM_ID";
@@ -20867,7 +21252,7 @@ async function configure(opts) {
20867
21252
  active: opts.active
20868
21253
  });
20869
21254
  }
20870
- var sponsoredTaskManagersCommand = new Command106("managers").description(
21255
+ var sponsoredTaskManagersCommand = new Command107("managers").description(
20871
21256
  "Manage authorized managers for a Sponsored Task vault"
20872
21257
  );
20873
21258
  sponsoredTaskManagersCommand.command("add").description("Authorize a manager with a token-denominated spend cap").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
@@ -20894,8 +21279,8 @@ sponsoredTaskManagersCommand.command("list").description("List a vault authorize
20894
21279
  });
20895
21280
 
20896
21281
  // src/commands/sponsored-task/managed.ts
20897
- import { Command as Command107 } from "commander";
20898
- var sponsoredTaskManagedCommand = new Command107("managed").description(
21282
+ import { Command as Command108 } from "commander";
21283
+ var sponsoredTaskManagedCommand = new Command108("managed").description(
20899
21284
  "List the active Sponsored Task vaults an address can fund tasks from as an active manager (defaults to your wallet)"
20900
21285
  ).option("--address <address>", "Manager address (defaults to your wallet)").option("--limit <n>", "Max vaults to return (1-100)", "50").option("--cursor <vaultId>", "Pagination cursor from a previous nextCursor").action(async (opts) => {
20901
21286
  let address2 = opts.address;
@@ -20925,8 +21310,8 @@ var sponsoredTaskManagedCommand = new Command107("managed").description(
20925
21310
  });
20926
21311
 
20927
21312
  // src/commands/sponsored-task/creation-fee.ts
20928
- import { Command as Command108 } from "commander";
20929
- var sponsoredTaskCreationFeeCommand = new Command108("creation-fee").description("Show the one-time fee for creating a Sponsored Task vault on a chain").requiredOption(
21313
+ import { Command as Command109 } from "commander";
21314
+ var sponsoredTaskCreationFeeCommand = new Command109("creation-fee").description("Show the one-time fee for creating a Sponsored Task vault on a chain").requiredOption(
20930
21315
  "--chain-id <chain>",
20931
21316
  "EVM chain the vault would be created on: a network name or chain id (e.g. base, 8453)",
20932
21317
  chainOption("--chain-id", "evm-vault")
@@ -20970,8 +21355,8 @@ var sponsoredTaskCreationFeeCommand = new Command108("creation-fee").description
20970
21355
  });
20971
21356
 
20972
21357
  // src/commands/sponsored-task/list.ts
20973
- import { Command as Command109 } from "commander";
20974
- var sponsoredTaskListCommand = new Command109("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).option("--owner <address>", "Only vaults this address owns, whatever their curation status").option("--mine", "Only the vaults your wallet owns", false).action(
21358
+ import { Command as Command110 } from "commander";
21359
+ var sponsoredTaskListCommand = new Command110("list").description("List Sponsored Task vaults").option("--limit <n>", "Max vaults to return", "50").option("--cursor <vaultId>", "Pagination cursor").option("--include-unverified", "Include vaults not yet curator-approved", false).option("--owner <address>", "Only vaults this address owns, whatever their curation status").option("--mine", "Only the vaults your wallet owns", false).action(
20975
21360
  async (opts) => {
20976
21361
  if (opts.owner && opts.mine) {
20977
21362
  printError("Pass --owner or --mine, not both");
@@ -21000,8 +21385,8 @@ var sponsoredTaskListCommand = new Command109("list").description("List Sponsore
21000
21385
  );
21001
21386
 
21002
21387
  // src/commands/sponsored-task/settlements.ts
21003
- import { Command as Command110 } from "commander";
21004
- var sponsoredTaskSettlementsCommand = new Command110("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
21388
+ import { Command as Command111 } from "commander";
21389
+ var sponsoredTaskSettlementsCommand = new Command111("settlements").description("List the settlements a Sponsored Task vault has installed, newest first").argument("<vaultId>", "Vault id").option("--limit <n>", "Max settlements to return (1-100)", "25").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(async (vaultId, opts) => {
21005
21390
  const limit = Number(opts.limit);
21006
21391
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
21007
21392
  printError("--limit must be an integer from 1 to 100");
@@ -21016,17 +21401,17 @@ var sponsoredTaskSettlementsCommand = new Command110("settlements").description(
21016
21401
  });
21017
21402
 
21018
21403
  // src/commands/sponsored-task/show.ts
21019
- import { Command as Command111 } from "commander";
21020
- var sponsoredTaskShowCommand = new Command111("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21404
+ import { Command as Command112 } from "commander";
21405
+ var sponsoredTaskShowCommand = new Command112("show").description("Show a Sponsored Task vault by id").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21021
21406
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}`);
21022
21407
  printResult(result);
21023
21408
  });
21024
21409
 
21025
21410
  // src/commands/sponsored-task/request-review.ts
21026
21411
  import { randomBytes as randomBytes6 } from "crypto";
21027
- import { Command as Command112 } from "commander";
21412
+ import { Command as Command113 } from "commander";
21028
21413
  var REQUEST_TTL_SECONDS = 5 * 60;
21029
- var sponsoredTaskRequestReviewCommand = new Command112("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21414
+ var sponsoredTaskRequestReviewCommand = new Command113("request-review").description("Ask Taskmarket curators to review a Sponsored Task vault (vault owner only)").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21030
21415
  let keystore;
21031
21416
  try {
21032
21417
  keystore = await loadKeystore();
@@ -21083,18 +21468,18 @@ var sponsoredTaskRequestReviewCommand = new Command112("request-review").descrip
21083
21468
  });
21084
21469
 
21085
21470
  // src/commands/sponsored-task/balance.ts
21086
- import { Command as Command113 } from "commander";
21087
- var sponsoredTaskBalanceCommand = new Command113("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21471
+ import { Command as Command114 } from "commander";
21472
+ var sponsoredTaskBalanceCommand = new Command114("balance").description("Show a Sponsored Task vault funded/available/reserved balances").argument("<vaultId>", "Vault id").action(async (vaultId) => {
21088
21473
  const result = await apiGet(`/api/sponsored-task-vaults/${vaultId}/balance`);
21089
21474
  printResult(result);
21090
21475
  });
21091
21476
 
21092
21477
  // src/commands/sponsored-task/withdraw.ts
21093
- import { Command as Command114 } from "commander";
21478
+ import { Command as Command115 } from "commander";
21094
21479
  function isValidAddress7(addr) {
21095
21480
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
21096
21481
  }
21097
- var sponsoredTaskWithdrawCommand = new Command114("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption(
21482
+ var sponsoredTaskWithdrawCommand = new Command115("withdraw").description("Withdraw unreserved project tokens from a vault (owner only)").requiredOption("--vault <address>", "Vault address").requiredOption(
21098
21483
  "--chain-id <chain>",
21099
21484
  "EVM chain the vault is deployed on: a network name or chain id (e.g. base, robinhood, 8453)",
21100
21485
  chainOption("--chain-id", "evm-vault")
@@ -21103,6 +21488,10 @@ var sponsoredTaskWithdrawCommand = new Command114("withdraw").description("Withd
21103
21488
  printError("Invalid Ethereum address for --vault or --recipient");
21104
21489
  return;
21105
21490
  }
21491
+ if (!/^\d+$/.test(opts.amount) || BigInt(opts.amount) === 0n) {
21492
+ printError("--amount must be a whole number of token base units, more than zero");
21493
+ return;
21494
+ }
21106
21495
  let keystore;
21107
21496
  try {
21108
21497
  keystore = await loadKeystore();
@@ -21126,11 +21515,11 @@ var sponsoredTaskWithdrawCommand = new Command114("withdraw").description("Withd
21126
21515
  });
21127
21516
 
21128
21517
  // src/commands/sponsored-task/exit.ts
21129
- import { Command as Command115 } from "commander";
21518
+ import { Command as Command116 } from "commander";
21130
21519
  function isValidAddress8(addr) {
21131
21520
  return /^0x[a-fA-F0-9]{40}$/.test(addr);
21132
21521
  }
21133
- var sponsoredTaskExitCommand = new Command115("exit").description(
21522
+ var sponsoredTaskExitCommand = new Command116("exit").description(
21134
21523
  "Terminally exit a vault: sweeps every reserved and unclaimed token back to you, invalidating every outstanding reservation, claim signature, and Merkle proof at once. There is no undo and no per-allocation revoke -- a worker with a pending but unclaimed entitlement gets nothing once this runs."
21135
21524
  ).requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
21136
21525
  "--chain-id <chain>",
@@ -21206,7 +21595,7 @@ var sponsoredTaskExitCommand = new Command115("exit").description(
21206
21595
  });
21207
21596
 
21208
21597
  // src/commands/sponsored-task/claim.ts
21209
- import { Command as Command116 } from "commander";
21598
+ import { Command as Command117 } from "commander";
21210
21599
  var CLAIM_TO_TYPES = {
21211
21600
  ClaimTo: [
21212
21601
  { name: "vaultId", type: "bytes32" },
@@ -21271,7 +21660,7 @@ async function findEntitlement(vaultId, workerAddress, taskId, options = {}) {
21271
21660
  await sleep4(3e3);
21272
21661
  }
21273
21662
  }
21274
- var sponsoredTaskClaimCommand = new Command116("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
21663
+ var sponsoredTaskClaimCommand = new Command117("claim").description("Claim your unclaimed Sponsored Task reward for a vault task").argument("<vaultId>", "Vault id").option(
21275
21664
  "--task-id <id>",
21276
21665
  "Claim the entitlement for a specific task (defaults to the first unclaimed one)"
21277
21666
  ).action(async (vaultId, opts) => {
@@ -21387,10 +21776,10 @@ var sponsoredTaskClaimCommand = new Command116("claim").description("Claim your
21387
21776
  });
21388
21777
 
21389
21778
  // src/commands/sponsored-task/rewards.ts
21390
- import { Command as Command117 } from "commander";
21779
+ import { Command as Command118 } from "commander";
21391
21780
  var REWARD_STATES = SponsoredTaskRewardStateSchema.options;
21392
21781
  var CLAIM_STATUSES = SponsoredTaskWorkerRewardClaimStatusSchema.options;
21393
- var sponsoredTaskRewardsCommand = new Command117("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
21782
+ var sponsoredTaskRewardsCommand = new Command118("rewards").description("List Sponsored Task rewards across every vault (defaults to your wallet)").option("--address <address>", "Worker address (defaults to your wallet)").option("--state <state>", `Reward state: ${REWARD_STATES.join(", ")}`).option("--claim-status <status>", `Claim status: ${CLAIM_STATUSES.join(", ")}`).option("--limit <n>", "Max rewards to return (1-100)", "50").option("--cursor <cursor>", "Pagination cursor from a previous nextCursor").action(
21394
21783
  async (opts) => {
21395
21784
  let address2 = opts.address;
21396
21785
  if (address2 === void 0) {
@@ -21430,7 +21819,7 @@ var sponsoredTaskRewardsCommand = new Command117("rewards").description("List Sp
21430
21819
  );
21431
21820
 
21432
21821
  // src/commands/sponsored-task/bind-payout.ts
21433
- import { Command as Command118 } from "commander";
21822
+ import { Command as Command119 } from "commander";
21434
21823
  async function solanaRewards(agent) {
21435
21824
  try {
21436
21825
  const result = await apiGet(
@@ -21441,7 +21830,7 @@ async function solanaRewards(agent) {
21441
21830
  return [];
21442
21831
  }
21443
21832
  }
21444
- var sponsoredTaskBindPayoutCommand = new Command118("bind-payout").description(
21833
+ var sponsoredTaskBindPayoutCommand = new Command119("bind-payout").description(
21445
21834
  "Bind the Solana address that receives your Solana Sponsored Task awards (once; rebinding replaces it)"
21446
21835
  ).option(
21447
21836
  "--address <solana-address>",
@@ -21580,7 +21969,7 @@ function bindingTaskChainIds(requested, connection, everyChain) {
21580
21969
  }
21581
21970
 
21582
21971
  // src/commands/sponsored-task/index.ts
21583
- var sponsoredTaskCommand = new Command119("sponsored-task").description(
21972
+ var sponsoredTaskCommand = new Command120("sponsored-task").description(
21584
21973
  "Sponsored Task vault administration and reward claims"
21585
21974
  );
21586
21975
  sponsoredTaskCommand.addCommand(sponsoredTaskCreateCommand);
@@ -21600,10 +21989,10 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
21600
21989
  sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
21601
21990
 
21602
21991
  // src/commands/project/index.ts
21603
- import { Command as Command131 } from "commander";
21992
+ import { Command as Command132 } from "commander";
21604
21993
 
21605
21994
  // src/commands/project/accept.ts
21606
- import { Command as Command120 } from "commander";
21995
+ import { Command as Command121 } from "commander";
21607
21996
 
21608
21997
  // src/commands/project/shared.ts
21609
21998
  var ADDRESS = /^0x[0-9a-fA-F]{40}$/;
@@ -21657,16 +22046,16 @@ async function postProjectWrite(path7, body, options) {
21657
22046
  const { data: result, idempotencyKey } = await x402Post(
21658
22047
  path7,
21659
22048
  { chainId: selectedNetwork().chainId, ...body },
21660
- options
22049
+ options?.maxAmount !== void 0 ? { maxAmount: options.maxAmount } : void 0
21661
22050
  );
21662
22051
  printResult(
21663
22052
  { ...result, ...await settleRecording(result, idempotencyKey) },
21664
- { idempotencyKey }
22053
+ { idempotencyKey, ...options?.warnings?.length ? { warnings: options.warnings } : {} }
21665
22054
  );
21666
22055
  }
21667
22056
 
21668
22057
  // src/commands/project/accept.ts
21669
- var projectAcceptCommand = new Command120("accept").description(
22058
+ var projectAcceptCommand = new Command121("accept").description(
21670
22059
  "Accept a grant on a project as its operator, which freezes the terms; read them first with `project show` (costs 0.001 in the payment token)"
21671
22060
  ).argument("<projectId>", "Project id").action(async (id) => {
21672
22061
  const projectId = parseProjectId(id);
@@ -21675,7 +22064,7 @@ var projectAcceptCommand = new Command120("accept").description(
21675
22064
  });
21676
22065
 
21677
22066
  // src/commands/project/add-task.ts
21678
- import { Command as Command121 } from "commander";
22067
+ import { Command as Command122 } from "commander";
21679
22068
  function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
21680
22069
  if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
21681
22070
  const endsAt = new Date(project.endsAt);
@@ -21737,7 +22126,7 @@ function parseContinuation(flags) {
21737
22126
  function collect5(value, previous = []) {
21738
22127
  return [...previous, value];
21739
22128
  }
21740
- var projectAddTaskCommand = new Command121("add-task").description(
22129
+ var projectAddTaskCommand = new Command122("add-task").description(
21741
22130
  "Create a task of any mode funded from a project's budget, as its owner or an operator with an accepted grant. Takes every flag of task create; the reward and any evaluator stake come out of the budget (costs 0.001 in the payment token)"
21742
22131
  ).argument("<projectId>", "Project id");
21743
22132
  for (const option of createCmd.options) {
@@ -21781,8 +22170,8 @@ projectAddTaskCommand.action(async (id, opts) => {
21781
22170
  });
21782
22171
 
21783
22172
  // src/commands/project/claim.ts
21784
- import { Command as Command122 } from "commander";
21785
- var projectClaimCommand = new Command122("claim").description(
22173
+ import { Command as Command123 } from "commander";
22174
+ var projectClaimCommand = new Command123("claim").description(
21786
22175
  "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)"
21787
22176
  ).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
21788
22177
  const projectId = parseProjectId(id);
@@ -21798,8 +22187,8 @@ var projectClaimCommand = new Command122("claim").description(
21798
22187
  });
21799
22188
 
21800
22189
  // src/commands/project/close.ts
21801
- import { Command as Command123 } from "commander";
21802
- var projectCloseCommand = new Command123("close").description(
22190
+ import { Command as Command124 } from "commander";
22191
+ var projectCloseCommand = new Command124("close").description(
21803
22192
  "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)"
21804
22193
  ).argument("<projectId>", "Project id").action(async (id) => {
21805
22194
  const projectId = parseProjectId(id);
@@ -21808,8 +22197,8 @@ var projectCloseCommand = new Command123("close").description(
21808
22197
  });
21809
22198
 
21810
22199
  // src/commands/project/create.ts
21811
- import { Command as Command124 } from "commander";
21812
- var projectCreateCommand = new Command124("create").description(
22200
+ import { Command as Command125 } from "commander";
22201
+ var projectCreateCommand = new Command125("create").description(
21813
22202
  "Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
21814
22203
  ).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
21815
22204
  "--ends-at <time>",
@@ -21844,8 +22233,8 @@ var projectCreateCommand = new Command124("create").description(
21844
22233
  );
21845
22234
 
21846
22235
  // src/commands/project/fund.ts
21847
- import { Command as Command125 } from "commander";
21848
- var projectFundCommand = new Command125("fund").description(
22236
+ import { Command as Command126 } from "commander";
22237
+ var projectFundCommand = new Command126("fund").description(
21849
22238
  "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)"
21850
22239
  ).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
21851
22240
  "--on-behalf-of <address>",
@@ -21867,7 +22256,7 @@ var projectFundCommand = new Command125("fund").description(
21867
22256
  });
21868
22257
 
21869
22258
  // src/commands/project/grant.ts
21870
- import { Command as Command126 } from "commander";
22259
+ import { Command as Command127 } from "commander";
21871
22260
  function grantBody(projectId, opts) {
21872
22261
  if (!ADDRESS.test(opts.operator)) {
21873
22262
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -21890,11 +22279,11 @@ function grantBody(projectId, opts) {
21890
22279
  revokeRemovesControl: opts.revokeRemovesControl
21891
22280
  };
21892
22281
  }
21893
- var projectGrantCommand = new Command126("grant").description(
22282
+ var projectGrantCommand = new Command127("grant").description(
21894
22283
  "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)"
21895
22284
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
21896
22285
  "--cap <amount>",
21897
- "The most the operator's tasks may hold from the budget at once, in the payment token (default: no cap beyond the budget)"
22286
+ "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)"
21898
22287
  ).option(
21899
22288
  "--requester-of-record <who>",
21900
22289
  "Who is task.requester on the operator's tasks, whom ratings and reputation follow: owner or operator",
@@ -21914,7 +22303,7 @@ var projectGrantCommand = new Command126("grant").description(
21914
22303
  });
21915
22304
 
21916
22305
  // src/commands/project/review.ts
21917
- import { Command as Command127 } from "commander";
22306
+ import { Command as Command128 } from "commander";
21918
22307
  function reviewEvaluator(opts) {
21919
22308
  if (opts.evaluator !== void 0 && opts.off) {
21920
22309
  return { error: "Pass --evaluator <address> or --off, not both" };
@@ -21929,7 +22318,7 @@ function reviewEvaluator(opts) {
21929
22318
  }
21930
22319
  return opts.evaluator;
21931
22320
  }
21932
- var projectReviewCommand = new Command127("review").description(
22321
+ var projectReviewCommand = new Command128("review").description(
21933
22322
  "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"
21934
22323
  ).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) => {
21935
22324
  const projectId = parseProjectId(id);
@@ -21946,12 +22335,33 @@ var projectReviewCommand = new Command127("review").description(
21946
22335
  }
21947
22336
  return;
21948
22337
  }
21949
- await postProjectWrite(`/api/projects/${projectId}/review`, { projectId, evaluator });
22338
+ await postProjectWrite(
22339
+ `/api/projects/${projectId}/review`,
22340
+ { projectId, evaluator },
22341
+ { warnings: await ownerEvaluatorWarnings(evaluator) }
22342
+ );
21950
22343
  });
22344
+ async function ownerEvaluatorWarnings(evaluator) {
22345
+ if (evaluator === null) return [];
22346
+ let wallet;
22347
+ try {
22348
+ wallet = (await loadKeystore()).walletAddress;
22349
+ } catch {
22350
+ return [];
22351
+ }
22352
+ if (wallet.toLowerCase() !== evaluator.toLowerCase()) return [];
22353
+ return [
22354
+ cliWarning(
22355
+ "project_review_owner_is_evaluator",
22356
+ "The evaluator is the project owner's own wallet. The owner is the requester of record on its own tasks and, under the default grant terms, its operators' tasks, and cannot evaluate them, so creating those tasks is refused until the review default names another wallet.",
22357
+ { evaluator: evaluator.toLowerCase() }
22358
+ )
22359
+ ];
22360
+ }
21951
22361
 
21952
22362
  // src/commands/project/revoke.ts
21953
- import { Command as Command128 } from "commander";
21954
- var projectRevokeCommand = new Command128("revoke").description(
22363
+ import { Command as Command129 } from "commander";
22364
+ var projectRevokeCommand = new Command129("revoke").description(
21955
22365
  "End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
21956
22366
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
21957
22367
  const projectId = parseProjectId(id);
@@ -21966,7 +22376,7 @@ var projectRevokeCommand = new Command128("revoke").description(
21966
22376
  });
21967
22377
 
21968
22378
  // src/commands/project/schedule.ts
21969
- import { Command as Command129 } from "commander";
22379
+ import { Command as Command130 } from "commander";
21970
22380
  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}$/;
21971
22381
  var STATUSES = ["active", "paused", "cancelled", "completed"];
21972
22382
  function positiveNumber2(value, flag) {
@@ -22078,7 +22488,7 @@ async function read(path7) {
22078
22488
  renderFailure(err);
22079
22489
  }
22080
22490
  }
22081
- var createCommand2 = new Command129("create").description(
22491
+ var createCommand3 = new Command130("create").description(
22082
22492
  "Create a schedule that opens a task from the project's budget on a cadence, as the project's owner. The platform runner creates each task 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, and failures in a row (3 by default) pause the schedule. Costs 0.001 in the payment token"
22083
22493
  ).argument("<projectId>", "Project id").requiredOption(
22084
22494
  "--cadence <cadence>",
@@ -22099,7 +22509,7 @@ var createCommand2 = new Command129("create").description(
22099
22509
  if ("error" in body) return void printError(String(body.error));
22100
22510
  await postProjectWrite(`/api/projects/${projectId}/schedules`, body);
22101
22511
  });
22102
- var listCommand6 = new Command129("list").description("List a project's schedules, its schedule limits and the platform runner (free)").argument("<projectId>", "Project id").option("--status <status>", "active, paused, cancelled or completed").option("--limit <count>", "Schedules to list (1-100, default 50)").action(async (id, opts) => {
22512
+ var listCommand6 = new Command130("list").description("List a project's schedules, its schedule limits and the platform runner (free)").argument("<projectId>", "Project id").option("--status <status>", "active, paused, cancelled or completed").option("--limit <count>", "Schedules to list (1-100, default 50)").action(async (id, opts) => {
22103
22513
  const projectId = parseProjectId(id);
22104
22514
  if (typeof projectId !== "number") return void printError(projectId.error);
22105
22515
  if (opts.status !== void 0 && !STATUSES.includes(opts.status)) {
@@ -22114,19 +22524,19 @@ var listCommand6 = new Command129("list").description("List a project's schedule
22114
22524
  const query4 = params.toString();
22115
22525
  await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
22116
22526
  });
22117
- var showCommand3 = new Command129("show").description("Show a schedule and its newest runs: opened, skipped or failed (free)").argument("<scheduleId>", "Schedule id").action(async (value) => {
22527
+ var showCommand3 = new Command130("show").description("Show a schedule and its newest runs: opened, skipped or failed (free)").argument("<scheduleId>", "Schedule id").action(async (value) => {
22118
22528
  const id = scheduleId(value);
22119
22529
  if (typeof id !== "string") return void printError(id.error);
22120
22530
  await read(`/api/project-schedules/${id}`);
22121
22531
  });
22122
22532
  function actionCommand(action, description) {
22123
- return new Command129(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
22533
+ return new Command130(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
22124
22534
  const id = scheduleId(value);
22125
22535
  if (typeof id !== "string") return void printError(id.error);
22126
22536
  await postProjectWrite(`/api/project-schedules/${id}/${action}`, { scheduleId: id });
22127
22537
  });
22128
22538
  }
22129
- var settingsCommand = new Command129("settings").description(
22539
+ var settingsCommand = new Command130("settings").description(
22130
22540
  "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"
22131
22541
  ).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) => {
22132
22542
  const projectId = parseProjectId(id);
@@ -22146,9 +22556,9 @@ var settingsCommand = new Command129("settings").description(
22146
22556
  if ("error" in body) return void printError(String(body.error));
22147
22557
  await postProjectWrite(`/api/projects/${projectId}/schedules/settings`, body);
22148
22558
  });
22149
- var projectScheduleCommand = new Command129("schedule").description(
22559
+ var projectScheduleCommand = new Command130("schedule").description(
22150
22560
  "Schedules: a task from the project's budget on a cadence, created by the platform runner under your grant to it"
22151
- ).addCommand(createCommand2).addCommand(listCommand6).addCommand(showCommand3).addCommand(
22561
+ ).addCommand(createCommand3).addCommand(listCommand6).addCommand(showCommand3).addCommand(
22152
22562
  actionCommand(
22153
22563
  "pause",
22154
22564
  "Pause a schedule; it creates nothing until resumed (costs 0.001 in the payment token)"
@@ -22164,23 +22574,24 @@ var projectScheduleCommand = new Command129("schedule").description(
22164
22574
  "Cancel a schedule for good; the tasks it created are unaffected (costs 0.001 in the payment token)"
22165
22575
  )
22166
22576
  ).addCommand(settingsCommand);
22167
- var projectRunnerCommand = new Command129("runner").description(
22168
- "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 hold at once; the runner pays each action fee"
22577
+ var projectRunnerCommand = new Command130("runner").description(
22578
+ "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"
22169
22579
  ).action(async () => {
22170
22580
  await read(withChainId("/api/project-runner"));
22171
22581
  });
22172
22582
 
22173
22583
  // src/commands/project/show.ts
22174
- import { Command as Command130 } from "commander";
22175
- var projectShowCommand = new Command130("show").description(
22584
+ import { Command as Command131 } from "commander";
22585
+ var projectShowCommand = new Command131("show").description(
22176
22586
  "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)"
22177
22587
  ).argument("<projectId>", "Project id").action(async (id) => {
22178
22588
  const projectId = parseProjectId(id);
22179
22589
  if (typeof projectId !== "number") return void printError(projectId.error);
22180
- printResult(await apiGet(withChainId(`/api/projects/${projectId}`)));
22590
+ const headers = (await signReadAuth())?.headers ?? {};
22591
+ printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
22181
22592
  });
22182
22593
  var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
22183
- var projectBackersCommand = new Command130("backers").description(
22594
+ var projectBackersCommand = new Command131("backers").description(
22184
22595
  "List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
22185
22596
  ).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) => {
22186
22597
  const projectId = parseProjectId(id);
@@ -22199,13 +22610,13 @@ var projectBackersCommand = new Command130("backers").description(
22199
22610
  await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
22200
22611
  );
22201
22612
  });
22202
- var projectForTaskCommand = new Command130("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) => {
22613
+ var projectForTaskCommand = new Command131("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) => {
22203
22614
  if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
22204
22615
  return void printError("The task id must be 0x-prefixed hex");
22205
22616
  }
22206
22617
  printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
22207
22618
  });
22208
- var projectListCommand = new Command130("list").description("List a wallet's projects, as owner or operator (free; default: your wallet)").option("--address <address>", "The wallet to list (default: your keystore wallet)").option("--role <role>", "owner, operator or any", "any").option("--limit <count>", "Projects per page (1-100, default 50)").option("--before <projectId>", "The next page: projects with a smaller id than this").action(async (opts) => {
22619
+ var projectListCommand = new Command131("list").description("List a wallet's projects, as owner or operator (free; default: your wallet)").option("--address <address>", "The wallet to list (default: your keystore wallet)").option("--role <role>", "owner, operator or any", "any").option("--limit <count>", "Projects per page (1-100, default 50)").option("--before <projectId>", "The next page: projects with a smaller id than this").action(async (opts) => {
22209
22620
  if (!["owner", "operator", "any"].includes(opts.role)) {
22210
22621
  return void printError("--role must be owner, operator or any");
22211
22622
  }
@@ -22234,7 +22645,7 @@ var projectListCommand = new Command130("list").description("List a wallet's pro
22234
22645
  });
22235
22646
 
22236
22647
  // src/commands/project/index.ts
22237
- var projectCommand = new Command131("project").description(
22648
+ var projectCommand = new Command132("project").description(
22238
22649
  "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"
22239
22650
  );
22240
22651
  projectCommand.addCommand(projectCreateCommand);
@@ -22254,12 +22665,12 @@ projectCommand.addCommand(projectListCommand);
22254
22665
  projectCommand.addCommand(projectForTaskCommand);
22255
22666
 
22256
22667
  // src/commands/workflow.ts
22257
- import { readFile as readFile4 } from "fs/promises";
22258
- import { Command as Command133 } from "commander";
22668
+ import { readFile as readFile5 } from "fs/promises";
22669
+ import { Command as Command134 } from "commander";
22259
22670
 
22260
22671
  // src/commands/workflow-template.ts
22261
- import { readFile as readFile3 } from "fs/promises";
22262
- import { Command as Command132 } from "commander";
22672
+ import { readFile as readFile4 } from "fs/promises";
22673
+ import { Command as Command133 } from "commander";
22263
22674
  var UUID3 = /^[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}$/;
22264
22675
  var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
22265
22676
  var FILE_MAX_BYTES = 256 * 1024;
@@ -22268,7 +22679,7 @@ async function readJsonFile(path7, what = "template") {
22268
22679
  if (!path7) return { error: `Pass the ${what} with --file <path> (JSON)` };
22269
22680
  let text;
22270
22681
  try {
22271
- const buffer = await readFile3(path7);
22682
+ const buffer = await readFile4(path7);
22272
22683
  if (buffer.length > FILE_MAX_BYTES) {
22273
22684
  return { error: `${path7} is ${buffer.length} bytes; a ${what} is at most 64 KiB as JSON` };
22274
22685
  }
@@ -22349,14 +22760,14 @@ async function readValidTemplate(path7) {
22349
22760
  }
22350
22761
  return parsed.document;
22351
22762
  }
22352
- var createCommand3 = new Command132("create").description(
22763
+ var createCommand4 = new Command133("create").description(
22353
22764
  "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"
22354
22765
  ).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
22355
22766
  const template = await readValidTemplate(opts.file);
22356
22767
  if (!template) return;
22357
22768
  await postProjectWrite("/api/project-workflow-templates", { template });
22358
22769
  });
22359
- var updateCommand = new Command132("update").description(
22770
+ var updateCommand = new Command133("update").description(
22360
22771
  "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"
22361
22772
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
22362
22773
  const choice = templateChoice(value);
@@ -22370,7 +22781,7 @@ var updateCommand = new Command132("update").description(
22370
22781
  template
22371
22782
  });
22372
22783
  });
22373
- var listCommand7 = new Command132("list").description(
22784
+ var listCommand7 = new Command133("list").description(
22374
22785
  "List the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given) (free)"
22375
22786
  ).option("--owner <address>", "The wallet whose templates to list").option("--limit <count>", "Templates per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (opts) => {
22376
22787
  if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
@@ -22398,7 +22809,7 @@ var listCommand7 = new Command132("list").description(
22398
22809
  renderFailure(err);
22399
22810
  }
22400
22811
  });
22401
- var showCommand4 = new Command132("show").description(
22812
+ var showCommand4 = new Command133("show").description(
22402
22813
  "Show a saved template or a preset (code, content, research): its parameters, steps and worst case (free)"
22403
22814
  ).argument("<template>", "Template id or preset name").action(async (value) => {
22404
22815
  const choice = templateChoice(value);
@@ -22411,7 +22822,7 @@ var showCommand4 = new Command132("show").description(
22411
22822
  renderFailure(err);
22412
22823
  }
22413
22824
  });
22414
- var deleteCommand2 = new Command132("delete").description(
22825
+ var deleteCommand2 = new Command133("delete").description(
22415
22826
  "Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
22416
22827
  ).argument("<templateId>", "Template id").action(async (value) => {
22417
22828
  const choice = templateChoice(value);
@@ -22422,9 +22833,9 @@ var deleteCommand2 = new Command132("delete").description(
22422
22833
  templateId: choice.templateId
22423
22834
  });
22424
22835
  });
22425
- var workflowTemplateCommand = new Command132("template").description(
22836
+ var workflowTemplateCommand = new Command133("template").description(
22426
22837
  "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|preset> --param name=value`. Presets: code, content, research"
22427
- ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand7).addCommand(showCommand4).addCommand(deleteCommand2);
22838
+ ).addCommand(createCommand4).addCommand(updateCommand).addCommand(listCommand7).addCommand(showCommand4).addCommand(deleteCommand2);
22428
22839
  async function createWorkflowFromTemplate(projectId, template, pairs) {
22429
22840
  const choice = templateChoice(template);
22430
22841
  if ("error" in choice) return void printError(choice.error);
@@ -22451,7 +22862,7 @@ async function readDocument(path7) {
22451
22862
  if (!path7) return { error: "Pass the workflow document with --file <path> (JSON)" };
22452
22863
  let text;
22453
22864
  try {
22454
- const buffer = await readFile4(path7);
22865
+ const buffer = await readFile5(path7);
22455
22866
  if (buffer.length > FILE_MAX_BYTES2) {
22456
22867
  return {
22457
22868
  error: `${path7} is ${buffer.length} bytes; a workflow document is at most 64 KiB as JSON`
@@ -22501,7 +22912,7 @@ async function projectContext(projectId) {
22501
22912
  runner
22502
22913
  };
22503
22914
  }
22504
- var validateCommand = new Command133("validate").description(
22915
+ var validateCommand = new Command134("validate").description(
22505
22916
  "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)"
22506
22917
  ).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) => {
22507
22918
  const parsed = await readDocument(opts.file ?? file);
@@ -22544,7 +22955,7 @@ var validateCommand = new Command133("validate").description(
22544
22955
  document: result.document
22545
22956
  });
22546
22957
  });
22547
- var createCommand4 = new Command133("create").description(
22958
+ var createCommand5 = new Command134("create").description(
22548
22959
  "Create a workflow on a project, as its owner, from a JSON document (--file) or from a saved template or a preset (--template <id|code|content|research> 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"
22549
22960
  ).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option("--template <template>", "A saved template id, or a preset: code, content, research").option(
22550
22961
  "--param <name=value>",
@@ -22579,7 +22990,7 @@ var createCommand4 = new Command133("create").description(
22579
22990
  document: parsed.document
22580
22991
  });
22581
22992
  });
22582
- var listCommand8 = new Command133("list").description(
22993
+ var listCommand8 = new Command134("list").description(
22583
22994
  "List a project's workflows, newest first, with its workflow limits and the platform runner (free)"
22584
22995
  ).argument("<projectId>", "Project id").option("--limit <count>", "Workflows per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (id, opts) => {
22585
22996
  const projectId = parseProjectId(id);
@@ -22593,12 +23004,12 @@ var listCommand8 = new Command133("list").description(
22593
23004
  const query4 = params.toString();
22594
23005
  await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
22595
23006
  });
22596
- var showCommand5 = new Command133("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
23007
+ var showCommand5 = new Command134("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
22597
23008
  const id = uuid(value, "workflow");
22598
23009
  if (typeof id !== "string") return void printError(id.error);
22599
23010
  await read2(`/api/project-workflows/${id}`);
22600
23011
  });
22601
- var runsCommand = new Command133("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) => {
23012
+ var runsCommand = new Command134("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) => {
22602
23013
  const id = uuid(value, "workflow");
22603
23014
  if (typeof id !== "string") return void printError(id.error);
22604
23015
  if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
@@ -22610,14 +23021,14 @@ var runsCommand = new Command133("runs").description("Page through a workflow's
22610
23021
  const query4 = params.toString();
22611
23022
  await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
22612
23023
  });
22613
- var statusCommand3 = new Command133("status").description(
23024
+ var statusCommand3 = new Command134("status").description(
22614
23025
  "Show a run: its outline, each step with its state (pending, open, accepted, failed or skipped), round, item or attempt, and the next action (free)"
22615
23026
  ).argument("<runId>", "Run id").action(async (value) => {
22616
23027
  const id = uuid(value, "run");
22617
23028
  if (typeof id !== "string") return void printError(id.error);
22618
23029
  await read2(`/api/project-workflow-runs/${id}`);
22619
23030
  });
22620
- var runCommand2 = new Command133("run").description(
23031
+ var runCommand2 = new Command134("run").description(
22621
23032
  "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"
22622
23033
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
22623
23034
  const id = uuid(value, "workflow");
@@ -22625,7 +23036,7 @@ var runCommand2 = new Command133("run").description(
22625
23036
  await postProjectWrite(`/api/project-workflows/${id}/runs`, { workflowId: id });
22626
23037
  });
22627
23038
  function stepCommand(action, description) {
22628
- return new Command133(action).description(description).argument("<runId>", "Run id").requiredOption(
23039
+ return new Command134(action).description(description).argument("<runId>", "Run id").requiredOption(
22629
23040
  "--step <key>",
22630
23041
  "The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
22631
23042
  ).action(async (value, opts) => {
@@ -22636,14 +23047,21 @@ function stepCommand(action, description) {
22636
23047
  await postProjectWrite(`/api/project-workflow-runs/${id}/${action}`, { runId: id, step });
22637
23048
  });
22638
23049
  }
22639
- var cancelCommand = new Command133("cancel").description(
23050
+ var cancelCommand = new Command134("cancel").description(
22640
23051
  "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"
22641
23052
  ).argument("<runId>", "Run id").action(async (value) => {
22642
23053
  const id = uuid(value, "run");
22643
23054
  if (typeof id !== "string") return void printError(id.error);
22644
23055
  await postProjectWrite(`/api/project-workflow-runs/${id}/cancel`, { runId: id });
22645
23056
  });
22646
- var settingsCommand2 = new Command133("settings").description(
23057
+ var deleteCommand3 = new Command134("delete").description(
23058
+ "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"
23059
+ ).argument("<workflowId>", "Workflow id").action(async (value) => {
23060
+ const id = uuid(value, "workflow");
23061
+ if (typeof id !== "string") return void printError(id.error);
23062
+ await postProjectWrite(`/api/project-workflows/${id}/delete`, { workflowId: id });
23063
+ });
23064
+ var settingsCommand2 = new Command134("settings").description(
22647
23065
  `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`
22648
23066
  ).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
22649
23067
  const projectId = parseProjectId(id);
@@ -22670,9 +23088,9 @@ var settingsCommand2 = new Command133("settings").description(
22670
23088
  stepLimit: limit
22671
23089
  });
22672
23090
  });
22673
- var workflowCommand = new Command133("workflow").description(
23091
+ var workflowCommand = new Command134("workflow").description(
22674
23092
  "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"
22675
- ).addCommand(validateCommand).addCommand(createCommand4).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
23093
+ ).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand5).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
22676
23094
  stepCommand(
22677
23095
  "approve",
22678
23096
  "Approve an open owner gate in a run so the steps after it start, as the owner; a verdict or time gate opens on its own (costs 0.001 in the payment token)"
@@ -22680,13 +23098,13 @@ var workflowCommand = new Command133("workflow").description(
22680
23098
  ).addCommand(
22681
23099
  stepCommand(
22682
23100
  "retry",
22683
- "Retry a failed step the run waits on, as a new attempt, as the owner; a forEach recounts its list (costs 0.001 in the payment token)"
23101
+ "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)"
22684
23102
  )
22685
- ).addCommand(cancelCommand).addCommand(settingsCommand2).addCommand(workflowTemplateCommand);
23103
+ ).addCommand(cancelCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(workflowTemplateCommand);
22686
23104
 
22687
23105
  // src/commands/drops.ts
22688
- import { Command as Command134 } from "commander";
22689
- var listCommand9 = new Command134("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) => {
23106
+ import { Command as Command135 } from "commander";
23107
+ var listCommand9 = new Command135("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) => {
22690
23108
  try {
22691
23109
  const input = parseInput(TaskDropDirectoryInputSchema, {
22692
23110
  limit: optionalInt(opts.limit),
@@ -22699,7 +23117,7 @@ var listCommand9 = new Command134("list").description("List public Task Drops, o
22699
23117
  renderFailure(err);
22700
23118
  }
22701
23119
  });
22702
- var showCommand6 = new Command134("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
23120
+ var showCommand6 = new Command135("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
22703
23121
  try {
22704
23122
  const input = parseInput(TaskDropGetInputSchema, { taskDropId });
22705
23123
  const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
@@ -22711,7 +23129,7 @@ var showCommand6 = new Command134("show").description("Show a Task Drop and its
22711
23129
  renderFailure(err);
22712
23130
  }
22713
23131
  });
22714
- var subscribeCommand = new Command134("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(
23132
+ var subscribeCommand = new Command135("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(
22715
23133
  async (taskDropId, opts) => {
22716
23134
  try {
22717
23135
  if (opts.official) {
@@ -22739,7 +23157,7 @@ var subscribeCommand = new Command134("subscribe").description("Subscribe an ema
22739
23157
  }
22740
23158
  }
22741
23159
  );
22742
- var statusCommand4 = new Command134("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) => {
23160
+ var statusCommand4 = new Command135("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) => {
22743
23161
  try {
22744
23162
  if (opts.official) {
22745
23163
  if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
@@ -22756,11 +23174,11 @@ var statusCommand4 = new Command134("status").description("Check whether an emai
22756
23174
  renderFailure(err);
22757
23175
  }
22758
23176
  });
22759
- var dropsCommand = new Command134("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
23177
+ var dropsCommand = new Command135("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
22760
23178
 
22761
23179
  // src/commands/hooks.ts
22762
- import { Command as Command135 } from "commander";
22763
- var listCommand10 = new Command135("list").description(
23180
+ import { Command as Command136 } from "commander";
23181
+ var listCommand10 = new Command136("list").description(
22764
23182
  "List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
22765
23183
  ).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").action(async (opts) => {
22766
23184
  try {
@@ -22775,7 +23193,7 @@ var listCommand10 = new Command135("list").description(
22775
23193
  renderFailure(err);
22776
23194
  }
22777
23195
  });
22778
- var showCommand7 = new Command135("show").description(
23196
+ var showCommand7 = new Command136("show").description(
22779
23197
  "Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
22780
23198
  ).argument("<address>", "Hook contract address").action(async (address2) => {
22781
23199
  try {
@@ -22795,7 +23213,7 @@ var showCommand7 = new Command135("show").description(
22795
23213
  renderFailure(err);
22796
23214
  }
22797
23215
  });
22798
- var attachmentConfigCommand = new Command135("attachment-config").description(
23216
+ var attachmentConfigCommand = new Command136("attachment-config").description(
22799
23217
  "Show the protocol-default hook order and maximum hooks per task on the selected --network"
22800
23218
  ).action(async () => {
22801
23219
  try {
@@ -22804,12 +23222,12 @@ var attachmentConfigCommand = new Command135("attachment-config").description(
22804
23222
  renderFailure(err);
22805
23223
  }
22806
23224
  });
22807
- var hooksCommand = new Command135("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(attachmentConfigCommand);
23225
+ var hooksCommand = new Command136("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(attachmentConfigCommand);
22808
23226
 
22809
23227
  // src/commands/tap.ts
22810
23228
  import { promises as fs10 } from "fs";
22811
- import { Command as Command136 } from "commander";
22812
- var tapCommand = new Command136("tap").description(
23229
+ import { Command as Command137 } from "commander";
23230
+ var tapCommand = new Command137("tap").description(
22813
23231
  "Manage the TAP signing key used on tasks that require TAP verification"
22814
23232
  );
22815
23233
  tapCommand.command("import").description(
@@ -22921,10 +23339,10 @@ tapCommand.command("show").description(
22921
23339
  printResult({ configured: false });
22922
23340
  return;
22923
23341
  }
22924
- const summary = { configured: true, ...tapKeySummary(tapKey) };
23342
+ const summary2 = { configured: true, ...tapKeySummary(tapKey) };
22925
23343
  const keyId = tapKey.keyId;
22926
23344
  if (keyId === null) {
22927
- printResult({ ...summary, status: null });
23345
+ printResult({ ...summary2, status: null });
22928
23346
  return;
22929
23347
  }
22930
23348
  const warnings = [];
@@ -22951,7 +23369,7 @@ tapCommand.command("show").description(
22951
23369
  );
22952
23370
  }
22953
23371
  }
22954
- printResult({ ...summary, status }, { warnings });
23372
+ printResult({ ...summary2, status }, { warnings });
22955
23373
  } catch (err) {
22956
23374
  renderFailure(err);
22957
23375
  }
@@ -22968,7 +23386,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
22968
23386
  });
22969
23387
 
22970
23388
  // src/commands/hire.ts
22971
- import { Command as Command137 } from "commander";
23389
+ import { Command as Command138 } from "commander";
22972
23390
  var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
22973
23391
  async function lookupListedService(worker, serviceId) {
22974
23392
  let listing;
@@ -22999,7 +23417,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
22999
23417
  }
23000
23418
  return null;
23001
23419
  }
23002
- var hireCommand = new Command137("hire").description(
23420
+ var hireCommand = new Command138("hire").description(
23003
23421
  "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."
23004
23422
  ).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(
23005
23423
  "--requires-evaluator",
@@ -23063,7 +23481,7 @@ hireCommand.action(async (worker, opts) => {
23063
23481
  // src/index.ts
23064
23482
  var require2 = createRequire(import.meta.url);
23065
23483
  var { version } = require2("../package.json");
23066
- var program = new Command138();
23484
+ var program = new Command139();
23067
23485
  setLastErrorCliVersion(version);
23068
23486
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
23069
23487
  program.option(
@@ -23091,6 +23509,7 @@ program.addCommand(statsCommand);
23091
23509
  program.addCommand(taskCommand2);
23092
23510
  program.addCommand(agentCommand);
23093
23511
  program.addCommand(agentsCommand);
23512
+ program.addCommand(skillsCommand);
23094
23513
  program.addCommand(inboxCommand);
23095
23514
  program.addCommand(depositCommand);
23096
23515
  program.addCommand(withdrawCommand);