@lucid-agents/taskmarket 1.39.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-I3EZRW6P.js → api-S2IU3JCT.js} +2 -2
  4. package/dist/{channels-JW5465JV.js → channels-4LHC2LND.js} +4 -4
  5. package/dist/{chunk-WGLEKAU2.js → chunk-5VGLI7T4.js} +1 -1
  6. package/dist/{chunk-5IV4HFML.js → chunk-6XMZQPS5.js} +3 -3
  7. package/dist/{chunk-OEVU366I.js → chunk-7Y5S6QR7.js} +3330 -6412
  8. package/dist/{chunk-U7L2VMHL.js → chunk-A37LXOBO.js} +5 -5
  9. package/dist/{chunk-U2BQZ7BU.js → chunk-A6JG4LL5.js} +3 -3
  10. package/dist/{chunk-I6O7MUFZ.js → chunk-HH2RBNNT.js} +2 -2
  11. package/dist/{chunk-HJE3YXIQ.js → chunk-HYYMYJV4.js} +3 -3
  12. package/dist/{chunk-6Q37G25Q.js → chunk-LIVNNQYQ.js} +1 -1
  13. package/dist/{chunk-PPTRUZJK.js → chunk-ORCB435L.js} +1 -1
  14. package/dist/{chunk-LJKCK7J7.js → chunk-PNBVFBTB.js} +14 -9
  15. package/dist/{chunk-BVUHDLFY.js → chunk-PRKO232N.js} +1 -1
  16. package/dist/{chunk-CO6HZLD5.js → chunk-Z66B234H.js} +1 -1
  17. package/dist/{doctor-YSCUPIXR.js → doctor-EII4X6TP.js} +8 -8
  18. package/dist/index.js +1064 -575
  19. package/dist/{launch-ZEYFMO3L.js → launch-SV7PLTVI.js} +11 -11
  20. package/dist/pi-extensions/xgate.cjs +10456 -84161
  21. package/dist/{read-auth-34XAANDC.js → read-auth-SP6JR5V4.js} +3 -3
  22. package/dist/{reconcile-34TJBB74.js → reconcile-FN727GXS.js} +4 -4
  23. package/dist/{status-ZAZLJJMP.js → status-ASLURNQV.js} +8 -8
  24. package/dist/{sync-pull-3HL7LFTB.js → sync-pull-NAO3WOFB.js} +4 -4
  25. package/dist/{task-access-grants-WMTLO2WA.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-LJKCK7J7.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-U2BQZ7BU.js";
40
+ } from "./chunk-A6JG4LL5.js";
41
41
  import {
42
42
  signReadAuth
43
- } from "./chunk-I6O7MUFZ.js";
43
+ } from "./chunk-HH2RBNNT.js";
44
44
  import {
45
45
  saveTaskAccessGrant,
46
46
  taskAccessGrantHeaders
47
- } from "./chunk-PPTRUZJK.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-CO6HZLD5.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-WGLEKAU2.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-OEVU366I.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-ZEYFMO3L.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-ZAZLJJMP.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-YSCUPIXR.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-34TJBB74.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-JW5465JV.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-JW5465JV.js");
13516
- const { reconcileLeasedPurchase } = await import("./reconcile-34TJBB74.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-3HL7LFTB.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,312 +25853,84 @@ 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 suggestBody(projectId, opts) {
25774
- if (opts.title === void 0) return { error: "--title is required" };
25775
- if (opts.brief === void 0) return { error: "--brief is required" };
25776
- const title = ProjectSuggestionTitleSchema.safeParse(opts.title);
25777
- if (!title.success) return { error: `--title: ${title.error.issues[0].message}` };
25778
- const brief = ProjectSuggestionBriefSchema.safeParse(opts.brief);
25779
- if (!brief.success) return { error: `--brief: ${brief.error.issues[0].message}` };
25780
- const body = { projectId, title: title.data, brief: brief.data };
25781
- if (opts.mode !== void 0) {
25782
- const mode = opts.mode.trim();
25783
- if (!GRANT_MODE_NAMES.includes(mode)) {
25784
- 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
+ };
25785
25870
  }
25786
- body.mode = mode;
25787
- }
25788
- if (opts.reward !== void 0) {
25789
- const reward = parseAmount(opts.reward, "--reward");
25790
- if (typeof reward !== "string") return reward;
25791
- body.reward = reward;
25792
25871
  }
25793
- 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 };
25794
25882
  }
25795
- function suggestionsQuery(opts) {
25796
- const params = new URLSearchParams();
25797
- if (opts.status !== void 0) {
25798
- const status = opts.status.trim();
25799
- if (!PROJECT_SUGGESTION_STATUSES.includes(status)) {
25800
- 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>" };
25801
25891
  }
25802
- params.set("status", status);
25892
+ return { continuation: null };
25803
25893
  }
25804
- if (opts.sort !== void 0) {
25805
- const sort = opts.sort.trim();
25806
- if (!PROJECT_SUGGESTION_SORTS.includes(sort)) {
25807
- return { error: `--sort must be ${PROJECT_SUGGESTION_SORTS.join(" or ")}` };
25808
- }
25809
- 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}` };
25810
25899
  }
25811
- if (opts.limit !== void 0) {
25812
- const limit = opts.limit.trim();
25813
- if (!/^[1-9][0-9]*$/.test(limit) || Number(limit) > PROJECT_SUGGESTIONS_LIST_MAX) {
25814
- return { error: `--limit must be an integer from 1 to ${PROJECT_SUGGESTIONS_LIST_MAX}` };
25815
- }
25816
- 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` };
25817
25905
  }
25818
- if (opts.cursor !== void 0) {
25819
- const cursor = opts.cursor.trim();
25820
- if (cursor.length === 0 || cursor.length > 512) {
25821
- 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 }
25822
25912
  }
25823
- params.set("cursor", cursor);
25824
- }
25825
- return params.toString();
25913
+ };
25826
25914
  }
25827
- function suggestionSettingsBody(projectId, opts) {
25828
- if (opts.suggestions === void 0 && opts.hostedOperators === void 0) return null;
25829
- const body = { projectId };
25830
- if (opts.suggestions !== void 0) {
25831
- const setting = parseSuggestionsSetting(opts.suggestions);
25832
- if (typeof setting !== "string") return setting;
25833
- body.suggestions = setting;
25834
- }
25835
- if (opts.hostedOperators !== void 0) {
25836
- const value = opts.hostedOperators.trim();
25837
- if (value !== "on" && value !== "off") return { error: "--hosted-operators must be on or off" };
25838
- body.hostedOperators = value === "on";
25839
- }
25840
- return body;
25915
+ function collect5(value, previous = []) {
25916
+ return [...previous, value];
25841
25917
  }
25842
- async function signedRead(path9) {
25843
- try {
25844
- const headers = (await signReadAuth())?.headers ?? {};
25845
- printResult(await apiGet(withChainId(path9), { headers }));
25846
- } catch (err) {
25847
- renderFailure(err);
25848
- }
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);
25849
25923
  }
