@lucid-agents/taskmarket 1.40.0 → 1.41.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 (26) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +150 -288
  2. package/dist/agent-compatibility.json +1 -1
  3. package/dist/{api-KVJC2YUT.js → api-S2IU3JCT.js} +2 -2
  4. package/dist/{channels-C7RATT4R.js → channels-4LHC2LND.js} +4 -4
  5. package/dist/{chunk-HDXVDIQQ.js → chunk-5VGLI7T4.js} +1 -1
  6. package/dist/{chunk-I56PQUGS.js → chunk-6XMZQPS5.js} +3 -3
  7. package/dist/{chunk-H6EGL76J.js → chunk-7Y5S6QR7.js} +3320 -6414
  8. package/dist/{chunk-DQ7VOFP7.js → chunk-A37LXOBO.js} +5 -5
  9. package/dist/{chunk-LPW4GUD5.js → chunk-A6JG4LL5.js} +3 -3
  10. package/dist/{chunk-HWOVMACE.js → chunk-HH2RBNNT.js} +2 -2
  11. package/dist/{chunk-KOV37V5R.js → chunk-HYYMYJV4.js} +3 -3
  12. package/dist/{chunk-PQCZDREC.js → chunk-LIVNNQYQ.js} +1 -1
  13. package/dist/{chunk-IILD5VXU.js → chunk-ORCB435L.js} +1 -1
  14. package/dist/{chunk-6QUUNUR4.js → chunk-PNBVFBTB.js} +14 -9
  15. package/dist/{chunk-JAJCNNGK.js → chunk-PRKO232N.js} +1 -1
  16. package/dist/{chunk-QEDLNQCE.js → chunk-Z66B234H.js} +1 -1
  17. package/dist/{doctor-22BCAXSE.js → doctor-EII4X6TP.js} +8 -8
  18. package/dist/index.js +1051 -591
  19. package/dist/{launch-CGOA6WTU.js → launch-SV7PLTVI.js} +11 -11
  20. package/dist/pi-extensions/xgate.cjs +10458 -84178
  21. package/dist/{read-auth-XV4SH3GF.js → read-auth-SP6JR5V4.js} +3 -3
  22. package/dist/{reconcile-7ZG7SJM2.js → reconcile-FN727GXS.js} +4 -4
  23. package/dist/{status-VODVEYZK.js → status-ASLURNQV.js} +8 -8
  24. package/dist/{sync-pull-3EZWIMNV.js → sync-pull-NAO3WOFB.js} +4 -4
  25. package/dist/{task-access-grants-J3RR2BKM.js → task-access-grants-2UQMMUAR.js} +2 -2
  26. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  listWorkerSubmissions,
15
15
  submitTaskFiles,
16
16
  taskRequirementsOf
