@lucid-agents/taskmarket 1.35.0 → 1.37.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-R76D244Y.js → api-X7M5ZRFO.js} +2 -2
  3. package/dist/{channels-SVCU2MU5.js → channels-JRY5YSNU.js} +4 -4
  4. package/dist/{chunk-CHX7O7EU.js → chunk-5YGFSGJA.js} +1 -1
  5. package/dist/{chunk-WP7GXSKE.js → chunk-ATZLUOQX.js} +3 -3
  6. package/dist/{chunk-QAGDCIMU.js → chunk-AUDDFWKQ.js} +372 -117
  7. package/dist/{chunk-KHDQRFHG.js → chunk-HNTWHQBL.js} +5 -5
  8. package/dist/{chunk-JRWRBSS2.js → chunk-IDSGZXDR.js} +3 -3
  9. package/dist/{chunk-YGSVDU2D.js → chunk-M2UVDGSH.js} +3 -3
  10. package/dist/{chunk-B7W4G3EY.js → chunk-NO227FAP.js} +1 -1
  11. package/dist/{chunk-L6D2CDVQ.js → chunk-OK3AHSZH.js} +8 -8
  12. package/dist/{chunk-BDKM5JMT.js → chunk-SKD2T3UR.js} +1 -1
  13. package/dist/{chunk-54OR2JDT.js → chunk-TDQHU2JT.js} +2 -2
  14. package/dist/{chunk-G3U2BQNC.js → chunk-XL76RC3P.js} +1 -1
  15. package/dist/{chunk-YHVP2UNE.js → chunk-YQLA6EXP.js} +1 -1
  16. package/dist/{doctor-IIVQFDIB.js → doctor-QGHPARVU.js} +8 -8
  17. package/dist/index.js +393 -84
  18. package/dist/{launch-OC4LIPSS.js → launch-6VCLZ7XR.js} +11 -11
  19. package/dist/pi-extensions/xgate.cjs +155 -3
  20. package/dist/{read-auth-AGP3CUMT.js → read-auth-AVN4SJSZ.js} +3 -3
  21. package/dist/{reconcile-H3JIKN2X.js → reconcile-HEON5ETE.js} +4 -4
  22. package/dist/{status-SARVECVT.js → status-6PCJLCTM.js} +8 -8
  23. package/dist/{sync-pull-IUPV57MU.js → sync-pull-62R4YTEO.js} +4 -4
  24. package/dist/{task-access-grants-HALV3NEO.js → task-access-grants-MIWSFZZ3.js} +2 -2
  25. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  listWorkerSubmissions,
15
15
  submitTaskFiles,
16
16
  taskRequirementsOf