25850
- var projectSuggestCommand = new Command128("suggest").description(
25851
- "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"
25852
- ).argument("<projectId>", "Project id").option("--title <text>", "Required: one line, 1 to 120 characters").option(
25853
- "--brief <text>",
25854
- "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"
25855
25927
  ).option(
25856
- "--mode <mode>",
25857
- `The task mode you suggest (${GRANT_MODE_NAMES.join(", ")}); the owner or operator decides`
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
25858
25931
  ).option(
25859
- "--reward <amount>",
25860
- "The reward you suggest, in the payment token (e.g. 5); the owner or operator decides"
25861
- ).action(async (id, opts) => {
25862
- const projectId = parseProjectId(id);
25863
- if (typeof projectId !== "number") return void printError(projectId.error);
25864
- const body = suggestBody(projectId, opts);
25865
- if ("error" in body) return void printError(String(body.error));
25866
- await postProjectWrite(`/api/projects/${projectId}/suggestions`, body, {
25867
- maxAmount: ACTION_FEE_MAX_AMOUNT
25868
- });
25869
- });
25870
- var projectSuggestionsCommand = new Command128("suggestions").description(
25871
- "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)"
25872
- ).argument("<projectId>", "Project id").option(
25873
- "--status <status>",
25874
- `Only suggestions in this status: ${PROJECT_SUGGESTION_STATUSES.join(", ")}`
25875
- ).option("--sort <sort>", "votes (default) or backed").option(
25876
- "--limit <count>",
25877
- `Suggestions per page (1-${PROJECT_SUGGESTIONS_LIST_MAX}, default ${PROJECT_SUGGESTIONS_LIST_DEFAULT})`
25878
- ).option(
25879
- "--cursor <cursor>",
25880
- "The next page: the previous page's nextCursor, with the same --status and --sort"
25881
- ).action(async (id, opts) => {
25882
- const projectId = parseProjectId(id);
25883
- if (typeof projectId !== "number") return void printError(projectId.error);
25884
- const query4 = suggestionsQuery(opts);
25885
- if (typeof query4 !== "string") return void printError(query4.error);
25886
- await signedRead(`/api/projects/${projectId}/suggestions${query4 ? `?${query4}` : ""}`);
25887
- });
25888
- var showCommand3 = new Command128("show").description("Show a suggestion with its status, votes and backedShares (free)").argument("<suggestionId>", "Suggestion id").action(async (value) => {
25889
- const id = parseSuggestionId(value);
25890
- if (typeof id !== "string") return void printError(id.error);
25891
- await signedRead(`/api/project-suggestions/${id}`);
25892
- });
25893
- function voteCommand(action, description) {
25894
- return new Command128(action).description(description).argument("<suggestionId>", "Suggestion id").action(async (value) => {
25895
- const suggestionId = parseSuggestionId(value);
25896
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25897
- const auth = await signReadAuth();
25898
- if (auth && Object.keys(auth.headers).length === 0) {
25899
- return void printError(`Could not sign with your wallet: ${auth.error ?? "unknown error"}`);
25900
- }
25901
- if (!auth) {
25902
- return void printError(
25903
- `${action === "vote" ? "Voting" : "Taking back a vote"} needs a wallet. Run \`taskmarket init\` first.`
25904
- );
25905
- }
25906
- try {
25907
- const chainId = selectedNetwork().chainId;
25908
- const proof = await signWalletWrite("project-suggestion-vote", {
25909
- action,
25910
- chainId,
25911
- suggestionId
25912
- });
25913
- const { data, idempotencyKey } = await apiPost(
25914
- `/api/project-suggestions/${suggestionId}/${action}`,
25915
- { chainId, suggestionId, ...proof },
25916
- { headers: auth.headers }
25917
- );
25918
- printResult(data, { idempotencyKey });
25919
- } catch (err) {
25920
- renderFailure(err);
25921
- }
25922
- });
25923
- }
25924
- 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) => {
25925
- const suggestionId = parseSuggestionId(value);
25926
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25927
- await postProjectWrite(
25928
- `/api/project-suggestions/${suggestionId}/withdraw`,
25929
- { suggestionId },
25930
- { maxAmount: ACTION_FEE_MAX_AMOUNT }
25931
- );
25932
- });
25933
- var declineCommand = new Command128("decline").description(
25934
- "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"
25935
- ).argument("<suggestionId>", "Suggestion id").option("--reason <text>", "Why, shown to everyone: up to 500 characters").action(async (value, opts) => {
25936
- const suggestionId = parseSuggestionId(value);
25937
- if (typeof suggestionId !== "string") return void printError(suggestionId.error);
25938
- const parsed = ProjectSuggestionDeclineSchema.safeParse({ suggestionId, reason: opts.reason });
25939
- if (!parsed.success) {
25940
- return void printError(`--reason: ${parsed.error.issues[0].message}`);
25941
- }
25942
- await postProjectWrite(
25943
- `/api/project-suggestions/${suggestionId}/decline`,
25944
- { suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
25945
- { maxAmount: ACTION_FEE_MAX_AMOUNT }
25946
- );
25947
- });
25948
- var projectSuggestionCommand = new Command128("suggestion").description(
25949
- "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"
25950
- ).addCommand(showCommand3).addCommand(
25951
- voteCommand(
25952
- "vote",
25953
- "Upvote a suggestion, as a wallet that may suggest on its project; one vote per wallet (free, signed by your wallet)"
25954
- )
25955
- ).addCommand(
25956
- voteCommand("unvote", "Take back your upvote on a suggestion (free, signed by your wallet)")
25957
- ).addCommand(withdrawCommand2).addCommand(declineCommand);
25958
- var projectSuggestionSettingsCommand = new Command128("suggestion-settings").description(
25959
- "Read or set the project's suggestions settings, as its owner: who may post and upvote suggestions (off, backers or anyone) 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"
25960
- ).argument("<projectId>", "Project id").option(
25961
- "--suggestions <setting>",
25962
- "off (no one), backers (the owner, operators and backers) or anyone (any wallet)"
25963
- ).option(
25964
- "--hosted-operators <on|off>",
25965
- "Whether hosted operators act on suggestions by themselves"
25966
- ).action(async (id, opts) => {
25967
- const projectId = parseProjectId(id);
25968
- if (typeof projectId !== "number") return void printError(projectId.error);
25969
- const body = suggestionSettingsBody(projectId, opts);
25970
- if (body === null) {
25971
- try {
25972
- const view = await apiGet(withChainId(`/api/projects/${projectId}`));
25973
- printResult({
25974
- chainId: view.project?.chainId,
25975
- projectId: view.project?.projectId ?? projectId,
25976
- suggestions: view.suggestions ?? null
25977
- });
25978
- } catch (err) {
25979
- renderFailure(err);
25980
- }
25981
- return;
25982
- }
25983
- if ("error" in body) return void printError(String(body.error));
25984
- await postProjectWrite(`/api/projects/${projectId}/suggestions/settings`, body, {
25985
- maxAmount: ACTION_FEE_MAX_AMOUNT
25986
- });
25987
- });
25988
-
25989
- // src/commands/project/add-task.ts
25990
- function deadlineCheck(durationHours, project, now = /* @__PURE__ */ new Date()) {
25991
- if (!project?.endsAt || !Number.isFinite(durationHours)) return null;
25992
- const endsAt = new Date(project.endsAt);
25993
- if (Number.isNaN(endsAt.getTime())) return null;
25994
- const deadline = new Date(now.getTime() + durationHours * 3600 * 1e3);
25995
- if (deadline.getTime() <= endsAt.getTime()) return null;
25996
- const grace = project.taskGraceSecs;
25997
- if (typeof grace === "number") {
25998
- const latest = new Date(endsAt.getTime() + grace * 1e3);
25999
- if (deadline.getTime() > latest.getTime()) {
26000
- return {
26001
- error: `This task's deadline (${deadline.toISOString()}) is past the project's end date plus its task grace period (${latest.toISOString()}); shorten --duration`
26002
- };
26003
- }
26004
- }
26005
- const warning = cliWarning(
26006
- "project_deadline_after_end",
26007
- "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.",
26008
- {
26009
- taskDeadline: deadline.toISOString(),
26010
- projectEndsAt: endsAt.toISOString(),
26011
- ...typeof grace === "number" ? { taskGraceSecs: grace } : {}
26012
- }
26013
- );
26014
- return { warning };
26015
- }
26016
- var TASK_ID2 = /^0x[0-9a-fA-F]{1,78}$/;
26017
- var SHA256 = /^(0x)?[0-9a-fA-F]{64}$/;
26018
- var INPUTS_MAX = 20;
26019
- function parseContinuation(flags) {
26020
- const inputs = flags.input ?? [];
26021
- if (flags.parent === void 0) {
26022
- if (inputs.length > 0 || flags.shareInputs) {
26023
- return { error: "--input and --share-inputs need --parent <taskId>" };
26024
- }
26025
- return { continuation: null };
26026
- }
26027
- const parentTaskId = flags.parent.trim();
26028
- if (!TASK_ID2.test(parentTaskId)) return { error: "--parent must be a 0x-prefixed hex task id" };
26029
- const bad = inputs.find((hash) => !SHA256.test(hash.trim()));
26030
- if (bad !== void 0) {
26031
- return { error: `--input must be a SHA-256 hash (64 hex characters): ${bad}` };
26032
- }
26033
- const artifacts = [
26034
- ...new Set(inputs.map((hash) => hash.trim().replace(/^0x/i, "").toLowerCase()))
26035
- ];
26036
- if (artifacts.length > INPUTS_MAX) {
26037
- return { error: `At most ${INPUTS_MAX} --input files` };
26038
- }
26039
- const shared = flags.shareInputs === true;
26040
- if (artifacts.length === 0 && !shared) return { continuation: { parentTaskId } };
26041
- return {
26042
- continuation: {
26043
- parentTaskId,
26044
- inputs: { ...artifacts.length > 0 ? { artifacts } : {}, shared }
26045
- }
26046
- };
26047
- }
26048
- function collect5(value, previous = []) {
26049
- return [...previous, value];
26050
- }
26051
- var projectAddTaskCommand = new Command129("add-task").description(
26052
- "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)"
26053
- ).argument("<projectId>", "Project id");
26054
- for (const option of createCmd.options) {
26055
- projectAddTaskCommand.addOption(option);
26056
- }
26057
- projectAddTaskCommand.option(
26058
- "--parent <taskId>",
26059
- "Continue this task, a task in the same project (accepted or not); its worker can read the inputs"
26060
- ).option(
26061
- "--input <sha256>",
26062
- "A file of the parent's accepted submissions, by SHA-256, as an input; repeat for more (default: the winning accepted submission's files)",
26063
- collect5
26064
- ).option(
26065
- "--share-inputs",
26066
- "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"
25932
+ "--share-inputs",
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"
26067
25934
  ).option(
26068
25935
  "--suggestion <id>",
26069
25936
  "Accept this open suggestion on the project: the task is linked to it and credits its author. As the owner or an operator with an accepted grant; normally refused before payment when the suggestion is not open, is on another project, or you are a hosted operator the owner keeps off suggestions"
@@ -26100,7 +25967,7 @@ projectAddTaskCommand.action(async (id, opts) => {
26100
25967
  });
26101
25968
 
26102
25969
  // src/commands/project/automations.ts
26103
- import { Command as Command130 } from "commander";
25970
+ import { Command as Command129 } from "commander";
26104
25971
  function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26105
25972
  if (opts.cap === void 0) {
26106
25973
  return { error: "--cap is required: the most the automations may draw from the budget" };
@@ -26129,7 +25996,7 @@ function automationsOnBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26129
25996
  }
26130
25997
  return body;
26131
25998
  }
26132
- var projectAutomationsOnCommand = new Command130("on").description(
25999
+ var projectAutomationsOnCommand = new Command129("on").description(
26133
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)"
26134
26001
  ).argument("<projectId>", "Project id").option(
26135
26002
  "--cap <amount>",
@@ -26157,7 +26024,7 @@ var projectAutomationsOnCommand = new Command130("on").description(
26157
26024
  });
26158
26025
  }
