@lucid-agents/taskmarket 1.49.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/agent-compatibility.json +1 -1
  2. package/dist/{api-3AM2K2OD.js → api-YDCOGL5P.js} +2 -2
  3. package/dist/{channels-UVUKKHEH.js → channels-K4AKXBRM.js} +4 -4
  4. package/dist/{chunk-JJWVZVQL.js → chunk-5EUSU7QA.js} +1 -1
  5. package/dist/{chunk-BD7EUFMK.js → chunk-7OC73WUN.js} +1 -1
  6. package/dist/{chunk-ZI6J2FVP.js → chunk-CBLGBZ67.js} +3 -3
  7. package/dist/{chunk-5FEFXZWX.js → chunk-CCK7JYVX.js} +1 -1
  8. package/dist/{chunk-E7DQ6PHQ.js → chunk-DE5YYAHJ.js} +1 -1
  9. package/dist/{chunk-KMDMP37P.js → chunk-HZ6KGGNX.js} +8 -8
  10. package/dist/{chunk-VROY6UJU.js → chunk-JPAOL63U.js} +3 -3
  11. package/dist/{chunk-QASNNRSL.js → chunk-LC5VE4EQ.js} +3682 -2929
  12. package/dist/{chunk-4PIW55SU.js → chunk-LL2SVODK.js} +1 -1
  13. package/dist/{chunk-IPLFBE4Z.js → chunk-O56EUZVG.js} +4 -4
  14. package/dist/{chunk-ZBIB5Z72.js → chunk-VQ6X6FME.js} +2 -2
  15. package/dist/{chunk-JPFNNGT5.js → chunk-YCWWBCXW.js} +5 -5
  16. package/dist/{doctor-62ESHY26.js → doctor-UA5ST7KE.js} +9 -9
  17. package/dist/index.js +844 -205
  18. package/dist/{launch-QN325T4P.js → launch-TMSW4WPX.js} +11 -11
  19. package/dist/pi-extensions/xgate.cjs +118 -118
  20. package/dist/{read-auth-YVFCEAQN.js → read-auth-PN6FJNKK.js} +3 -3
  21. package/dist/{reconcile-ZQUH7Z7P.js → reconcile-VVNRBYY7.js} +4 -4
  22. package/dist/{status-BCKUXLAQ.js → status-VQ7V3CIS.js} +9 -9
  23. package/dist/{sync-pull-YDX4D4XW.js → sync-pull-UKSVJFMY.js} +4 -4
  24. package/dist/{task-access-grants-Z2P4RHFL.js → task-access-grants-QBORD7RL.js} +2 -2
  25. package/package.json +8 -10
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  listWorkerSubmissions,
15
15
  submitTaskFiles,
16
16
  taskRequirementsOf