17
- } from "./chunk-6QUUNUR4.js";
17
+ } from "./chunk-PNBVFBTB.js";
18
18
  import {
19
19
  ComputeCreditError,
20
20
  applyComputeCreditSetup,
@@ -37,14 +37,14 @@ import {
37
37
  releasePendingComputePurchase,
38
38
  resolvePendingComputePurchases,
39
39
  x402FeePost
40
- } from "./chunk-LPW4GUD5.js";
40
+ } from "./chunk-A6JG4LL5.js";
41
41
  import {
42
42
  signReadAuth
43
- } from "./chunk-HWOVMACE.js";
43
+ } from "./chunk-HH2RBNNT.js";
44
44
  import {
45
45
  saveTaskAccessGrant,
46
46
  taskAccessGrantHeaders
47
- } from "./chunk-IILD5VXU.js";
47
+ } from "./chunk-ORCB435L.js";
48
48
  import {
49
49
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
50
50
  X402PayError,
@@ -62,7 +62,7 @@ import {
62
62
  setX402PolicyRuleEnabled,
63
63
  signSponsoredTempoTransfer,
64
64
  signTaskmarketFeePayment
65
- } from "./chunk-QEDLNQCE.js";
65
+ } from "./chunk-Z66B234H.js";
66
66
  import {
67
67
  ALL_NETWORKS,
68
68
  ApiError,
@@ -125,7 +125,7 @@ import {
125
125
  withErrorContext,
126
126
  withIdempotentWrite,
127
127
  withTapSignature
128
- } from "./chunk-HDXVDIQQ.js";
128
+ } from "./chunk-5VGLI7T4.js";
129
129
  import {
130
130
  AGENT_AVATAR_MAX_BYTES,
131
131
  AGENT_HIRES_ROLES,
@@ -196,6 +196,7 @@ import {
196
196
  PROJECT_SUGGESTIONS_LIST_DEFAULT,
197
197
  PROJECT_SUGGESTIONS_LIST_MAX,
198
198
  PROJECT_SUGGESTIONS_SETTINGS,
199
+ PROJECT_SUGGESTION_REPORT_REASONS,
199
200
  PROJECT_SUGGESTION_SORTS,
200
201
  PROJECT_SUGGESTION_STATUSES,
201
202
  PUBLIC_BUG_REPORT_SORTS,
@@ -207,6 +208,8 @@ import {
207
208
  ProjectSuggestionBriefSchema,
208
209
  ProjectSuggestionDeclineSchema,
209
210
  ProjectSuggestionIdSchema,
211
+ ProjectSuggestionReportNoteSchema,
212
+ ProjectSuggestionReportReasonSchema,
210
213
  ProjectSuggestionTitleSchema,
211
214
  READ_AUTH_ADDRESS_HEADER,
212
215
  READ_AUTH_SIGNATURE_HEADER,
@@ -219,6 +222,8 @@ import {
219
222
  SOLANA_CHAIN_IDS,
220
223
  SPONSORED_VAULT_7702,
221
224
  STANDARD_X402_ACTION_AMOUNT,
225
+ SUGGESTION_PROPOSAL_STATUSES,
226
+ SUGGESTION_SCHEDULE_MAX_TASKS_PER_RUN,
222
227
  SetMarketEventPreferenceInputSchema,
223
228
  SponsoredTaskRewardStateSchema,
224
229
  SponsoredTaskWorkerRewardClaimStatusSchema,
@@ -242,6 +247,10 @@ import {
242
247
  SubmissionReviewStartPayloadSchema,
243
248
  SubmissionReviewTaskInputSchema,
244
249
  SubmitBugReportInputSchema,
250
+ SuggestionProposalConfirmSchema,
251
+ SuggestionProposalsListInputSchema,
252
+ SuggestionScheduleConfigSchema,
253
+ SuggestionScheduleSettingsSchema,
245
254
  TASK_TEMPLATE_IDS,
246
255
  TaskActionQueueInputSchema,
247
256
  TaskCapabilitiesSchema,
@@ -360,12 +369,13 @@ import {
360
369
  validateWorkflowTemplate,
361
370
  vaultCallGasLimit7702,
362
371
  verifierProviderId,
363
- verifiersUnsupportedOnChain
364
- } from "./chunk-H6EGL76J.js";
372
+ verifiersUnsupportedOnChain,
373
+ viemChainFor
374
+ } from "./chunk-7Y5S6QR7.js";
365
375
  import "./chunk-S7SJMJ2I.js";
366
376
 
367
377
  // src/index.ts
368
- import { Command as Command154 } from "commander";
378
+ import { Command as Command156 } from "commander";
369
379
  import { createRequire } from "module";
370
380
 
371
381
  // src/commands/init.ts
@@ -7789,7 +7799,7 @@ function resolveSponsoredTaskChain(chainId, env = process.env) {
7789
7799
  throw new Error(`Chain ${chainId} is not a Taskmarket chain`);
7790
7800
  }
7791
7801
  const entry = taskmarketChain(chainId);
7792
- const viemChain = entry.viemChain;
7802
+ const viemChain = viemChainFor(chainId);
7793
7803
  const rpcOverride = env["TASKMARKET_RPC_URL"]?.trim();
7794
7804
  const rpcUrl = rpcOverride || entry.publicRpcUrl;
7795
7805
  const rpcSource = rpcOverride ? "TASKMARKET_RPC_URL" : "registry";
@@ -9049,12 +9059,12 @@ async function x402Post(path9, body, options) {
9049
9059
  body: request.body
9050
9060
  });
9051
9061
  if (r2.ok) return { data: await r2.json(), idempotencyKey };
9052
- const read3 = await readFailureBody(r2);
9053
- if (r2.status === 503 && apiErrorEnvelopeOf(read3.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
9062
+ const read4 = await readFailureBody(r2);
9063
+ if (r2.status === 503 && apiErrorEnvelopeOf(read4.body)?.reason === "facilitator_unavailable" && attempt < FACILITATOR_RETRIES) {
9054
9064
  await sleep4(retryAfterMs(r2));
9055
9065
  continue;
9056
9066
  }
9057
- throw failedAfterPayment(path9, r2.status, read3, idempotencyKey);
9067
+ throw failedAfterPayment(path9, r2.status, read4, idempotencyKey);
9058
9068
  }
9059
9069
  });
9060
9070
  }
@@ -11067,10 +11077,10 @@ var UNVERIFIED_HOOK_CODE = "unverified_hook";
11067
11077
  var UNVERIFIED_HOOK_CHECK_FAILED_CODE = "unverified_hook_check_failed";
11068
11078
  async function confirmUnverifiedHooks(action, taskId, accepted, task) {
11069
11079
  if (accepted) return true;
11070
- let read3 = task;
11071
- if (read3 === void 0) {
11080
+ let read4 = task;
11081
+ if (read4 === void 0) {
11072
11082
  try {
11073
- read3 = await getTask(cliTaskReadContext(), { taskId });
11083
+ read4 = await getTask(cliTaskReadContext(), { taskId });
11074
11084
  } catch (error) {
11075
11085
  renderFailure(
11076
11086
  new Error(
@@ -11086,7 +11096,7 @@ async function confirmUnverifiedHooks(action, taskId, accepted, task) {
11086
11096
  return false;
11087
11097
  }
11088
11098
  }
11089
- const hooks = [...read3?.unverifiedHooks ?? []];
11099
+ const hooks = [...read4?.unverifiedHooks ?? []];
11090
11100
  if (hooks.length === 0) return true;
11091
11101
  renderFailure(
11092
11102
  new Error(
@@ -11100,15 +11110,15 @@ async function confirmUnverifiedHooks(action, taskId, accepted, task) {
11100
11110
  // src/lib/task-network.ts
11101
11111
  var WRONG_NETWORK_CODE = "wrong_network";
11102
11112
  async function confirmTaskOnSelectedNetwork(taskId, task) {
11103
- let read3 = task;
11104
- if (read3 === void 0) {
11113
+ let read4 = task;
11114
+ if (read4 === void 0) {
11105
11115
  try {
11106
- read3 = await getTask(cliTaskReadContext(), { taskId });
11116
+ read4 = await getTask(cliTaskReadContext(), { taskId });
11107
11117
  } catch {
11108
11118
  return true;
11109
11119
  }
11110
11120
  }
11111
- const taskChainId = read3?.chainId;
11121
+ const taskChainId = read4?.chainId;
11112
11122
  const network = selectedNetwork();
11113
11123
  if (typeof taskChainId !== "number" || taskChainId === network.chainId) return true;
11114
11124
  const taskNetwork = networkNameForChain(taskChainId) ?? null;
@@ -11794,25 +11804,49 @@ var auctionAcceptCmd = new Command27("auction-accept").description("Accept curre
11794
11804
 
11795
11805
  // src/commands/task/submissions.ts
11796
11806
  import { Command as Command28 } from "commander";
11807
+ import { z as z3 } from "zod";
11808
+ var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
11809
+ limit: TaskChildListSchema.shape.limit.removeDefault().optional(),
11810
+ ids: z3.string().transform(
11811
+ (value) => value.split(",").map((id) => id.trim()).filter(Boolean)
11812
+ ).pipe(z3.array(z3.string().uuid().toLowerCase()).min(1).max(50)).optional()
11813
+ });
11797
11814
  var submissionsCmd = new Command28("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
11798
11815
  "--passed-check <provider>",
11799
11816
  "Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:verified or tap:identity:known"
11800
- ).action(async (taskId, opts) => {
11801
- const passedCheck = parseRequirementFilter(opts.passedCheck, CHECK_FILTER, "--passed-check");
11802
- if ("error" in passedCheck) return void printError(passedCheck.error);
11803
- let subs;
11804
- try {
11805
- subs = await listTaskSubmissions(
11806
- cliTaskReadContext(),
11807
- { taskId },
11808
- passedCheck.value ? { passedCheck: passedCheck.value } : {}
11809
- );
11810
- } catch (err) {
11811
- renderFailure(err, { fallback: "Failed to fetch submissions." });
11812
- return;
11817
+ ).option("--limit <n>", "Page size (1-500); without it every submission is listed").option("--cursor <id>", "Last returned id; read the following page").option("--ids <ids>", "Only these submissions: comma-separated ids (at most 50)").action(
11818
+ async (taskId, opts) => {
11819
+ const passedCheck = parseRequirementFilter(opts.passedCheck, CHECK_FILTER, "--passed-check");
11820
+ if ("error" in passedCheck) return void printError(passedCheck.error);
11821
+ const page = SubmissionPageSchema.safeParse({
11822
+ limit: opts.limit,
11823
+ cursor: opts.cursor,
11824
+ ids: opts.ids
11825
+ });
11826
+ if (!page.success) {
11827
+ return void printError(
11828
+ `Invalid paging options: ${page.error.issues.map((issue) => `--${issue.path.join(".")} ${issue.message}`).join("; ")}`
11829
+ );
11830
+ }
11831
+ let subs;
11832
+ try {
11833
+ subs = await listTaskSubmissions(
11834
+ cliTaskReadContext(),
11835
+ { taskId },
11836
+ {
11837
+ ...passedCheck.value ? { passedCheck: passedCheck.value } : {},
11838
+ ...page.data.limit !== void 0 ? { limit: page.data.limit } : {},
11839
+ ...page.data.cursor ? { cursor: page.data.cursor } : {},
11840
+ ...page.data.ids ? { ids: page.data.ids } : {}
11841
+ }
11842
+ );
11843
+ } catch (err) {
11844
+ renderFailure(err, { fallback: "Failed to fetch submissions." });
11845
+ return;
11846
+ }
11847
+ printResult(withChainNames(subs));
11813
11848
  }
11814
- printResult(withChainNames(subs));
11815
- });
11849
+ );
11816
11850
 
11817
11851
  // src/commands/task/claims.ts
11818
11852
  import { Command as Command29 } from "commander";
@@ -13009,7 +13043,7 @@ async function runAgentCommand(options) {
13009
13043
  try {
13010
13044
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
13011
13045
  const pi = assertAgentCompatibility();
13012
- const { runAgent } = await import("./launch-CGOA6WTU.js");
13046
+ const { runAgent } = await import("./launch-SV7PLTVI.js");
13013
13047
  result = await runAgent({
13014
13048
  model: options.model,
13015
13049
  pi,
@@ -13443,13 +13477,13 @@ function agentManagementCommands() {
13443
13477
  const status = new Command57("status").description(
13444
13478
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
13445
13479
  ).action(async () => {
13446
- const { collectAgentStatus } = await import("./status-VODVEYZK.js");
13480
+ const { collectAgentStatus } = await import("./status-ASLURNQV.js");
13447
13481
  await run(() => collectAgentStatus());
13448
13482
  });
13449
13483
  const doctor = new Command57("doctor").description(
13450
13484
  "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."
13451
13485
  ).action(async () => {
13452
- const { runDoctor } = await import("./doctor-22BCAXSE.js");
13486
+ const { runDoctor } = await import("./doctor-EII4X6TP.js");
13453
13487
  const report = await run(() => runDoctor());
13454
13488
  if (report && !report.ok) process.exitCode = 1;
13455
13489
  });
@@ -13460,7 +13494,7 @@ function agentManagementCommands() {
13460
13494
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
13461
13495
  ).action(
13462
13496
  async (invocationId, options) => {
13463
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-7ZG7SJM2.js");
13497
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-FN727GXS.js");
13464
13498
  const choice = { rail: options.rail, channel: options.channel };
13465
13499
  if (invocationId !== void 0) {
13466
13500
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -13492,7 +13526,7 @@ function agentManagementCommands() {
13492
13526
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
13493
13527
  );
13494
13528
  }
13495
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-C7RATT4R.js");
13529
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-4LHC2LND.js");
13496
13530
  const { rails } = await openAgentChannels();
13497
13531
  const result = await requestTopUp(selectRail(rails, options.rail), amount);
13498
13532
  return {
@@ -13512,8 +13546,8 @@ function agentManagementCommands() {
13512
13546
  await run(async () => {
13513
13547
  await requireExperimental();
13514
13548
  const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
13515
- const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-C7RATT4R.js");
13516
- const { reconcileLeasedPurchase } = await import("./reconcile-7ZG7SJM2.js");
13549
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-4LHC2LND.js");
13550
+ const { reconcileLeasedPurchase } = await import("./reconcile-FN727GXS.js");
13517
13551
  const opened = await openAgentChannels();
13518
13552
  const { rail, retired } = selectChannel(opened, options);
13519
13553
  const result = await closeChannel(
@@ -13567,7 +13601,7 @@ function agentManagementCommands() {
13567
13601
  async (options) => {
13568
13602
  await run(async () => {
13569
13603
  await requireExperimental();
13570
- const { runPull } = await import("./sync-pull-3EZWIMNV.js");
13604
+ const { runPull } = await import("./sync-pull-NAO3WOFB.js");
13571
13605
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
13572
13606
  return runPull(options, {
13573
13607
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -13634,7 +13668,7 @@ function allowListed(flag, value, allowed) {
13634
13668
  }
13635
13669
  var agentsCommand = new Command59("agents").description("Browse the worker directory (agents and humans) on the selected --network").enablePositionalOptions().option(
13636
13670
  "--sort <order>",
13637
- "Sort order: reputation (top rated), tasks or hires (most hired: completed reserved, quote and request hires)",
13671
+ "Sort order: reputation (top rated), tasks, hires (most hired: completed reserved, quote and request hires) or volume (settled earnings)",
13638
13672
  "reputation"
13639
13673
  ).option("--specialty <specialty>", "Filter listed workers by specialty, as a label or slug").option("--skill <tag>", "Deprecated alias of --specialty").option(
13640
13674
  "--capability <slug>",
@@ -14068,9 +14102,9 @@ function buildWorkflows(workflows, schedules, limit = DASHBOARD_LIST_LIMIT) {
14068
14102
  // src/commands/dashboard.ts
14069
14103
  var PROJECTS_READ_LIMIT = 25;
14070
14104
  var SWARM_NOTE = "Hosted agents are managed in the web app (/dashboard/swarm) and need a web sign-in, so the CLI does not read them.";
14071
- async function settle(read3) {
14105
+ async function settle(read4) {
14072
14106
  try {
14073
- return { value: await read3(), error: null };
14107
+ return { value: await read4(), error: null };
14074
14108
  } catch (error) {
14075
14109
  return { value: null, error: error instanceof Error ? error.message : String(error) };
14076
14110
  }
@@ -14331,18 +14365,18 @@ var inboxCommand = new Command61("inbox").description(
14331
14365
  import { Command as Command62 } from "commander";
14332
14366
 
14333
14367
  // src/lib/relay-bridge.ts
14334
- import { z as z3 } from "zod";
14368
+ import { z as z4 } from "zod";
14335
14369
  var RELAY_API_BASE_URL = "https://api.relay.link";
14336
- var RelayQuoteResponseSchema = z3.object({
14337
- requestId: z3.string().min(1),
14338
- steps: z3.array(
14339
- z3.object({
14340
- depositAddress: z3.string().regex(/^0x[a-fA-F0-9]{40}$/).optional()
14370
+ var RelayQuoteResponseSchema = z4.object({
14371
+ requestId: z4.string().min(1),
14372
+ steps: z4.array(
14373
+ z4.object({
14374
+ depositAddress: z4.string().regex(/^0x[a-fA-F0-9]{40}$/).optional()
14341
14375
  })
14342
14376
  ).optional(),
14343
- details: z3.object({
14344
- currencyOut: z3.object({
14345
- amount: z3.string().regex(/^[0-9]+$/).optional()
14377
+ details: z4.object({
14378
+ currencyOut: z4.object({
14379
+ amount: z4.string().regex(/^[0-9]+$/).optional()
14346
14380
  }).optional()
14347
14381
  }).optional()
14348
14382
  });
@@ -16197,9 +16231,9 @@ async function createDevClient(input) {
16197
16231
  let offset = 0;
16198
16232
  let live = false;
16199
16233
  while (!options?.signal?.aborted) {
16200
- const read3 = fileBus.readFrom(inboxId, offset);
16201
- offset = read3.offset;
16202
- for (const message of read3.messages) {
16234
+ const read4 = fileBus.readFrom(inboxId, offset);
16235
+ offset = read4.offset;
16236
+ for (const message of read4.messages) {
16203
16237
  if (options?.peerInboxId) {
16204
16238
  if (message.conversationId !== devConversationId(inboxId, options.peerInboxId)) {
16205
16239
  continue;
@@ -17962,7 +17996,7 @@ async function followEmails(options) {
17962
17996
  const sleep4 = options.sleep ?? abortableSleep2;
17963
17997
  const network = selectedNetwork().name;
17964
17998
  const headers = { "x-taskmarket-api-token": options.apiToken };
17965
- const read3 = async (limit, offset) => {
17999
+ const read4 = async (limit, offset) => {
17966
18000
  const params = new URLSearchParams({
17967
18001
  deviceId: options.deviceId,
17968
18002
  limit: String(limit),
@@ -17984,14 +18018,14 @@ async function followEmails(options) {
17984
18018
  }
17985
18019
  try {
17986
18020
  if (cursor === void 0) {
17987
- const [newest] = await read3(1, 0);
18021
+ const [newest] = await read4(1, 0);
17988
18022
  cursor = newest ? { receivedAt: newest.receivedAt, ids: [newest.id] } : { receivedAt: null, ids: [] };
17989
18023
  await saveEmailCursor(walletAddress, network, cursor);
17990
18024
  } else {
17991
18025
  const fresh = [];
17992
18026
  let reachedCursor = false;
17993
18027
  for (let pageIndex = 0; pageIndex < EMAIL_MAX_PAGES; pageIndex += 1) {
17994
- const page = await read3(EMAIL_PAGE_SIZE, pageIndex * EMAIL_PAGE_SIZE);
18028
+ const page = await read4(EMAIL_PAGE_SIZE, pageIndex * EMAIL_PAGE_SIZE);
17995
18029
  for (const email of page) {
17996
18030
  if (isAfter(email, cursor)) {
17997
18031
  if (!fresh.some((seen) => seen.id === email.id)) fresh.push(email);
@@ -18691,7 +18725,7 @@ var addressCommand3 = new Command88("address").description("Show your registered
18691
18725
 
18692
18726
  // src/commands/email/mark-read.ts
18693
18727
  import { Command as Command89 } from "commander";
18694
- async function setReadStatus(id, read3) {
18728
+ async function setReadStatus(id, read4) {
18695
18729
  const keystore = await loadKeystore();
18696
18730
  const { data: result, idempotencyKey } = await apiPost(
18697
18731
  "/api/emails/mark-read",
@@ -18699,7 +18733,7 @@ async function setReadStatus(id, read3) {
18699
18733
  deviceId: keystore.deviceId,
18700
18734
  apiToken: keystore.apiToken,
18701
18735
  id,
18702
- read: read3
18736
+ read: read4
18703
18737
  }
18704
18738
  );
18705
18739
  printResult({ id: result.id, isRead: result.isRead }, { idempotencyKey });
@@ -19616,12 +19650,12 @@ async function call(procedure, input, credential) {
19616
19650
  ...query4 ? {} : { body: JSON.stringify(input ?? {}) }
19617
19651
  });
19618
19652
  if (!response.ok) {
19619
- const read3 = await readFailureBody(response);
19653
+ const read4 = await readFailureBody(response);
19620
19654
  throw new ApiError(
19621
19655
  response.status,
19622
- failureMessage(`brief.${procedure} failed`, response.status, read3),
19656
+ failureMessage(`brief.${procedure} failed`, response.status, read4),
19623
19657
  void 0,
19624
- apiErrorEnvelopeOf(read3.body) ?? void 0
19658
+ apiErrorEnvelopeOf(read4.body) ?? void 0
19625
19659
  );
19626
19660
  }
19627
19661
  const body = await response.json();
@@ -25659,13 +25693,26 @@ sponsoredTaskCommand.addCommand(sponsoredTaskRewardsCommand);
25659
25693
  sponsoredTaskCommand.addCommand(sponsoredTaskBindPayoutCommand);
25660
25694
 
25661
25695
  // src/commands/project/index.ts
25662
- import { Command as Command146 } from "commander";
25696
+ import { Command as Command148 } from "commander";
25663
25697
 
25664
25698
  // src/commands/project/accept.ts
25665
25699
  import { Command as Command127 } from "commander";
25666
25700
 
25667
25701
  // src/commands/project/shared.ts
25668
25702
  var ADDRESS = /^0x[0-9a-fA-F]{40}$/;
25703
+ 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}$/;
25704
+ function parseScheduleId(value) {
25705
+ const trimmed = value.trim();
25706
+ return UUID2.test(trimmed) ? trimmed.toLowerCase() : { error: "The schedule id must be a UUID" };
25707
+ }
25708
+ function parseProposalId(value) {
25709
+ const trimmed = value.trim();
25710
+ return UUID2.test(trimmed) ? trimmed.toLowerCase() : { error: "The proposal id must be a UUID" };
25711
+ }
25712
+ function parseSuggestionId(value) {
25713
+ const parsed = ProjectSuggestionIdSchema.safeParse(value.trim());
25714
+ return parsed.success ? parsed.data.toLowerCase() : { error: "The suggestion id must be a UUID" };
25715
+ }
25669
25716
  function parseProjectId(value) {
25670
25717
  if (!/^[1-9][0-9]*$/.test(value.trim())) {
25671
25718
  return { error: "The project id must be a positive integer" };
@@ -25710,6 +25757,54 @@ function parseAmount(value, flag) {
25710
25757
  return { error: `Invalid ${flag}: ${err instanceof Error ? err.message : String(err)}` };
25711
25758
  }
25712
25759
  }
25760
+ function positiveNumber2(value, flag) {
25761
+ const parsed = Number(value);
25762
+ if (!Number.isFinite(parsed) || parsed <= 0)
25763
+ return { error: `${flag} must be a positive number` };
25764
+ return parsed;
25765
+ }
25766
+ function parseTags(value) {
25767
+ return value ? value.split(",").map((tag) => tag.trim()).filter(Boolean) : [];
25768
+ }
25769
+ function evaluatorTerms(opts) {
25770
+ const template = {};
25771
+ const evaluatorOnly = [
25772
+ ["--evaluator-fee-bps", opts.evaluatorFeeBps],
25773
+ ["--evaluator-stake", opts.evaluatorStake],
25774
+ ["--evaluation-window", opts.evaluationWindow],
25775
+ ["--appeal-window", opts.appealWindow]
25776
+ ];
25777
+ if (opts.evaluator === void 0) {
25778
+ const stray = evaluatorOnly.find(([, value]) => value !== void 0);
25779
+ if (stray) return { error: `${stray[0]} needs --evaluator` };
25780
+ } else {
25781
+ if (!ADDRESS.test(opts.evaluator)) {
25782
+ return { error: "--evaluator must be a wallet address (0x + 40 hex chars)" };
25783
+ }
25784
+ template.evaluator = opts.evaluator;
25785
+ if (opts.evaluatorFeeBps !== void 0) {
25786
+ if (!/^\d+$/.test(opts.evaluatorFeeBps) || Number(opts.evaluatorFeeBps) > 1e4) {
25787
+ return { error: "--evaluator-fee-bps must be an integer from 0 to 10000" };
25788
+ }
25789
+ template.evaluatorFeeBps = Number(opts.evaluatorFeeBps);
25790
+ }
25791
+ if (opts.evaluatorStake !== void 0) {
25792
+ const stake = parseAmount(opts.evaluatorStake, "--evaluator-stake");
25793
+ if (typeof stake !== "string") return stake;
25794
+ template.evaluatorStake = stake;
25795
+ }
25796
+ for (const [flag, value, field] of [
25797
+ ["--evaluation-window", opts.evaluationWindow, "evaluationWindowHours"],
25798
+ ["--appeal-window", opts.appealWindow, "appealWindowHours"]
25799
+ ]) {
25800
+ if (value === void 0) continue;
25801
+ const hours = positiveNumber2(value, flag);
25802
+ if (typeof hours !== "number") return hours;
25803
+ template[field] = hours;
25804
+ }
25805
+ }
25806
+ return template;
25807
+ }
25713
25808
 
25714
25809
  // src/commands/project/write.ts
25715
25810
  async function postProjectWrite(path9, body, options) {
@@ -25758,330 +25853,81 @@ var projectAcceptCommand = new Command127("accept").description(
25758
25853
  });
25759
25854
 
25760
25855
  // src/commands/project/add-task.ts
25761
- import { Command as Command129 } from "commander";
25762
-
25763
- // src/commands/project/suggestions.ts
25764
25856
  import { Command as Command128 } from "commander";
25765
- function parseSuggestionId(value) {
25766
- const parsed = ProjectSuggestionIdSchema.safeParse(value.trim());
25767
- return parsed.success ? parsed.data.toLowerCase() : { error: "The suggestion id must be a UUID" };
25768
- }
25769
- function parseSuggestionsSetting(value) {
25770
- const trimmed = value.trim();
25771
- return PROJECT_SUGGESTIONS_SETTINGS.includes(trimmed) ? trimmed : { error: `--suggestions must be ${PROJECT_SUGGESTIONS_SETTINGS.join(", ")}` };
25772
- }
25773
- function parseSuggestionsMinBacking(value, options = {}) {
25774
- const trimmed = value.trim();
25775
- if (options.allowDefault && trimmed === "default") return null;
25776
- try {
25777
- return usdcToBaseUnits(trimmed, { allowZero: true });
25778
- } catch (err) {
25779
- return {
25780
- error: `Invalid --suggestions-min-backing: ${err instanceof Error ? err.message : String(err)}${options.allowDefault ? ", or default" : ""}`
25781
- };
25782
- }
25783
- }
25784
- function suggestBody(projectId, opts) {
25785
- if (opts.title === void 0) return { error: "--title is required" };
25786
- if (opts.brief === void 0) return { error: "--brief is required" };
25787
- const title = ProjectSuggestionTitleSchema.safeParse(opts.title);
25788
- if (!title.success) return { error: `--title: ${title.error.issues[0].message}` };
25789
- const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
25790
- if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
25791
- const body = { projectId, title: title.data, brief: brief.data };
25792
- if (opts.mode !== void 0) {
25793
- const mode = opts.mode.trim();
25794
- if (!GRANT_MODE_NAMES.includes(mode)) {
25795
- return { error: `--mode must be ${GRANT_MODE_NAMES.join(", ")}` };
25857
+ function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
25858
+ if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
25859
+ const endsAt = new Date(project.endsAt);
25860
+ if (Number.isNaN(endsAt.getTime())) return null;
25861
+ const deadline = new Date(now.getTime() + durationHours * 3600 * 1e3);
25862
+ if (deadline.getTime() <= endsAt.getTime()) return null;
25863
+ const grace = project.taskGraceSecs;
25864
+ if (typeof grace === "number") {
25865
+ const latest = new Date(endsAt.getTime() + grace * 1e3);
25866
+ if (deadline.getTime() > latest.getTime()) {
25867
+ return {
25868
+ error: `This task's deadline (${deadline.toISOString()}) is past the project's end date plus its task grace period (${latest.toISOString()}); shorten --duration`
25869
+ };
25796
25870
  }
25797
- body.mode = mode;
25798
- }
25799
- if (opts.reward !== void 0) {
25800
- const reward = parseAmount(opts.reward, "--reward");
25801
- if (typeof reward !== "string") return reward;
25802
- body.reward = reward;
25803
25871
  }
25804
- return body;
25872
+ const warning = cliWarning(
25873
+ "project_deadline_after_end",
25874
+ "This task's deadline is after the project's end date, within its task grace period. The task still runs to its own deadline; the project funds no new tasks after its end, and backers claim what is left once its last task ends.",
25875
+ {
25876
+ taskDeadline: deadline.toISOString(),
25877
+ projectEndsAt: endsAt.toISOString(),
25878
+ ...typeof grace === "number" ? { taskGraceSecs: grace } : {}
25879
+ }
25880
+ );
25881
+ return { warning };
25805
25882
  }
25806
- function suggestionsQuery(opts) {
25807
- const params = new URLSearchParams();
25808
- if (opts.status !== void 0) {
25809
- const status = opts.status.trim();
25810
- if (!PROJECT_SUGGESTION_STATUSES.includes(status)) {
25811
- return { error: `--status must be ${PROJECT_SUGGESTION_STATUSES.join(", ")}` };
25883
+ var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
25884
+ var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
25885
+ var INPUTS_MAX = 20;
25886
+ function parseContinuation(flags) {
25887
+ const inputs = flags.input ?? [];
25888
+ if (flags.parent === void 0) {
25889
+ if (inputs.length > 0 || flags.shareInputs) {
25890
+ return { error: "--input and --share-inputs need --parent <taskId>" };
25812
25891
  }
25813
- params.set("status", status);
25892
+ return { continuation: null };
25814
25893
  }
25815
- if (opts.sort !== void 0) {
25816
- const sort = opts.sort.trim();
25817
- if (!PROJECT_SUGGESTION_SORTS.includes(sort)) {
25818
- return { error: `--sort must be ${PROJECT_SUGGESTION_SORTS.join(" or ")}` };
25819
- }
25820
- params.set("sort", sort);
25894
+ const parentTaskId = flags.parent.trim();
25895
+ if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
25896
+ const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
25897
+ if (bad !== void 0) {
25898
+ return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
25821
25899
  }
25822
- if (opts.limit !== void 0) {
25823
- const limit = opts.limit.trim();
25824
- if (!/^[1-9][0-9]*$/.test(limit) || Number(limit) > PROJECT_SUGGESTIONS_LIST_MAX) {
25825
- return { error: `--limit must be an integer from 1 to ${PROJECT_SUGGESTIONS_LIST_MAX}` };
25826
- }
25827
- params.set("limit", limit);
25900
+ const artifacts = [
25901
+ ...new Set(inputs.map((hash) => hash.trim().replace(/^0x/i, "").toLowerCase()))
25902
+ ];
25903
+ if (artifacts.length > INPUTS_MAX) {
25904
+ return { error: `At most ${INPUTS_MAX} --input files` };
25828
25905
  }
25829
- if (opts.cursor !== void 0) {
25830
- const cursor = opts.cursor.trim();
25831
- if (cursor.length === 0 || cursor.length > 512) {
25832
- return { error: "--cursor must be the previous page's nextCursor" };
25906
+ const shared = flags.shareInputs === true;
25907
+ if (artifacts.length === 0 && !shared) return { continuation: { parentTaskId } };
25908
+ return {
25909
+ continuation: {
25910
+ parentTaskId,
25911
+ inputs: { ...artifacts.length > 0 ? { artifacts } : {}, shared }
25833
25912
  }
25834
- params.set("cursor", cursor);
25835
- }
25836
- return params.toString();
25913
+ };
25837
25914
  }
25838
- function suggestionSettingsBody(projectId, opts) {
25839
- if (opts.suggestions === void 0 && opts.hostedOperators === void 0 && opts.suggestionsMinBacking === void 0) {
25840
- return null;
25841
- }
25842
- const body = { projectId };
25843
- if (opts.suggestions !== void 0) {
25844
- const setting = parseSuggestionsSetting(opts.suggestions);
25845
- if (typeof setting !== "string") return setting;
25846
- body.suggestions = setting;
25847
- }
25848
- if (opts.hostedOperators !== void 0) {
25849
- const value = opts.hostedOperators.trim();
25850
- if (value !== "on" && value !== "off") return { error: "--hosted-operators must be on or off" };
25851
- body.hostedOperators = value === "on";
25852
- }
25853
- if (opts.suggestionsMinBacking !== void 0) {
25854
- const min = parseSuggestionsMinBacking(opts.suggestionsMinBacking, { allowDefault: true });
25855
- if (min !== null && typeof min === "object") return min;
25856
- body.minBacking = min;
25857
- }
25858
- return body;
25915
+ function collect5(value, previous = []) {
25916
+ return [...previous, value];
25859
25917
  }
25860
- async function signedRead(path9) {
25861
- try {
25862
- const headers = (await signReadAuth())?.headers ?? {};
25863
- printResult(await apiGet(withChainId(path9), { headers }));
25864
- } catch (err) {
25865
- renderFailure(err);
25866
- }
25918
+ var projectAddTaskCommand = new Command128("add-task").description(
25919
+ "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)"
25920
+ ).argument("<projectId>", "Project id");
25921
+ for (const option of createCmd.options) {
25922
+ projectAddTaskCommand.addOption(option);
25867
25923
  }
25868
- var projectSuggestCommand = new Command128("suggest").description(
25869
- "Post a suggestion on an open project: an idea for work its budget could pay for, as a wallet the project's suggestions setting admits (backers: the owner, its operators and backers; anyone: any wallet). Posting costs 0.001 in the payment token. The owner or an operator turns it into a task with `project add-task --suggestion <id>`, and anyone it admits may upvote it for free"
25870
- ).argument("<projectId>", "Project id").option("--title <text>", "Required: one line, 1 to 120 characters").option(
25871
- "--brief <text>",
25872
- "Required: what the work is and what done looks like, plain text, up to 4000 characters"
25924
+ projectAddTaskCommand.option(
25925
+ "--parent <taskId>",
25926
+ "Continue this task, a task in the same project (accepted or not); its worker can read the inputs"
25873
25927
  ).option(
25874
- "--mode <mode>",
25875
- `The task mode you suggest (${GRANT_MODE_NAMES.join(", ")}); the owner or operator decides`
25876
- ).option(
25877
- "--reward <amount>",
25878
- "The reward you suggest, in the payment token (e.g. 5); the owner or operator decides"
25879
- ).action(async (id, opts) => {
25880
- const projectId = parseProjectId(id);
25881
- if (typeof projectId !== "number") return void printError(projectId.error);
25882
- const body = suggestBody(projectId, opts);
25883
- if ("error" in body) return void printError(String(body.error));
25884
- await postProjectWrite(`/api/projects/${projectId}/suggestions`, body, {
25885
- maxAmount: ACTION_FEE_MAX_AMOUNT
25886
- });
25887
- });
25888
- var projectSuggestionsCommand = new Command128("suggestions").description(
25889
- "List a project's suggestions with its suggestions settings, most upvoted first or, with --sort backed, most pool shares among the voters who back the project first. Each carries votes, backedShares and, when your wallet signs the read, whether you voted (free)"
25890
- ).argument("<projectId>", "Project id").option(
25891
- "--status <status>",
25892
- `Only suggestions in this status: ${PROJECT_SUGGESTION_STATUSES.join(", ")}`
25893
- ).option("--sort <sort>", "votes (default) or backed").option(
25894
- "--limit <count>",
25895
- `Suggestions per page (1-${PROJECT_SUGGESTIONS_LIST_MAX}, default ${PROJECT_SUGGESTIONS_LIST_DEFAULT})`
25896
- ).option(
25897
- "--cursor <cursor>",
25898
- "The next page: the previous page's nextCursor, with the same --status and --sort"
25899
- ).action(async (id, opts) => {
25900
- const projectId = parseProjectId(id);
25901
- if (typeof projectId !== "number") return void printError(projectId.error);
25902
- const query4 = suggestionsQuery(opts);
25903
- if (typeof query4 !== "string") return void printError(query4.error);
25904
- await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
25905
- });
25906
- var showCommand3 = new Command128("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
25907
- const id = parseSuggestionId(value);
25908
- if (typeof id !== "string") return void printError(id.error);
25909
- await signedRead(`/api/project-suggestions/${id}`);
25910
- });
25911
- function voteCommand(action, description) {
25912
- return new Command128(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
25913
- const suggestionId = parseSuggestionId(value);
25914
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25915
- const auth = await signReadAuth();
25916
- if (auth && Object.keys(auth.headers).length === 0) {
25917
- return void printError(`Could not sign with your wallet: ${auth.error ?? "unknown error"}`);
25918
- }
25919
- if (!auth) {
25920
- return void printError(
25921
- `${action === "vote" ? "Voting" : "Taking back a vote"} needs a wallet. Run \`taskmarket init\` first.`
25922
- );
25923
- }
25924
- try {
25925
- const chainId = selectedNetwork().chainId;
25926
- const proof = await signWalletWrite("project-suggestion-vote", {
25927
- action,
25928
- chainId,
25929
- suggestionId
25930
- });
25931
- const { data, idempotencyKey } = await apiPost(
25932
- `/api/project-suggestions/${suggestionId}/${action}`,
25933
- { chainId, suggestionId, ...proof },
25934
- { headers: auth.headers }
25935
- );
25936
- printResult(data, { idempotencyKey });
25937
- } catch (err) {
25938
- renderFailure(err);
25939
- }
25940
- });
25941
- }
25942
- var withdrawCommand2 = new Command128("withdraw").description("Withdraw your open suggestion, as its author (costs 0.001 in the payment token)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
25943
- const suggestionId = parseSuggestionId(value);
25944
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25945
- await postProjectWrite(
25946
- `/api/project-suggestions/${suggestionId}/withdraw`,
25947
- { suggestionId },
25948
- { maxAmount: ACTION_FEE_MAX_AMOUNT }
25949
- );
25950
- });
25951
- var declineCommand = new Command128("decline").description(
25952
- "Decline an open suggestion, as the project's owner or an operator with an accepted grant; the reason is shown to everyone. Declining costs 0.001 in the payment token. To accept one instead, create its task with `project add-task <projectId> --suggestion <id>`, which pays the task's reward and any evaluator stake from the budget, plus the 0.001 action fee"
25953
- ).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
25954
- const suggestionId = parseSuggestionId(value);
25955
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25956
- const parsed = ProjectSuggestionDeclineSchema.safeParse({ suggestionId, reason: opts.reason });
25957
- if (!parsed.success) {
25958
- return void printError(`--reason: ${parsed.error.issues[0].message}`);
25959
- }
25960
- await postProjectWrite(
25961
- `/api/project-suggestions/${suggestionId}/decline`,
25962
- { suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
25963
- { maxAmount: ACTION_FEE_MAX_AMOUNT }
25964
- );
25965
- });
25966
- var projectSuggestionCommand = new Command128("suggestion").description(
25967
- "One project suggestion: show it, upvote it or take the upvote back (free, signed by your wallet), withdraw it as its author, or decline it as the owner or an operator"
25968
- ).addCommand(showCommand3).addCommand(
25969
- voteCommand(
25970
- "vote",
25971
- "Upvote a suggestion, as a wallet that may suggest on its project; one vote per wallet (free, signed by your wallet)"
25972
- )
25973
- ).addCommand(
25974
- voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
25975
- ).addCommand(withdrawCommand2).addCommand(declineCommand);
25976
- var projectSuggestionSettingsCommand = new Command128("suggestion-settings").description(
25977
- "Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone), the least a wallet must have contributed to count as a backer for them (1 in the payment token by default), and whether hosted agents that operate the project accept and decline suggestions by themselves (on by default). Turning hosted operators off keeps their grants. Setting costs 0.001 in the payment token; reading is free"
25978
- ).argument("<projectId>", "Project id").option(
25979
- "--suggestions <setting>",
25980
- "off (no one), backers (the owner, operators and backers) or anyone (any wallet)"
25981
- ).option(
25982
- "--suggestions-min-backing <amount>",
25983
- "Under backers, the least a wallet must have contributed to the project's pool to post and upvote, in the payment token (e.g. 5); 0 admits any contribution, default returns to the default of 1"
25984
- ).option(
25985
- "--hosted-operators <on|off>",
25986
- "Whether hosted operators act on suggestions by themselves"
25987
- ).action(async (id, opts) => {
25988
- const projectId = parseProjectId(id);
25989
- if (typeof projectId !== "number") return void printError(projectId.error);
25990
- const body = suggestionSettingsBody(projectId, opts);
25991
- if (body === null) {
25992
- try {
25993
- const view = await apiGet(withChainId(`/api/projects/${projectId}`));
25994
- printResult({
25995
- chainId: view.project?.chainId,
25996
- projectId: view.project?.projectId ?? projectId,
25997
- suggestions: view.suggestions ?? null
25998
- });
25999
- } catch (err) {
26000
- renderFailure(err);
26001
- }
26002
- return;
26003
- }
26004
- if ("error" in body) return void printError(String(body.error));
26005
- await postProjectWrite(`/api/projects/${projectId}/suggestions/settings`, body, {
26006
- maxAmount: ACTION_FEE_MAX_AMOUNT
26007
- });
26008
- });
26009
-
26010
- // src/commands/project/add-task.ts
26011
- function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
26012
- if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
26013
- const endsAt = new Date(project.endsAt);
26014
- if (Number.isNaN(endsAt.getTime())) return null;
26015
- const deadline = new Date(now.getTime() + durationHours * 3600 * 1e3);
26016
- if (deadline.getTime() <= endsAt.getTime()) return null;
26017
- const grace = project.taskGraceSecs;
26018
- if (typeof grace === "number") {
26019
- const latest = new Date(endsAt.getTime() + grace * 1e3);
26020
- if (deadline.getTime() > latest.getTime()) {
26021
- return {
26022
- error: `This task's deadline (${deadline.toISOString()}) is past the project's end date plus its task grace period (${latest.toISOString()}); shorten --duration`
26023
- };
26024
- }
26025
- }
26026
- const warning = cliWarning(
26027
- "project_deadline_after_end",
26028
- "This task's deadline is after the project's end date, within its task grace period. The task still runs to its own deadline; the project funds no new tasks after its end, and backers claim what is left once its last task ends.",
26029
- {
26030
- taskDeadline: deadline.toISOString(),
26031
- projectEndsAt: endsAt.toISOString(),
26032
- ...typeof grace === "number" ? { taskGraceSecs: grace } : {}
26033
- }
26034
- );
26035
- return { warning };
26036
- }
26037
- var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
26038
- var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
26039
- var INPUTS_MAX = 20;
26040
- function parseContinuation(flags) {
26041
- const inputs = flags.input ?? [];
26042
- if (flags.parent === void 0) {
26043
- if (inputs.length > 0 || flags.shareInputs) {
26044
- return { error: "--input and --share-inputs need --parent <taskId>" };
26045
- }
26046
- return { continuation: null };
26047
- }
26048
- const parentTaskId = flags.parent.trim();
26049
- if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
26050
- const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
26051
- if (bad !== void 0) {
26052
- return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
26053
- }
26054
- const artifacts = [
26055
- ...new Set(inputs.map((hash) => hash.trim().replace(/^0x/i, "").toLowerCase()))
26056
- ];
26057
- if (artifacts.length > INPUTS_MAX) {
26058
- return { error: `At most ${INPUTS_MAX} --input files` };
26059
- }
26060
- const shared = flags.shareInputs === true;
26061
- if (artifacts.length === 0 && !shared) return { continuation: { parentTaskId } };
26062
- return {
26063
- continuation: {
26064
- parentTaskId,
26065
- inputs: { ...artifacts.length > 0 ? { artifacts } : {}, shared }
26066
- }
26067
- };
26068
- }
26069
- function collect5(value, previous = []) {
26070
- return [...previous, value];
26071
- }
26072
- var projectAddTaskCommand = new Command129("add-task").description(
26073
- "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)"
26074
- ).argument("<projectId>", "Project id");
26075
- for (const option of createCmd.options) {
26076
- projectAddTaskCommand.addOption(option);
26077
- }
26078
- projectAddTaskCommand.option(
26079
- "--parent <taskId>",
26080
- "Continue this task, a task in the same project (accepted or not); its worker can read the inputs"
26081
- ).option(
26082
- "--input <sha256>",
26083
- "A file of the parent's accepted submissions, by SHA-256, as an input; repeat for more (default: the winning accepted submission's files)",
26084
- collect5
25928
+ "--input <sha256>",
25929
+ "A file of the parent's accepted submissions, by SHA-256, as an input; repeat for more (default: the winning accepted submission's files)",
25930
+ collect5
26085
25931
  ).option(
26086
25932
  "--share-inputs",
26087
25933
  "As the project's owner, share the input files of a parent that hides them (private, or submission visibility other than public) with this task's worker"
@@ -26121,7 +25967,7 @@ projectAddTaskCommand.action(async (id, opts) => {
26121
25967
  });
26122
25968
 
26123
25969
  // src/commands/project/automations.ts
26124
- import { Command as Command130 } from "commander";
25970
+ import { Command as Command129 } from "commander";
26125
25971
  function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26126
25972
  if (opts.cap === void 0) {
26127
25973
  return { error: "--cap is required: the most the automations may draw from the budget" };
@@ -26150,7 +25996,7 @@ function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26150
25996
  }
26151
25997
  return body;
26152
25998
  }
26153
- var projectAutomationsOnCommand = new Command130("on").description(
25999
+ var projectAutomationsOnCommand = new Command129("on").description(
26154
26000
  "Turn the project's automations on, so its schedules and workflows run. Grants the platform runner of the project's chain, which you never name, with a cap: the most the automations may draw from the budget in total, net of refunds (payouts keep counting). The cap is required. On a project whose automations are on, a higher cap raises it and a lower one is refused; turning them on again after off, or raising the cap, needs a chain on contract revision 29 and is refused before payment otherwise. Optional limits (contract revision 29): --expires, and --period-budget with --period; on states them whole, so none stated clears an expiry and a period budget. Schedules paused by off stay paused: resume each one (costs 0.001 in the payment token)"
26155
26001
  ).argument("<projectId>", "Project id").option(
26156
26002
  "--cap <amount>",
@@ -26178,7 +26024,7 @@ var projectAutomationsOnCommand = new Command130("on").description(
26178
26024
  });
26179
26025
  }
26180
26026
  );
26181
- var projectAutomationsOffCommand = new Command130("off").description(
26027
+ var projectAutomationsOffCommand = new Command129("off").description(
26182
26028
  "Turn the project's automations off: revokes the platform runner's grant and pauses the project's schedules and workflow schedules (reason automations_off). Their definitions stay, tasks already started finish under you, and turning automations on again does not resume them (costs 0.001 in the payment token)"
26183
26029
  ).argument("<projectId>", "Project id").action(async (id) => {
26184
26030
  const projectId = parseProjectId(id);
@@ -26189,59 +26035,452 @@ var projectAutomationsOffCommand = new Command130("off").description(
26189
26035
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26190
26036
  );
26191
26037
  });
26192
- var projectAutomationsStatusCommand = new Command130("status").description(
26038
+ var projectAutomationsStatusCommand = new Command129("status").description(
26193
26039
  "Whether the project's schedules and workflows can run: state on, off, pending (granted, the runner has not accepted yet) or unavailable (no runner on the chain), with the cap, what is spent and what remains, and whether it can be turned on again or its cap raised (free)"
26194
26040
  ).argument("<projectId>", "Project id").action(async (id) => {
26195
26041
  const projectId = parseProjectId(id);
26196
26042
  if (typeof projectId !== "number") return void printError(projectId.error);
26197
26043
  try {
26198
- printResult(await apiGet(withChainId(`/api/projects/${projectId}/automations`)));
26044
+ printResult(await apiGet(withChainId(`/api/projects/${projectId}/automations`)));
26045
+ } catch (err) {
26046
+ renderFailure(err);
26047
+ }
26048
+ });
26049
+ var projectAutomationsCommand = new Command129("automations").description(
26050
+ "The project's automations: one switch for its schedules and workflows. `on --cap <amount>` grants the platform runner of the project chain for you, `off` revokes it and pauses schedules, `status` reads it. `project runner` and `project grant` remain for advanced use"
26051
+ ).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
26052
+
26053
+ // src/commands/project/claim.ts
26054
+ import { Command as Command130 } from "commander";
26055
+ var projectClaimCommand = new Command130("claim").description(
26056
+ "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)"
26057
+ ).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
26058
+ const projectId = parseProjectId(id);
26059
+ if (typeof projectId !== "number") return void printError(projectId.error);
26060
+ const backer = opts.backer?.trim();
26061
+ if (backer !== void 0 && (!ADDRESS.test(backer) || /^0x0{40}$/i.test(backer))) {
26062
+ return void printError("Invalid Ethereum address for --backer");
26063
+ }
26064
+ await postProjectWrite(
26065
+ `/api/projects/${projectId}/claim`,
26066
+ {
26067
+ projectId,
26068
+ ...backer ? { backer } : {}
26069
+ },
26070
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26071
+ );
26072
+ });
26073
+
26074
+ // src/commands/project/close.ts
26075
+ import { Command as Command131 } from "commander";
26076
+ var projectCloseCommand = new Command131("close").description(
26077
+ "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)"
26078
+ ).argument("<projectId>", "Project id").action(async (id) => {
26079
+ const projectId = parseProjectId(id);
26080
+ if (typeof projectId !== "number") return void printError(projectId.error);
26081
+ await postProjectWrite(
26082
+ `/api/projects/${projectId}/close`,
26083
+ { projectId },
26084
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26085
+ );
26086
+ });
26087
+
26088
+ // src/commands/project/create.ts
26089
+ import { Command as Command134 } from "commander";
26090
+
26091
+ // src/commands/project/suggestions.ts
26092
+ import { Command as Command133 } from "commander";
26093
+
26094
+ // src/commands/project/suggestion-proposals.ts
26095
+ import { Command as Command132 } from "commander";
26096
+ var QUERY_ERRORS = {
26097
+ status: "--status must be pending, closed or expired",
26098
+ limit: "--limit must be an integer from 1 to 50",
26099
+ cursor: "--cursor must be the previous page's nextCursor"
26100
+ };
26101
+ function proposalsQuery(projectId, opts) {
26102
+ const query4 = {
26103
+ status: opts.status?.trim(),
26104
+ limit: opts.limit === void 0 ? void 0 : Number(opts.limit.trim() || Number.NaN),
26105
+ cursor: opts.cursor?.trim()
26106
+ };
26107
+ const parsed = SuggestionProposalsListInputSchema.safeParse({ projectId, ...query4 });
26108
+ if (!parsed.success) {
26109
+ const issue = parsed.error.issues[0];
26110
+ return { error: QUERY_ERRORS[String(issue.path[0])] ?? issue.message };
26111
+ }
26112
+ const params = new URLSearchParams();
26113
+ for (const [key, value] of Object.entries(query4)) {
26114
+ if (value !== void 0) params.set(key, String(value));
26115
+ }
26116
+ return params.toString();
26117
+ }
26118
+ function proposalDecisionBody(proposalId, suggestions) {
26119
+ const id = parseProposalId(proposalId);
26120
+ if (typeof id !== "string") return id;
26121
+ const body = { proposalId: id };
26122
+ if (suggestions.length > 0) {
26123
+ const ids = [];
26124
+ for (const value of suggestions) {
26125
+ const suggestionId = parseSuggestionId(value);
26126
+ if (typeof suggestionId !== "string") return { error: `--suggestion: ${suggestionId.error}` };
26127
+ ids.push(suggestionId);
26128
+ }
26129
+ body.suggestionIds = [...new Set(ids)];
26130
+ }
26131
+ const parsed = SuggestionProposalConfirmSchema.safeParse(body);
26132
+ if (!parsed.success) return { error: `--suggestion: ${parsed.error.issues[0].message}` };
26133
+ return body;
26134
+ }
26135
+ async function read(path9) {
26136
+ try {
26137
+ const headers = (await signReadAuth())?.headers ?? {};
26138
+ printResult(await apiGet(withChainId(path9), { headers }));
26139
+ } catch (err) {
26140
+ renderFailure(err);
26141
+ }
26142
+ }
26143
+ function collectSuggestion(value, previous) {
26144
+ return [...previous, value];
26145
+ }
26146
+ var projectSuggestionProposalsCommand = new Command132("proposals").description(
26147
+ "List a project's suggestion proposals, newest first: what each run of its suggestions schedule picked in propose mode, with the ranking it was picked by and each pick's rank, reward, mode and status. A pick the owner drops is not proposed again by that schedule. The reads are public; signed with your wallet when there is one, so a pick whose suggestion staff hid shows only to the project's owner and its author. A pending proposal waits for the owner to confirm or drop its picks, and expires at the schedule's next slot or after 72 hours (free)"
26148
+ ).argument("<projectId>", "Project id").option(
26149
+ "--status <status>",
26150
+ `Only proposals in this status: ${SUGGESTION_PROPOSAL_STATUSES.join(", ")}`
26151
+ ).option("--limit <count>", "Proposals per page (1-50, default 20)").option(
26152
+ "--cursor <cursor>",
26153
+ "The next page: the previous page's nextCursor, with the same --status"
26154
+ ).action(async (id, opts) => {
26155
+ const projectId = parseProjectId(id);
26156
+ if (typeof projectId !== "number") return void printError(projectId.error);
26157
+ const query4 = proposalsQuery(projectId, opts);
26158
+ if (typeof query4 !== "string") return void printError(query4.error);
26159
+ await read(`/api/projects/${projectId}/suggestion-proposals${query4 ? `?${query4}` : ""}`);
26160
+ });
26161
+ var proposalShowCommand = new Command132("show").description(
26162
+ "Show a suggestion proposal with its picks: each suggestion, its rank and score, the reward and mode its task will carry, and its status (pending, confirmed, created with its taskId, dropped, expired or failed with the reason). Public; signed with your wallet when there is one, so a hidden pick shows only to the project's owner and its author (free)"
26163
+ ).argument("<proposalId>", "Proposal id").action(async (value) => {
26164
+ const id = parseProposalId(value);
26165
+ if (typeof id !== "string") return void printError(id.error);
26166
+ await read(`/api/suggestion-proposals/${id}`);
26167
+ });
26168
+ function decisionCommand(action, description) {
26169
+ return new Command132(action).description(description).argument("<proposalId>", "Proposal id").option(
26170
+ "--suggestion <suggestionId>",
26171
+ `Only this pick; repeat it for each (default: every pending pick)`,
26172
+ collectSuggestion,
26173
+ []
26174
+ ).action(async (value, opts) => {
26175
+ const body = proposalDecisionBody(value, opts.suggestion);
26176
+ if ("error" in body) return void printError(String(body.error));
26177
+ await postProjectWrite(
26178
+ `/api/suggestion-proposals/${String(body.proposalId)}/${action}`,
26179
+ body,
26180
+ {
26181
+ maxAmount: ACTION_FEE_MAX_AMOUNT
26182
+ }
26183
+ );
26184
+ });
26185
+ }
26186
+ var projectSuggestionProposalCommand = new Command132("proposal").description(
26187
+ "One suggestion proposal, as the project's owner: show it, confirm its picks so the platform runner creates their tasks, or drop them"
26188
+ ).addCommand(proposalShowCommand).addCommand(
26189
+ decisionCommand(
26190
+ "confirm",
26191
+ "Confirm a pending proposal's picks, as the project's owner: the platform runner creates each pick's task from the budget under its grant, so it counts against the automations cap. Without --suggestion it confirms every pending pick, skipping any whose suggestion is held or hidden; picks you leave out stay pending until the proposal expires. Costs 0.001 in the payment token"
26192
+ )
26193
+ ).addCommand(
26194
+ decisionCommand(
26195
+ "drop",
26196
+ "Drop a pending proposal's picks, as the project's owner: no task is created and the suggestions stay open. Costs 0.001 in the payment token"
26197
+ )
26198
+ );
26199
+
26200
+ // src/commands/project/suggestions.ts
26201
+ function parseSuggestionsSetting(value) {
26202
+ const trimmed = value.trim();
26203
+ return PROJECT_SUGGESTIONS_SETTINGS.includes(trimmed) ? trimmed : { error: `--suggestions must be ${PROJECT_SUGGESTIONS_SETTINGS.join(", ")}` };
26204
+ }
26205
+ function parseSuggestionsMinBacking(value, options = {}) {
26206
+ const trimmed = value.trim();
26207
+ if (options.allowDefault && trimmed === "default") return null;
26208
+ try {
26209
+ return usdcToBaseUnits(trimmed, { allowZero: true });
26210
+ } catch (err) {
26211
+ return {
26212
+ error: `Invalid --suggestions-min-backing: ${err instanceof Error ? err.message : String(err)}${options.allowDefault ? ", or default" : ""}`
26213
+ };
26214
+ }
26215
+ }
26216
+ function suggestBody(projectId, opts) {
26217
+ if (opts.title === void 0) return { error: "--title is required" };
26218
+ if (opts.brief === void 0) return { error: "--brief is required" };
26219
+ const title = ProjectSuggestionTitleSchema.safeParse(opts.title);
26220
+ if (!title.success) return { error: `--title: ${title.error.issues[0].message}` };
26221
+ const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
26222
+ if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
26223
+ const body = { projectId, title: title.data, brief: brief.data };
26224
+ if (opts.mode !== void 0) {
26225
+ const mode = opts.mode.trim();
26226
+ if (!GRANT_MODE_NAMES.includes(mode)) {
26227
+ return { error: `--mode must be ${GRANT_MODE_NAMES.join(", ")}` };
26228
+ }
26229
+ body.mode = mode;
26230
+ }
26231
+ if (opts.reward !== void 0) {
26232
+ const reward = parseAmount(opts.reward, "--reward");
26233
+ if (typeof reward !== "string") return reward;
26234
+ body.reward = reward;
26235
+ }
26236
+ return body;
26237
+ }
26238
+ function suggestionsQuery(opts) {
26239
+ const params = new URLSearchParams();
26240
+ if (opts.status !== void 0) {
26241
+ const status = opts.status.trim();
26242
+ if (!PROJECT_SUGGESTION_STATUSES.includes(status)) {
26243
+ return { error: `--status must be ${PROJECT_SUGGESTION_STATUSES.join(", ")}` };
26244
+ }
26245
+ params.set("status", status);
26246
+ }
26247
+ if (opts.sort !== void 0) {
26248
+ const sort = opts.sort.trim();
26249
+ if (!PROJECT_SUGGESTION_SORTS.includes(sort)) {
26250
+ return { error: `--sort must be ${PROJECT_SUGGESTION_SORTS.join(" or ")}` };
26251
+ }
26252
+ params.set("sort", sort);
26253
+ }
26254
+ if (opts.limit !== void 0) {
26255
+ const limit = opts.limit.trim();
26256
+ if (!/^[1-9][0-9]*$/.test(limit) || Number(limit) > PROJECT_SUGGESTIONS_LIST_MAX) {
26257
+ return { error: `--limit must be an integer from 1 to ${PROJECT_SUGGESTIONS_LIST_MAX}` };
26258
+ }
26259
+ params.set("limit", limit);
26260
+ }
26261
+ if (opts.cursor !== void 0) {
26262
+ const cursor = opts.cursor.trim();
26263
+ if (cursor.length === 0 || cursor.length > 512) {
26264
+ return { error: "--cursor must be the previous page's nextCursor" };
26265
+ }
26266
+ params.set("cursor", cursor);
26267
+ }
26268
+ return params.toString();
26269
+ }
26270
+ function suggestionSettingsBody(projectId, opts) {
26271
+ if (opts.suggestions === void 0 && opts.hostedOperators === void 0 && opts.suggestionsMinBacking === void 0) {
26272
+ return null;
26273
+ }
26274
+ const body = { projectId };
26275
+ if (opts.suggestions !== void 0) {
26276
+ const setting = parseSuggestionsSetting(opts.suggestions);
26277
+ if (typeof setting !== "string") return setting;
26278
+ body.suggestions = setting;
26279
+ }
26280
+ if (opts.hostedOperators !== void 0) {
26281
+ const value = opts.hostedOperators.trim();
26282
+ if (value !== "on" && value !== "off") return { error: "--hosted-operators must be on or off" };
26283
+ body.hostedOperators = value === "on";
26284
+ }
26285
+ if (opts.suggestionsMinBacking !== void 0) {
26286
+ const min = parseSuggestionsMinBacking(opts.suggestionsMinBacking, { allowDefault: true });
26287
+ if (min !== null && typeof min === "object") return min;
26288
+ body.minBacking = min;
26289
+ }
26290
+ return body;
26291
+ }
26292
+ async function signedRead(path9) {
26293
+ try {
26294
+ const headers = (await signReadAuth())?.headers ?? {};
26295
+ printResult(await apiGet(withChainId(path9), { headers }));
26296
+ } catch (err) {
26297
+ renderFailure(err);
26298
+ }
26299
+ }
26300
+ var projectSuggestCommand = new Command133("suggest").description(
26301
+ "Post a suggestion on an open project: an idea for work its budget could pay for, as a wallet the project's suggestions setting admits (backers: the owner, its operators and backers; anyone: any wallet). Posting costs 0.001 in the payment token. The owner or an operator turns it into a task with `project add-task --suggestion <id>`, and anyone it admits may upvote it for free"
26302
+ ).argument("<projectId>", "Project id").option("--title <text>", "Required: one line, 1 to 120 characters").option(
26303
+ "--brief <text>",
26304
+ "Required: what the work is and what done looks like, plain text, up to 4000 characters"
26305
+ ).option(
26306
+ "--mode <mode>",
26307
+ `The task mode you suggest (${GRANT_MODE_NAMES.join(", ")}); the owner or operator decides`
26308
+ ).option(
26309
+ "--reward <amount>",
26310
+ "The reward you suggest, in the payment token (e.g. 5); the owner or operator decides"
26311
+ ).action(async (id, opts) => {
26312
+ const projectId = parseProjectId(id);
26313
+ if (typeof projectId !== "number") return void printError(projectId.error);
26314
+ const body = suggestBody(projectId, opts);
26315
+ if ("error" in body) return void printError(String(body.error));
26316
+ await postProjectWrite(`/api/projects/${projectId}/suggestions`, body, {
26317
+ maxAmount: ACTION_FEE_MAX_AMOUNT
26318
+ });
26319
+ });
26320
+ var projectSuggestionsCommand = new Command133("suggestions").description(
26321
+ "List a project's suggestions with its suggestions settings, most upvoted first or, with --sort backed, most pool shares among the voters who back the project first. Each carries votes, backedShares and, when your wallet signs the read, whether you voted (free)"
26322
+ ).argument("<projectId>", "Project id").option(
26323
+ "--status <status>",
26324
+ `Only suggestions in this status: ${PROJECT_SUGGESTION_STATUSES.join(", ")}`
26325
+ ).option("--sort <sort>", "votes (default) or backed").option(
26326
+ "--limit <count>",
26327
+ `Suggestions per page (1-${PROJECT_SUGGESTIONS_LIST_MAX}, default ${PROJECT_SUGGESTIONS_LIST_DEFAULT})`
26328
+ ).option(
26329
+ "--cursor <cursor>",
26330
+ "The next page: the previous page's nextCursor, with the same --status and --sort"
26331
+ ).action(async (id, opts) => {
26332
+ const projectId = parseProjectId(id);
26333
+ if (typeof projectId !== "number") return void printError(projectId.error);
26334
+ const query4 = suggestionsQuery(opts);
26335
+ if (typeof query4 !== "string") return void printError(query4.error);
26336
+ await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
26337
+ });
26338
+ var showCommand3 = new Command133("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
26339
+ const id = parseSuggestionId(value);
26340
+ if (typeof id !== "string") return void printError(id.error);
26341
+ await signedRead(`/api/project-suggestions/${id}`);
26342
+ });
26343
+ async function readAuthFor(what) {
26344
+ const auth = await signReadAuth();
26345
+ if (auth && Object.keys(auth.headers).length === 0) {
26346
+ return { error: `Could not sign with your wallet: ${auth.error ?? "unknown error"}` };
26347
+ }
26348
+ if (!auth) return { error: `${what} needs a wallet. Run \`taskmarket init\` first.` };
26349
+ return { headers: auth.headers };
26350
+ }
26351
+ function voteCommand(action, description) {
26352
+ return new Command133(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
26353
+ const suggestionId = parseSuggestionId(value);
26354
+ if (typeof suggestionId !== "string") return void printError(suggestionId.error);
26355
+ const auth = await readAuthFor(action === "vote" ? "Voting" : "Taking back a vote");
26356
+ if ("error" in auth) return void printError(auth.error);
26357
+ try {
26358
+ const chainId = selectedNetwork().chainId;
26359
+ const proof = await signWalletWrite("project-suggestion-vote", {
26360
+ action,
26361
+ chainId,
26362
+ suggestionId
26363
+ });
26364
+ const { data, idempotencyKey } = await apiPost(
26365
+ `/api/project-suggestions/${suggestionId}/${action}`,
26366
+ { chainId, suggestionId, ...proof },
26367
+ { headers: auth.headers }
26368
+ );
26369
+ printResult(data, { idempotencyKey });
26370
+ } catch (err) {
26371
+ renderFailure(err);
26372
+ }
26373
+ });
26374
+ }
26375
+ var reportCommand = new Command133("report").description(
26376
+ "Report a suggestion to Taskmarket staff, as any wallet but its author (free, signed by your wallet). Staff may hide it from the project's lists; one open report per wallet per suggestion, so a repeat returns the open one"
26377
+ ).argument("<suggestionId>", "Suggestion id").requiredOption("--reason <reason>", `Why: ${PROJECT_SUGGESTION_REPORT_REASONS.join(", ")}`).option("--note <text>", "What staff should know: up to 500 characters, read only by staff").action(async (value, opts) => {
26378
+ const suggestionId = parseSuggestionId(value);
26379
+ if (typeof suggestionId !== "string") return void printError(suggestionId.error);
26380
+ const reason = ProjectSuggestionReportReasonSchema.safeParse(opts.reason.trim());
26381
+ if (!reason.success) {
26382
+ return void printError(`--reason must be ${PROJECT_SUGGESTION_REPORT_REASONS.join(", ")}`);
26383
+ }
26384
+ let note;
26385
+ if (opts.note !== void 0) {
26386
+ const parsed = ProjectSuggestionReportNoteSchema.safeParse(opts.note);
26387
+ if (!parsed.success) return void printError(`--note: ${parsed.error.issues[0].message}`);
26388
+ note = parsed.data;
26389
+ }
26390
+ const auth = await readAuthFor("Reporting a suggestion");
26391
+ if ("error" in auth) return void printError(auth.error);
26392
+ try {
26393
+ const chainId = selectedNetwork().chainId;
26394
+ const body = {
26395
+ chainId,
26396
+ suggestionId,
26397
+ reason: reason.data,
26398
+ ...note !== void 0 ? { note } : {}
26399
+ };
26400
+ const proof = await signWalletWrite("project-suggestion-report", {
26401
+ action: "report",
26402
+ ...body
26403
+ });
26404
+ const { data, idempotencyKey } = await apiPost(
26405
+ `/api/project-suggestions/${suggestionId}/report`,
26406
+ { ...body, ...proof },
26407
+ { headers: auth.headers }
26408
+ );
26409
+ printResult(data, { idempotencyKey });
26199
26410
  } catch (err) {
26200
26411
  renderFailure(err);
26201
26412
  }
26202
26413
  });
26203
- var projectAutomationsCommand = new Command130("automations").description(
26204
- "The project's automations: one switch for its schedules and workflows. `on --cap <amount>` grants the platform runner of the project chain for you, `off` revokes it and pauses schedules, `status` reads it. `project runner` and `project grant` remain for advanced use"
26205
- ).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
26206
-
26207
- // src/commands/project/claim.ts
26208
- import { Command as Command131 } from "commander";
26209
- var projectClaimCommand = new Command131("claim").description(
26210
- "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)"
26211
- ).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
26212
- const projectId = parseProjectId(id);
26213
- if (typeof projectId !== "number") return void printError(projectId.error);
26214
- const backer = opts.backer?.trim();
26215
- if (backer !== void 0 && (!ADDRESS.test(backer) || /^0x0{40}$/i.test(backer))) {
26216
- return void printError("Invalid Ethereum address for --backer");
26217
- }
26414
+ var withdrawCommand2 = new Command133("withdraw").description("Withdraw your open suggestion, as its author (costs 0.001 in the payment token)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
26415
+ const suggestionId = parseSuggestionId(value);
26416
+ if (typeof suggestionId !== "string") return void printError(suggestionId.error);
26218
26417
  await postProjectWrite(
26219
- `/api/projects/${projectId}/claim`,
26220
- {
26221
- projectId,
26222
- ...backer ? { backer } : {}
26223
- },
26418
+ `/api/project-suggestions/${suggestionId}/withdraw`,
26419
+ { suggestionId },
26224
26420
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26225
26421
  );
26226
26422
  });
26227
-
26228
- // src/commands/project/close.ts
26229
- import { Command as Command132 } from "commander";
26230
- var projectCloseCommand = new Command132("close").description(
26231
- "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)"
26232
- ).argument("<projectId>", "Project id").action(async (id) => {
26233
- const projectId = parseProjectId(id);
26234
- if (typeof projectId !== "number") return void printError(projectId.error);
26423
+ var declineCommand = new Command133("decline").description(
26424
+ "Decline an open suggestion, as the project's owner or an operator with an accepted grant; the reason is shown to everyone. Declining costs 0.001 in the payment token. To accept one instead, create its task with `project add-task <projectId> --suggestion <id>`, which pays the task's reward and any evaluator stake from the budget, plus the 0.001 action fee"
26425
+ ).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
26426
+ const suggestionId = parseSuggestionId(value);
26427
+ if (typeof suggestionId !== "string") return void printError(suggestionId.error);
26428
+ const parsed = ProjectSuggestionDeclineSchema.safeParse({ suggestionId, reason: opts.reason });
26429
+ if (!parsed.success) {
26430
+ return void printError(`--reason: ${parsed.error.issues[0].message}`);
26431
+ }
26235
26432
  await postProjectWrite(
26236
- `/api/projects/${projectId}/close`,
26237
- { projectId },
26433
+ `/api/project-suggestions/${suggestionId}/decline`,
26434
+ { suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
26238
26435
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26239
26436
  );
26240
26437
  });
26438
+ var projectSuggestionCommand = new Command133("suggestion").description(
26439
+ "One project suggestion: show it, upvote it or take the upvote back, report it to staff (each free, signed by your wallet), withdraw it as its author, or decline it as the owner or an operator. `proposals` and `proposal` read and act on what the project's suggestions schedule proposes"
26440
+ ).addCommand(showCommand3).addCommand(
26441
+ voteCommand(
26442
+ "vote",
26443
+ "Upvote a suggestion, as a wallet that may suggest on its project; one vote per wallet (free, signed by your wallet)"
26444
+ )
26445
+ ).addCommand(
26446
+ voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
26447
+ ).addCommand(reportCommand).addCommand(withdrawCommand2).addCommand(declineCommand).addCommand(projectSuggestionProposalsCommand).addCommand(projectSuggestionProposalCommand);
26448
+ var projectSuggestionSettingsCommand = new Command133("suggestion-settings").description(
26449
+ "Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone), the least a wallet must have contributed to count as a backer for them (1 in the payment token by default), and whether hosted agents that operate the project accept and decline suggestions by themselves (on by default). Turning hosted operators off keeps their grants. Setting costs 0.001 in the payment token; reading is free"
26450
+ ).argument("<projectId>", "Project id").option(
26451
+ "--suggestions <setting>",
26452
+ "off (no one), backers (the owner, operators and backers) or anyone (any wallet)"
26453
+ ).option(
26454
+ "--suggestions-min-backing <amount>",
26455
+ "Under backers, the least a wallet must have contributed to the project's pool to post and upvote, in the payment token (e.g. 5); 0 admits any contribution, default returns to the default of 1"
26456
+ ).option(
26457
+ "--hosted-operators <on|off>",
26458
+ "Whether hosted operators act on suggestions by themselves"
26459
+ ).action(async (id, opts) => {
26460
+ const projectId = parseProjectId(id);
26461
+ if (typeof projectId !== "number") return void printError(projectId.error);
26462
+ const body = suggestionSettingsBody(projectId, opts);
26463
+ if (body === null) {
26464
+ try {
26465
+ const view = await apiGet(withChainId(`/api/projects/${projectId}`));
26466
+ printResult({
26467
+ chainId: view.project?.chainId,
26468
+ projectId: view.project?.projectId ?? projectId,
26469
+ suggestions: view.suggestions ?? null
26470
+ });
26471
+ } catch (err) {
26472
+ renderFailure(err);
26473
+ }
26474
+ return;
26475
+ }
26476
+ if ("error" in body) return void printError(String(body.error));
26477
+ await postProjectWrite(`/api/projects/${projectId}/suggestions/settings`, body, {
26478
+ maxAmount: ACTION_FEE_MAX_AMOUNT
26479
+ });
26480
+ });
26241
26481
 
26242
26482
  // src/commands/project/create.ts
26243
- import { Command as Command133 } from "commander";
26244
- var projectCreateCommand = new Command133("create").description(
26483
+ var projectCreateCommand = new Command134("create").description(
26245
26484
  "Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
26246
26485
  ).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
26247
26486
  "--ends-at <time>",
@@ -26290,9 +26529,9 @@ var projectCreateCommand = new Command133("create").description(
26290
26529
  );
26291
26530
 
26292
26531
  // src/commands/project/extend.ts
26293
- import { Command as Command134 } from "commander";
26532
+ import { Command as Command135 } from "commander";
26294
26533
  var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
26295
- var projectExtendCommand = new Command134("extend").description(
26534
+ var projectExtendCommand = new Command135("extend").description(
26296
26535
  "Move an open project's end date later, as the project owner (costs 0.001 in the payment token). The new date must be later than the current one and at most 365 days from now. A closed project, or one past its end date, cannot be extended. Backers' shares and the pool's value do not change; a backer whose pot is still open claims at the new date"
26297
26536
  ).argument("<projectId>", "Project id").requiredOption("--ends <time>", "The new end date: ISO 8601 or a duration from now such as 90d").action(async (id, opts) => {
26298
26537
  const projectId = parseProjectId(id);
@@ -26310,8 +26549,8 @@ var projectExtendCommand = new Command134("extend").description(
26310
26549
  });
26311
26550
 
26312
26551
  // src/commands/project/fund.ts
26313
- import { Command as Command135 } from "commander";
26314
- var projectFundCommand = new Command135("fund").description(
26552
+ import { Command as Command136 } from "commander";
26553
+ var projectFundCommand = new Command136("fund").description(
26315
26554
  "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)"
26316
26555
  ).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
26317
26556
  "--on-behalf-of <address>",
@@ -26333,7 +26572,7 @@ var projectFundCommand = new Command135("fund").description(
26333
26572
  });
26334
26573
 
26335
26574
  // src/commands/project/grant.ts
26336
- import { Command as Command136 } from "commander";
26575
+ import { Command as Command137 } from "commander";
26337
26576
  function grantBody(projectId, opts) {
26338
26577
  if (!ADDRESS.test(opts.operator)) {
26339
26578
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -26356,7 +26595,7 @@ function grantBody(projectId, opts) {
26356
26595
  revokeRemovesControl: opts.revokeRemovesControl
26357
26596
  };
26358
26597
  }
26359
- var projectGrantCommand = new Command136("grant").description(
26598
+ var projectGrantCommand = new Command137("grant").description(
26360
26599
  "Grant a wallet (an agent or a person) the right to create tasks from the project's budget under the terms below. It can spend only after it accepts, which freezes the terms; until then a new grant replaces them, and a revoked operator can be granted again, back to pending (costs 0.001 in the payment token)"
26361
26600
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
26362
26601
  "--cap <amount>",
@@ -26382,7 +26621,7 @@ var projectGrantCommand = new Command136("grant").description(
26382
26621
  });
26383
26622
 
26384
26623
  // src/commands/project/review.ts
26385
- import { Command as Command137 } from "commander";
26624
+ import { Command as Command138 } from "commander";
26386
26625
  function reviewEvaluator(opts) {
26387
26626
  if (opts.evaluator !== void 0 && opts.off) {
26388
26627
  return { error: "Pass --evaluator <address> or --off, not both" };
@@ -26397,7 +26636,7 @@ function reviewEvaluator(opts) {
26397
26636
  }
26398
26637
  return opts.evaluator;
26399
26638
  }
26400
- var projectReviewCommand = new Command137("review").description(
26639
+ var projectReviewCommand = new Command138("review").description(
26401
26640
  "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"
26402
26641
  ).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) => {
26403
26642
  const projectId = parseProjectId(id);
@@ -26439,8 +26678,8 @@ async function ownerEvaluatorWarnings(evaluator) {
26439
26678
  }
26440
26679
 
26441
26680
  // src/commands/project/raise-cap.ts
26442
- import { Command as Command138 } from "commander";
26443
- var projectRaiseCapCommand = new Command138("raise-cap").description(
26681
+ import { Command as Command139 } from "commander";
26682
+ var projectRaiseCapCommand = new Command139("raise-cap").description(
26444
26683
  "Advanced. Raise any operator's spending cap in place, as the project owner (costs 0.001 in the payment token). For the platform runner use `project automations on --cap <higher amount>`, which takes the same path. The new cap must be above the current one, which must be set; a cap is never lowered, and a revoked operator is granted again instead"
26445
26684
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to raise").requiredOption("--cap <amount>", "The new cap in the payment token, above the current cap").action(async (id, opts) => {
26446
26685
  const projectId = parseProjectId(id);
@@ -26458,8 +26697,8 @@ var projectRaiseCapCommand = new Command138("raise-cap").description(
26458
26697
  });
26459
26698
 
26460
26699
  // src/commands/project/lower-cap.ts
26461
- import { Command as Command139 } from "commander";
26462
- var projectLowerCapCommand = new Command139("lower-cap").description(
26700
+ import { Command as Command140 } from "commander";
26701
+ var projectLowerCapCommand = new Command140("lower-cap").description(
26463
26702
  "Advanced. Lower an operator's lifetime spending cap in place, as the project owner (costs 0.001 in the payment token; contract revision 29 or later). The new cap must be below the current one (any cap lowers a grant that has none) and at least what the operator already draws (committed). To raise a cap use `project raise-cap`; for the platform runner, `project automations on --cap`"
26464
26703
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
26465
26704
  "--cap <amount>",
@@ -26481,7 +26720,7 @@ var projectLowerCapCommand = new Command139("lower-cap").description(
26481
26720
  });
26482
26721
 
26483
26722
  // src/commands/project/limits.ts
26484
- import { Command as Command140 } from "commander";
26723
+ import { Command as Command141 } from "commander";
26485
26724
  function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26486
26725
  if (!ADDRESS.test(opts.operator)) {
26487
26726
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -26521,7 +26760,7 @@ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26521
26760
  }
26522
26761
  return body;
26523
26762
  }
26524
- var projectLimitsCommand = new Command140("limits").description(
26763
+ var projectLimitsCommand = new Command141("limits").description(
26525
26764
  "Advanced. Set all of an operator's limits as the project owner, stated whole: a flag you leave out is no limit of that kind (costs 0.001 in the payment token; contract revision 29 or later). The limits bound the operator on top of its cap: an expiry, the task modes it may create, the most one task may hold, and a budget per week or month. For the platform runner, `project automations on` takes --expires, --period-budget and --period"
26526
26765
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
26527
26766
  "--expires <time>",
@@ -26543,8 +26782,8 @@ var projectLimitsCommand = new Command140("limits").description(
26543
26782
  });
26544
26783
 
26545
26784
  // src/commands/project/revoke.ts
26546
- import { Command as Command141 } from "commander";
26547
- var projectRevokeCommand = new Command141("revoke").description(
26785
+ import { Command as Command142 } from "commander";
26786
+ var projectRevokeCommand = new Command142("revoke").description(
26548
26787
  "End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
26549
26788
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
26550
26789
  const projectId = parseProjectId(id);
@@ -26563,7 +26802,7 @@ var projectRevokeCommand = new Command141("revoke").description(
26563
26802
  });
26564
26803
 
26565
26804
  // src/commands/project/schedule.ts
26566
- import { Command as Command143 } from "commander";
26805
+ import { Command as Command145 } from "commander";
26567
26806
 
26568
26807
  // src/lib/owner-list.ts
26569
26808
  import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
@@ -26602,10 +26841,234 @@ function ownerListQuery(owner, opts, statuses) {
26602
26841
  return params.toString();
26603
26842
  }
26604
26843
 
26844
+ // src/commands/project/suggestion-schedule.ts
26845
+ import { Command as Command143 } from "commander";
26846
+ var SUGGESTION_ONLY_FLAGS = [
26847
+ ["--rank", "rank"],
26848
+ ["--min-backed-share", "minBackedShare"],
26849
+ ["--min-votes", "minVotes"],
26850
+ ["--min-age", "minAge"],
26851
+ ["--max-tasks", "maxTasks"],
26852
+ ["--max-spend", "maxSpend"],
26853
+ ["--max-reward", "maxReward"],
26854
+ ["--decline-after", "declineAfter"],
26855
+ ["--default-mode", "defaultMode"],
26856
+ ["--email-picks", "emailPicks"]
26857
+ ];
26858
+ var TEMPLATE_FLAGS = [
26859
+ ["--duration", "duration"],
26860
+ ["--tags", "tags"],
26861
+ ["--evaluator", "evaluator"],
26862
+ ["--evaluator-fee-bps", "evaluatorFeeBps"],
26863
+ ["--evaluator-stake", "evaluatorStake"],
26864
+ ["--evaluation-window", "evaluationWindow"],
26865
+ ["--appeal-window", "appealWindow"]
26866
+ ];
26867
+ var FLAG_FOR_FIELD = {
26868
+ mode: "--mode",
26869
+ rank: "--rank",
26870
+ minBackedShare: "--min-backed-share",
26871
+ minVotes: "--min-votes",
26872
+ minAgeHours: "--min-age",
26873
+ maxTasksPerRun: "--max-tasks",
26874
+ maxSpendPerRun: "--max-spend",
26875
+ maxReward: "--max-reward",
26876
+ declineAfterDays: "--decline-after",
26877
+ defaultMode: "--default-mode",
26878
+ emailPicksWaiting: "--email-picks",
26879
+ duration: "--duration",
26880
+ tags: "--tags",
26881
+ evaluator: "--evaluator",
26882
+ evaluatorFeeBps: "--evaluator-fee-bps",
26883
+ evaluatorStake: "--evaluator-stake",
26884
+ evaluationWindowHours: "--evaluation-window",
26885
+ appealWindowHours: "--appeal-window"
26886
+ };
26887
+ function issueError(issue) {
26888
+ const field = [...issue.path].reverse().find((part) => typeof part === "string");
26889
+ const flag = field === void 0 ? void 0 : FLAG_FOR_FIELD[field];
26890
+ return { error: flag ? `${flag}: ${issue.message}` : issue.message };
26891
+ }
26892
+ function flagNumber(value) {
26893
+ const trimmed = value.trim();
26894
+ return trimmed === "" ? Number.NaN : Number(trimmed);
26895
+ }
26896
+ var EVALUATOR_FIELDS = [
26897
+ "evaluator",
26898
+ "evaluatorFeeBps",
26899
+ "evaluatorStake",
26900
+ "evaluationWindowHours",
26901
+ "appealWindowHours"
26902
+ ];
26903
+ function setsTemplate(opts) {
26904
+ return TEMPLATE_FLAGS.some(([, key]) => opts[key] !== void 0);
26905
+ }
26906
+ function pickTemplate(opts, stored) {
26907
+ if (!setsTemplate(opts)) return void 0;
26908
+ const template = { ...stored };
26909
+ if (opts.duration !== void 0) template.duration = flagNumber(opts.duration);
26910
+ if (opts.tags !== void 0) template.tags = parseTags(opts.tags);
26911
+ template.tags ??= [];
26912
+ const storedEvaluator = typeof stored?.evaluator === "string" ? stored.evaluator : void 0;
26913
+ const terms = evaluatorTerms({ ...opts, evaluator: opts.evaluator ?? storedEvaluator });
26914
+ if ("error" in terms) return terms;
26915
+ if (opts.evaluator !== void 0) for (const field of EVALUATOR_FIELDS) delete template[field];
26916
+ return { ...template, ...terms };
26917
+ }
26918
+ function settingsFields(opts, stored) {
26919
+ const body = {};
26920
+ if (opts.mode !== void 0) body.mode = opts.mode.trim();
26921
+ if (opts.rank !== void 0) body.rank = opts.rank.trim();
26922
+ if (opts.minBackedShare !== void 0) body.minBackedShare = flagNumber(opts.minBackedShare);
26923
+ if (opts.minVotes !== void 0) body.minVotes = flagNumber(opts.minVotes);
26924
+ if (opts.minAge !== void 0) body.minAgeHours = flagNumber(opts.minAge);
26925
+ if (opts.maxTasks !== void 0) body.maxTasksPerRun = flagNumber(opts.maxTasks);
26926
+ for (const [flag, value, field] of [
26927
+ ["--max-spend", opts.maxSpend, "maxSpendPerRun"],
26928
+ ["--max-reward", opts.maxReward, "maxReward"]
26929
+ ]) {
26930
+ if (value === void 0) continue;
26931
+ const amount = parseAmount(value, flag);
26932
+ if (typeof amount !== "string") return amount;
26933
+ body[field] = amount;
26934
+ }
26935
+ if (opts.declineAfter !== void 0) {
26936
+ const trimmed = opts.declineAfter.trim();
26937
+ body.declineAfterDays = trimmed === "never" ? null : flagNumber(trimmed);
26938
+ }
26939
+ if (opts.defaultMode !== void 0) body.defaultMode = opts.defaultMode.trim();
26940
+ if (opts.emailPicks !== void 0) body.emailPicksWaiting = opts.emailPicks;
26941
+ const template = pickTemplate(opts, stored);
26942
+ if (template !== void 0 && "error" in template) return template;
26943
+ if (template !== void 0) body.template = template;
26944
+ return body;
26945
+ }
26946
+ function suggestionScheduleConfig(opts) {
26947
+ for (const [flag, key] of [
26948
+ ["--max-spend", "maxSpend"],
26949
+ ["--max-reward", "maxReward"],
26950
+ ["--duration", "duration"]
26951
+ ]) {
26952
+ if (opts[key] === void 0) {
26953
+ return { error: `${flag} is required for a suggestions schedule` };
26954
+ }
26955
+ }
26956
+ const config = settingsFields(opts);
26957
+ if ("error" in config) return config;
26958
+ const parsed = SuggestionScheduleConfigSchema.safeParse(config);
26959
+ if (!parsed.success) return issueError(parsed.error.issues[0]);
26960
+ const spend = spendCoversOnePick(config);
26961
+ if (spend) return spend;
26962
+ return config;
26963
+ }
26964
+ function baseUnits(value) {
26965
+ return typeof value === "string" && /^[0-9]+$/.test(value) ? BigInt(value) : void 0;
26966
+ }
26967
+ function spendCoversOnePick(settings) {
26968
+ const spend = baseUnits(settings.maxSpendPerRun);
26969
+ const reward = baseUnits(settings.maxReward);
26970
+ if (spend === void 0 || reward === void 0) return null;
26971
+ const template = settings.template ?? {};
26972
+ const stake = baseUnits(template.evaluatorStake) ?? 0n;
26973
+ if (reward + stake <= spend) return null;
26974
+ return {
26975
+ error: stake > 0n ? "--max-reward plus --evaluator-stake must be at most --max-spend: each pick draws its reward and the stake" : "--max-reward must be at most --max-spend"
26976
+ };
26977
+ }
26978
+ function suggestionScheduleSettingsBody(scheduleId, opts, stored) {
26979
+ const id = parseScheduleId(scheduleId);
26980
+ if (typeof id !== "string") return id;
26981
+ const fields = settingsFields(opts, stored?.template);
26982
+ if ("error" in fields) return fields;
26983
+ if (Object.keys(fields).length === 0) {
26984
+ return { error: "Pass at least one setting to change (see --help)" };
26985
+ }
26986
+ const body = { scheduleId: id, ...fields };
26987
+ const parsed = SuggestionScheduleSettingsSchema.safeParse(body);
26988
+ if (!parsed.success) return issueError(parsed.error.issues[0]);
26989
+ const spend = spendCoversOnePick({
26990
+ maxSpendPerRun: fields.maxSpendPerRun ?? stored?.maxSpendPerRun,
26991
+ maxReward: fields.maxReward ?? stored?.maxReward,
26992
+ template: fields.template ?? stored?.template
26993
+ });
26994
+ if (spend) return spend;
26995
+ return body;
26996
+ }
26997
+ async function storedSettings(scheduleId) {
26998
+ const view = await apiGet(`/api/project-schedules/${scheduleId}`);
26999
+ const settings = view?.schedule?.suggestions;
27000
+ return settings?.template ? settings : { error: `Schedule ${scheduleId} is not a suggestions schedule` };
27001
+ }
27002
+ function addSuggestionScheduleOptions(command) {
27003
+ return command.option(
27004
+ "--rank <rank>",
27005
+ "Suggestions schedules: rank by backed (most pool shares among backer voters, default) or votes"
27006
+ ).option(
27007
+ "--min-backed-share <fraction>",
27008
+ "Suggestions schedules: the least share of the pool's shares a suggestion's backer voters must hold, 0 to 1 (default 0)"
27009
+ ).option(
27010
+ "--min-votes <count>",
27011
+ "Suggestions schedules: the least upvotes a suggestion must have (default 0)"
27012
+ ).option(
27013
+ "--min-age <hours>",
27014
+ "Suggestions schedules: how long a suggestion must have been open, in hours (0 to 720, default 24)"
27015
+ ).option(
27016
+ "--max-tasks <count>",
27017
+ `Suggestions schedules: most picks a run takes (1 to ${SUGGESTION_SCHEDULE_MAX_TASKS_PER_RUN}, default 1)`
27018
+ ).option(
27019
+ "--max-spend <amount>",
27020
+ "Suggestions schedules: most one run's picks may draw together, in the payment token (e.g. 20): each pick draws its reward plus the template's evaluator stake, so it must cover --max-reward plus --evaluator-stake; required at create"
27021
+ ).option(
27022
+ "--max-reward <amount>",
27023
+ "Suggestions schedules: a suggested reward above this is lowered to it, in the payment token; the API requires it plus the evaluator stake to be at most --max-spend; required at create"
27024
+ ).option(
27025
+ "--decline-after <days|never>",
27026
+ "Suggestions schedules: decline an open suggestion that never reached --min-votes or --min-backed-share once it is this many days old (1 to 365, default 30), or never. Only those two thresholds count, so with both at 0 (the default) nothing is declined: set one of them when you use this"
27027
+ ).option(
27028
+ "--default-mode <mode>",
27029
+ "Suggestions schedules: the task mode when a suggestion names none: bounty (default), claim or pitch. A suggestion whose own mode the runner's grant refuses is skipped"
27030
+ ).option(
27031
+ "--email-picks",
27032
+ "Suggestions schedules: email the owner when a propose run has picks waiting (the default)"
27033
+ ).option("--no-email-picks", "Suggestions schedules: do not email when picks are waiting");
27034
+ }
27035
+ var suggestionScheduleSettingsCommand = addSuggestionScheduleOptions(
27036
+ new Command143("suggestion-settings").description(
27037
+ "Change a suggestions schedule's settings, as the project's owner: any of its mode, ranking, thresholds, limits, stale-suggestion declines, default task mode, the picks-waiting email and the task template. Only the settings you pass change; a template flag changes only its own fields of the stored template, which the CLI reads first. A pending proposal is unchanged. Read the settings with `taskmarket project schedule show`. Costs 0.001 in the payment token"
27038
+ ).argument("<scheduleId>", "Schedule id").option(
27039
+ "--mode <mode>",
27040
+ "propose (each run proposes its picks for you to confirm) or auto (each run creates the tasks)"
27041
+ ).option("--duration <hours>", "Each task's deadline, in hours after it is created").option("--tags <tags>", "Comma-separated tags for each task").option("--evaluator <address>", "An evaluator for each task").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (needs --evaluator)").option(
27042
+ "--evaluator-stake <amount>",
27043
+ "Stake behind the evaluator, from the budget (needs --evaluator)"
27044
+ ).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)")
27045
+ ).action(async (value, opts) => {
27046
+ const id = parseScheduleId(value);
27047
+ if (typeof id !== "string") return void printError(id.error);
27048
+ let stored;
27049
+ if (setsTemplate(opts) || opts.maxSpend !== void 0 || opts.maxReward !== void 0) {
27050
+ let read4;
27051
+ try {
27052
+ read4 = await storedSettings(id);
27053
+ } catch (err) {
27054
+ return void renderFailure(err);
27055
+ }
27056
+ if ("error" in read4) return void printError(String(read4.error));
27057
+ stored = read4;
27058
+ }
27059
+ const body = suggestionScheduleSettingsBody(id, opts, stored);
27060
+ if ("error" in body) return void printError(String(body.error));
27061
+ await postProjectWrite(
27062
+ `/api/project-schedules/${String(body.scheduleId)}/suggestions-settings`,
27063
+ body,
27064
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
27065
+ );
27066
+ });
27067
+
26605
27068
  // src/commands/workflow-template.ts
26606
27069
  import { readFile as readFile4 } from "fs/promises";
26607
- import { Command as Command142 } from "commander";
26608
- 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}$/;
27070
+ import { Command as Command144 } from "commander";
27071
+ 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}$/;
26609
27072
  var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
26610
27073
  var FILE_MAX_BYTES = 256 * 1024;
26611
27074
  var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
@@ -26632,7 +27095,7 @@ function templateChoice(value) {
26632
27095
  if (WORKFLOW_PRESET_NAMES.includes(trimmed)) {
26633
27096
  return { preset: trimmed };
26634
27097
  }
26635
- if (UUID2.test(trimmed)) return { templateId: trimmed.toLowerCase() };
27098
+ if (UUID3.test(trimmed)) return { templateId: trimmed.toLowerCase() };
26636
27099
  if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(trimmed)) return { templateId: trimmed };
26637
27100
  return {
26638
27101
  error: `--template is a saved template id (UUID), an official template id (official:<slug>) or a preset: ${WORKFLOW_PRESET_NAMES.join(", ")}`
@@ -26698,7 +27161,7 @@ async function readValidTemplate(path9) {
26698
27161
  }
26699
27162
  return parsed.document;
26700
27163
  }
26701
- var createCommand3 = new Command142("create").description(
27164
+ var createCommand3 = new Command144("create").description(
26702
27165
  "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"
26703
27166
  ).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
26704
27167
  const template = await readValidTemplate(opts.file);
@@ -26709,7 +27172,7 @@ var createCommand3 = new Command142("create").description(
26709
27172
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26710
27173
  );
26711
27174
  });
26712
- var updateCommand = new Command142("update").description(
27175
+ var updateCommand = new Command144("update").description(
26713
27176
  "Replace a saved template with a JSON file, as the wallet that saved it. A change to its content makes a new version; workflows already made from it keep their document until their owner runs `taskmarket workflow update-template`. Costs 0.001 in the payment token"
26714
27177
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
26715
27178
  const choice = templateChoice(value);
@@ -26763,7 +27226,7 @@ function parseTemplateSearch(opts) {
26763
27226
  }
26764
27227
  return { query: query4 };
26765
27228
  }
26766
- var listCommand6 = new Command142("list").description(
27229
+ var listCommand6 = new Command144("list").description(
26767
27230
  "List the official templates (official: true, ids official:<slug>), the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given). Any wallet may make a workflow from any of them (free). With --search, --tag, --featured or --sort, search instead: one page of templates, featured first, with `hasMore`, `nextCursor` and the catalog's most used tags in `catalogTags`; each template lists its `tags` and `featured`"
26768
27231
  ).option("--owner <address>", "The wallet whose templates to list").option(
26769
27232
  "--mine",
@@ -26848,7 +27311,7 @@ var listCommand6 = new Command142("list").description(
26848
27311
  }
26849
27312
  }
26850
27313
  );
26851
- var showCommand4 = new Command142("show").description(
27314
+ var showCommand4 = new Command144("show").description(
26852
27315
  "Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its version (a counter for a saved template, a content hash for an official one), the earlier versions of a saved template as `versions` (number, hash, date), whether it is `listed` in the gallery, its parameters, steps and worst case (free)"
26853
27316
  ).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
26854
27317
  const choice = templateChoice(value);
@@ -26871,7 +27334,7 @@ function savedTemplateId(value, verb) {
26871
27334
  }
26872
27335
  return choice.templateId;
26873
27336
  }
26874
- var publishCommand = new Command142("publish").description(
27337
+ var publishCommand = new Command144("publish").description(
26875
27338
  "List a saved template in the public gallery, as the wallet that saved it, so others can find it with `template list --gallery` (and on the web Templates page) without being given its id; it is shown with your wallet as its author. It needs a description and at most 10 templates per wallet can be listed. Listing again changes nothing. Costs 0.001 in the payment token"
26876
27339
  ).argument("<templateId>", "Saved template id").action(async (value) => {
26877
27340
  const id = savedTemplateId(value, "publish");
@@ -26882,7 +27345,7 @@ var publishCommand = new Command142("publish").description(
26882
27345
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26883
27346
  );
26884
27347
  });
26885
- var unpublishCommand = new Command142("unpublish").description(
27348
+ var unpublishCommand = new Command144("unpublish").description(
26886
27349
  "Take a saved template out of the public gallery, as the wallet that saved it. It stays usable by anyone who has its id. Costs 0.001 in the payment token"
26887
27350
  ).argument("<templateId>", "Saved template id").action(async (value) => {
26888
27351
  const id = savedTemplateId(value, "unpublish");
@@ -26893,7 +27356,7 @@ var unpublishCommand = new Command142("unpublish").description(
26893
27356
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26894
27357
  );
26895
27358
  });
26896
- var deleteCommand2 = new Command142("delete").description(
27359
+ var deleteCommand2 = new Command144("delete").description(
26897
27360
  "Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
26898
27361
  ).argument("<templateId>", "Template id").action(async (value) => {
26899
27362
  const choice = templateChoice(value);
@@ -26910,7 +27373,7 @@ var deleteCommand2 = new Command142("delete").description(
26910
27373
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26911
27374
  );
26912
27375
  });
26913
- var workflowTemplateCommand = new Command142("template").description(
27376
+ var workflowTemplateCommand = new Command144("template").description(
26914
27377
  "Workflow templates: a workflow saved once with declared parameters ({{reward}}, {{topic}}) and made into a workflow on any of your projects with `taskmarket workflow create <projectId> --template <id|official:slug|preset> --param name=value`. Any wallet may use any template; only the wallet that saved one may update or delete it. Official templates: see `taskmarket workflow template list`. Presets: code, content, research"
26915
27378
  ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand4).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
26916
27379
  async function createWorkflowFromTemplate(projectId, template, pairs) {
@@ -26930,19 +27393,41 @@ async function createWorkflowFromTemplate(projectId, template, pairs) {
26930
27393
  }
26931
27394
 
26932
27395
  // src/commands/project/schedule.ts
26933
- 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}$/;
26934
27396
  var STATUSES = ["active", "paused", "cancelled", "completed"];
26935
- function positiveNumber2(value, flag) {
26936
- const parsed = Number(value);
26937
- if (!Number.isFinite(parsed) || parsed <= 0)
26938
- return { error: `${flag} must be a positive number` };
26939
- return parsed;
26940
- }
26941
27397
  function scheduleCreateBody(projectId, opts, workflow) {
26942
27398
  const cadence = parseScheduleCadence(opts.cadence);
26943
27399
  if ("error" in cadence) return { error: `--cadence: ${cadence.error}` };
27400
+ if (!opts.suggestions) {
27401
+ const stray = SUGGESTION_ONLY_FLAGS.find(([, key]) => opts[key] !== void 0);
27402
+ if (stray) {
27403
+ const flag = stray[1] === "emailPicks" && opts.emailPicks === false ? "--no-email-picks" : stray[0];
27404
+ return { error: `${flag} sets a suggestions schedule; pass --suggestions` };
27405
+ }
27406
+ }
26944
27407
  let target;
26945
- if (workflow !== void 0) {
27408
+ if (opts.suggestions) {
27409
+ if (workflow !== void 0 || opts.workflow !== void 0 || opts.workflowFile !== void 0) {
27410
+ return { error: "Pass one of --suggestions, --workflow or --workflow-file" };
27411
+ }
27412
+ for (const [flag, key] of [
27413
+ ["--description", "description"],
27414
+ ["--reward", "reward"]
27415
+ ]) {
27416
+ if (opts[key] !== void 0) {
27417
+ return {
27418
+ error: `${flag} describes a task; a suggestions schedule takes each task's from its suggestion`
27419
+ };
27420
+ }
27421
+ }
27422
+ if (opts.continuePrevious) {
27423
+ return {
27424
+ error: "--continue-previous continues a task schedule; a suggestions schedule has none"
27425
+ };
27426
+ }
27427
+ const suggestions = suggestionScheduleConfig(opts);
27428
+ if ("error" in suggestions) return suggestions;
27429
+ target = { suggestions };
27430
+ } else if (workflow !== void 0) {
26946
27431
  const taskFlag = TASK_TEMPLATE_FLAGS.find(([, key]) => opts[key] !== void 0);
26947
27432
  if (taskFlag) {
26948
27433
  return { error: `${taskFlag[0]} describes a task; a workflow schedule takes none` };
@@ -27009,44 +27494,11 @@ function taskTemplate(opts) {
27009
27494
  reward,
27010
27495
  duration,
27011
27496
  mode,
27012
- tags: opts.tags ? opts.tags.split(",").map((tag) => tag.trim()).filter(Boolean) : []
27497
+ tags: parseTags(opts.tags)
27013
27498
  };
27014
- const evaluatorOnly = [
27015
- ["--evaluator-fee-bps", opts.evaluatorFeeBps],
27016
- ["--evaluator-stake", opts.evaluatorStake],
27017
- ["--evaluation-window", opts.evaluationWindow],
27018
- ["--appeal-window", opts.appealWindow]
27019
- ];
27020
- if (opts.evaluator === void 0) {
27021
- const stray = evaluatorOnly.find(([, value]) => value !== void 0);
27022
- if (stray) return { error: `${stray[0]} needs --evaluator` };
27023
- } else {
27024
- if (!ADDRESS.test(opts.evaluator)) {
27025
- return { error: "--evaluator must be a wallet address (0x + 40 hex chars)" };
27026
- }
27027
- template.evaluator = opts.evaluator;
27028
- if (opts.evaluatorFeeBps !== void 0) {
27029
- if (!/^\d+$/.test(opts.evaluatorFeeBps) || Number(opts.evaluatorFeeBps) > 1e4) {
27030
- return { error: "--evaluator-fee-bps must be an integer from 0 to 10000" };
27031
- }
27032
- template.evaluatorFeeBps = Number(opts.evaluatorFeeBps);
27033
- }
27034
- if (opts.evaluatorStake !== void 0) {
27035
- const stake = parseAmount(opts.evaluatorStake, "--evaluator-stake");
27036
- if (typeof stake !== "string") return stake;
27037
- template.evaluatorStake = stake;
27038
- }
27039
- for (const [flag, value, field] of [
27040
- ["--evaluation-window", opts.evaluationWindow, "evaluationWindowHours"],
27041
- ["--appeal-window", opts.appealWindow, "appealWindowHours"]
27042
- ]) {
27043
- if (value === void 0) continue;
27044
- const hours = positiveNumber2(value, flag);
27045
- if (typeof hours !== "number") return hours;
27046
- template[field] = hours;
27047
- }
27048
- }
27049
- return template;
27499
+ const terms = evaluatorTerms(opts);
27500
+ if ("error" in terms) return terms;
27501
+ return { ...template, ...terms };
27050
27502
  }
27051
27503
  async function resolveWorkflowTarget(projectId, opts) {
27052
27504
  const pairs = opts.param ?? [];
@@ -27073,7 +27525,7 @@ async function resolveWorkflowTarget(projectId, opts) {
27073
27525
  return { preset: value, ...params };
27074
27526
  }
27075
27527
  if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(value)) return { templateId: value, ...params };
27076
- if (!UUID3.test(value)) {
27528
+ if (!UUID2.test(value)) {
27077
27529
  return {
27078
27530
  error: `--workflow is a preset (${WORKFLOW_PRESET_NAMES.join(", ")}), an official template id (official:<slug>), a saved template id or a workflow id`
27079
27531
  };
@@ -27113,44 +27565,52 @@ function scheduleSettingsBody(projectId, opts) {
27113
27565
  }
27114
27566
  return body;
27115
27567
  }
27116
- function scheduleId(value) {
27117
- return UUID3.test(value.trim()) ? value.trim().toLowerCase() : { error: "The schedule id must be a UUID" };
27118
- }
27119
- async function read(path9) {
27568
+ async function read2(path9) {
27120
27569
  try {
27121
27570
  printResult(await apiGet(path9));
27122
27571
  } catch (err) {
27123
27572
  renderFailure(err);
27124
27573
  }
27125
27574
  }
27126
- var createCommand4 = new Command143("create").description(
27127
- "Create a schedule that opens a task from the project's budget on a cadence, or starts a run of a workflow (--workflow or --workflow-file), as the project's owner. The platform runner creates each task or run under your grant to it, and pays the action fee: grant it first (see `taskmarket project runner`). A slot is skipped while the previous task is open or the previous run is not settled, and failures in a row (3 by default) pause the schedule. Costs 0.001 in the payment token"
27128
- ).argument("<projectId>", "Project id").requiredOption(
27129
- "--cadence <cadence>",
27130
- 'An ISO 8601 duration (PT30M, PT6H, P1D, P1W) or a five-field cron expression in UTC ("0 9 * * 1"); at least 30 minutes between runs, or the project minimum'
27131
- ).option(
27132
- "--workflow <workflow>",
27133
- "Run a workflow each slot instead of opening a task: a preset (" + WORKFLOW_PRESET_NAMES.join(", ") + "), an official template (official:<slug>), a saved template id, or a workflow id on this project. Not with the task flags"
27134
- ).option(
27135
- "--param <name=value>",
27136
- "A preset or template parameter value for --workflow; repeat it for each",
27137
- collect6,
27138
- []
27139
- ).option("--workflow-file <path>", "Run this workflow document (JSON) each slot").option("--description <text>", "Each task's description (task schedules)").option(
27140
- "--reward <amount>",
27141
- "Each task's reward in the payment token (e.g. 5), from the budget (task schedules)"
27142
- ).option("--duration <hours>", "Each task's deadline, in hours after it opens (task schedules)").option("--mode <mode>", "Task mode: bounty, claim or pitch (default bounty)").option("--tags <tags>", "Comma-separated tags").option("--evaluator <address>", "An evaluator for each task (optional)").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (needs --evaluator)").option(
27143
- "--evaluator-stake <amount>",
27144
- "Stake behind the evaluator, from the budget (needs --evaluator)"
27145
- ).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)").option(
27146
- "--runs <count>",
27147
- "How many tasks to create (default: until cancelled or the project ends)"
27148
- ).option("--continue-previous", "Each task continues the previous run's task (task schedules)").option("--start <time>", "The first slot, ISO 8601 (default: now, or the next cron time)").action(async (id, opts) => {
27575
+ var createCommand4 = addSuggestionScheduleOptions(
27576
+ new Command145("create").description(
27577
+ "Create a schedule that opens a task from the project's budget on a cadence, starts a run of a workflow (--workflow or --workflow-file), or turns the top open suggestions into tasks (--suggestions), as the project's owner. The platform runner creates each task or run under your grant to it, and pays the action fee: grant it first (see `taskmarket project runner`). A slot is skipped while the previous task is open or the previous run is not settled, and failures in a row (3 by default) pause the schedule. A suggestions schedule proposes its picks for you to confirm (`taskmarket project suggestion proposals`) unless --mode auto; it needs --max-spend, --max-reward and --duration. Costs 0.001 in the payment token"
27578
+ ).argument("<projectId>", "Project id").requiredOption(
27579
+ "--cadence <cadence>",
27580
+ 'An ISO 8601 duration (PT30M, PT6H, P1D, P1W) or a five-field cron expression in UTC ("0 9 * * 1"); at least 30 minutes between runs, or the project minimum'
27581
+ ).option(
27582
+ "--workflow <workflow>",
27583
+ "Run a workflow each slot instead of opening a task: a preset (" + WORKFLOW_PRESET_NAMES.join(", ") + "), an official template (official:<slug>), a saved template id, or a workflow id on this project. Not with the task flags"
27584
+ ).option(
27585
+ "--param <name=value>",
27586
+ "A preset or template parameter value for --workflow; repeat it for each",
27587
+ collect6,
27588
+ []
27589
+ ).option("--workflow-file <path>", "Run this workflow document (JSON) each slot").option(
27590
+ "--suggestions",
27591
+ "Take the project's top open suggestions each slot and propose them as tasks (or create them with --mode auto), within the suggestions flags below; not with --workflow or the task's --description and --reward"
27592
+ ).option("--description <text>", "Each task's description (task schedules)").option(
27593
+ "--reward <amount>",
27594
+ "Each task's reward in the payment token (e.g. 5), from the budget (task schedules)"
27595
+ ).option(
27596
+ "--duration <hours>",
27597
+ "Each task's deadline, in hours after it opens (task and suggestions schedules)"
27598
+ ).option(
27599
+ "--mode <mode>",
27600
+ "Task mode: bounty, claim or pitch (default bounty); with --suggestions, propose (default: you confirm each pick) or auto (each run creates the tasks)"
27601
+ ).option("--tags <tags>", "Comma-separated tags").option("--evaluator <address>", "An evaluator for each task (optional)").option("--evaluator-fee-bps <bps>", "Evaluator fee in basis points (needs --evaluator)").option(
27602
+ "--evaluator-stake <amount>",
27603
+ "Stake behind the evaluator, from the budget (needs --evaluator)"
27604
+ ).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)").option(
27605
+ "--runs <count>",
27606
+ "How many runs the schedule makes (default: until cancelled or the project ends); a task schedule opens one task a run, and a suggestions schedule may create up to --max-tasks a run"
27607
+ ).option("--continue-previous", "Each task continues the previous run's task (task schedules)").option("--start <time>", "The first slot, ISO 8601 (default: now, or the next cron time)")
27608
+ ).action(async (id, opts) => {
27149
27609
  const projectId = parseProjectId(id);
27150
27610
  if (typeof projectId !== "number") return void printError(projectId.error);
27151
- let workflow;
27611
+ let workflow = null;
27152
27612
  try {
27153
- workflow = await resolveWorkflowTarget(projectId, opts);
27613
+ if (!opts.suggestions) workflow = await resolveWorkflowTarget(projectId, opts);
27154
27614
  } catch (err) {
27155
27615
  return void renderFailure(err);
27156
27616
  }
@@ -27162,7 +27622,7 @@ var createCommand4 = new Command143("create").description(
27162
27622
  });
27163
27623
  });
27164
27624
  var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
27165
- var listCommand7 = new Command143("list").description(
27625
+ var listCommand7 = new Command145("list").description(
27166
27626
  "List a project's schedules, its schedule limits and the platform runner; or, with --mine or --owner, a wallet's schedules across every project it owns, failing ones first, each with its next and last run (free)"
27167
27627
  ).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's schedules across the projects it owns").option("--owner <address>", "List this wallet's schedules across the projects it owns").option(
27168
27628
  "--status <status>",
@@ -27173,7 +27633,7 @@ var listCommand7 = new Command143("list").description(
27173
27633
  if (owner) {
27174
27634
  const query5 = ownerListQuery(owner.owner, opts, OWNER_SCHEDULE_STATUSES);
27175
27635
  if (typeof query5 !== "string") return void printError(query5.error);
27176
- return void await read(withChainId(`/api/schedules?${query5}`));
27636
+ return void await read2(withChainId(`/api/schedules?${query5}`));
27177
27637
  }
27178
27638
  if (id === void 0) {
27179
27639
  return void printError("Pass a project id, or --mine / --owner <address>");
@@ -27193,18 +27653,18 @@ var listCommand7 = new Command143("list").description(
27193
27653
  if (opts.status) params.set("status", opts.status);
27194
27654
  if (opts.limit) params.set("limit", opts.limit.trim());
27195
27655
  const query4 = params.toString();
27196
- await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
27656
+ await read2(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
27197
27657
  });
27198
- var showCommand5 = new Command143("show").description(
27199
- "Show a schedule (its target, task or workflow, with workflowId and template) and its newest runs: opened, skipped with the reason, or failed, each with its task or workflowRunId (free)"
27658
+ var showCommand5 = new Command145("show").description(
27659
+ "Show a schedule (its target, task, workflow or suggestions, with workflowId, template or its suggestions settings) and its newest runs: opened, proposed, skipped with the reason, or failed, each with its task, workflowRunId, proposalId or taskIds (free)"
27200
27660
  ).argument("<scheduleId>", "Schedule id").action(async (value) => {
27201
- const id = scheduleId(value);
27661
+ const id = parseScheduleId(value);
27202
27662
  if (typeof id !== "string") return void printError(id.error);
27203
- await read(`/api/project-schedules/${id}`);
27663
+ await read2(`/api/project-schedules/${id}`);
27204
27664
  });
27205
27665
  function actionCommand(action, description) {
27206
- return new Command143(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
27207
- const id = scheduleId(value);
27666
+ return new Command145(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
27667
+ const id = parseScheduleId(value);
27208
27668
  if (typeof id !== "string") return void printError(id.error);
27209
27669
  await postProjectWrite(
27210
27670
  `/api/project-schedules/${id}/${action}`,
@@ -27213,7 +27673,7 @@ function actionCommand(action, description) {
27213
27673
  );
27214
27674
  });
27215
27675
  }
27216
- var settingsCommand = new Command143("settings").description(
27676
+ var settingsCommand = new Command145("settings").description(
27217
27677
  "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"
27218
27678
  ).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) => {
27219
27679
  const projectId = parseProjectId(id);
@@ -27235,8 +27695,8 @@ var settingsCommand = new Command143("settings").description(
27235
27695
  maxAmount: ACTION_FEE_MAX_AMOUNT
27236
27696
  });
27237
27697
  });
27238
- var projectScheduleCommand = new Command143("schedule").description(
27239
- "Schedules: a task from the project's budget on a cadence, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
27698
+ var projectScheduleCommand = new Command145("schedule").description(
27699
+ "Schedules: a task from the project's budget on a cadence, a workflow run, or tasks from the top suggestions, created by the platform runner once the project's automations are on (`taskmarket project automations on <projectId> --cap <amount>`)"
27240
27700
  ).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand5).addCommand(
27241
27701
  actionCommand(
27242
27702
  "pause",
@@ -27257,16 +27717,16 @@ var projectScheduleCommand = new Command143("schedule").description(
27257
27717
  "stop-auto-payout",
27258
27718
  "Stop automatic payouts and review acceptance on a workflow schedule, for good: every run it starts, and its runs still going, wait for the owner's confirmation; the runner sends nothing. Refused on a schedule that opens tasks (costs 0.001 in the payment token)"
27259
27719
  )
27260
- ).addCommand(settingsCommand);
27261
- var projectRunnerCommand = new Command143("runner").description(
27720
+ ).addCommand(settingsCommand).addCommand(suggestionScheduleSettingsCommand);
27721
+ var projectRunnerCommand = new Command145("runner").description(
27262
27722
  "Advanced. The platform runner's address on the selected network's chain, and every chain's runner (free). To run schedules and workflows turn automations on instead, `taskmarket project automations on <projectId> --cap <amount>`, which grants the right runner for you. Granting it by hand with `taskmarket project grant` works too; the runner pays each action fee"
27263
27723
  ).action(async () => {
27264
- await read(withChainId("/api/project-runner"));
27724
+ await read2(withChainId("/api/project-runner"));
27265
27725
  });
27266
27726
 
27267
27727
  // src/commands/project/transfer.ts
27268
- import { Command as Command144 } from "commander";
27269
- var proposeCommand = new Command144("propose").description(
27728
+ import { Command as Command146 } from "commander";
27729
+ var proposeCommand = new Command146("propose").description(
27270
27730
  "Propose a new owner for a project, as the project owner (costs 0.001 in the payment token). Nothing changes until that wallet runs `project transfer accept`; a new proposal replaces the old one, and `project transfer cancel` withdraws it. Only an open project can be handed over. On accept, the owner's own share of the project's pool moves to the new owner; other backers' shares never move, and the grants stay"
27271
27731
  ).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
27272
27732
  const projectId = parseProjectId(id);
@@ -27280,7 +27740,7 @@ var proposeCommand = new Command144("propose").description(
27280
27740
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27281
27741
  );
27282
27742
  });
27283
- var acceptCommand2 = new Command144("accept").description(
27743
+ var acceptCommand2 = new Command146("accept").description(
27284
27744
  "Take over a project its owner proposed to this wallet (costs 0.001 in the payment token). Read the project first (`project show`): you receive it as it stands, with its grants and tasks, and the previous owner's share of its pool. Only an open project can be accepted"
27285
27745
  ).argument("<projectId>", "Project id").action(async (id) => {
27286
27746
  const projectId = parseProjectId(id);
@@ -27291,7 +27751,7 @@ var acceptCommand2 = new Command144("accept").description(
27291
27751
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27292
27752
  );
27293
27753
  });
27294
- var cancelCommand = new Command144("cancel").description(
27754
+ var cancelCommand = new Command146("cancel").description(
27295
27755
  "Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
27296
27756
  ).argument("<projectId>", "Project id").action(async (id) => {
27297
27757
  const projectId = parseProjectId(id);
@@ -27302,13 +27762,13 @@ var cancelCommand = new Command144("cancel").description(
27302
27762
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27303
27763
  );
27304
27764
  });
27305
- var projectTransferCommand = new Command144("transfer").description(
27765
+ var projectTransferCommand = new Command146("transfer").description(
27306
27766
  "Hand a project to another wallet in two steps: the owner proposes, the new owner accepts, and the owner can cancel before it does"
27307
27767
  ).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
27308
27768
 
27309
27769
  // src/commands/project/show.ts
27310
- import { Command as Command145 } from "commander";
27311
- var projectShowCommand = new Command145("show").description(
27770
+ import { Command as Command147 } from "commander";
27771
+ var projectShowCommand = new Command147("show").description(
27312
27772
  "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)"
27313
27773
  ).argument("<projectId>", "Project id").action(async (id) => {
27314
27774
  const projectId = parseProjectId(id);
@@ -27317,7 +27777,7 @@ var projectShowCommand = new Command145("show").description(
27317
27777
  printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
27318
27778
  });
27319
27779
  var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
27320
- var projectBackersCommand = new Command145("backers").description(
27780
+ var projectBackersCommand = new Command147("backers").description(
27321
27781
  "List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
27322
27782
  ).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) => {
27323
27783
  const projectId = parseProjectId(id);
@@ -27336,13 +27796,13 @@ var projectBackersCommand = new Command145("backers").description(
27336
27796
  await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
27337
27797
  );
27338
27798
  });
27339
- var projectForTaskCommand = new Command145("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) => {
27799
+ var projectForTaskCommand = new Command147("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) => {
27340
27800
  if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
27341
27801
  return void printError("The task id must be 0x-prefixed hex");
27342
27802
  }
27343
27803
  printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
27344
27804
  });
27345
- var projectListCommand = new Command145("list").description(
27805
+ var projectListCommand = new Command147("list").description(
27346
27806
  "List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
27347
27807
  ).option(
27348
27808
  "--funding",
@@ -27393,7 +27853,7 @@ var projectListCommand = new Command145("list").description(
27393
27853
  );
27394
27854
 
27395
27855
  // src/commands/project/index.ts
27396
- var projectCommand = new Command146("project").description(
27856
+ var projectCommand = new Command148("project").description(
27397
27857
  "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"
27398
27858
  );
27399
27859
  projectCommand.addCommand(projectCreateCommand);
@@ -27424,7 +27884,7 @@ projectCommand.addCommand(projectForTaskCommand);
27424
27884
 
27425
27885
  // src/commands/workflow.ts
27426
27886
  import { readFile as readFile5 } from "fs/promises";
27427
- import { Command as Command147 } from "commander";
27887
+ import { Command as Command149 } from "commander";
27428
27888
  var UUID4 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
27429
27889
  var FILE_MAX_BYTES2 = 256 * 1024;
27430
27890
  function parseWorkflowText(text) {
@@ -27462,7 +27922,7 @@ function stepKey(value) {
27462
27922
  }
27463
27923
  return trimmed;
27464
27924
  }
27465
- async function read2(path9) {
27925
+ async function read3(path9) {
27466
27926
  try {
27467
27927
  printResult(await apiGet(path9));
27468
27928
  } catch (err) {
@@ -27488,7 +27948,7 @@ async function projectContext(projectId) {
27488
27948
  runner
27489
27949
  };
27490
27950
  }
27491
- var validateCommand = new Command147("validate").description(
27951
+ var validateCommand = new Command149("validate").description(
27492
27952
  "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)"
27493
27953
  ).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) => {
27494
27954
  const parsed = await readDocument(opts.file ?? file);
@@ -27531,7 +27991,7 @@ var validateCommand = new Command147("validate").description(
27531
27991
  document: result.document
27532
27992
  });
27533
27993
  });
27534
- var createCommand5 = new Command147("create").description(
27994
+ var createCommand5 = new Command149("create").description(
27535
27995
  "Create a workflow on a project, as its owner, from a JSON document (--file) or from a saved template, an official template or a preset (--template <id|official:slug|preset> with --param name=value for each value; a parameter left out takes its default). The API validates it again, worst case included, before saving; nothing runs until `taskmarket workflow run`. Grant the platform runner first (`taskmarket project runner`). Costs 0.001 in the payment token"
27536
27996
  ).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
27537
27997
  "--template <template>",
@@ -27574,7 +28034,7 @@ var createCommand5 = new Command147("create").description(
27574
28034
  );
27575
28035
  });
27576
28036
  var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
27577
- var listCommand8 = new Command147("list").description(
28037
+ var listCommand8 = new Command149("list").description(
27578
28038
  "List a project's workflows, newest first, with its workflow limits and the platform runner; or, with --mine or --owner, a wallet's workflows across every project it owns, those waiting on the owner first (free)"
27579
28039
  ).argument("[projectId]", "Project id (omit with --mine or --owner)").option("--mine", "List the acting wallet's workflows across the projects it owns").option("--owner <address>", "List this wallet's workflows across the projects it owns").option(
27580
28040
  "--status <status>",
@@ -27585,7 +28045,7 @@ var listCommand8 = new Command147("list").description(
27585
28045
  if (owner) {
27586
28046
  const query5 = ownerListQuery(owner.owner, opts, OWNER_WORKFLOW_STATUSES);
27587
28047
  if (typeof query5 !== "string") return void printError(query5.error);
27588
- return void await read2(withChainId(`/api/workflows?${query5}`));
28048
+ return void await read3(withChainId(`/api/workflows?${query5}`));
27589
28049
  }
27590
28050
  if (id === void 0) {
27591
28051
  return void printError("Pass a project id, or --mine / --owner <address>");
@@ -27602,9 +28062,9 @@ var listCommand8 = new Command147("list").description(
27602
28062
  if (opts.limit) params.set("limit", opts.limit.trim());
27603
28063
  if (opts.cursor) params.set("cursor", opts.cursor.trim());
27604
28064
  const query4 = params.toString();
27605
- await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
28065
+ await read3(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
27606
28066
  });
27607
- var showCommand6 = new Command147("show").description(
28067
+ var showCommand6 = new Command149("show").description(
27608
28068
  "Show a workflow, its validated document, its newest runs and, for one made from a template, `workflow.templateUpdate` (the version it has, the template's latest and `available`); when an update is available a `note` says how to apply it (free)"
27609
28069
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27610
28070
  const id = uuid(value, "workflow");
@@ -27617,7 +28077,7 @@ var showCommand6 = new Command147("show").description(
27617
28077
  renderFailure(err);
27618
28078
  }
27619
28079
  });
27620
- var updateTemplateCommand = new Command147("update-template").description(
28080
+ var updateTemplateCommand = new Command149("update-template").description(
27621
28081
  "Apply the newest version of the template a workflow was made from, as the project owner: the document is made again from the template with the workflow's own parameter values and checked against the project, like a new workflow. It never happens on its own; `workflow show` says when an update is available. Runs already started keep the version they started with. Costs 0.001 in the payment token"
27622
28082
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27623
28083
  const id = uuid(value, "workflow");
@@ -27628,7 +28088,7 @@ var updateTemplateCommand = new Command147("update-template").description(
27628
28088
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27629
28089
  );
27630
28090
  });
27631
- var runsCommand = new Command147("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) => {
28091
+ var runsCommand = new Command149("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) => {
27632
28092
  const id = uuid(value, "workflow");
27633
28093
  if (typeof id !== "string") return void printError(id.error);
27634
28094
  if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
@@ -27638,16 +28098,16 @@ var runsCommand = new Command147("runs").description("Page through a workflow's
27638
28098
  if (opts.limit) params.set("limit", opts.limit.trim());
27639
28099
  if (opts.cursor) params.set("cursor", opts.cursor.trim());
27640
28100
  const query4 = params.toString();
27641
- await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
28101
+ await read3(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
27642
28102
  });
27643
- var statusCommand3 = new Command147("status").description(
28103
+ var statusCommand3 = new Command149("status").description(
27644
28104
  "Show a run: its outline, each step with its state (pending, open, accepted, failed or skipped), round, item or attempt, autoAccept for a gating review the runner accepts itself, and the next action (free)"
27645
28105
  ).argument("<runId>", "Run id").action(async (value) => {
27646
28106
  const id = uuid(value, "run");
27647
28107
  if (typeof id !== "string") return void printError(id.error);
27648
- await read2(`/api/project-workflow-runs/${id}`);
28108
+ await read3(`/api/project-workflow-runs/${id}`);
27649
28109
  });
27650
- var runCommand2 = new Command147("run").description(
28110
+ var runCommand2 = new Command149("run").description(
27651
28111
  "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"
27652
28112
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27653
28113
  const id = uuid(value, "workflow");
@@ -27659,7 +28119,7 @@ var runCommand2 = new Command147("run").description(
27659
28119
  );
27660
28120
  });
27661
28121
  function stepCommand(action, description) {
27662
- return new Command147(action).description(description).argument("<runId>", "Run id").requiredOption(
28122
+ return new Command149(action).description(description).argument("<runId>", "Run id").requiredOption(
27663
28123
  "--step <key>",
27664
28124
  "The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
27665
28125
  ).action(async (value, opts) => {
@@ -27674,7 +28134,7 @@ function stepCommand(action, description) {
27674
28134
  );
27675
28135
  });
27676
28136
  }
27677
- var cancelCommand2 = new Command147("cancel").description(
28137
+ var cancelCommand2 = new Command149("cancel").description(
27678
28138
  "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"
27679
28139
  ).argument("<runId>", "Run id").action(async (value) => {
27680
28140
  const id = uuid(value, "run");
@@ -27685,7 +28145,7 @@ var cancelCommand2 = new Command147("cancel").description(
27685
28145
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27686
28146
  );
27687
28147
  });
27688
- var stopAutoPayoutCommand = new Command147("stop-auto-payout").description(
28148
+ var stopAutoPayoutCommand = new Command149("stop-auto-payout").description(
27689
28149
  "Stop automatic payouts and automatic review acceptance on a run, as the owner, at once and for good: from then on every pending step's review waits for you to accept it and every payout becomes a proposal you confirm (`taskmarket workflow payout confirm`); the runner sends nothing. A second stop changes nothing; refused on a completed or cancelled run. Costs 0.001 in the payment token"
27690
28150
  ).argument("<runId>", "Run id").action(async (value) => {
27691
28151
  const id = uuid(value, "run");
@@ -27696,7 +28156,7 @@ var stopAutoPayoutCommand = new Command147("stop-auto-payout").description(
27696
28156
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27697
28157
  );
27698
28158
  });
27699
- var deleteCommand3 = new Command147("delete").description(
28159
+ var deleteCommand3 = new Command149("delete").description(
27700
28160
  "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"
27701
28161
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27702
28162
  const id = uuid(value, "workflow");
@@ -27718,21 +28178,21 @@ async function ownerRead(path9) {
27718
28178
  renderFailure(err);
27719
28179
  }
27720
28180
  }
27721
- var payoutListCommand = new Command147("list").description(
28181
+ var payoutListCommand = new Command149("list").description(
27722
28182
  "A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId), accepted_by_owner (the gated task was accepted by hand before the automatic payout landed; the runner paid nothing) or unavailable (free)"
27723
28183
  ).argument("<runId>", "Run id").action(async (value) => {
27724
28184
  const id = uuid(value, "run");
27725
28185
  if (typeof id !== "string") return void printError(id.error);
27726
28186
  await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
27727
28187
  });
27728
- var payoutShowCommand = new Command147("show").description(
28188
+ var payoutShowCommand = new Command149("show").description(
27729
28189
  "Show a payout proposal: its status (pending, confirmed, auto_paid, accepted_by_owner or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends; owner and operators only (free)"
27730
28190
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
27731
28191
  const id = uuid(value, "payout proposal");
27732
28192
  if (typeof id !== "string") return void printError(id.error);
27733
28193
  await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
27734
28194
  });
27735
- var payoutConfirmCommand = new Command147("confirm").description(
28195
+ var payoutConfirmCommand = new Command149("confirm").description(
27736
28196
  "Confirm a pending payout proposal, as the project's owner: sends exactly the accept it shows (`taskmarket workflow payout show` prints the winners and shares first), paying the gated task out. Refused unless the proposal is pending (an auto_paid one was already sent by the runner). Costs the accept, paid like `task accept-submissions`"
27737
28197
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
27738
28198
  const id = uuid(value, "payout proposal");
@@ -27755,10 +28215,10 @@ var payoutConfirmCommand = new Command147("confirm").description(
27755
28215
  { maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
27756
28216
  );
27757
28217
  });
27758
- var payoutCommand = new Command147("payout").description(
28218
+ var payoutCommand = new Command149("payout").description(
27759
28219
  "Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
27760
28220
  ).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
27761
- var settingsCommand2 = new Command147("settings").description(
28221
+ var settingsCommand2 = new Command149("settings").description(
27762
28222
  `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`
27763
28223
  ).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
27764
28224
  const projectId = parseProjectId(id);
@@ -27789,7 +28249,7 @@ var settingsCommand2 = new Command147("settings").description(
27789
28249
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27790
28250
  );
27791
28251
  });
27792
- var workflowCommand = new Command147("workflow").description(
28252
+ var workflowCommand = new Command149("workflow").description(
27793
28253
  "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"
27794
28254
  ).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand6).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
27795
28255
  stepCommand(
@@ -27804,8 +28264,8 @@ var workflowCommand = new Command147("workflow").description(
27804
28264
  ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27805
28265
 
27806
28266
  // src/commands/drops.ts
27807
- import { Command as Command148 } from "commander";
27808
- var listCommand9 = new Command148("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").option("--status <status>", "ended: only drops no longer accepting work, newest first").option("--worker <address>", "Only drops this wallet entered (a submission, pitch or bid)").option("--entered", "Only drops your wallet entered (--worker with your own address)").action(
28267
+ import { Command as Command150 } from "commander";
28268
+ var listCommand9 = new Command150("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").option("--status <status>", "ended: only drops no longer accepting work, newest first").option("--worker <address>", "Only drops this wallet entered (a submission, pitch or bid)").option("--entered", "Only drops your wallet entered (--worker with your own address)").action(
27809
28269
  async (opts) => {
27810
28270
  try {
27811
28271
  if (opts.worker && opts.entered) throw new Error("Pass --worker or --entered, not both");
@@ -27833,7 +28293,7 @@ var listCommand9 = new Command148("list").description("List public Task Drops, o
27833
28293
  }
27834
28294
  }
27835
28295
  );
27836
- var showCommand7 = new Command148("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
28296
+ var showCommand7 = new Command150("show").description("Show a Task Drop and its discoverable tasks").argument("<taskDropId>", "Task Drop ID").action(async (taskDropId) => {
27837
28297
  try {
27838
28298
  const input = parseInput(TaskDropGetInputSchema, { taskDropId });
27839
28299
  const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
@@ -27845,7 +28305,7 @@ var showCommand7 = new Command148("show").description("Show a Task Drop and its
27845
28305
  renderFailure(err);
27846
28306
  }
27847
28307
  });
27848
- var subscribeCommand = new Command148("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(
28308
+ var subscribeCommand = new Command150("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(
27849
28309
  async (taskDropId, opts) => {
27850
28310
  try {
27851
28311
  if (opts.official) {
@@ -27873,7 +28333,7 @@ var subscribeCommand = new Command148("subscribe").description("Subscribe an ema
27873
28333
  }
27874
28334
  }
27875
28335
  );
27876
- var statusCommand4 = new Command148("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) => {
28336
+ var statusCommand4 = new Command150("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) => {
27877
28337
  try {
27878
28338
  if (opts.official) {
27879
28339
  if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
@@ -27890,15 +28350,15 @@ var statusCommand4 = new Command148("status").description("Check whether an emai
27890
28350
  renderFailure(err);
27891
28351
  }
27892
28352
  });
27893
- var dropsCommand = new Command148("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand7).addCommand(subscribeCommand).addCommand(statusCommand4);
28353
+ var dropsCommand = new Command150("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand7).addCommand(subscribeCommand).addCommand(statusCommand4);
27894
28354
 
27895
28355
  // src/commands/hooks.ts
27896
- import { Command as Command150 } from "commander";
28356
+ import { Command as Command152 } from "commander";
27897
28357
  import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
27898
28358
 
27899
28359
  // src/lib/listing-submissions.ts
27900
28360
  import { readFile as readFile6 } from "fs/promises";
27901
- import { Command as Command149 } from "commander";
28361
+ import { Command as Command151 } from "commander";
27902
28362
  var NOTICE = "Submitted for staff review. The action fee is kept whether the submission is approved or rejected. Approval opens a review pull request; `listed` turns true once the entry is served.";
27903
28363
  function prepareListingFile(kind, text) {
27904
28364
  if (Buffer.byteLength(text, "utf8") > LISTING_SUBMISSION_MAX_BYTES) {
@@ -27955,7 +28415,7 @@ function prepareListingFile(kind, text) {
27955
28415
  }
27956
28416
  function submitCommandFor(kind) {
27957
28417
  const what = kind === "catalog" ? "catalog entry (kind x402-endpoint)" : "hook manifest";
27958
- return new Command149("submit").description(
28418
+ return new Command151("submit").description(
27959
28419
  `Submit a ${what} for staff review. Pays the standard action fee, kept either way; needs an ERC-8004 identity on the selected network`
27960
28420
  ).requiredOption("--file <path>", `Path to the ${what} JSON file`).action(async (opts) => {
27961
28421
  let text;
@@ -27987,7 +28447,7 @@ function submitCommandFor(kind) {
27987
28447
  });
27988
28448
  }
27989
28449
  function submissionsCommandFor(kind) {
27990
- return new Command149("submissions").description(
28450
+ return new Command151("submissions").description(
27991
28451
  `List the ${kind === "catalog" ? "catalog entries" : "hook listings"} you submitted and their status`
27992
28452
  ).option("--status <status>", `Only this status: ${LISTING_SUBMISSION_STATUSES.join(", ")}`).option("--limit <n>", "Maximum submissions to return (1-100)", "50").action(async (opts) => {
27993
28453
  if (opts.status && !LISTING_SUBMISSION_STATUSES.includes(opts.status)) {
@@ -28053,7 +28513,7 @@ async function probeHookVersion(entry, chainId) {
28053
28513
  return reverted ? { ...entry, hookVersion: 1 } : entry;
28054
28514
  }
28055
28515
  }
28056
- var listCommand10 = new Command150("list").description(
28516
+ var listCommand10 = new Command152("list").description(
28057
28517
  "List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
28058
28518
  ).option("--limit <n>", "Maximum unlisted observed hooks to return (1-100)", "50").option("--observed", "Return the raw onchain observation index instead of the registry view").option(
28059
28519
  "--cursor <cursor>",
@@ -28092,7 +28552,7 @@ var listCommand10 = new Command150("list").description(
28092
28552
  }
28093
28553
  }
28094
28554
  );
28095
- var showCommand8 = new Command150("show").description(
28555
+ var showCommand8 = new Command152("show").description(
28096
28556
  "Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
28097
28557
  ).argument("<address>", "Hook contract address").action(async (address3) => {
28098
28558
  try {
@@ -28112,7 +28572,7 @@ var showCommand8 = new Command150("show").description(
28112
28572
  renderFailure(err);
28113
28573
  }
28114
28574
  });
28115
- var encodeConfigCommand = new Command150("encode-config").description(
28575
+ var encodeConfigCommand = new Command152("encode-config").description(
28116
28576
  "Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
28117
28577
  ).argument("<address>", "Hook contract address").requiredOption(
28118
28578
  "--values <json>",
@@ -28141,7 +28601,7 @@ var encodeConfigCommand = new Command150("encode-config").description(
28141
28601
  renderFailure(err);
28142
28602
  }
28143
28603
  });
28144
- var attachmentConfigCommand = new Command150("attachment-config").description(
28604
+ var attachmentConfigCommand = new Command152("attachment-config").description(
28145
28605
  "Show the protocol-default hook order and maximum hooks per task on the selected --network"
28146
28606
  ).action(async () => {
28147
28607
  try {
@@ -28150,16 +28610,16 @@ var attachmentConfigCommand = new Command150("attachment-config").description(
28150
28610
  renderFailure(err);
28151
28611
  }
28152
28612
  });
28153
- var hooksCommand = new Command150("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand8).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
28613
+ var hooksCommand = new Command152("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand8).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
28154
28614
 
28155
28615
  // src/commands/catalog/index.ts
28156
- import { Command as Command151 } from "commander";
28157
- var catalogCommand = new Command151("catalog").description("Submit paid endpoints to the Taskmarket catalog and track your submissions").addCommand(submitCommandFor("catalog")).addCommand(submissionsCommandFor("catalog"));
28616
+ import { Command as Command153 } from "commander";
28617
+ var catalogCommand = new Command153("catalog").description("Submit paid endpoints to the Taskmarket catalog and track your submissions").addCommand(submitCommandFor("catalog")).addCommand(submissionsCommandFor("catalog"));
28158
28618
 
28159
28619
  // src/commands/tap.ts
28160
28620
  import { promises as fs12 } from "fs";
28161
- import { Command as Command152 } from "commander";
28162
- var tapCommand = new Command152("tap").description(
28621
+ import { Command as Command154 } from "commander";
28622
+ var tapCommand = new Command154("tap").description(
28163
28623
  "Manage the TAP signing key used on tasks that require TAP verification"
28164
28624
  );
28165
28625
  tapCommand.command("import").description(
@@ -28318,7 +28778,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
28318
28778
  });
28319
28779
 
28320
28780
  // src/commands/hire.ts
28321
- import { Command as Command153 } from "commander";
28781
+ import { Command as Command155 } from "commander";
28322
28782
  var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
28323
28783
  async function lookupListedService(worker, serviceId) {
28324
28784
  let listing;
@@ -28350,7 +28810,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
28350
28810
  }
28351
28811
  return null;
28352
28812
  }
28353
- var hireCommand = new Command153("hire").description(
28813
+ var hireCommand = new Command155("hire").description(
28354
28814
  "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."
28355
28815
  ).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(
28356
28816
  "--requires-evaluator",
@@ -28413,7 +28873,7 @@ hireCommand.action(async (worker, opts) => {
28413
28873
  // src/index.ts
28414
28874
  var require2 = createRequire(import.meta.url);
28415
28875
  var { version } = require2("../package.json");
28416
- var program = new Command154();
28876
+ var program = new Command156();
28417
28877
  setLastErrorCliVersion(version);
28418
28878
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
28419
28879
  program.option(