26159
26026
  );
26160
- var projectAutomationsOffCommand = new Command130("off").description(
26027
+ var projectAutomationsOffCommand = new Command129("off").description(
26161
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)"
26162
26029
  ).argument("<projectId>", "Project id").action(async (id) => {
26163
26030
  const projectId = parseProjectId(id);
@@ -26168,59 +26035,452 @@ var projectAutomationsOffCommand = new Command130("off").description(
26168
26035
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26169
26036
  );
26170
26037
  });
26171
- var projectAutomationsStatusCommand = new Command130("status").description(
26038
+ var projectAutomationsStatusCommand = new Command129("status").description(
26172
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)"
26173
26040
  ).argument("<projectId>", "Project id").action(async (id) => {
26174
26041
  const projectId = parseProjectId(id);
26175
26042
  if (typeof projectId !== "number") return void printError(projectId.error);
26176
26043
  try {
26177
- 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 });
26178
26410
  } catch (err) {
26179
26411
  renderFailure(err);
26180
26412
  }
26181
26413
  });
26182
- var projectAutomationsCommand = new Command130("automations").description(
26183
- "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"
26184
- ).addCommand(projectAutomationsOnCommand).addCommand(projectAutomationsOffCommand).addCommand(projectAutomationsStatusCommand);
26185
-
26186
- // src/commands/project/claim.ts
26187
- import { Command as Command131 } from "commander";
26188
- var projectClaimCommand = new Command131("claim").description(
26189
- "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)"
26190
- ).argument("<projectId>", "Project id").option("--backer <address>", "The backer to pay (default: your wallet)").action(async (id, opts) => {
26191
- const projectId = parseProjectId(id);
26192
- if (typeof projectId !== "number") return void printError(projectId.error);
26193
- const backer = opts.backer?.trim();
26194
- if (backer !== void 0 && (!ADDRESS.test(backer) || /^0x0{40}$/i.test(backer))) {
26195
- return void printError("Invalid Ethereum address for --backer");
26196
- }
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);
26197
26417
  await postProjectWrite(
26198
- `/api/projects/${projectId}/claim`,
26199
- {
26200
- projectId,
26201
- ...backer ? { backer } : {}
26202
- },
26418
+ `/api/project-suggestions/${suggestionId}/withdraw`,
26419
+ { suggestionId },
26203
26420
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26204
26421
  );
26205
26422
  });
26206
-
26207
- // src/commands/project/close.ts
26208
- import { Command as Command132 } from "commander";
26209
- var projectCloseCommand = new Command132("close").description(
26210
- "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)"
26211
- ).argument("<projectId>", "Project id").action(async (id) => {
26212
- const projectId = parseProjectId(id);
26213
- 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
+ }
26214
26432
  await postProjectWrite(
26215
- `/api/projects/${projectId}/close`,
26216
- { projectId },
26433
+ `/api/project-suggestions/${suggestionId}/decline`,
26434
+ { suggestionId, ...parsed.data.reason !== void 0 ? { reason: parsed.data.reason } : {} },
26217
26435
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26218
26436
  );
26219
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
+ });
26220
26481
 
26221
26482
  // src/commands/project/create.ts
