@lucid-agents/taskmarket 1.35.0 → 1.36.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-BAW7ZGDD.js} +2 -2
  3. package/dist/{channels-SVCU2MU5.js → channels-FAOZ67V2.js} +4 -4
  4. package/dist/{chunk-CHX7O7EU.js → chunk-6AIEGDDI.js} +1 -1
  5. package/dist/{chunk-B7W4G3EY.js → chunk-7TDHFFF2.js} +1 -1
  6. package/dist/{chunk-YHVP2UNE.js → chunk-AZ2N4KKB.js} +1 -1
  7. package/dist/{chunk-BDKM5JMT.js → chunk-BQ63ZEML.js} +1 -1
  8. package/dist/{chunk-JRWRBSS2.js → chunk-F5ZHREXK.js} +3 -3
  9. package/dist/{chunk-KHDQRFHG.js → chunk-FXBA6X3I.js} +5 -5
  10. package/dist/{chunk-WP7GXSKE.js → chunk-NF3XHNJH.js} +3 -3
  11. package/dist/{chunk-L6D2CDVQ.js → chunk-Q2NCP72I.js} +8 -8
  12. package/dist/{chunk-QAGDCIMU.js → chunk-Q3IC6GTF.js} +125 -6
  13. package/dist/{chunk-54OR2JDT.js → chunk-TKHBDRU6.js} +2 -2
  14. package/dist/{chunk-YGSVDU2D.js → chunk-WGQV5OG3.js} +3 -3
  15. package/dist/{chunk-G3U2BQNC.js → chunk-WJHT663R.js} +1 -1
  16. package/dist/{doctor-IIVQFDIB.js → doctor-WFGKN5ZB.js} +8 -8
  17. package/dist/index.js +191 -58
  18. package/dist/{launch-OC4LIPSS.js → launch-QWDD4WLN.js} +11 -11
  19. package/dist/pi-extensions/xgate.cjs +65 -2
  20. package/dist/{read-auth-AGP3CUMT.js → read-auth-JKSDOSKI.js} +3 -3
  21. package/dist/{reconcile-H3JIKN2X.js → reconcile-B33L7D3M.js} +4 -4
  22. package/dist/{status-SARVECVT.js → status-CBGRCJQO.js} +8 -8
  23. package/dist/{sync-pull-IUPV57MU.js → sync-pull-EA6TBOHC.js} +4 -4
  24. package/dist/{task-access-grants-HALV3NEO.js → task-access-grants-JF7LGUWX.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-Q2NCP72I.js";
18
18
  import {
19
19
  ComputeCreditError,
20
20
  applyComputeCreditSetup,
@@ -36,14 +36,14 @@ import {
36
36
  refusedPaidWrite,
37
37
  releasePendingComputePurchase,
38
38
  resolvePendingComputePurchases
39
- } from "./chunk-JRWRBSS2.js";
39
+ } from "./chunk-F5ZHREXK.js";
40
40
  import {
41
41
  signReadAuth
42
- } from "./chunk-54OR2JDT.js";
42
+ } from "./chunk-TKHBDRU6.js";
43
43
  import {
44
44
  saveTaskAccessGrant,
45
45
  taskAccessGrantHeaders
46
- } from "./chunk-CHX7O7EU.js";
46
+ } from "./chunk-6AIEGDDI.js";
47
47
  import {
48
48
  MPP_TEMPO_DEFAULT_VALIDITY_SECONDS,
49
49
  X402PayError,
@@ -61,7 +61,7 @@ import {
61
61
  setX402PolicyRuleEnabled,
62
62
  signSponsoredTempoTransfer,
63
63
  signTaskmarketFeePayment
64
- } from "./chunk-YHVP2UNE.js";
64
+ } from "./chunk-AZ2N4KKB.js";
65
65
  import {
66
66
  ALL_NETWORKS,
67
67
  ApiError,
@@ -124,7 +124,7 @@ import {
124
124
  withErrorContext,
125
125
  withIdempotentWrite,
126
126
  withTapSignature
127
- } from "./chunk-G3U2BQNC.js";
127
+ } from "./chunk-WJHT663R.js";
128
128
  import {
129
129
  AGENT_AVATAR_MAX_BYTES,
130
130
  AGENT_HIRES_ROLES,
@@ -254,6 +254,9 @@ import {
254
254
  WORKFLOW_STEP_LIMIT_MAX,
255
255
  WORKFLOW_STEP_LIMIT_MIN,
256
256
  WORKFLOW_TEMPLATE_PARAMETERS_MAX,
257
+ WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH,
258
+ WORKFLOW_TEMPLATE_SEARCH_SORTS,
259
+ WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX,
257
260
  WalletMarketEventsInputSchema,
258
261
  apiErrorEnvelopeOf,
259
262
  assertSelectableCapabilities,
@@ -310,6 +313,7 @@ import {
310
313
  marketEventPreferenceChange,
311
314
  needsYouKindForIntent,
312
315
  normalizeReferenceCode,
316
+ normalizeWorkflowTemplateTags,
313
317
  parseIsoDurationSeconds,
314
318
  parseScheduleCadence,
315
319
  paymentTokenSymbol,
@@ -341,7 +345,7 @@ import {
341
345
  vaultCallGasLimit7702,
342
346
  verifierProviderId,
343
347
  verifiersUnsupportedOnChain
344
- } from "./chunk-QAGDCIMU.js";
348
+ } from "./chunk-Q3IC6GTF.js";
345
349
  import "./chunk-S7SJMJ2I.js";
346
350
 
347
351
  // src/index.ts
@@ -12976,7 +12980,7 @@ async function runAgentCommand(options) {
12976
12980
  try {
12977
12981
  const { assertAgentCompatibility } = await import("./compatibility-636WJOEX.js");
12978
12982
  const pi = assertAgentCompatibility();
12979
- const { runAgent } = await import("./launch-OC4LIPSS.js");
12983
+ const { runAgent } = await import("./launch-QWDD4WLN.js");
12980
12984
  result = await runAgent({
12981
12985
  model: options.model,
12982
12986
  pi,
@@ -13410,13 +13414,13 @@ function agentManagementCommands() {
13410
13414
  const status = new Command57("status").description(
13411
13415
  "Show the agent channels (locked, charged, refundable), purchases with an unknown outcome, the sandbox and compute credit. Reads only."
13412
13416
  ).action(async () => {
13413
- const { collectAgentStatus } = await import("./status-SARVECVT.js");
13417
+ const { collectAgentStatus } = await import("./status-CBGRCJQO.js");
13414
13418
  await run(() => collectAgentStatus());
13415
13419
  });
13416
13420
  const doctor = new Command57("doctor").description(
13417
13421
  "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
13422
  ).action(async () => {
13419
- const { runDoctor } = await import("./doctor-IIVQFDIB.js");
13423
+ const { runDoctor } = await import("./doctor-WFGKN5ZB.js");
13420
13424
  const report = await run(() => runDoctor());
13421
13425
  if (report && !report.ok) process.exitCode = 1;
13422
13426
  });
@@ -13427,7 +13431,7 @@ function agentManagementCommands() {
13427
13431
  "Reconcile the open purchases of this channel, as status lists it; also reaches retired channels"
13428
13432
  ).action(
13429
13433
  async (invocationId, options) => {
13430
- const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-H3JIKN2X.js");
13434
+ const { reconcileChannelPurchases, reconcileInvocation } = await import("./reconcile-B33L7D3M.js");
13431
13435
  const choice = { rail: options.rail, channel: options.channel };
13432
13436
  if (invocationId !== void 0) {
13433
13437
  await run(() => reconcileInvocation(invocationId, { choice }));
@@ -13459,7 +13463,7 @@ function agentManagementCommands() {
13459
13463
  `Not a USDC amount: ${options.amount} (digits, at most 6 decimals)`
13460
13464
  );
13461
13465
  }
13462
- const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-SVCU2MU5.js");
13466
+ const { openAgentChannels, requestTopUp, selectRail, withdrawalHatch } = await import("./channels-FAOZ67V2.js");
13463
13467
  const { rails } = await openAgentChannels();
13464
13468
  const result = await requestTopUp(selectRail(rails, options.rail), amount);
13465
13469
  return {
@@ -13479,8 +13483,8 @@ function agentManagementCommands() {
13479
13483
  await run(async () => {
13480
13484
  await requireExperimental();
13481
13485
  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");
13486
+ const { closeChannel, openAgentChannels, selectChannel } = await import("./channels-FAOZ67V2.js");
13487
+ const { reconcileLeasedPurchase } = await import("./reconcile-B33L7D3M.js");
13484
13488
  const opened = await openAgentChannels();
13485
13489
  const { rail, retired } = selectChannel(opened, options);
13486
13490
  const result = await closeChannel(
@@ -13534,7 +13538,7 @@ function agentManagementCommands() {
13534
13538
  async (options) => {
13535
13539
  await run(async () => {
13536
13540
  await requireExperimental();
13537
- const { runPull } = await import("./sync-pull-IUPV57MU.js");
13541
+ const { runPull } = await import("./sync-pull-EA6TBOHC.js");
13538
13542
  const { terminalPrompter } = await import("./prompter-LSICEYSQ.js");
13539
13543
  return runPull(options, {
13540
13544
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
@@ -26332,6 +26336,9 @@ function parseParams(pairs) {
26332
26336
  }
26333
26337
  return { params };
26334
26338
  }
26339
+ function updateNote(workflowId, status) {
26340
+ return `Update available: ${status.templateId} is at version ${status.latestVersion}, this workflow has ${status.currentVersion}. Apply it with: taskmarket workflow update-template ${workflowId}`;
26341
+ }
26335
26342
  var collect6 = (value, previous = []) => [...previous, value];
26336
26343
  async function readValidTemplate(path9) {
26337
26344
  const parsed = await readJsonFile(path9);
@@ -26363,7 +26370,7 @@ var createCommand3 = new Command141("create").description(
26363
26370
  );
26364
26371
  });
26365
26372
  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"
26373
+ "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
26374
  ).argument("<templateId>", "Template id").requiredOption("--file <path>", "The template, JSON").action(async (value, opts) => {
26368
26375
  const choice = templateChoice(value);
26369
26376
  if (!("templateId" in choice) || OFFICIAL_WORKFLOW_TEMPLATE_ID.test(choice.templateId)) {
@@ -26382,52 +26389,127 @@ var updateCommand = new Command141("update").description(
26382
26389
  { maxAmount: ACTION_FEE_MAX_AMOUNT }
26383
26390
  );
26384
26391
  });
26392
+ function parseTemplateSearch(opts) {
26393
+ const query4 = new URLSearchParams();
26394
+ if (opts.search !== void 0) {
26395
+ const q = opts.search.trim();
26396
+ if (q.length === 0 || q.length > WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH) {
26397
+ return {
26398
+ error: `--search is 1 to ${WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH} characters of text to find in a template's name, description or tags`
26399
+ };
26400
+ }
26401
+ query4.set("q", q);
26402
+ }
26403
+ if (opts.tag && opts.tag.length > 0) {
26404
+ if (opts.tag.length > WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX) {
26405
+ return {
26406
+ error: `--tag may be given at most ${WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX} times; a template must carry all of them`
26407
+ };
26408
+ }
26409
+ const tags = normalizeWorkflowTemplateTags(opts.tag);
26410
+ if (!tags.ok) {
26411
+ return {
26412
+ error: `--tag "${tags.invalid.slice(0, 40)}" is not a tag: use letters, digits and hyphens, at most 24 characters`
26413
+ };
26414
+ }
26415
+ query4.set("tags", tags.tags.join(","));
26416
+ }
26417
+ if (opts.featured) query4.set("featured", "true");
26418
+ if (opts.sort !== void 0) {
26419
+ if (!WORKFLOW_TEMPLATE_SEARCH_SORTS.includes(opts.sort)) {
26420
+ return { error: `--sort is one of ${WORKFLOW_TEMPLATE_SEARCH_SORTS.join(", ")}` };
26421
+ }
26422
+ query4.set("sort", opts.sort);
26423
+ }
26424
+ return { query: query4 };
26425
+ }
26385
26426
  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)"
26427
+ "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
26428
  ).option("--owner <address>", "The wallet whose templates to list").option(
26388
26429
  "--mine",
26389
26430
  '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
26431
+ ).option(
26432
+ "--search <text>",
26433
+ `Find templates whose name, description or tags contain every word (up to ${WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH} characters)`
26434
+ ).option(
26435
+ "--tag <tag>",
26436
+ `Only templates with this tag; repeat for more (at most ${WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX}, all required)`,
26437
+ collect6
26438
+ ).option("--featured", "Only the featured templates, which the repository curates").option(
26439
+ "--gallery",
26440
+ "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"
26441
+ ).option(
26442
+ "--sort <order>",
26443
+ `Order of a search: ${WORKFLOW_TEMPLATE_SEARCH_SORTS.join(" (featured first, default) or ")}`
26444
+ ).option("--limit <count>", "Templates per page (1-100, default 20)").option("--cursor <cursor>", "nextCursor from the previous page").action(
26445
+ async (opts) => {
26446
+ if (opts.mine && opts.owner !== void 0) {
26447
+ return void printError("Use either --mine or --owner <address>, not both");
26448
+ }
26449
+ if (opts.gallery && (opts.mine || opts.featured)) {
26450
+ return void printError(
26451
+ "--gallery lists the saved templates authors listed; it does not combine with --mine or --featured"
26452
+ );
26453
+ }
26454
+ if (opts.limit !== void 0 && !/^(100|[1-9][0-9]?)$/.test(opts.limit.trim())) {
26455
+ return void printError("--limit must be an integer from 1 to 100");
26456
+ }
26457
+ if (opts.owner !== void 0 && !ADDRESS2.test(opts.owner.trim())) {
26458
+ return void printError("--owner is a wallet address (0x and 40 hex digits)");
26459
+ }
26460
+ const searching = opts.search !== void 0 || (opts.tag?.length ?? 0) > 0 || opts.featured === true || opts.gallery === true || opts.sort !== void 0;
26461
+ const search = parseTemplateSearch(opts);
26462
+ if ("error" in search) return void printError(search.error);
26463
+ try {
26464
+ const owner = opts.owner?.trim() ?? (opts.gallery ? void 0 : await getWalletAddress());
26465
+ if (searching) {
26466
+ const query4 = search.query;
26467
+ if (owner) query4.set("owner", owner);
26468
+ if (opts.mine) query4.set("scope", "saved");
26469
+ if (opts.gallery) query4.set("scope", "community");
26470
+ if (opts.limit) query4.set("limit", opts.limit.trim());
26471
+ if (opts.cursor) query4.set("cursor", opts.cursor.trim());
26472
+ const page2 = await apiGet(
26473
+ `/api/project-workflow-template-search?${query4.toString()}`
26474
+ );
26475
+ return void printResult({
26476
+ owner: owner ? owner.toLowerCase() : null,
26477
+ templates: page2.templates ?? [],
26478
+ hasMore: page2.hasMore ?? false,
26479
+ nextCursor: page2.nextCursor ?? null,
26480
+ catalogTags: page2.catalogTags ?? []
26481
+ });
26482
+ }
26483
+ const params = new URLSearchParams({ owner });
26484
+ if (opts.limit) params.set("limit", opts.limit.trim());
26485
+ if (opts.cursor) params.set("cursor", opts.cursor.trim());
26486
+ if (opts.mine) {
26487
+ const mine = await apiGet(`/api/project-workflow-templates?${params.toString()}`);
26488
+ return void printResult({
26489
+ owner: mine.owner ?? owner.toLowerCase(),
26490
+ templates: mine.templates ?? [],
26491
+ nextCursor: mine.nextCursor ?? null
26492
+ });
26493
+ }
26494
+ const [presets, page] = await Promise.all([
26495
+ apiGet("/api/project-workflow-presets"),
26496
+ apiGet(`/api/project-workflow-templates?${params.toString()}`)
26497
+ ]);
26498
+ const builtIn = presets.presets ?? [];
26499
+ printResult({
26500
+ official: builtIn.filter((t) => t.official === true),
26501
+ presets: builtIn.filter((t) => t.official !== true),
26502
+ owner: page.owner ?? owner.toLowerCase(),
26503
+ templates: page.templates ?? [],
26504
+ nextCursor: page.nextCursor ?? null
26411
26505
  });
26506
+ } catch (err) {
26507
+ renderFailure(err);
26412
26508
  }
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
26509
  }
26428
- });
26510
+ );
26429
26511
  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)"
26512
+ "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
26513
  ).argument("<template>", "Template id, official template id or preset name").action(async (value) => {
26432
26514
  const choice = templateChoice(value);
26433
26515
  if ("error" in choice)
@@ -26439,6 +26521,38 @@ var showCommand3 = new Command141("show").description(
26439
26521
  renderFailure(err);
26440
26522
  }
26441
26523
  });
26524
+ function savedTemplateId(value, verb) {
26525
+ const choice = templateChoice(value);
26526
+ if (!("templateId" in choice) || OFFICIAL_WORKFLOW_TEMPLATE_ID.test(choice.templateId)) {
26527
+ printError(
26528
+ `Presets and official templates are read-only; ${verb} takes a saved template id (UUID)`
26529
+ );
26530
+ return null;
26531
+ }
26532
+ return choice.templateId;
26533
+ }
26534
+ var publishCommand = new Command141("publish").description(
26535
+ "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"
26536
+ ).argument("<templateId>", "Saved template id").action(async (value) => {
26537
+ const id = savedTemplateId(value, "publish");
26538
+ if (!id) return;
26539
+ await postProjectWrite(
26540
+ `/api/project-workflow-templates/${id}/publish`,
26541
+ { templateId: id },
26542
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26543
+ );
26544
+ });
26545
+ var unpublishCommand = new Command141("unpublish").description(
26546
+ "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"
26547
+ ).argument("<templateId>", "Saved template id").action(async (value) => {
26548
+ const id = savedTemplateId(value, "unpublish");
26549
+ if (!id) return;
26550
+ await postProjectWrite(
26551
+ `/api/project-workflow-templates/${id}/unpublish`,
26552
+ { templateId: id },
26553
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
26554
+ );
26555
+ });
26442
26556
  var deleteCommand2 = new Command141("delete").description(
26443
26557
  "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
26558
  ).argument("<templateId>", "Template id").action(async (value) => {
@@ -26458,7 +26572,7 @@ var deleteCommand2 = new Command141("delete").description(
26458
26572
  });
26459
26573
  var workflowTemplateCommand = new Command141("template").description(
26460
26574
  "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);
26575
+ ).addCommand(createCommand3).addCommand(updateCommand).addCommand(listCommand6).addCommand(showCommand3).addCommand(publishCommand).addCommand(unpublishCommand).addCommand(deleteCommand2);
26462
26576
  async function createWorkflowFromTemplate(projectId, template, pairs) {
26463
26577
  const choice = templateChoice(template);
26464
26578
  if ("error" in choice) return void printError(choice.error);
@@ -27146,10 +27260,29 @@ var listCommand8 = new Command146("list").description(
27146
27260
  const query4 = params.toString();
27147
27261
  await read2(withChainId(`/api/projects/${projectId}/workflows${query4 ? `?${query4}` : ""}`));
27148
27262
  });
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) => {
27263
+ var showCommand5 = new Command146("show").description(
27264
+ "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)"
27265
+ ).argument("<workflowId>", "Workflow id").action(async (value) => {
27266
+ const id = uuid(value, "workflow");
27267
+ if (typeof id !== "string") return void printError(id.error);
27268
+ try {
27269
+ const shown = await apiGet(`/api/project-workflows/${id}`);
27270
+ const update = shown.workflow?.templateUpdate;
27271
+ printResult(update?.available ? { ...shown, note: updateNote(id, update) } : shown);
27272
+ } catch (err) {
27273
+ renderFailure(err);
27274
+ }
27275
+ });
27276
+ var updateTemplateCommand = new Command146("update-template").description(
27277
+ "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"
27278
+ ).argument("<workflowId>", "Workflow id").action(async (value) => {
27150
27279
  const id = uuid(value, "workflow");
27151
27280
  if (typeof id !== "string") return void printError(id.error);
27152
- await read2(`/api/project-workflows/${id}`);
27281
+ await postProjectWrite(
27282
+ `/api/project-workflows/${id}/update-template`,
27283
+ { workflowId: id },
27284
+ { maxAmount: ACTION_FEE_MAX_AMOUNT }
27285
+ );
27153
27286
  });
27154
27287
  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
27288
  const id = uuid(value, "workflow");
@@ -27324,7 +27457,7 @@ var workflowCommand = new Command146("workflow").description(
27324
27457
  "retry",
27325
27458
  "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
27459
  )
27327
- ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27460
+ ).addCommand(cancelCommand2).addCommand(stopAutoPayoutCommand).addCommand(updateTemplateCommand).addCommand(deleteCommand3).addCommand(settingsCommand2).addCommand(payoutCommand).addCommand(workflowTemplateCommand);
27328
27461
 
27329
27462
  // src/commands/drops.ts
27330
27463
  import { Command as Command147 } from "commander";
@@ -38,7 +38,7 @@ import {
38
38
  sha256Hex,
39
39
  specHash,
40
40
  taskStage
41
- } from "./chunk-WP7GXSKE.js";
41
+ } from "./chunk-NF3XHNJH.js";
42
42
  import {
43
43
  SessionSync,
44
44
  emptyBase,
@@ -47,7 +47,7 @@ import {
47
47
  recordSessionEnd,
48
48
  recordSessionStart,
49
49
  uploadPlan
50
- } from "./chunk-BDKM5JMT.js";
50
+ } from "./chunk-BQ63ZEML.js";
51
51
  import {
52
52
  BrokerConnector,
53
53
  OutputLimitError,
@@ -59,7 +59,7 @@ import {
59
59
  serveSandboxChannel,
60
60
  withFileLock,
61
61
  writeAtomic
62
- } from "./chunk-B7W4G3EY.js";
62
+ } from "./chunk-7TDHFFF2.js";
63
63
  import {
64
64
  TaskOperationError,
65
65
  claimTask,
@@ -78,7 +78,7 @@ import {
78
78
  requestArtifactUpload,
79
79
  submitUploadedArtifacts,
80
80
  taskAwardsOf
81
- } from "./chunk-L6D2CDVQ.js";
81
+ } from "./chunk-Q2NCP72I.js";
82
82
  import {
83
83
  applyComputeCreditSetup,
84
84
  atomicToUsd,
@@ -88,13 +88,13 @@ import {
88
88
  planComputeCreditSetup,
89
89
  readComputeCreditBalance,
90
90
  usdToAtomic
91
- } from "./chunk-JRWRBSS2.js";
91
+ } from "./chunk-F5ZHREXK.js";
92
92
  import {
93
93
  signReadAuth
94
- } from "./chunk-54OR2JDT.js";
94
+ } from "./chunk-TKHBDRU6.js";
95
95
  import {
96
96
  taskAccessGrantHeaders
97
- } from "./chunk-CHX7O7EU.js";
97
+ } from "./chunk-6AIEGDDI.js";
98
98
  import {
99
99
  MAX_RETIRED_RAILS,
100
100
  NETWORK_NAMES,
@@ -118,7 +118,7 @@ import {
118
118
  routeOfCatalogRow,
119
119
  saveAgentPolicy,
120
120
  settledRetiredRails
121
- } from "./chunk-YGSVDU2D.js";
121
+ } from "./chunk-WGQV5OG3.js";
122
122
  import {
123
123
  BASE_CHANNEL_RAIL_ID,
124
124
  createBaseChannelPayer,
@@ -132,13 +132,13 @@ import {
132
132
  rpcUrlForNetwork,
133
133
  saveX402Policy,
134
134
  x402SpendWindowAvailability
135
- } from "./chunk-YHVP2UNE.js";
135
+ } from "./chunk-AZ2N4KKB.js";
136
136
  import {
137
137
  apiUrl,
138
138
  keystoreExists,
139
139
  loadKeystore,
140
140
  selectedNetwork
141
- } from "./chunk-G3U2BQNC.js";
141
+ } from "./chunk-WJHT663R.js";
142
142
  import {
143
143
  IntentStatusResponseSchema,
144
144
  NetworkChainInfoSchema,
@@ -147,7 +147,7 @@ import {
147
147
  isRecordingPendingResponse,
148
148
  piCodingAgentTools,
149
149
  taskmarketChain
150
- } from "./chunk-QAGDCIMU.js";
150
+ } from "./chunk-Q3IC6GTF.js";
151
151
  import {
152
152
  AgentLaunchError
153
153
  } from "./chunk-YM4S6IE4.js";
@@ -53921,6 +53921,10 @@ var ProjectWorkflowDeleteSchema = external_exports.object({
53921
53921
  chainId: ChainIdSchema4.optional(),
53922
53922
  workflowId: external_exports.string().uuid()
53923
53923
  });
53924
+ var ProjectWorkflowUpdateTemplateSchema = external_exports.object({
53925
+ chainId: ChainIdSchema4.optional(),
53926
+ workflowId: external_exports.string().uuid()
53927
+ });
53924
53928
  var ProjectWorkflowRunActionSchema = external_exports.object({
53925
53929
  chainId: ChainIdSchema4.optional(),
53926
53930
  runId: external_exports.string().uuid()
@@ -53947,7 +53951,14 @@ var WorkflowTemplateKindSchema = external_exports.enum(["template", "preset"]);
53947
53951
  var ProjectWorkflowSourceSchema = external_exports.object({
53948
53952
  kind: WorkflowTemplateKindSchema,
53949
53953
  templateId: external_exports.string().describe("The template id, or the preset name"),
53950
- params: external_exports.record(external_exports.union([external_exports.string(), external_exports.number(), external_exports.array(external_exports.string())]))
53954
+ params: external_exports.record(external_exports.union([external_exports.string(), external_exports.number(), external_exports.array(external_exports.string())])),
53955
+ templateVersion: external_exports.string().optional().describe("The template's version when the workflow was made or last updated from it; absent on a workflow made before versions were recorded")
53956
+ });
53957
+ var ProjectWorkflowTemplateUpdateStatusSchema = external_exports.object({
53958
+ templateId: external_exports.string(),
53959
+ currentVersion: external_exports.string().nullable().describe("The version the workflow has; null when not recorded"),
53960
+ latestVersion: external_exports.string().nullable().describe("The template now; null when it was deleted"),
53961
+ available: external_exports.boolean().describe("True when the template has a version other than the one the workflow has")
53951
53962
  });
53952
53963
  var ProjectWorkflowViewSchema = external_exports.object({
53953
53964
  workflowId: external_exports.string(),
@@ -53958,6 +53969,7 @@ var ProjectWorkflowViewSchema = external_exports.object({
53958
53969
  document: external_exports.record(external_exports.unknown()).describe("The validated document, with every default filled in"),
53959
53970
  summary: WorkflowSummarySchema,
53960
53971
  source: ProjectWorkflowSourceSchema.nullable().describe("The template or preset it was made from, with its parameter values; null when written by hand"),
53972
+ templateUpdate: ProjectWorkflowTemplateUpdateStatusSchema.nullable().optional().describe("Whether the template it was made from has another version now (available); null for a workflow written by hand. Filled by the list, show and update-template reads"),
53961
53973
  createdAt: external_exports.string()
53962
53974
  });
53963
53975
  var ProjectWorkflowRunStatusSchema = external_exports.enum([
@@ -54169,6 +54181,11 @@ var WORKFLOW_TEMPLATE_PARAMETERS_MAX = 20;
54169
54181
  var WORKFLOW_TEMPLATE_STRING_MAX_LENGTH = 5e3;
54170
54182
  var WORKFLOW_TEMPLATE_LIST_MAX_ITEMS = WORKFLOW_MAX_ITEMS_MAX;
54171
54183
  var WORKFLOW_TEMPLATE_LIST_ITEM_MAX_LENGTH = WORKFLOW_ITEM_MAX_LENGTH;
54184
+ var WORKFLOW_TEMPLATE_TAG_INPUT_MAX_LENGTH = 40;
54185
+ var WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH = 100;
54186
+ var WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX = 5;
54187
+ var WORKFLOW_TEMPLATE_SEARCH_LIMIT_DEFAULT = 20;
54188
+ var WORKFLOW_TEMPLATE_SEARCH_LIMIT_MAX = 100;
54172
54189
  var WORKFLOW_PRESET_NAMES = ["code", "content", "research"];
54173
54190
  var WORKFLOW_TEMPLATE_FIXED_FIELDS = [
54174
54191
  "pattern",
@@ -54179,7 +54196,8 @@ var WORKFLOW_TEMPLATE_FIXED_FIELDS = [
54179
54196
  "approve",
54180
54197
  "on",
54181
54198
  "verdict",
54182
- "when"
54199
+ "when",
54200
+ "hireWinnerOf"
54183
54201
  ];
54184
54202
  var TemplateInputSchema = external_exports.record(external_exports.unknown()).describe("The template: { name, description?, parameters, steps }, a workflow document whose strings use {{param}} placeholders, and parameters declaring each one: { type: string | integer | amount | list, default?, description?, and bounds (min/max for integer and amount, minLength/maxLength for string, minItems/maxItems/maxLength for list) }");
54185
54203
  var ProjectWorkflowTemplateCreateSchema = external_exports.object({
@@ -54195,6 +54213,10 @@ var ProjectWorkflowTemplateDeleteSchema = external_exports.object({
54195
54213
  chainId: ChainIdSchema5.optional(),
54196
54214
  templateId: external_exports.string().uuid()
54197
54215
  });
54216
+ var ProjectWorkflowTemplatePublishSchema = external_exports.object({
54217
+ chainId: ChainIdSchema5.optional(),
54218
+ templateId: external_exports.string().uuid()
54219
+ });
54198
54220
  var ParameterValueInputSchema = external_exports.union([
54199
54221
  external_exports.string().max(WORKFLOW_TEMPLATE_STRING_MAX_LENGTH),
54200
54222
  external_exports.number(),
@@ -54224,11 +54246,44 @@ var ProjectWorkflowTemplateViewSchema = external_exports.object({
54224
54246
  owner: external_exports.string().nullable().describe("The wallet that saved it; null for a preset or an official template"),
54225
54247
  name: external_exports.string(),
54226
54248
  description: external_exports.string().nullable(),
54249
+ tags: external_exports.array(external_exports.string()).describe("Normalized tags the author (or the repository, for an official template) gave it"),
54250
+ featured: external_exports.boolean().optional().describe("True for a template on the featured list, which the repository curates"),
54227
54251
  template: external_exports.record(external_exports.unknown()).describe("The validated template: name, description, parameters (every bound filled in), steps"),
54228
54252
  summary: WorkflowSummarySchema.describe("The workflow with every parameter at its maximum: the worst case a project must hold"),
54253
+ version: external_exports.string().describe("The template version: 1, 2, 3 ... for a saved template, bumped whenever a save changes its content; a short content hash for an official template or preset"),
54254
+ contentHash: external_exports.string().describe("SHA-256 of the template content, hex"),
54255
+ versions: external_exports.array(external_exports.object({
54256
+ version: external_exports.string(),
54257
+ contentHash: external_exports.string(),
54258
+ at: external_exports.string().describe("When that version was replaced")
54259
+ })).optional().describe("Earlier versions of a saved template, oldest first; shown on a single template only"),
54260
+ listed: external_exports.boolean().optional().describe("True when the author listed this saved template in the public gallery"),
54261
+ listedAt: external_exports.string().nullable().optional(),
54229
54262
  createdAt: external_exports.string().nullable(),
54230
54263
  updatedAt: external_exports.string().nullable()
54231
54264
  });
54265
+ var SearchTagSchema = external_exports.string().min(1).max(WORKFLOW_TEMPLATE_TAG_INPUT_MAX_LENGTH).describe("A tag as written; it is normalized (lowercase, hyphens) before it is matched");
54266
+ var WORKFLOW_TEMPLATE_SEARCH_SORTS = ["featured", "name"];
54267
+ var WORKFLOW_TEMPLATE_SEARCH_SCOPES = ["all", "saved", "community"];
54268
+ var ProjectWorkflowTemplateSearchSchema = external_exports.object({
54269
+ q: external_exports.string().trim().min(1).max(WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH).optional().describe(`Words to find in a template's name, description or tags; every word must match (at most ${WORKFLOW_TEMPLATE_SEARCH_MAX_LENGTH} characters)`),
54270
+ tags: csvArrayQueryParam(SearchTagSchema, {
54271
+ maxItems: WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX
54272
+ }).describe(`Comma-separated tags; a template must carry all of them (at most ${WORKFLOW_TEMPLATE_SEARCH_TAGS_MAX})`),
54273
+ // A query-string flag, so it arrives as 'true' or 'false' over REST.
54274
+ featured: external_exports.enum(["true", "false"]).optional().transform((value) => value === void 0 ? void 0 : value === "true").describe("true lists only the featured templates"),
54275
+ owner: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/, "owner is a wallet address (0x and 40 hex digits)").optional().describe("Also search this wallet's saved templates, listed after the catalog"),
54276
+ scope: external_exports.enum(WORKFLOW_TEMPLATE_SEARCH_SCOPES).default("all").describe("all: the catalog, then owner's saved templates, or with no owner the templates listed in the gallery; saved: only owner's (needs owner); community: only the gallery's listed templates"),
54277
+ sort: external_exports.enum(WORKFLOW_TEMPLATE_SEARCH_SORTS).default("featured").describe("featured: featured, then other official templates, presets, then saved templates newest first; name: A to Z within the catalog, then saved templates A to Z"),
54278
+ limit: coerceNumber(external_exports.number().int().min(1).max(WORKFLOW_TEMPLATE_SEARCH_LIMIT_MAX)).default(WORKFLOW_TEMPLATE_SEARCH_LIMIT_DEFAULT),
54279
+ cursor: external_exports.string().min(1).max(300).optional().describe("nextCursor from the previous page; valid only with the same filters and sort")
54280
+ });
54281
+ var ProjectWorkflowTemplateSearchOutputSchema = external_exports.object({
54282
+ templates: external_exports.array(ProjectWorkflowTemplateViewSchema),
54283
+ nextCursor: external_exports.string().nullable(),
54284
+ hasMore: external_exports.boolean(),
54285
+ catalogTags: external_exports.array(external_exports.object({ tag: external_exports.string(), count: external_exports.number().int() })).describe("The most used tags across the whole catalog (not this page), for a tag picker; same on every page")
54286
+ });
54232
54287
 
54233
54288
  // ../../packages/shared/dist/schemas/brief-session.schemas.js
54234
54289
  init_cjs_shims();
@@ -54878,6 +54933,11 @@ var TEMPLATE_FIELDS = Object.keys(ProjectScheduleTaskTemplateSchema.innerType().
54878
54933
 
54879
54934
  // ../../packages/shared/dist/lib/workflow-template.js
54880
54935
  init_cjs_shims();
54936
+
54937
+ // ../../packages/shared/dist/lib/workflow-template-search.js
54938
+ init_cjs_shims();
54939
+
54940
+ // ../../packages/shared/dist/lib/workflow-template.js
54881
54941
  var FIXED = new Set(WORKFLOW_TEMPLATE_FIXED_FIELDS);
54882
54942
 
54883
54943
  // ../../packages/shared/dist/lib/workflow-presets.js
@@ -54900,6 +54960,7 @@ var duration = (defaultHours) => ({
54900
54960
  var code = {
54901
54961
  name: "Code: spec, review loop, deploy",
54902
54962
  description: "A spec, then an implementation reviewed and fixed until the review approves it (up to the rounds you set), then your approval, then a deploy.",
54963
+ tags: ["code", "review", "deploy"],
54903
54964
  parameters: {
54904
54965
  brief: {
54905
54966
  type: "string",
@@ -54985,6 +55046,7 @@ var code = {
54985
55046
  var content = {
54986
55047
  name: "Content: articles, then an edit",
54987
55048
  description: "One article per topic you list, written in parallel, then an edit that brings them to one voice and standard.",
55049
+ tags: ["content", "writing", "editing"],
54988
55050
  parameters: {
54989
55051
  articles: {
54990
55052
  type: "list",
@@ -55036,6 +55098,7 @@ var content = {
55036
55098
  var research = {
55037
55099
  name: "Research: parallel sources, then synthesis",
55038
55100
  description: "Papers, the web and data researched at once by separate workers, then a synthesis that answers the question from all three.",
55101
+ tags: ["research", "analysis"],
55039
55102
  parameters: {
55040
55103
  question: {
55041
55104
  type: "string",
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __tmCreateRequire } from 'node:module'; import { fileURLToPath as __tmFileURLToPath } from 'node:url'; import { dirname as __tmDirname } from 'node:path'; const require = __tmCreateRequire(import.meta.url); const __tmFilename = __tmFileURLToPath(import.meta.url); const __tmDirnameValue = __tmDirname(__tmFilename);
2
2
  import {
3
3
  signReadAuth
4
- } from "./chunk-54OR2JDT.js";
5
- import "./chunk-G3U2BQNC.js";
6
- import "./chunk-QAGDCIMU.js";
4
+ } from "./chunk-TKHBDRU6.js";
5
+ import "./chunk-WJHT663R.js";
6
+ import "./chunk-Q3IC6GTF.js";
7
7
  import "./chunk-S7SJMJ2I.js";
8
8
  export {
9
9
  signReadAuth