17
- } from "./chunk-KMDMP37P.js";
17
+ } from "./chunk-HZ6KGGNX.js";
18
18
  import {
19
19
  ComputeCreditError,
20
20
  applyComputeCreditSetup,
@@ -43,14 +43,14 @@ import {
43
43
  withSelectedChain,
44
44
  x402FeePost,
45
45
  x402PaymentProtocol
46
- } from "./chunk-IPLFBE4Z.js";
46
+ } from "./chunk-O56EUZVG.js";
47
47
  import {
48
48
  signReadAuth
49
- } from "./chunk-ZBIB5Z72.js";
49
+ } from "./chunk-VQ6X6FME.js";
50
50
  import {
51
51
  saveTaskAccessGrant,
52
52
  taskAccessGrantHeaders
53
- } from "./chunk-BD7EUFMK.js";
53
+ } from "./chunk-7OC73WUN.js";
54
54
  import {
55
55
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
56
56
  X402PayError,
@@ -69,7 +69,7 @@ import {
69
69
  setX402PolicyRuleEnabled,
70
70
  signSponsoredTempoTransfer,
71
71
  signTaskmarketFeePayment
72
- } from "./chunk-JJWVZVQL.js";
72
+ } from "./chunk-5EUSU7QA.js";
73
73
  import {
74
74
  ALL_NETWORKS,
75
75
  ApiError,
@@ -135,7 +135,7 @@ import {
135
135
  withErrorContext,
136
136
  withIdempotentWrite,
137
137
  withTapSignature
138
- } from "./chunk-E7DQ6PHQ.js";
138
+ } from "./chunk-DE5YYAHJ.js";
139
139
  import {
140
140
  AGENT_AVATAR_MAX_BYTES,
141
141
  AGENT_HIRES_ROLES,
@@ -154,6 +154,7 @@ import {
154
154
  AgentListingSchema,
155
155
  AgentMessageEnvelopeSchema,
156
156
  AgentServiceRecordsResponseSchema,
157
+ AgentShopfrontPublicSchema,
157
158
  AgentTimeSeriesInputSchema,
158
159
  AgentUserSkillArchiveWriteSchema,
159
160
  AgentUserSkillBundleWriteSchema,
@@ -234,12 +235,16 @@ import {
234
235
  RejectOutcome,
235
236
  RelayBridgeFundingConfigOutputSchema,
236
237
  RelayBridgeRouteIdSchema,
238
+ SERVICE_HIRE_ACCEPT_POLICIES,
239
+ SHOP_HANDLE_REGEX,
237
240
  SOLANA_CHAIN_IDS,
238
241
  SPONSORED_VAULT_7702,
239
242
  STANDARD_X402_ACTION_AMOUNT,
240
243
  SUGGESTION_PROPOSAL_STATUSES,
241
244
  SUGGESTION_SCHEDULE_MAX_TASKS_PER_RUN,
245
+ ServiceHireAcceptPolicySchema,
242
246
  SetMarketEventPreferenceInputSchema,
247
+ ShopHandleResolveResultSchema,
243
248
  SponsoredTaskRewardStateSchema,
244
249
  SponsoredTaskWorkerRewardClaimStatusSchema,
245
250
  SubmissionReviewAssessmentInputSchema,
@@ -370,6 +375,7 @@ import {
370
375
  matchesAnyGlob,
371
376
  needsYouKindForIntent,
372
377
  normalizeReferenceCode,
378
+ normalizeShopHandle,
373
379
  normalizeWorkflowTemplateTags,
374
380
  parseIsoDurationSeconds,
375
381
  parseScheduleCadence,
@@ -409,7 +415,7 @@ import {
409
415
  vaultCallGasLimit7702,
410
416
  verifiersUnsupportedOnChain,
411
417
  viemChainFor
412
- } from "./chunk-QASNNRSL.js";
418
+ } from "./chunk-LC5VE4EQ.js";
413
419
  import "./chunk-S7SJMJ2I.js";
414
420
 
415
421
  // src/index.ts
@@ -7634,6 +7640,9 @@ async function signWalletWrite(scope, change) {
7634
7640
  }
7635
7641
 
7636
7642
  // src/lib/tap-enrol.ts
7643
+ var TAP_WAIT_POLL_INTERVAL_MS = 3e3;
7644
+ var TAP_WAIT_DEFAULT_TIMEOUT_SECONDS = 900;
7645
+ var TAP_WAIT_MAX_TIMEOUT_SECONDS = 3600;
7637
7646
  function verifierEnrolmentMessage(chainId) {
7638
7647
  return `TAP keys cannot be enrolled on chain ${chainId} from the CLI: TAP is off there, or the verifier's registrar is not available. The stored key stays unenrolled. To use a key the verifier issued, import it with 'taskmarket tap import --key-id <id> --key-file <path> --signature-agent <url> --force'.`;
7639
7648
  }
@@ -7672,11 +7681,80 @@ async function enrolTapKey(stored, chainId) {
7672
7681
  { chainId, publicKey: stored.publicKey, ...proof },
7673
7682
  { headers: auth.headers }
7674
7683
  );
7675
- return data;
7684
+ if (data.status === "card_verification_required") {
7685
+ if (typeof data.sessionId !== "string" || data.sessionId.length === 0 || typeof data.verificationUrl !== "string" || data.verificationUrl.length === 0 || typeof data.expiresAt !== "string" || data.expiresAt.length === 0 || typeof data.chainId !== "number") {
7686
+ throw new Error(
7687
+ `The card verification handoff answer is malformed: ${JSON.stringify(data)}`
7688
+ );
7689
+ }
7690
+ return {
7691
+ status: "card_verification_required",
7692
+ sessionId: data.sessionId,
7693
+ verificationUrl: data.verificationUrl,
7694
+ expiresAt: data.expiresAt,
7695
+ chainId: data.chainId
7696
+ };
7697
+ }
7698
+ return {
7699
+ status: "enrolled",
7700
+ enrolment: {
7701
+ keyId: data.keyId,
7702
+ algorithm: data.algorithm,
7703
+ chainId: data.chainId,
7704
+ ...typeof data.signatureAgent === "string" ? { signatureAgent: data.signatureAgent } : {}
7705
+ }
7706
+ };
7676
7707
  } catch (error) {
7677
7708
  throw explainEnrolFailure(error, chainId);
7678
7709
  }
7679
7710
  }
7711
+ async function readTapEnrolmentStatus(sessionId) {
7712
+ const auth = await signReadAuth();
7713
+ if (!auth || Object.keys(auth.headers).length === 0) {
7714
+ throw new Error("Checking TAP enrolment status needs a wallet. Run `taskmarket init` first.");
7715
+ }
7716
+ const data = await apiGet(`/api/tap/enrolments/${encodeURIComponent(sessionId)}`, {
7717
+ headers: auth.headers
7718
+ });
7719
+ if (typeof data !== "object" || data === null || data.status !== "pending" && data.status !== "completed" && data.status !== "expired" || typeof data.chainId !== "number") {
7720
+ throw new Error(`The TAP enrolment status answer is malformed: ${JSON.stringify(data)}`);
7721
+ }
7722
+ return data;
7723
+ }
7724
+ async function waitForTapEnrolment(sessionId, opts) {
7725
+ const pollIntervalMs = opts.pollIntervalMs ?? TAP_WAIT_POLL_INTERVAL_MS;
7726
+ const sleep4 = opts.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
7727
+ const now = opts.now ?? (() => Date.now());
7728
+ const deadline = now() + opts.timeoutMs;
7729
+ while (true) {
7730
+ const state = await readTapEnrolmentStatus(sessionId);
7731
+ if (state.status === "completed") {
7732
+ if (typeof state.keyId !== "string" || state.keyId.length === 0) {
7733
+ throw new Error(
7734
+ `The completed TAP enrolment session has no key id: ${JSON.stringify(state)}`
7735
+ );
7736
+ }
7737
+ return {
7738
+ keyId: state.keyId,
7739
+ algorithm: state.algorithm,
7740
+ chainId: state.chainId,
7741
+ ...typeof state.signatureAgent === "string" ? { signatureAgent: state.signatureAgent } : {}
7742
+ };
7743
+ }
7744
+ if (state.status === "expired") {
7745
+ throw new Error(
7746
+ "The TAP card verification session expired before completion. Run 'taskmarket tap enrol' again to get a new verification link."
7747
+ );
7748
+ }
7749
+ const remainingMs = deadline - now();
7750
+ if (remainingMs <= 0) {
7751
+ throw new Error(
7752
+ "Timed out waiting for Visa card verification. Have the agent owner finish at the verification link or run 'taskmarket tap enrol' again."
7753
+ );
7754
+ }
7755
+ await sleep4(Math.min(pollIntervalMs, remainingMs));
7756
+ }
7757
+ }
7680
7758
  function withTapEnrolment(stored, enrolment) {
7681
7759
  if (typeof enrolment.keyId !== "string" || typeof enrolment.chainId !== "number") {
7682
7760
  throw new Error(`The enrolment answer has no key id: ${JSON.stringify(enrolment)}`);
@@ -7769,6 +7847,7 @@ async function addSolanaWallet() {
7769
7847
  await saveKeystore({ ...keystore, ...solanaKeystoreFields(dek, wallet) });
7770
7848
  printResult({ address: keystore.walletAddress, solanaAddress: wallet.address });
7771
7849
  }
7850
+ var TAP_CARD_VERIFICATION_NEXT_STEP = "Have the agent owner open verificationUrl in a browser to link a Visa card, then re-run 'taskmarket tap enrol' (or run with --wait).";
7772
7851
  async function tryEnrolTapKey(tapKey, chainId, warnings) {
7773
7852
  const retryCommand = "taskmarket tap enrol";
7774
7853
  if (chainId === void 0) {
@@ -7779,12 +7858,22 @@ async function tryEnrolTapKey(tapKey, chainId, warnings) {
7779
7858
  { retryCommand }
7780
7859
  )
7781
7860
  );
7782
- return tapKey;
7861
+ return { tapKey };
7783
7862
  }
7784
7863
  try {
7785
- const enrolled = withTapEnrolment(tapKey, await enrolTapKey(tapKey, chainId));
7864
+ const outcome = await enrolTapKey(tapKey, chainId);
7865
+ if (outcome.status === "card_verification_required") {
7866
+ return {
7867
+ tapKey,
7868
+ tapVerification: {
7869
+ ...outcome,
7870
+ nextStep: TAP_CARD_VERIFICATION_NEXT_STEP
7871
+ }
7872
+ };
7873
+ }
7874
+ const enrolled = withTapEnrolment(tapKey, outcome.enrolment);
7786
7875
  await saveKeystore({ ...await loadKeystore(), tapKey: enrolled });
7787
- return enrolled;
7876
+ return { tapKey: enrolled };
7788
7877
  } catch (err) {
7789
7878
  const reason = err?.envelope?.reason;
7790
7879
  warnings.push(
@@ -7794,7 +7883,7 @@ async function tryEnrolTapKey(tapKey, chainId, warnings) {
7794
7883
  { chainId, ...typeof reason === "string" ? { reason } : {}, retryCommand }
7795
7884
  )
7796
7885
  );
7797
- return tapKey;
7886
+ return { tapKey };
7798
7887
  }
7799
7888
  }
7800
7889
  async function addTapKey() {
@@ -7809,8 +7898,19 @@ async function addTapKey() {
7809
7898
  const created = storedTapKey(dek, null, generateTapKey(), /* @__PURE__ */ new Date(), "created");
7810
7899
  await saveKeystore({ ...keystore, tapKey: created });
7811
7900
  const warnings = [];
7812
- const tapKey = await tryEnrolTapKey(created, selectedNetworkOrUndefined()?.chainId, warnings);
7813
- printResult({ address: keystore.walletAddress, tapKey: tapKeySummary(tapKey) }, { warnings });
7901
+ const { tapKey, tapVerification } = await tryEnrolTapKey(
7902
+ created,
7903
+ selectedNetworkOrUndefined()?.chainId,
7904
+ warnings
7905
+ );
7906
+ printResult(
7907
+ {
7908
+ address: keystore.walletAddress,
7909
+ tapKey: tapKeySummary(tapKey),
7910
+ ...tapVerification ? { tapVerification } : {}
7911
+ },
7912
+ { warnings }
7913
+ );
7814
7914
  }
7815
7915
  var initCommand = new Command2("init").description(
7816
7916
  "Create and register this machine's agent wallet (one-time; refuses when a wallet exists)"
@@ -7916,7 +8016,7 @@ var initCommand = new Command2("init").description(
7916
8016
  renderFailure(err);
7917
8017
  return;
7918
8018
  }
7919
- const tapKey = createdTapKey ? await tryEnrolTapKey(createdTapKey, selectedNetwork().chainId, warnings) : void 0;
8019
+ const tapAttempt = createdTapKey ? await tryEnrolTapKey(createdTapKey, selectedNetwork().chainId, warnings) : void 0;
7920
8020
  printResult(
7921
8021
  {
7922
8022
  address: address3,
@@ -7927,7 +8027,8 @@ var initCommand = new Command2("init").description(
7927
8027
  paymentMethod: chain?.paymentMethod,
7928
8028
  feeModel: chain?.feeModel,
7929
8029
  emailAddress,
7930
- ...tapKey ? { tapKey: tapKeySummary(tapKey) } : {}
8030
+ ...tapAttempt ? { tapKey: tapKeySummary(tapAttempt.tapKey) } : {},
8031
+ ...tapAttempt?.tapVerification ? { tapVerification: tapAttempt.tapVerification } : {}
7931
8032
  },
7932
8033
  { warnings, next: nextAfterInit({ address: address3, chainId: selectedNetwork().chainId }) }
7933
8034
  );
@@ -10455,7 +10556,7 @@ var createCmd = new Command12("create").description("Create a new task (costs th
10455
10556
  "Only workers with one of these identities may claim, pitch, bid, submit proofs or submit work (comma-separated; any one is enough): erc8004:identity:registered, erc8004:reputation:reputable"
10456
10557
  ).option(
10457
10558
  "--require-verified <verifiers>",
10458
- "Only workers one of these verifiers passes may work on the task (comma-separated; any one is enough): tap:identity:known (any agent registered with TAP; the level to use) or tap:identity:verified (agents the verifier reviewed by hand; the verifier does not use this level yet). With --require-identity too, both must be met."
10559
+ "Only workers one of these verifiers passes may work on the task (comma-separated; any one is enough): tap:identity:verified (TAP Verified: any agent whose key the verifier lists). With --require-identity too, both must be met."
10459
10560
  ).option("--tags <tags>", "Comma-separated tags").option(
10460
10561
  "--capabilities <slugs>",
10461
10562
  "Comma-separated capability slugs the task needs, from `taskmarket capabilities` (active entries only; capped like a listing)"
@@ -10504,7 +10605,7 @@ var createCmd = new Command12("create").description("Create a new task (costs th
10504
10605
  "Attach the payout gate; it opens on its own this long from now, e.g. 48h, 7d (1h to 180d). Without --gated-by, link the gating task later with `taskmarket task link-gate`"
10505
10606
  ).option(
10506
10607
  "--gates <taskIds>",
10507
- "Make this task the gating task of your own gated tasks (repeat, or comma-separated; at most 16), each with a payout gate and no gating task yet: their payouts wait on this one. Not with --gated-by or --gate-deadline",
10608
+ "Make this task the gating task of your own gated tasks (repeat, or comma-separated; at most 16), each with a payout gate and no gating task yet: their payouts wait on this one. You must be each task's requester (the gate also accepts a project operator). Not with --gated-by or --gate-deadline",
10508
10609
  (value, previous = []) => [
10509
10610
  ...previous,
10510
10611
  ...value.split(",").map((id) => id.trim()).filter(Boolean)
@@ -11226,7 +11327,7 @@ var listCmd = new Command13("list").alias("search").description("List available
11226
11327
  "Only tasks that require this worker identity: erc8004:identity:registered or erc8004:reputation:reputable"
11227
11328
  ).option(
11228
11329
  "--verified-by <verifier>",
11229
- "Only tasks that require this verifier: tap:identity:known or tap:identity:verified"
11330
+ "Only tasks that require this verifier: tap:identity:verified"
11230
11331
  ).option("--limit <n>", "Maximum results to return", "20").option(
11231
11332
  "--cursor <cursor>",
11232
11333
  "Cursor from previous page (nextCursor in JSON output); pass it with the same --sort and filters"
@@ -12553,7 +12654,7 @@ var SubmissionPageSchema = TaskChildListSchema.pick({ cursor: true }).extend({
12553
12654
  });
12554
12655
  var submissionsCmd = new Command29("submissions").description("List submissions for a task").argument("<taskId>", "Task ID (0x-prefixed hex)").option(
12555
12656
  "--passed-check <provider>",
12556
- "Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, tap:identity:known or tap:identity:verified"
12657
+ "Only submissions whose worker passed this check when submitting: erc8004:identity:registered, erc8004:reputation:reputable, or tap:identity:verified"
12557
12658
  ).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(
12558
12659
  async (taskId, opts) => {
12559
12660
  const passedCheck = parseRequirementFilter(opts.passedCheck, CHECK_FILTER, "--passed-check");
@@ -12990,7 +13091,7 @@ var updateCmd = new Command41("update").description(
12990
13091
  "Replace the identity requirement (comma-separated, any one is enough: erc8004:identity:registered, erc8004:reputation:reputable; none clears it). Refused once a worker has committed."
12991
13092
  ).option(
12992
13093
  "--require-verified <verifiers>",
12993
- "Replace the verifier requirement (comma-separated, any one is enough: tap:identity:known, tap:identity:verified; none clears it). tap:identity:known accepts any agent registered with TAP; tap:identity:verified needs one the verifier reviewed by hand, a level it does not use yet. Refused once a worker has committed."
13094
+ "Replace the verifier requirement (comma-separated, any one is enough: tap:identity:verified; none clears it). tap:identity:verified (TAP Verified) accepts any agent whose key the verifier lists. Refused once a worker has committed."
12994
13095
  ).action(
12995
13096
  async (taskId, opts) => {
12996
13097
  const body = { taskId };
@@ -13852,7 +13953,7 @@ async function runAgentCommand(options) {
13852
13953
  try {
13853
13954
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
13854
13955
  const pi = assertAgentCompatibility();
13855
- const { runAgent } = await import("./launch-QN325T4P.js");
13956
+ const { runAgent } = await import("./launch-TMSW4WPX.js");
13856
13957
  result = await runAgent({
13857
13958
  model: options.model,
13858
13959
  pi,
@@ -14114,11 +14215,16 @@ function serviceInputFromStored(service) {
14114
14215
  deliveryPeriodSecs: service.deliveryPeriodSecs,
14115
14216
  ...service.acceptBySecs !== null ? { acceptBySecs: service.acceptBySecs } : {},
14116
14217
  ...service.terms ? { terms: service.terms } : {},
14117
- ...service.requiresEvaluator ? { requiresEvaluator: true } : {}
14218
+ ...service.requiresEvaluator ? { requiresEvaluator: true } : {},
14219
+ ...service.hireAcceptPolicy === "ask" ? { hireAcceptPolicy: "ask" } : {}
14118
14220
  };
14119
14221
  }
14120
14222
  if (service.kind === "quote") {
14121
- return { ...base, ...service.requiresEvaluator ? { requiresEvaluator: true } : {} };
14223
+ return {
14224
+ ...base,
14225
+ ...service.requiresEvaluator ? { requiresEvaluator: true } : {},
14226
+ ...service.hireAcceptPolicy === "ask" ? { hireAcceptPolicy: "ask" } : {}
14227
+ };
14122
14228
  }
14123
14229
  return {
14124
14230
  ...base,
@@ -14157,6 +14263,13 @@ function buildServiceInput(opts, base = {}) {
14157
14263
  if (opts.requiresEvaluator) service.requiresEvaluator = true;
14158
14264
  else delete service.requiresEvaluator;
14159
14265
  }
14266
+ if (opts.hirePolicy !== void 0) {
14267
+ const policy = parseInput(ServiceHireAcceptPolicySchema, opts.hirePolicy);
14268
+ if (service.kind === "evaluation") {
14269
+ throw new Error("--hire-policy applies only to fixed and quote services");
14270
+ }
14271
+ service.hireAcceptPolicy = policy;
14272
+ }
14160
14273
  return service;
14161
14274
  }
14162
14275
  function addServiceOptions(command) {
@@ -14169,7 +14282,10 @@ function addServiceOptions(command) {
14169
14282
  ).option("--title <title>", "Service title").option("--description <text>", "What the service covers").option("--deliverable <text>", "What the requester receives").option("--specialty <label>", "A specialty label or slug (repeatable; at least one)", collect3).option("--chain <chain>", "A chain requesters may pay on, by name or id (repeatable)", collect3).option("--all-chains", "Accept every chain you are registered on (the default)").option("--price <usd>", "fixed: price in USD, e.g. 25 or 12.50").option("--delivery <hours>", "fixed: delivery period in hours").option("--accept-by <hours>", "fixed: hours you have to accept a hire (default 72)").option("--terms-preset <name>", "fixed: settlement terms preset for hires").option("--fee-bps <bps>", "evaluation: your fee in basis points").option("--evaluation-window <hours>", "evaluation: hours you take to evaluate").option("--stake <usd>", "evaluation: stake the requester puts behind you, in USD").option(
14170
14283
  "--requires-evaluator",
14171
14284
  "fixed or quote: a hire of this service must name an evaluator before it is accepted"
14172
- ).option("--no-requires-evaluator", "fixed or quote: hires need no evaluator (the default)");
14285
+ ).option("--no-requires-evaluator", "fixed or quote: hires need no evaluator (the default)").option(
14286
+ "--hire-policy <policy>",
14287
+ `fixed or quote: hire acceptance policy (${SERVICE_HIRE_ACCEPT_POLICIES.join(" or ")}; default auto)`
14288
+ );
14173
14289
  }
14174
14290
  var serviceCommand = new Command58("service").description(
14175
14291
  "Your listing services: the priced offers requesters hire you for"
@@ -14286,13 +14402,13 @@ function agentManagementCommands() {
14286
14402
  const status = new Command59("status").description(
14287
14403
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
14288
14404
  ).action(async () => {
14289
- const { collectAgentStatus } = await import("./status-BCKUXLAQ.js");
14405
+ const { collectAgentStatus } = await import("./status-VQ7V3CIS.js");
14290
14406
  await run(() => collectAgentStatus());
14291
14407
  });
14292
14408
  const doctor = new Command59("doctor").description(
14293
14409
  "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."
14294
14410
  ).action(async () => {
14295
- const { runDoctor } = await import("./doctor-62ESHY26.js");
14411
+ const { runDoctor } = await import("./doctor-UA5ST7KE.js");
14296
14412
  const report = await run(() => runDoctor());
14297
14413
  if (report && !report.ok) process.exitCode = 1;
14298
14414
  });
@@ -14303,7 +14419,7 @@ function agentManagementCommands() {
14303
14419
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
14304
14420
  ).action(
14305
14421
  async (invocationId, options) => {
14306
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-ZQUH7Z7P.js");
14422
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-VVNRBYY7.js");
14307
14423
  const choice = { rail: options.rail, channel: options.channel };
14308
14424
  if (invocationId !== void 0) {
14309
14425
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -14335,7 +14451,7 @@ function agentManagementCommands() {
14335
14451
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
14336
14452
  );
14337
14453
  }
14338
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-UVUKKHEH.js");
14454
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-K4AKXBRM.js");
14339
14455
  const { rails } = await openAgentChannels();
14340
14456
  const result = await requestTopUp(selectRail(rails, options.rail), amount2);
14341
14457
  return {
@@ -14355,8 +14471,8 @@ function agentManagementCommands() {
14355
14471
  await run(async () => {
14356
14472
  await requireExperimental();
14357
14473
  const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
14358
- const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-UVUKKHEH.js");
14359
- const { reconcileLeasedPurchase } = await import("./reconcile-ZQUH7Z7P.js");
14474
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-K4AKXBRM.js");
14475
+ const { reconcileLeasedPurchase } = await import("./reconcile-VVNRBYY7.js");
14360
14476
  const opened = await openAgentChannels();
14361
14477
  const { rail, retired } = selectChannel(opened, options);
14362
14478
  const result = await closeChannel(
@@ -14410,7 +14526,7 @@ function agentManagementCommands() {
14410
14526
  async (options) => {
14411
14527
  await run(async () => {
14412
14528
  await requireExperimental();
14413
- const { runPull } = await import("./sync-pull-YDX4D4XW.js");
14529
+ const { runPull } = await import("./sync-pull-UKSVJFMY.js");
14414
14530
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
14415
14531
  return runPull(options, {
14416
14532
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -14490,7 +14606,7 @@ var agentsCommand = new Command61("agents").description("Browse the worker direc
14490
14606
  "Filter by actor kind: agent, human (the web directory filtered to humans) or hosted"
14491
14607
  ).option(
14492
14608
  "--verified-by <verifier>",
14493
- "Only agents this verifier passed within the last 30 days: tap:identity:known (any agent registered with TAP) or tap:identity:verified (reviewed by hand; not yet used by the verifier)"
14609
+ "Only agents this verifier passed within the last 30 days: tap:identity:verified (TAP Verified: any agent whose key the verifier lists)"
14494
14610
  ).option(
14495
14611
  "--availability <availability>",
14496
14612
  "available (open and under capacity), unavailable (paused or fully booked) or any",
@@ -14562,15 +14678,71 @@ async function installedSkillsFor(wallet) {
14562
14678
  return {};
14563
14679
  }
14564
14680
  }
14681
+ async function resolveAgentTarget(target) {
14682
+ if (target.startsWith("@")) {
14683
+ const handle = normalizeShopHandle(target);
14684
+ if (!handle || !SHOP_HANDLE_REGEX.test(handle)) {
14685
+ throw new Error(
14686
+ `Invalid shopfront handle "${target}". Expected @handle with 3 to 30 lowercase letters, digits, or hyphens.`
14687
+ );
14688
+ }
14689
+ let resolved;
14690
+ try {
14691
+ resolved = await apiGet(`/api/shopfronts/handle/${encodeURIComponent(handle)}`);
14692
+ } catch (err) {
14693
+ const status = err && typeof err === "object" && "status" in err && typeof err.status === "number" ? err.status : void 0;
14694
+ if (status === 404) {
14695
+ throw new Error(`Shopfront handle "@${handle}" not found`);
14696
+ }
14697
+ throw err;
14698
+ }
14699
+ const parsed = ShopHandleResolveResultSchema.safeParse(resolved);
14700
+ if (!parsed.success) {
14701
+ throw new Error(`Shopfront handle "@${handle}" could not be resolved`);
14702
+ }
14703
+ return parseInput(EthAddressSchema, parsed.data.walletAddress);
14704
+ }
14705
+ return parseInput(EthAddressSchema, target);
14706
+ }
14707
+ async function fetchPublicShopfront(wallet) {
14708
+ try {
14709
+ const parsed = AgentShopfrontPublicSchema.safeParse(
14710
+ await apiGet(`/api/shopfronts/${encodeURIComponent(wallet)}`)
14711
+ );
14712
+ if (!parsed.success) return null;
14713
+ const {
14714
+ handle,
14715
+ shopStatus,
14716
+ crew,
14717
+ samples,
14718
+ webring,
14719
+ trophies,
14720
+ guestbookEnabled,
14721
+ guestbookCount
14722
+ } = parsed.data;
14723
+ return {
14724
+ handle,
14725
+ shopStatus,
14726
+ crew,
14727
+ samples,
14728
+ webring,
14729
+ trophies,
14730
+ guestbookEnabled,
14731
+ guestbookCount
14732
+ };
14733
+ } catch {
14734
+ return null;
14735
+ }
14736
+ }
14565
14737
  agentsCommand.command("get").description(
14566
- "Show a worker's record (agent or human) on the selected --network, or on every chain"
14567
- ).argument("<address>", "Wallet address of the worker").option("--all-chains", "List the worker's records on every served chain").option(
14738
+ "Show a worker's record (agent or human) by wallet address or @handle on the selected --network, or on every chain"
14739
+ ).argument("<target>", "Wallet address or @handle of the worker").option("--all-chains", "List the worker's records on every served chain").option(
14568
14740
  "--hires",
14569
14741
  "Add the worker's hire record, each listed service's record (serviceRecords) and the workers it hired (see `taskmarket agents hires`)"
14570
- ).action(async (address3, opts) => {
14742
+ ).action(async (target, opts) => {
14571
14743
  let wallet;
14572
14744
  try {
14573
- wallet = parseInput(EthAddressSchema, address3);
14745
+ wallet = await resolveAgentTarget(target);
14574
14746
  } catch (err) {
14575
14747
  renderFailure(err);
14576
14748
  return;
@@ -14590,14 +14762,16 @@ agentsCommand.command("get").description(
14590
14762
  printResult(result);
14591
14763
  return;
14592
14764
  }
14593
- const [skills2, hireAvailability2] = await Promise.all([
14765
+ const [skills2, hireAvailability2, shopfront2] = await Promise.all([
14594
14766
  installedSkillsFor(wallet),
14595
- fetchHireAvailability(wallet)
14767
+ fetchHireAvailability(wallet),
14768
+ fetchPublicShopfront(wallet)
14596
14769
  ]);
14597
14770
  printResult({
14598
14771
  ...parsed.data,
14599
14772
  ...skills2,
14600
14773
  ...hireAvailability2 ? { hireAvailability: hireAvailability2 } : {},
14774
+ ...shopfront2 ? { shopfront: shopfront2 } : {},
14601
14775
  chains: parsed.data.chains.map((entry) => ({
14602
14776
  ...entry,
14603
14777
  earningsToken: paymentTokenSymbol(entry.chainId)
@@ -14607,12 +14781,18 @@ agentsCommand.command("get").description(
14607
14781
  }
14608
14782
  const { chainId } = selectedNetwork();
14609
14783
  const params = new URLSearchParams({ address: wallet, chainId: String(chainId) });
14610
- const [stats, skills, hireAvailability] = await Promise.all([
14784
+ const [stats, skills, hireAvailability, shopfront] = await Promise.all([
14611
14785
  apiGet(`/api/agents/stats?${params.toString()}`),
14612
14786
  installedSkillsFor(wallet),
14613
- fetchHireAvailability(wallet)
14787
+ fetchHireAvailability(wallet),
14788
+ fetchPublicShopfront(wallet)
14614
14789
  ]);
14615
- const record = stats && typeof stats === "object" ? { ...stats, ...skills, ...hireAvailability ? { hireAvailability } : {} } : stats;
14790
+ const record = stats && typeof stats === "object" ? {
14791
+ ...stats,
14792
+ ...skills,
14793
+ ...hireAvailability ? { hireAvailability } : {},
14794
+ ...shopfront ? { shopfront } : {}
14795
+ } : stats;
14616
14796
  if (!opts.hires) {
14617
14797
  printResult(record);
14618
14798
  return;
@@ -21094,6 +21274,19 @@ var SponsoredTasksVaultV2ABI = [
21094
21274
  ],
21095
21275
  "stateMutability": "view"
21096
21276
  },
21277
+ {
21278
+ "type": "function",
21279
+ "name": "CONFIGURE_MANAGER_FOR_CHAIN_TYPEHASH",
21280
+ "inputs": [],
21281
+ "outputs": [
21282
+ {
21283
+ "name": "",
21284
+ "type": "bytes32",
21285
+ "internalType": "bytes32"
21286
+ }
21287
+ ],
21288
+ "stateMutability": "view"
21289
+ },
21097
21290
  {
21098
21291
  "type": "function",
21099
21292
  "name": "CONFIGURE_MANAGER_TYPEHASH",
@@ -21604,6 +21797,72 @@ var SponsoredTasksVaultV2ABI = [
21604
21797
  "outputs": [],
21605
21798
  "stateMutability": "nonpayable"
21606
21799
  },
21800
+ {
21801
+ "type": "function",
21802
+ "name": "configureManagerForChain",
21803
+ "inputs": [
21804
+ {
21805
+ "name": "taskChainId",
21806
+ "type": "uint256",
21807
+ "internalType": "uint256"
21808
+ },
21809
+ {
21810
+ "name": "manager",
21811
+ "type": "address",
21812
+ "internalType": "address"
21813
+ },
21814
+ {
21815
+ "name": "newCap",
21816
+ "type": "uint256",
21817
+ "internalType": "uint256"
21818
+ },
21819
+ {
21820
+ "name": "active",
21821
+ "type": "bool",
21822
+ "internalType": "bool"
21823
+ }
21824
+ ],
21825
+ "outputs": [],
21826
+ "stateMutability": "nonpayable"
21827
+ },
21828
+ {
21829
+ "type": "function",
21830
+ "name": "configureManagerForChainBySig",
21831
+ "inputs": [
21832
+ {
21833
+ "name": "taskChainId",
21834
+ "type": "uint256",
21835
+ "internalType": "uint256"
21836
+ },
21837
+ {
21838
+ "name": "manager",
21839
+ "type": "address",
21840
+ "internalType": "address"
21841
+ },
21842
+ {
21843
+ "name": "newCap",
21844
+ "type": "uint256",
21845
+ "internalType": "uint256"
21846
+ },
21847
+ {
21848
+ "name": "active",
21849
+ "type": "bool",
21850
+ "internalType": "bool"
21851
+ },
21852
+ {
21853
+ "name": "deadline",
21854
+ "type": "uint256",
21855
+ "internalType": "uint256"
21856
+ },
21857
+ {
21858
+ "name": "signature",
21859
+ "type": "bytes",
21860
+ "internalType": "bytes"
21861
+ }
21862
+ ],
21863
+ "outputs": [],
21864
+ "stateMutability": "nonpayable"
21865
+ },
21607
21866
  {
21608
21867
  "type": "function",
21609
21868
  "name": "controller",
@@ -21951,6 +22210,52 @@ var SponsoredTasksVaultV2ABI = [
21951
22210
  ],
21952
22211
  "stateMutability": "view"
21953
22212
  },
22213
+ {
22214
+ "type": "function",
22215
+ "name": "managerAccountForChain",
22216
+ "inputs": [
22217
+ {
22218
+ "name": "taskChainId",
22219
+ "type": "uint256",
22220
+ "internalType": "uint256"
22221
+ },
22222
+ {
22223
+ "name": "manager",
22224
+ "type": "address",
22225
+ "internalType": "address"
22226
+ }
22227
+ ],
22228
+ "outputs": [
22229
+ {
22230
+ "name": "account",
22231
+ "type": "tuple",
22232
+ "internalType": "struct SponsoredTaskTypes.ManagerAccount",
22233
+ "components": [
22234
+ {
22235
+ "name": "cap",
22236
+ "type": "uint256",
22237
+ "internalType": "uint256"
22238
+ },
22239
+ {
22240
+ "name": "reserved",
22241
+ "type": "uint256",
22242
+ "internalType": "uint256"
22243
+ },
22244
+ {
22245
+ "name": "spent",
22246
+ "type": "uint256",
22247
+ "internalType": "uint256"
22248
+ },
22249
+ {
22250
+ "name": "active",
22251
+ "type": "bool",
22252
+ "internalType": "bool"
22253
+ }
22254
+ ]
22255
+ }
22256
+ ],
22257
+ "stateMutability": "view"
22258
+ },
21954
22259
  {
21955
22260
  "type": "function",
21956
22261
  "name": "managerRemaining",
@@ -21970,6 +22275,30 @@ var SponsoredTasksVaultV2ABI = [
21970
22275
  ],
21971
22276
  "stateMutability": "view"
21972
22277
  },
22278
+ {
22279
+ "type": "function",
22280
+ "name": "managerRemainingForChain",
22281
+ "inputs": [
22282
+ {
22283
+ "name": "taskChainId",
22284
+ "type": "uint256",
22285
+ "internalType": "uint256"
22286
+ },
22287
+ {
22288
+ "name": "manager",
22289
+ "type": "address",
22290
+ "internalType": "address"
22291
+ }
22292
+ ],
22293
+ "outputs": [
22294
+ {
22295
+ "name": "",
22296
+ "type": "uint256",
22297
+ "internalType": "uint256"
22298
+ }
22299
+ ],
22300
+ "stateMutability": "view"
22301
+ },
21973
22302
  {
21974
22303
  "type": "function",
21975
22304
  "name": "owner",
@@ -22117,50 +22446,122 @@ var SponsoredTasksVaultV2ABI = [
22117
22446
  },
22118
22447
  {
22119
22448
  "type": "function",
22120
- "name": "settlementChain",
22121
- "inputs": [],
22122
- "outputs": [
22449
+ "name": "reserveTaskForChain",
22450
+ "inputs": [
22123
22451
  {
22124
- "name": "",
22452
+ "name": "allocationId",
22453
+ "type": "bytes32",
22454
+ "internalType": "bytes32"
22455
+ },
22456
+ {
22457
+ "name": "taskChainId",
22125
22458
  "type": "uint256",
22126
22459
  "internalType": "uint256"
22127
- }
22128
- ],
22129
- "stateMutability": "view"
22130
- },
22131
- {
22132
- "type": "function",
22133
- "name": "status",
22134
- "inputs": [],
22135
- "outputs": [
22460
+ },
22136
22461
  {
22137
- "name": "",
22138
- "type": "uint8",
22139
- "internalType": "enum SponsoredTaskTypes.VaultStatus"
22140
- }
22141
- ],
22142
- "stateMutability": "view"
22143
- },
22144
- {
22145
- "type": "function",
22146
- "name": "token",
22147
- "inputs": [],
22148
- "outputs": [
22462
+ "name": "taskId",
22463
+ "type": "bytes32",
22464
+ "internalType": "bytes32"
22465
+ },
22149
22466
  {
22150
- "name": "",
22467
+ "name": "manager",
22151
22468
  "type": "address",
22152
22469
  "internalType": "address"
22153
- }
22154
- ],
22155
- "stateMutability": "view"
22156
- },
22157
- {
22158
- "type": "function",
22159
- "name": "totalClaimable",
22160
- "inputs": [],
22161
- "outputs": [
22470
+ },
22162
22471
  {
22163
- "name": "",
22472
+ "name": "grossAmount",
22473
+ "type": "uint256",
22474
+ "internalType": "uint256"
22475
+ },
22476
+ {
22477
+ "name": "expectedEpoch",
22478
+ "type": "uint64",
22479
+ "internalType": "uint64"
22480
+ },
22481
+ {
22482
+ "name": "expectedFeeBps",
22483
+ "type": "uint16",
22484
+ "internalType": "uint16"
22485
+ },
22486
+ {
22487
+ "name": "expectedFeeRecipient",
22488
+ "type": "address",
22489
+ "internalType": "address"
22490
+ },
22491
+ {
22492
+ "name": "termsHash",
22493
+ "type": "bytes32",
22494
+ "internalType": "bytes32"
22495
+ }
22496
+ ],
22497
+ "outputs": [],
22498
+ "stateMutability": "nonpayable"
22499
+ },
22500
+ {
22501
+ "type": "function",
22502
+ "name": "settlementChain",
22503
+ "inputs": [],
22504
+ "outputs": [
22505
+ {
22506
+ "name": "",
22507
+ "type": "uint256",
22508
+ "internalType": "uint256"
22509
+ }
22510
+ ],
22511
+ "stateMutability": "view"
22512
+ },
22513
+ {
22514
+ "type": "function",
22515
+ "name": "status",
22516
+ "inputs": [],
22517
+ "outputs": [
22518
+ {
22519
+ "name": "",
22520
+ "type": "uint8",
22521
+ "internalType": "enum SponsoredTaskTypes.VaultStatus"
22522
+ }
22523
+ ],
22524
+ "stateMutability": "view"
22525
+ },
22526
+ {
22527
+ "type": "function",
22528
+ "name": "sweepExited",
22529
+ "inputs": [
22530
+ {
22531
+ "name": "recipient",
22532
+ "type": "address",
22533
+ "internalType": "address"
22534
+ }
22535
+ ],
22536
+ "outputs": [
22537
+ {
22538
+ "name": "amount",
22539
+ "type": "uint256",
22540
+ "internalType": "uint256"
22541
+ }
22542
+ ],
22543
+ "stateMutability": "nonpayable"
22544
+ },
22545
+ {
22546
+ "type": "function",
22547
+ "name": "token",
22548
+ "inputs": [],
22549
+ "outputs": [
22550
+ {
22551
+ "name": "",
22552
+ "type": "address",
22553
+ "internalType": "address"
22554
+ }
22555
+ ],
22556
+ "stateMutability": "view"
22557
+ },
22558
+ {
22559
+ "type": "function",
22560
+ "name": "totalClaimable",
22561
+ "inputs": [],
22562
+ "outputs": [
22563
+ {
22564
+ "name": "",
22164
22565
  "type": "uint256",
22165
22566
  "internalType": "uint256"
22166
22567
  }
@@ -22374,6 +22775,37 @@ var SponsoredTasksVaultV2ABI = [
22374
22775
  "inputs": [],
22375
22776
  "anonymous": false
22376
22777
  },
22778
+ {
22779
+ "type": "event",
22780
+ "name": "ExitedVaultSwept",
22781
+ "inputs": [
22782
+ {
22783
+ "name": "vaultId",
22784
+ "type": "bytes32",
22785
+ "indexed": true,
22786
+ "internalType": "bytes32"
22787
+ },
22788
+ {
22789
+ "name": "owner",
22790
+ "type": "address",
22791
+ "indexed": true,
22792
+ "internalType": "address"
22793
+ },
22794
+ {
22795
+ "name": "recipient",
22796
+ "type": "address",
22797
+ "indexed": true,
22798
+ "internalType": "address"
22799
+ },
22800
+ {
22801
+ "name": "amount",
22802
+ "type": "uint256",
22803
+ "indexed": false,
22804
+ "internalType": "uint256"
22805
+ }
22806
+ ],
22807
+ "anonymous": false
22808
+ },
22377
22809
  {
22378
22810
  "type": "event",
22379
22811
  "name": "FeeClaimed",
@@ -22461,6 +22893,49 @@ var SponsoredTasksVaultV2ABI = [
22461
22893
  ],
22462
22894
  "anonymous": false
22463
22895
  },
22896
+ {
22897
+ "type": "event",
22898
+ "name": "ManagerConfiguredForChain",
22899
+ "inputs": [
22900
+ {
22901
+ "name": "taskChainId",
22902
+ "type": "uint256",
22903
+ "indexed": true,
22904
+ "internalType": "uint256"
22905
+ },
22906
+ {
22907
+ "name": "manager",
22908
+ "type": "address",
22909
+ "indexed": true,
22910
+ "internalType": "address"
22911
+ },
22912
+ {
22913
+ "name": "cap",
22914
+ "type": "uint256",
22915
+ "indexed": false,
22916
+ "internalType": "uint256"
22917
+ },
22918
+ {
22919
+ "name": "reserved",
22920
+ "type": "uint256",
22921
+ "indexed": false,
22922
+ "internalType": "uint256"
22923
+ },
22924
+ {
22925
+ "name": "spent",
22926
+ "type": "uint256",
22927
+ "indexed": false,
22928
+ "internalType": "uint256"
22929
+ },
22930
+ {
22931
+ "name": "active",
22932
+ "type": "bool",
22933
+ "indexed": false,
22934
+ "internalType": "bool"
22935
+ }
22936
+ ],
22937
+ "anonymous": false
22938
+ },
22464
22939
  {
22465
22940
  "type": "event",
22466
22941
  "name": "OwnerSignatureUsed",
@@ -23335,6 +23810,11 @@ var SponsoredTasksVaultV2ABI = [
23335
23810
  }
23336
23811
  ]
23337
23812
  },
23813
+ {
23814
+ "type": "error",
23815
+ "name": "TaskChainRequired",
23816
+ "inputs": []
23817
+ },
23338
23818
  {
23339
23819
  "type": "error",
23340
23820
  "name": "TaskIdRequired",
@@ -23403,6 +23883,11 @@ var SponsoredTasksVaultV2ABI = [
23403
23883
  "name": "VaultNotActive",
23404
23884
  "inputs": []
23405
23885
  },
23886
+ {
23887
+ "type": "error",
23888
+ "name": "VaultNotExited",
23889
+ "inputs": []
23890
+ },
23406
23891
  {
23407
23892
  "type": "error",
23408
23893
  "name": "ZeroAddress",
@@ -24703,6 +25188,18 @@ function getEmergencyExitInstruction(input, config) {
24703
25188
  });
24704
25189
  }
24705
25190
 
25191
+ // ../../packages/solana-sponsored-client/dist/generated/instructions/extendDeadline.js
25192
+ var EXTEND_DEADLINE_DISCRIMINATOR = new Uint8Array([
25193
+ 18,
25194
+ 209,
25195
+ 27,
25196
+ 175,
25197
+ 87,
25198
+ 13,
25199
+ 213,
25200
+ 188
25201
+ ]);
25202
+
24706
25203
  // ../../packages/solana-sponsored-client/dist/generated/instructions/fund.js
24707
25204
  var FUND_DISCRIMINATOR = new Uint8Array([
24708
25205
  218,
@@ -24934,6 +25431,18 @@ var SETTLE_DISCRIMINATOR = new Uint8Array([
24934
25431
  212
24935
25432
  ]);
24936
25433
 
25434
+ // ../../packages/solana-sponsored-client/dist/generated/instructions/sweepExited.js
25435
+ var SWEEP_EXITED_DISCRIMINATOR = new Uint8Array([
25436
+ 49,
25437
+ 51,
25438
+ 165,
25439
+ 229,
25440
+ 234,
25441
+ 130,
25442
+ 98,
25443
+ 7
25444
+ ]);
25445
+
24937
25446
  // ../../packages/solana-sponsored-client/dist/generated/programs/sponsoredTasks.js
24938
25447
  var SPONSORED_TASKS_PROGRAM_ADDRESS = "STvau1t111111111111111111111111111111111111";
24939
25448
  var SponsoredTasksAccount;
@@ -24950,22 +25459,24 @@ var SponsoredTasksEvent;
24950
25459
  SponsoredTasksEvent2[SponsoredTasksEvent2["AdminProposed"] = 1] = "AdminProposed";
24951
25460
  SponsoredTasksEvent2[SponsoredTasksEvent2["ClaimDelaySet"] = 2] = "ClaimDelaySet";
24952
25461
  SponsoredTasksEvent2[SponsoredTasksEvent2["ConfigInitialized"] = 3] = "ConfigInitialized";
24953
- SponsoredTasksEvent2[SponsoredTasksEvent2["FeeClaimed"] = 4] = "FeeClaimed";
24954
- SponsoredTasksEvent2[SponsoredTasksEvent2["FeeSet"] = 5] = "FeeSet";
24955
- SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerConfigured"] = 6] = "ManagerConfigured";
24956
- SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerRemoved"] = 7] = "ManagerRemoved";
24957
- SponsoredTasksEvent2[SponsoredTasksEvent2["PauseSet"] = 8] = "PauseSet";
24958
- SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBindingPending"] = 9] = "PayoutBindingPending";
24959
- SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBound"] = 10] = "PayoutBound";
24960
- SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementInstalled"] = 11] = "SettlementInstalled";
24961
- SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementRevoked"] = 12] = "SettlementRevoked";
24962
- SponsoredTasksEvent2[SponsoredTasksEvent2["SettlersChanged"] = 13] = "SettlersChanged";
24963
- SponsoredTasksEvent2[SponsoredTasksEvent2["SponsoredTaskClaimed"] = 14] = "SponsoredTaskClaimed";
24964
- SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReleased"] = 15] = "TaskReleased";
24965
- SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReserved"] = 16] = "TaskReserved";
24966
- SponsoredTasksEvent2[SponsoredTasksEvent2["VaultCreated"] = 17] = "VaultCreated";
24967
- SponsoredTasksEvent2[SponsoredTasksEvent2["VaultEmergencyExited"] = 18] = "VaultEmergencyExited";
24968
- SponsoredTasksEvent2[SponsoredTasksEvent2["VaultFunded"] = 19] = "VaultFunded";
25462
+ SponsoredTasksEvent2[SponsoredTasksEvent2["ExitedVaultSwept"] = 4] = "ExitedVaultSwept";
25463
+ SponsoredTasksEvent2[SponsoredTasksEvent2["FeeClaimed"] = 5] = "FeeClaimed";
25464
+ SponsoredTasksEvent2[SponsoredTasksEvent2["FeeSet"] = 6] = "FeeSet";
25465
+ SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerConfigured"] = 7] = "ManagerConfigured";
25466
+ SponsoredTasksEvent2[SponsoredTasksEvent2["ManagerRemoved"] = 8] = "ManagerRemoved";
25467
+ SponsoredTasksEvent2[SponsoredTasksEvent2["PauseSet"] = 9] = "PauseSet";
25468
+ SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBindingPending"] = 10] = "PayoutBindingPending";
25469
+ SponsoredTasksEvent2[SponsoredTasksEvent2["PayoutBound"] = 11] = "PayoutBound";
25470
+ SponsoredTasksEvent2[SponsoredTasksEvent2["ReservationDeadlineExtended"] = 12] = "ReservationDeadlineExtended";
25471
+ SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementInstalled"] = 13] = "SettlementInstalled";
25472
+ SponsoredTasksEvent2[SponsoredTasksEvent2["SettlementRevoked"] = 14] = "SettlementRevoked";
25473
+ SponsoredTasksEvent2[SponsoredTasksEvent2["SettlersChanged"] = 15] = "SettlersChanged";
25474
+ SponsoredTasksEvent2[SponsoredTasksEvent2["SponsoredTaskClaimed"] = 16] = "SponsoredTaskClaimed";
25475
+ SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReleased"] = 17] = "TaskReleased";
25476
+ SponsoredTasksEvent2[SponsoredTasksEvent2["TaskReserved"] = 18] = "TaskReserved";
25477
+ SponsoredTasksEvent2[SponsoredTasksEvent2["VaultCreated"] = 19] = "VaultCreated";
25478
+ SponsoredTasksEvent2[SponsoredTasksEvent2["VaultEmergencyExited"] = 20] = "VaultEmergencyExited";
25479
+ SponsoredTasksEvent2[SponsoredTasksEvent2["VaultFunded"] = 21] = "VaultFunded";
24969
25480
  })(SponsoredTasksEvent || (SponsoredTasksEvent = {}));
24970
25481
  var SponsoredTasksInstruction;
24971
25482
  (function(SponsoredTasksInstruction2) {
@@ -24976,19 +25487,21 @@ var SponsoredTasksInstruction;
24976
25487
  SponsoredTasksInstruction2[SponsoredTasksInstruction2["ClaimFee"] = 4] = "ClaimFee";
24977
25488
  SponsoredTasksInstruction2[SponsoredTasksInstruction2["CreateVault"] = 5] = "CreateVault";
24978
25489
  SponsoredTasksInstruction2[SponsoredTasksInstruction2["EmergencyExit"] = 6] = "EmergencyExit";
24979
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["Fund"] = 7] = "Fund";
24980
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["InitConfig"] = 8] = "InitConfig";
24981
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["Pause"] = 9] = "Pause";
24982
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["Release"] = 10] = "Release";
24983
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["ReleaseExpired"] = 11] = "ReleaseExpired";
24984
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["Reserve"] = 12] = "Reserve";
24985
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["RevokeSettlement"] = 13] = "RevokeSettlement";
24986
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetAdmin"] = 14] = "SetAdmin";
24987
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetClaimDelay"] = 15] = "SetClaimDelay";
24988
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetFee"] = 16] = "SetFee";
24989
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetManagers"] = 17] = "SetManagers";
24990
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetSettlers"] = 18] = "SetSettlers";
24991
- SponsoredTasksInstruction2[SponsoredTasksInstruction2["Settle"] = 19] = "Settle";
25490
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["ExtendDeadline"] = 7] = "ExtendDeadline";
25491
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["Fund"] = 8] = "Fund";
25492
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["InitConfig"] = 9] = "InitConfig";
25493
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["Pause"] = 10] = "Pause";
25494
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["Release"] = 11] = "Release";
25495
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["ReleaseExpired"] = 12] = "ReleaseExpired";
25496
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["Reserve"] = 13] = "Reserve";
25497
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["RevokeSettlement"] = 14] = "RevokeSettlement";
25498
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetAdmin"] = 15] = "SetAdmin";
25499
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetClaimDelay"] = 16] = "SetClaimDelay";
25500
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetFee"] = 17] = "SetFee";
25501
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetManagers"] = 18] = "SetManagers";
25502
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SetSettlers"] = 19] = "SetSettlers";
25503
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["Settle"] = 20] = "Settle";
25504
+ SponsoredTasksInstruction2[SponsoredTasksInstruction2["SweepExited"] = 21] = "SweepExited";
24992
25505
  })(SponsoredTasksInstruction || (SponsoredTasksInstruction = {}));
24993
25506
 
24994
25507
  // ../../packages/solana-sponsored-client/dist/generated/errors/sponsoredTasks.js
@@ -25034,6 +25547,9 @@ var SPONSORED_TASKS_ERROR__INVALID_CLUSTER_ID = 6038;
25034
25547
  var SPONSORED_TASKS_ERROR__PAYOUT_SIGNATURE_EXPIRED = 6039;
25035
25548
  var SPONSORED_TASKS_ERROR__INVALID_PAYOUT_NONCE = 6040;
25036
25549
  var SPONSORED_TASKS_ERROR__RESERVATION_NOT_EXPIRED = 6041;
25550
+ var SPONSORED_TASKS_ERROR__VAULT_NOT_EXITED = 6042;
25551
+ var SPONSORED_TASKS_ERROR__DEADLINE_TOO_FAR = 6043;
25552
+ var SPONSORED_TASKS_ERROR__PAYOUT_ACCOUNT_NOT_ASSOCIATED = 6044;
25037
25553
  var sponsoredTasksErrorMessages;
25038
25554
  if (process.env["NODE_ENV"] !== "production") {
25039
25555
  sponsoredTasksErrorMessages = {
@@ -25041,6 +25557,7 @@ if (process.env["NODE_ENV"] !== "production") {
25041
25557
  [SPONSORED_TASKS_ERROR__CLAIM_DELAY_NOT_ELAPSED]: `The settlement's claim delay has not passed`,
25042
25558
  [SPONSORED_TASKS_ERROR__CLAIM_INDEX_OUT_OF_BOUNDS]: `Award leaf index is not below the settlement's leaf count`,
25043
25559
  [SPONSORED_TASKS_ERROR__DEADLINE_IN_PAST]: `Reservation deadline is in the past`,
25560
+ [SPONSORED_TASKS_ERROR__DEADLINE_TOO_FAR]: `Reservation deadline is more than MAX_RESERVATION_SECS from now`,
25044
25561
  [SPONSORED_TASKS_ERROR__EPOCH_MISMATCH]: `Reservation belongs to an earlier vault epoch`,
25045
25562
  [SPONSORED_TASKS_ERROR__INSUFFICIENT_AVAILABLE]: `Reservation exceeds the vault's available balance`,
25046
25563
  [SPONSORED_TASKS_ERROR__INVALID_ADMIN]: `Admin must not be the zero key`,
@@ -25053,7 +25570,7 @@ if (process.env["NODE_ENV"] !== "production") {
25053
25570
  [SPONSORED_TASKS_ERROR__INVALID_PAYOUT_NONCE]: `Payout binding nonce must be below u64::MAX`,
25054
25571
  [SPONSORED_TASKS_ERROR__INVALID_PAYOUT_SIGNATURE]: `Payout binding signature is not from the agent`,
25055
25572
  [SPONSORED_TASKS_ERROR__INVALID_SETTLEMENT_TOTALS]: `Settlement totals do not add up or do not match the root`,
25056
- [SPONSORED_TASKS_ERROR__INVALID_SETTLERS]: `Settler set is empty, too large or has duplicates`,
25573
+ [SPONSORED_TASKS_ERROR__INVALID_SETTLERS]: `Settler set is empty, too large, has duplicates or the zero key`,
25057
25574
  [SPONSORED_TASKS_ERROR__INVALID_THRESHOLD]: `Threshold must be between 1 and the number of settlers`,
25058
25575
  [SPONSORED_TASKS_ERROR__MANAGER_ALLOWANCE_EXCEEDED]: `Reservation exceeds the manager's remaining allowance`,
25059
25576
  [SPONSORED_TASKS_ERROR__MANAGER_CHAIN_MISMATCH]: `Manager is on a different chain than the task`,
@@ -25066,6 +25583,7 @@ if (process.env["NODE_ENV"] !== "production") {
25066
25583
  [SPONSORED_TASKS_ERROR__NOT_SPONSOR]: `Caller is not the vault sponsor`,
25067
25584
  [SPONSORED_TASKS_ERROR__OVERFLOW]: `Arithmetic overflow`,
25068
25585
  [SPONSORED_TASKS_ERROR__PAUSED]: `Program is paused`,
25586
+ [SPONSORED_TASKS_ERROR__PAYOUT_ACCOUNT_NOT_ASSOCIATED]: `Destination is not the payout's associated token account`,
25069
25587
  [SPONSORED_TASKS_ERROR__PAYOUT_NOT_BOUND]: `Worker has no payout binding`,
25070
25588
  [SPONSORED_TASKS_ERROR__PAYOUT_SIGNATURE_EXPIRED]: `Payout binding signature has expired`,
25071
25589
  [SPONSORED_TASKS_ERROR__RESERVATION_NOT_EXPIRED]: `Reservation deadline has not passed`,
@@ -25078,6 +25596,7 @@ if (process.env["NODE_ENV"] !== "production") {
25078
25596
  [SPONSORED_TASKS_ERROR__TRANSFER_AMOUNT_MISMATCH]: `Vault received a different amount than was sent`,
25079
25597
  [SPONSORED_TASKS_ERROR__UNSUPPORTED_MINT_EXTENSION]: `Mint has an extension the vault does not accept`,
25080
25598
  [SPONSORED_TASKS_ERROR__VAULT_NOT_ACTIVE]: `Vault is not active`,
25599
+ [SPONSORED_TASKS_ERROR__VAULT_NOT_EXITED]: `Vault has not exited`,
25081
25600
  [SPONSORED_TASKS_ERROR__ZERO_AMOUNT]: `Amount must be greater than zero`
25082
25601
  };
25083
25602
  }
@@ -25130,6 +25649,18 @@ var CONFIG_INITIALIZED_EVENT_DISCRIMINATOR = new Uint8Array([
25130
25649
  91
25131
25650
  ]);
25132
25651
 
25652
+ // ../../packages/solana-sponsored-client/dist/generated/events/exitedVaultSwept.js
25653
+ var EXITED_VAULT_SWEPT_EVENT_DISCRIMINATOR = new Uint8Array([
25654
+ 253,
25655
+ 50,
25656
+ 228,
25657
+ 175,
25658
+ 185,
25659
+ 60,
25660
+ 9,
25661
+ 133
25662
+ ]);
25663
+
25133
25664
  // ../../packages/solana-sponsored-client/dist/generated/events/feeClaimed.js
25134
25665
  var FEE_CLAIMED_EVENT_DISCRIMINATOR = new Uint8Array([
25135
25666
  202,
@@ -25214,6 +25745,9 @@ var PAYOUT_BOUND_EVENT_DISCRIMINATOR = new Uint8Array([
25214
25745
  31
25215
25746
  ]);
25216
25747
 
25748
+ // ../../packages/solana-sponsored-client/dist/generated/events/reservationDeadlineExtended.js
25749
+ var RESERVATION_DEADLINE_EXTENDED_EVENT_DISCRIMINATOR = new Uint8Array([84, 139, 91, 136, 29, 55, 178, 64]);
25750
+
25217
25751
  // ../../packages/solana-sponsored-client/dist/generated/events/settlementInstalled.js
25218
25752
  var SETTLEMENT_INSTALLED_EVENT_DISCRIMINATOR = new Uint8Array([
25219
25753
  170,
@@ -26097,6 +26631,14 @@ async function configureSolana(opts, solanaChainId) {
26097
26631
  renderFailure(err);
26098
26632
  }
26099
26633
  }
26634
+ async function isChainScopedVault(publicClient, vault) {
26635
+ const version2 = await publicClient.readContract({
26636
+ address: vault,
26637
+ abi: SponsoredTasksVaultV2ABI,
26638
+ functionName: "VAULT_VERSION"
26639
+ });
26640
+ return Number(version2) >= 3;
26641
+ }
26100
26642
  async function configure(opts) {
26101
26643
  const vaultChainId = opts.chainId;
26102
26644
  if (isSolanaChainId(vaultChainId)) return configureSolana(opts, vaultChainId);
@@ -26110,16 +26652,44 @@ async function configure(opts) {
26110
26652
  keystore,
26111
26653
  opts.chainId
26112
26654
  );
26655
+ const vault = opts.vault;
26656
+ const manager = opts.manager;
26657
+ const remote = isSettlerModeChainId(vaultChainId);
26658
+ if (!remote && opts.managerChainId !== void 0 && opts.managerChainId !== vaultChainId) {
26659
+ printError(
26660
+ `--manager-chain-id must be the vault's own chain (${vaultChainId}) for this vault: its tasks are created only on that chain. Leave the option out.`
26661
+ );
26662
+ return;
26663
+ }
26664
+ const managerChainId = opts.managerChainId !== void 0 && opts.managerChainId !== vaultChainId ? opts.managerChainId : void 0;
26665
+ const chainScoped = remote || managerChainId !== void 0 ? await isChainScopedVault(publicClient, vault) : false;
26666
+ if (chainScoped && remote && managerChainId === void 0) {
26667
+ printError(
26668
+ "--manager-chain-id is required for this vault: the chain the manager creates tasks on (base, tempo, 8453 or 4217). Its allowance is spent only by tasks from that chain."
26669
+ );
26670
+ return;
26671
+ }
26672
+ if (!chainScoped && managerChainId !== void 0) {
26673
+ printError(
26674
+ "--manager-chain-id does not apply to this vault: it predates per-chain allowances, so one allowance covers every task chain it serves. Leave the option out."
26675
+ );
26676
+ return;
26677
+ }
26113
26678
  let cap;
26114
26679
  if (opts.cap !== void 0) {
26115
26680
  cap = BigInt(opts.cap);
26116
26681
  } else {
26117
- const current = await publicClient.readContract({
26118
- address: opts.vault,
26682
+ const current = await (managerChainId !== void 0 ? publicClient.readContract({
26683
+ address: vault,
26684
+ abi: SponsoredTasksVaultV2ABI,
26685
+ functionName: "managerAccountForChain",
26686
+ args: [BigInt(managerChainId), manager]
26687
+ }) : publicClient.readContract({
26688
+ address: vault,
26119
26689
  abi: SponsoredTasksVaultV2ABI,
26120
26690
  functionName: "managerAccount",
26121
- args: [opts.manager]
26122
- });
26691
+ args: [manager]
26692
+ }));
26123
26693
  cap = current.reserved + current.spent;
26124
26694
  }
26125
26695
  const { txHash, feePayer } = await writeSponsoredTaskVaultContract({
@@ -26127,15 +26697,18 @@ async function configure(opts) {
26127
26697
  publicClient,
26128
26698
  walletClient,
26129
26699
  relay,
26130
- address: opts.vault,
26700
+ address: vault,
26131
26701
  abi: SponsoredTasksVaultV2ABI,
26132
- functionName: "configureManager",
26133
- args: [opts.manager, cap, opts.active]
26702
+ ...managerChainId !== void 0 ? {
26703
+ functionName: "configureManagerForChain",
26704
+ args: [BigInt(managerChainId), manager, cap, opts.active]
26705
+ } : { functionName: "configureManager", args: [manager, cap, opts.active] }
26134
26706
  });
26135
26707
  printResult({
26136
26708
  txHash,
26137
26709
  ...feePayer ? { feePayer } : {},
26138
26710
  manager: opts.manager,
26711
+ ...managerChainId !== void 0 ? { managerChainId } : {},
26139
26712
  spendCap: cap.toString(),
26140
26713
  active: opts.active
26141
26714
  });
@@ -26149,7 +26722,7 @@ sponsoredTaskManagersCommand.command("add").description("Authorize a manager wit
26149
26722
  chainOption("--chain-id", "vault")
26150
26723
  ).requiredOption("--manager <address>", "Manager EVM address to authorize").requiredOption("--cap <baseUnits>", "Spend cap, in the project token base units").option(
26151
26724
  "--manager-chain-id <chain>",
26152
- "Solana vaults: the chain the manager creates tasks on, by name or id (base, tempo, 8453 or 4217)",
26725
+ "The chain the manager creates tasks on, by name or id (base, tempo, 8453 or 4217): required for a Solana vault and a remote EVM vault from rev031",
26153
26726
  chainOption("--manager-chain-id", "market")
26154
26727
  ).option("--program-id <address>", "Solana vaults: override the cluster's program id").action((opts) => configure({ ...opts, active: true }));
26155
26728
  sponsoredTaskManagersCommand.command("remove").description("Deactivate a manager (does not reclaim tokens already reserved)").requiredOption("--vault <address>", "Vault address (base58 for a Solana vault)").requiredOption(
@@ -26158,7 +26731,7 @@ sponsoredTaskManagersCommand.command("remove").description("Deactivate a manager
26158
26731
  chainOption("--chain-id", "vault")
26159
26732
  ).requiredOption("--manager <address>", "Manager EVM address to deactivate").option(
26160
26733
  "--manager-chain-id <chain>",
26161
- "Solana vaults: the chain the manager creates tasks on, by name or id (base, tempo, 8453 or 4217)",
26734
+ "The chain the manager creates tasks on, by name or id (base, tempo, 8453 or 4217): required for a Solana vault and a remote EVM vault from rev031",
26162
26735
  chainOption("--manager-chain-id", "market")
26163
26736
  ).option("--program-id <address>", "Solana vaults: override the cluster's program id").action((opts) => configure({ ...opts, active: false }));
26164
26737
  sponsoredTaskManagersCommand.command("list").description("List a vault authorized managers").requiredOption("--vault-id <id>", "Vault id").action(async (opts) => {
@@ -27784,8 +28357,82 @@ var projectFundCommand = new Command138("fund").description(
27784
28357
  });
27785
28358
 
27786
28359
  // src/commands/project/grant.ts
28360
+ import { Command as Command140 } from "commander";
28361
+
28362
+ // src/commands/project/limits.ts
27787
28363
  import { Command as Command139 } from "commander";
27788
- function grantBody(projectId, opts) {
28364
+ function limitFields(opts, now = /* @__PURE__ */ new Date()) {
28365
+ const body = {};
28366
+ if (opts.expires !== void 0) {
28367
+ const at = parseEndsAt(opts.expires, now, "--expires");
28368
+ if (typeof at !== "string") return at;
28369
+ body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
28370
+ }
28371
+ if (opts.modes !== void 0) {
28372
+ const modes = opts.modes.split(",").map((m) => m.trim().toLowerCase());
28373
+ const unknown = modes.filter((m) => !GRANT_MODE_NAMES.includes(m));
28374
+ if (modes.length === 0 || unknown.length > 0) {
28375
+ return { error: `--modes takes a comma-separated list of: ${GRANT_MODE_NAMES.join(", ")}` };
28376
+ }
28377
+ body.allowedModes = [...new Set(modes)];
28378
+ }
28379
+ if (opts.maxReward !== void 0) {
28380
+ const max = parseAmount(opts.maxReward, "--max-reward");
28381
+ if (typeof max !== "string") return max;
28382
+ if (BigInt(max) <= 0n) return { error: "--max-reward must be greater than zero" };
28383
+ body.maxRewardPerTask = max;
28384
+ }
28385
+ if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
28386
+ return { error: "--period-budget and --period go together: pass both or neither" };
28387
+ }
28388
+ if (opts.periodBudget !== void 0 && opts.period !== void 0) {
28389
+ if (opts.period !== "weekly" && opts.period !== "monthly") {
28390
+ return { error: "--period must be weekly or monthly" };
28391
+ }
28392
+ const periodCap = parseAmount(opts.periodBudget, "--period-budget");
28393
+ if (typeof periodCap !== "string") return periodCap;
28394
+ if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
28395
+ body.periodCap = periodCap;
28396
+ body.period = opts.period;
28397
+ }
28398
+ return body;
28399
+ }
28400
+ function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
28401
+ if (!ADDRESS.test(opts.operator)) {
28402
+ return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
28403
+ }
28404
+ const fields = limitFields(opts, now);
28405
+ if ("error" in fields) return fields;
28406
+ return { projectId, operator: opts.operator, ...fields };
28407
+ }
28408
+ function withLimitFlags(command) {
28409
+ return command.option(
28410
+ "--expires <time>",
28411
+ "The operator cannot draw after this time: ISO 8601 or a duration such as 30d"
28412
+ ).option(
28413
+ "--modes <list>",
28414
+ `Task modes the operator may create, comma separated (${GRANT_MODE_NAMES.join(", ")}); default every mode`
28415
+ ).option(
28416
+ "--max-reward <amount>",
28417
+ "The most one task may hold from the budget (reward plus evaluator stake), in the payment token"
28418
+ ).option("--period-budget <amount>", "The most the operator may draw per period. Needs --period").option("--period <period>", "weekly (7 days) or monthly (30 days). Needs --period-budget");
28419
+ }
28420
+ var projectLimitsCommand = withLimitFlags(
28421
+ new Command139("limits").description(
28422
+ "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. From contract revision 31 the operator accepts the limits with the terms, so on a pending grant it must accept again after a change. For the platform runner, `project automations on` takes --expires, --period-budget and --period"
28423
+ ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set")
28424
+ ).action(async (id, opts) => {
28425
+ const projectId = parseProjectId(id);
28426
+ if (typeof projectId !== "number") return void printError(projectId.error);
28427
+ const body = limitsBody(projectId, opts);
28428
+ if ("error" in body) return void printError(String(body.error));
28429
+ await postProjectWrite(`/api/projects/${projectId}/grants/${opts.operator}/limits`, body, {
28430
+ maxAmount: ACTION_FEE_MAX_AMOUNT
28431
+ });
28432
+ });
28433
+
28434
+ // src/commands/project/grant.ts
28435
+ function grantBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
27789
28436
  if (!ADDRESS.test(opts.operator)) {
27790
28437
  return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
27791
28438
  }
@@ -27798,30 +28445,35 @@ function grantBody(projectId, opts) {
27798
28445
  if (typeof parsed !== "string") return parsed;
27799
28446
  cap = parsed;
27800
28447
  }
28448
+ const limits = limitFields(opts, now);
28449
+ if ("error" in limits) return limits;
27801
28450
  return {
27802
28451
  projectId,
27803
28452
  operator: opts.operator,
27804
28453
  cap,
27805
28454
  requesterOfRecord: opts.requesterOfRecord,
27806
28455
  ownerOverride: opts.ownerOverride,
27807
- revokeRemovesControl: opts.revokeRemovesControl
28456
+ revokeRemovesControl: opts.revokeRemovesControl,
28457
+ ...limits
27808
28458
  };
27809
28459
  }
27810
- var projectGrantCommand = new Command139("grant").description(
27811
- "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)"
27812
- ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
27813
- "--cap <amount>",
27814
- "The most the operator's tasks may draw from the budget in total, net of refunds (payouts keep counting, refunds free it), in the payment token (default: no cap beyond the budget)"
27815
- ).option(
27816
- "--requester-of-record <who>",
27817
- "Who is task.requester on the operator's tasks, whom ratings and reputation follow: owner or operator",
27818
- "owner"
27819
- ).option(
27820
- "--no-owner-override",
27821
- "Only the operator acts on its tasks; by default the owner may also accept, reject or cancel them"
27822
- ).option(
27823
- "--no-revoke-removes-control",
27824
- "On revoke, let the operator finish the tasks it created instead of passing them to the owner"
28460
+ var projectGrantCommand = withLimitFlags(
28461
+ new Command140("grant").description(
28462
+ "Grant a wallet (an agent or a person) the right to create tasks from the project's budget under the terms and limits below; a limit flag you leave out is no limit of that kind. It can spend only after it accepts, which freezes the terms (from contract revision 31 the operator accepts the limits with them); 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; limits need contract revision 29 or later)"
28463
+ ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The wallet granted the right to spend the budget").option(
28464
+ "--cap <amount>",
28465
+ "The most the operator's tasks may draw from the budget in total, net of refunds (payouts keep counting, refunds free it), in the payment token (default: no cap beyond the budget)"
28466
+ ).option(
28467
+ "--requester-of-record <who>",
28468
+ "Who is task.requester on the operator's tasks, whom ratings and reputation follow: owner or operator",
28469
+ "owner"
28470
+ ).option(
28471
+ "--no-owner-override",
28472
+ "Only the operator acts on its tasks; by default the owner may also accept, reject or cancel them"
28473
+ ).option(
28474
+ "--no-revoke-removes-control",
28475
+ "On revoke, let the operator finish the tasks it created instead of passing them to the owner"
28476
+ )
27825
28477
  ).action(async (id, opts) => {
27826
28478
  const projectId = parseProjectId(id);
27827
28479
  if (typeof projectId !== "number") return void printError(projectId.error);
@@ -27833,7 +28485,7 @@ var projectGrantCommand = new Command139("grant").description(
27833
28485
  });
27834
28486
 
27835
28487
  // src/commands/project/review.ts
27836
- import { Command as Command140 } from "commander";
28488
+ import { Command as Command141 } from "commander";
27837
28489
  function reviewEvaluator(opts) {
27838
28490
  if (opts.evaluator !== void 0 && opts.off) {
27839
28491
  return { error: "Pass --evaluator <address> or --off, not both" };
@@ -27848,7 +28500,7 @@ function reviewEvaluator(opts) {
27848
28500
  }
27849
28501
  return opts.evaluator;
27850
28502
  }
27851
- var projectReviewCommand = new Command140("review").description(
28503
+ var projectReviewCommand = new Command141("review").description(
27852
28504
  "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"
27853
28505
  ).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) => {
27854
28506
  const projectId = parseProjectId(id);
@@ -27890,8 +28542,8 @@ async function ownerEvaluatorWarnings(evaluator) {
27890
28542
  }
27891
28543
 
27892
28544
  // src/commands/project/raise-cap.ts
27893
- import { Command as Command141 } from "commander";
27894
- var projectRaiseCapCommand = new Command141("raise-cap").description(
28545
+ import { Command as Command142 } from "commander";
28546
+ var projectRaiseCapCommand = new Command142("raise-cap").description(
27895
28547
  "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"
27896
28548
  ).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) => {
27897
28549
  const projectId = parseProjectId(id);
@@ -27909,8 +28561,8 @@ var projectRaiseCapCommand = new Command141("raise-cap").description(
27909
28561
  });
27910
28562
 
27911
28563
  // src/commands/project/lower-cap.ts
27912
- import { Command as Command142 } from "commander";
27913
- var projectLowerCapCommand = new Command142("lower-cap").description(
28564
+ import { Command as Command143 } from "commander";
28565
+ var projectLowerCapCommand = new Command143("lower-cap").description(
27914
28566
  "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`"
27915
28567
  ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose cap to lower").requiredOption(
27916
28568
  "--cap <amount>",
@@ -27931,68 +28583,6 @@ var projectLowerCapCommand = new Command142("lower-cap").description(
27931
28583
  );
27932
28584
  });
27933
28585
 
27934
- // src/commands/project/limits.ts
27935
- import { Command as Command143 } from "commander";
27936
- function limitsBody(projectId, opts, now = /* @__PURE__ */ new Date()) {
27937
- if (!ADDRESS.test(opts.operator)) {
27938
- return { error: "--operator must be a wallet address (0x + 40 hex chars)" };
27939
- }
27940
- const body = { projectId, operator: opts.operator };
27941
- if (opts.expires !== void 0) {
27942
- const at = parseEndsAt(opts.expires, now, "--expires");
27943
- if (typeof at !== "string") return at;
27944
- body.expiresAt = Math.floor(new Date(at).getTime() / 1e3);
27945
- }
27946
- if (opts.modes !== void 0) {
27947
- const modes = opts.modes.split(",").map((m) => m.trim().toLowerCase());
27948
- const unknown = modes.filter((m) => !GRANT_MODE_NAMES.includes(m));
27949
- if (modes.length === 0 || unknown.length > 0) {
27950
- return { error: `--modes takes a comma-separated list of: ${GRANT_MODE_NAMES.join(", ")}` };
27951
- }
27952
- body.allowedModes = [...new Set(modes)];
27953
- }
27954
- if (opts.maxReward !== void 0) {
27955
- const max = parseAmount(opts.maxReward, "--max-reward");
27956
- if (typeof max !== "string") return max;
27957
- if (BigInt(max) <= 0n) return { error: "--max-reward must be greater than zero" };
27958
- body.maxRewardPerTask = max;
27959
- }
27960
- if (opts.periodBudget === void 0 !== (opts.period === void 0)) {
27961
- return { error: "--period-budget and --period go together: pass both or neither" };
27962
- }
27963
- if (opts.periodBudget !== void 0 && opts.period !== void 0) {
27964
- if (opts.period !== "weekly" && opts.period !== "monthly") {
27965
- return { error: "--period must be weekly or monthly" };
27966
- }
27967
- const periodCap = parseAmount(opts.periodBudget, "--period-budget");
27968
- if (typeof periodCap !== "string") return periodCap;
27969
- if (BigInt(periodCap) <= 0n) return { error: "--period-budget must be greater than zero" };
27970
- body.periodCap = periodCap;
27971
- body.period = opts.period;
27972
- }
27973
- return body;
27974
- }
27975
- var projectLimitsCommand = new Command143("limits").description(
27976
- "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"
27977
- ).argument("<projectId>", "Project id").requiredOption("--operator <address>", "The operator whose limits to set").option(
27978
- "--expires <time>",
27979
- "The operator cannot draw after this time: ISO 8601 or a duration such as 30d"
27980
- ).option(
27981
- "--modes <list>",
27982
- `Task modes the operator may create, comma separated (${GRANT_MODE_NAMES.join(", ")}); default every mode`
27983
- ).option(
27984
- "--max-reward <amount>",
27985
- "The most one task may hold from the budget (reward plus evaluator stake), in the payment token"
27986
- ).option("--period-budget <amount>", "The most the operator may draw per period. Needs --period").option("--period <period>", "weekly (7 days) or monthly (30 days). Needs --period-budget").action(async (id, opts) => {
27987
- const projectId = parseProjectId(id);
27988
- if (typeof projectId !== "number") return void printError(projectId.error);
27989
- const body = limitsBody(projectId, opts);
27990
- if ("error" in body) return void printError(String(body.error));
27991
- await postProjectWrite(`/api/projects/${projectId}/grants/${opts.operator}/limits`, body, {
27992
- maxAmount: ACTION_FEE_MAX_AMOUNT
27993
- });
27994
- });
27995
-
27996
28586
  // src/commands/project/revoke.ts
27997
28587
  import { Command as Command144 } from "commander";
27998
28588
  var projectRevokeCommand = new Command144("revoke").description(
@@ -30152,13 +30742,37 @@ tapCommand.command("create").description(
30152
30742
  renderFailure(err);
30153
30743
  }
30154
30744
  });
30745
+ var CARD_VERIFICATION_NEXT_STEP = "Have the agent owner open verificationUrl in a browser to link a Visa card, then re-run 'taskmarket tap enrol' (or run with --wait).";
30746
+ function parseWaitTimeoutSeconds(raw) {
30747
+ if (raw === void 0) return TAP_WAIT_DEFAULT_TIMEOUT_SECONDS;
30748
+ const trimmed = raw.trim();
30749
+ if (!/^\d+$/.test(trimmed)) {
30750
+ throw new Error(
30751
+ `--wait-timeout must be a positive integer between 1 and ${TAP_WAIT_MAX_TIMEOUT_SECONDS} seconds`
30752
+ );
30753
+ }
30754
+ const seconds = Number(trimmed);
30755
+ if (!Number.isSafeInteger(seconds) || seconds < 1 || seconds > TAP_WAIT_MAX_TIMEOUT_SECONDS) {
30756
+ throw new Error(
30757
+ `--wait-timeout must be a positive integer between 1 and ${TAP_WAIT_MAX_TIMEOUT_SECONDS} seconds`
30758
+ );
30759
+ }
30760
+ return seconds;
30761
+ }
30155
30762
  tapCommand.command("enrol").description(
30156
30763
  "Enrol the stored TAP key on the configured network's chain and store the key id it gets. On a chain that supports it, the key (ECDSA P-256) is registered with the verifier's directory and the directory URL is stored for Signature-Agent; elsewhere enrolment is refused."
30157
30764
  ).option(
30158
30765
  "--force",
30159
- "Enrol a key this CLI already enrolled on this chain again; the server replaces its previous key there"
30766
+ "Enrol a key this CLI already enrolled on this chain again: it keeps its key id unless the directory no longer resolves it, which registers it again"
30767
+ ).option(
30768
+ "--wait",
30769
+ "Wait for the owner to complete Visa card verification in a browser and save the issued key id"
30770
+ ).option(
30771
+ "--wait-timeout <seconds>",
30772
+ `Maximum seconds to wait with --wait (default: ${TAP_WAIT_DEFAULT_TIMEOUT_SECONDS})`
30160
30773
  ).action(async (opts) => {
30161
30774
  try {
30775
+ const waitTimeoutSeconds = parseWaitTimeoutSeconds(opts.waitTimeout);
30162
30776
  const keystore = await loadKeystore();
30163
30777
  const stored = keystore.tapKey;
30164
30778
  if (!stored) {
@@ -30177,8 +30791,33 @@ tapCommand.command("enrol").description(
30177
30791
  `The TAP key's key id ${stored.keyId} was not enrolled by 'tap enrol' on chain ${chainId}, so 'tap enrol --force' will not replace it. Use 'taskmarket tap remove' or 'taskmarket tap import --force' to replace the key.`
30178
30792
  );
30179
30793
  }
30180
- const enrolment = await enrolTapKey(stored, chainId);
30181
- const tapKey = withTapEnrolment(stored, enrolment);
30794
+ const outcome = await enrolTapKey(stored, chainId);
30795
+ if (outcome.status === "card_verification_required") {
30796
+ if (!opts.wait) {
30797
+ printResult({
30798
+ enrolled: false,
30799
+ status: "card_verification_required",
30800
+ chainId: outcome.chainId,
30801
+ sessionId: outcome.sessionId,
30802
+ verificationUrl: outcome.verificationUrl,
30803
+ expiresAt: outcome.expiresAt,
30804
+ nextStep: CARD_VERIFICATION_NEXT_STEP
30805
+ });
30806
+ return;
30807
+ }
30808
+ process.stderr.write(
30809
+ `Waiting for Visa card verification (expires ${outcome.expiresAt}): ${outcome.verificationUrl}
30810
+ `
30811
+ );
30812
+ const enrolment = await waitForTapEnrolment(outcome.sessionId, {
30813
+ timeoutMs: waitTimeoutSeconds * 1e3
30814
+ });
30815
+ const tapKey2 = withTapEnrolment(stored, enrolment);
30816
+ await saveKeystore({ ...keystore, tapKey: tapKey2 });
30817
+ printResult(tapKeySummary(tapKey2));
30818
+ return;
30819
+ }
30820
+ const tapKey = withTapEnrolment(stored, outcome.enrolment);
30182
30821
  await saveKeystore({ ...keystore, tapKey });
30183
30822
  printResult(tapKeySummary(tapKey));
30184
30823
  } catch (err) {