26222
- import { Command as Command133 } from "commander";
26223
- var projectCreateCommand = new Command133("create").description(
26483
+ var projectCreateCommand = new Command134("create").description(
26224
26484
  "Open a project: one budget that funds tasks of any mode (costs the budget, in the payment token)"
26225
26485
  ).requiredOption("--budget <amount>", "Opening budget in the payment token (e.g. 50)").requiredOption(
26226
26486
  "--ends-at <time>",
@@ -26231,6 +26491,9 @@ var projectCreateCommand = new Command133("create").description(
26231
26491
  ).option("--name <text>", "A short name for the project: 1 to 80 characters of plain text").option("--goal <text>", "What the project is for: up to 500 characters of plain text").option(
26232
26492
  "--suggestions <setting>",
26233
26493
  "Who may post and upvote suggestions: off (no one), backers (the owner, operators and backers; the default) or anyone (any wallet). Change it later with `project suggestion-settings`"
26494
+ ).option(
26495
+ "--suggestions-min-backing <amount>",
26496
+ "Under backers, the least a wallet must have contributed to the project's pool to post and upvote suggestions, in the payment token: 1 by default, 0 admits any contribution"
26234
26497
  ).action(
26235
26498
  async (opts) => {
26236
26499
  const name = opts.name === void 0 ? void 0 : ProjectNameSchema.safeParse(opts.name);
@@ -26239,6 +26502,10 @@ var projectCreateCommand = new Command133("create").description(
26239
26502
  if (goal && !goal.success) return void printError(`--goal: ${goal.error.issues[0].message}`);
26240
26503
  const suggestions = opts.suggestions === void 0 ? void 0 : parseSuggestionsSetting(opts.suggestions);
26241
26504
  if (typeof suggestions === "object") return void printError(suggestions.error);
26505
+ const suggestionsMinBacking = opts.suggestionsMinBacking === void 0 ? void 0 : parseSuggestionsMinBacking(opts.suggestionsMinBacking);
26506
+ if (suggestionsMinBacking !== null && typeof suggestionsMinBacking === "object") {
26507
+ return void printError(suggestionsMinBacking.error);
26508
+ }
26242
26509
  const budget = parseAmount(opts.budget, "--budget");
26243
26510
  if (typeof budget !== "string") return void printError(budget.error);
26244
26511
  const endsAt = parseEndsAt(opts.endsAt);
@@ -26253,7 +26520,8 @@ var projectCreateCommand = new Command133("create").description(
26253
26520
  ...taskGraceSecs === void 0 ? {} : { taskGraceSecs },
26254
26521
  ...name?.success ? { name: name.data } : {},
26255
26522
  ...goal?.success ? { goal: goal.data } : {},
26256
- ...suggestions === void 0 ? {} : { suggestions }
26523
+ ...suggestions === void 0 ? {} : { suggestions },
26524
+ ...suggestionsMinBacking === void 0 ? {} : { suggestionsMinBacking }
26257
26525
  },
26258
26526
  { maxAmount: budget }
26259
26527
  );
@@ -26261,9 +26529,9 @@ var projectCreateCommand = new Command133("create").description(
26261
26529
  );
26262
26530
 
26263
26531
  // src/commands/project/extend.ts
26264
- import { Command as Command134 } from "commander";
26532
+ import { Command as Command135 } from "commander";
26265
26533
  var MAX_EXTENSION_MS = 365 * 24 * 3600 * 1e3;
26266
- var projectExtendCommand = new Command134("extend").description(
26534
+ var projectExtendCommand = new Command135("extend").description(
26267
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"
26268
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) => {
26269
26537
  const projectId = parseProjectId(id);
@@ -26281,8 +26549,8 @@ var projectExtendCommand = new Command134("extend").description(
26281
26549
  });
26282
26550
 
26283
26551
  // src/commands/project/fund.ts
26284
- import { Command as Command135 } from "commander";
26285
- var projectFundCommand = new Command135("fund").description(
26552
+ import { Command as Command136 } from "commander";
26553
+ var projectFundCommand = new Command136("fund").description(
26286
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)"
26287
26555
  ).argument("<projectId>", "Project id").requiredOption("--amount <amount>", "Amount in the payment token (e.g. 10)").option(
26288
26556
  "--on-behalf-of <address>",
@@ -26304,7 +26572,7 @@ var projectFundCommand = new Command135("fund").description(
26304
26572
  });
26305
26573
 
26306
26574
  // src/commands/project/grant.ts
26307
- import { Command as Command136 } from "commander";
26575
+ import { Command as Command137 } from "commander";
26308
26576
  function grantBody(projectId, opts) {
26309
26577
  if (!ADDRESS.test(opts.operator)) {
26310
26578
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -26327,7 +26595,7 @@ function grantBody(projectId, opts) {
26327
26595
  revokeRemovesControl: opts.revokeRemovesControl
26328
26596
  };
26329
26597
  }
26330
- var projectGrantCommand = new Command136("grant").description(
26598
+ var projectGrantCommand = new Command137("grant").description(
26331
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)"
26332
26600
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
26333
26601
  "--cap <amount>",
@@ -26353,7 +26621,7 @@ var projectGrantCommand = new Command136("grant").description(
26353
26621
  });
26354
26622
 
26355
26623
  // src/commands/project/review.ts
26356
- import { Command as Command137 } from "commander";
26624
+ import { Command as Command138 } from "commander";
26357
26625
  function reviewEvaluator(opts) {
26358
26626
  if (opts.evaluator !== void 0 && opts.off) {
26359
26627
  return { error: "Pass --evaluator <address> or --off, not both" };
@@ -26368,7 +26636,7 @@ function reviewEvaluator(opts) {
26368
26636
  }
26369
26637
  return opts.evaluator;
26370
26638
  }
26371
- var projectReviewCommand = new Command137("review").description(
26639
+ var projectReviewCommand = new Command138("review").description(
26372
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"
26373
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) => {
26374
26642
  const projectId = parseProjectId(id);
@@ -26410,8 +26678,8 @@ async function ownerEvaluatorWarnings(evaluator) {
26410
26678
  }
26411
26679
 
26412
26680
  // src/commands/project/raise-cap.ts
26413
- import { Command as Command138 } from "commander";
26414
- var projectRaiseCapCommand = new Command138("raise-cap").description(
26681
+ import { Command as Command139 } from "commander";
26682
+ var projectRaiseCapCommand = new Command139("raise-cap").description(
26415
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"
26416
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) => {
26417
26685
  const projectId = parseProjectId(id);
@@ -26429,8 +26697,8 @@ var projectRaiseCapCommand = new Command138("raise-cap").description(
26429
26697
  });
26430
26698
 
26431
26699
  // src/commands/project/lower-cap.ts
26432
- import { Command as Command139 } from "commander";
26433
- var projectLowerCapCommand = new Command139("lower-cap").description(
26700
+ import { Command as Command140 } from "commander";
26701
+ var projectLowerCapCommand = new Command140("lower-cap").description(
26434
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`"
26435
26703
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
26436
26704
  "--cap <amount>",
@@ -26452,7 +26720,7 @@ var projectLowerCapCommand = new Command139("lower-cap").description(
26452
26720
  });
26453
26721
 
26454
26722
  // src/commands/project/limits.ts
26455
- import { Command as Command140 } from "commander";
26723
+ import { Command as Command141 } from "commander";
26456
26724
  function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26457
26725
  if (!ADDRESS.test(opts.operator)) {
26458
26726
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
@@ -26492,7 +26760,7 @@ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
26492
26760
  }
26493
26761
  return body;
26494
26762
  }
26495
- var projectLimitsCommand = new Command140("limits").description(
26763
+ var projectLimitsCommand = new Command141("limits").description(
26496
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"
26497
26765
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
26498
26766
  "--expires <time>",
@@ -26514,8 +26782,8 @@ var projectLimitsCommand = new Command140("limits").description(
26514
26782
  });
26515
26783
 
26516
26784
  // src/commands/project/revoke.ts
26517
- import { Command as Command141 } from "commander";
26518
- var projectRevokeCommand = new Command141("revoke").description(
26785
+ import { Command as Command142 } from "commander";
26786
+ var projectRevokeCommand = new Command142("revoke").description(
26519
26787
  "End an operator's right to create tasks from the project, as its owner (costs 0.001 in the payment token)"
26520
26788
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator to revoke").action(async (id, opts) => {
26521
26789
  const projectId = parseProjectId(id);
@@ -26534,7 +26802,7 @@ var projectRevokeCommand = new Command141("revoke").description(
26534
26802
  });
26535
26803
 
26536
26804
  // src/commands/project/schedule.ts
26537
- import { Command as Command143 } from "commander";
26805
+ import { Command as Command145 } from "commander";
26538
26806
 
26539
26807
  // src/lib/owner-list.ts
26540
26808
  import { getAddress as getAddress2, isAddress as isAddress5 } from "viem";
@@ -26573,10 +26841,234 @@ function ownerListQuery(owner, opts, statuses) {
26573
26841
  return params.toString();
26574
26842
  }
26575
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
+
26576
27068
  // src/commands/workflow-template.ts
26577
27069
  import { readFile as readFile4 } from "fs/promises";
26578
- import { Command as Command142 } from "commander";
26579
- 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}$/;
26580
27072
  var ADDRESS2 = /^0x[0-9a-fA-F]{40}$/;
26581
27073
  var FILE_MAX_BYTES = 256 * 1024;
26582
27074
  var PARAM_NAME = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
@@ -26603,7 +27095,7 @@ function templateChoice(value) {
26603
27095
  if (WORKFLOW_PRESET_NAMES.includes(trimmed)) {
26604
27096
  return { preset: trimmed };
26605
27097
  }
26606
- if (UUID2.test(trimmed)) return { templateId: trimmed.toLowerCase() };
27098
+ if (UUID3.test(trimmed)) return { templateId: trimmed.toLowerCase() };
26607
27099
  if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(trimmed)) return { templateId: trimmed };
26608
27100
  return {
26609
27101
  error: `--template is a saved template id (UUID), an official template id (official:<slug>) or a preset: ${WORKFLOW_PRESET_NAMES.join(", ")}`
@@ -26669,7 +27161,7 @@ async function readValidTemplate(path9) {
26669
27161
  }
26670
27162
  return parsed.document;
26671
27163
  }
26672
- var createCommand3 = new Command142("create").description(
27164
+ var createCommand3 = new Command144("create").description(
26673
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"
26674
27166
  ).requiredOption("--file <path>", "The template, JSON").action(async (opts) => {
26675
27167
  const template = await readValidTemplate(opts.file);
@@ -26680,7 +27172,7 @@ var createCommand3 = new Command142("create").description(
26680
27172
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26681
27173
  );
26682
27174
  });
26683
- var updateCommand = new Command142("update").description(
27175
+ var updateCommand = new Command144("update").description(
26684
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"
26685
27177
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
26686
27178
  const choice = templateChoice(value);
@@ -26734,7 +27226,7 @@ function parseTemplateSearch(opts) {
26734
27226
  }
26735
27227
  return { query: query4 };
26736
27228
  }
26737
- var listCommand6 = new Command142("list").description(
27229
+ var listCommand6 = new Command144("list").description(
26738
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`"
26739
27231
  ).option("--owner <address>", "The wallet whose templates to list").option(
26740
27232
  "--mine",
@@ -26819,7 +27311,7 @@ var listCommand6 = new Command142("list").description(
26819
27311
  }
26820
27312
  }
26821
27313
  );
26822
- var showCommand4 = new Command142("show").description(
27314
+ var showCommand4 = new Command144("show").description(
26823
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)"
26824
27316
  ).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
26825
27317
  const choice = templateChoice(value);
@@ -26842,7 +27334,7 @@ function savedTemplateId(value, verb) {
26842
27334
  }
26843
27335
  return choice.templateId;
26844
27336
  }
26845
- var publishCommand = new Command142("publish").description(
27337
+ var publishCommand = new Command144("publish").description(
26846
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"
26847
27339
  ).argument("<templateId>", "Saved template id").action(async (value) => {
26848
27340
  const id = savedTemplateId(value, "publish");
@@ -26853,7 +27345,7 @@ var publishCommand = new Command142("publish").description(
26853
27345
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26854
27346
  );
26855
27347
  });
26856
- var unpublishCommand = new Command142("unpublish").description(
27348
+ var unpublishCommand = new Command144("unpublish").description(
26857
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"
26858
27350
  ).argument("<templateId>", "Saved template id").action(async (value) => {
26859
27351
  const id = savedTemplateId(value, "unpublish");
@@ -26864,7 +27356,7 @@ var unpublishCommand = new Command142("unpublish").description(
26864
27356
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26865
27357
  );
26866
27358
  });
26867
- var deleteCommand2 = new Command142("delete").description(
27359
+ var deleteCommand2 = new Command144("delete").description(
26868
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"
26869
27361
  ).argument("<templateId>", "Template id").action(async (value) => {
26870
27362
  const choice = templateChoice(value);
@@ -26881,7 +27373,7 @@ var deleteCommand2 = new Command142("delete").description(
26881
27373
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26882
27374
  );
26883
27375
  });
26884
- var workflowTemplateCommand = new Command142("template").description(
27376
+ var workflowTemplateCommand = new Command144("template").description(
26885
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"
26886
27378
  ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand4).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
26887
27379
  async function createWorkflowFromTemplate(projectId, template, pairs) {
@@ -26901,19 +27393,41 @@ async function createWorkflowFromTemplate(projectId, template, pairs) {
26901
27393
  }
26902
27394
 
26903
27395
  // src/commands/project/schedule.ts
26904
- 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}$/;
26905
27396
  var STATUSES = ["active", "paused", "cancelled", "completed"];
26906
- function positiveNumber2(value, flag) {
26907
- const parsed = Number(value);
26908
- if (!Number.isFinite(parsed) || parsed <= 0)
26909
- return { error: `${flag} must be a positive number` };
26910
- return parsed;
26911
- }
26912
27397
  function scheduleCreateBody(projectId, opts, workflow) {
26913
27398
  const cadence = parseScheduleCadence(opts.cadence);
26914
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
+ }
26915
27407
  let target;
26916
- 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) {
26917
27431
  const taskFlag = TASK_TEMPLATE_FLAGS.find(([, key]) => opts[key] !== void 0);
26918
27432
  if (taskFlag) {
26919
27433
  return { error: `${taskFlag[0]} describes a task; a workflow schedule takes none` };
@@ -26980,44 +27494,11 @@ function taskTemplate(opts) {
26980
27494
  reward,
26981
27495
  duration,
26982
27496
  mode,
26983
- tags: opts.tags ? opts.tags.split(",").map((tag) => tag.trim()).filter(Boolean) : []
27497
+ tags: parseTags(opts.tags)
26984
27498
  };
26985
- const evaluatorOnly = [
26986
- ["--evaluator-fee-bps", opts.evaluatorFeeBps],
26987
- ["--evaluator-stake", opts.evaluatorStake],
26988
- ["--evaluation-window", opts.evaluationWindow],
26989
- ["--appeal-window", opts.appealWindow]
26990
- ];
26991
- if (opts.evaluator === void 0) {
26992
- const stray = evaluatorOnly.find(([, value]) => value !== void 0);
26993
- if (stray) return { error: `${stray[0]} needs --evaluator` };
26994
- } else {
26995
- if (!ADDRESS.test(opts.evaluator)) {
26996
- return { error: "--evaluator must be a wallet address (0x + 40 hex chars)" };
26997
- }
26998
- template.evaluator = opts.evaluator;
26999
- if (opts.evaluatorFeeBps !== void 0) {
27000
- if (!/^\d+$/.test(opts.evaluatorFeeBps) || Number(opts.evaluatorFeeBps) > 1e4) {
27001
- return { error: "--evaluator-fee-bps must be an integer from 0 to 10000" };
27002
- }
27003
- template.evaluatorFeeBps = Number(opts.evaluatorFeeBps);
27004
- }
27005
- if (opts.evaluatorStake !== void 0) {
27006
- const stake = parseAmount(opts.evaluatorStake, "--evaluator-stake");
27007
- if (typeof stake !== "string") return stake;
27008
- template.evaluatorStake = stake;
27009
- }
27010
- for (const [flag, value, field] of [
27011
- ["--evaluation-window", opts.evaluationWindow, "evaluationWindowHours"],
27012
- ["--appeal-window", opts.appealWindow, "appealWindowHours"]
27013
- ]) {
27014
- if (value === void 0) continue;
27015
- const hours = positiveNumber2(value, flag);
27016
- if (typeof hours !== "number") return hours;
27017
- template[field] = hours;
27018
- }
27019
- }
27020
- return template;
27499
+ const terms = evaluatorTerms(opts);
27500
+ if ("error" in terms) return terms;
27501
+ return { ...template, ...terms };
27021
27502
  }
27022
27503
  async function resolveWorkflowTarget(projectId, opts) {
27023
27504
  const pairs = opts.param ?? [];
@@ -27044,7 +27525,7 @@ async function resolveWorkflowTarget(projectId, opts) {
27044
27525
  return { preset: value, ...params };
27045
27526
  }
27046
27527
  if (OFFICIAL_WORKFLOW_TEMPLATE_ID.test(value)) return { templateId: value, ...params };
27047
- if (!UUID3.test(value)) {
27528
+ if (!UUID2.test(value)) {
27048
27529
  return {
27049
27530
  error: `--workflow is a preset (${WORKFLOW_PRESET_NAMES.join(", ")}), an official template id (official:<slug>), a saved template id or a workflow id`
27050
27531
  };
@@ -27084,44 +27565,52 @@ function scheduleSettingsBody(projectId, opts) {
27084
27565
  }
27085
27566
  return body;
27086
27567
  }
27087
- function scheduleId(value) {
27088
- return UUID3.test(value.trim()) ? value.trim().toLowerCase() : { error: "The schedule id must be a UUID" };
27089
- }
27090
- async function read(path9) {
27568
+ async function read2(path9) {
27091
27569
  try {
27092
27570
  printResult(await apiGet(path9));
27093
27571
  } catch (err) {
27094
27572
  renderFailure(err);
27095
27573
  }
27096
27574
  }
27097
- var createCommand4 = new Command143("create").description(
27098
- "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"
27099
- ).argument("<projectId>", "Project id").requiredOption(
27100
- "--cadence <cadence>",
27101
- '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'
27102
- ).option(
27103
- "--workflow <workflow>",
27104
- "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"
27105
- ).option(
27106
- "--param <name=value>",
27107
- "A preset or template parameter value for --workflow; repeat it for each",
27108
- collect6,
27109
- []
27110
- ).option("--workflow-file <path>", "Run this workflow document (JSON) each slot").option("--description <text>", "Each task's description (task schedules)").option(
27111
- "--reward <amount>",
27112
- "Each task's reward in the payment token (e.g. 5), from the budget (task schedules)"
27113
- ).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(
27114
- "--evaluator-stake <amount>",
27115
- "Stake behind the evaluator, from the budget (needs --evaluator)"
27116
- ).option("--evaluation-window <hours>", "Evaluation window in hours (needs --evaluator)").option("--appeal-window <hours>", "Appeal window in hours (needs --evaluator)").option(
27117
- "--runs <count>",
27118
- "How many tasks to create (default: until cancelled or the project ends)"
27119
- ).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) => {
27120
27609
  const projectId = parseProjectId(id);
27121
27610
  if (typeof projectId !== "number") return void printError(projectId.error);
27122
- let workflow;
27611
+ let workflow = null;
27123
27612
  try {
27124
- workflow = await resolveWorkflowTarget(projectId, opts);
27613
+ if (!opts.suggestions) workflow = await resolveWorkflowTarget(projectId, opts);
27125
27614
  } catch (err) {
27126
27615
  return void renderFailure(err);
27127
27616
  }
@@ -27133,7 +27622,7 @@ var createCommand4 = new Command143("create").description(
27133
27622
  });
27134
27623
  });
27135
27624
  var OWNER_SCHEDULE_STATUSES = [...STATUSES, "needs_action", "all"];
27136
- var listCommand7 = new Command143("list").description(
27625
+ var listCommand7 = new Command145("list").description(
27137
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)"
27138
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(
27139
27628
  "--status <status>",
@@ -27144,7 +27633,7 @@ var listCommand7 = new Command143("list").description(
27144
27633
  if (owner) {
27145
27634
  const query5 = ownerListQuery(owner.owner, opts, OWNER_SCHEDULE_STATUSES);
27146
27635
  if (typeof query5 !== "string") return void printError(query5.error);
27147
- return void await read(withChainId(`/api/schedules?${query5}`));
27636
+ return void await read2(withChainId(`/api/schedules?${query5}`));
27148
27637
  }
27149
27638
  if (id === void 0) {
27150
27639
  return void printError("Pass a project id, or --mine / --owner <address>");
@@ -27164,18 +27653,18 @@ var listCommand7 = new Command143("list").description(
27164
27653
  if (opts.status) params.set("status", opts.status);
27165
27654
  if (opts.limit) params.set("limit", opts.limit.trim());
27166
27655
  const query4 = params.toString();
27167
- await read(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
27656
+ await read2(withChainId(`/api/projects/${projectId}/schedules${query4 ? `?${query4}` : ""}`));
27168
27657
  });
27169
- var showCommand5 = new Command143("show").description(
27170
- "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)"
27171
27660
  ).argument("<scheduleId>", "Schedule id").action(async (value) => {
27172
- const id = scheduleId(value);
27661
+ const id = parseScheduleId(value);
27173
27662
  if (typeof id !== "string") return void printError(id.error);
27174
- await read(`/api/project-schedules/${id}`);
27663
+ await read2(`/api/project-schedules/${id}`);
27175
27664
  });
27176
27665
  function actionCommand(action, description) {
27177
- return new Command143(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
27178
- const id = scheduleId(value);
27666
+ return new Command145(action).description(description).argument("<scheduleId>", "Schedule id").action(async (value) => {
27667
+ const id = parseScheduleId(value);
27179
27668
  if (typeof id !== "string") return void printError(id.error);
27180
27669
  await postProjectWrite(
27181
27670
  `/api/project-schedules/${id}/${action}`,
@@ -27184,7 +27673,7 @@ function actionCommand(action, description) {
27184
27673
  );
27185
27674
  });
27186
27675
  }
27187
- var settingsCommand = new Command143("settings").description(
27676
+ var settingsCommand = new Command145("settings").description(
27188
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"
27189
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) => {
27190
27679
  const projectId = parseProjectId(id);
@@ -27206,8 +27695,8 @@ var settingsCommand = new Command143("settings").description(
27206
27695
  maxAmount: ACTION_FEE_MAX_AMOUNT
27207
27696
  });
27208
27697
  });
27209
- var projectScheduleCommand = new Command143("schedule").description(
27210
- "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>`)"
27211
27700
  ).addCommand(createCommand4).addCommand(listCommand7).addCommand(showCommand5).addCommand(
27212
27701
  actionCommand(
27213
27702
  "pause",
@@ -27228,16 +27717,16 @@ var projectScheduleCommand = new Command143("schedule").description(
27228
27717
  "stop-auto-payout",
27229
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)"
27230
27719
  )
27231
- ).addCommand(settingsCommand);
27232
- var projectRunnerCommand = new Command143("runner").description(
27720
+ ).addCommand(settingsCommand).addCommand(suggestionScheduleSettingsCommand);
27721
+ var projectRunnerCommand = new Command145("runner").description(
27233
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"
27234
27723
  ).action(async () => {
27235
- await read(withChainId("/api/project-runner"));
27724
+ await read2(withChainId("/api/project-runner"));
27236
27725
  });
27237
27726
 
27238
27727
  // src/commands/project/transfer.ts
27239
- import { Command as Command144 } from "commander";
27240
- var proposeCommand = new Command144("propose").description(
27728
+ import { Command as Command146 } from "commander";
27729
+ var proposeCommand = new Command146("propose").description(
27241
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"
27242
27731
  ).argument("<projectId>", "Project id").requiredOption("--to <address>", "The wallet that will own the project once it accepts").action(async (id, opts) => {
27243
27732
  const projectId = parseProjectId(id);
@@ -27251,7 +27740,7 @@ var proposeCommand = new Command144("propose").description(
27251
27740
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27252
27741
  );
27253
27742
  });
27254
- var acceptCommand2 = new Command144("accept").description(
27743
+ var acceptCommand2 = new Command146("accept").description(
27255
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"
27256
27745
  ).argument("<projectId>", "Project id").action(async (id) => {
27257
27746
  const projectId = parseProjectId(id);
@@ -27262,7 +27751,7 @@ var acceptCommand2 = new Command144("accept").description(
27262
27751
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27263
27752
  );
27264
27753
  });
27265
- var cancelCommand = new Command144("cancel").description(
27754
+ var cancelCommand = new Command146("cancel").description(
27266
27755
  "Withdraw the pending ownership proposal, as the project owner (costs 0.001 in the payment token)"
27267
27756
  ).argument("<projectId>", "Project id").action(async (id) => {
27268
27757
  const projectId = parseProjectId(id);
@@ -27273,13 +27762,13 @@ var cancelCommand = new Command144("cancel").description(
27273
27762
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27274
27763
  );
27275
27764
  });
27276
- var projectTransferCommand = new Command144("transfer").description(
27765
+ var projectTransferCommand = new Command146("transfer").description(
27277
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"
27278
27767
  ).addCommand(proposeCommand).addCommand(acceptCommand2).addCommand(cancelCommand);
27279
27768
 
27280
27769
  // src/commands/project/show.ts
27281
- import { Command as Command145 } from "commander";
27282
- var projectShowCommand = new Command145("show").description(
27770
+ import { Command as Command147 } from "commander";
27771
+ var projectShowCommand = new Command147("show").description(
27283
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)"
27284
27773
  ).argument("<projectId>", "Project id").action(async (id) => {
27285
27774
  const projectId = parseProjectId(id);
@@ -27288,7 +27777,7 @@ var projectShowCommand = new Command145("show").description(
27288
27777
  printResult(await apiGet(withChainId(`/api/projects/${projectId}`), { headers }));
27289
27778
  });
27290
27779
  var BACKERS_CURSOR = /^\d{1,20}-\d{1,9}$/;
27291
- var projectBackersCommand = new Command145("backers").description(
27780
+ var projectBackersCommand = new Command147("backers").description(
27292
27781
  "List a project's backers, newest first, with each one's contribution, shares, claims and claimable share (free)"
27293
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) => {
27294
27783
  const projectId = parseProjectId(id);
@@ -27307,13 +27796,13 @@ var projectBackersCommand = new Command145("backers").description(
27307
27796
  await apiGet(withChainId(`/api/projects/${projectId}/backers${query4 ? `?${query4}` : ""}`))
27308
27797
  );
27309
27798
  });
27310
- 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) => {
27311
27800
  if (!/^0x[0-9a-fA-F]{1,78}$/.test(taskId.trim())) {
27312
27801
  return void printError("The task id must be 0x-prefixed hex");
27313
27802
  }
27314
27803
  printResult(await apiGet(`/api/projects/by-task/${encodeURIComponent(taskId.trim())}`));
27315
27804
  });
27316
- var projectListCommand = new Command145("list").description(
27805
+ var projectListCommand = new Command147("list").description(
27317
27806
  "List a wallet's projects, as owner, operator or backer, or with --funding the projects open for backing now (free; default: your wallet)"
27318
27807
  ).option(
27319
27808
  "--funding",
@@ -27364,7 +27853,7 @@ var projectListCommand = new Command145("list").description(
27364
27853
  );
27365
27854
 
27366
27855
  // src/commands/project/index.ts
27367
- var projectCommand = new Command146("project").description(
27856
+ var projectCommand = new Command148("project").description(
27368
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"
27369
27858
  );
27370
27859
  projectCommand.addCommand(projectCreateCommand);
@@ -27395,7 +27884,7 @@ projectCommand.addCommand(projectForTaskCommand);
27395
27884
 
27396
27885
  // src/commands/workflow.ts
27397
27886
  import { readFile as readFile5 } from "fs/promises";
27398
- import { Command as Command147 } from "commander";
27887
+ import { Command as Command149 } from "commander";
27399
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}$/;
27400
27889
  var FILE_MAX_BYTES2 = 256 * 1024;
27401
27890
  function parseWorkflowText(text) {
@@ -27433,7 +27922,7 @@ function stepKey(value) {
27433
27922
  }
27434
27923
  return trimmed;
27435
27924
  }
27436
- async function read2(path9) {
27925
+ async function read3(path9) {
27437
27926
  try {
27438
27927
  printResult(await apiGet(path9));
27439
27928
  } catch (err) {
@@ -27459,7 +27948,7 @@ async function projectContext(projectId) {
27459
27948
  runner
27460
27949
  };
27461
27950
  }
27462
- var validateCommand = new Command147("validate").description(
27951
+ var validateCommand = new Command149("validate").description(
27463
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)"
27464
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) => {
27465
27954
  const parsed = await readDocument(opts.file ?? file);
@@ -27502,7 +27991,7 @@ var validateCommand = new Command147("validate").description(
27502
27991
  document: result.document
27503
27992
  });
27504
27993
  });
27505
- var createCommand5 = new Command147("create").description(
27994
+ var createCommand5 = new Command149("create").description(
27506
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"
27507
27996
  ).argument("<projectId>", "Project id").option("--file <path>", "The document, JSON").option(
27508
27997
  "--template <template>",
@@ -27545,7 +28034,7 @@ var createCommand5 = new Command147("create").description(
27545
28034
  );
27546
28035
  });
27547
28036
  var OWNER_WORKFLOW_STATUSES = ["needs_action", "running", "failed", "idle", "all"];
27548
- var listCommand8 = new Command147("list").description(
28037
+ var listCommand8 = new Command149("list").description(
27549
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)"
27550
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(
27551
28040
  "--status <status>",
@@ -27556,7 +28045,7 @@ var listCommand8 = new Command147("list").description(
27556
28045
  if (owner) {
27557
28046
  const query5 = ownerListQuery(owner.owner, opts, OWNER_WORKFLOW_STATUSES);
27558
28047
  if (typeof query5 !== "string") return void printError(query5.error);
27559
- return void await read2(withChainId(`/api/workflows?${query5}`));
28048
+ return void await read3(withChainId(`/api/workflows?${query5}`));
27560
28049
  }
27561
28050
  if (id === void 0) {
27562
28051
  return void printError("Pass a project id, or --mine / --owner <address>");
@@ -27573,9 +28062,9 @@ var listCommand8 = new Command147("list").description(
27573
28062
  if (opts.limit) params.set("limit", opts.limit.trim());
27574
28063
  if (opts.cursor) params.set("cursor", opts.cursor.trim());
27575
28064
  const query4 = params.toString();
27576
- await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
28065
+ await read3(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
27577
28066
  });
27578
- var showCommand6 = new Command147("show").description(
28067
+ var showCommand6 = new Command149("show").description(
27579
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)"
27580
28069
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27581
28070
  const id = uuid(value, "workflow");
@@ -27588,7 +28077,7 @@ var showCommand6 = new Command147("show").description(
27588
28077
  renderFailure(err);
27589
28078
  }
27590
28079
  });
27591
- var updateTemplateCommand = new Command147("update-template").description(
28080
+ var updateTemplateCommand = new Command149("update-template").description(
27592
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"
27593
28082
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27594
28083
  const id = uuid(value, "workflow");
@@ -27599,7 +28088,7 @@ var updateTemplateCommand = new Command147("update-template").description(
27599
28088
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27600
28089
  );
27601
28090
  });
27602
- 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) => {
27603
28092
  const id = uuid(value, "workflow");
27604
28093
  if (typeof id !== "string") return void printError(id.error);
27605
28094
  if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
@@ -27609,16 +28098,16 @@ var runsCommand = new Command147("runs").description("Page through a workflow's
27609
28098
  if (opts.limit) params.set("limit", opts.limit.trim());
27610
28099
  if (opts.cursor) params.set("cursor", opts.cursor.trim());
27611
28100
  const query4 = params.toString();
27612
- await read2(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
28101
+ await read3(`/api/project-workflows/${id}/runs${query4 ? `?${query4}` : ""}`);
27613
28102
  });
27614
- var statusCommand3 = new Command147("status").description(
28103
+ var statusCommand3 = new Command149("status").description(
27615
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)"
27616
28105
  ).argument("<runId>", "Run id").action(async (value) => {
27617
28106
  const id = uuid(value, "run");
27618
28107
  if (typeof id !== "string") return void printError(id.error);
27619
- await read2(`/api/project-workflow-runs/${id}`);
28108
+ await read3(`/api/project-workflow-runs/${id}`);
27620
28109
  });
27621
- var runCommand2 = new Command147("run").description(
28110
+ var runCommand2 = new Command149("run").description(
27622
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"
27623
28112
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27624
28113
  const id = uuid(value, "workflow");
@@ -27630,7 +28119,7 @@ var runCommand2 = new Command147("run").description(
27630
28119
  );
27631
28120
  });
27632
28121
  function stepCommand(action, description) {
27633
- return new Command147(action).description(description).argument("<runId>", "Run id").requiredOption(
28122
+ return new Command149(action).description(description).argument("<runId>", "Run id").requiredOption(
27634
28123
  "--step <key>",
27635
28124
  "The step key the run shows, e.g. gate-1, review[round=2] or post[attempt=2]"
27636
28125
  ).action(async (value, opts) => {
@@ -27645,7 +28134,7 @@ function stepCommand(action, description) {
27645
28134
  );
27646
28135
  });
27647
28136
  }
27648
- var cancelCommand2 = new Command147("cancel").description(
28137
+ var cancelCommand2 = new Command149("cancel").description(
27649
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"
27650
28139
  ).argument("<runId>", "Run id").action(async (value) => {
27651
28140
  const id = uuid(value, "run");
@@ -27656,7 +28145,7 @@ var cancelCommand2 = new Command147("cancel").description(
27656
28145
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27657
28146
  );
27658
28147
  });
27659
- var stopAutoPayoutCommand = new Command147("stop-auto-payout").description(
28148
+ var stopAutoPayoutCommand = new Command149("stop-auto-payout").description(
27660
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"
27661
28150
  ).argument("<runId>", "Run id").action(async (value) => {
27662
28151
  const id = uuid(value, "run");
@@ -27667,7 +28156,7 @@ var stopAutoPayoutCommand = new Command147("stop-auto-payout").description(
27667
28156
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27668
28157
  );
27669
28158
  });
27670
- var deleteCommand3 = new Command147("delete").description(
28159
+ var deleteCommand3 = new Command149("delete").description(
27671
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"
27672
28161
  ).argument("<workflowId>", "Workflow id").action(async (value) => {
27673
28162
  const id = uuid(value, "workflow");
@@ -27689,21 +28178,21 @@ async function ownerRead(path9) {
27689
28178
  renderFailure(err);
27690
28179
  }
27691
28180
  }
27692
- var payoutListCommand = new Command147("list").description(
27693
- "A run's payout proposals: what each accepted gating review recommends paying on the task it gates, with the exact accept confirming sends; visible to the project's owner and operators only (signed with your wallet); status is pending, confirmed, auto_paid (payout: auto, with mode, txHash and intentId) or unavailable (free)"
28181
+ var payoutListCommand = new Command149("list").description(
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)"
27694
28183
  ).argument("<runId>", "Run id").action(async (value) => {
27695
28184
  const id = uuid(value, "run");
27696
28185
  if (typeof id !== "string") return void printError(id.error);
27697
28186
  await ownerRead(withChainId(`/api/project-workflow-runs/${id}/payouts`));
27698
28187
  });
27699
- var payoutShowCommand = new Command147("show").description(
27700
- "Show a payout proposal: its status (pending, confirmed, auto_paid or unavailable), mode, txHash and intentId once sent, the ranking and rationale, and `accept`, the winners and shares (basis points) confirming sends; owner and operators only (free)"
28188
+ var payoutShowCommand = new Command149("show").description(
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)"
27701
28190
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
27702
28191
  const id = uuid(value, "payout proposal");
27703
28192
  if (typeof id !== "string") return void printError(id.error);
27704
28193
  await ownerRead(withChainId(`/api/project-workflow-payouts/${id}`));
27705
28194
  });
27706
- var payoutConfirmCommand = new Command147("confirm").description(
28195
+ var payoutConfirmCommand = new Command149("confirm").description(
27707
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`"
27708
28197
  ).argument("<proposalId>", "Payout proposal id").action(async (value) => {
27709
28198
  const id = uuid(value, "payout proposal");
@@ -27726,10 +28215,10 @@ var payoutConfirmCommand = new Command147("confirm").description(
27726
28215
  { maxAmount: ACTION_FEE_MAX_AMOUNT, extra: { accept: view.accept } }
27727
28216
  );
27728
28217
  });
27729
- var payoutCommand = new Command147("payout").description(
28218
+ var payoutCommand = new Command149("payout").description(
27730
28219
  "Payout proposals: a gating review's recommended winners and shares for the task it gates, which the owner confirms"
27731
28220
  ).addCommand(payoutListCommand).addCommand(payoutShowCommand).addCommand(payoutConfirmCommand);
27732
- var settingsCommand2 = new Command147("settings").description(
28221
+ var settingsCommand2 = new Command149("settings").description(
27733
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`
27734
28223
  ).argument("<projectId>", "Project id").option("--step-limit <count>", "The most task steps per workflow").action(async (id, opts) => {
27735
28224
  const projectId = parseProjectId(id);
@@ -27760,7 +28249,7 @@ var settingsCommand2 = new Command147("settings").description(
27760
28249
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
27761
28250
  );
27762
28251
  });
27763
- var workflowCommand = new Command147("workflow").description(
28252
+ var workflowCommand = new Command149("workflow").description(
27764
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"
27765
28254
  ).addCommand(validateCommand).addCommand(createCommand5).addCommand(listCommand8).addCommand(showCommand6).addCommand(runsCommand).addCommand(runCommand2).addCommand(statusCommand3).addCommand(
27766
28255
  stepCommand(
@@ -27775,8 +28264,8 @@ var workflowCommand = new Command147("workflow").description(
27775
28264
  ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27776
28265
 
27777
28266
  // src/commands/drops.ts
27778
- import { Command as Command148 } from "commander";
27779
- 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(
27780
28269
  async (opts) => {
27781
28270
  try {
27782
28271
  if (opts.worker && opts.entered) throw new Error("Pass --worker or --entered, not both");
@@ -27804,7 +28293,7 @@ var listCommand9 = new Command148("list").description("List public Task Drops, o
27804
28293
  }
27805
28294
  }
27806
28295
  );
27807
- 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) => {
27808
28297
  try {
27809
28298
  const input = parseInput(TaskDropGetInputSchema, { taskDropId });
27810
28299
  const result = await apiGet(`/api/task-drops/${encodeURIComponent(input.taskDropId)}`);
@@ -27816,7 +28305,7 @@ var showCommand7 = new Command148("show").description("Show a Task Drop and its
27816
28305
  renderFailure(err);
27817
28306
  }
27818
28307
  });
27819
- 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(
27820
28309
  async (taskDropId, opts) => {
27821
28310
  try {
27822
28311
  if (opts.official) {
@@ -27844,7 +28333,7 @@ var subscribeCommand = new Command148("subscribe").description("Subscribe an ema
27844
28333
  }
27845
28334
  }
27846
28335
  );
27847
- 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) => {
27848
28337
  try {
27849
28338
  if (opts.official) {
27850
28339
  if (taskDropId) throw new Error("Pass either a Task Drop ID or --official, not both");
@@ -27861,15 +28350,15 @@ var statusCommand4 = new Command148("status").description("Check whether an emai
27861
28350
  renderFailure(err);
27862
28351
  }
27863
28352
  });
27864
- 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);
27865
28354
 
27866
28355
  // src/commands/hooks.ts
27867
- import { Command as Command150 } from "commander";
28356
+ import { Command as Command152 } from "commander";
27868
28357
  import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
27869
28358
 
27870
28359
  // src/lib/listing-submissions.ts
27871
28360
  import { readFile as readFile6 } from "fs/promises";
27872
- import { Command as Command149 } from "commander";
28361
+ import { Command as Command151 } from "commander";
27873
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.";
27874
28363
  function prepareListingFile(kind, text) {
27875
28364
  if (Buffer.byteLength(text, "utf8") > LISTING_SUBMISSION_MAX_BYTES) {
@@ -27926,7 +28415,7 @@ function prepareListingFile(kind, text) {
27926
28415
  }
27927
28416
  function submitCommandFor(kind) {
27928
28417
  const what = kind === "catalog" ? "catalog entry (kind x402-endpoint)" : "hook manifest";
27929
- return new Command149("submit").description(
28418
+ return new Command151("submit").description(
27930
28419
  `Submit a ${what} for staff review. Pays the standard action fee, kept either way; needs an ERC-8004 identity on the selected network`
27931
28420
  ).requiredOption("--file <path>", `Path to the ${what} JSON file`).action(async (opts) => {
27932
28421
  let text;
@@ -27958,7 +28447,7 @@ function submitCommandFor(kind) {
27958
28447
  });
27959
28448
  }
27960
28449
  function submissionsCommandFor(kind) {
27961
- return new Command149("submissions").description(
28450
+ return new Command151("submissions").description(
27962
28451
  `List the ${kind === "catalog" ? "catalog entries" : "hook listings"} you submitted and their status`
27963
28452
  ).option("--status <status>", `Only this status: ${LISTING_SUBMISSION_STATUSES.join(", ")}`).option("--limit <n>", "Maximum submissions to return (1-100)", "50").action(async (opts) => {
27964
28453
  if (opts.status && !LISTING_SUBMISSION_STATUSES.includes(opts.status)) {
@@ -28024,7 +28513,7 @@ async function probeHookVersion(entry, chainId) {
28024
28513
  return reverted ? { ...entry, hookVersion: 1 } : entry;
28025
28514
  }
28026
28515
  }
28027
- var listCommand10 = new Command150("list").description(
28516
+ var listCommand10 = new Command152("list").description(
28028
28517
  "List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
28029
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(
28030
28519
  "--cursor <cursor>",
@@ -28063,7 +28552,7 @@ var listCommand10 = new Command150("list").description(
28063
28552
  }
28064
28553
  }
28065
28554
  );
28066
- var showCommand8 = new Command150("show").description(
28555
+ var showCommand8 = new Command152("show").description(
28067
28556
  "Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
28068
28557
  ).argument("<address>", "Hook contract address").action(async (address3) => {
28069
28558
  try {
@@ -28083,7 +28572,7 @@ var showCommand8 = new Command150("show").description(
28083
28572
  renderFailure(err);
28084
28573
  }
28085
28574
  });
28086
- var encodeConfigCommand = new Command150("encode-config").description(
28575
+ var encodeConfigCommand = new Command152("encode-config").description(
28087
28576
  "Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
28088
28577
  ).argument("<address>", "Hook contract address").requiredOption(
28089
28578
  "--values <json>",
@@ -28112,7 +28601,7 @@ var encodeConfigCommand = new Command150("encode-config").description(
28112
28601
  renderFailure(err);
28113
28602
  }
28114
28603
  });
28115
- var attachmentConfigCommand = new Command150("attachment-config").description(
28604
+ var attachmentConfigCommand = new Command152("attachment-config").description(
28116
28605
  "Show the protocol-default hook order and maximum hooks per task on the selected --network"
28117
28606
  ).action(async () => {
28118
28607
  try {
@@ -28121,16 +28610,16 @@ var attachmentConfigCommand = new Command150("attachment-config").description(
28121
28610
  renderFailure(err);
28122
28611
  }
28123
28612
  });
28124
- 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"));
28125
28614
 
28126
28615
  // src/commands/catalog/index.ts
28127
- import { Command as Command151 } from "commander";
28128
- 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"));
28129
28618
 
28130
28619
  // src/commands/tap.ts
28131
28620
  import { promises as fs12 } from "fs";
28132
- import { Command as Command152 } from "commander";
28133
- var tapCommand = new Command152("tap").description(
28621
+ import { Command as Command154 } from "commander";
28622
+ var tapCommand = new Command154("tap").description(
28134
28623
  "Manage the TAP signing key used on tasks that require TAP verification"
28135
28624
  );
28136
28625
  tapCommand.command("import").description(
@@ -28289,7 +28778,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
28289
28778
  });
28290
28779
 
28291
28780
  // src/commands/hire.ts
28292
- import { Command as Command153 } from "commander";
28781
+ import { Command as Command155 } from "commander";
28293
28782
  var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
28294
28783
  async function lookupListedService(worker, serviceId) {
28295
28784
  let listing;
@@ -28321,7 +28810,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
28321
28810
  }
28322
28811
  return null;
28323
28812
  }
28324
- var hireCommand = new Command153("hire").description(
28813
+ var hireCommand = new Command155("hire").description(
28325
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."
28326
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(
28327
28816
  "--requires-evaluator",
@@ -28384,7 +28873,7 @@ hireCommand.action(async (worker, opts) => {
28384
28873
  // src/index.ts
28385
28874
  var require2 = createRequire(import.meta.url);
28386
28875
  var { version } = require2("../package.json");
28387
- var program = new Command154();
28876
+ var program = new Command156();
28388
28877
  setLastErrorCliVersion(version);
28389
28878
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
28390
28879
  program.option(