17
- } from "./chunk-L6D2CDVQ.js";
17
+ } from "./chunk-OK3AHSZH.js";
18
18
  import {
19
19
  ComputeCreditError,
20
20
  applyComputeCreditSetup,
@@ -35,15 +35,16 @@ import {
35
35
  reconcileX402PaymentById,
36
36
  refusedPaidWrite,
37
37
  releasePendingComputePurchase,
38
- resolvePendingComputePurchases
39
- } from "./chunk-JRWRBSS2.js";
38
+ resolvePendingComputePurchases,
39
+ x402FeePost
40
+ } from "./chunk-IDSGZXDR.js";
40
41
  import {
41
42
  signReadAuth
42
- } from "./chunk-54OR2JDT.js";
43
+ } from "./chunk-TDQHU2JT.js";
43
44
  import {
44
45
  saveTaskAccessGrant,
45
46
  taskAccessGrantHeaders
46
- } from "./chunk-CHX7O7EU.js";
47
+ } from "./chunk-5YGFSGJA.js";
47
48
  import {
48
49
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
49
50
  X402PayError,
@@ -61,7 +62,7 @@ import {
61
62
  setX402PolicyRuleEnabled,
62
63
  signSponsoredTempoTransfer,
63
64
  signTaskmarketFeePayment
64
- } from "./chunk-YHVP2UNE.js";
65
+ } from "./chunk-YQLA6EXP.js";
65
66
  import {
66
67
  ALL_NETWORKS,
67
68
  ApiError,
@@ -124,7 +125,7 @@ import {
124
125
  withErrorContext,
125
126
  withIdempotentWrite,
126
127
  withTapSignature
127
- } from "./chunk-G3U2BQNC.js";
128
+ } from "./chunk-XL76RC3P.js";
128
129
  import {
129
130
  AGENT_AVATAR_MAX_BYTES,
130
131
  AGENT_HIRES_ROLES,
@@ -154,6 +155,7 @@ import {
154
155
  CAPABILITY_LIMIT_MESSAGE,
155
156
  CapabilitiesListInputSchema,
156
157
  CapabilitiesListResponseSchema,
158
+ CatalogSubmissionEntrySchema,
157
159
  CrossChainFundingConfigOutputSchema,
158
160
  DEFAULT_EVALUATION_WINDOW_HOURS,
159
161
  DEFAULT_TERMS_BOUNDS,
@@ -177,6 +179,8 @@ import {
177
179
  HookIndexInputSchema,
178
180
  INITIAL_BRIEF_TURN_MESSAGE,
179
181
  IntentStatusResponseSchema,
182
+ LISTING_SUBMISSION_MAX_BYTES,
183
+ LISTING_SUBMISSION_STATUSES,
180
184
  LegalAcceptanceResponseSchema,
181
185
  LegalBundleSchema,
182
186
  LegalChallengeResponseSchema,
@@ -254,6 +258,9 @@ import {
254
258
  WORKFLOW_STEP_LIMIT_MAX,
255
259
  WORKFLOW_STEP_LIMIT_MIN,
256
260
  WORKFLOW_TEMPLATE_PARAMETERS_MAX,
261
+ WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH,
262
+ WORKFLOW_TEMPLATE_SEARCH_SORTS,
263
+ WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX,
257
264
  WalletMarketEventsInputSchema,
258
265
  apiErrorEnvelopeOf,
259
266
  assertSelectableCapabilities,
@@ -287,6 +294,7 @@ import {
287
294
  coreChains,
288
295
  dreamsToUsd,
289
296
  evaluationWindowError,
297
+ findHiddenCharacters,
290
298
  findTemplate,
291
299
  formatDreams,
292
300
  formatPaymentAmount,
@@ -298,6 +306,7 @@ import {
298
306
  hireSelectAtCapacityMessage,
299
307
  hireUnavailableAcknowledgeable,
300
308
  hireUnavailableMessage,
309
+ hookListingSubject,
301
310
  humanListingChangeError,
302
311
  isCapabilitySlug,
303
312
  isInFlightApiError,
@@ -307,9 +316,11 @@ import {
307
316
  isSolanaChainId,
308
317
  isTaskmarketChainId,
309
318
  isTerminalWalletBridgeStatus,
319
+ listingSubmissionWriteChange,
310
320
  marketEventPreferenceChange,
311
321
  needsYouKindForIntent,
312
322
  normalizeReferenceCode,
323
+ normalizeWorkflowTemplateTags,
313
324
  parseIsoDurationSeconds,
314
325
  parseScheduleCadence,
315
326
  paymentTokenSymbol,
@@ -341,11 +352,11 @@ import {
341
352
  vaultCallGasLimit7702,
342
353
  verifierProviderId,
343
354
  verifiersUnsupportedOnChain
344
- } from "./chunk-QAGDCIMU.js";
355
+ } from "./chunk-AUDDFWKQ.js";
345
356
  import "./chunk-S7SJMJ2I.js";
346
357
 
347
358
  // src/index.ts
348
- import { Command as Command151 } from "commander";
359
+ import { Command as Command153 } from "commander";
349
360
  import { createRequire } from "module";
350
361
 
351
362
  // src/commands/init.ts
@@ -12976,7 +12987,7 @@ async function runAgentCommand(options) {
12976
12987
  try {
12977
12988
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
12978
12989
  const pi = assertAgentCompatibility();
12979
- const { runAgent } = await import("./launch-OC4LIPSS.js");
12990
+ const { runAgent } = await import("./launch-6VCLZ7XR.js");
12980
12991
  result = await runAgent({
12981
12992
  model: options.model,
12982
12993
  pi,
@@ -13410,13 +13421,13 @@ function agentManagementCommands() {
13410
13421
  const status = new Command57("status").description(
13411
13422
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
13412
13423
  ).action(async () => {
13413
- const { collectAgentStatus } = await import("./status-SARVECVT.js");
13424
+ const { collectAgentStatus } = await import("./status-6PCJLCTM.js");
13414
13425
  await run(() => collectAgentStatus());
13415
13426
  });
13416
13427
  const doctor = new Command57("doctor").description(
13417
13428
  "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."
13418
13429
  ).action(async () => {
13419
- const { runDoctor } = await import("./doctor-IIVQFDIB.js");
13430
+ const { runDoctor } = await import("./doctor-QGHPARVU.js");
13420
13431
  const report = await run(() => runDoctor());
13421
13432
  if (report && !report.ok) process.exitCode = 1;
13422
13433
  });
@@ -13427,7 +13438,7 @@ function agentManagementCommands() {
13427
13438
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
13428
13439
  ).action(
13429
13440
  async (invocationId, options) => {
13430
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-H3JIKN2X.js");
13441
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-HEON5ETE.js");
13431
13442
  const choice = { rail: options.rail, channel: options.channel };
13432
13443
  if (invocationId !== void 0) {
13433
13444
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -13459,7 +13470,7 @@ function agentManagementCommands() {
13459
13470
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
13460
13471
  );
13461
13472
  }
13462
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-SVCU2MU5.js");
13473
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-JRY5YSNU.js");
13463
13474
  const { rails } = await openAgentChannels();
13464
13475
  const result = await requestTopUp(selectRail(rails, options.rail), amount);
13465
13476
  return {
@@ -13479,8 +13490,8 @@ function agentManagementCommands() {
13479
13490
  await run(async () => {
13480
13491
  await requireExperimental();
13481
13492
  const { AGENT_VIEW_VERSION } = await import("./budget-view-J6L7X6EY.js");
13482
- const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-SVCU2MU5.js");
13483
- const { reconcileLeasedPurchase } = await import("./reconcile-H3JIKN2X.js");
13493
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-JRY5YSNU.js");
13494
+ const { reconcileLeasedPurchase } = await import("./reconcile-HEON5ETE.js");
13484
13495
  const opened = await openAgentChannels();
13485
13496
  const { rail, retired } = selectChannel(opened, options);
13486
13497
  const result = await closeChannel(
@@ -13534,7 +13545,7 @@ function agentManagementCommands() {
13534
13545
  async (options) => {
13535
13546
  await run(async () => {
13536
13547
  await requireExperimental();
13537
- const { runPull } = await import("./sync-pull-IUPV57MU.js");
13548
+ const { runPull } = await import("./sync-pull-62R4YTEO.js");
13538
13549
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
13539
13550
  return runPull(options, {
13540
13551
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -19254,22 +19265,55 @@ var removeCommand = new Command101("remove").description("Remove a bookmark; an
19254
19265
  return renderFailure(error);
19255
19266
  }
19256
19267
  });
19257
- var listCommand4 = new Command101("list").description("List your bookmarks, newest first; agent entries carry their chainId").option("--type <type>", `Only one kind: ${ENTITY_TYPES.join(", ")}`).option("--collection <id>", "Only bookmarks in this collection").option("--limit <n>", "Maximum bookmarks to return (1-100)", "50").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(async (opts) => {
19258
- const entityType = opts.type === void 0 ? void 0 : parseEntityType(opts.type, "--type");
19259
- if (entityType === null) return;
19260
- const limit = Number(opts.limit);
19261
- if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
19262
- printError("--limit must be an integer from 1 to 100");
19263
- return;
19268
+ var listCommand4 = new Command101("list").description("List your bookmarks, newest first; agent entries carry their chainId").option("--type <type>", `Only one kind: ${ENTITY_TYPES.join(", ")}`).option("--collection <id>", "Only bookmarks in this collection").option("--pinned", "Only pinned bookmarks").option("--limit <n>", "Maximum bookmarks to return (1-100)", "50").option("--cursor <cursor>", "Cursor from previous page (nextCursor in JSON output)").action(
19269
+ async (opts) => {
19270
+ const entityType = opts.type === void 0 ? void 0 : parseEntityType(opts.type, "--type");
19271
+ if (entityType === null) return;
19272
+ const limit = Number(opts.limit);
19273
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
19274
+ printError("--limit must be an integer from 1 to 100");
19275
+ return;
19276
+ }
19277
+ const auth = await bookmarkAuth("Listing bookmarks");
19278
+ if (!auth) return;
19279
+ const params = new URLSearchParams({ limit: String(limit) });
19280
+ if (entityType) params.set("entityType", entityType);
19281
+ if (opts.collection) params.set("collectionId", opts.collection);
19282
+ if (opts.pinned) params.set("pinned", "true");
19283
+ if (opts.cursor) params.set("cursor", opts.cursor);
19284
+ try {
19285
+ printResult(await apiGet(`/api/bookmarks?${params.toString()}`, { headers: auth.headers }));
19286
+ } catch (error) {
19287
+ return renderFailure(error);
19288
+ }
19264
19289
  }
19265
- const auth = await bookmarkAuth("Listing bookmarks");
19290
+ );
19291
+ function pinToggle(name, description, action) {
19292
+ return new Command101(name).description(description).argument("<id>", "Bookmark id (from `taskmarket bookmark list`)").action(async (id) => {
19293
+ const auth = await bookmarkAuth(action);
19294
+ if (!auth) return;
19295
+ try {
19296
+ const { data, idempotencyKey } = await apiPost(
19297
+ `/api/bookmarks/${name}`,
19298
+ { id },
19299
+ { headers: auth.headers }
19300
+ );
19301
+ printResult(data, { idempotencyKey });
19302
+ } catch (error) {
19303
+ return renderFailure(error);
19304
+ }
19305
+ });
19306
+ }
19307
+ var countCommand = new Command101("count").description("Count your saved bookmarks").option("--pinned", "Count only pinned bookmarks").action(async (opts) => {
19308
+ const auth = await bookmarkAuth("Counting bookmarks");
19266
19309
  if (!auth) return;
19267
- const params = new URLSearchParams({ limit: String(limit) });
19268
- if (entityType) params.set("entityType", entityType);
19269
- if (opts.collection) params.set("collectionId", opts.collection);
19270
- if (opts.cursor) params.set("cursor", opts.cursor);
19310
+ const params = new URLSearchParams();
19311
+ if (opts.pinned) params.set("pinned", "true");
19312
+ const query4 = params.toString();
19271
19313
  try {
19272
- printResult(await apiGet(`/api/bookmarks?${params.toString()}`, { headers: auth.headers }));
19314
+ printResult(
19315
+ await apiGet(`/api/bookmarks/count${query4 ? `?${query4}` : ""}`, { headers: auth.headers })
19316
+ );
19273
19317
  } catch (error) {
19274
19318
  return renderFailure(error);
19275
19319
  }
@@ -19280,6 +19324,13 @@ var bookmarkCommand = new Command101("bookmark").description(
19280
19324
  bookmarkCommand.addCommand(addCommand);
19281
19325
  bookmarkCommand.addCommand(removeCommand);
19282
19326
  bookmarkCommand.addCommand(listCommand4);
19327
+ bookmarkCommand.addCommand(countCommand);
19328
+ bookmarkCommand.addCommand(
19329
+ pinToggle("pin", "Pin a bookmark by its id; pinning again keeps the first pin time", "Pinning")
19330
+ );
19331
+ bookmarkCommand.addCommand(
19332
+ pinToggle("unpin", "Unpin a bookmark by its id; it stays saved", "Unpinning")
19333
+ );
19283
19334
  bookmarkCommand.addCommand(collectionCommand);
19284
19335
 
19285
19336
  // src/commands/skills/index.ts
@@ -26332,6 +26383,9 @@ function parseParams(pairs) {
26332
26383
  }
26333
26384
  return { params };
26334
26385
  }
26386
+ function updateNote(workflowId, status) {
26387
+ return `Update available: ${status.templateId} is at version ${status.latestVersion}, this workflow has ${status.currentVersion}. Apply it with: taskmarket workflow update-template ${workflowId}`;
26388
+ }
26335
26389
  var collect6 = (value, previous = []) => [...previous, value];
26336
26390
  async function readValidTemplate(path9) {
26337
26391
  const parsed = await readJsonFile(path9);
@@ -26363,7 +26417,7 @@ var createCommand3 = new Command141("create").description(
26363
26417
  );
26364
26418
  });
26365
26419
  var updateCommand = new Command141("update").description(
26366
- "Replace a saved template with a JSON file, as the wallet that saved it; workflows already made from it keep their document. Costs 0.001 in the payment token"
26420
+ "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"
26367
26421
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
26368
26422
  const choice = templateChoice(value);
26369
26423
  if (!("templateId" in choice) || OFFICIAL_WORKFLOW_TEMPLATE_ID.test(choice.templateId)) {
@@ -26382,52 +26436,127 @@ var updateCommand = new Command141("update").description(
26382
26436
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26383
26437
  );
26384
26438
  });
26439
+ function parseTemplateSearch(opts) {
26440
+ const query4 = new URLSearchParams();
26441
+ if (opts.search !== void 0) {
26442
+ const q = opts.search.trim();
26443
+ if (q.length === 0 || q.length > WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH) {
26444
+ return {
26445
+ error: `--search is 1 to ${WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH} characters of text to find in a template's name, description or tags`
26446
+ };
26447
+ }
26448
+ query4.set("q", q);
26449
+ }
26450
+ if (opts.tag && opts.tag.length > 0) {
26451
+ if (opts.tag.length > WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX) {
26452
+ return {
26453
+ error: `--tag may be given at most ${WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX} times; a template must carry all of them`
26454
+ };
26455
+ }
26456
+ const tags = normalizeWorkflowTemplateTags(opts.tag);
26457
+ if (!tags.ok) {
26458
+ return {
26459
+ error: `--tag "${tags.invalid.slice(0, 40)}" is not a tag: use letters, digits and hyphens, at most 24 characters`
26460
+ };
26461
+ }
26462
+ query4.set("tags", tags.tags.join(","));
26463
+ }
26464
+ if (opts.featured) query4.set("featured", "true");
26465
+ if (opts.sort !== void 0) {
26466
+ if (!WORKFLOW_TEMPLATE_SEARCH_SORTS.includes(opts.sort)) {
26467
+ return { error: `--sort is one of ${WORKFLOW_TEMPLATE_SEARCH_SORTS.join(", ")}` };
26468
+ }
26469
+ query4.set("sort", opts.sort);
26470
+ }
26471
+ return { query: query4 };
26472
+ }
26385
26473
  var listCommand6 = new Command141("list").description(
26386
- "List the official templates (official: true, ids official:<slug>), the built-in presets and a wallet's saved templates, newest first (your wallet unless --owner is given). Any wallet may make a workflow from any of them (free)"
26474
+ "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`"
26387
26475
  ).option("--owner <address>", "The wallet whose templates to list").option(
26388
26476
  "--mine",
26389
26477
  'Only the templates your wallet saved: no official templates or presets (the web Templates page "Yours" filter)'
26390
- ).option("--limit <count>", "Templates per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (opts) => {
26391
- if (opts.mine && opts.owner !== void 0) {
26392
- return void printError("Use either --mine or --owner <address>, not both");
26393
- }
26394
- if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
26395
- return void printError("--limit must be an integer from 1 to 100");
26396
- }
26397
- if (opts.owner !== void 0 && !ADDRESS2.test(opts.owner.trim())) {
26398
- return void printError("--owner is a wallet address (0x and 40 hex digits)");
26399
- }
26400
- try {
26401
- const owner = opts.owner?.trim() ?? await getWalletAddress();
26402
- const params = new URLSearchParams({ owner });
26403
- if (opts.limit) params.set("limit", opts.limit.trim());
26404
- if (opts.cursor) params.set("cursor", opts.cursor.trim());
26405
- if (opts.mine) {
26406
- const mine = await apiGet(`/api/project-workflow-templates?${params.toString()}`);
26407
- return void printResult({
26408
- owner: mine.owner ?? owner.toLowerCase(),
26409
- templates: mine.templates ?? [],
26410
- nextCursor: mine.nextCursor ?? null
26478
+ ).option(
26479
+ "--search <text>",
26480
+ `Find templates whose name, description or tags contain every word (up to ${WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH} characters)`
26481
+ ).option(
26482
+ "--tag <tag>",
26483
+ `Only templates with this tag; repeat for more (at most ${WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX}, all required)`,
26484
+ collect6
26485
+ ).option("--featured", "Only the featured templates, which the repository curates").option(
26486
+ "--gallery",
26487
+ "The public gallery: only the saved templates their authors listed with `template publish`, each with its author's wallet in `owner` (with --owner, only that wallet's); no official templates or presets"
26488
+ ).option(
26489
+ "--sort <order>",
26490
+ `Order of a search: ${WORKFLOW_TEMPLATE_SEARCH_SORTS.join(" (featured first, default) or ")}`
26491
+ ).option("--limit <count>", "Templates per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(
26492
+ async (opts) => {
26493
+ if (opts.mine && opts.owner !== void 0) {
26494
+ return void printError("Use either --mine or --owner <address>, not both");
26495
+ }
26496
+ if (opts.gallery && (opts.mine || opts.featured)) {
26497
+ return void printError(
26498
+ "--gallery lists the saved templates authors listed; it does not combine with --mine or --featured"
26499
+ );
26500
+ }
26501
+ if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
26502
+ return void printError("--limit must be an integer from 1 to 100");
26503
+ }
26504
+ if (opts.owner !== void 0 && !ADDRESS2.test(opts.owner.trim())) {
26505
+ return void printError("--owner is a wallet address (0x and 40 hex digits)");
26506
+ }
26507
+ const searching = opts.search !== void 0 || (opts.tag?.length ?? 0) > 0 || opts.featured === true || opts.gallery === true || opts.sort !== void 0;
26508
+ const search = parseTemplateSearch(opts);
26509
+ if ("error" in search) return void printError(search.error);
26510
+ try {
26511
+ const owner = opts.owner?.trim() ?? (opts.gallery ? void 0 : await getWalletAddress());
26512
+ if (searching) {
26513
+ const query4 = search.query;
26514
+ if (owner) query4.set("owner", owner);
26515
+ if (opts.mine) query4.set("scope", "saved");
26516
+ if (opts.gallery) query4.set("scope", "community");
26517
+ if (opts.limit) query4.set("limit", opts.limit.trim());
26518
+ if (opts.cursor) query4.set("cursor", opts.cursor.trim());
26519
+ const page2 = await apiGet(
26520
+ `/api/project-workflow-template-search?${query4.toString()}`
26521
+ );
26522
+ return void printResult({
26523
+ owner: owner ? owner.toLowerCase() : null,
26524
+ templates: page2.templates ?? [],
26525
+ hasMore: page2.hasMore ?? false,
26526
+ nextCursor: page2.nextCursor ?? null,
26527
+ catalogTags: page2.catalogTags ?? []
26528
+ });
26529
+ }
26530
+ const params = new URLSearchParams({ owner });
26531
+ if (opts.limit) params.set("limit", opts.limit.trim());
26532
+ if (opts.cursor) params.set("cursor", opts.cursor.trim());
26533
+ if (opts.mine) {
26534
+ const mine = await apiGet(`/api/project-workflow-templates?${params.toString()}`);
26535
+ return void printResult({
26536
+ owner: mine.owner ?? owner.toLowerCase(),
26537
+ templates: mine.templates ?? [],
26538
+ nextCursor: mine.nextCursor ?? null
26539
+ });
26540
+ }
26541
+ const [presets, page] = await Promise.all([
26542
+ apiGet("/api/project-workflow-presets"),
26543
+ apiGet(`/api/project-workflow-templates?${params.toString()}`)
26544
+ ]);
26545
+ const builtIn = presets.presets ?? [];
26546
+ printResult({
26547
+ official: builtIn.filter((t) => t.official === true),
26548
+ presets: builtIn.filter((t) => t.official !== true),
26549
+ owner: page.owner ?? owner.toLowerCase(),
26550
+ templates: page.templates ?? [],
26551
+ nextCursor: page.nextCursor ?? null
26411
26552
  });
26553
+ } catch (err) {
26554
+ renderFailure(err);
26412
26555
  }
26413
- const [presets, page] = await Promise.all([
26414
- apiGet("/api/project-workflow-presets"),
26415
- apiGet(`/api/project-workflow-templates?${params.toString()}`)
26416
- ]);
26417
- const builtIn = presets.presets ?? [];
26418
- printResult({
26419
- official: builtIn.filter((t) => t.official === true),
26420
- presets: builtIn.filter((t) => t.official !== true),
26421
- owner: page.owner ?? owner.toLowerCase(),
26422
- templates: page.templates ?? [],
26423
- nextCursor: page.nextCursor ?? null
26424
- });
26425
- } catch (err) {
26426
- renderFailure(err);
26427
26556
  }
26428
- });
26557
+ );
26429
26558
  var showCommand3 = new Command141("show").description(
26430
- "Show a saved template, an official template (official:<slug>) or a preset (code, content, research): its parameters, steps and worst case (free)"
26559
+ "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)"
26431
26560
  ).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
26432
26561
  const choice = templateChoice(value);
26433
26562
  if ("error" in choice)
@@ -26439,6 +26568,38 @@ var showCommand3 = new Command141("show").description(
26439
26568
  renderFailure(err);
26440
26569
  }
26441
26570
  });
26571
+ function savedTemplateId(value, verb) {
26572
+ const choice = templateChoice(value);
26573
+ if (!("templateId" in choice) || OFFICIAL_WORKFLOW_TEMPLATE_ID.test(choice.templateId)) {
26574
+ printError(
26575
+ `Presets and official templates are read-only; ${verb} takes a saved template id (UUID)`
26576
+ );
26577
+ return null;
26578
+ }
26579
+ return choice.templateId;
26580
+ }
26581
+ var publishCommand = new Command141("publish").description(
26582
+ "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"
26583
+ ).argument("<templateId>", "Saved template id").action(async (value) => {
26584
+ const id = savedTemplateId(value, "publish");
26585
+ if (!id) return;
26586
+ await postProjectWrite(
26587
+ `/api/project-workflow-templates/${id}/publish`,
26588
+ { templateId: id },
26589
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26590
+ );
26591
+ });
26592
+ var unpublishCommand = new Command141("unpublish").description(
26593
+ "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"
26594
+ ).argument("<templateId>", "Saved template id").action(async (value) => {
26595
+ const id = savedTemplateId(value, "unpublish");
26596
+ if (!id) return;
26597
+ await postProjectWrite(
26598
+ `/api/project-workflow-templates/${id}/unpublish`,
26599
+ { templateId: id },
26600
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26601
+ );
26602
+ });
26442
26603
  var deleteCommand2 = new Command141("delete").description(
26443
26604
  "Delete a saved template, as the wallet that saved it; workflows already made from it are unaffected. Costs 0.001 in the payment token"
26444
26605
  ).argument("<templateId>", "Template id").action(async (value) => {
@@ -26458,7 +26619,7 @@ var deleteCommand2 = new Command141("delete").description(
26458
26619
  });
26459
26620
  var workflowTemplateCommand = new Command141("template").description(
26460
26621
  "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"
26461
- ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(deleteCommand2);
26622
+ ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
26462
26623
  async function createWorkflowFromTemplate(projectId, template, pairs) {
26463
26624
  const choice = templateChoice(template);
26464
26625
  if ("error" in choice) return void printError(choice.error);
@@ -27146,10 +27307,29 @@ var listCommand8 = new Command146("list").description(
27146
27307
  const query4 = params.toString();
27147
27308
  await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
27148
27309
  });
27149
- var showCommand5 = new Command146("show").description("Show a workflow, its validated document and its newest runs (free)").argument("<workflowId>", "Workflow id").action(async (value) => {
27310
+ var showCommand5 = new Command146("show").description(
27311
+ "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)"
27312
+ ).argument("<workflowId>", "Workflow id").action(async (value) => {
27313
+ const id = uuid(value, "workflow");
27314
+ if (typeof id !== "string") return void printError(id.error);
27315
+ try {
27316
+ const shown = await apiGet(`/api/project-workflows/${id}`);
27317
+ const update = shown.workflow?.templateUpdate;
27318
+ printResult(update?.available ? { ...shown, note: updateNote(id, update) } : shown);
27319
+ } catch (err) {
27320
+ renderFailure(err);
27321
+ }
27322
+ });
27323
+ var updateTemplateCommand = new Command146("update-template").description(
27324
+ "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"
27325
+ ).argument("<workflowId>", "Workflow id").action(async (value) => {
27150
27326
  const id = uuid(value, "workflow");
27151
27327
  if (typeof id !== "string") return void printError(id.error);
27152
- await read2(`/api/project-workflows/${id}`);
27328
+ await postProjectWrite(
27329
+ `/api/project-workflows/${id}/update-template`,
27330
+ { workflowId: id },
27331
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
27332
+ );
27153
27333
  });
27154
27334
  var runsCommand = new Command146("runs").description("Page through a workflow's runs, newest first (free)").argument("<workflowId>", "Workflow id").option("--limit <count>", "Runs per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(async (value, opts) => {
27155
27335
  const id = uuid(value, "workflow");
@@ -27324,7 +27504,7 @@ var workflowCommand = new Command146("workflow").description(
27324
27504
  "retry",
27325
27505
  "Retry a failed step the run waits on, as a new attempt, as the owner; a forEach that failed over_budget recounts its list, and one that failed too_many_items is refused (costs 0.001 in the payment token)"
27326
27506
  )
27327
- ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27507
+ ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27328
27508
 
27329
27509
  // src/commands/drops.ts
27330
27510
  import { Command as Command147 } from "commander";
@@ -27401,8 +27581,132 @@ var statusCommand4 = new Command147("status").description("Check whether an emai
27401
27581
  var dropsCommand = new Command147("drops").description("Browse Task Drops and manage email subscriptions to them").addCommand(listCommand9).addCommand(showCommand6).addCommand(subscribeCommand).addCommand(statusCommand4);
27402
27582
 
27403
27583
  // src/commands/hooks.ts
27404
- import { Command as Command148 } from "commander";
27584
+ import { Command as Command149 } from "commander";
27405
27585
  import { BaseError, ContractFunctionRevertedError, ContractFunctionZeroDataError } from "viem";
27586
+
27587
+ // src/lib/listing-submissions.ts
27588
+ import { readFile as readFile6 } from "fs/promises";
27589
+ import { Command as Command148 } from "commander";
27590
+ 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.";
27591
+ function prepareListingFile(kind, text) {
27592
+ if (Buffer.byteLength(text, "utf8") > LISTING_SUBMISSION_MAX_BYTES) {
27593
+ return {
27594
+ valid: false,
27595
+ reason: `A submission is at most ${LISTING_SUBMISSION_MAX_BYTES} bytes`
27596
+ };
27597
+ }
27598
+ let parsed;
27599
+ try {
27600
+ parsed = JSON.parse(text);
27601
+ } catch {
27602
+ return { valid: false, reason: "The file is not valid JSON" };
27603
+ }
27604
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
27605
+ return { valid: false, reason: "The file must hold one JSON object" };
27606
+ }
27607
+ const hidden = findHiddenCharacters(kind === "catalog" ? parsed : text);
27608
+ if (hidden) {
27609
+ return {
27610
+ valid: false,
27611
+ reason: `The file contains a control or invisible character at ${hidden}`
27612
+ };
27613
+ }
27614
+ if (kind === "hook") {
27615
+ const subject = hookListingSubject(parsed);
27616
+ if (!subject) {
27617
+ return {
27618
+ valid: false,
27619
+ reason: "A hook manifest submitted for listing must contain exactly one deployment"
27620
+ };
27621
+ }
27622
+ return { valid: true, value: { subject, body: { manifest: text }, signed: text } };
27623
+ }
27624
+ const entryKind = parsed.kind;
27625
+ if (entryKind !== "x402-endpoint") {
27626
+ return {
27627
+ valid: false,
27628
+ reason: `Only kind "x402-endpoint" entries can be submitted; the file has kind ${JSON.stringify(entryKind ?? null)}`
27629
+ };
27630
+ }
27631
+ const entry = CatalogSubmissionEntrySchema.safeParse(parsed);
27632
+ if (!entry.success) {
27633
+ const issue = entry.error.issues[0];
27634
+ return {
27635
+ valid: false,
27636
+ reason: `Invalid catalog entry: ${issue.path.join(".") || "entry"}: ${issue.message}`
27637
+ };
27638
+ }
27639
+ return {
27640
+ valid: true,
27641
+ value: { subject: entry.data.id, body: { entry: entry.data }, signed: entry.data }
27642
+ };
27643
+ }
27644
+ function submitCommandFor(kind) {
27645
+ const what = kind === "catalog" ? "catalog entry (kind x402-endpoint)" : "hook manifest";
27646
+ return new Command148("submit").description(
27647
+ `Submit a ${what} for staff review. Pays the standard action fee, kept either way; needs an ERC-8004 identity on the selected network`
27648
+ ).requiredOption("--file <path>", `Path to the ${what} JSON file`).action(async (opts) => {
27649
+ let text;
27650
+ try {
27651
+ text = await readFile6(opts.file, "utf8");
27652
+ } catch {
27653
+ printError(`Cannot read ${opts.file}`);
27654
+ return;
27655
+ }
27656
+ const prepared = prepareListingFile(kind, text);
27657
+ if (!prepared.valid) {
27658
+ printError(prepared.reason);
27659
+ return;
27660
+ }
27661
+ const { subject, body, signed } = prepared.value;
27662
+ try {
27663
+ const proof = await signWalletWrite(
27664
+ "listing-submission",
27665
+ listingSubmissionWriteChange(kind, subject, signed)
27666
+ );
27667
+ const { data, idempotencyKey } = await x402FeePost(
27668
+ kind === "catalog" ? "/api/catalog/submissions" : "/api/hooks/submissions",
27669
+ { chainId: selectedNetwork().chainId, ...body, ...proof }
27670
+ );
27671
+ printResult({ ...data, notice: NOTICE }, { idempotencyKey });
27672
+ } catch (error) {
27673
+ return renderFailure(error);
27674
+ }
27675
+ });
27676
+ }
27677
+ function submissionsCommandFor(kind) {
27678
+ return new Command148("submissions").description(
27679
+ `List the ${kind === "catalog" ? "catalog entries" : "hook listings"} you submitted and their status`
27680
+ ).option("--status <status>", `Only this status: ${LISTING_SUBMISSION_STATUSES.join(", ")}`).option("--limit <n>", "Maximum submissions to return (1-100)", "50").action(async (opts) => {
27681
+ if (opts.status && !LISTING_SUBMISSION_STATUSES.includes(opts.status)) {
27682
+ printError(`--status must be one of ${LISTING_SUBMISSION_STATUSES.join(", ")}`);
27683
+ return;
27684
+ }
27685
+ const limit = Number(opts.limit);
27686
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
27687
+ printError("--limit must be an integer from 1 to 100");
27688
+ return;
27689
+ }
27690
+ const auth = await signReadAuth();
27691
+ if (!auth || Object.keys(auth.headers).length === 0) {
27692
+ printError("Listing submissions needs a wallet. Run `taskmarket init` first.");
27693
+ return;
27694
+ }
27695
+ const params = new URLSearchParams({ kind, limit: String(limit) });
27696
+ if (opts.status) params.set("status", opts.status);
27697
+ try {
27698
+ printResult(
27699
+ await apiGet(`/api/listing-submissions/mine?${params.toString()}`, {
27700
+ headers: auth.headers
27701
+ })
27702
+ );
27703
+ } catch (error) {
27704
+ return renderFailure(error);
27705
+ }
27706
+ });
27707
+ }
27708
+
27709
+ // src/commands/hooks.ts
27406
27710
  function withV2Declarations(entry) {
27407
27711
  const mask = capabilitiesOf(entry);
27408
27712
  const served = entry.hookVersion;
@@ -27437,7 +27741,7 @@ async function probeHookVersion(entry, chainId) {
27437
27741
  return reverted ? { ...entry, hookVersion: 1 } : entry;
27438
27742
  }
27439
27743
  }
27440
- var listCommand10 = new Command148("list").description(
27744
+ var listCommand10 = new Command149("list").description(
27441
27745
  "List hooks listed (verified) in the hook registry on the selected --network, then observed hooks that are not listed"
27442
27746
  ).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(
27443
27747
  "--cursor <cursor>",
@@ -27476,7 +27780,7 @@ var listCommand10 = new Command148("list").description(
27476
27780
  }
27477
27781
  }
27478
27782
  );
27479
- var showCommand7 = new Command148("show").description(
27783
+ var showCommand7 = new Command149("show").description(
27480
27784
  "Show one hook on the selected --network: its registry listing, or its onchain observation marked unlisted"
27481
27785
  ).argument("<address>", "Hook contract address").action(async (address3) => {
27482
27786
  try {
@@ -27496,7 +27800,7 @@ var showCommand7 = new Command148("show").description(
27496
27800
  renderFailure(err);
27497
27801
  }
27498
27802
  });
27499
- var encodeConfigCommand = new Command148("encode-config").description(
27803
+ var encodeConfigCommand = new Command149("encode-config").description(
27500
27804
  "Encode a V2 hook's typed configuration from its registry config schema, for --hook-config"
27501
27805
  ).argument("<address>", "Hook contract address").requiredOption(
27502
27806
  "--values <json>",
@@ -27525,7 +27829,7 @@ var encodeConfigCommand = new Command148("encode-config").description(
27525
27829
  renderFailure(err);
27526
27830
  }
27527
27831
  });
27528
- var attachmentConfigCommand = new Command148("attachment-config").description(
27832
+ var attachmentConfigCommand = new Command149("attachment-config").description(
27529
27833
  "Show the protocol-default hook order and maximum hooks per task on the selected --network"
27530
27834
  ).action(async () => {
27531
27835
  try {
@@ -27534,12 +27838,16 @@ var attachmentConfigCommand = new Command148("attachment-config").description(
27534
27838
  renderFailure(err);
27535
27839
  }
27536
27840
  });
27537
- var hooksCommand = new Command148("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand);
27841
+ var hooksCommand = new Command149("hooks").description("Browse the hook registry on the selected --network").addCommand(listCommand10).addCommand(showCommand7).addCommand(encodeConfigCommand).addCommand(attachmentConfigCommand).addCommand(submitCommandFor("hook")).addCommand(submissionsCommandFor("hook"));
27842
+
27843
+ // src/commands/catalog/index.ts
27844
+ import { Command as Command150 } from "commander";
27845
+ var catalogCommand = new Command150("catalog").description("Submit paid endpoints to the Taskmarket catalog and track your submissions").addCommand(submitCommandFor("catalog")).addCommand(submissionsCommandFor("catalog"));
27538
27846
 
27539
27847
  // src/commands/tap.ts
27540
27848
  import { promises as fs12 } from "fs";
27541
- import { Command as Command149 } from "commander";
27542
- var tapCommand = new Command149("tap").description(
27849
+ import { Command as Command151 } from "commander";
27850
+ var tapCommand = new Command151("tap").description(
27543
27851
  "Manage the TAP signing key used on tasks that require TAP verification"
27544
27852
  );
27545
27853
  tapCommand.command("import").description(
@@ -27698,7 +28006,7 @@ tapCommand.command("remove").description("Remove the TAP key from the keystore")
27698
28006
  });
27699
28007
 
27700
28008
  // src/commands/hire.ts
27701
- import { Command as Command150 } from "commander";
28009
+ import { Command as Command152 } from "commander";
27702
28010
  var OWN_FLAGS = /* @__PURE__ */ new Set(["--mode", "--hire-worker", "--service-id"]);
27703
28011
  async function lookupListedService(worker, serviceId) {
27704
28012
  let listing;
@@ -27730,7 +28038,7 @@ function hireEvaluatorError(opts, requiresEvaluator) {
27730
28038
  }
27731
28039
  return null;
27732
28040
  }
27733
- var hireCommand = new Command150("hire").description(
28041
+ var hireCommand = new Command152("hire").description(
27734
28042
  "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."
27735
28043
  ).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(
27736
28044
  "--requires-evaluator",
@@ -27793,7 +28101,7 @@ hireCommand.action(async (worker, opts) => {
27793
28101
  // src/index.ts
27794
28102
  var require2 = createRequire(import.meta.url);
27795
28103
  var { version } = require2("../package.json");
27796
- var program = new Command151();
28104
+ var program = new Command153();
27797
28105
  setLastErrorCliVersion(version);
27798
28106
  program.name("taskmarket").description("Taskmarket CLI for AI agents").version(version);
27799
28107
  program.option(
@@ -27854,6 +28162,7 @@ program.addCommand(projectCommand);
27854
28162
  program.addCommand(workflowCommand);
27855
28163
  program.addCommand(dropsCommand);
27856
28164
  program.addCommand(hooksCommand);
28165
+ program.addCommand(catalogCommand);
27857
28166
  program.addCommand(hireCommand);
27858
28167
  program.addCommand(hiresCommand);
27859
28168
  program.addCommand(bugCommand);